diff options
Diffstat (limited to 'src/com/android/settings/accounts')
4 files changed, 37 insertions, 16 deletions
diff --git a/src/com/android/settings/accounts/AccountPreferenceBase.java b/src/com/android/settings/accounts/AccountPreferenceBase.java index a84bece..a0d6a7f 100644 --- a/src/com/android/settings/accounts/AccountPreferenceBase.java +++ b/src/com/android/settings/accounts/AccountPreferenceBase.java @@ -32,6 +32,7 @@ import android.content.Context; import android.content.SyncAdapterType; import android.content.SyncStatusObserver; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; @@ -113,7 +114,7 @@ class AccountPreferenceBase extends SettingsPreferenceFragment mAccountTypeToAuthorities.put(sa.accountType, authorities); } if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.d(TAG, "added authority " + sa.authority + " to accountType " + Log.d(TAG, "added authority " + sa.authority + " to accountType " + sa.accountType); } authorities.add(sa.authority); @@ -136,7 +137,10 @@ class AccountPreferenceBase extends SettingsPreferenceFragment icon = authContext.getResources().getDrawable(desc.iconId); } catch (PackageManager.NameNotFoundException e) { // TODO: place holder icon for missing account icons? - Log.w(TAG, "No icon for account type " + accountType); + Log.w(TAG, "No icon name for account type " + accountType); + } catch (Resources.NotFoundException e) { + // TODO: place holder icon for missing account icons? + Log.w(TAG, "No icon resource for account type " + accountType); } } return icon; @@ -155,7 +159,9 @@ class AccountPreferenceBase extends SettingsPreferenceFragment Context authContext = getActivity().createPackageContext(desc.packageName, 0); label = authContext.getResources().getText(desc.labelId); } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, "No label for account type " + ", type " + accountType); + Log.w(TAG, "No label name for account type " + accountType); + } catch (Resources.NotFoundException e) { + Log.w(TAG, "No label icon for account type " + accountType); } } return label; @@ -179,6 +185,8 @@ class AccountPreferenceBase extends SettingsPreferenceFragment } } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Couldn't load preferences.xml file from " + desc.packageName); + } catch (Resources.NotFoundException e) { + Log.w(TAG, "Couldn't load preferences.xml file from " + desc.packageName); } } return prefs; diff --git a/src/com/android/settings/accounts/AccountSyncSettings.java b/src/com/android/settings/accounts/AccountSyncSettings.java index 9ef0481..547b0e1 100644 --- a/src/com/android/settings/accounts/AccountSyncSettings.java +++ b/src/com/android/settings/accounts/AccountSyncSettings.java @@ -16,10 +16,6 @@ package com.android.settings.accounts; -import com.android.settings.R; -import com.google.android.collect.Lists; -import com.google.android.collect.Maps; - import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountManagerCallback; @@ -53,6 +49,10 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; +import com.android.settings.R; +import com.google.android.collect.Lists; +import com.google.android.collect.Maps; + import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -175,7 +175,13 @@ public class AccountSyncSettings extends AccountPreferenceBase { mDateFormat = DateFormat.getDateFormat(activity); mTimeFormat = DateFormat.getTimeFormat(activity); - mAccount = (Account) getArguments().getParcelable(ACCOUNT_KEY); + Bundle arguments = getArguments(); + if (arguments == null) { + Log.e(TAG, "No arguments provided when starting intent. ACCOUNT_KEY needed."); + return; + } + + mAccount = (Account) arguments.getParcelable(ACCOUNT_KEY); if (mAccount != null) { if (Log.isLoggable(TAG, Log.VERBOSE)) Log.v(TAG, "Got account: " + mAccount); mUserId.setText(mAccount.name); @@ -486,11 +492,13 @@ public class AccountSyncSettings extends AccountPreferenceBase { protected void onAuthDescriptionsUpdated() { super.onAuthDescriptionsUpdated(); getPreferenceScreen().removeAll(); - mProviderIcon.setImageDrawable(getDrawableForType(mAccount.type)); - mProviderId.setText(getLabelForType(mAccount.type)); - PreferenceScreen prefs = addPreferencesForType(mAccount.type); - if (prefs != null) { - updatePreferenceIntents(prefs); + if (mAccount != null) { + mProviderIcon.setImageDrawable(getDrawableForType(mAccount.type)); + mProviderId.setText(getLabelForType(mAccount.type)); + PreferenceScreen prefs = addPreferencesForType(mAccount.type); + if (prefs != null) { + updatePreferenceIntents(prefs); + } } addPreferencesFromResource(R.xml.account_sync_settings); } diff --git a/src/com/android/settings/accounts/ChooseAccountActivity.java b/src/com/android/settings/accounts/ChooseAccountActivity.java index 9576dee..631fe47 100644 --- a/src/com/android/settings/accounts/ChooseAccountActivity.java +++ b/src/com/android/settings/accounts/ChooseAccountActivity.java @@ -23,6 +23,7 @@ import android.content.Context; import android.content.Intent; import android.content.SyncAdapterType; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.preference.Preference; @@ -199,7 +200,10 @@ public class ChooseAccountActivity extends PreferenceActivity { icon = authContext.getResources().getDrawable(desc.iconId); } catch (PackageManager.NameNotFoundException e) { // TODO: place holder icon for missing account icons? - Log.w(TAG, "No icon for account type " + accountType); + Log.w(TAG, "No icon name for account type " + accountType); + } catch (Resources.NotFoundException e) { + // TODO: place holder icon for missing account icons? + Log.w(TAG, "No icon resource for account type " + accountType); } } return icon; @@ -218,7 +222,9 @@ public class ChooseAccountActivity extends PreferenceActivity { Context authContext = createPackageContext(desc.packageName, 0); label = authContext.getResources().getText(desc.labelId); } catch (PackageManager.NameNotFoundException e) { - Log.w(TAG, "No label for account type " + ", type " + accountType); + Log.w(TAG, "No label name for account type " + accountType); + } catch (Resources.NotFoundException e) { + Log.w(TAG, "No label resource for account type " + accountType); } } return label; diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java index 06c5ff0..7d935f0 100644 --- a/src/com/android/settings/accounts/ManageAccountsSettings.java +++ b/src/com/android/settings/accounts/ManageAccountsSettings.java @@ -19,7 +19,6 @@ package com.android.settings.accounts; import com.android.settings.AccountPreference; import com.android.settings.DialogCreatable; import com.android.settings.R; -import com.android.settings.vpn.VpnTypeSelection; import com.google.android.collect.Maps; import android.accounts.Account; |