Merge "System Bars: API to ensure contrast when app requested transparent bar" into qt-dev
diff --git a/api/current.txt b/api/current.txt
index 01edc71..ccfc0f5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -571,6 +571,8 @@
     field public static final int endX = 16844050; // 0x1010512
     field public static final int endY = 16844051; // 0x1010513
     field @Deprecated public static final int endYear = 16843133; // 0x101017d
+    field public static final int ensuringNavigationBarContrastWhenTransparent = 16844203; // 0x10105ab
+    field public static final int ensuringStatusBarContrastWhenTransparent = 16844202; // 0x10105aa
     field public static final int enterFadeDuration = 16843532; // 0x101030c
     field public static final int entries = 16842930; // 0x10100b2
     field public static final int entryValues = 16843256; // 0x10101f8
@@ -51781,6 +51783,8 @@
     method public void injectInputEvent(android.view.InputEvent);
     method public abstract void invalidatePanelMenu(int);
     method public final boolean isActive();
+    method public boolean isEnsuringNavigationBarContrastWhenTransparent();
+    method public boolean isEnsuringStatusBarContrastWhenTransparent();
     method public abstract boolean isFloating();
     method public abstract boolean isShortcutKey(int, android.view.KeyEvent);
     method public boolean isWideColorGamut();
@@ -51815,6 +51819,8 @@
     method protected void setDefaultWindowFormat(int);
     method public void setDimAmount(float);
     method public void setElevation(float);
+    method public void setEnsuringNavigationBarContrastWhenTransparent(boolean);
+    method public void setEnsuringStatusBarContrastWhenTransparent(boolean);
     method public void setEnterTransition(android.transition.Transition);
     method public void setExitTransition(android.transition.Transition);
     method public abstract void setFeatureDrawable(int, android.graphics.drawable.Drawable);
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 9079ace..5f972c9 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -4909,10 +4909,11 @@
         final boolean targetPreQ = targetSdk < Build.VERSION_CODES.Q;
         if (!targetPreQ) {
             mTaskDescription.setEnsureStatusBarContrastWhenTransparent(a.getBoolean(
-                    R.styleable.ActivityTaskDescription_ensureStatusBarContrastWhenTransparent,
+                    R.styleable.ActivityTaskDescription_ensuringStatusBarContrastWhenTransparent,
                     false));
             mTaskDescription.setEnsureNavigationBarContrastWhenTransparent(a.getBoolean(
-                    R.styleable.ActivityTaskDescription_ensureNavigationBarContrastWhenTransparent,
+                    R.styleable
+                            .ActivityTaskDescription_ensuringNavigationBarContrastWhenTransparent,
                     true));
         }
 
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index a9463e9..fc9d8c2 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -2340,10 +2340,11 @@
      * <p>When the status bar color has a non-zero alpha value, the value of this
      * property has no effect.
      *
-     * @see android.R.attr#ensureStatusBarContrastWhenTransparent
-     * @hide pending API
+     * @see android.R.attr#ensuringStatusBarContrastWhenTransparent
+     * @see #isEnsuringStatusBarContrastWhenTransparent
+     * @see #setStatusBarColor
      */
-    public void setEnsureStatusBarContrastWhenTransparent(boolean ensureContrast) {
+    public void setEnsuringStatusBarContrastWhenTransparent(boolean ensureContrast) {
     }
 
     /**
@@ -2353,11 +2354,12 @@
      * <p>When the status bar color has a non-zero alpha value, the value of this
      * property has no effect.
      *
-     * @see android.R.attr#ensureStatusBarContrastWhenTransparent
      * @return true, if the system is ensuring contrast, false otherwise.
-     * @hide pending API
+     * @see android.R.attr#ensuringStatusBarContrastWhenTransparent
+     * @see #setEnsuringStatusBarContrastWhenTransparent
+     * @see #setStatusBarColor
      */
-    public boolean isEnsureStatusBarContrastWhenTransparent() {
+    public boolean isEnsuringStatusBarContrastWhenTransparent() {
         return false;
     }
 
@@ -2372,10 +2374,11 @@
      * <p>When the navigation bar color has a non-zero alpha value, the value of this
      * property has no effect.
      *
-     * @see android.R.attr#ensureNavigationBarContrastWhenTransparent
-     * @hide pending API
+     * @see android.R.attr#ensuringNavigationBarContrastWhenTransparent
+     * @see #isEnsuringNavigationBarContrastWhenTransparent
+     * @see #setNavigationBarColor
      */
-    public void setEnsureNavigationBarContrastWhenTransparent(boolean ensureContrast) {
+    public void setEnsuringNavigationBarContrastWhenTransparent(boolean ensureContrast) {
     }
 
     /**
@@ -2386,10 +2389,11 @@
      * property has no effect.
      *
      * @return true, if the system is ensuring contrast, false otherwise.
-     * @see android.R.attr#ensureNavigationBarContrastWhenTransparent
-     * @hide pending API
+     * @see android.R.attr#ensuringNavigationBarContrastWhenTransparent
+     * @see #setEnsuringNavigationBarContrastWhenTransparent
+     * @see #setNavigationBarColor
      */
-    public boolean isEnsureNavigationBarContrastWhenTransparent() {
+    public boolean isEnsuringNavigationBarContrastWhenTransparent() {
         return false;
     }
 
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 16d6c52..fd75f4f 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -2464,9 +2464,9 @@
         }
         if (!targetPreQ) {
             mEnsureStatusBarContrastWhenTransparent = a.getBoolean(
-                    R.styleable.Window_ensureStatusBarContrastWhenTransparent, false);
+                    R.styleable.Window_ensuringStatusBarContrastWhenTransparent, false);
             mEnsureNavigationBarContrastWhenTransparent = a.getBoolean(
-                    R.styleable.Window_ensureNavigationBarContrastWhenTransparent, true);
+                    R.styleable.Window_ensuringNavigationBarContrastWhenTransparent, true);
         }
 
         WindowManager.LayoutParams params = getAttributes();
@@ -3857,7 +3857,7 @@
     }
 
     @Override
-    public void setEnsureStatusBarContrastWhenTransparent(boolean ensureContrast) {
+    public void setEnsuringStatusBarContrastWhenTransparent(boolean ensureContrast) {
         mEnsureStatusBarContrastWhenTransparent = ensureContrast;
         if (mDecor != null) {
             mDecor.updateColorViews(null, false /* animate */);
@@ -3865,12 +3865,12 @@
     }
 
     @Override
-    public boolean isEnsureStatusBarContrastWhenTransparent() {
+    public boolean isEnsuringStatusBarContrastWhenTransparent() {
         return mEnsureStatusBarContrastWhenTransparent;
     }
 
     @Override
-    public void setEnsureNavigationBarContrastWhenTransparent(boolean ensureContrast) {
+    public void setEnsuringNavigationBarContrastWhenTransparent(boolean ensureContrast) {
         mEnsureNavigationBarContrastWhenTransparent = ensureContrast;
         if (mDecor != null) {
             mDecor.updateColorViews(null, false /* animate */);
@@ -3878,7 +3878,7 @@
     }
 
     @Override
-    public boolean isEnsureNavigationBarContrastWhenTransparent() {
+    public boolean isEnsuringNavigationBarContrastWhenTransparent() {
         return mEnsureNavigationBarContrastWhenTransparent;
     }
 
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a510424..ed8f2c1 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2104,9 +2104,8 @@
              <p>If the app does not target at least {@link android.os.Build.VERSION_CODES#Q Q},
              this attribute is ignored.
 
-             @see android.view.Window#setEnsureStatusBarContrastWhenTransparent 
-             @hide pendingAPI -->
-        <attr name="ensureStatusBarContrastWhenTransparent" format="boolean" />
+             @see android.view.Window#setEnsuringStatusBarContrastWhenTransparent -->
+        <attr name="ensuringStatusBarContrastWhenTransparent" format="boolean" />
 
         <!-- Sets whether the system should ensure that the navigation bar has enough
              contrast when a fully transparent background is requested.
@@ -2121,9 +2120,8 @@
              <p>If the app does not target at least {@link android.os.Build.VERSION_CODES#Q Q},
              this attribute is ignored.
 
-             @see android.view.Window#setEnsureNavigationBarContrastWhenTransparent
-             @hide pendingApi -->
-        <attr name="ensureNavigationBarContrastWhenTransparent" format="boolean" />
+             @see android.view.Window#setEnsuringNavigationBarContrastWhenTransparent -->
+        <attr name="ensuringNavigationBarContrastWhenTransparent" format="boolean" />
 
         <!-- The duration, in milliseconds, of the window background fade duration
              when transitioning into or away from an Activity when called with an
@@ -9014,10 +9012,10 @@
         <!-- @hide From Theme.navigationBarColor, used for the TaskDescription navigation bar
                    color. -->
         <attr name="navigationBarColor"/>
-        <!-- @hide From Window.ensureStatusBarContrastWhenTransparent -->
-        <attr name="ensureStatusBarContrastWhenTransparent"/>
-        <!-- @hide From Window.ensureNavigationBarContrastWhenTransparent -->
-        <attr name="ensureNavigationBarContrastWhenTransparent"/>
+        <!-- @hide From Window.ensuringStatusBarContrastWhenTransparent -->
+        <attr name="ensuringStatusBarContrastWhenTransparent"/>
+        <!-- @hide From Window.ensuringNavigationBarContrastWhenTransparent -->
+        <attr name="ensuringNavigationBarContrastWhenTransparent"/>
     </declare-styleable>
 
     <declare-styleable name="Shortcut">
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 58afe33..f27f34a 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3261,7 +3261,7 @@
     <dimen name="config_backGestureInset">0dp</dimen>
 
     <!-- Controls whether the navbar needs a scrim with
-         {@link Window#setEnsureNavigationBarContrastWhenTransparent}. -->
+         {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
     <bool name="config_navBarNeedsScrim">true</bool>
 
     <!-- Default insets [LEFT/RIGHTxTOP/BOTTOM] from the screen edge for picture-in-picture windows.
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 3bbc03f..626518c 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2943,6 +2943,8 @@
         <public name="allowAudioPlaybackCapture"/>
         <public name="secureElementName" />
         <public name="allowExternalStorageSandbox"/>
+        <public name="ensuringStatusBarContrastWhenTransparent" />
+        <public name="ensuringNavigationBarContrastWhenTransparent" />
     </public-group>
 
     <public-group type="drawable" first-id="0x010800b4">
diff --git a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml
index 86fd47b..80fd459 100644
--- a/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml
+++ b/packages/overlays/NavigationBarModeGesturalOverlay/res/values/config.xml
@@ -34,7 +34,7 @@
     <dimen name="config_backGestureInset">20dp</dimen>
 
     <!-- Controls whether the navbar needs a scrim with
-     {@link Window#setEnsureNavigationBarContrastWhenTransparent}. -->
+     {@link Window#setEnsuringNavigationBarContrastWhenTransparent}. -->
     <bool name="config_navBarNeedsScrim">false</bool>
 
 </resources>