diff options
-rw-r--r-- | api/current.txt | 2 | ||||
-rw-r--r-- | api/system-current.txt | 2 | ||||
-rw-r--r-- | core/java/android/view/View.java | 14 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 10 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 1 | ||||
-rw-r--r-- | packages/SystemUI/res/values/colors.xml | 1 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 15 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 4 |
8 files changed, 49 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index 269cdf0..de56df1 100644 --- a/api/current.txt +++ b/api/current.txt @@ -1412,6 +1412,7 @@ package android { field public static final int windowExitTransition = 16843832; // 0x1010438 field public static final int windowFrame = 16842837; // 0x1010055 field public static final int windowFullscreen = 16843277; // 0x101020d + field public static final int windowHasLightStatusBar = 16843995; // 0x10104db field public static final int windowHideAnimation = 16842935; // 0x10100b7 field public static final int windowIsFloating = 16842839; // 0x1010057 field public static final int windowIsTranslucent = 16842840; // 0x1010058 @@ -34331,6 +34332,7 @@ package android.view { field public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400 field public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200 field public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100 + field public static final int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 8192; // 0x2000 field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1 field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0 field public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 diff --git a/api/system-current.txt b/api/system-current.txt index 70c2b29..fafe657 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1488,6 +1488,7 @@ package android { field public static final int windowExitTransition = 16843832; // 0x1010438 field public static final int windowFrame = 16842837; // 0x1010055 field public static final int windowFullscreen = 16843277; // 0x101020d + field public static final int windowHasLightStatusBar = 16843995; // 0x10104db field public static final int windowHideAnimation = 16842935; // 0x10100b7 field public static final int windowIsFloating = 16842839; // 0x1010057 field public static final int windowIsTranslucent = 16842840; // 0x1010058 @@ -36533,6 +36534,7 @@ package android.view { field public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400 field public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200 field public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100 + field public static final int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 8192; // 0x2000 field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1 field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0 field public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600 diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 97e1bc0..5a8b265 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2544,6 +2544,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback, public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 0x00001000; /** + * Flag for {@link #setSystemUiVisibility(int)}: Requests the status bar to draw in a mode that + * is compatible with light status bar backgrounds. + * + * <p>For this to take effect, the window must request + * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS + * FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} but not + * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS + * FLAG_TRANSLUCENT_STATUS}. + * + * @see android.R.attr#windowHasLightStatusBar + */ + public static final int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 0x00002000; + + /** * @deprecated Use {@link #SYSTEM_UI_FLAG_LOW_PROFILE} instead. */ public static final int STATUS_BAR_HIDDEN = SYSTEM_UI_FLAG_LOW_PROFILE; diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index d157cdc..3a15b9d 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1952,6 +1952,16 @@ <!-- Whether to clip window content to the outline of the window background. --> <attr name="windowClipToOutline" format="boolean" /> + + <!-- If set, the status bar will be drawn such that it is compatible with a light + status bar background. + <p>For this to take effect, the window must be drawing the system bar backgrounds with + {@link android.R.attr#windowDrawsSystemBarBackgrounds} and the status bar must not + have been requested to be translucent with + {@link android.R.attr#windowTranslucentStatus}. + Corresponds to setting {@link android.view.View#SYSTEM_UI_FLAG_LIGHT_STATUS_BAR} on + the decor view. --> + <attr name="windowHasLightStatusBar" format="boolean" /> </declare-styleable> <!-- The set of attributes that describe a AlertDialog's theme. --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 3bf9631..e2a0ec9 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2613,6 +2613,7 @@ <public type="attr" name="resizeableActivity" /> <public type="attr" name="start" /> <public type="attr" name="end" /> + <public type="attr" name="windowHasLightStatusBar" /> <public type="style" name="Widget.Material.Button.Colored" /> diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index 5cb956f..4c0cea8 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -129,4 +129,5 @@ <color name="segmented_button_selected">#FFFFFFFF</color> <color name="segmented_button_unselected">#B3B0BEC5</color><!-- 70% blue grey 200 --> <color name="volume_panel_divider">#1FFFFFFF</color><!-- 12% white --> + <color name="light_mode_icon_color">#FF616161</color><!-- grey 700 --> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 4ffe9b1..f3ad46e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -49,6 +49,7 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Bitmap; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.PixelFormat; import android.graphics.Point; @@ -225,6 +226,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, /** Allow some time inbetween the long press for back and recents. */ private static final int LOCK_TO_APP_GESTURE_TOLERENCE = 200; + private int mLightModeIconColor; + PhoneStatusBarPolicy mIconPolicy; // These are no longer handled by the policy, because we need custom strategies for them @@ -531,6 +534,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, updateDisplaySize(); mScrimSrcModeEnabled = mContext.getResources().getBoolean( R.bool.config_status_bar_scrim_behind_use_src); + mLightModeIconColor = mContext.getResources().getColor(R.color.light_mode_icon_color, + mContext.getTheme()); + super.start(); // calls createAndAddWindows() mMediaSessionManager @@ -2223,6 +2229,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mSystemUiVisibility &= ~View.NAVIGATION_BAR_UNHIDE; } + if ((diff & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0 || sbModeChanged) { + boolean allowLight = (sbMode == MODE_TRANSPARENT + || sbMode == MODE_LIGHTS_OUT_TRANSPARENT); + boolean light = (vis & View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) != 0; + + mIconController.setIconTint( + (allowLight && light) ? mLightModeIconColor : Color.WHITE); + + } // restore the recents bit if (wasRecentsVisible) { mSystemUiVisibility |= View.RECENT_APPS_VISIBLE; diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 1aa7366..6771988 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -3479,6 +3479,10 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (!mForcedNavigationBarColor) { mNavigationBarColor = a.getColor(R.styleable.Window_navigationBarColor, 0xFF000000); } + if (a.getBoolean(R.styleable.Window_windowHasLightStatusBar, false)) { + decor.setSystemUiVisibility( + decor.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } if (mAlwaysReadCloseOnTouchAttr || getContext().getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { |