Loading packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +14 −1 Original line number Diff line number Diff line Loading @@ -168,6 +168,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, /** Volume dialog slider animation. */ private static final String TYPE_UPDATE = "update"; /** * TODO(b/290612381): remove lingering animations or tolerate them * When false, this will cause this class to not listen to animator events and not record jank * events. This should never be false in production code, and only is false for unit tests for * this class. This flag should be true in Scenario/Integration tests. */ private final boolean mShouldListenForJank; private final int mDialogShowAnimationDurationMs; private final int mDialogHideAnimationDurationMs; private int mDialogWidth; Loading Loading @@ -304,6 +311,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, VolumePanelFactory volumePanelFactory, ActivityStarter activityStarter, InteractionJankMonitor interactionJankMonitor, boolean shouldListenForJank, CsdWarningDialog.Factory csdWarningDialogFactory, DevicePostureController devicePostureController, Looper looper, Loading @@ -311,6 +319,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mContext = new ContextThemeWrapper(context, R.style.volume_dialog_theme); mHandler = new H(looper); mShouldListenForJank = shouldListenForJank; mController = volumeDialogController; mKeyguard = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); Loading Loading @@ -1368,7 +1378,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, } private Animator.AnimatorListener getJankListener(View v, String type, long timeout) { return new Animator.AnimatorListener() { if (!mShouldListenForJank) { // TODO(b/290612381): temporary fix to prevent null pointers on leftover JankMonitors return null; } else return new Animator.AnimatorListener() { @Override public void onAnimationStart(@NonNull Animator animation) { if (!v.isAttachedToWindow()) { Loading packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public interface VolumeModule { volumePanelFactory, activityStarter, interactionJankMonitor, true, /* should listen for jank */ csdFactory, devicePostureController, Looper.getMainLooper(), Loading packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java +21 −6 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, mPostureController, mTestableLooper.getLooper(), Loading Loading @@ -378,6 +379,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, devicePostureController, mTestableLooper.getLooper(), Loading @@ -397,6 +399,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { int gravity = dialog.getWindowGravity(); assertEquals(Gravity.TOP, gravity & Gravity.VERTICAL_GRAVITY_MASK); cleanUp(dialog); } @Test Loading @@ -415,6 +419,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, devicePostureController, mTestableLooper.getLooper(), Loading @@ -433,6 +438,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { int gravity = dialog.getWindowGravity(); assertEquals(Gravity.CENTER_VERTICAL, gravity & Gravity.VERTICAL_GRAVITY_MASK); cleanUp(dialog); } @Test Loading @@ -451,6 +458,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, devicePostureController, mTestableLooper.getLooper(), Loading @@ -469,6 +477,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { int gravity = dialog.getWindowGravity(); assertEquals(Gravity.CENTER_VERTICAL, gravity & Gravity.VERTICAL_GRAVITY_MASK); cleanUp(dialog); } @Test Loading @@ -489,18 +499,19 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, mPostureController, mTestableLooper.getLooper(), mDumpManager ); mDumpManager); dialog.init(0, null); verify(mPostureController, never()).removeCallback(any()); dialog.destroy(); verify(mPostureController).removeCallback(any()); cleanUp(dialog); } private void setOrientation(int orientation) { Loading @@ -513,14 +524,18 @@ public class VolumeDialogImplTest extends SysuiTestCase { @After public void teardown() { if (mDialog != null) { mDialog.clearInternalHandlerAfterTest(); } cleanUp(mDialog); setOrientation(mOriginalOrientation); mTestableLooper.processAllMessages(); reset(mPostureController); } private void cleanUp(VolumeDialogImpl dialog) { if (dialog != null) { dialog.clearInternalHandlerAfterTest(); } } /* @Test public void testContentDescriptions() { Loading Loading
packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +14 −1 Original line number Diff line number Diff line Loading @@ -168,6 +168,13 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, /** Volume dialog slider animation. */ private static final String TYPE_UPDATE = "update"; /** * TODO(b/290612381): remove lingering animations or tolerate them * When false, this will cause this class to not listen to animator events and not record jank * events. This should never be false in production code, and only is false for unit tests for * this class. This flag should be true in Scenario/Integration tests. */ private final boolean mShouldListenForJank; private final int mDialogShowAnimationDurationMs; private final int mDialogHideAnimationDurationMs; private int mDialogWidth; Loading Loading @@ -304,6 +311,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, VolumePanelFactory volumePanelFactory, ActivityStarter activityStarter, InteractionJankMonitor interactionJankMonitor, boolean shouldListenForJank, CsdWarningDialog.Factory csdWarningDialogFactory, DevicePostureController devicePostureController, Looper looper, Loading @@ -311,6 +319,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mContext = new ContextThemeWrapper(context, R.style.volume_dialog_theme); mHandler = new H(looper); mShouldListenForJank = shouldListenForJank; mController = volumeDialogController; mKeyguard = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); Loading Loading @@ -1368,7 +1378,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, } private Animator.AnimatorListener getJankListener(View v, String type, long timeout) { return new Animator.AnimatorListener() { if (!mShouldListenForJank) { // TODO(b/290612381): temporary fix to prevent null pointers on leftover JankMonitors return null; } else return new Animator.AnimatorListener() { @Override public void onAnimationStart(@NonNull Animator animation) { if (!v.isAttachedToWindow()) { Loading
packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ public interface VolumeModule { volumePanelFactory, activityStarter, interactionJankMonitor, true, /* should listen for jank */ csdFactory, devicePostureController, Looper.getMainLooper(), Loading
packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java +21 −6 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, mPostureController, mTestableLooper.getLooper(), Loading Loading @@ -378,6 +379,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, devicePostureController, mTestableLooper.getLooper(), Loading @@ -397,6 +399,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { int gravity = dialog.getWindowGravity(); assertEquals(Gravity.TOP, gravity & Gravity.VERTICAL_GRAVITY_MASK); cleanUp(dialog); } @Test Loading @@ -415,6 +419,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, devicePostureController, mTestableLooper.getLooper(), Loading @@ -433,6 +438,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { int gravity = dialog.getWindowGravity(); assertEquals(Gravity.CENTER_VERTICAL, gravity & Gravity.VERTICAL_GRAVITY_MASK); cleanUp(dialog); } @Test Loading @@ -451,6 +458,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, devicePostureController, mTestableLooper.getLooper(), Loading @@ -469,6 +477,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { int gravity = dialog.getWindowGravity(); assertEquals(Gravity.CENTER_VERTICAL, gravity & Gravity.VERTICAL_GRAVITY_MASK); cleanUp(dialog); } @Test Loading @@ -489,18 +499,19 @@ public class VolumeDialogImplTest extends SysuiTestCase { mVolumePanelFactory, mActivityStarter, mInteractionJankMonitor, false, mCsdWarningDialogFactory, mPostureController, mTestableLooper.getLooper(), mDumpManager ); mDumpManager); dialog.init(0, null); verify(mPostureController, never()).removeCallback(any()); dialog.destroy(); verify(mPostureController).removeCallback(any()); cleanUp(dialog); } private void setOrientation(int orientation) { Loading @@ -513,14 +524,18 @@ public class VolumeDialogImplTest extends SysuiTestCase { @After public void teardown() { if (mDialog != null) { mDialog.clearInternalHandlerAfterTest(); } cleanUp(mDialog); setOrientation(mOriginalOrientation); mTestableLooper.processAllMessages(); reset(mPostureController); } private void cleanUp(VolumeDialogImpl dialog) { if (dialog != null) { dialog.clearInternalHandlerAfterTest(); } } /* @Test public void testContentDescriptions() { Loading