Misc cleanup on AndroidManifest.xml
- Add a few activities to widget list. These are more commonly used settings, so adding them to widget list for easier access. - Storage - System - About phone - Remove useless intent-filters from AndroidManifest. - If the intent-filter is just action MAIN and category DEFAULT, it doesn't do anything. Bug: 74806595 Test: visual Change-Id: I5d80bc6c88f7bf60adabac872e92b72b341b97e6
This commit is contained in:
@@ -191,37 +191,4 @@ public class CreateShortcut extends LauncherActivity {
|
||||
return new Intent(Intent.ACTION_MAIN).addCategory("com.android.settings.SHORTCUT");
|
||||
}
|
||||
|
||||
public static class ShortcutsUpdateTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
public ShortcutsUpdateTask(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void doInBackground(Void... params) {
|
||||
ShortcutManager sm = mContext.getSystemService(ShortcutManager.class);
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
|
||||
List<ShortcutInfo> updates = new ArrayList<>();
|
||||
for (ShortcutInfo info : sm.getPinnedShortcuts()) {
|
||||
if (!info.getId().startsWith(SHORTCUT_ID_PREFIX)) {
|
||||
continue;
|
||||
}
|
||||
ComponentName cn = ComponentName.unflattenFromString(
|
||||
info.getId().substring(SHORTCUT_ID_PREFIX.length()));
|
||||
ResolveInfo ri = pm.resolveActivity(getBaseIntent().setComponent(cn), 0);
|
||||
if (ri == null) {
|
||||
continue;
|
||||
}
|
||||
updates.add(new ShortcutInfo.Builder(mContext, info.getId())
|
||||
.setShortLabel(ri.loadLabel(pm)).build());
|
||||
}
|
||||
if (!updates.isEmpty()) {
|
||||
sm.updateShortcuts(updates);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user