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

Commit 28342820 authored by Julia Reynolds's avatar Julia Reynolds Committed by Nishith Khanna
Browse files

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 6d2603a5
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -626,6 +626,10 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta
        }

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

        if (row.isNotificationRowLongClickable()) {
            view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
@@ -688,6 +692,12 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta
        return true;
    }

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

    /**
     * @param gutsListener the listener for open and close guts events
     */