From 5bcd3189c52423040281a9f52eeaaef08a7db8a5 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Fri, 23 Oct 2015 12:30:28 -0700 Subject: [PATCH] Updated support for drawing background drawable when resizing f3a62fbc58bbc7f081a53248cae48a8951294e8f added support for drawing the background draweable when resizing an activity window. However, after some additional discussion we decided that R.styleable.Window_windowResizingBackground and R.integer.config_windowResizingBackgroundColorARGB are not needed. We use R.styleable.Window_windowBackground for the background drawable and fallback to using R.styleable.Window_windowBackgroundFallback which is now public if the first isn't set. Bug: 24534744 Change-Id: Ia0507e25a1893ea941d259f1d4e88ce500dda154 --- api/current.txt | 2 +- api/system-current.txt | 2 +- .../android/internal/policy/DecorContext.java | 11 ---------- .../android/internal/policy/PhoneWindow.java | 22 ++++--------------- core/res/res/values/attrs.xml | 11 +++------- core/res/res/values/config.xml | 3 --- core/res/res/values/public.xml | 2 +- core/res/res/values/symbols.xml | 2 -- packages/SystemUI/res/values/styles.xml | 1 - 9 files changed, 10 insertions(+), 46 deletions(-) diff --git a/api/current.txt b/api/current.txt index d70317e04a686..818469fd1a760 100644 --- a/api/current.txt +++ b/api/current.txt @@ -1395,6 +1395,7 @@ package android { field public static final int windowAllowReturnTransitionOverlap = 16843835; // 0x101043b field public static final int windowAnimationStyle = 16842926; // 0x10100ae field public static final int windowBackground = 16842836; // 0x1010054 + field public static final int windowBackgroundFallback = 16844035; // 0x1010503 field public static final int windowClipToOutline = 16843947; // 0x10104ab field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b field public static final int windowContentOverlay = 16842841; // 0x1010059 @@ -1420,7 +1421,6 @@ package android { field public static final int windowNoTitle = 16842838; // 0x1010056 field public static final int windowOverscan = 16843727; // 0x10103cf field public static final int windowReenterTransition = 16843951; // 0x10104af - field public static final int windowResizingBackground = 16844035; // 0x1010503 field public static final int windowReturnTransition = 16843950; // 0x10104ae field public static final int windowSharedElementEnterTransition = 16843833; // 0x1010439 field public static final int windowSharedElementExitTransition = 16843834; // 0x101043a diff --git a/api/system-current.txt b/api/system-current.txt index f44065e5a4eec..b6e78dc4555a1 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1491,6 +1491,7 @@ package android { field public static final int windowAllowReturnTransitionOverlap = 16843835; // 0x101043b field public static final int windowAnimationStyle = 16842926; // 0x10100ae field public static final int windowBackground = 16842836; // 0x1010054 + field public static final int windowBackgroundFallback = 16844035; // 0x1010503 field public static final int windowClipToOutline = 16843947; // 0x10104ab field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b field public static final int windowContentOverlay = 16842841; // 0x1010059 @@ -1516,7 +1517,6 @@ package android { field public static final int windowNoTitle = 16842838; // 0x1010056 field public static final int windowOverscan = 16843727; // 0x10103cf field public static final int windowReenterTransition = 16843951; // 0x10104af - field public static final int windowResizingBackground = 16844035; // 0x1010503 field public static final int windowReturnTransition = 16843950; // 0x10104ae field public static final int windowSharedElementEnterTransition = 16843833; // 0x1010439 field public static final int windowSharedElementExitTransition = 16843834; // 0x101043a diff --git a/core/java/com/android/internal/policy/DecorContext.java b/core/java/com/android/internal/policy/DecorContext.java index aa603c123f8bd..4f17c39ddf813 100644 --- a/core/java/com/android/internal/policy/DecorContext.java +++ b/core/java/com/android/internal/policy/DecorContext.java @@ -17,7 +17,6 @@ package com.android.internal.policy; import android.content.Context; -import android.content.res.TypedArray; import android.view.ContextThemeWrapper; import android.view.WindowManager; import android.view.WindowManagerImpl; @@ -31,7 +30,6 @@ import android.view.WindowManagerImpl; class DecorContext extends ContextThemeWrapper { private PhoneWindow mPhoneWindow; private WindowManager mWindowManager; - private TypedArray mWindowStyle; public DecorContext(Context context) { super(context, null); @@ -54,13 +52,4 @@ class DecorContext extends ContextThemeWrapper { } return super.getSystemService(name); } - - public TypedArray getWindowStyle() { - synchronized (this) { - if (mWindowStyle == null) { - mWindowStyle = obtainStyledAttributes(com.android.internal.R.styleable.Window); - } - return mWindowStyle; - } - } } diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 8b81812c45a55..46442110aa108 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -31,7 +31,6 @@ import android.animation.Animator; import android.animation.ObjectAnimator; import android.app.ActivityManagerNative; import android.app.SearchManager; -import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.os.UserHandle; @@ -5438,20 +5437,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { * */ private Drawable getResizingBackgroundDrawable() { final Context context = mDecor.getContext(); - final TypedArray windowStyle; - if (context instanceof DecorContext) { - windowStyle = ((DecorContext) context).getWindowStyle(); - } else { - windowStyle = getWindowStyle(); - } - final int resourceId = - windowStyle.getResourceId(R.styleable.Window_windowResizingBackground, 0); - if (resourceId != 0) { - return context.getDrawable(resourceId); - } - // The app didn't set a resizing background color. In this case we try to use the app's - // background drawable for the resizing background. if (mBackgroundResource != 0) { final Drawable drawable = context.getDrawable(mBackgroundResource); if (drawable != null) { @@ -5459,8 +5445,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } } - // The app background drawable isn't currently set. This might be because the app cleared - // it. In this case we try to use the app's background fallback drawable. if (mBackgroundFallbackResource != 0) { final Drawable fallbackDrawable = context.getDrawable(mBackgroundFallbackResource); if (fallbackDrawable != null) { @@ -5468,7 +5452,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } } - return new ColorDrawable(context.getResources().getInteger( - com.android.internal.R.integer.config_windowResizingBackgroundColorARGB)); + // We shouldn't really get here as the background fallback should be always available since + // it is defaulted by the system. + Log.w(TAG, "Failed to find background drawable for PhoneWindow=" + this); + return null; } } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 8e36eb052ee4c..093ea80950b7e 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -323,14 +323,10 @@ + surface when the app has not drawn any content into this area. One example is + when the user is resizing a window of an activity that has + {@link android.R.attr#resizeableActivity} set for multi-window mode. --> - - @@ -1850,7 +1846,6 @@ i - diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index d20b09fdf4b47..23960e381cf68 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2349,9 +2349,6 @@ is non-interactive. --> true - - 0xFF808080 - diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 839e81b4373a8..c05b585be2984 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2677,7 +2677,7 @@ - + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 6f239e63fe676..b70c0b33f28f9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2332,7 +2332,5 @@ - - diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 8f634e1952f74..8241ddf6a3782 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -36,7 +36,6 @@