summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/Activity.java9
-rw-r--r--core/java/android/view/Window.java7
-rw-r--r--core/java/com/android/internal/policy/PhoneWindow.java1
3 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 4a8649545fc3..38df17b92644 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -5535,6 +5535,15 @@ public class Activity extends ContextThemeWrapper
}
a.recycle();
+ if (first && mTaskDescription.getSystemBarsAppearance() == 0
+ && mWindow != null && mWindow.getSystemBarAppearance() != 0) {
+ // When the theme is applied for the first time during the activity re-creation process,
+ // the attached window restores the system bars appearance from the old window/activity.
+ // Make sure to restore this appearance in TaskDescription too, to prevent the
+ // #setTaskDescription() call below from incorrectly sending an empty value to the
+ // server.
+ mTaskDescription.setSystemBarsAppearance(mWindow.getSystemBarAppearance());
+ }
setTaskDescription(mTaskDescription);
}
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index 1e2d95d639c5..51229a75edf8 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -1038,6 +1038,11 @@ public abstract class Window {
}
/** @hide */
+ public final void setSystemBarAppearance(@WindowInsetsController.Appearance int appearance) {
+ mSystemBarAppearance = appearance;
+ }
+
+ /** @hide */
@WindowInsetsController.Appearance
public final int getSystemBarAppearance() {
return mSystemBarAppearance;
@@ -1046,7 +1051,7 @@ public abstract class Window {
/** @hide */
public final void dispatchOnSystemBarAppearanceChanged(
@WindowInsetsController.Appearance int appearance) {
- mSystemBarAppearance = appearance;
+ setSystemBarAppearance(appearance);
if (mDecorCallback != null) {
mDecorCallback.onSystemBarAppearanceChanged(appearance);
}
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index 0dd01e48db0a..2f1d654c8b37 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -406,6 +406,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
mElevation = preservedWindow.getElevation();
mLoadElevation = false;
mForceDecorInstall = true;
+ setSystemBarAppearance(preservedWindow.getSystemBarAppearance());
// If we're preserving window, carry over the app token from the preserved
// window, as we'll be skipping the addView in handleResumeActivity(), and
// the token will not be updated as for a new window.