Display recent apps in notification settings

The last 5 non-system apps that have sent notifications
will be displayed at the top level of notification settings for
easy access.

Test: make -j20 RunSettingsRoboTests
Change-Id: Ifaae36f977beb0438a740f61ff0ac9c97f3acc80
Fixes: 63927402
This commit is contained in:
Julia Reynolds
2018-01-22 16:20:47 -05:00
parent aaf307e71d
commit 02af3659e0
7 changed files with 758 additions and 6 deletions

View File

@@ -27,12 +27,16 @@ import android.content.pm.ParceledListSlice;
import android.graphics.drawable.Drawable;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.service.notification.NotifyingApp;
import android.util.IconDrawableFactory;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settingslib.Utils;
import java.util.ArrayList;
import java.util.List;
public class NotificationBackend {
private static final String TAG = "NotificationBackend";
@@ -185,7 +189,6 @@ public class NotificationBackend {
}
}
public int getDeletedChannelCount(String pkg, int uid) {
try {
return sINM.getDeletedChannelCount(pkg, uid);
@@ -204,6 +207,15 @@ public class NotificationBackend {
}
}
public List<NotifyingApp> getRecentApps() {
try {
return sINM.getRecentNotifyingAppsForUser(UserHandle.myUserId()).getList();
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return new ArrayList<>();
}
}
static class Row {
public String section;
}