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

Commit bf02d48f authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "More usage tracking"

parents b4d533ba f47e51ec
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28911,6 +28911,7 @@ package android.service.notification {
    method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap);
    method public final void requestInterruptionFilter(int);
    method public final void requestListenerHints(int);
    method public final void setNotificationsShown(java.lang.String[]);
    field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1
    field public static final int INTERRUPTION_FILTER_ALARMS = 4; // 0x4
    field public static final int INTERRUPTION_FILTER_ALL = 1; // 0x1
+1 −0
Original line number Diff line number Diff line
@@ -30956,6 +30956,7 @@ package android.service.notification {
    method public void registerAsSystemService(android.content.Context, android.content.ComponentName, int) throws android.os.RemoteException;
    method public final void requestInterruptionFilter(int);
    method public final void requestListenerHints(int);
    method public final void setNotificationsShown(java.lang.String[]);
    method public final void setOnNotificationPostedTrim(int);
    method public void unregisterAsSystemService() throws android.os.RemoteException;
    field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1
+2 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ interface INotificationManager
    void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
    void cancelNotificationsFromListener(in INotificationListener token, in String[] keys);

    void setNotificationsShownFromListener(in INotificationListener token, in String[] keys);

    ParceledListSlice getActiveNotificationsFromListener(in INotificationListener token, in String[] keys, int trim);
    void requestHintsFromListener(in INotificationListener token, int hints);
    int getHintsFromListener(in INotificationListener token);
+14 −0
Original line number Diff line number Diff line
@@ -357,6 +357,20 @@ public abstract class NotificationListenerService extends Service {
        }
    }

    /**
     * Inform the notification manager that these notifications have been viewed by the
     * user.
     * @param keys Notifications to mark as seen.
     */
    public final void setNotificationsShown(String[] keys) {
        if (!isBound()) return;
        try {
            getNotificationInterface().setNotificationsShownFromListener(mWrapper, keys);
        } catch (android.os.RemoteException ex) {
            Log.v(TAG, "Unable to contact notification manager", ex);
        }
    }

    /**
     * Sets the notification trim that will be received via {@link #onNotificationPosted}.
     *
+21 −0
Original line number Diff line number Diff line
@@ -700,6 +700,26 @@ public abstract class BaseStatusBar extends SystemUI implements
        return isCurrentProfile(notificationUserId);
    }

    protected void setNotificationShown(StatusBarNotification n) {
        mNotificationListener.setNotificationsShown(new String[] { n.getKey() });
    }

    protected void setNotificationsShown(String[] keys) {
        mNotificationListener.setNotificationsShown(keys);
    }

    protected void setNotificationsShownAll() {
        ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
        final int N = activeNotifications.size();

        String[] keys = new String[N];
        for (int i = 0; i < N; i++) {
            NotificationData.Entry entry = activeNotifications.get(i);
            keys[i] = entry.key;
        }
        setNotificationsShown(keys);
    }

    protected boolean isCurrentProfile(int userId) {
        synchronized (mCurrentProfiles) {
            return userId == UserHandle.USER_ALL || mCurrentProfiles.get(userId) != null;
@@ -1681,6 +1701,7 @@ public abstract class BaseStatusBar extends SystemUI implements
                boolean clearNotificationEffects =
                        (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED);
                mBarService.onPanelRevealed(clearNotificationEffects);
                setNotificationsShownAll();
            } else {
                mBarService.onPanelHidden();
            }
Loading