OSDN Git Service

[RESTRICT AUTOMERGE] Make ScreenPinningSettings behaviour consistent with LockTaskCon...
authorJonathan Scott <scottjonathan@google.com>
Tue, 30 Apr 2019 14:52:52 +0000 (15:52 +0100)
committerNikoli Cartagena <dargeren@google.com>
Mon, 10 Jun 2019 21:55:03 +0000 (14:55 -0700)
Bug: 127605586
Test: Manual
Change-Id: Id85632b5e6975fc5f92d6e8126a6603a07f097e1
(cherry picked from commit 687b18067cb3bf28282376b311ece73b1c893254)

src/com/android/settings/security/ScreenPinningSettings.java

index 6e4856e..0af7b72 100644 (file)
@@ -115,9 +115,13 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
     }
 
     private boolean isScreenLockUsed() {
-        int def = getCurrentSecurityTitle() != R.string.screen_pinning_unlock_none ? 1 : 0;
-        return Settings.Secure.getInt(getContentResolver(),
-                Settings.Secure.LOCK_TO_APP_EXIT_LOCKED, def) != 0;
+        // This functionality should be kept consistent with
+        // com.android.server.wm.LockTaskController (see b/127605586)
+        int defaultValueIfSettingNull = mLockPatternUtils.isSecure(UserHandle.myUserId()) ? 1 : 0;
+        return Settings.Secure.getInt(
+                getContentResolver(),
+                Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
+                defaultValueIfSettingNull) != 0;
     }
 
     private boolean setScreenLockUsed(boolean isEnabled) {