Loading core/java/android/window/flags/windowing_frontend.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -51,14 +51,6 @@ flag { is_fixed_read_only: true } flag { name: "action_mode_edge_to_edge" namespace: "windowing_frontend" description: "Make contextual action bar edge-to-edge" bug: "379783298" is_fixed_read_only: true } flag { name: "copy_compat_fields_of_window_insets" namespace: "windowing_frontend" Loading core/java/com/android/internal/policy/DecorView.java +21 −103 Original line number Diff line number Diff line Loading @@ -121,7 +121,6 @@ import com.android.internal.view.menu.MenuHelper; import com.android.internal.widget.ActionBarContextView; import com.android.internal.widget.BackgroundFallback; import com.android.internal.widget.floatingtoolbar.FloatingToolbar; import com.android.window.flags.Flags; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -217,9 +216,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private FloatingToolbar mFloatingToolbar; private ObjectAnimator mFadeAnim; // View added at runtime to draw under the status bar area private View mStatusGuard; private final ColorViewState mStatusColorViewState = new ColorViewState(STATUS_BAR_COLOR_VIEW_ATTRIBUTES); private final ColorViewState mNavigationColorViewState = Loading Loading @@ -1028,11 +1024,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override public void onWindowSystemUiVisibilityChanged(int visible) { updateColorViews(null /* insets */, true /* animate */); if (!Flags.actionModeEdgeToEdge() && mStatusGuard != null && mStatusGuard.getVisibility() == VISIBLE) { updateStatusGuardColor(); } } @Override Loading Loading @@ -1625,8 +1616,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } private WindowInsets updateActionModeInsets(WindowInsets insets) { boolean showStatusGuard = false; // Show the status guard when the non-overlay contextual action bar is showing if (mPrimaryActionModeView != null) { if (mPrimaryActionModeView.getLayoutParams() instanceof MarginLayoutParams) { // Insets are magic! Loading @@ -1643,7 +1632,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind final WindowInsets innerInsets = mWindow.mContentParent.computeSystemWindowInsets(insets, rect); final boolean consumesSystemWindowInsetsTop; if (Flags.actionModeEdgeToEdge()) { final Insets systemWindowInsets = innerInsets.getSystemWindowInsets(); final Insets newMargin = innerInsets.getInsets( WindowInsets.Type.navigationBars()); Loading @@ -1665,56 +1653,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind - newMargin.right, mActionModeViewInternalPaddingBottom); consumesSystemWindowInsetsTop = systemWindowInsets.top > 0; } else { int newTopMargin = innerInsets.getSystemWindowInsetTop(); int newLeftMargin = innerInsets.getSystemWindowInsetLeft(); int newRightMargin = innerInsets.getSystemWindowInsetRight(); // Must use root window insets for the guard, because the color views // consume the navigation bar inset if the window does not request // LAYOUT_HIDE_NAV - but the status guard is attached at the root. WindowInsets rootInsets = getRootWindowInsets(); int newGuardLeftMargin = rootInsets.getSystemWindowInsetLeft(); int newGuardRightMargin = rootInsets.getSystemWindowInsetRight(); if (mlp.topMargin != newTopMargin || mlp.leftMargin != newLeftMargin || mlp.rightMargin != newRightMargin) { mlpChanged = true; mlp.topMargin = newTopMargin; mlp.leftMargin = newLeftMargin; mlp.rightMargin = newRightMargin; } if (newTopMargin > 0 && mStatusGuard == null) { mStatusGuard = new View(mContext); mStatusGuard.setVisibility(GONE); final LayoutParams lp = new LayoutParams(MATCH_PARENT, mlp.topMargin, Gravity.LEFT | Gravity.TOP); lp.leftMargin = newGuardLeftMargin; lp.rightMargin = newGuardRightMargin; addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), lp); } else if (mStatusGuard != null) { final LayoutParams lp = (LayoutParams) mStatusGuard.getLayoutParams(); if (lp.height != mlp.topMargin || lp.leftMargin != newGuardLeftMargin || lp.rightMargin != newGuardRightMargin) { lp.height = mlp.topMargin; lp.leftMargin = newGuardLeftMargin; lp.rightMargin = newGuardRightMargin; mStatusGuard.setLayoutParams(lp); } } // The action mode's theme may differ from the app, so // always show the status guard above it if we have one. showStatusGuard = mStatusGuard != null; if (showStatusGuard && mStatusGuard.getVisibility() != VISIBLE) { // If it wasn't previously shown, the color may be stale updateStatusGuardColor(); } consumesSystemWindowInsetsTop = showStatusGuard; } // We only need to consume the insets if the action // mode is overlaid on the app content (e.g. it's Loading @@ -1725,34 +1663,15 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (nonOverlay && consumesSystemWindowInsetsTop) { insets = insets.inset(0, insets.getSystemWindowInsetTop(), 0, 0); } } else { if (!Flags.actionModeEdgeToEdge()) { // reset top margin if (mlp.topMargin != 0 || mlp.leftMargin != 0 || mlp.rightMargin != 0) { mlpChanged = true; mlp.topMargin = 0; } } } if (mlpChanged) { mPrimaryActionModeView.setLayoutParams(mlp); } } } if (!Flags.actionModeEdgeToEdge() && mStatusGuard != null) { mStatusGuard.setVisibility(showStatusGuard ? VISIBLE : GONE); } return insets; } private void updateStatusGuardColor() { boolean lightStatusBar = (getWindowSystemUiVisibility() & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0; mStatusGuard.setBackgroundColor(lightStatusBar ? mContext.getColor(R.color.decor_view_status_guard_light) : mContext.getColor(R.color.decor_view_status_guard)); } /** * Overrides the view outline when the activity enters picture-in-picture to ensure that it has * an opaque shadow even if the window background is completely transparent. This only applies Loading Loading @@ -2251,8 +2170,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind void clearContentView() { for (int i = getChildCount() - 1; i >= 0; i--) { View v = getChildAt(i); if (v != mStatusColorViewState.view && v != mNavigationColorViewState.view && (Flags.actionModeEdgeToEdge() || v != mStatusGuard)) { if (v != mStatusColorViewState.view && v != mNavigationColorViewState.view) { removeViewAt(i); } } Loading core/java/com/android/internal/widget/ActionBarContextView.java +1 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import android.widget.TextView; import com.android.internal.R; import com.android.internal.view.menu.MenuBuilder; import com.android.window.flags.Flags; /** * @hide Loading Loading @@ -338,9 +337,7 @@ public class ActionBarContextView extends AbsActionBarView { final int verticalPadding = getPaddingTop() + getPaddingBottom(); final int externalVerticalPadding = Math.max(0, verticalPadding - mInternalVerticalPadding); final int maxHeight = mContentHeight > 0 ? Flags.actionModeEdgeToEdge() ? mContentHeight + externalVerticalPadding : mContentHeight : MeasureSpec.getSize(heightMeasureSpec); final int height = maxHeight - verticalPadding; final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST); Loading core/tests/coretests/src/com/android/internal/widget/ActionBarContextViewTest.java +1 −6 Original line number Diff line number Diff line Loading @@ -24,8 +24,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import androidx.test.rule.ActivityTestRule; import com.android.window.flags.Flags; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -70,10 +68,7 @@ public class ActionBarContextViewTest { View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(2000, View.MeasureSpec.AT_MOST)); // Flags.actionModeEdgeToEdge() enabled: // 210 = 200 (content height) + 5 (external top padding) + 5 (external bottom padding) // Flags.actionModeEdgeToEdge() disabled: // If content height is greater than 0, the measured height should be content height (200). assertEquals(Flags.actionModeEdgeToEdge() ? 210 : 200, view.getMeasuredHeight()); assertEquals(210, view.getMeasuredHeight()); } } Loading
core/java/android/window/flags/windowing_frontend.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -51,14 +51,6 @@ flag { is_fixed_read_only: true } flag { name: "action_mode_edge_to_edge" namespace: "windowing_frontend" description: "Make contextual action bar edge-to-edge" bug: "379783298" is_fixed_read_only: true } flag { name: "copy_compat_fields_of_window_insets" namespace: "windowing_frontend" Loading
core/java/com/android/internal/policy/DecorView.java +21 −103 Original line number Diff line number Diff line Loading @@ -121,7 +121,6 @@ import com.android.internal.view.menu.MenuHelper; import com.android.internal.widget.ActionBarContextView; import com.android.internal.widget.BackgroundFallback; import com.android.internal.widget.floatingtoolbar.FloatingToolbar; import com.android.window.flags.Flags; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -217,9 +216,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private FloatingToolbar mFloatingToolbar; private ObjectAnimator mFadeAnim; // View added at runtime to draw under the status bar area private View mStatusGuard; private final ColorViewState mStatusColorViewState = new ColorViewState(STATUS_BAR_COLOR_VIEW_ATTRIBUTES); private final ColorViewState mNavigationColorViewState = Loading Loading @@ -1028,11 +1024,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override public void onWindowSystemUiVisibilityChanged(int visible) { updateColorViews(null /* insets */, true /* animate */); if (!Flags.actionModeEdgeToEdge() && mStatusGuard != null && mStatusGuard.getVisibility() == VISIBLE) { updateStatusGuardColor(); } } @Override Loading Loading @@ -1625,8 +1616,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } private WindowInsets updateActionModeInsets(WindowInsets insets) { boolean showStatusGuard = false; // Show the status guard when the non-overlay contextual action bar is showing if (mPrimaryActionModeView != null) { if (mPrimaryActionModeView.getLayoutParams() instanceof MarginLayoutParams) { // Insets are magic! Loading @@ -1643,7 +1632,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind final WindowInsets innerInsets = mWindow.mContentParent.computeSystemWindowInsets(insets, rect); final boolean consumesSystemWindowInsetsTop; if (Flags.actionModeEdgeToEdge()) { final Insets systemWindowInsets = innerInsets.getSystemWindowInsets(); final Insets newMargin = innerInsets.getInsets( WindowInsets.Type.navigationBars()); Loading @@ -1665,56 +1653,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind - newMargin.right, mActionModeViewInternalPaddingBottom); consumesSystemWindowInsetsTop = systemWindowInsets.top > 0; } else { int newTopMargin = innerInsets.getSystemWindowInsetTop(); int newLeftMargin = innerInsets.getSystemWindowInsetLeft(); int newRightMargin = innerInsets.getSystemWindowInsetRight(); // Must use root window insets for the guard, because the color views // consume the navigation bar inset if the window does not request // LAYOUT_HIDE_NAV - but the status guard is attached at the root. WindowInsets rootInsets = getRootWindowInsets(); int newGuardLeftMargin = rootInsets.getSystemWindowInsetLeft(); int newGuardRightMargin = rootInsets.getSystemWindowInsetRight(); if (mlp.topMargin != newTopMargin || mlp.leftMargin != newLeftMargin || mlp.rightMargin != newRightMargin) { mlpChanged = true; mlp.topMargin = newTopMargin; mlp.leftMargin = newLeftMargin; mlp.rightMargin = newRightMargin; } if (newTopMargin > 0 && mStatusGuard == null) { mStatusGuard = new View(mContext); mStatusGuard.setVisibility(GONE); final LayoutParams lp = new LayoutParams(MATCH_PARENT, mlp.topMargin, Gravity.LEFT | Gravity.TOP); lp.leftMargin = newGuardLeftMargin; lp.rightMargin = newGuardRightMargin; addView(mStatusGuard, indexOfChild(mStatusColorViewState.view), lp); } else if (mStatusGuard != null) { final LayoutParams lp = (LayoutParams) mStatusGuard.getLayoutParams(); if (lp.height != mlp.topMargin || lp.leftMargin != newGuardLeftMargin || lp.rightMargin != newGuardRightMargin) { lp.height = mlp.topMargin; lp.leftMargin = newGuardLeftMargin; lp.rightMargin = newGuardRightMargin; mStatusGuard.setLayoutParams(lp); } } // The action mode's theme may differ from the app, so // always show the status guard above it if we have one. showStatusGuard = mStatusGuard != null; if (showStatusGuard && mStatusGuard.getVisibility() != VISIBLE) { // If it wasn't previously shown, the color may be stale updateStatusGuardColor(); } consumesSystemWindowInsetsTop = showStatusGuard; } // We only need to consume the insets if the action // mode is overlaid on the app content (e.g. it's Loading @@ -1725,34 +1663,15 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (nonOverlay && consumesSystemWindowInsetsTop) { insets = insets.inset(0, insets.getSystemWindowInsetTop(), 0, 0); } } else { if (!Flags.actionModeEdgeToEdge()) { // reset top margin if (mlp.topMargin != 0 || mlp.leftMargin != 0 || mlp.rightMargin != 0) { mlpChanged = true; mlp.topMargin = 0; } } } if (mlpChanged) { mPrimaryActionModeView.setLayoutParams(mlp); } } } if (!Flags.actionModeEdgeToEdge() && mStatusGuard != null) { mStatusGuard.setVisibility(showStatusGuard ? VISIBLE : GONE); } return insets; } private void updateStatusGuardColor() { boolean lightStatusBar = (getWindowSystemUiVisibility() & SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0; mStatusGuard.setBackgroundColor(lightStatusBar ? mContext.getColor(R.color.decor_view_status_guard_light) : mContext.getColor(R.color.decor_view_status_guard)); } /** * Overrides the view outline when the activity enters picture-in-picture to ensure that it has * an opaque shadow even if the window background is completely transparent. This only applies Loading Loading @@ -2251,8 +2170,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind void clearContentView() { for (int i = getChildCount() - 1; i >= 0; i--) { View v = getChildAt(i); if (v != mStatusColorViewState.view && v != mNavigationColorViewState.view && (Flags.actionModeEdgeToEdge() || v != mStatusGuard)) { if (v != mStatusColorViewState.view && v != mNavigationColorViewState.view) { removeViewAt(i); } } Loading
core/java/com/android/internal/widget/ActionBarContextView.java +1 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import android.widget.TextView; import com.android.internal.R; import com.android.internal.view.menu.MenuBuilder; import com.android.window.flags.Flags; /** * @hide Loading Loading @@ -338,9 +337,7 @@ public class ActionBarContextView extends AbsActionBarView { final int verticalPadding = getPaddingTop() + getPaddingBottom(); final int externalVerticalPadding = Math.max(0, verticalPadding - mInternalVerticalPadding); final int maxHeight = mContentHeight > 0 ? Flags.actionModeEdgeToEdge() ? mContentHeight + externalVerticalPadding : mContentHeight : MeasureSpec.getSize(heightMeasureSpec); final int height = maxHeight - verticalPadding; final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST); Loading
core/tests/coretests/src/com/android/internal/widget/ActionBarContextViewTest.java +1 −6 Original line number Diff line number Diff line Loading @@ -24,8 +24,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import androidx.test.rule.ActivityTestRule; import com.android.window.flags.Flags; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -70,10 +68,7 @@ public class ActionBarContextViewTest { View.MeasureSpec.makeMeasureSpec(1000, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(2000, View.MeasureSpec.AT_MOST)); // Flags.actionModeEdgeToEdge() enabled: // 210 = 200 (content height) + 5 (external top padding) + 5 (external bottom padding) // Flags.actionModeEdgeToEdge() disabled: // If content height is greater than 0, the measured height should be content height (200). assertEquals(Flags.actionModeEdgeToEdge() ? 210 : 200, view.getMeasuredHeight()); assertEquals(210, view.getMeasuredHeight()); } }