Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManagerAbstract.java +11 −9 Original line number Diff line number Diff line Loading @@ -140,11 +140,8 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana /** * Whether the layout is eligible to be shown according to the internal state of the subclass. * Returns true by default if subclass doesn't override this method. */ protected boolean eligibleToShowLayout() { return true; } protected abstract boolean eligibleToShowLayout(); @Override public void setConfiguration(Configuration configuration) { Loading Loading @@ -214,8 +211,7 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana boolean layoutDirectionUpdated = mTaskConfig.getLayoutDirection() != prevTaskConfig.getLayoutDirection(); if (boundsUpdated || layoutDirectionUpdated) { // Reposition the UI surfaces. updateSurfacePosition(); updateSurface(); } if (layout != null && layoutDirectionUpdated) { Loading @@ -226,7 +222,6 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana return true; } /** * Updates the visibility of the layout. * Loading @@ -253,8 +248,7 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana displayLayout.getStableBounds(curStableBounds); mDisplayLayout = displayLayout; if (!prevStableBounds.equals(curStableBounds)) { // Stable bounds changed, update UI surface positions. updateSurfacePosition(); updateSurface(); mStableBounds.set(curStableBounds); } } Loading Loading @@ -303,6 +297,14 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana updateSurfacePosition(); } /** * Updates the surface following a change in the task bounds, display layout stable bounds, * or the layout direction. */ protected void updateSurface() { updateSurfacePosition(); } /** * Updates the position of the surface with respect to the task bounds and display layout * stable bounds. Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogLayout.java +0 −13 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ class LetterboxEduDialogLayout extends FrameLayout { // The alpha of a background is a number between 0 (fully transparent) to 255 (fully opaque). // 204 is simply 255 * 0.8. static final int BACKGROUND_DIM_ALPHA = 204; private LetterboxEduWindowManager mWindowManager; private View mDialogContainer; private Drawable mBackgroundDim; Loading @@ -58,10 +56,6 @@ class LetterboxEduDialogLayout extends FrameLayout { super(context, attrs, defStyleAttr, defStyleRes); } void inject(LetterboxEduWindowManager windowManager) { mWindowManager = windowManager; } View getDialogContainer() { return mDialogContainer; } Loading @@ -70,13 +64,6 @@ class LetterboxEduDialogLayout extends FrameLayout { return mBackgroundDim; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // Need to relayout after visibility changes since they affect size. mWindowManager.relayout(); } /** * Register a callback for the dismiss button and background dim. * Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduWindowManager.java +10 −4 Original line number Diff line number Diff line Loading @@ -103,7 +103,6 @@ public class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract { protected View createLayout() { setSeenLetterboxEducation(); mLayout = inflateLayout(); mLayout.inject(this); mAnimationController.startEnterAnimation(mLayout, /* endCallback= */ this::setDismissOnClickListener); Loading Loading @@ -144,16 +143,23 @@ public class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract { return super.updateCompatInfo(taskInfo, taskListener, canShow); } @Override protected void updateSurface() { // We need to relayout because the layout dimensions depend on the task bounds. relayout(); } @Override protected void updateSurfacePosition(Rect taskBounds, Rect stableBounds) { updateSurfacePosition(/* positionX= */ taskBounds.left, /* positionY= */ taskBounds.top); // Nothing to do, since the position of the surface is fixed to the top left corner (0,0) // of the task (parent surface), which is the default position of a surface. } @Override protected WindowManager.LayoutParams getWindowLayoutParams() { final Rect taskBounds = mTaskConfig.windowConfiguration.getBounds(); return getWindowLayoutParams(/* width= */ taskBounds.right - taskBounds.left, /* height= */ taskBounds.bottom - taskBounds.top); return getWindowLayoutParams(/* width= */ taskBounds.width(), /* height= */ taskBounds.height()); } private boolean getHasSeenLetterboxEducation() { Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManagerAbstract.java +11 −9 Original line number Diff line number Diff line Loading @@ -140,11 +140,8 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana /** * Whether the layout is eligible to be shown according to the internal state of the subclass. * Returns true by default if subclass doesn't override this method. */ protected boolean eligibleToShowLayout() { return true; } protected abstract boolean eligibleToShowLayout(); @Override public void setConfiguration(Configuration configuration) { Loading Loading @@ -214,8 +211,7 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana boolean layoutDirectionUpdated = mTaskConfig.getLayoutDirection() != prevTaskConfig.getLayoutDirection(); if (boundsUpdated || layoutDirectionUpdated) { // Reposition the UI surfaces. updateSurfacePosition(); updateSurface(); } if (layout != null && layoutDirectionUpdated) { Loading @@ -226,7 +222,6 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana return true; } /** * Updates the visibility of the layout. * Loading @@ -253,8 +248,7 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana displayLayout.getStableBounds(curStableBounds); mDisplayLayout = displayLayout; if (!prevStableBounds.equals(curStableBounds)) { // Stable bounds changed, update UI surface positions. updateSurfacePosition(); updateSurface(); mStableBounds.set(curStableBounds); } } Loading Loading @@ -303,6 +297,14 @@ public abstract class CompatUIWindowManagerAbstract extends WindowlessWindowMana updateSurfacePosition(); } /** * Updates the surface following a change in the task bounds, display layout stable bounds, * or the layout direction. */ protected void updateSurface() { updateSurfacePosition(); } /** * Updates the position of the surface with respect to the task bounds and display layout * stable bounds. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduDialogLayout.java +0 −13 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ class LetterboxEduDialogLayout extends FrameLayout { // The alpha of a background is a number between 0 (fully transparent) to 255 (fully opaque). // 204 is simply 255 * 0.8. static final int BACKGROUND_DIM_ALPHA = 204; private LetterboxEduWindowManager mWindowManager; private View mDialogContainer; private Drawable mBackgroundDim; Loading @@ -58,10 +56,6 @@ class LetterboxEduDialogLayout extends FrameLayout { super(context, attrs, defStyleAttr, defStyleRes); } void inject(LetterboxEduWindowManager windowManager) { mWindowManager = windowManager; } View getDialogContainer() { return mDialogContainer; } Loading @@ -70,13 +64,6 @@ class LetterboxEduDialogLayout extends FrameLayout { return mBackgroundDim; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); // Need to relayout after visibility changes since they affect size. mWindowManager.relayout(); } /** * Register a callback for the dismiss button and background dim. * Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterboxedu/LetterboxEduWindowManager.java +10 −4 Original line number Diff line number Diff line Loading @@ -103,7 +103,6 @@ public class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract { protected View createLayout() { setSeenLetterboxEducation(); mLayout = inflateLayout(); mLayout.inject(this); mAnimationController.startEnterAnimation(mLayout, /* endCallback= */ this::setDismissOnClickListener); Loading Loading @@ -144,16 +143,23 @@ public class LetterboxEduWindowManager extends CompatUIWindowManagerAbstract { return super.updateCompatInfo(taskInfo, taskListener, canShow); } @Override protected void updateSurface() { // We need to relayout because the layout dimensions depend on the task bounds. relayout(); } @Override protected void updateSurfacePosition(Rect taskBounds, Rect stableBounds) { updateSurfacePosition(/* positionX= */ taskBounds.left, /* positionY= */ taskBounds.top); // Nothing to do, since the position of the surface is fixed to the top left corner (0,0) // of the task (parent surface), which is the default position of a surface. } @Override protected WindowManager.LayoutParams getWindowLayoutParams() { final Rect taskBounds = mTaskConfig.windowConfiguration.getBounds(); return getWindowLayoutParams(/* width= */ taskBounds.right - taskBounds.left, /* height= */ taskBounds.bottom - taskBounds.top); return getWindowLayoutParams(/* width= */ taskBounds.width(), /* height= */ taskBounds.height()); } private boolean getHasSeenLetterboxEducation() { Loading