Send attributionTag to notification APIs

Test: TH
Bug: 136595429
Change-Id: I4a5bb43a4aa5bfd88646771a0d1a2394d40e82e2
This commit is contained in:
Philip P. Moltmann
2020-03-24 11:46:48 -07:00
parent 87c0179c01
commit 288491c724
4 changed files with 11 additions and 9 deletions

View File

@@ -397,9 +397,9 @@ public class NotificationBackend {
return false;
}
public NotificationHistory getNotificationHistory(String pkg) {
public NotificationHistory getNotificationHistory(String pkg, String attributionTag) {
try {
return sINM.getNotificationHistory(pkg);
return sINM.getNotificationHistory(pkg, attributionTag);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
}

View File

@@ -50,7 +50,8 @@ public class HistoryLoader {
try {
Map<String, NotificationHistoryPackage> historicalNotifications = new HashMap<>();
NotificationHistory history =
mBackend.getNotificationHistory(mContext.getPackageName());
mBackend.getNotificationHistory(mContext.getPackageName(),
mContext.getAttributionTag());
while (history.hasNextNotification()) {
HistoricalNotification hn = history.getNextNotification();

View File

@@ -245,8 +245,9 @@ public class NotificationHistoryActivity extends Activity {
StatusBarNotification[] dismissed = null;
try {
snoozed = getSnoozedNotifications();
dismissed = mNm.getHistoricalNotifications(
NotificationHistoryActivity.this.getPackageName(), 6, false);
dismissed = mNm.getHistoricalNotificationsWithAttribution(
NotificationHistoryActivity.this.getPackageName(),
NotificationHistoryActivity.this.getAttributionTag(), 6, false);
} catch (SecurityException | RemoteException e) {
Log.d(TAG, "OnPaused called while trying to retrieve notifications");
}

View File

@@ -372,10 +372,10 @@ public class NotificationStation extends SettingsPreferenceFragment {
*/
private void loadNotifications() {
try {
StatusBarNotification[] active = mNoMan.getActiveNotifications(
mContext.getPackageName());
StatusBarNotification[] dismissed = mNoMan.getHistoricalNotifications(
mContext.getPackageName(), 50, false);
StatusBarNotification[] active = mNoMan.getActiveNotificationsWithAttribution(
mContext.getPackageName(), mContext.getAttributionTag());
StatusBarNotification[] dismissed = mNoMan.getHistoricalNotificationsWithAttribution(
mContext.getPackageName(), mContext.getAttributionTag(), 50, false);
List<HistoricalNotificationInfo> list
= new ArrayList<>(active.length + dismissed.length);