Loading core/java/com/android/internal/policy/DecorView.java +32 −8 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Shader; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.RemoteException; import android.util.DisplayMetrics; Loading Loading @@ -907,10 +908,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (getBackground() != drawable) { setBackgroundDrawable(drawable); if (drawable != null) { mResizingBackgroundDrawable = drawable; mResizingBackgroundDrawable = enforceNonTranslucentBackground(drawable, mWindow.isTranslucent() || mWindow.isShowingWallpaper()); } else { mResizingBackgroundDrawable = getResizingBackgroundDrawable( getContext(), 0, mWindow.mBackgroundFallbackResource); getContext(), 0, mWindow.mBackgroundFallbackResource, mWindow.isTranslucent() || mWindow.isShowingWallpaper()); } if (mResizingBackgroundDrawable != null) { mResizingBackgroundDrawable.getPadding(mBackgroundPadding); Loading Loading @@ -1785,7 +1788,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private void loadBackgroundDrawablesIfNeeded() { if (mResizingBackgroundDrawable == null) { mResizingBackgroundDrawable = getResizingBackgroundDrawable(getContext(), mWindow.mBackgroundResource, mWindow.mBackgroundFallbackResource); mWindow.mBackgroundResource, mWindow.mBackgroundFallbackResource, mWindow.isTranslucent() || mWindow.isShowingWallpaper()); if (mResizingBackgroundDrawable == null) { // We shouldn't really get here as the background fallback should be always // available since it is defaulted by the system. Loading Loading @@ -1893,21 +1897,41 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind * user is resizing the window of an activity in multi-window mode. */ public static Drawable getResizingBackgroundDrawable(Context context, int backgroundRes, int backgroundFallbackRes) { int backgroundFallbackRes, boolean windowTranslucent) { if (backgroundRes != 0) { final Drawable drawable = context.getDrawable(backgroundRes); if (drawable != null) { return drawable; return enforceNonTranslucentBackground(drawable, windowTranslucent); } } if (backgroundFallbackRes != 0) { final Drawable fallbackDrawable = context.getDrawable(backgroundFallbackRes); if (fallbackDrawable != null) { return fallbackDrawable; return enforceNonTranslucentBackground(fallbackDrawable, windowTranslucent); } } return null; return new ColorDrawable(Color.BLACK); } /** * Enforces a drawable to be non-translucent to act as a background if needed, i.e. if the * window is not translucent. */ private static Drawable enforceNonTranslucentBackground(Drawable drawable, boolean windowTranslucent) { if (!windowTranslucent && drawable instanceof ColorDrawable) { ColorDrawable colorDrawable = (ColorDrawable) drawable; int color = colorDrawable.getColor(); if (Color.alpha(color) != 255) { ColorDrawable copy = (ColorDrawable) colorDrawable.getConstantState().newDrawable() .mutate(); copy.setColor( Color.argb(255, Color.red(color), Color.green(color), Color.blue(color))); return copy; } } return drawable; } /** Loading Loading @@ -2037,7 +2061,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private void drawResizingShadowIfNeeded(DisplayListCanvas canvas) { if (mResizeMode != RESIZE_MODE_DOCKED_DIVIDER || mWindow.mIsFloating || mWindow.isTranslucent() || (mWindow.getAttributes().flags & FLAG_SHOW_WALLPAPER) != 0) { || mWindow.isShowingWallpaper()) { return; } canvas.save(); Loading core/java/com/android/internal/policy/PhoneWindow.java +7 −0 Original line number Diff line number Diff line Loading @@ -508,6 +508,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { return mIsTranslucent; } /** * @return Whether the window is currently showing the wallpaper. */ boolean isShowingWallpaper() { return (getAttributes().flags & FLAG_SHOW_WALLPAPER) != 0; } /** * Return a LayoutInflater instance that can be used to inflate XML view layout * resources for use in this Window. Loading core/res/res/values/themes.xml +0 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,6 @@ please see themes_device_defaults.xml. <!-- Window attributes --> <item name="windowBackground">@drawable/screen_background_selector_dark</item> <item name="windowBackgroundFallback">?attr/colorBackground</item> <item name="windowClipToOutline">false</item> <item name="windowFrame">@null</item> <item name="windowNoTitle">false</item> Loading Loading
core/java/com/android/internal/policy/DecorView.java +32 −8 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Shader; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.RemoteException; import android.util.DisplayMetrics; Loading Loading @@ -907,10 +908,12 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind if (getBackground() != drawable) { setBackgroundDrawable(drawable); if (drawable != null) { mResizingBackgroundDrawable = drawable; mResizingBackgroundDrawable = enforceNonTranslucentBackground(drawable, mWindow.isTranslucent() || mWindow.isShowingWallpaper()); } else { mResizingBackgroundDrawable = getResizingBackgroundDrawable( getContext(), 0, mWindow.mBackgroundFallbackResource); getContext(), 0, mWindow.mBackgroundFallbackResource, mWindow.isTranslucent() || mWindow.isShowingWallpaper()); } if (mResizingBackgroundDrawable != null) { mResizingBackgroundDrawable.getPadding(mBackgroundPadding); Loading Loading @@ -1785,7 +1788,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private void loadBackgroundDrawablesIfNeeded() { if (mResizingBackgroundDrawable == null) { mResizingBackgroundDrawable = getResizingBackgroundDrawable(getContext(), mWindow.mBackgroundResource, mWindow.mBackgroundFallbackResource); mWindow.mBackgroundResource, mWindow.mBackgroundFallbackResource, mWindow.isTranslucent() || mWindow.isShowingWallpaper()); if (mResizingBackgroundDrawable == null) { // We shouldn't really get here as the background fallback should be always // available since it is defaulted by the system. Loading Loading @@ -1893,21 +1897,41 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind * user is resizing the window of an activity in multi-window mode. */ public static Drawable getResizingBackgroundDrawable(Context context, int backgroundRes, int backgroundFallbackRes) { int backgroundFallbackRes, boolean windowTranslucent) { if (backgroundRes != 0) { final Drawable drawable = context.getDrawable(backgroundRes); if (drawable != null) { return drawable; return enforceNonTranslucentBackground(drawable, windowTranslucent); } } if (backgroundFallbackRes != 0) { final Drawable fallbackDrawable = context.getDrawable(backgroundFallbackRes); if (fallbackDrawable != null) { return fallbackDrawable; return enforceNonTranslucentBackground(fallbackDrawable, windowTranslucent); } } return null; return new ColorDrawable(Color.BLACK); } /** * Enforces a drawable to be non-translucent to act as a background if needed, i.e. if the * window is not translucent. */ private static Drawable enforceNonTranslucentBackground(Drawable drawable, boolean windowTranslucent) { if (!windowTranslucent && drawable instanceof ColorDrawable) { ColorDrawable colorDrawable = (ColorDrawable) drawable; int color = colorDrawable.getColor(); if (Color.alpha(color) != 255) { ColorDrawable copy = (ColorDrawable) colorDrawable.getConstantState().newDrawable() .mutate(); copy.setColor( Color.argb(255, Color.red(color), Color.green(color), Color.blue(color))); return copy; } } return drawable; } /** Loading Loading @@ -2037,7 +2061,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind private void drawResizingShadowIfNeeded(DisplayListCanvas canvas) { if (mResizeMode != RESIZE_MODE_DOCKED_DIVIDER || mWindow.mIsFloating || mWindow.isTranslucent() || (mWindow.getAttributes().flags & FLAG_SHOW_WALLPAPER) != 0) { || mWindow.isShowingWallpaper()) { return; } canvas.save(); Loading
core/java/com/android/internal/policy/PhoneWindow.java +7 −0 Original line number Diff line number Diff line Loading @@ -508,6 +508,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { return mIsTranslucent; } /** * @return Whether the window is currently showing the wallpaper. */ boolean isShowingWallpaper() { return (getAttributes().flags & FLAG_SHOW_WALLPAPER) != 0; } /** * Return a LayoutInflater instance that can be used to inflate XML view layout * resources for use in this Window. Loading
core/res/res/values/themes.xml +0 −1 Original line number Diff line number Diff line Loading @@ -174,7 +174,6 @@ please see themes_device_defaults.xml. <!-- Window attributes --> <item name="windowBackground">@drawable/screen_background_selector_dark</item> <item name="windowBackgroundFallback">?attr/colorBackground</item> <item name="windowClipToOutline">false</item> <item name="windowFrame">@null</item> <item name="windowNoTitle">false</item> Loading