diff options
-rw-r--r-- | api/current.txt | 10 | ||||
-rw-r--r-- | core/java/android/view/Window.java | 40 | ||||
-rw-r--r-- | core/java/android/view/WindowManager.java | 13 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 29 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/themes.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/themes_quantum.xml | 6 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 18 |
8 files changed, 120 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt index 799221a..7efafb8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -796,7 +796,7 @@ package android { field public static final int manageSpaceActivity = 16842756; // 0x1010004 field public static final int mapViewStyle = 16842890; // 0x101008a field public static final int marqueeRepeatLimit = 16843293; // 0x101021d - field public static final int matchOrder = 16843861; // 0x1010455 + field public static final int matchOrder = 16843859; // 0x1010453 field public static final int max = 16843062; // 0x1010136 field public static final int maxDate = 16843584; // 0x1010340 field public static final int maxEms = 16843095; // 0x1010157 @@ -829,6 +829,7 @@ package android { field public static final int moreIcon = 16843061; // 0x1010135 field public static final int multiprocess = 16842771; // 0x1010013 field public static final int name = 16842755; // 0x1010003 + field public static final int navigationBarColor = 16843862; // 0x1010456 field public static final int navigationMode = 16843471; // 0x10102cf field public static final int negativeButtonText = 16843254; // 0x10101f6 field public static final int nestedScrollingEnabled = 16843835; // 0x101043b @@ -1083,6 +1084,7 @@ package android { field public static final int state_single = 16842915; // 0x10100a3 field public static final int state_window_focused = 16842909; // 0x101009d field public static final int staticWallpaperPreview = 16843569; // 0x1010331 + field public static final int statusBarColor = 16843861; // 0x1010455 field public static final int stepSize = 16843078; // 0x1010146 field public static final int stopWithTask = 16843626; // 0x101036a field public static final int streamType = 16843273; // 0x1010209 @@ -1306,6 +1308,7 @@ package android { field public static final int windowContentTransitionManager = 16843796; // 0x1010414 field public static final int windowContentTransitions = 16843795; // 0x1010413 field public static final int windowDisablePreview = 16843298; // 0x1010222 + field public static final int windowDrawsSystemBarBackgrounds = 16843860; // 0x1010454 field public static final int windowEnableSplitTouch = 16843543; // 0x1010317 field public static final int windowEnterAnimation = 16842932; // 0x10100b4 field public static final int windowEnterTransition = 16843836; // 0x101043c @@ -32559,8 +32562,10 @@ package android.view { method protected final int getForcedWindowFlags(); method public abstract android.view.LayoutInflater getLayoutInflater(); method protected final int getLocalFeatures(); + method public abstract int getNavigationBarColor(); method public android.transition.Transition getSharedElementEnterTransition(); method public android.transition.Transition getSharedElementExitTransition(); + method public abstract int getStatusBarColor(); method public android.transition.TransitionManager getTransitionManager(); method public abstract int getVolumeControlStream(); method public android.view.WindowManager getWindowManager(); @@ -32612,9 +32617,11 @@ package android.view { method public void setLayout(int, int); method public void setLocalFocus(boolean, boolean); method public void setLogo(int); + method public abstract void setNavigationBarColor(int); method public void setSharedElementEnterTransition(android.transition.Transition); method public void setSharedElementExitTransition(android.transition.Transition); method public void setSoftInputMode(int); + method public abstract void setStatusBarColor(int); method public abstract void setTitle(java.lang.CharSequence); method public abstract deprecated void setTitleColor(int); method public void setTransitionManager(android.transition.TransitionManager); @@ -32772,6 +32779,7 @@ package android.view { field public static final int FLAG_DIM_BEHIND = 2; // 0x2 field public static final int FLAG_DISMISS_KEYGUARD = 4194304; // 0x400000 field public static final deprecated int FLAG_DITHER = 4096; // 0x1000 + field public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = -2147483648; // 0x80000000 field public static final int FLAG_FORCE_NOT_FULLSCREEN = 2048; // 0x800 field public static final int FLAG_FULLSCREEN = 1024; // 0x400 field public static final int FLAG_HARDWARE_ACCELERATED = 16777216; // 0x1000000 diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 375f5e3..4acc608 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -1527,4 +1527,44 @@ public abstract class Window { * until the called Activity's exiting transition completes. */ public boolean getAllowExitTransitionOverlap() { return true; } + + /** + * @return the color of the status bar. + */ + public abstract int getStatusBarColor(); + + /** + * Sets the color of the status bar to {@param color}. + * + * For this to take effect, + * the window must be drawing the system bar backgrounds with + * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and + * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS} must not be set. + * + * If {@param color} is not opaque, consider setting + * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and + * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}. + */ + public abstract void setStatusBarColor(int color); + + /** + * @return the color of the navigation bar. + */ + public abstract int getNavigationBarColor(); + + /** + * Sets the color of the navigation bar to {@param color}. + * + * For this to take effect, + * the window must be drawing the system bar backgrounds with + * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and + * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION} must not be set. + * + * If {@param color} is not opaque, consider setting + * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and + * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}. + */ + public abstract void setNavigationBarColor(int color); + + } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 032a82f..031ad80 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -915,6 +915,14 @@ public interface WindowManager extends ViewManager { public static final int FLAG_NEEDS_MENU_KEY = 0x40000000; /** + * Flag indicating that this Window is responsible for drawing the background for the + * system bars. If set, the system bars are drawn with a transparent background and the + * corresponding areas in this window are filled with the colors specified in + * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}. + */ + public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000; + + /** * Various behavioral options/flags. Default is none. * * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON @@ -941,6 +949,7 @@ public interface WindowManager extends ViewManager { * @see #FLAG_SPLIT_TOUCH * @see #FLAG_HARDWARE_ACCELERATED * @see #FLAG_LOCAL_FOCUS_MODE + * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS */ @ViewDebug.ExportedProperty(flagMapping = { @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, @@ -998,7 +1007,9 @@ public interface WindowManager extends ViewManager { @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS, name = "FLAG_TRANSLUCENT_STATUS"), @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION, - name = "FLAG_TRANSLUCENT_NAVIGATION") + name = "FLAG_TRANSLUCENT_NAVIGATION"), + @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, + name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS") }) public int flags; diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index a06a3fd..d490277 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1775,6 +1775,35 @@ finishes. Corresponds to {@link android.view.Window#setAllowExitTransitionOverlap(boolean)}. --> <attr name="windowAllowExitTransitionOverlap"/> + + <!-- Flag indicating whether this Window is responsible for drawing the background for the + system bars. If true and the window is not floating, the system bars are drawn with a + transparent background and the corresponding areas in this window are filled with the + colors specified in {@link android.R.attr#statusBarColor} and + {@link android.R.attr#navigationBarColor}. Corresponds to + {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS}. --> + <attr name="windowDrawsSystemBarBackgrounds" format="boolean" /> + + <!-- The color for the status bar. If the color is not opaque, consider setting + {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and + {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}. + 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 {@link android.view.Window#setStatusBarColor(int)}. --> + <attr name="statusBarColor" format="color" /> + + <!-- The color for the navigation bar. If the color is not opaque, consider setting + {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and + {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}. + For this to take effect, the window must be drawing the system bar backgrounds with + {@link android.R.attr#windowDrawsSystemBarBackgrounds} and the navigation bar must not + have been requested to be translucent with + {@link android.R.attr#windowTranslucentNavigation}. + Corresponds to {@link android.view.Window#setNavigationBarColor(int)}. --> + <attr name="navigationBarColor" format="color" /> + </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 de3a8d0..7cd242b 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2171,6 +2171,9 @@ <public type="attr" name="targetViewName" /> <public type="attr" name="excludeViewName" /> <public type="attr" name="matchOrder" /> + <public type="attr" name="windowDrawsSystemBarBackgrounds" /> + <public type="attr" name="statusBarColor"/> + <public type="attr" name="navigationBarColor"/> <public-padding type="dimen" name="l_resource_pad" end="0x01050010" /> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index 1d9bbae..743ad61 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -189,6 +189,9 @@ please see themes_device_defaults.xml. <item name="windowCloseOnTouchOutside">false</item> <item name="windowTranslucentStatus">false</item> <item name="windowTranslucentNavigation">false</item> + <item name="windowDrawsSystemBarBackgrounds">false</item> + <item name="statusBarColor">@android:color/black</item> + <item name="navigationBarColor">@android:color/black</item> <!-- Define these here; ContextThemeWrappers around themes that define them should always clear these values. --> diff --git a/core/res/res/values/themes_quantum.xml b/core/res/res/values/themes_quantum.xml index f45fbac..ccae90f 100644 --- a/core/res/res/values/themes_quantum.xml +++ b/core/res/res/values/themes_quantum.xml @@ -161,6 +161,9 @@ please see themes_device_defaults.xml. <item name="windowSoftInputMode">stateUnspecified|adjustUnspecified</item> <item name="windowActionBar">true</item> <item name="windowActionModeOverlay">false</item> + <item name="windowDrawsSystemBarBackgrounds">true</item> + <item name="statusBarColor">?attr/colorPrimaryDark</item> + <item name="navigationBarColor">?attr/colorPrimaryDark</item> <!-- Dialog attributes --> <item name="dialogTheme">@style/Theme.Quantum.Dialog</item> @@ -501,6 +504,9 @@ please see themes_device_defaults.xml. <item name="windowSoftInputMode">stateUnspecified|adjustUnspecified</item> <item name="windowActionBar">true</item> <item name="windowActionModeOverlay">false</item> + <item name="windowDrawsSystemBarBackgrounds">true</item> + <item name="statusBarColor">?attr/colorPrimaryDark</item> + <item name="navigationBarColor">?attr/colorPrimaryDark</item> <!-- Dialog attributes --> <item name="dialogTheme">@style/Theme.Quantum.Light.Dialog</item> diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 6341a0c..f6c8001 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -4166,4 +4166,22 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { void sendCloseSystemWindows(String reason) { PhoneWindowManager.sendCloseSystemWindows(getContext(), reason); } + + @Override + public int getStatusBarColor() { + return 0; + } + + @Override + public void setStatusBarColor(int color) { + } + + @Override + public int getNavigationBarColor() { + return 0; + } + + @Override + public void setNavigationBarColor(int color) { + } } |