Merge "Return null when user is locked" into nyc-dev
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index c792c11..480da72 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -828,6 +828,10 @@
                     account.type);
             throw new SecurityException(msg);
         }
+        if (!isUserUnlocked(userId)) {
+            Log.w(TAG, "User " + userId + " data is locked. callingUid " + callingUid);
+            return null;
+        }
         long identityToken = clearCallingIdentity();
         try {
             UserAccounts accounts = getUserAccounts(userId);
@@ -1788,6 +1792,11 @@
                     account.type);
             throw new SecurityException(msg);
         }
+        if (!isUserUnlocked(userId)) {
+            Log.w(TAG, "Authtoken not available - user " + userId + " data is locked. callingUid "
+                    + callingUid);
+            return null;
+        }
         long identityToken = clearCallingIdentity();
         try {
             UserAccounts accounts = getUserAccounts(userId);