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

Commit 3493cecd authored by DvTonder's avatar DvTonder
Browse files

Framework: Forward port Fix Profiles Insecure lock screen not working

This fixes Issue 6226: The insecure lockscreen setting is not being activated with
the use of profiles if the default is secure (PIN or Password)

Change-Id: Iaba6d39df0000da073c3ea0c35de1c78f63ad08d
parent 360f50e6
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AlertDialog;
import android.app.Profile;
import android.app.ProfileManager;
import android.app.SearchManager;
import android.app.admin.DevicePolicyManager;
import android.appwidget.AppWidgetHost;
@@ -101,6 +103,10 @@ public class KeyguardHostView extends KeyguardViewBase {

    private boolean mSafeModeEnabled;


     // We can use the profile manager to override security
     private ProfileManager mProfileManager;

     /*package*/ interface TransportCallback {
        void onListenerDetached();
        void onListenerAttached();
@@ -133,6 +139,8 @@ public class KeyguardHostView extends KeyguardViewBase {

        mViewStateManager = new KeyguardViewStateManager(this);

        mProfileManager = (ProfileManager) context.getSystemService(Context.PROFILE_SERVICE);

        DevicePolicyManager dpm =
            (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
        if (dpm != null) {
@@ -856,10 +864,12 @@ public class KeyguardHostView extends KeyguardViewBase {
        SecurityMode mode = mSecurityModel.getSecurityMode();
        switch (mode) {
            case Pattern:
                return mLockPatternUtils.isLockPatternEnabled();
                return mLockPatternUtils.isLockPatternEnabled()
                        && mProfileManager.getActiveProfile().getScreenLockMode()!= Profile.LockMode.INSECURE;
            case Password:
            case PIN:
                return mLockPatternUtils.isLockPasswordEnabled();
                return mLockPatternUtils.isLockPasswordEnabled()
                        && mProfileManager.getActiveProfile().getScreenLockMode() != Profile.LockMode.INSECURE;
            case SimPin:
            case SimPuk:
            case Account: