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

Commit 86905582 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Handle light status bar for split-screen

In split-screen the light status bar flag for one side of the
status bar can be different from the other side.
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR is now reported for both
the fullscreen stack and docked stack, but not anymore in the
"default" SysUI visibility field when reporting a visibility
change to SystemUI. The change also reports the docked stack
and the fullscreen stack bounds, so SystemUI can guard tinting
the icons on whether the icon is one of the areas.

When calculating the light status bar flag in PWM, we keep track
of the top fullscreen opaque window state for the docked and
fullscreen stack separately.

Bug: 24365214
Change-Id: Id2240a86d75bf96e0138ec7652a4793859f56e3c
parent 7cd1f0d3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -632,6 +632,17 @@ public class ActivityManager {
        public static boolean useWindowFrameForBackdrop(int stackId) {
            return stackId == FREEFORM_WORKSPACE_STACK_ID || stackId == PINNED_STACK_ID;
        }

        /**
         * Returns true if a window from the specified stack with {@param stackId} are normally
         * fullscreen, i. e. they can become the top opaque fullscreen window, meaning that it
         * controls system bars, lockscreen occluded/dismissing state, screen rotation animation,
         * etc.
         */
        public static boolean normallyFullscreenWindows(int stackId) {
            return stackId != PINNED_STACK_ID && stackId != FREEFORM_WORKSPACE_STACK_ID
                    && stackId != DOCKED_STACK_ID;
        }
    }

    /**
+12 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.view;

import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.app.ActivityManager.StackId;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.CompatibilityInfo;
@@ -388,6 +389,12 @@ public interface WindowManagerPolicy {
         * Check whether the window is currently dimming.
         */
        public boolean isDimming();

        /**
         * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if
         *         not attached to any stack.
         */
        int getStackId();
    }

    /**
@@ -465,6 +472,11 @@ public interface WindowManagerPolicy {
         * @return The content insets of the docked divider window.
         */
        int getDockedDividerInsetsLw();

        /**
         * Retrieves the {@param outBounds} from the stack with id {@param stackId}.
         */
        void getStackBounds(int stackId, Rect outBounds);
    }

    public interface PointerEventListener {
+18 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.statusbar;

import android.content.ComponentName;
import android.graphics.Rect;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;

@@ -31,7 +32,23 @@ oneway interface IStatusBar
    void animateExpandNotificationsPanel();
    void animateExpandSettingsPanel(String subPanel);
    void animateCollapsePanels();
    void setSystemUiVisibility(int vis, int mask);

    /**
     * Notifies the status bar of a System UI visibility flag change.
     *
     * @param vis the visibility flags except SYSTEM_UI_FLAG_LIGHT_STATUS_BAR which will be reported
     *            separately in fullscreenStackVis and dockedStackVis
     * @param fullscreenStackVis the flags which only apply in the region of the fullscreen stack,
     *                           which is currently only SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
     * @param dockedStackVis the flags that only apply in the region of the docked stack, which is
     *                       currently only SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
     * @param mask which flags to change
     * @param fullscreenBounds the current bounds of the fullscreen stack, in screen coordinates
     * @param dockedBounds the current bounds of the docked stack, in screen coordinates
     */
    void setSystemUiVisibility(int vis, int fullscreenStackVis, int dockedStackVis, int mask,
            in Rect fullscreenBounds, in Rect dockedBounds);

    void topAppWindowChanged(boolean menuVisible);
    void setImeWindowStatus(in IBinder token, int vis, int backDisposition,
            boolean showImeSwitcher);
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.statusbar;

import android.content.ComponentName;
import android.graphics.Rect;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;

@@ -37,7 +38,6 @@ interface IStatusBarService
    void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
    void setIconVisibility(String slot, boolean visible);
    void removeIcon(String slot);
    void topAppWindowChanged(boolean menuVisible);
    void setImeWindowStatus(in IBinder token, int vis, int backDisposition,
            boolean showImeSwitcher);
    void expandSettingsPanel(String subPanel);
@@ -47,7 +47,8 @@ interface IStatusBarService
    // You need the STATUS_BAR_SERVICE permission
    void registerStatusBar(IStatusBar callbacks, out List<String> iconSlots,
            out List<StatusBarIcon> iconList,
            out int[] switches, out List<IBinder> binders);
            out int[] switches, out List<IBinder> binders, out Rect fullscreenStackBounds,
            out Rect dockedStackBounds);
    void onPanelRevealed(boolean clearNotificationEffects, int numItems);
    void onPanelHidden();
    // Mark current notifications as "seen" and stop ringing, vibrating, blinking.
+5 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public class BatteryMeterDrawable extends Drawable implements DemoMode,
            mPlusPaint;
    private float mTextHeight, mWarningTextHeight;
    private int mIconTint = Color.WHITE;
    private float mOldDarkIntensity = 0f;

    private int mHeight;
    private int mWidth;
@@ -295,6 +296,9 @@ public class BatteryMeterDrawable extends Drawable implements DemoMode,
    }

    public void setDarkIntensity(float darkIntensity) {
        if (darkIntensity == mOldDarkIntensity) {
            return;
        }
        int backgroundColor = getBackgroundColor(darkIntensity);
        int fillColor = getFillColor(darkIntensity);
        mIconTint = fillColor;
@@ -302,6 +306,7 @@ public class BatteryMeterDrawable extends Drawable implements DemoMode,
        mBoltPaint.setColor(fillColor);
        mChargeColor = fillColor;
        invalidateSelf();
        mOldDarkIntensity = darkIntensity;
    }

    private int getBackgroundColor(float darkIntensity) {
Loading