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

Commit 6107812d authored by Alex Johnston's avatar Alex Johnston Committed by Automerger Merge Worker
Browse files

Merge "DPMS workaround to check the device owner type in PermissionController"...

Merge "DPMS workaround to check the device owner type in PermissionController" into tm-dev am: 2d31bbe7 am: 36c0b2d1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19034752



Change-Id: Iab524e7ab8bba033093c3a1aeb52d88f79e23581
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 48fbc807 36c0b2d1
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1981,6 +1981,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        synchronized (getLockObject()) {
            mOwners.load();
            setDeviceOwnershipSystemPropertyLocked();
            if (mOwners.hasDeviceOwner()) {
                setGlobalSettingDeviceOwnerType(
                        mOwners.getDeviceOwnerType(mOwners.getDeviceOwnerPackageName()));
            }
        }
    }
@@ -8804,6 +8808,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        deleteTransferOwnershipBundleLocked(userId);
        toggleBackupServiceActive(UserHandle.USER_SYSTEM, true);
        pushUserControlDisabledPackagesLocked(userId);
        setGlobalSettingDeviceOwnerType(DEVICE_OWNER_TYPE_DEFAULT);
    }
    private void clearApplicationRestrictions(int userId) {
@@ -18363,6 +18368,14 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                "Test only admins can only set the device owner type more than once");
        mOwners.setDeviceOwnerType(packageName, deviceOwnerType, isAdminTestOnly);
        setGlobalSettingDeviceOwnerType(deviceOwnerType);
    }
    // TODO(b/237065504): Allow mainline modules to get the device owner type. This is a workaround
    // to get the device owner type in PermissionController. See HibernationPolicy.kt.
    private void setGlobalSettingDeviceOwnerType(int deviceOwnerType) {
        mInjector.binderWithCleanCallingIdentity(
                () -> mInjector.settingsGlobalPutInt("device_owner_type", deviceOwnerType));
    }
    @Override