HOTFIX (oc 1.3.20, ocw 1.0.2): fixed the creation of new accounts after installing the workaround app and rebooting

This commit is contained in:
David A. Velasco 2013-01-31 16:17:32 +01:00
parent 82ee5c46ee
commit 0f99bd59a1
6 changed files with 36 additions and 9 deletions

View file

@ -17,8 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<manifest package="com.owncloud.android"
android:versionCode="103019"
android:versionName="1.3.19" xmlns:android="http://schemas.android.com/apk/res/android">
android:versionCode="103020"
android:versionName="1.3.20" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
@ -121,6 +121,10 @@
android:name=".ui.activity.AuthenticatorActivity"
android:exported="true"
android:theme="@style/Theme.ownCloud.noActionBar" >
<intent-filter>
<action android:name="com.owncloud.android.workaround.accounts.CREATE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name=".files.services.FileDownloader" >

View 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"
android:versionCode="0100001"
android:versionName="1.0" >
android:versionCode="0100002"
android:versionName="1.0.2" >
<uses-sdk
android:minSdkVersion="16"

View file

@ -2,5 +2,6 @@
<resources>
<string name="app_name">ownCloud Jelly Bean Workaround for lost credentials</string>
<string name="oc_app_name">ownCloud</string>
</resources>

View file

@ -2,6 +2,6 @@
<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>

View file

@ -15,6 +15,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
//import android.util.Log;
public class AccountAuthenticatorService extends Service {
@ -35,6 +36,10 @@ public class AccountAuthenticatorService extends Service {
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);
}
@ -44,7 +49,24 @@ public class AccountAuthenticatorService extends Service {
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 {
return getCommonResultBundle();
return super.getAccountRemovalAllowed(response, account);
}
private Bundle getCommonResultBundle() {

View file

@ -174,7 +174,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
public Bundle hasFeatures(AccountAuthenticatorResponse response,
Account account, String[] features) throws NetworkErrorException {
final Bundle result = new Bundle();
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
return result;
}