Merge "Tolerate missing AccountManager resource, not just missing resource name"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5298d488b7
@@ -32,6 +32,7 @@ import android.content.Context;
|
|||||||
import android.content.SyncAdapterType;
|
import android.content.SyncAdapterType;
|
||||||
import android.content.SyncStatusObserver;
|
import android.content.SyncStatusObserver;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -136,7 +137,10 @@ class AccountPreferenceBase extends SettingsPreferenceFragment
|
|||||||
icon = authContext.getResources().getDrawable(desc.iconId);
|
icon = authContext.getResources().getDrawable(desc.iconId);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
// TODO: place holder icon for missing account icons?
|
// 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;
|
return icon;
|
||||||
@@ -155,7 +159,9 @@ class AccountPreferenceBase extends SettingsPreferenceFragment
|
|||||||
Context authContext = getActivity().createPackageContext(desc.packageName, 0);
|
Context authContext = getActivity().createPackageContext(desc.packageName, 0);
|
||||||
label = authContext.getResources().getText(desc.labelId);
|
label = authContext.getResources().getText(desc.labelId);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} 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;
|
return label;
|
||||||
@@ -179,6 +185,8 @@ class AccountPreferenceBase extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.w(TAG, "Couldn't load preferences.xml file from " + desc.packageName);
|
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;
|
return prefs;
|
||||||
|
@@ -23,6 +23,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SyncAdapterType;
|
import android.content.SyncAdapterType;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
@@ -199,7 +200,10 @@ public class ChooseAccountActivity extends PreferenceActivity {
|
|||||||
icon = authContext.getResources().getDrawable(desc.iconId);
|
icon = authContext.getResources().getDrawable(desc.iconId);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
// TODO: place holder icon for missing account icons?
|
// 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;
|
return icon;
|
||||||
@@ -218,7 +222,9 @@ public class ChooseAccountActivity extends PreferenceActivity {
|
|||||||
Context authContext = createPackageContext(desc.packageName, 0);
|
Context authContext = createPackageContext(desc.packageName, 0);
|
||||||
label = authContext.getResources().getText(desc.labelId);
|
label = authContext.getResources().getText(desc.labelId);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} 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;
|
return label;
|
||||||
|
Reference in New Issue
Block a user