Remove the package name restriction of ACTION_UNINSTALL_PACKAGE

PackageInstaller has protected the intent action by setting
"android:priority=1".

Test: manual
Fix: 332228634
Change-Id: If0794e5957366d8b26acd0362b59c6c9076a0c4f
This commit is contained in:
Jason Chiu
2024-04-17 16:26:52 +08:00
parent 523fd97cb4
commit 5d82f6a648
5 changed files with 1 additions and 10 deletions

View File

@@ -34,7 +34,6 @@ import android.util.Log;
import androidx.fragment.app.FragmentActivity;
import com.android.settings.R;
import com.android.settings.Utils;
import java.util.HashSet;
@@ -79,8 +78,6 @@ public class CloneBackend {
// 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);
uninstallIntent.putExtra(Intent.EXTRA_USER, UserHandle.of(mCloneUserId));
// Trigger uninstall as clone user.