Hide notification channel slice that is interacted

- Ignore interacted package in ContextualNotificationChannelSlice.
- Regularly clear package record with background worker.

Bug:129726858
Test: visual, robotests

Change-Id: I94661a53bcbbe4a15479224c33cfb2eff345aa67
This commit is contained in:
Yanting Yang
2019-04-08 20:30:02 +08:00
parent db7f321526
commit 78e097f239
6 changed files with 290 additions and 3 deletions

View File

@@ -218,6 +218,17 @@ public class NotificationChannelSlice implements CustomSliceable {
.toIntent();
}
/**
* Check the package has been interacted by user or not.
* Will use to filter package in {@link #getRecentlyInstalledPackages()}.
*
* @param packageName The app package name.
* @return true if the package was interacted, false otherwise.
*/
protected boolean isUserInteracted(String packageName) {
return false;
}
@VisibleForTesting
IconCompat getApplicationIcon(String packageName) {
final Drawable drawable;
@@ -328,8 +339,9 @@ public class NotificationChannelSlice implements CustomSliceable {
final List<PackageInfo> installedPackages =
mContext.getPackageManager().getInstalledPackages(0);
for (PackageInfo packageInfo : installedPackages) {
// Not include system app.
if (packageInfo.applicationInfo.isSystemApp()) {
// Not include system app and interacted app.
if (packageInfo.applicationInfo.isSystemApp()
|| isUserInteracted(packageInfo.packageName)) {
continue;
}