[Safer intents] Applications

To avoid implicit intents, make intents launch explicitly.

Test: build, robotest
Bug: 323061508
Change-Id: I9bf4eb102550f4afd8d14a6799940d37fc0ab9a7
This commit is contained in:
Jason Chiu
2024-03-27 11:49:33 +08:00
parent 9ab22c28fb
commit 071dfe8691
7 changed files with 22 additions and 3 deletions

View File

@@ -512,6 +512,7 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
} else {
Intent intent = new Intent(Intent.ACTION_QUERY_PACKAGE_RESTART,
Uri.fromParts("package", mAppEntry.info.packageName, null));
intent.setPackage("android");
intent.putExtra(Intent.EXTRA_PACKAGES, new String[]{mAppEntry.info.packageName});
intent.putExtra(Intent.EXTRA_UID, mAppEntry.info.uid);
intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(mAppEntry.info.uid));
@@ -538,6 +539,8 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
// Create new intent to launch Uninstaller activity
Uri packageUri = Uri.parse("package:" + packageName);
Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
uninstallIntent.setPackage(mContext.getString(
R.string.config_package_installer_package_name));
uninstallIntent.putExtra(Intent.EXTRA_UNINSTALL_ALL_USERS, allUsers);
mMetricsFeatureProvider.action(mActivity, SettingsEnums.ACTION_SETTINGS_UNINSTALL_APP);