Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 876e3017 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "RESTRICT AUTOMERGE [PM] Fix the profile issue in UninstallerActivity" into udc-dev

parents 9bc35a21 a30de548
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -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,14 +160,17 @@ public class UninstallerActivity extends Activity {
        if (mDialogInfo.user == null) {
            mDialogInfo.user = Process.myUserHandle();
        } else {
            List<UserHandle> profiles = userManager.getUserProfiles();
            if (!profiles.contains(mDialogInfo.user)) {
            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;
                }
            }
        }

        mDialogInfo.callback = intent.getParcelableExtra(PackageInstaller.EXTRA_CALLBACK,
                                            PackageManager.UninstallCompleteCallback.class);