Loading packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java +0 −5 Original line number Diff line number Diff line Loading @@ -106,11 +106,6 @@ public class ScrimView extends View implements ConfigurationController.Configura Utils.getThemeAttr(mContext, android.R.attr.dialogCornerRadius)); } @Override public void setBackground(Drawable background) { Log.wtfStack(TAG, "ScrimView should never have a background."); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +7 −2 Original line number Diff line number Diff line Loading @@ -239,6 +239,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, mCurrentBehindAlpha = state.getBehindAlpha(mNotificationDensity); applyExpansionToAlpha(); // Scrim might acquire focus when user is navigating with a D-pad or a keyboard. // We need to disable focus otherwise AOD would end up with a gray overlay. mScrimInFront.setFocusable(!state.isLowPowerState()); mScrimBehind.setFocusable(!state.isLowPowerState()); // Cancel blanking transitions that were pending before we requested a new state if (mPendingFrameCallback != null) { Choreographer.getInstance().removeFrameCallback(mPendingFrameCallback); Loading @@ -257,7 +262,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, // the animation plays properly until the last frame. // It's important to avoid holding the wakelock unless necessary because // WakeLock#aqcuire will trigger an IPC and will cause jank. if (mState == ScrimState.AOD) { if (mState.isLowPowerState()) { holdWakeLock(); } Loading Loading @@ -528,7 +533,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, scrim.setClickable(false); } else { // Eat touch events (unless dozing). scrim.setClickable(!(mState == ScrimState.AOD)); scrim.setClickable(!mState.isLowPowerState()); } updateScrim(scrim, alpha); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +9 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,11 @@ public enum ScrimState { // to set our state. mAnimateChange = mCanControlScreenOff; } @Override public boolean isLowPowerState() { return true; } }, /** Loading Loading @@ -250,4 +255,8 @@ public enum ScrimState { public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) { mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode; } public boolean isLowPowerState() { return false; } } No newline at end of file packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.testing.TestableLooper; import android.view.Choreographer; import android.view.View; import com.android.internal.util.Preconditions; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.ScrimView; Loading Loading @@ -463,6 +464,17 @@ public class ScrimControllerTest extends SysuiTestCase { mHeadsUpScrim.getAlpha(), 0.01f); } @Test public void testScrimFocus() { mScrimController.transitionTo(ScrimState.AOD); Assert.assertFalse("Should not be focusable on AOD", mScrimBehind.isFocusable()); Assert.assertFalse("Should not be focusable on AOD", mScrimInFront.isFocusable()); mScrimController.transitionTo(ScrimState.KEYGUARD); Assert.assertTrue("Should be focusable on keyguard", mScrimBehind.isFocusable()); Assert.assertTrue("Should be focusable on keyguard", mScrimInFront.isFocusable()); } /** * Conserves old notification density after leaving state and coming back. * Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/ScrimView.java +0 −5 Original line number Diff line number Diff line Loading @@ -106,11 +106,6 @@ public class ScrimView extends View implements ConfigurationController.Configura Utils.getThemeAttr(mContext, android.R.attr.dialogCornerRadius)); } @Override public void setBackground(Drawable background) { Log.wtfStack(TAG, "ScrimView should never have a background."); } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +7 −2 Original line number Diff line number Diff line Loading @@ -239,6 +239,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, mCurrentBehindAlpha = state.getBehindAlpha(mNotificationDensity); applyExpansionToAlpha(); // Scrim might acquire focus when user is navigating with a D-pad or a keyboard. // We need to disable focus otherwise AOD would end up with a gray overlay. mScrimInFront.setFocusable(!state.isLowPowerState()); mScrimBehind.setFocusable(!state.isLowPowerState()); // Cancel blanking transitions that were pending before we requested a new state if (mPendingFrameCallback != null) { Choreographer.getInstance().removeFrameCallback(mPendingFrameCallback); Loading @@ -257,7 +262,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, // the animation plays properly until the last frame. // It's important to avoid holding the wakelock unless necessary because // WakeLock#aqcuire will trigger an IPC and will cause jank. if (mState == ScrimState.AOD) { if (mState.isLowPowerState()) { holdWakeLock(); } Loading Loading @@ -528,7 +533,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, scrim.setClickable(false); } else { // Eat touch events (unless dozing). scrim.setClickable(!(mState == ScrimState.AOD)); scrim.setClickable(!mState.isLowPowerState()); } updateScrim(scrim, alpha); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java +9 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,11 @@ public enum ScrimState { // to set our state. mAnimateChange = mCanControlScreenOff; } @Override public boolean isLowPowerState() { return true; } }, /** Loading Loading @@ -250,4 +255,8 @@ public enum ScrimState { public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) { mWallpaperSupportsAmbientMode = wallpaperSupportsAmbientMode; } public boolean isLowPowerState() { return false; } } No newline at end of file
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.testing.TestableLooper; import android.view.Choreographer; import android.view.View; import com.android.internal.util.Preconditions; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.ScrimView; Loading Loading @@ -463,6 +464,17 @@ public class ScrimControllerTest extends SysuiTestCase { mHeadsUpScrim.getAlpha(), 0.01f); } @Test public void testScrimFocus() { mScrimController.transitionTo(ScrimState.AOD); Assert.assertFalse("Should not be focusable on AOD", mScrimBehind.isFocusable()); Assert.assertFalse("Should not be focusable on AOD", mScrimInFront.isFocusable()); mScrimController.transitionTo(ScrimState.KEYGUARD); Assert.assertTrue("Should be focusable on keyguard", mScrimBehind.isFocusable()); Assert.assertTrue("Should be focusable on keyguard", mScrimInFront.isFocusable()); } /** * Conserves old notification density after leaving state and coming back. * Loading