Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5132e86 authored by Julia Reynolds's avatar Julia Reynolds Committed by mse1969
Browse files

[BACKPORT] Prevent long press on profile notifs when locked

Test: NotificationGutsManagerTest
Bug: 378087531
Flag: EXEMPT BUGFIX

(cherry picked from commit a6280c4ccf96685eed5dc57c2bd9cbbe04209bf1)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:2feb7e286a93196e44fef97ac00fb69f6f3d3ca9
Merged-In: Ic4ab842763d2d9473adcfc426a64434aec5c6ed2
Change-Id: Ic4ab842763d2d9473adcfc426a64434aec5c6ed2
parent 85300b42
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -615,6 +615,10 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
        }

        final ExpandableNotificationRow row = (ExpandableNotificationRow) view;
        if (affectedByWorkProfileLock(row)) {
            return false;
        }

        view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        if (row.areGutsExposed()) {
            closeAndSaveGuts(false /* removeLeavebehind */, false /* force */,
@@ -675,6 +679,12 @@ public class NotificationGutsManager implements Dumpable, NotificationLifetimeEx
        return true;
    }

    boolean affectedByWorkProfileLock(ExpandableNotificationRow row) {
        int userId = row.getEntry().getSbn().getNormalizedUserId();
        return mUserManager.isManagedProfile(userId)
                && mLockscreenUserManager.isLockscreenPublicMode(userId);
    }

    @Override
    public void setCallback(NotificationSafeToRemoveCallback callback) {
        mNotificationLifetimeFinishedCallback = callback;