HOTFIX (oc 1.3.20, ocw 1.0.2): fixed the creation of new accounts after installing... oc-android-1-3-20
authorDavid A. Velasco <dvelasco@solidgear.es>
Thu, 31 Jan 2013 15:17:32 +0000 (16:17 +0100)
committerDavid A. Velasco <dvelasco@solidgear.es>
Thu, 31 Jan 2013 15:17:32 +0000 (16:17 +0100)
AndroidManifest.xml
oc_jb_workaround/AndroidManifest.xml
oc_jb_workaround/res/values/strings.xml
oc_jb_workaround/res/xml/authenticator.xml
oc_jb_workaround/src/com/owncloud/android/workaround/accounts/AccountAuthenticatorService.java
src/com/owncloud/android/authenticator/AccountAuthenticator.java

index db6d31c..1ea115c 100644 (file)
@@ -17,8 +17,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
  -->\r
 <manifest package="com.owncloud.android"\r
   along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
  -->\r
 <manifest package="com.owncloud.android"\r
-    android:versionCode="103019"\r
-    android:versionName="1.3.19" xmlns:android="http://schemas.android.com/apk/res/android">\r
+    android:versionCode="103020"\r
+    android:versionName="1.3.20" xmlns:android="http://schemas.android.com/apk/res/android">\r
 \r
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />\r
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />\r
 \r
     <uses-permission android:name="android.permission.GET_ACCOUNTS" />\r
     <uses-permission android:name="android.permission.USE_CREDENTIALS" />\r
             android:name=".ui.activity.AuthenticatorActivity"\r
             android:exported="true"\r
             android:theme="@style/Theme.ownCloud.noActionBar" >\r
             android:name=".ui.activity.AuthenticatorActivity"\r
             android:exported="true"\r
             android:theme="@style/Theme.ownCloud.noActionBar" >\r
+            <intent-filter>\r
+                <action android:name="com.owncloud.android.workaround.accounts.CREATE" />\r
+                <category android:name="android.intent.category.DEFAULT" />\r
+            </intent-filter>\r
         </activity>\r
 \r
         <service android:name=".files.services.FileDownloader" >\r
         </activity>\r
 \r
         <service android:name=".files.services.FileDownloader" >\r
index 87458dd..acaf6eb 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.owncloud.android.workaround.accounts"
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.owncloud.android.workaround.accounts"
-    android:versionCode="0100001"
-    android:versionName="1.0" >
+    android:versionCode="0100002"
+    android:versionName="1.0.2" >
 
     <uses-sdk
         android:minSdkVersion="16"
 
     <uses-sdk
         android:minSdkVersion="16"
index 177c053..1bfdbe0 100644 (file)
@@ -2,5 +2,6 @@
 <resources>
 
     <string name="app_name">ownCloud Jelly Bean Workaround for lost credentials</string>
 <resources>
 
     <string name="app_name">ownCloud Jelly Bean Workaround for lost credentials</string>
-
+    <string name="oc_app_name">ownCloud</string>
+    
 </resources>
\ No newline at end of file
 </resources>
\ No newline at end of file
index a62aa21..0bb5760 100644 (file)
@@ -2,6 +2,6 @@
 <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
                        android:accountType="owncloud"
                        android:icon="@drawable/oc_icon"
 <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
                        android:accountType="owncloud"
                        android:icon="@drawable/oc_icon"
-                       android:label="@string/app_name"
+                       android:label="@string/oc_app_name"
                        android:smallIcon="@drawable/oc_icon">  
 </account-authenticator>
\ No newline at end of file
                        android:smallIcon="@drawable/oc_icon">  
 </account-authenticator>
\ No newline at end of file
index 2d81f65..32b164b 100644 (file)
@@ -15,6 +15,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.IBinder;
+//import android.util.Log;
 
 public class AccountAuthenticatorService extends Service {
 
 
 public class AccountAuthenticatorService extends Service {
 
@@ -35,6 +36,10 @@ public class AccountAuthenticatorService extends Service {
     
     public static class AccountAuthenticator extends AbstractAccountAuthenticator {
 
     
     public static class AccountAuthenticator extends AbstractAccountAuthenticator {
 
+        public static final String KEY_AUTH_TOKEN_TYPE = "authTokenType";
+        public static final String KEY_REQUIRED_FEATURES = "requiredFeatures";
+        public static final String KEY_LOGIN_OPTIONS = "loginOptions";
+       
        public AccountAuthenticator(Context context) {
             super(context);
         }
        public AccountAuthenticator(Context context) {
             super(context);
         }
@@ -44,7 +49,24 @@ public class AccountAuthenticatorService extends Service {
                 String accountType, String authTokenType,
                 String[] requiredFeatures, Bundle options)
                 throws NetworkErrorException {
                 String accountType, String authTokenType,
                 String[] requiredFeatures, Bundle options)
                 throws NetworkErrorException {
-            return getCommonResultBundle();
+               //Log.e("WORKAROUND", "Yes, WORKAROUND takes the control here");
+            final Intent intent = new Intent("com.owncloud.android.workaround.accounts.CREATE");
+            intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
+                    response);
+            intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
+            intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures);
+            intent.putExtra(KEY_LOGIN_OPTIONS, options);
+
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
+            intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
+            intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+            intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
+
+            final Bundle bundle = new Bundle();
+            bundle.putParcelable(AccountManager.KEY_INTENT, intent);
+            return bundle;
+            //return getCommonResultBundle();
         }
 
         
         }
 
         
@@ -89,7 +111,7 @@ public class AccountAuthenticatorService extends Service {
         public Bundle getAccountRemovalAllowed(
                 AccountAuthenticatorResponse response, Account account)
                 throws NetworkErrorException {
         public Bundle getAccountRemovalAllowed(
                 AccountAuthenticatorResponse response, Account account)
                 throws NetworkErrorException {
-            return getCommonResultBundle();
+            return super.getAccountRemovalAllowed(response, account);
         }
 
         private Bundle getCommonResultBundle() {
         }
 
         private Bundle getCommonResultBundle() {
index 58919ec..53183c6 100644 (file)
@@ -174,7 +174,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
     public Bundle hasFeatures(AccountAuthenticatorResponse response,\r
             Account account, String[] features) throws NetworkErrorException {\r
         final Bundle result = new Bundle();\r
     public Bundle hasFeatures(AccountAuthenticatorResponse response,\r
             Account account, String[] features) throws NetworkErrorException {\r
         final Bundle result = new Bundle();\r
-        result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);\r
+        result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);\r
         return result;\r
     }\r
 \r
         return result;\r
     }\r
 \r