am eef25288: Merge "KeyStore: stop using state()"

# Via Gerrit Code Review (1) and Kenny Root (1)
* commit 'eef252881a9194777399d2dc4ece744b3407129c':
  KeyStore: stop using state()
diff --git a/src/com/android/keychain/KeyChainActivity.java b/src/com/android/keychain/KeyChainActivity.java
index 1811fbf..e7b161b 100644
--- a/src/com/android/keychain/KeyChainActivity.java
+++ b/src/com/android/keychain/KeyChainActivity.java
@@ -74,12 +74,6 @@
     // be done on the UI thread.
     private KeyStore mKeyStore = KeyStore.getInstance();
 
-    // the KeyStore.state operation is safe to do on the UI thread, it
-    // does not do a file operation.
-    private boolean isKeyStoreUnlocked() {
-        return mKeyStore.state() == KeyStore.State.UNLOCKED;
-    }
-
     @Override public void onCreate(Bundle savedState) {
         super.onCreate(savedState);
         if (savedState == null) {
@@ -114,7 +108,7 @@
         // see if KeyStore has been unlocked, if not start activity to do so
         switch (mState) {
             case INITIAL:
-                if (!isKeyStoreUnlocked()) {
+                if (!mKeyStore.isUnlocked()) {
                     mState = State.UNLOCK_REQUESTED;
                     this.startActivityForResult(new Intent(Credentials.UNLOCK_ACTION),
                                                 REQUEST_UNLOCK);
@@ -362,7 +356,7 @@
     @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         switch (requestCode) {
             case REQUEST_UNLOCK:
-                if (isKeyStoreUnlocked()) {
+                if (mKeyStore.isUnlocked()) {
                     showCertChooserDialog();
                 } else {
                     // user must have canceled unlock, give up
diff --git a/src/com/android/keychain/KeyChainService.java b/src/com/android/keychain/KeyChainService.java
index 1c41957..a2b44e8 100644
--- a/src/com/android/keychain/KeyChainService.java
+++ b/src/com/android/keychain/KeyChainService.java
@@ -111,7 +111,7 @@
             if (alias == null) {
                 throw new NullPointerException("alias == null");
             }
-            if (!isKeyStoreUnlocked()) {
+            if (!mKeyStore.isUnlocked()) {
                 throw new IllegalStateException("keystore is "
                         + mKeyStore.state().toString());
             }
@@ -123,10 +123,6 @@
             }
         }
 
-        private boolean isKeyStoreUnlocked() {
-            return (mKeyStore.state() == KeyStore.State.UNLOCKED);
-        }
-
         @Override public void installCaCertificate(byte[] caCertificate) {
             checkCertInstallerOrSystemCaller();
             try {