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

Commit 46c592f6 authored by Mariia Sandrikova's avatar Mariia Sandrikova Committed by Automerger Merge Worker
Browse files

Merge "Allow status and navigation bars to be semi-transparent in letterbox...

Merge "Allow status and navigation bars to be semi-transparent in letterbox mode." into sc-dev am: bc1f09bd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13427909

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibb5ad1a50922ce9feb9a995b82cfdc8da74099d1
parents fdf3d39d bc1f09bd
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_STATUS_BARS;
import static android.view.WindowInsetsController.APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS;
import static android.view.WindowInsetsController.BEHAVIOR_DEFAULT;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;

@@ -54,7 +56,15 @@ public class InsetsFlags {
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_LIGHT_NAVIGATION_BARS,
                    equals = APPEARANCE_LIGHT_NAVIGATION_BARS,
                    name = "LIGHT_NAVIGATION_BARS")
                    name = "LIGHT_NAVIGATION_BARS"),
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS,
                    equals = APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS,
                    name = "SEMI_TRANSPARENT_STATUS_BARS"),
            @ViewDebug.FlagToString(
                    mask = APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS,
                    equals = APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS,
                    name = "SEMI_TRANSPARENT_NAVIGATION_BARS")
    })
    public @Appearance int appearance;

+14 −1
Original line number Diff line number Diff line
@@ -66,6 +66,18 @@ public interface WindowInsetsController {
     */
    int APPEARANCE_LIGHT_NAVIGATION_BARS = 1 << 4;

    /**
     * Makes status bars semi-transparent with dark background and light foreground.
     * @hide
     */
    int APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS = 1 << 5;

    /**
     * Makes navigation bars semi-transparent with dark background and light foreground.
     * @hide
     */
    int APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS = 1 << 6;

    /**
     * Determines the appearance of system bars.
     * @hide
@@ -73,7 +85,8 @@ public interface WindowInsetsController {
    @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_LIGHT_NAVIGATION_BARS, APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS,
            APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS})
    @interface Appearance {
    }

+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.InsetsState.containsType;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON;
@@ -994,6 +995,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
            return MODE_LIGHTS_OUT_TRANSPARENT;
        } else if ((appearance & APPEARANCE_OPAQUE_NAVIGATION_BARS) != 0) {
            return MODE_OPAQUE;
        } else if ((appearance & APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS) != 0) {
            return MODE_SEMI_TRANSPARENT;
        } else {
            return MODE_TRANSPARENT;
        }
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static android.view.InsetsState.ITYPE_STATUS_BAR;
import static android.view.InsetsState.containsType;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_STATUS_BARS;
import static android.view.WindowInsetsController.APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS;

import static androidx.lifecycle.Lifecycle.State.RESUMED;

@@ -2430,6 +2431,8 @@ public class StatusBar extends SystemUI implements DemoMode,
            return MODE_LIGHTS_OUT_TRANSPARENT;
        } else if ((appearance & APPEARANCE_OPAQUE_STATUS_BARS) != 0) {
            return MODE_OPAQUE;
        } else if ((appearance & APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS) != 0) {
            return MODE_SEMI_TRANSPARENT;
        } else {
            return MODE_TRANSPARENT;
        }
+3 −6
Original line number Diff line number Diff line
@@ -1431,14 +1431,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    /**
     * @return {@code true} if bar shown within a given rectangle is allowed to be transparent
     * @return {@code true} if bar shown within a given rectangle is allowed to be fully transparent
     *     when the current activity is displayed.
     */
    boolean isTransparentBarAllowed(Rect rect) {
        // TODO(b/175482966): Allow status and navigation bars to be semi-transparent black
        // in letterbox mode.
        return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect)
                || mWmService.isLetterboxActivityCornersRounded();
    boolean isFullyTransparentBarAllowed(Rect rect) {
        return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect);
    }

    /**
Loading