Loading core/java/android/inputmethodservice/NavigationBarController.java +37 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Insets; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -158,6 +159,8 @@ final class NavigationBarController { @Nullable private ValueAnimator mTintAnimator; private boolean mDrawLegacyNavigationBarBackground; Impl(@NonNull InputMethodService inputMethodService) { mService = inputMethodService; } Loading Loading @@ -226,9 +229,14 @@ final class NavigationBarController { mLastInsets = systemInsets; } if (mDrawLegacyNavigationBarBackground) { mNavigationBarFrame.setBackgroundColor(Color.BLACK); } else { mNavigationBarFrame.setBackground(null); } setIconTintInternal(calculateTargetDarkIntensity(mAppearance)); setIconTintInternal(calculateTargetDarkIntensity(mAppearance, mDrawLegacyNavigationBarBackground)); } private void uninstallNavigationBarFrameIfNecessary() { Loading Loading @@ -478,7 +486,8 @@ final class NavigationBarController { return; } final float targetDarkIntensity = calculateTargetDarkIntensity(mAppearance); final float targetDarkIntensity = calculateTargetDarkIntensity(mAppearance, mDrawLegacyNavigationBarBackground); if (mTintAnimator != null) { mTintAnimator.cancel(); Loading Loading @@ -506,11 +515,33 @@ final class NavigationBarController { } @FloatRange(from = 0.0f, to = 1.0f) private static float calculateTargetDarkIntensity(@Appearance int appearance) { final boolean lightNavBar = (appearance & APPEARANCE_LIGHT_NAVIGATION_BARS) != 0; private static float calculateTargetDarkIntensity(@Appearance int appearance, boolean drawLegacyNavigationBarBackground) { final boolean lightNavBar = !drawLegacyNavigationBarBackground && (appearance & APPEARANCE_LIGHT_NAVIGATION_BARS) != 0; return lightNavBar ? 1.0f : 0.0f; } @Override public boolean onDrawLegacyNavigationBarBackgroundChanged( boolean drawLegacyNavigationBarBackground) { if (mDestroyed) { return false; } if (drawLegacyNavigationBarBackground != mDrawLegacyNavigationBarBackground) { mDrawLegacyNavigationBarBackground = drawLegacyNavigationBarBackground; if (mDrawLegacyNavigationBarBackground) { mNavigationBarFrame.setBackgroundColor(Color.BLACK); } else { mNavigationBarFrame.setBackground(null); } scheduleRelayout(); onSystemBarAppearanceChanged(mAppearance); } return drawLegacyNavigationBarBackground; } @Override public String toDebugString() { return "{mRenderGesturalNavButtons=" + mRenderGesturalNavButtons Loading @@ -518,6 +549,7 @@ final class NavigationBarController { + " mShouldShowImeSwitcherWhenImeIsShown" + mShouldShowImeSwitcherWhenImeIsShown + " mAppearance=0x" + Integer.toHexString(mAppearance) + " mDarkIntensity=" + mDarkIntensity + " mDrawLegacyNavigationBarBackground=" + mDrawLegacyNavigationBarBackground + "}"; } } Loading core/java/android/view/Window.java +28 −0 Original line number Diff line number Diff line Loading @@ -673,6 +673,24 @@ public abstract class Window { * @param appearance The newly applied appearance. */ void onSystemBarAppearanceChanged(@WindowInsetsController.Appearance int appearance); /** * Called from * {@link com.android.internal.policy.DecorView#updateColorViews(WindowInsets, boolean)} * when {@link com.android.internal.policy.DecorView#mDrawLegacyNavigationBarBackground} is * being updated. * * @param drawLegacyNavigationBarBackground the new value that is being set to * {@link com.android.internal.policy.DecorView#mDrawLegacyNavigationBarBackground}. * @return The value to be set to * {@link com.android.internal.policy.DecorView#mDrawLegacyNavigationBarBackgroundHandled} * on behalf of the {@link com.android.internal.policy.DecorView}. * {@code true} to tell that the Window can render the legacy navigation bar * background on behalf of the {@link com.android.internal.policy.DecorView}. * {@code false} to let {@link com.android.internal.policy.DecorView} handle it. */ boolean onDrawLegacyNavigationBarBackgroundChanged( boolean drawLegacyNavigationBarBackground); } /** Loading Loading @@ -1019,6 +1037,16 @@ public abstract class Window { } } /** @hide */ public final boolean onDrawLegacyNavigationBarBackgroundChanged( boolean drawLegacyNavigationBarBackground) { if (mDecorCallback == null) { return false; } return mDecorCallback.onDrawLegacyNavigationBarBackgroundChanged( drawLegacyNavigationBarBackground); } /** * Set a callback for changes of area where caption will draw its content. * Loading core/java/com/android/internal/policy/DecorView.java +6 −2 Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private Insets mBackgroundInsets = Insets.NONE; private Insets mLastBackgroundInsets = Insets.NONE; private boolean mDrawLegacyNavigationBarBackground; private boolean mDrawLegacyNavigationBarBackgroundHandled; private PendingInsetsController mPendingInsetsController = new PendingInsetsController(); Loading Loading @@ -1171,6 +1172,9 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mDrawLegacyNavigationBarBackground = mNavigationColorViewState.visible && (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0; if (oldDrawLegacy != mDrawLegacyNavigationBarBackground) { mDrawLegacyNavigationBarBackgroundHandled = mWindow.onDrawLegacyNavigationBarBackgroundChanged( mDrawLegacyNavigationBarBackground); if (viewRoot != null) { viewRoot.requestInvalidateRootRenderNode(); } Loading Loading @@ -1263,7 +1267,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } if (forceConsumingNavBar) { if (forceConsumingNavBar && !mDrawLegacyNavigationBarBackgroundHandled) { mBackgroundInsets = Insets.of(mLastLeftInset, 0, mLastRightInset, mLastBottomInset); } else { mBackgroundInsets = Insets.NONE; Loading Loading @@ -2488,7 +2492,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } private void drawLegacyNavigationBarBackground(RecordingCanvas canvas) { if (!mDrawLegacyNavigationBarBackground) { if (!mDrawLegacyNavigationBarBackground || mDrawLegacyNavigationBarBackgroundHandled) { return; } View v = mNavigationColorViewState.view; Loading Loading
core/java/android/inputmethodservice/NavigationBarController.java +37 −5 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Insets; import android.graphics.Rect; import android.graphics.Region; Loading Loading @@ -158,6 +159,8 @@ final class NavigationBarController { @Nullable private ValueAnimator mTintAnimator; private boolean mDrawLegacyNavigationBarBackground; Impl(@NonNull InputMethodService inputMethodService) { mService = inputMethodService; } Loading Loading @@ -226,9 +229,14 @@ final class NavigationBarController { mLastInsets = systemInsets; } if (mDrawLegacyNavigationBarBackground) { mNavigationBarFrame.setBackgroundColor(Color.BLACK); } else { mNavigationBarFrame.setBackground(null); } setIconTintInternal(calculateTargetDarkIntensity(mAppearance)); setIconTintInternal(calculateTargetDarkIntensity(mAppearance, mDrawLegacyNavigationBarBackground)); } private void uninstallNavigationBarFrameIfNecessary() { Loading Loading @@ -478,7 +486,8 @@ final class NavigationBarController { return; } final float targetDarkIntensity = calculateTargetDarkIntensity(mAppearance); final float targetDarkIntensity = calculateTargetDarkIntensity(mAppearance, mDrawLegacyNavigationBarBackground); if (mTintAnimator != null) { mTintAnimator.cancel(); Loading Loading @@ -506,11 +515,33 @@ final class NavigationBarController { } @FloatRange(from = 0.0f, to = 1.0f) private static float calculateTargetDarkIntensity(@Appearance int appearance) { final boolean lightNavBar = (appearance & APPEARANCE_LIGHT_NAVIGATION_BARS) != 0; private static float calculateTargetDarkIntensity(@Appearance int appearance, boolean drawLegacyNavigationBarBackground) { final boolean lightNavBar = !drawLegacyNavigationBarBackground && (appearance & APPEARANCE_LIGHT_NAVIGATION_BARS) != 0; return lightNavBar ? 1.0f : 0.0f; } @Override public boolean onDrawLegacyNavigationBarBackgroundChanged( boolean drawLegacyNavigationBarBackground) { if (mDestroyed) { return false; } if (drawLegacyNavigationBarBackground != mDrawLegacyNavigationBarBackground) { mDrawLegacyNavigationBarBackground = drawLegacyNavigationBarBackground; if (mDrawLegacyNavigationBarBackground) { mNavigationBarFrame.setBackgroundColor(Color.BLACK); } else { mNavigationBarFrame.setBackground(null); } scheduleRelayout(); onSystemBarAppearanceChanged(mAppearance); } return drawLegacyNavigationBarBackground; } @Override public String toDebugString() { return "{mRenderGesturalNavButtons=" + mRenderGesturalNavButtons Loading @@ -518,6 +549,7 @@ final class NavigationBarController { + " mShouldShowImeSwitcherWhenImeIsShown" + mShouldShowImeSwitcherWhenImeIsShown + " mAppearance=0x" + Integer.toHexString(mAppearance) + " mDarkIntensity=" + mDarkIntensity + " mDrawLegacyNavigationBarBackground=" + mDrawLegacyNavigationBarBackground + "}"; } } Loading
core/java/android/view/Window.java +28 −0 Original line number Diff line number Diff line Loading @@ -673,6 +673,24 @@ public abstract class Window { * @param appearance The newly applied appearance. */ void onSystemBarAppearanceChanged(@WindowInsetsController.Appearance int appearance); /** * Called from * {@link com.android.internal.policy.DecorView#updateColorViews(WindowInsets, boolean)} * when {@link com.android.internal.policy.DecorView#mDrawLegacyNavigationBarBackground} is * being updated. * * @param drawLegacyNavigationBarBackground the new value that is being set to * {@link com.android.internal.policy.DecorView#mDrawLegacyNavigationBarBackground}. * @return The value to be set to * {@link com.android.internal.policy.DecorView#mDrawLegacyNavigationBarBackgroundHandled} * on behalf of the {@link com.android.internal.policy.DecorView}. * {@code true} to tell that the Window can render the legacy navigation bar * background on behalf of the {@link com.android.internal.policy.DecorView}. * {@code false} to let {@link com.android.internal.policy.DecorView} handle it. */ boolean onDrawLegacyNavigationBarBackgroundChanged( boolean drawLegacyNavigationBarBackground); } /** Loading Loading @@ -1019,6 +1037,16 @@ public abstract class Window { } } /** @hide */ public final boolean onDrawLegacyNavigationBarBackgroundChanged( boolean drawLegacyNavigationBarBackground) { if (mDecorCallback == null) { return false; } return mDecorCallback.onDrawLegacyNavigationBarBackgroundChanged( drawLegacyNavigationBarBackground); } /** * Set a callback for changes of area where caption will draw its content. * Loading
core/java/com/android/internal/policy/DecorView.java +6 −2 Original line number Diff line number Diff line Loading @@ -285,6 +285,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private Insets mBackgroundInsets = Insets.NONE; private Insets mLastBackgroundInsets = Insets.NONE; private boolean mDrawLegacyNavigationBarBackground; private boolean mDrawLegacyNavigationBarBackgroundHandled; private PendingInsetsController mPendingInsetsController = new PendingInsetsController(); Loading Loading @@ -1171,6 +1172,9 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mDrawLegacyNavigationBarBackground = mNavigationColorViewState.visible && (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0; if (oldDrawLegacy != mDrawLegacyNavigationBarBackground) { mDrawLegacyNavigationBarBackgroundHandled = mWindow.onDrawLegacyNavigationBarBackgroundChanged( mDrawLegacyNavigationBarBackground); if (viewRoot != null) { viewRoot.requestInvalidateRootRenderNode(); } Loading Loading @@ -1263,7 +1267,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } if (forceConsumingNavBar) { if (forceConsumingNavBar && !mDrawLegacyNavigationBarBackgroundHandled) { mBackgroundInsets = Insets.of(mLastLeftInset, 0, mLastRightInset, mLastBottomInset); } else { mBackgroundInsets = Insets.NONE; Loading Loading @@ -2488,7 +2492,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } private void drawLegacyNavigationBarBackground(RecordingCanvas canvas) { if (!mDrawLegacyNavigationBarBackground) { if (!mDrawLegacyNavigationBarBackground || mDrawLegacyNavigationBarBackgroundHandled) { return; } View v = mNavigationColorViewState.view; Loading