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

Commit b03d1098 authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas Committed by Android (Google) Code Review
Browse files

Merge "Update DPM.setProfileOwner call in DeviceAdminAdd"

parents e68cf6df 07695a58
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -123,7 +123,6 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
    AppOpsManager mAppOps;
    DeviceAdminInfo mDeviceAdmin;
    String mAddMsgText;
    String mProfileOwnerName;

    ImageView mAdminIcon;
    TextView mAdminName;
@@ -189,8 +188,6 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
            setResult(RESULT_CANCELED);
            setFinishOnTouchOutside(true);
            mAddingProfileOwner = true;
            mProfileOwnerName =
                    getIntent().getStringExtra(DevicePolicyManager.EXTRA_PROFILE_OWNER_NAME);
            String callingPackage = getCallingPackage();
            if (callingPackage == null || !callingPackage.equals(who.getPackageName())) {
                Log.e(TAG, "Unknown or incorrect caller");
@@ -338,6 +335,8 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
                    .create();
            dialog.show();

            String profileOwnerName =
                    getIntent().getStringExtra(DevicePolicyManager.EXTRA_PROFILE_OWNER_NAME);
            mActionButton = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE);
            mActionButton.setFilterTouchesWhenObscured(true);
            mAddMsg = dialog.findViewById(R.id.add_msg_simplified);
@@ -346,7 +345,7 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
            mAdminWarning.setText(
                    mDPM.getResources().getString(NEW_DEVICE_ADMIN_WARNING_SIMPLIFIED, () ->
                            getString(R.string.device_admin_warning_simplified,
                    mProfileOwnerName), mProfileOwnerName));
                            profileOwnerName), profileOwnerName));
            return;
        }
        setContentView(R.layout.device_admin_add);
@@ -524,8 +523,7 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
        }
        if (mAddingProfileOwner) {
            try {
                mDPM.setProfileOwner(mDeviceAdmin.getComponent(),
                        mProfileOwnerName, UserHandle.myUserId());
                mDPM.setProfileOwner(mDeviceAdmin.getComponent(), UserHandle.myUserId());
            } catch (RuntimeException re) {
                setResult(Activity.RESULT_CANCELED);
            }