summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-10-10 10:58:58 -0700
committerAlan Viverette <alanv@google.com>2014-10-10 10:58:58 -0700
commit0ba89bd54c4b44b3803342da10b0c08b0bf76ad4 (patch)
tree512ff72b2ba57474c60e303c6122d4ad05df3744 /src/com
parent90625329608c19c3a0b8f7c98bb8710fe346a220 (diff)
downloadpackages_apps_Settings-0ba89bd54c4b44b3803342da10b0c08b0bf76ad4.tar.gz
packages_apps_Settings-0ba89bd54c4b44b3803342da10b0c08b0bf76ad4.tar.bz2
packages_apps_Settings-0ba89bd54c4b44b3803342da10b0c08b0bf76ad4.zip
Update Settings to use themed Context.getDrawable()
Explicit null theme is passed when using Resources.getDrawable() and no theme is available, e.g. when using getResourcesForApplication(). This fixes an issue with ic_text_dot theming and helps avoid similar issues in the future. BUG: 17648301 Change-Id: I3e97c3490b6f2a55744f567b21284f2935ae9af7
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/settings/ActivityPicker.java2
-rw-r--r--src/com/android/settings/MasterClear.java2
-rw-r--r--src/com/android/settings/RegulatoryInfoDisplayActivity.java2
-rw-r--r--src/com/android/settings/UserSpinnerAdapter.java2
-rw-r--r--src/com/android/settings/Utils.java3
-rw-r--r--src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java4
-rw-r--r--src/com/android/settings/accounts/AuthenticatorHelper.java2
-rw-r--r--src/com/android/settings/accounts/ChooseAccountActivity.java2
-rw-r--r--src/com/android/settings/applications/AppOpsState.java2
-rw-r--r--src/com/android/settings/applications/ApplicationsState.java2
-rw-r--r--src/com/android/settings/applications/RunningState.java2
-rwxr-xr-xsrc/com/android/settings/bluetooth/DeviceProfilesSettings.java2
-rw-r--r--src/com/android/settings/fuelgauge/BatteryEntry.java4
-rw-r--r--src/com/android/settings/fuelgauge/PowerUsageDetail.java2
-rw-r--r--src/com/android/settings/net/UidDetailProvider.java2
-rw-r--r--src/com/android/settings/notification/NotificationStation.java2
16 files changed, 19 insertions, 18 deletions
diff --git a/src/com/android/settings/ActivityPicker.java b/src/com/android/settings/ActivityPicker.java
index edbccc3fb..7c269238e 100644
--- a/src/com/android/settings/ActivityPicker.java
+++ b/src/com/android/settings/ActivityPicker.java
@@ -159,7 +159,7 @@ public class ActivityPicker extends AlertActivity implements
Resources res = packageManager.getResourcesForApplication(
iconResource.packageName);
icon = res.getDrawable(res.getIdentifier(
- iconResource.resourceName, null, null));
+ iconResource.resourceName, null, null), null);
} catch (NameNotFoundException e) {
// Ignore
}
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index bbd98fb0c..6a0a24917 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -212,7 +212,7 @@ public class MasterClear extends Fragment {
try {
if (desc.iconId != 0) {
Context authContext = context.createPackageContext(desc.packageName, 0);
- icon = authContext.getResources().getDrawable(desc.iconId);
+ icon = authContext.getDrawable(desc.iconId);
}
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "No icon for account type " + desc.type);
diff --git a/src/com/android/settings/RegulatoryInfoDisplayActivity.java b/src/com/android/settings/RegulatoryInfoDisplayActivity.java
index 171059c29..c674f13f1 100644
--- a/src/com/android/settings/RegulatoryInfoDisplayActivity.java
+++ b/src/com/android/settings/RegulatoryInfoDisplayActivity.java
@@ -63,7 +63,7 @@ public class RegulatoryInfoDisplayActivity extends Activity implements
int resId = getResourceId();
if (resId != 0) {
try {
- Drawable d = resources.getDrawable(resId);
+ Drawable d = getDrawable(resId);
// set to false if the width or height is <= 2
// (missing PNG can return an empty 2x2 pixel Drawable)
regulatoryInfoDrawableExists = (d.getIntrinsicWidth() > 2
diff --git a/src/com/android/settings/UserSpinnerAdapter.java b/src/com/android/settings/UserSpinnerAdapter.java
index 001dfc460..eb4a118f9 100644
--- a/src/com/android/settings/UserSpinnerAdapter.java
+++ b/src/com/android/settings/UserSpinnerAdapter.java
@@ -51,7 +51,7 @@ public class UserSpinnerAdapter implements SpinnerAdapter {
UserInfo userInfo = um.getUserInfo(mUserHandle.getIdentifier());
if (userInfo.isManagedProfile()) {
name = context.getString(R.string.managed_user_title);
- icon = Resources.getSystem().getDrawable(
+ icon = context.getDrawable(
com.android.internal.R.drawable.ic_corp_icon);
} else {
name = userInfo.name;
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 04160fbfd..88536c481 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -211,7 +211,8 @@ public final class Utils {
Bundle metaData = resolveInfo.activityInfo.metaData;
if (res != null && metaData != null) {
- icon = res.getDrawable(metaData.getInt(META_DATA_PREFERENCE_ICON));
+ icon = res.getDrawable(
+ metaData.getInt(META_DATA_PREFERENCE_ICON), null);
title = res.getString(metaData.getInt(META_DATA_PREFERENCE_TITLE));
summary = res.getString(metaData.getInt(META_DATA_PREFERENCE_SUMMARY));
}
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index 9fe224ee5..f38d48286 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -231,7 +231,7 @@ public class ToggleAccessibilityServicePreferenceFragment
ImageView imageView = (ImageView) capabilityView.findViewById(
com.android.internal.R.id.perm_icon);
- imageView.setImageDrawable(getResources().getDrawable(
+ imageView.setImageDrawable(getActivity().getDrawable(
com.android.internal.R.drawable.ic_text_dot));
TextView labelView = (TextView) capabilityView.findViewById(
@@ -257,7 +257,7 @@ public class ToggleAccessibilityServicePreferenceFragment
imageView = (ImageView) capabilityView.findViewById(
com.android.internal.R.id.perm_icon);
- imageView.setImageDrawable(getResources().getDrawable(
+ imageView.setImageDrawable(getActivity().getDrawable(
com.android.internal.R.drawable.ic_text_dot));
labelView = (TextView) capabilityView.findViewById(
diff --git a/src/com/android/settings/accounts/AuthenticatorHelper.java b/src/com/android/settings/accounts/AuthenticatorHelper.java
index cc8a6d58c..3757d97c6 100644
--- a/src/com/android/settings/accounts/AuthenticatorHelper.java
+++ b/src/com/android/settings/accounts/AuthenticatorHelper.java
@@ -111,7 +111,7 @@ final public class AuthenticatorHelper extends BroadcastReceiver {
Context authContext = context.createPackageContextAsUser(desc.packageName, 0,
mUserHandle);
icon = mContext.getPackageManager().getUserBadgedIcon(
- authContext.getResources().getDrawable(desc.iconId), mUserHandle);
+ authContext.getDrawable(desc.iconId), mUserHandle);
synchronized (mAccTypeIconCache) {
mAccTypeIconCache.put(accountType, icon);
}
diff --git a/src/com/android/settings/accounts/ChooseAccountActivity.java b/src/com/android/settings/accounts/ChooseAccountActivity.java
index e52d640be..5e7e81e16 100644
--- a/src/com/android/settings/accounts/ChooseAccountActivity.java
+++ b/src/com/android/settings/accounts/ChooseAccountActivity.java
@@ -216,7 +216,7 @@ public class ChooseAccountActivity extends PreferenceActivity {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
Context authContext = createPackageContextAsUser(desc.packageName, 0, mUserHandle);
icon = getPackageManager().getUserBadgedIcon(
- authContext.getResources().getDrawable(desc.iconId), mUserHandle);
+ authContext.getDrawable(desc.iconId), mUserHandle);
} catch (PackageManager.NameNotFoundException e) {
// TODO: place holder icon for missing account icons?
Log.w(TAG, "No icon name for account type " + accountType);
diff --git a/src/com/android/settings/applications/AppOpsState.java b/src/com/android/settings/applications/AppOpsState.java
index 580c44e66..1ab3c7344 100644
--- a/src/com/android/settings/applications/AppOpsState.java
+++ b/src/com/android/settings/applications/AppOpsState.java
@@ -269,7 +269,7 @@ public class AppOpsState {
return mIcon;
}
- return mState.mContext.getResources().getDrawable(
+ return mState.mContext.getDrawable(
android.R.drawable.sym_def_app_icon);
}
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java
index 1c2eb2c70..9c5118150 100644
--- a/src/com/android/settings/applications/ApplicationsState.java
+++ b/src/com/android/settings/applications/ApplicationsState.java
@@ -144,7 +144,7 @@ public class ApplicationsState {
return true;
} else {
this.mounted = false;
- this.icon = context.getResources().getDrawable(
+ this.icon = context.getDrawable(
com.android.internal.R.drawable.sym_app_on_sd_unavailable_icon);
}
} else if (!this.mounted) {
diff --git a/src/com/android/settings/applications/RunningState.java b/src/com/android/settings/applications/RunningState.java
index 1019abca2..1d24148c9 100644
--- a/src/com/android/settings/applications/RunningState.java
+++ b/src/com/android/settings/applications/RunningState.java
@@ -679,7 +679,7 @@ public class RunningState {
return constState.newDrawable();
}
}
- return context.getResources().getDrawable(
+ return context.getDrawable(
com.android.internal.R.drawable.ic_menu_cc);
}
}
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index 757535a7c..0109e35ee 100755
--- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
+++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
@@ -194,7 +194,7 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
int iconResource = profile.getDrawableResource(mCachedDevice.getBtClass());
if (iconResource != 0) {
- pref.setIcon(getResources().getDrawable(iconResource));
+ pref.setIcon(getActivity().getDrawable(iconResource));
}
refreshProfilePreference(pref, profile);
diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java
index 4ff4dfd14..0dfd5c9d8 100644
--- a/src/com/android/settings/fuelgauge/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryEntry.java
@@ -189,7 +189,7 @@ public class BatteryEntry {
break;
}
if (iconId > 0) {
- icon = context.getResources().getDrawable(iconId);
+ icon = context.getDrawable(iconId);
}
if ((name == null || iconId == 0) && this.sipper.uidObj != null) {
getQuickNameIconForUid(this.sipper.uidObj);
@@ -228,7 +228,7 @@ public class BatteryEntry {
name = context.getResources().getString(R.string.process_mediaserver_label);
}
iconId = R.drawable.ic_power_system;
- icon = context.getResources().getDrawable(iconId);
+ icon = context.getDrawable(iconId);
return;
} else {
//name = packages[0];
diff --git a/src/com/android/settings/fuelgauge/PowerUsageDetail.java b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
index 9dca02904..e3c8dabfd 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
@@ -379,7 +379,7 @@ public class PowerUsageDetail extends Fragment implements Button.OnClickListener
// Use default icon
}
} else if (iconId != 0) {
- mAppIcon = getActivity().getResources().getDrawable(iconId);
+ mAppIcon = getActivity().getDrawable(iconId);
}
if (mAppIcon == null) {
mAppIcon = getActivity().getPackageManager().getDefaultActivityIcon();
diff --git a/src/com/android/settings/net/UidDetailProvider.java b/src/com/android/settings/net/UidDetailProvider.java
index 4b54137cf..b6160fdd6 100644
--- a/src/com/android/settings/net/UidDetailProvider.java
+++ b/src/com/android/settings/net/UidDetailProvider.java
@@ -138,7 +138,7 @@ public class UidDetailProvider {
if (info != null) {
if (info.isManagedProfile()) {
detail.label = res.getString(R.string.managed_user_title);
- detail.icon = Resources.getSystem().getDrawable(
+ detail.icon = mContext.getDrawable(
com.android.internal.R.drawable.ic_corp_icon);
} else {
detail.label = res.getString(R.string.running_process_item_user_label,
diff --git a/src/com/android/settings/notification/NotificationStation.java b/src/com/android/settings/notification/NotificationStation.java
index c61f91ece..3f4d3df8a 100644
--- a/src/com/android/settings/notification/NotificationStation.java
+++ b/src/com/android/settings/notification/NotificationStation.java
@@ -275,7 +275,7 @@ public class NotificationStation extends SettingsPreferenceFragment {
}
try {
- return r.getDrawable(resId);
+ return r.getDrawable(resId, null);
} catch (RuntimeException e) {
Log.w(TAG, "Icon not found in "
+ (pkg != null ? resId : "<system>")