完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
—— 即控制 异显功能 能否 使用,以及异显功能是否 启用 控制代码位置: packages/apps/Settings/src/com/android/settings/HdmiSettings.java
以上部分并不是双屏异显的关键 触发异显 控制代码位置: framework/base/core/java/com/android/internal/policy/DecorView.java
方法 1 主要流程:
方法 2 关键步骤:
异显流程 主要就是上一环节中调用的 WMS 的 setOnlyShowInExtendDisplay 控制代码位置: frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java setOnlyShowInExtendDisplay() 主要流程: 1 if (mDisplayContents == null || mDisplayContents.size() <= 1) { return; }
2 final int displayCount = mDisplayContents.size(); DisplayContent defaultContent = getDefaultDisplayContentLocked(); int displayId = 0; DisplayContent secondDisplayContent = null; for (int i = 0; i < displayCount;i++) { final DisplayContent content = mDisplayContents.valueAt(i); if (content != defaultContent) { secondDisplayContent = content; displayId = secondDisplayContent.getDisplayId(); break; } } 3 if(secondDisplayContent == null){ return; } if(!okToDisplay()){ return; } WindowState current = windowForClientLocked(session, client, false); if(isHomeWindow(current)){ return; } AppWindowToken wtoken = current.mAppToken; if(wtoken == null){ return; }
4 int groupId = wtoken.mTask.mTaskId; mH.sendMessage(mH.obtainMessage(H.DO_TASK_DISPLAY_CHANGED, groupId, -1));
moveTransitionToSecondDisplay() 主要流程: 1 if (!isShowDualScreen()) { mSecondTaskIds.clear(); } else { if (mSecondDisplayTaskId != -1) { return; } }
2 Settings.System.putInt(mContext.getContentResolver(), Settings.DUAL_SCREEN_ICON_USED, 0);
3 List try { allTaskIds = mActivityManager.getAllTaskIds(); } catch (Exception e) { if(DEBUG) Log.i(TAG_DUALSCREEN, "WindowManagerService->getAllTaskIds->e:" + e); } if (allTaskIds == null || allTaskIds.size() < 2) return;
4 if(mDisplayContents == null || mDisplayContents.size() <= 1){ return; } final int displayCount = mDisplayContents.size(); DisplayContent defaultContent = getDefaultDisplayContentLocked(); int displayId = 0; DisplayContent secondDisplayContent = null; for(int i = 0; i < displayCount;i++){ final DisplayContent content = mDisplayContents.valueAt(i); if(content != defaultContent){ secondDisplayContent = content; displayId = secondDisplayContent.getDisplayId(); if(DEBUG) Log.d(TAG_DUALSCREEN, "moveTransitionToSecondDisplay->secondDisplayId:" + displayId); break; } } if(secondDisplayContent == null){ return; } if(!okToDisplay()){ return; }
5 SurfaceControl.openTransaction(); WindowState win = null; WindowList defaultWindows = defaultContent.getWindowList();
6 int topTaskId = -1; if (allTaskIds != null && allTaskIds.size() > 0) { topTaskId = allTaskIds.get(0); mSecondTaskIds.add(topTaskId); }
7 for(int i= defaultWindows.size()-1;i>=0;i--){ win = defaultWindows.get(i); if(win == null){ continue; } if (win.mAppToken == null){ continue; } boolean isSurface=false; int windowTaskId=-1; if(win.taskId==-1&&win.mAttachedWindow!=null && win.mAttachedWindow.mAppToken.mTask.mTaskId==topTaskId){ isSurface=true; Log.i("DualScreenIs","isSurface = "+isSurface); } else if(win.mAppToken.mTask == null){ continue; }else{ windowTaskId = win.mAppToken.mTask.mTaskId; } if(windowTaskId == topTaskId||isSurface){ if(DEBUG) Log.i(TAG_DUALSCREEN, "moveTransitionToSecondDisplay->add win:" + win); defaultWindows.remove(win); mTempWindowList.add(win); win.mDisplayContent = secondDisplayContent; if(DEBUG) Log.i(TAG_DUALSCREEN,"win.mDisplayContent = "+win.mDisplayContent+ " secondDisplayContent = "+secondDisplayContent); if(win.mWinAnimator != null){ int layerStack = secondDisplayContent.getDisplay().getLayerStack(); if(win.mWinAnimator.mSurfaceController!= null){ win.mWinAnimator.mSurfaceController.mSurfaceControl.setLayerStack(layerStack); } } secondDisplayAddList.add(0,win); mSecondTopPackageName = win.getOwningPackage(); } }
8 DisplayContent displayContent = getDefaultDisplayContentLocked(); if (displayContent != null) { final DisplayInfo displayInfo = displayContent.getDisplayInfo(); int rotation = 0; if(displayInfo.logicalWidth > displayInfo.logicalHeight) { rotation = Surface.ROTATION_90; } else { rotation = Surface.ROTATION_0; } Settings.System.putInt(mContext.getContentResolver(), Settings.System.USER_ROTATION, rotation); }
9 secondDisplayWindows.clear(); secondDisplayWindows.addAll(secondDisplayAddList);
10 for (int i = 0; i < displayCount; i++) { final DisplayContent content = mDisplayContents.valueAt(i); mLayersController.assignLayersLocked(content.getWindowList()); content.layoutNeeded = true; } 11 mSecondDisplayTaskId = topTaskId; misMovingToSecond = true; Settings.System.putInt(mContext.getContentResolver(), Settings.DUAL_SCREEN_ICON_USED, 1);
12 curMoveTaskId = getLaunchTaskId(); if (curMoveTaskId == -1) { curMoveTaskId = allTaskIds.get(1); } if (DEBUG) Log.i(TAG_DUALSCREEN, "WindowManagerService->curMoveTaskId:" + curMoveTaskId ); switchFocusWindow(curMoveTaskId);
13 updateFocusedWindowLocked(UPDATE_FOCUS_WILL_PLACE_SURFACES, false); mAppTransition.setReady(); mWindowPlacerLocked.performSurfacePlacement();
14 currentTimeout = Settings.System.getLong(mContext.getContentResolver(),Settings.System.SCREEN_OFF_TIMEOUT,3000); Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT,2147483647); Binder.restoreCallingIdentity(origId);
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
【飞凌嵌入式OK3576-C开发板体验】SSH远程登录网络配置及CAN通讯
197 浏览 0 评论
2057 浏览 3 评论
rk1126实现BT601输入,输入不带IIC接口的驱动程序
3829 浏览 0 评论
2340 浏览 1 评论
3577 浏览 3 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-9-30 16:23 , Processed in 0.546330 second(s), Total 70, Slave 54 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号