Merge "Prompt for lock pin on VPN screen when credential restriction is enabled."
diff --git a/src/com/android/settings/CredentialStorage.java b/src/com/android/settings/CredentialStorage.java
index 60803dc..45d3d11 100644
--- a/src/com/android/settings/CredentialStorage.java
+++ b/src/com/android/settings/CredentialStorage.java
@@ -135,7 +135,13 @@
                 handleUnlockOrInstall();
             }
         } else {
-            finish();
+            // Users can set a screen lock if there is none even if they can't modify the
+            // credentials store.
+            if (ACTION_UNLOCK.equals(action) && mKeyStore.state() == KeyStore.State.UNINITIALIZED) {
+                ensureKeyGuard();
+            } else {
+                finish();
+            }
         }
     }