publicvoidupdateViewLayout(View view, ViewGroup.LayoutParams params) { if (view == null) { thrownewIllegalArgumentException("view must not be null"); } if (!(params instanceof WindowManager.LayoutParams)) { thrownewIllegalArgumentException("Params must be WindowManager.LayoutParams"); }
final WindowManager.LayoutParamswparams= (WindowManager.LayoutParams)params;
relayout(IWindow window, int seq, WindowManager.LayoutParams attrs … )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
publicintrelayout(IWindow window, int seq, WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewFlags, int flags, Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, Rect outVisibleInsets, Rect outStableInsets, Rect outsets, Rect outBackdropFrame, Configuration outConfig, Surface outSurface) { if (false) Slog.d(TAG_WM, ">>>>>> ENTERED relayout from " + Binder.getCallingPid()); intres= mService.relayoutWindow(this, window, seq, attrs, requestedWidth, requestedHeight, viewFlags, flags, outFrame, outOverscanInsets, outContentInsets, outVisibleInsets, outStableInsets, outsets, outBackdropFrame, outConfig, outSurface); if (false) Slog.d(TAG_WM, "<<<<<< EXITING relayout to " + Binder.getCallingPid()); return res; }
publicintrelayoutWindow(Session session, IWindow client, int seq, WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, Rect outVisibleInsets, Rect outStableInsets, Rect outOutsets, Rect outBackdropFrame, Configuration outConfig, Surface outSurface) { intresult=0; boolean configChanged; booleanhasStatusBarPermission= mContext.checkCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR) == PackageManager.PERMISSION_GRANTED;
booleantoBeDisplayed= (result & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0; if (imMayMove && (moveInputMethodWindowsIfNeededLocked(false) || toBeDisplayed)) { // Little hack here -- we -should- be able to rely on the // function to return true if the IME has moved and needs // its layer recomputed. However, if the IME was hidden // and isn't actually moved in the list, its layer may be // out of data so we make sure to recompute it. // 如果窗口排序有改动,那么为 DisplayContent 的所有窗口分配最终的显示次序 mLayersController.assignLayersLocked(win.getWindowList()); } ... // 更新 window 后设置一些变量