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

Commit 6bc4d22e authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Allow listeners to know about lockscreen notifs"

parents e9a69be5 4fddc795
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -42461,6 +42461,7 @@ package android.service.notification {
    method public CharSequence getImportanceExplanation();
    method public CharSequence getImportanceExplanation();
    method public String getKey();
    method public String getKey();
    method public long getLastAudiblyAlertedMillis();
    method public long getLastAudiblyAlertedMillis();
    method public int getLockscreenVisibilityOverride();
    method public String getOverrideGroupKey();
    method public String getOverrideGroupKey();
    method public int getRank();
    method public int getRank();
    method @NonNull public java.util.List<android.app.Notification.Action> getSmartActions();
    method @NonNull public java.util.List<android.app.Notification.Action> getSmartActions();
@@ -42474,6 +42475,7 @@ package android.service.notification {
    field public static final int USER_SENTIMENT_NEGATIVE = -1; // 0xffffffff
    field public static final int USER_SENTIMENT_NEGATIVE = -1; // 0xffffffff
    field public static final int USER_SENTIMENT_NEUTRAL = 0; // 0x0
    field public static final int USER_SENTIMENT_NEUTRAL = 0; // 0x0
    field public static final int USER_SENTIMENT_POSITIVE = 1; // 0x1
    field public static final int USER_SENTIMENT_POSITIVE = 1; // 0x1
    field public static final int VISIBILITY_NO_OVERRIDE = -1000; // 0xfffffc18
  }
  }
  public static class NotificationListenerService.RankingMap implements android.os.Parcelable {
  public static class NotificationListenerService.RankingMap implements android.os.Parcelable {
+8 −7
Original line number Original line Diff line number Diff line
@@ -1517,8 +1517,10 @@ public abstract class NotificationListenerService extends Service {
     */
     */
    public static class Ranking {
    public static class Ranking {


        /** Value signifying that the user has not expressed a per-app visibility override value.
        /**
         * @hide */
         * Value signifying that the user and device policy manager have not expressed a lockscreen
         * visibility override for a notification.
         */
        public static final int VISIBILITY_NO_OVERRIDE = NotificationManager.VISIBILITY_NO_OVERRIDE;
        public static final int VISIBILITY_NO_OVERRIDE = NotificationManager.VISIBILITY_NO_OVERRIDE;


        /**
        /**
@@ -1695,14 +1697,13 @@ public abstract class NotificationListenerService extends Service {
        }
        }


        /**
        /**
         * Returns the user specified visibility for the package that posted
         * Returns the user or device policy manager specified visibility (see
         * this notification, or
         * {@link Notification#VISIBILITY_PRIVATE}, {@link Notification#VISIBILITY_PUBLIC},
         * {@link Notification#VISIBILITY_SECRET}) for this notification, or
         * {@link NotificationListenerService.Ranking#VISIBILITY_NO_OVERRIDE} if
         * {@link NotificationListenerService.Ranking#VISIBILITY_NO_OVERRIDE} if
         * no such preference has been expressed.
         * no such preference has been expressed.
         * @hide
         */
         */
        @UnsupportedAppUsage
        public int getLockscreenVisibilityOverride() {
        public int getVisibilityOverride() {
            return mVisibilityOverride;
            return mVisibilityOverride;
        }
        }


+3 −2
Original line number Original line Diff line number Diff line
@@ -335,7 +335,7 @@ public class NotificationLockscreenUserManagerImpl implements
        }
        }
        NotificationEntry visibleEntry = getEntryManager().getActiveNotificationUnfiltered(key);
        NotificationEntry visibleEntry = getEntryManager().getActiveNotificationUnfiltered(key);
        return isLockscreenPublicMode(mCurrentUserId) && visibleEntry != null
        return isLockscreenPublicMode(mCurrentUserId) && visibleEntry != null
                && visibleEntry.getRanking().getVisibilityOverride() == VISIBILITY_SECRET;
                && visibleEntry.getRanking().getLockscreenVisibilityOverride() == VISIBILITY_SECRET;
    }
    }


    public boolean shouldShowOnKeyguard(NotificationEntry entry) {
    public boolean shouldShowOnKeyguard(NotificationEntry entry) {
@@ -513,7 +513,8 @@ public class NotificationLockscreenUserManagerImpl implements
        }
        }
        NotificationEntry entry = getEntryManager().getActiveNotificationUnfiltered(key);
        NotificationEntry entry = getEntryManager().getActiveNotificationUnfiltered(key);
        return entry != null
        return entry != null
                && entry.getRanking().getVisibilityOverride() == Notification.VISIBILITY_PRIVATE;
                && entry.getRanking().getLockscreenVisibilityOverride() 
                == Notification.VISIBILITY_PRIVATE;
    }
    }


    private void updateCurrentProfilesCache() {
    private void updateCurrentProfilesCache() {
+1 −1
Original line number Original line Diff line number Diff line
@@ -120,7 +120,7 @@ public class KeyguardCoordinator implements Coordinator {
                // notifications to show in public mode
                // notifications to show in public mode
                if (mLockscreenUserManager.isLockscreenPublicMode(currUserId)
                if (mLockscreenUserManager.isLockscreenPublicMode(currUserId)
                        || mLockscreenUserManager.isLockscreenPublicMode(notifUserId)) {
                        || mLockscreenUserManager.isLockscreenPublicMode(notifUserId)) {
                    if (entry.getRanking().getVisibilityOverride() == VISIBILITY_SECRET) {
                    if (entry.getRanking().getLockscreenVisibilityOverride() == VISIBILITY_SECRET) {
                        return true;
                        return true;
                    }
                    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -65,7 +65,7 @@ public class RankingBuilder {
        mKey = ranking.getKey();
        mKey = ranking.getKey();
        mRank = ranking.getRank();
        mRank = ranking.getRank();
        mMatchesInterruptionFilter = ranking.matchesInterruptionFilter();
        mMatchesInterruptionFilter = ranking.matchesInterruptionFilter();
        mVisibilityOverride = ranking.getVisibilityOverride();
        mVisibilityOverride = ranking.getLockscreenVisibilityOverride();
        mSuppressedVisualEffects = ranking.getSuppressedVisualEffects();
        mSuppressedVisualEffects = ranking.getSuppressedVisualEffects();
        mImportance = ranking.getImportance();
        mImportance = ranking.getImportance();
        mExplanation = ranking.getImportanceExplanation();
        mExplanation = ranking.getImportanceExplanation();
Loading