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

Commit a7aa2d2c authored by Sinduran Sivarajan's avatar Sinduran Sivarajan Committed by Evelyn Torres
Browse files

Disable "Developer options" by default for managed profiles.

DISABLE_TOPIC_PROTECTOR

Bug: 382064697
Test: go/work-profile-creation-developer-access
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d5783311183adc56c87ce7f7a3ab7f561e03ecc0)
Merged-In: Ibe6b721f2552d9e72aba0582a2eed4ba87178c7c
Change-Id: Ibe6b721f2552d9e72aba0582a2eed4ba87178c7c
parent 43281258
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -258,7 +258,8 @@ public class UserRestrictionsUtils {
     * in settings. So it is handled separately.
     */
    private static final Set<String> DEFAULT_ENABLED_FOR_MANAGED_PROFILES = Sets.newArraySet(
            UserManager.DISALLOW_BLUETOOTH_SHARING
            UserManager.DISALLOW_BLUETOOTH_SHARING,
            UserManager.DISALLOW_DEBUGGING_FEATURES
    );

    /**
+13 −1
Original line number Diff line number Diff line
@@ -8877,7 +8877,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                return false;
            }
            if (isAdb(caller)) {
            boolean isAdb = isAdb(caller);
            if (isAdb) {
                // Log profile owner provisioning was started using adb.
                MetricsLogger.action(mContext, PROVISIONING_ENTRY_POINT_ADB, LOG_TAG_PROFILE_OWNER);
                DevicePolicyEventLogger
@@ -8900,6 +8901,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                            UserRestrictionsUtils.getDefaultEnabledForManagedProfiles());
                    ensureUnknownSourcesRestrictionForProfileOwnerLocked(userHandle, admin,
                            true /* newOwner */);
                    if (isAdb) {
                        // DISALLOW_DEBUGGING_FEATURES is being added to newly-created
                        // work profile by default due to b/382064697 . This would have
                        //  impacted certain CTS test flows when they interact with the
                        // work profile via ADB (for example installing an app into the
                        // work profile). Remove DISALLOW_DEBUGGING_FEATURES here to
                        // reduce the potential impact.
                        admin.ensureUserRestrictions().putBoolean(
                            UserManager.DISALLOW_DEBUGGING_FEATURES, false);
                        saveUserRestrictionsLocked(userHandle);
                    }
                }
                sendOwnerChangedBroadcast(DevicePolicyManager.ACTION_PROFILE_OWNER_CHANGED,
                        userHandle);