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

Commit 78d769d1 authored by Adnan Begovic's avatar Adnan Begovic Committed by Eamon Powell
Browse files

admin: Restore requireSecureKeyguard interface.

Change-Id: I3c0533bafdae77df953d5bff457a4efdb94167e7
parent ae08fb94
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -12154,4 +12154,24 @@ public class DevicePolicyManager {
        }
        return false;
    }
    /**
     * Lineage: check if secure keyguard is required
     * @hide
     */
    public boolean requireSecureKeyguard() {
        return requireSecureKeyguard(UserHandle.myUserId());
    }
    /** @hide */
    public boolean requireSecureKeyguard(int userHandle) {
        if (mService != null) {
            try {
                return mService.requireSecureKeyguard(userHandle);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to get secure keyguard requirement");
            }
        }
        return true;
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -483,4 +483,6 @@ interface IDevicePolicyManager {
    long getManagedProfileMaximumTimeOff(in ComponentName admin);
    void setManagedProfileMaximumTimeOff(in ComponentName admin, long timeoutMs);
    boolean canProfileOwnerResetPasswordWhenLocked(in int userId);

    boolean requireSecureKeyguard(int userHandle);
}
+24 −0
Original line number Diff line number Diff line
@@ -8551,6 +8551,30 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                .write();
    }
    /**
     * @hide
     */
    @Override
    public boolean requireSecureKeyguard(int userHandle) {
        if (!mHasFeature) {
            return false;
        }
        int passwordQuality = getPasswordQuality(null, userHandle, false);
        if (passwordQuality > DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
            return true;
        }
        int encryptionStatus = getStorageEncryptionStatus(null, userHandle);
        if (encryptionStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE
                || encryptionStatus == DevicePolicyManager.ENCRYPTION_STATUS_ACTIVATING) {
            return true;
        }
        final int keyguardDisabledFeatures = getKeyguardDisabledFeatures(null, userHandle, false);
        return (keyguardDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
    }
    /**
     * Gets the disabled state for features in keyguard for the given admin,
     * or the aggregate of all active admins if who is null.