diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-22 16:51:52 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-22 16:51:52 +0000 |
commit | b0cbbbc8fd3195679e860de886f662df550b36f5 (patch) | |
tree | 8160c55522db535c0f284d1180e9ddeb9bbb3444 | |
parent | 6e47c7075b91983ae501114425ea25e6df7690c8 (diff) | |
parent | 3a7eff0c93c03b5f3fe53f8dd03144bf76f442c8 (diff) | |
download | base-b0cbbbc8fd3195679e860de886f662df550b36f5.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/25583221', 'googleplex-android-review.googlesource.com/25511825', 'googleplex-android-review.googlesource.com/25518128', 'googleplex-android-review.googlesource.com/25521013', 'googleplex-android-review.googlesource.com/25554438', 'googleplex-android-review.googlesource.com/25519613', 'googleplex-android-review.googlesource.com/23919673'] into sparse-10817346-L08000030000963663.android-14.0.0_r28
SPARSE_CHANGE: Id828744c8c5bcb4bdb3be9a11810338614b84b2e
SPARSE_CHANGE: Ie8ccf1d9b8629a60943726cf3c2b8daad84fe08c
SPARSE_CHANGE: I8d0e5bd07414f39fb8aca7cf33a01dcf0ae7956e
SPARSE_CHANGE: I24f0eafb2479ac7427ba28077e45ba26a9127cc8
SPARSE_CHANGE: I8c2d2ccd7907fa732551fbecb8f0a7c37d4c4755
SPARSE_CHANGE: Ia4b1bf695299ac8f698a534e1b1a32a483db968b
SPARSE_CHANGE: I6f89d8b9a9e1aa1b8673fcaffe4c1b92c4c3d210
Change-Id: Ia1321767e91789d86b799f785f5f905435ad5cf1
15 files changed, 218 insertions, 46 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 9ff338e8d5ab..42a4e7202c82 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -281,6 +281,8 @@ public class KeyguardSecurityContainer extends ConstraintLayout { public interface SwipeListener { void onSwipeUp(); + /** */ + void onSwipeDown(); } @VisibleForTesting @@ -543,6 +545,11 @@ public class KeyguardSecurityContainer extends ConstraintLayout { if (mSwipeListener != null) { mSwipeListener.onSwipeUp(); } + } else if (getTranslationY() > TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + MIN_DRAG_SIZE, getResources().getDisplayMetrics())) { + if (mSwipeListener != null) { + mSwipeListener.onSwipeDown(); + } } } return true; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 74b29a77aad4..bad6141c88ea 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -308,6 +308,11 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard "swipeUpOnBouncer"); } } + + @Override + public void onSwipeDown() { + mViewMediatorCallback.onBouncerSwipeDown(); + } }; private final ConfigurationController.ConfigurationListener mConfigurationListener = new ConfigurationController.ConfigurationListener() { diff --git a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java index 50f8f7e61230..14ec27ae6739 100644 --- a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java +++ b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java @@ -104,4 +104,9 @@ public interface ViewMediatorCallback { * Call when cancel button is pressed in bouncer. */ void onCancelClicked(); + + /** + * Determines if bouncer has swiped down. + */ + void onBouncerSwipeDown(); } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 18474e0af5b8..a99ce82e763e 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -874,6 +874,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } @Override + public void onBouncerSwipeDown() { + mKeyguardViewControllerLazy.get().reset(/* hideBouncerWhenShowing= */ true); + } + + @Override public void playTrustedSound() { KeyguardViewMediator.this.playTrustedSound(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java index 1c8241433172..4bc575491fd6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java @@ -792,6 +792,11 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { assertTrue(mViewMediator.isShowingAndNotOccluded()); } + @Test + public void testBouncerSwipeDown() { + mViewMediator.getViewMediatorCallback().onBouncerSwipeDown(); + verify(mStatusBarKeyguardViewManager).reset(true); + } private void createAndStartViewMediator() { createAndStartViewMediator(false); } diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java index 8e7d27795c07..2519f4e7f3e3 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityInputFilter.java @@ -388,11 +388,19 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo @Override public void onMotionEvent(MotionEvent transformedEvent, MotionEvent rawEvent, int policyFlags) { + if (!mInstalled) { + Slog.w(TAG, "onMotionEvent called before input filter installed!"); + return; + } sendInputEvent(transformedEvent, policyFlags); } @Override public void onKeyEvent(KeyEvent event, int policyFlags) { + if (!mInstalled) { + Slog.w(TAG, "onKeyEvent called before input filter installed!"); + return; + } sendInputEvent(event, policyFlags); } diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 647087de1c04..2e29941ee43b 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -9522,14 +9522,19 @@ public class NotificationManagerService extends SystemService { * Determine whether the userId applies to the notification in question, either because * they match exactly, or one of them is USER_ALL (which is treated as a wildcard). */ - private boolean notificationMatchesUserId(NotificationRecord r, int userId) { - return + private static boolean notificationMatchesUserId(NotificationRecord r, int userId, + boolean isAutogroupSummary) { + if (isAutogroupSummary) { + return r.getUserId() == userId; + } else { + return // looking for USER_ALL notifications? match everything - userId == UserHandle.USER_ALL - // a notification sent to USER_ALL matches any query - || r.getUserId() == UserHandle.USER_ALL - // an exact user match - || r.getUserId() == userId; + userId == UserHandle.USER_ALL + // a notification sent to USER_ALL matches any query + || r.getUserId() == UserHandle.USER_ALL + // an exact user match + || r.getUserId() == userId; + } } /** @@ -9538,7 +9543,7 @@ public class NotificationManagerService extends SystemService { * because it matches one of the users profiles. */ private boolean notificationMatchesCurrentProfiles(NotificationRecord r, int userId) { - return notificationMatchesUserId(r, userId) + return notificationMatchesUserId(r, userId, false) || mUserProfiles.isCurrentProfile(r.getUserId()); } @@ -9607,7 +9612,7 @@ public class NotificationManagerService extends SystemService { if (!notificationMatchesCurrentProfiles(r, userId)) { continue; } - } else if (!notificationMatchesUserId(r, userId)) { + } else if (!notificationMatchesUserId(r, userId, false)) { continue; } // Don't remove notifications to all, if there's no package name specified @@ -9845,7 +9850,7 @@ public class NotificationManagerService extends SystemService { final int len = list.size(); for (int i = 0; i < len; i++) { NotificationRecord r = list.get(i); - if (notificationMatchesUserId(r, userId) && r.getGroupKey().equals(groupKey) + if (notificationMatchesUserId(r, userId, false) && r.getGroupKey().equals(groupKey) && r.getSbn().getPackageName().equals(pkg)) { records.add(r); } @@ -9887,8 +9892,8 @@ public class NotificationManagerService extends SystemService { final int len = list.size(); for (int i = 0; i < len; i++) { NotificationRecord r = list.get(i); - if (notificationMatchesUserId(r, userId) && r.getSbn().getId() == id && - TextUtils.equals(r.getSbn().getTag(), tag) + if (notificationMatchesUserId(r, userId, (r.getFlags() & GroupHelper.BASE_FLAGS) != 0) + && r.getSbn().getId() == id && TextUtils.equals(r.getSbn().getTag(), tag) && r.getSbn().getPackageName().equals(pkg)) { return r; } @@ -9903,8 +9908,8 @@ public class NotificationManagerService extends SystemService { final int len = list.size(); for (int i = 0; i < len; i++) { NotificationRecord r = list.get(i); - if (notificationMatchesUserId(r, userId) && r.getSbn().getId() == id && - TextUtils.equals(r.getSbn().getTag(), tag) + if (notificationMatchesUserId(r, userId, false) && r.getSbn().getId() == id + && TextUtils.equals(r.getSbn().getTag(), tag) && r.getSbn().getPackageName().equals(pkg)) { matching.add(r); } @@ -9937,7 +9942,7 @@ public class NotificationManagerService extends SystemService { final int n = mEnqueuedNotifications.size(); for (int i = 0; i < n; i++) { NotificationRecord r = mEnqueuedNotifications.get(i); - if (notificationMatchesUserId(r, userId) + if (notificationMatchesUserId(r, userId, false) && r.getSbn().getId() == id && TextUtils.equals(r.getSbn().getTag(), tag) && r.getSbn().getPackageName().equals(pkg)) { diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java index f3001133338a..b3ae2ee30f22 100644 --- a/services/core/java/com/android/server/wm/AccessibilityController.java +++ b/services/core/java/com/android/server/wm/AccessibilityController.java @@ -1280,45 +1280,53 @@ final class AccessibilityController { } void drawIfNeeded(SurfaceControl.Transaction t) { + // Drawing variables (alpha, dirty rect, and bounds) access is synchronized + // using WindowManagerGlobalLock. Grab copies of these values before + // drawing on the canvas so that drawing can be performed outside of the lock. + int alpha; + Rect drawingRect = null; + Region drawingBounds = null; synchronized (mService.mGlobalLock) { if (!mInvalidated) { return; } mInvalidated = false; - if (mAlpha > 0) { - Canvas canvas = null; - try { - // Empty dirty rectangle means unspecified. - if (mDirtyRect.isEmpty()) { - mBounds.getBounds(mDirtyRect); - } - mDirtyRect.inset(-mHalfBorderWidth, -mHalfBorderWidth); - canvas = mSurface.lockCanvas(mDirtyRect); - if (DEBUG_VIEWPORT_WINDOW) { - Slog.i(LOG_TAG, "Dirty rect: " + mDirtyRect); - } - } catch (IllegalArgumentException iae) { - /* ignore */ - } catch (Surface.OutOfResourcesException oore) { - /* ignore */ - } - if (canvas == null) { - return; + + alpha = mAlpha; + if (alpha > 0) { + drawingBounds = new Region(mBounds); + // Empty dirty rectangle means unspecified. + if (mDirtyRect.isEmpty()) { + mBounds.getBounds(mDirtyRect); } + mDirtyRect.inset(-mHalfBorderWidth, -mHalfBorderWidth); + drawingRect = new Rect(mDirtyRect); if (DEBUG_VIEWPORT_WINDOW) { - Slog.i(LOG_TAG, "Bounds: " + mBounds); + Slog.i(LOG_TAG, "ViewportWindow bounds: " + mBounds); + Slog.i(LOG_TAG, "ViewportWindow dirty rect: " + mDirtyRect); } - canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR); - mPaint.setAlpha(mAlpha); - Path path = mBounds.getBoundaryPath(); - canvas.drawPath(path, mPaint); - - mSurface.unlockCanvasAndPost(canvas); - t.show(mSurfaceControl); - } else { - t.hide(mSurfaceControl); } } + + // Draw without holding WindowManagerGlobalLock. + if (alpha > 0) { + Canvas canvas = null; + try { + canvas = mSurface.lockCanvas(drawingRect); + } catch (IllegalArgumentException | OutOfResourcesException e) { + /* ignore */ + } + if (canvas == null) { + return; + } + canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR); + mPaint.setAlpha(alpha); + canvas.drawPath(drawingBounds.getBoundaryPath(), mPaint); + mSurface.unlockCanvasAndPost(canvas); + t.show(mSurfaceControl); + } else { + t.hide(mSurfaceControl); + } } void releaseSurface() { diff --git a/services/core/java/com/android/server/wm/AsyncRotationController.java b/services/core/java/com/android/server/wm/AsyncRotationController.java index 01158779c24f..5a7799e318c1 100644 --- a/services/core/java/com/android/server/wm/AsyncRotationController.java +++ b/services/core/java/com/android/server/wm/AsyncRotationController.java @@ -33,6 +33,7 @@ import android.view.animation.AnimationUtils; import com.android.internal.R; +import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.function.Consumer; @@ -236,7 +237,15 @@ class AsyncRotationController extends FadeAnimationController implements Consume * operation directly to avoid waiting until timeout. */ void updateTargetWindows() { - if (mTransitionOp == OP_LEGACY || !mIsStartTransactionCommitted) return; + if (mTransitionOp == OP_LEGACY) return; + if (!mIsStartTransactionCommitted) { + if (mTimeoutRunnable == null && !mDisplayContent.hasTopFixedRotationLaunchingApp() + && !mDisplayContent.isRotationChanging() && !mDisplayContent.inTransition()) { + Slog.d(TAG, "Cancel for no change"); + mDisplayContent.finishAsyncRotationIfPossible(); + } + return; + } for (int i = mTargetWindowTokens.size() - 1; i >= 0; i--) { final Operation op = mTargetWindowTokens.valueAt(i); if (op.mIsCompletionPending || op.mAction == Operation.ACTION_SEAMLESS) { @@ -592,6 +601,16 @@ class AsyncRotationController extends FadeAnimationController implements Consume return !mAlwaysWaitForStartTransaction && op.mAction != Operation.ACTION_SEAMLESS; } + void dump(PrintWriter pw, String prefix) { + pw.println(prefix + "AsyncRotationController"); + prefix += " "; + pw.println(prefix + "mTransitionOp=" + mTransitionOp); + pw.println(prefix + "mIsStartTransactionCommitted=" + mIsStartTransactionCommitted); + pw.println(prefix + "mIsSyncDrawRequested=" + mIsSyncDrawRequested); + pw.println(prefix + "mOriginalRotation=" + mOriginalRotation); + pw.println(prefix + "mTargetWindowTokens=" + mTargetWindowTokens); + } + /** The operation to control the rotation appearance associated with window token. */ private static class Operation { @Retention(RetentionPolicy.SOURCE) @@ -619,5 +638,10 @@ class AsyncRotationController extends FadeAnimationController implements Consume Operation(@Action int action) { mAction = action; } + + @Override + public String toString() { + return "Operation{a=" + mAction + " pending=" + mIsCompletionPending + '}'; + } } } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index ef19eef22794..d288663ab2db 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -3453,6 +3453,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (mFixedRotationLaunchingApp != null) { setSeamlessTransitionForFixedRotation(controller.getCollectingTransition()); } + } else if (mAsyncRotationController != null && !isRotationChanging()) { + Slog.i(TAG, "Finish AsyncRotation for previous intermediate change"); + finishAsyncRotationIfPossible(); } return; } @@ -3621,6 +3624,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (mFixedRotationLaunchingApp != null) { pw.println(" mFixedRotationLaunchingApp=" + mFixedRotationLaunchingApp); } + if (mAsyncRotationController != null) { + mAsyncRotationController.dump(pw, prefix); + } pw.println(); pw.print(prefix + "mHoldScreenWindow="); pw.print(mHoldScreenWindow); diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 65c5c9b35ab7..2ac3125de961 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -1468,6 +1468,17 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { mTargetDisplays.add(dc); } + for (int i = 0; i < mTargets.size(); ++i) { + final DisplayArea da = mTargets.get(i).mContainer.asDisplayArea(); + if (da == null) continue; + if (da.isVisibleRequested()) { + mController.mValidateDisplayVis.remove(da); + } else { + // In case something accidentally hides a displayarea and nothing shows it again. + mController.mValidateDisplayVis.add(da); + } + } + if (mOverrideOptions != null) { info.setAnimationOptions(mOverrideOptions); if (mOverrideOptions.getType() == ANIM_OPEN_CROSS_PROFILE_APPS) { diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index b05c6b4839e5..7169c2cfa0f6 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -150,6 +150,13 @@ class TransitionController { final ArrayList<ActivityRecord> mValidateActivityCompat = new ArrayList<>(); /** + * List of display areas which were last sent as "closing"-type and haven't yet had a + * corresponding "opening"-type transition. A mismatch here is usually related to issues in + * keyguard unlock. + */ + final ArrayList<DisplayArea> mValidateDisplayVis = new ArrayList<>(); + + /** * Currently playing transitions (in the order they were started). When finished, records are * removed from this list. */ @@ -922,6 +929,15 @@ class TransitionController { ar.getSyncTransaction().setPosition(ar.getSurfaceControl(), tmpPos.x, tmpPos.y); } mValidateActivityCompat.clear(); + for (int i = 0; i < mValidateDisplayVis.size(); ++i) { + final DisplayArea da = mValidateDisplayVis.get(i); + if (!da.isAttached() || da.getSurfaceControl() == null) continue; + if (da.isVisibleRequested()) { + Slog.e(TAG, "DisplayArea became visible outside of a transition: " + da); + da.getSyncTransaction().show(da.getSurfaceControl()); + } + } + mValidateDisplayVis.clear(); } /** diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 06978a5338ea..c4506d59c138 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -5664,6 +5664,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // TODO(b/233286785): Add sync support to wallpaper. return false; } + if (mActivityRecord != null && mViewVisibility != View.VISIBLE + && mWinAnimator.mAttrType != TYPE_BASE_APPLICATION + && mWinAnimator.mAttrType != TYPE_APPLICATION_STARTING) { + // Skip sync for invisible app windows which are not managed by activity lifecycle. + return false; + } // In the WindowContainer implementation we immediately mark ready // since a generic WindowContainer only needs to wait for its // children to finish and is immediately ready from its own diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 72c9791a3ceb..1437f11d8073 100755 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -865,13 +865,18 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } private NotificationRecord generateNotificationRecord(NotificationChannel channel, int userId) { + return generateNotificationRecord(channel, 1, userId); + } + + private NotificationRecord generateNotificationRecord(NotificationChannel channel, int id, + int userId) { if (channel == null) { channel = mTestNotificationChannel; } Notification.Builder nb = new Notification.Builder(mContext, channel.getId()) .setContentTitle("foo") .setSmallIcon(android.R.drawable.sym_def_app_icon); - StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, 1, "tag", mUid, 0, + StatusBarNotification sbn = new StatusBarNotification(PKG, PKG, id, "tag", mUid, 0, nb.build(), new UserHandle(userId), null, 0); return new NotificationRecord(mContext, sbn, channel); } @@ -10752,6 +10757,51 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @Test + public void testUngroupingAutoSummary_differentUsers() throws Exception { + NotificationRecord nr0 = + generateNotificationRecord(mTestNotificationChannel, 0, USER_SYSTEM); + NotificationRecord nr1 = + generateNotificationRecord(mTestNotificationChannel, 1, USER_SYSTEM); + + // add notifications + summary for USER_SYSTEM + mService.addNotification(nr0); + mService.addNotification(nr1); + mService.addNotification(mService.createAutoGroupSummary(nr1.getUserId(), + nr1.getSbn().getPackageName(), nr1.getKey(), GroupHelper.BASE_FLAGS)); + + // add notifications + summary for USER_ALL + NotificationRecord nr0_all = + generateNotificationRecord(mTestNotificationChannel, 2, UserHandle.USER_ALL); + NotificationRecord nr1_all = + generateNotificationRecord(mTestNotificationChannel, 3, UserHandle.USER_ALL); + + mService.addNotification(nr0_all); + mService.addNotification(nr1_all); + mService.addNotification(mService.createAutoGroupSummary(nr0_all.getUserId(), + nr0_all.getSbn().getPackageName(), nr0_all.getKey(), GroupHelper.BASE_FLAGS)); + + // cancel both children for USER_ALL + mBinderService.cancelNotificationWithTag(PKG, PKG, nr0_all.getSbn().getTag(), + nr0_all.getSbn().getId(), UserHandle.USER_ALL); + mBinderService.cancelNotificationWithTag(PKG, PKG, nr1_all.getSbn().getTag(), + nr1_all.getSbn().getId(), UserHandle.USER_ALL); + waitForIdle(); + + // group helper would send 'remove summary' event + mService.clearAutogroupSummaryLocked(UserHandle.USER_ALL, + nr0_all.getSbn().getPackageName()); + waitForIdle(); + + // make sure the right summary was removed + assertThat(mService.getNotificationCount(nr0_all.getSbn().getPackageName(), + UserHandle.USER_ALL, 0, null)).isEqualTo(0); + + // the USER_SYSTEM notifications + summary were not removed + assertThat(mService.getNotificationCount(nr0.getSbn().getPackageName(), + USER_SYSTEM, 0, null)).isEqualTo(3); + } + + @Test public void testStrongAuthTracker_isInLockDownMode() { mStrongAuthTracker.setGetStrongAuthForUserReturnValue( STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN); diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 340b591e4086..b2fb891dadb3 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -2073,6 +2073,17 @@ public class DisplayContentTests extends WindowTestsBase { assertNotEquals(testPlayer.mLastReady.getChange(dcToken).getEndRotation(), testPlayer.mLastReady.getChange(dcToken).getStartRotation()); testPlayer.finish(); + + // The AsyncRotationController should only exist if there is an ongoing rotation change. + dc.finishAsyncRotationIfPossible(); + dc.setLastHasContent(); + doReturn(dr.getRotation() + 1).when(dr).rotationForOrientation(anyInt(), anyInt()); + dr.updateRotationUnchecked(true /* forceUpdate */); + assertNotNull(dc.getAsyncRotationController()); + doReturn(dr.getRotation() - 1).when(dr).rotationForOrientation(anyInt(), anyInt()); + dr.updateRotationUnchecked(true /* forceUpdate */); + assertNull("Cancel AsyncRotationController for the intermediate rotation changes 0->1->0", + dc.getAsyncRotationController()); } @Test |