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

Commit 63122cbd authored by Steve Elliott's avatar Steve Elliott
Browse files

Don't show "Clear All" w/ redacted notifs

The logic that determined when to show the Clear All Silent button in the
Silent notification header was occurring when the Silent (and Minimized)
sections update. At this time, there was no up-to-date information about
whether or not the notification has senstive content
(SensitiveContentCoordinator occurs later in the pipeline), and no
information about whether or not sensitive content can even be shown or
must be redacted (handled by NotificationStackScrollLayoutController).

Additionally, the visibility of the Clear All button in the shade footer
wasn't being adjusted at all under the new pipeline.

To remedy this, the following changes were made in this CL:

1. `boolean NotificationEntry#isSensitive()` has been dismantled. Rather
than relying on some separate code to properly set this value at some
point, instead the concept of "Sensitive Content" is derived directly
from the SBN + Ranking, and is kept separate from the state of the
user's settings, as well as the state of the lockscreen (whether we
would currently need to redact).

2. NotificationLockscreenUserMananger is the de-facto place for tracking
and querying redaction state. This includes checking if the user's
settings *would* require redaction (#needsRedactionInPublic), and
whether a user is actually public (#isLockscreenPublicMode).

3. In order to keep clients in sync, a new observable interface is
exposed on NotificationLockscreenUserManager that clients can use to be
notified when to requery #needsRedactionInPublic, due to user settings
changes. This replaces NotificationEntry#OnSensitivityChangedListener

4. SensitiveContentCoordinator has been removed entirely; the pipeline
no longer needs to invoke NotificationEntry#setSenstive, since it no
longer exists.

5. NotifStats has been updated to include additional information
extracted from the NotifCollection necessary to dynamically query for
redaction in the View layer, without needed to re-process the entire
list; specifically, we track a Set of users that currently have
sensitive notifications in the shade. This set is tested against the
user's settings (tracked separately from the pipeline in
NotifLockscreenUserManager).

Test: atest
Test: 1. Turn on notification redaction (no sensitive contents on lockscreen)
      2. Receive a silent sensitive notification
      3. Lock the device
      4. Double tap camera
      5. expand shade
      Observe: Clear all hidden in footer and in silent header

Fixes: 213443266
Fixes: 230581048
Change-Id: Ibc66576d28a48f7c82cad875ed2dcb57a7b23f10
Merged-In: Ibc66576d28a48f7c82cad875ed2dcb57a7b23f10
parent 7bc9ba3b
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.keyguard.AlphaOptimizedLinearLayout;
import com.android.systemui.R;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry.OnSensitivityChangedListener;

import java.util.ArrayList;

@@ -49,6 +48,7 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
    private TextView mTextView;
    private NotificationEntry mShowingEntry;
    private Runnable mOnDrawingRectChangedListener;
    private boolean mRedactSensitiveContent;

    public HeadsUpStatusBarView(Context context) {
        this(context, null);
@@ -111,29 +111,28 @@ public class HeadsUpStatusBarView extends AlphaOptimizedLinearLayout {
    }

    public void setEntry(NotificationEntry entry) {
        if (mShowingEntry != null) {
            mShowingEntry.removeOnSensitivityChangedListener(mOnSensitivityChangedListener);
        }
        mShowingEntry = entry;

        if (mShowingEntry != null) {
            CharSequence text = entry.headsUpStatusBarText;
            if (entry.isSensitive()) {
            if (mRedactSensitiveContent && entry.hasSensitiveContents()) {
                text = entry.headsUpStatusBarTextPublic;
            }
            mTextView.setText(text);
            mShowingEntry.addOnSensitivityChangedListener(mOnSensitivityChangedListener);
        }
    }

    private final OnSensitivityChangedListener mOnSensitivityChangedListener = entry -> {
        if (entry != mShowingEntry) {
            throw new IllegalStateException("Got a sensitivity change for " + entry
                    + " but mShowingEntry is " + mShowingEntry);
    public void setRedactSensitiveContent(boolean redactSensitiveContent) {
        if (mRedactSensitiveContent == redactSensitiveContent) {
            return;
        }
        mRedactSensitiveContent = redactSensitiveContent;
        if (mShowingEntry != null && mShowingEntry.hasSensitiveContents()) {
            mTextView.setText(
                    mRedactSensitiveContent
                            ? mShowingEntry.headsUpStatusBarTextPublic
                            : mShowingEntry.headsUpStatusBarText);
        }
    }
        // Update the text
        setEntry(entry);
    };

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+16 −9
Original line number Diff line number Diff line
@@ -386,7 +386,7 @@ class LockscreenShadeTransitionController @Inject constructor(
            }
            if (view is ExpandableNotificationRow) {
                // Only drag down on sensitive views, otherwise the ExpandHelper will take this
                return view.entry.isSensitive
                return lockScreenUserManager.notifNeedsRedactionInPublic(view.entry)
            }
        }
        return false
@@ -552,7 +552,8 @@ class LockscreenShadeTransitionController @Inject constructor(
            logger.logShadeDisabledOnGoToLockedShade()
            return
        }
        var userId: Int = lockScreenUserManager.getCurrentUserId()
        val currentUser = lockScreenUserManager.currentUserId
        var userId: Int = currentUser
        var entry: NotificationEntry? = null
        if (expandView is ExpandableNotificationRow) {
            entry = expandView.entry
@@ -562,12 +563,18 @@ class LockscreenShadeTransitionController @Inject constructor(
            entry.setGroupExpansionChanging(true)
            userId = entry.sbn.userId
        }
        var fullShadeNeedsBouncer = (!lockScreenUserManager.userAllowsPrivateNotificationsInPublic(
                lockScreenUserManager.getCurrentUserId()) ||
                !lockScreenUserManager.shouldShowLockscreenNotifications() ||
                falsingCollector.shouldEnforceBouncer())
        if (keyguardBypassController.bypassEnabled) {
            fullShadeNeedsBouncer = false
        val fullShadeNeedsBouncer = when {
            // No bouncer necessary if we're bypassing
            keyguardBypassController.bypassEnabled -> false
            // Redacted notificationss are present, bouncer should be shown before un-redacting in
            // the full shade
            lockScreenUserManager.sensitiveNotifsNeedRedactionInPublic(currentUser) -> true
            // Notifications are hidden in public, bouncer should be shown before showing them in
            // the full shade
            !lockScreenUserManager.shouldShowLockscreenNotifications() -> true
            // Bouncer is being enforced, so we need to show it
            falsingCollector.shouldEnforceBouncer() -> true
            else -> false
        }
        if (lockScreenUserManager.isLockscreenPublicMode(userId) && fullShadeNeedsBouncer) {
            statusBarStateController.setLeaveOpenOnKeyguardHide(true)
+9 −4
Original line number Diff line number Diff line
@@ -71,17 +71,22 @@ public interface NotificationLockscreenUserManager {
    boolean shouldHideNotifications(String key);
    boolean shouldShowOnKeyguard(NotificationEntry entry);

    void addOnNeedsRedactionInPublicChangedListener(Runnable listener);

    void removeOnNeedsRedactionInPublicChangedListener(Runnable listener);

    boolean isAnyProfilePublicMode();

    void updatePublicMode();

    boolean needsRedaction(NotificationEntry entry);
    /** Does this notification require redaction if it is displayed when the device is public? */
    boolean notifNeedsRedactionInPublic(NotificationEntry entry);

    /**
     * Has the given user chosen to allow their private (full) notifications to be shown even
     * when the lockscreen is in "public" (secure & locked) mode?
     * Do all sensitive notifications belonging to the given user require redaction when they are
     * displayed in public?
     */
    boolean userAllowsPrivateNotificationsInPublic(int currentUserId);
    boolean sensitiveNotifsNeedRedactionInPublic(int userId);

    /**
     * Has the given user chosen to allow notifications to be shown even when the lockscreen is in
+80 −63
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import static com.android.systemui.statusbar.notification.stack.NotificationPrio

import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
@@ -45,7 +44,6 @@ import android.util.SparseBooleanArray;
import com.android.internal.statusbar.NotificationVisibility;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.SysUISingleton;
@@ -60,6 +58,7 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.Co
import com.android.systemui.statusbar.notification.collection.render.NotificationVisibilityProvider;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.ListenerSet;
import com.android.systemui.util.settings.SecureSettings;

import java.io.PrintWriter;
@@ -85,13 +84,12 @@ public class NotificationLockscreenUserManagerImpl implements
    private final DeviceProvisionedController mDeviceProvisionedController;
    private final KeyguardStateController mKeyguardStateController;
    private final SecureSettings mSecureSettings;
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    private final Lazy<OverviewProxyService> mOverviewProxyService;
    private final Object mLock = new Object();

    // Lazy
    private NotificationEntryManager mEntryManager;

    private final Lazy<NotificationVisibilityProvider> mVisibilityProviderLazy;
    private final Lazy<CommonNotifCollection> mCommonNotifCollectionLazy;
    private final Lazy<NotificationEntryManager> mEntryManagerLazy;
    private final DevicePolicyManager mDevicePolicyManager;
    private final SparseBooleanArray mLockscreenPublicMode = new SparseBooleanArray();
    private final SparseBooleanArray mUsersWithSeparateWorkChallenge = new SparseBooleanArray();
@@ -103,13 +101,14 @@ public class NotificationLockscreenUserManagerImpl implements
    private final List<UserChangedListener> mListeners = new ArrayList<>();
    private final BroadcastDispatcher mBroadcastDispatcher;
    private final NotificationClickNotifier mClickNotifier;

    private boolean mShowLockscreenNotifications;
    private boolean mAllowLockscreenRemoteInput;
    private LockPatternUtils mLockPatternUtils;
    protected KeyguardManager mKeyguardManager;
    private int mState = StatusBarState.SHADE;
    private List<KeyguardNotificationSuppressor> mKeyguardSuppressors = new ArrayList<>();
    private final LockPatternUtils mLockPatternUtils;
    private final List<KeyguardNotificationSuppressor> mKeyguardSuppressors = new ArrayList<>();
    protected final Context mContext;
    private final Handler mMainHandler;
    protected final SparseArray<UserInfo> mCurrentProfiles = new SparseArray<>();
    protected final SparseArray<UserInfo> mCurrentManagedProfiles = new SparseArray<>();
    private final ListenerSet<Runnable> mOnSensitiveContentRedactionChangeListeners =
            new ListenerSet<>();

    protected final BroadcastReceiver mAllUsersReceiver = new BroadcastReceiver() {
        @Override
@@ -120,7 +119,11 @@ public class NotificationLockscreenUserManagerImpl implements
                    isCurrentProfile(getSendingUserId())) {
                mUsersAllowingPrivateNotifications.clear();
                updateLockscreenNotificationSetting();
                getEntryManager().updateNotifications("ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED");
                for (Runnable listener : mOnSensitiveContentRedactionChangeListeners) {
                    listener.run();
                }
                mEntryManagerLazy.get()
                        .updateNotifications("ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED");
            }
        }
    };
@@ -142,7 +145,7 @@ public class NotificationLockscreenUserManagerImpl implements
                    // The filtering needs to happen before the update call below in order to
                    // make sure
                    // the presenter has the updated notifications from the new user
                    getEntryManager().reapplyFilterAndSort("user switched");
                    mEntryManagerLazy.get().reapplyFilterAndSort("user switched");
                    mPresenter.onUserSwitched(mCurrentUserId);

                    for (UserChangedListener listener : mListeners) {
@@ -156,7 +159,7 @@ public class NotificationLockscreenUserManagerImpl implements
                    break;
                case Intent.ACTION_USER_UNLOCKED:
                    // Start the overview connection to the launcher service
                    Dependency.get(OverviewProxyService.class).startConnectionToCurrentUser();
                    mOverviewProxyService.get().startConnectionToCurrentUser();
                    break;
                case NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION:
                    final IntentSender intentSender = intent.getParcelableExtra(
@@ -179,28 +182,26 @@ public class NotificationLockscreenUserManagerImpl implements
        }
    };

    protected final Context mContext;
    private final Handler mMainHandler;
    protected final SparseArray<UserInfo> mCurrentProfiles = new SparseArray<>();
    protected final SparseArray<UserInfo> mCurrentManagedProfiles = new SparseArray<>();

    protected int mCurrentUserId = 0;
    // Late-init
    protected NotificationPresenter mPresenter;
    protected ContentObserver mLockscreenSettingsObserver;
    protected ContentObserver mSettingsObserver;
    private boolean mHideSilentNotificationsOnLockscreen;
    protected KeyguardManager mKeyguardManager;

    private NotificationEntryManager getEntryManager() {
        if (mEntryManager == null) {
            mEntryManager = Dependency.get(NotificationEntryManager.class);
        }
        return mEntryManager;
    }
    protected int mCurrentUserId = 0;
    private int mState = StatusBarState.SHADE;
    private boolean mHideSilentNotificationsOnLockscreen;
    private boolean mShowLockscreenNotifications;
    private boolean mAllowLockscreenRemoteInput;

    @Inject
    public NotificationLockscreenUserManagerImpl(Context context,
    public NotificationLockscreenUserManagerImpl(
            Context context,
            BroadcastDispatcher broadcastDispatcher,
            DevicePolicyManager devicePolicyManager,
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            Lazy<NotificationEntryManager> notificationEntryManagerLazy,
            Lazy<OverviewProxyService> overviewProxyServiceLazy,
            UserManager userManager,
            Lazy<NotificationVisibilityProvider> visibilityProviderLazy,
            Lazy<CommonNotifCollection> commonNotifCollectionLazy,
@@ -216,9 +217,11 @@ public class NotificationLockscreenUserManagerImpl implements
        mMainHandler = mainHandler;
        mDevicePolicyManager = devicePolicyManager;
        mUserManager = userManager;
        mOverviewProxyService = overviewProxyServiceLazy;
        mCurrentUserId = ActivityManager.getCurrentUser();
        mVisibilityProviderLazy = visibilityProviderLazy;
        mCommonNotifCollectionLazy = commonNotifCollectionLazy;
        mEntryManagerLazy = notificationEntryManagerLazy;
        mClickNotifier = clickNotifier;
        statusBarStateController.addCallback(this);
        mLockPatternUtils = new LockPatternUtils(context);
@@ -227,10 +230,12 @@ public class NotificationLockscreenUserManagerImpl implements
        mDeviceProvisionedController = deviceProvisionedController;
        mSecureSettings = secureSettings;
        mKeyguardStateController = keyguardStateController;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;

        dumpManager.registerDumpable(this);
    }

    @Override
    public void setUpWithPresenter(NotificationPresenter presenter) {
        mPresenter = presenter;

@@ -243,7 +248,10 @@ public class NotificationLockscreenUserManagerImpl implements
                mUsersAllowingNotifications.clear();
                // ... and refresh all the notifications
                updateLockscreenNotificationSetting();
                getEntryManager().updateNotifications("LOCK_SCREEN_SHOW_NOTIFICATIONS,"
                for (Runnable listener : mOnSensitiveContentRedactionChangeListeners) {
                    listener.run();
                }
                mEntryManagerLazy.get().updateNotifications("LOCK_SCREEN_SHOW_NOTIFICATIONS,"
                        + " or LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS change");
            }
        };
@@ -253,7 +261,7 @@ public class NotificationLockscreenUserManagerImpl implements
            public void onChange(boolean selfChange) {
                updateLockscreenNotificationSetting();
                if (mDeviceProvisionedController.isDeviceProvisioned()) {
                    getEntryManager().updateNotifications("LOCK_SCREEN_ALLOW_REMOTE_INPUT"
                    mEntryManagerLazy.get().updateNotifications("LOCK_SCREEN_ALLOW_REMOTE_INPUT"
                            + " or ZEN_MODE change");
                }
            }
@@ -312,14 +320,17 @@ public class NotificationLockscreenUserManagerImpl implements
        mSettingsObserver.onChange(false);  // set up
    }

    @Override
    public boolean shouldShowLockscreenNotifications() {
        return mShowLockscreenNotifications;
    }

    @Override
    public boolean shouldAllowLockscreenRemoteInput() {
        return mAllowLockscreenRemoteInput;
    }

    @Override
    public boolean isCurrentProfile(int userId) {
        synchronized (mLock) {
            return userId == UserHandle.USER_ALL || mCurrentProfiles.get(userId) != null;
@@ -334,7 +345,7 @@ public class NotificationLockscreenUserManagerImpl implements
        if (userId == UserHandle.USER_ALL) {
            userId = mCurrentUserId;
        }
        boolean inLockdown = Dependency.get(KeyguardUpdateMonitor.class).isUserInLockdown(userId);
        boolean inLockdown = mKeyguardUpdateMonitor.isUserInLockdown(userId);
        mUsersInLockdownLatestResult.put(userId, inLockdown);
        return inLockdown;
    }
@@ -343,6 +354,7 @@ public class NotificationLockscreenUserManagerImpl implements
     * Returns true if we're on a secure lockscreen and the user wants to hide notification data.
     * If so, notifications should be hidden.
     */
    @Override
    public boolean shouldHideNotifications(int userId) {
        boolean hide = isLockscreenPublicMode(userId) && !userAllowsNotificationsInPublic(userId)
                || (userId != mCurrentUserId && shouldHideNotifications(mCurrentUserId))
@@ -355,6 +367,7 @@ public class NotificationLockscreenUserManagerImpl implements
     * Returns true if we're on a secure lockscreen and the user wants to hide notifications via
     * package-specific override.
     */
    @Override
    public boolean shouldHideNotifications(String key) {
        if (mCommonNotifCollectionLazy.get() == null) {
            Log.wtf(TAG, "mCommonNotifCollectionLazy was null!", new Throwable());
@@ -365,6 +378,7 @@ public class NotificationLockscreenUserManagerImpl implements
                && visibleEntry.getRanking().getLockscreenVisibilityOverride() == VISIBILITY_SECRET;
    }

    @Override
    public boolean shouldShowOnKeyguard(NotificationEntry entry) {
        if (mCommonNotifCollectionLazy.get() == null) {
            Log.wtf(TAG, "mCommonNotifCollectionLazy was null!", new Throwable());
@@ -387,14 +401,6 @@ public class NotificationLockscreenUserManagerImpl implements
        return mShowLockscreenNotifications && exceedsPriorityThreshold;
    }

    private void setShowLockscreenNotifications(boolean show) {
        mShowLockscreenNotifications = show;
    }

    private void setLockscreenAllowRemoteInput(boolean allowLockscreenRemoteInput) {
        mAllowLockscreenRemoteInput = allowLockscreenRemoteInput;
    }

    protected void updateLockscreenNotificationSetting() {
        final boolean show = mSecureSettings.getIntForUser(
                Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS,
@@ -408,7 +414,7 @@ public class NotificationLockscreenUserManagerImpl implements
        mHideSilentNotificationsOnLockscreen = mSecureSettings.getIntForUser(
                Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1, mCurrentUserId) == 0;

        setShowLockscreenNotifications(show && allowedByDpm);
        mShowLockscreenNotifications = show && allowedByDpm;

        if (ENABLE_LOCK_SCREEN_ALLOW_REMOTE_INPUT) {
            final boolean remoteInput = mSecureSettings.getIntForUser(
@@ -418,9 +424,9 @@ public class NotificationLockscreenUserManagerImpl implements
            final boolean remoteInputDpm =
                    (dpmFlags & DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT) == 0;

            setLockscreenAllowRemoteInput(remoteInput && remoteInputDpm);
            mAllowLockscreenRemoteInput = remoteInput && remoteInputDpm;
        } else {
            setLockscreenAllowRemoteInput(false);
            mAllowLockscreenRemoteInput = false;
        }
    }

@@ -428,7 +434,7 @@ public class NotificationLockscreenUserManagerImpl implements
     * Has the given user chosen to allow their private (full) notifications to be shown even
     * when the lockscreen is in "public" (secure & locked) mode?
     */
    public boolean userAllowsPrivateNotificationsInPublic(int userHandle) {
    protected boolean userAllowsPrivateNotificationsInPublic(int userHandle) {
        if (userHandle == UserHandle.USER_ALL) {
            return true;
        }
@@ -473,10 +479,12 @@ public class NotificationLockscreenUserManagerImpl implements
    /**
     * Save the current "public" (locked and secure) state of the lockscreen.
     */
    @Override
    public void setLockscreenPublicMode(boolean publicMode, int userId) {
        mLockscreenPublicMode.put(userId, publicMode);
    }

    @Override
    public boolean isLockscreenPublicMode(int userId) {
        if (userId == UserHandle.USER_ALL) {
            return mLockscreenPublicMode.get(mCurrentUserId, false);
@@ -493,6 +501,7 @@ public class NotificationLockscreenUserManagerImpl implements
     * Has the given user chosen to allow notifications to be shown even when the lockscreen is in
     * "public" (secure & locked) mode?
     */
    @Override
    public boolean userAllowsNotificationsInPublic(int userHandle) {
        if (isCurrentProfile(userHandle) && userHandle != mCurrentUserId) {
            return true;
@@ -513,36 +522,37 @@ public class NotificationLockscreenUserManagerImpl implements
    }

    /** @return true if the entry needs redaction when on the lockscreen. */
    public boolean needsRedaction(NotificationEntry ent) {
    @Override
    public boolean notifNeedsRedactionInPublic(NotificationEntry ent) {
        int userId = ent.getSbn().getUserId();
        return ent.hasSensitiveContents() && sensitiveNotifsNeedRedactionInPublic(userId);
    }

    @Override
    public boolean sensitiveNotifsNeedRedactionInPublic(int userId) {
        boolean isCurrentUserRedactingNotifs =
                !userAllowsPrivateNotificationsInPublic(mCurrentUserId);
        if (userId == mCurrentUserId) {
            return isCurrentUserRedactingNotifs;
        }

        boolean isNotifForManagedProfile = mCurrentManagedProfiles.contains(userId);
        boolean isNotifUserRedacted = !userAllowsPrivateNotificationsInPublic(userId);

        // redact notifications if the current user is redacting notifications; however if the
        // notification is associated with a managed profile, we rely on the managed profile
        // setting to determine whether to redact it
        boolean isNotifRedacted = (!isNotifForManagedProfile && isCurrentUserRedactingNotifs)
                || isNotifUserRedacted;

        boolean notificationRequestsRedaction =
                ent.getSbn().getNotification().visibility == Notification.VISIBILITY_PRIVATE;
        boolean userForcesRedaction = packageHasVisibilityOverride(ent.getSbn().getKey());

        return userForcesRedaction || notificationRequestsRedaction && isNotifRedacted;
        return (!isNotifForManagedProfile && isCurrentUserRedactingNotifs) || isNotifUserRedacted;
    }

    private boolean packageHasVisibilityOverride(String key) {
        if (mCommonNotifCollectionLazy.get() == null) {
            Log.wtf(TAG, "mEntryManager was null!", new Throwable());
            return true;
    @Override
    public void addOnNeedsRedactionInPublicChangedListener(Runnable listener) {
        mOnSensitiveContentRedactionChangeListeners.addIfAbsent(listener);
    }
        NotificationEntry entry = mCommonNotifCollectionLazy.get().getEntry(key);
        return entry != null
                && entry.getRanking().getLockscreenVisibilityOverride() 
                == Notification.VISIBILITY_PRIVATE;

    @Override
    public void removeOnNeedsRedactionInPublicChangedListener(Runnable listener) {
        mOnSensitiveContentRedactionChangeListeners.remove(listener);
    }

    private void updateCurrentProfilesCache() {
@@ -562,12 +572,16 @@ public class NotificationLockscreenUserManagerImpl implements
            for (UserChangedListener listener : mListeners) {
                listener.onCurrentProfilesChanged(mCurrentProfiles);
            }
            for (Runnable listener : mOnSensitiveContentRedactionChangeListeners) {
                listener.run();
            }
        });
    }

    /**
     * If any of the profiles are in public mode.
     */
    @Override
    public boolean isAnyProfilePublicMode() {
        synchronized (mLock) {
            for (int i = mCurrentProfiles.size() - 1; i >= 0; i--) {
@@ -596,10 +610,12 @@ public class NotificationLockscreenUserManagerImpl implements
    /**
     * Returns the current user id. This can change if the user is switched.
     */
    @Override
    public int getCurrentUserId() {
        return mCurrentUserId;
    }

    @Override
    public SparseArray<UserInfo> getCurrentProfiles() {
        return mCurrentProfiles;
    }
@@ -640,7 +656,8 @@ public class NotificationLockscreenUserManagerImpl implements
            setLockscreenPublicMode(isProfilePublic, userId);
            mUsersWithSeparateWorkChallenge.put(userId, needsSeparateChallenge);
        }
        getEntryManager().updateNotifications("NotificationLockscreenUserManager.updatePublicMode");
        mEntryManagerLazy.get()
                .updateNotifications("NotificationLockscreenUserManager.updatePublicMode");
    }

    @Override
+20 −8

File changed.

Preview size limit exceeded, changes collapsed.

Loading