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

Commit 5c65c7fc authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊 Committed by Nishith Khanna
Browse files

base: allow parental control to be activated with accounts

parent 417e0de8
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -623,6 +623,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
    private static final String TAG_TRANSFER_OWNERSHIP_BUNDLE = "transfer-ownership-bundle";
    private static final String PARENTALCONTROL_PKG = "foundation.e.parentalcontrol";
    private static final int REQUEST_EXPIRE_PASSWORD = 5571;
    private static final int REQUEST_PROFILE_OFF_DEADLINE = 5572;
@@ -17320,6 +17322,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                            + "current user cannot be system user when setting device owner");
                    return STATUS_SYSTEM_USER;
                }
                // Allow parental control with accounts
                if (owner != null && PARENTALCONTROL_PKG.equals(owner.getPackageName())) {
                    return STATUS_OK;
                }
                if (hasIncompatibleAccountsOrNonAdb) {
                    return STATUS_ACCOUNTS_NOT_EMPTY;
                }
@@ -18785,6 +18791,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        if (!isAdb(caller)) {
            return true;
        }
        // Allow parental control with accounts
        if (owner != null && PARENTALCONTROL_PKG.equals(owner.getPackageName())) {
            return false;
        }
        wtfIfInLock();
        return mInjector.binderWithCleanCallingIdentity(() -> {