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

Commit 669ebc9b authored by Roman Kalukiewicz's avatar Roman Kalukiewicz Committed by Android (Google) Code Review
Browse files

Merge "Allow users to add profile owner after setup if the supervision role is set."

parents 6b8ddccb f6a7b65a
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -311,11 +311,13 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {
                return;
            }

            // othewise, only the defined default supervision profile owner can be set after user
            // setup.
            // otherwise, only the defined default supervision profile owner or holder of
            // supersvision role can be set after user setup.
            final String supervisor = getString(
                    com.android.internal.R.string.config_defaultSupervisionProfileOwnerComponent);
            if (TextUtils.isEmpty(supervisor)) {
            final String supervisionRolePackage = getString(
                    com.android.internal.R.string.config_systemSupervision);
            if (TextUtils.isEmpty(supervisor) && TextUtils.isEmpty(supervisionRolePackage)) {
                Log.w(TAG, "Unable to set profile owner post-setup, no default supervisor"
                        + "profile owner defined");
                finish();
@@ -324,7 +326,8 @@ public class DeviceAdminAdd extends CollapsingToolbarBaseActivity {

            final ComponentName supervisorComponent = ComponentName.unflattenFromString(
                    supervisor);
            if (supervisorComponent == null || who.compareTo(supervisorComponent) != 0) {
            if (!who.equals(supervisorComponent)
                    && !who.getPackageName().equals(supervisionRolePackage)) {
                Log.w(TAG, "Unable to set non-default profile owner post-setup " + who);
                finish();
                return;