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

Commit 513cb892 authored by Adnan Begovic's avatar Adnan Begovic Committed by Sam Mortimer
Browse files

admin: Restore requireSecureKeyguard interface.

Change-Id: I3c0533bafdae77df953d5bff457a4efdb94167e7
parent acc60083
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -10931,4 +10931,24 @@ public class DevicePolicyManager {
        }
        }
        return false;
        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 Original line Diff line number Diff line
@@ -436,4 +436,6 @@ interface IDevicePolicyManager {
    boolean isUnattendedManagedKiosk();
    boolean isUnattendedManagedKiosk();


    boolean startViewCalendarEventInManagedProfile(String packageName, long eventId, long start, long end, boolean allDay, int flags);
    boolean startViewCalendarEventInManagedProfile(String packageName, long eventId, long start, long end, boolean allDay, int flags);

    boolean requireSecureKeyguard(int userHandle);
}
}
+25 −0
Original line number Original line Diff line number Diff line
@@ -7696,6 +7696,31 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                .write();
                .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,
     * Gets the disabled state for features in keyguard for the given admin,
     * or the aggregate of all active admins if who is null.
     * or the aggregate of all active admins if who is null.