Merge \"Update battery content descriptions with labels\" into nyc-dev

am: 2a6b3d4db1

Change-Id: Id0d36f67615bd319351ba2bdc3c2993a3162e665
This commit is contained in:
Jason Monk
2016-06-22 13:32:21 +00:00
committed by android-build-merger
2 changed files with 9 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ public class PowerGaugePreference extends TintablePreference {
private final int mIconSize;
private BatteryEntry mInfo;
private final CharSequence mContentDescription;
private CharSequence mContentDescription;
private CharSequence mProgress;
public PowerGaugePreference(Context context, Drawable icon, CharSequence contentDescription,
@@ -48,6 +48,11 @@ public class PowerGaugePreference extends TintablePreference {
mIconSize = context.getResources().getDimensionPixelSize(R.dimen.app_icon_size);
}
public void setContentDescription(String name) {
mContentDescription = name;
notifyChanged();
}
public void setPercent(double percentOfMax, double percentOfTotal) {
mProgress = Utils.formatPercentage((int) (percentOfTotal + 0.5));
notifyChanged();

View File

@@ -432,6 +432,9 @@ public class PowerUsageSummary extends PowerUsageBase {
final UserHandle userHandle = new UserHandle(userId);
pgp.setIcon(mUm.getBadgedIconForUser(entry.getIcon(), userHandle));
pgp.setTitle(entry.name);
if (entry.sipper.drainType == DrainType.APP) {
pgp.setContentDescription(entry.name);
}
}
break;
case BatteryEntry.MSG_REPORT_FULLY_DRAWN: