Allow users to pick a notification assistant.

Test: manual. select and deselect an assistant, and verify that
the assistant can and then cannot get notification events.

Change-Id: If89c77f37170a44c827f997631aa7413da5a83e2
This commit is contained in:
Julia Reynolds
2016-11-08 14:45:34 -05:00
parent e185c5cc19
commit 0f3dd6d168
5 changed files with 135 additions and 5 deletions

View File

@@ -201,14 +201,21 @@ public class AppListPreference extends CustomListPreference {
try {
ActivityInfo activityInfo = AppGlobals.getPackageManager().getActivityInfo(
componentNames[i], 0, mUserId);
if (activityInfo == null) continue;
applicationNames.add(activityInfo.loadLabel(pm));
validatedComponentNames.add(componentNames[i].flattenToString());
entryDrawables.add(activityInfo.loadIcon(pm));
if (activityInfo != null) {
applicationNames.add(activityInfo.loadLabel(pm));
validatedComponentNames.add(componentNames[i].flattenToString());
entryDrawables.add(activityInfo.loadIcon(pm));
} else {
ApplicationInfo appInfo = pm.getApplicationInfoAsUser(
componentNames[i].getPackageName().toString(), 0, mUserId);
applicationNames.add(appInfo.loadLabel(pm));
validatedComponentNames.add(componentNames[i].flattenToString());
entryDrawables.add(appInfo.loadIcon(pm));
}
if (defaultCN != null && componentNames[i].equals(defaultCN)) {
selectedIndex = i;
}
} catch (RemoteException e) {
} catch (RemoteException|NameNotFoundException e) {
// Skip unknown packages.
}
}