Loading core/java/com/android/internal/policy/PhoneWindow.java +4 −5 Original line number Diff line number Diff line Loading @@ -2512,12 +2512,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (a.hasValue(R.styleable.Window_windowBackground)) { mBackgroundDrawable = a.getDrawable(R.styleable.Window_windowBackground); } } if (a.hasValue(R.styleable.Window_windowBackgroundFallback)) { mBackgroundFallbackDrawable = a.getDrawable(R.styleable.Window_windowBackgroundFallback); } } if (mLoadElevation) { mElevation = a.getDimension(R.styleable.Window_windowElevation, 0); } Loading core/tests/coretests/src/com/android/internal/policy/PhoneWindowTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,24 @@ public final class PhoneWindowTest { assertThat(colorDrawable.getColor(), is(Color.BLUE)); } @Test public void testWindowBackgroundFallbackWithExplicitBackgroundSet_colorLiteral() { createPhoneWindowWithTheme(R.style.WindowBackgroundFallbackColorLiteral); // set background before decorView is created mPhoneWindow.setBackgroundDrawable(new ColorDrawable(Color.CYAN)); installDecor(); // clear background so that fallback is used mPhoneWindow.setBackgroundDrawable(null); DecorView decorView = (DecorView) mPhoneWindow.getDecorView(); Drawable fallbackDrawable = decorView.getBackgroundFallback(); assertThat(fallbackDrawable instanceof ColorDrawable, is(true)); ColorDrawable colorDrawable = (ColorDrawable) fallbackDrawable; assertThat(colorDrawable.getColor(), is(Color.BLUE)); } private void createPhoneWindowWithTheme(int theme) { mPhoneWindow = new PhoneWindow(new ContextThemeWrapper(mContext, theme)); } Loading Loading
core/java/com/android/internal/policy/PhoneWindow.java +4 −5 Original line number Diff line number Diff line Loading @@ -2512,12 +2512,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (a.hasValue(R.styleable.Window_windowBackground)) { mBackgroundDrawable = a.getDrawable(R.styleable.Window_windowBackground); } } if (a.hasValue(R.styleable.Window_windowBackgroundFallback)) { mBackgroundFallbackDrawable = a.getDrawable(R.styleable.Window_windowBackgroundFallback); } } if (mLoadElevation) { mElevation = a.getDimension(R.styleable.Window_windowElevation, 0); } Loading
core/tests/coretests/src/com/android/internal/policy/PhoneWindowTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,24 @@ public final class PhoneWindowTest { assertThat(colorDrawable.getColor(), is(Color.BLUE)); } @Test public void testWindowBackgroundFallbackWithExplicitBackgroundSet_colorLiteral() { createPhoneWindowWithTheme(R.style.WindowBackgroundFallbackColorLiteral); // set background before decorView is created mPhoneWindow.setBackgroundDrawable(new ColorDrawable(Color.CYAN)); installDecor(); // clear background so that fallback is used mPhoneWindow.setBackgroundDrawable(null); DecorView decorView = (DecorView) mPhoneWindow.getDecorView(); Drawable fallbackDrawable = decorView.getBackgroundFallback(); assertThat(fallbackDrawable instanceof ColorDrawable, is(true)); ColorDrawable colorDrawable = (ColorDrawable) fallbackDrawable; assertThat(colorDrawable.getColor(), is(Color.BLUE)); } private void createPhoneWindowWithTheme(int theme) { mPhoneWindow = new PhoneWindow(new ContextThemeWrapper(mContext, theme)); } Loading