Updated support for drawing background drawable when resizing
f3a62fbc58 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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,14 +323,10 @@
|
||||
<attr name="windowBackground" format="reference" />
|
||||
<!-- Drawable to draw selectively within the inset areas when the windowBackground
|
||||
has been set to null. This protects against seeing visual garbage in the
|
||||
surface when the app has not drawn any content into this area. -->
|
||||
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. -->
|
||||
<attr name="windowBackgroundFallback" format="reference" />
|
||||
<!-- Drawable used to fill in areas the app has not rendered content to yet when the user is
|
||||
resizing the window of an activity that has {@link android.R.attr#resizeableActivity}
|
||||
set for multi-window mode. If unset, the system will try to use windowBackground if
|
||||
set, then windowBackgroundFallback if set. Otherwise, the system default resizing
|
||||
background color -->
|
||||
<attr name="windowResizingBackground" format="reference" />
|
||||
<!-- Drawable to use as a frame around the window. -->
|
||||
<attr name="windowFrame" format="reference" />
|
||||
<!-- Flag indicating whether there should be no title on this window. -->
|
||||
@@ -1850,7 +1846,6 @@ i
|
||||
<declare-styleable name="Window">
|
||||
<attr name="windowBackground" />
|
||||
<attr name="windowBackgroundFallback" />
|
||||
<attr name="windowResizingBackground" />
|
||||
<attr name="windowContentOverlay" />
|
||||
<attr name="windowFrame" />
|
||||
<attr name="windowNoTitle" />
|
||||
|
||||
@@ -2349,9 +2349,6 @@
|
||||
is non-interactive. -->
|
||||
<bool name="config_cameraDoubleTapPowerGestureEnabled">true</bool>
|
||||
|
||||
<!-- Default background color to use when resizing a window if the app didn't specify one. -->
|
||||
<integer name="config_windowResizingBackgroundColorARGB">0xFF808080</integer>
|
||||
|
||||
<!-- Name of the component to handle network policy notifications. If present,
|
||||
disables NetworkPolicyManagerService's presentation of data-usage notifications. -->
|
||||
<string translatable="false" name="config_networkPolicyNotificationComponent"></string>
|
||||
|
||||
@@ -2677,7 +2677,7 @@
|
||||
<public type="attr" name="level" />
|
||||
<public type="attr" name="contextPopupMenuStyle" />
|
||||
<public type="attr" name="textAppearancePopupMenuHeader" />
|
||||
<public type="attr" name="windowResizingBackground" />
|
||||
<public type="attr" name="windowBackgroundFallback" />
|
||||
|
||||
<public type="style" name="Theme.Material.DayNight" />
|
||||
<public type="style" name="Theme.Material.DayNight.DarkActionBar" />
|
||||
|
||||
@@ -2332,7 +2332,5 @@
|
||||
|
||||
<java-symbol type="string" name="config_iccHotswapPromptForRestartDialogComponent" />
|
||||
|
||||
<java-symbol type="integer" name="config_windowResizingBackgroundColorARGB" />
|
||||
|
||||
<java-symbol type="string" name="config_packagedKeyboardName" />
|
||||
</resources>
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
<style name="RecentsTheme.Wallpaper">
|
||||
<!-- Wallpaper -->
|
||||
<item name="android:windowBackground">@color/transparent</item>
|
||||
<item name="android:windowResizingBackground">@color/transparent</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user