diff options
| author | 2025-01-07 20:34:00 -0800 | |
|---|---|---|
| committer | 2025-01-07 20:34:00 -0800 | |
| commit | bea32799b42f533bd13c4e3e378efea3d3ebf813 (patch) | |
| tree | dee8dded829c2da0b4d5aeb6da4b925fcdcd278a | |
| parent | c26fef3e92cfb530784379de62a77d913fec3c07 (diff) | |
| parent | a6a7d2e1966739708a1f3be20110fc5b29fd71b7 (diff) | |
Merge "RESTRICT AUTOMERGE [PM] Fix the profile issue in UninstallerActivity" into udc-qpr-dev
| -rw-r--r-- | packages/PackageInstaller/src/com/android/packageinstaller/UninstallerActivity.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/packages/PackageInstaller/src/com/android/packageinstaller/UninstallerActivity.java b/packages/PackageInstaller/src/com/android/packageinstaller/UninstallerActivity.java index 9c67817cbef4..bf3bc8e7dcb3 100644 --- a/packages/PackageInstaller/src/com/android/packageinstaller/UninstallerActivity.java +++ b/packages/PackageInstaller/src/com/android/packageinstaller/UninstallerActivity.java @@ -56,8 +56,6 @@ import com.android.packageinstaller.television.ErrorFragment; import com.android.packageinstaller.television.UninstallAlertFragment; import com.android.packageinstaller.television.UninstallAppProgress; -import java.util.List; - /* * This activity presents UI to uninstall an application. Usually launched with intent * Intent.ACTION_UNINSTALL_PKG_COMMAND and attribute @@ -162,12 +160,15 @@ public class UninstallerActivity extends Activity { if (mDialogInfo.user == null) { mDialogInfo.user = Process.myUserHandle(); } else { - List<UserHandle> profiles = userManager.getUserProfiles(); - if (!profiles.contains(mDialogInfo.user)) { - Log.e(TAG, "User " + Process.myUserHandle() + " can't request uninstall " - + "for user " + mDialogInfo.user); - showUserIsNotAllowed(); - return; + if (!mDialogInfo.user.equals(Process.myUserHandle())) { + final boolean isCurrentUserProfileOwner = Process.myUserHandle().equals( + userManager.getProfileParent(mDialogInfo.user)); + if (!isCurrentUserProfileOwner) { + Log.e(TAG, "User " + Process.myUserHandle() + " can't request uninstall " + + "for user " + mDialogInfo.user); + showUserIsNotAllowed(); + return; + } } } |