Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53db21ac authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Use the nav bar color as the scrim color with 80% alpha" into main

parents 91a2c2fc 4f135163
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1876,11 +1876,15 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation

    @Override
    public @Appearance int getSystemBarsAppearance() {
        if (!mHost.isSystemBarsAppearanceControlled()) {
        @Appearance int appearance = mHost.getSystemBarsAppearance();

        // We only return the requested appearance, not the implied one.
            return 0;
        appearance &= ~APPEARANCE_FORCE_LIGHT_NAVIGATION_BARS;
        if (!mHost.isSystemBarsAppearanceControlled()) {
            appearance &= ~COMPATIBLE_APPEARANCE_FLAGS;
        }
        return mHost.getSystemBarsAppearance();

        return appearance;
    }

    @Override
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.view.WindowInsetsController.APPEARANCE_FORCE_LIGHT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
@@ -64,7 +65,11 @@ public class InsetsFlags {
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS,
                    equals = APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS,
                    name = "SEMI_TRANSPARENT_NAVIGATION_BARS")
                    name = "SEMI_TRANSPARENT_NAVIGATION_BARS"),
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_FORCE_LIGHT_NAVIGATION_BARS,
                    equals = APPEARANCE_FORCE_LIGHT_NAVIGATION_BARS,
                    name = "FORCE_LIGHT_NAVIGATION_BARS")
    })
    public @Appearance int appearance;

+2 −1
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import static android.view.ViewRootImplProto.WIDTH;
import static android.view.ViewRootImplProto.WINDOW_ATTRIBUTES;
import static android.view.ViewRootImplProto.WIN_FRAME;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
import static android.view.WindowInsetsController.COMPATIBLE_APPEARANCE_FLAGS;
import static android.view.flags.Flags.sensitiveContentAppProtection;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
@@ -2867,7 +2868,7 @@ public final class ViewRootImpl implements ViewParent,
        final int adjust = inOutParams.softInputMode & SOFT_INPUT_MASK_ADJUST;
        if ((inOutParams.privateFlags & PRIVATE_FLAG_APPEARANCE_CONTROLLED) == 0) {
            inOutParams.insetsFlags.appearance = 0;
            inOutParams.insetsFlags.appearance &= ~COMPATIBLE_APPEARANCE_FLAGS;
            if ((sysUiVis & SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                inOutParams.insetsFlags.appearance |= APPEARANCE_LOW_PROFILE_BARS;
            }
+4 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.view;

import static android.view.InsetsController.DEBUG;
import static android.view.WindowInsetsController.COMPATIBLE_APPEARANCE_FLAGS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_APPEARANCE_CONTROLLED;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_BEHAVIOR_CONTROLLED;

@@ -173,7 +174,9 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host {

    @Override
    public void setSystemBarsAppearance(int appearance, int mask) {
        if ((mask & COMPATIBLE_APPEARANCE_FLAGS) != 0) {
            mViewRoot.mWindowAttributes.privateFlags |= PRIVATE_FLAG_APPEARANCE_CONTROLLED;
        }
        final InsetsFlags insetsFlags = mViewRoot.mWindowAttributes.insetsFlags;
        final int newAppearance = (insetsFlags.appearance & ~mask) | (appearance & mask);
        if (insetsFlags.appearance != newAppearance) {
+25 −4
Original line number Diff line number Diff line
@@ -93,16 +93,37 @@ public interface WindowInsetsController {
    @FlaggedApi(Flags.FLAG_CUSTOMIZABLE_WINDOW_HEADERS)
    int APPEARANCE_LIGHT_CAPTION_BARS = 1 << 8;

    /**
     * Same as {@link #APPEARANCE_LIGHT_NAVIGATION_BARS} but set by the system. The system will
     * respect {@link #APPEARANCE_LIGHT_NAVIGATION_BARS} when this is cleared.
     * @hide
     */
    int APPEARANCE_FORCE_LIGHT_NAVIGATION_BARS = 1 << 9;

    /**
     * Appearance flags that can be implied from system UI flags.
     * @hide
     */
    int COMPATIBLE_APPEARANCE_FLAGS = APPEARANCE_LOW_PROFILE_BARS
            | APPEARANCE_LIGHT_STATUS_BARS
            | APPEARANCE_LIGHT_NAVIGATION_BARS;

    /**
     * Determines the appearance of system bars.
     * @hide
     */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = true, value = {APPEARANCE_OPAQUE_STATUS_BARS, APPEARANCE_OPAQUE_NAVIGATION_BARS,
            APPEARANCE_LOW_PROFILE_BARS, APPEARANCE_LIGHT_STATUS_BARS,
            APPEARANCE_LIGHT_NAVIGATION_BARS, APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS,
    @IntDef(flag = true, value = {
            APPEARANCE_OPAQUE_STATUS_BARS,
            APPEARANCE_OPAQUE_NAVIGATION_BARS,
            APPEARANCE_LOW_PROFILE_BARS,
            APPEARANCE_LIGHT_STATUS_BARS,
            APPEARANCE_LIGHT_NAVIGATION_BARS,
            APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS,
            APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS,
            APPEARANCE_TRANSPARENT_CAPTION_BAR_BACKGROUND, APPEARANCE_LIGHT_CAPTION_BARS})
            APPEARANCE_TRANSPARENT_CAPTION_BAR_BACKGROUND,
            APPEARANCE_LIGHT_CAPTION_BARS,
            APPEARANCE_FORCE_LIGHT_NAVIGATION_BARS})
    @interface Appearance {
    }

Loading