Revert commit 6cdd830a7be28b77688efc3cd62857c1e71a1342
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / AuthenticatorActivity.java
index f6decb8..1247f3f 100644 (file)
@@ -153,6 +153,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     \r
     private boolean mServerIsChecked = false;\r
     private boolean mServerIsValid = false;\r
+    private boolean mPendingAutoCheck = false;\r
 \r
     private GetServerInfoOperation.ServerInfo mServerInfo = \r
             new GetServerInfoOperation.ServerInfo();\r
@@ -174,7 +175,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     \r
     /// Identifier of operation in progress which result shouldn't be lost \r
     private long mWaitingForOpId = Long.MAX_VALUE;\r
-    \r
+\r
     \r
     /**\r
      * {@inheritDoc}\r
@@ -406,12 +407,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         });\r
      \r
         \r
-        /// step 4 - automatic actions to start\r
-        if (savedInstanceState == null) {\r
-            if (mAction != ACTION_CREATE || !isUrlInputAllowed) {\r
-                checkOcServer(); \r
-            }\r
-        }\r
+        /// step 4 - mark automatic check to be started when OperationsService is ready\r
+        mPendingAutoCheck = (savedInstanceState == null && \r
+                (mAction != ACTION_CREATE || !isUrlInputAllowed));\r
     }\r
     \r
     \r
@@ -729,6 +727,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             if (mOperationsServiceBinder != null) {\r
                 //Log_OC.wtf(TAG, "checking server..." );\r
                 mWaitingForOpId = mOperationsServiceBinder.newOperation(getServerInfoIntent);\r
+            } else {\r
+              Log_OC.wtf(TAG, "Server check tried with OperationService unbound!" );\r
             }\r
             \r
         } else {\r
@@ -1745,6 +1745,10 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         if (mWaitingForOpId <= Integer.MAX_VALUE) {\r
             mOperationsServiceBinder.dispatchResultIfFinished((int)mWaitingForOpId, this);\r
         }\r
+        \r
+        if (mPendingAutoCheck) {\r
+            checkOcServer();\r
+        }\r
     }\r
 \r
     \r