diff --git a/res/values/strings.xml b/res/values/strings.xml index 62d55fa1337..cc090dce9d6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -6410,21 +6410,21 @@ See apps with highest usage - Charging is paused + Charging optimized to protect your battery - Protecting battery to extend battery lifespan + To help extend your batter\'s lifespan, charging is optimized - Charging to %1$s to protect the battery + Charging optimized to protect your battery - When your tablet is docked, charging will be paused at %1$s to extend battery lifespan + To help extend your battery\'s lifespan, charging is optimized while docked - Charging paused to protect battery + Charging optimized to protect your battery - When your tablet is docked, charging is paused at %1$s to extend battery lifespan + To help extend your battery\'s lifespan, charging is optimized while docked Charging to full - To protect your battery, charging will be paused at %1$s the next time your tablet is docked + To protect your battery, charging will be optimized the next time your tablet is docked Learn more about charging is paused diff --git a/src/com/android/settings/fuelgauge/BatteryInfo.java b/src/com/android/settings/fuelgauge/BatteryInfo.java index 52d6d58061c..da3bbe4d379 100644 --- a/src/com/android/settings/fuelgauge/BatteryInfo.java +++ b/src/com/android/settings/fuelgauge/BatteryInfo.java @@ -42,8 +42,6 @@ import com.android.settingslib.fuelgauge.EstimateKt; import com.android.settingslib.utils.PowerUtil; import com.android.settingslib.utils.StringUtil; -import java.text.NumberFormat; - public class BatteryInfo { private static final String TAG = "BatteryInfo"; @@ -305,13 +303,9 @@ public class BatteryInfo { timeString); info.chargeLabel = context.getString(resId, info.batteryPercentString, timeString); } else if (dockDefenderMode == BatteryUtils.DockDefenderMode.FUTURE_BYPASS) { - // Dock defender will be triggered in the future, charging will be paused at 90%. - final int extraValue = context.getResources().getInteger( - R.integer.config_battery_extra_tip_value); - final String extraPercentage = NumberFormat.getPercentInstance().format( - extraValue * 0.01f); + // Dock defender will be triggered in the future, charging will be optimized. info.chargeLabel = context.getString(R.string.power_charging_future_paused, - info.batteryPercentString, extraPercentage); + info.batteryPercentString); } else { final String chargeStatusLabel = Utils.getBatteryStatus(context, batteryBroadcast, compactStatus); diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTip.java index dae4af4283c..f02adf58bf9 100644 --- a/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTip.java +++ b/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTip.java @@ -32,8 +32,6 @@ import com.android.settings.widget.CardPreference; import com.android.settingslib.HelpUtils; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; -import java.text.NumberFormat; - /** * Tip to show dock defender status */ @@ -58,8 +56,7 @@ public class DockDefenderTip extends BatteryTip { public CharSequence getTitle(Context context) { switch (mMode) { case DockDefenderMode.FUTURE_BYPASS: - return context.getString(R.string.battery_tip_dock_defender_future_bypass_title, - getExtraPercentage(context)); + return context.getString(R.string.battery_tip_dock_defender_future_bypass_title); case DockDefenderMode.ACTIVE: return context.getString(R.string.battery_tip_dock_defender_active_title); case DockDefenderMode.TEMPORARILY_BYPASSED: @@ -74,15 +71,12 @@ public class DockDefenderTip extends BatteryTip { public CharSequence getSummary(Context context) { switch (mMode) { case DockDefenderMode.FUTURE_BYPASS: - return context.getString(R.string.battery_tip_dock_defender_future_bypass_summary, - getExtraPercentage(context)); + return context.getString(R.string.battery_tip_dock_defender_future_bypass_summary); case DockDefenderMode.ACTIVE: - return context.getString(R.string.battery_tip_dock_defender_active_summary, - getExtraPercentage(context)); + return context.getString(R.string.battery_tip_dock_defender_active_summary); case DockDefenderMode.TEMPORARILY_BYPASSED: return context.getString( - R.string.battery_tip_dock_defender_temporarily_bypassed_summary, - getExtraPercentage(context)); + R.string.battery_tip_dock_defender_temporarily_bypassed_summary); default: return null; } @@ -174,13 +168,6 @@ public class DockDefenderTip extends BatteryTip { Log.i(TAG, "send resume charging broadcast intent=" + intent); } - private String getExtraPercentage(Context context) { - final int extraValue = context.getResources() - .getInteger(R.integer.config_battery_extra_tip_value); - return NumberFormat.getPercentInstance() - .format(extraValue * 0.01f); - } - public static final Creator CREATOR = new Creator() { public BatteryTip createFromParcel(Parcel in) { return new DockDefenderTip(in); diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java index 59c0f680bfa..2fac0eb6e1f 100644 --- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java +++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java @@ -67,8 +67,8 @@ public class BatteryInfoTest { private static final String STATUS_CHARGING_NO_TIME = "50% - charging"; private static final String STATUS_CHARGING_TIME = "50% - 0 min left until full"; private static final String STATUS_NOT_CHARGING = "Not charging"; - private static final String STATUS_CHARGING_FUTURE_BYPASS = "50% - Charging to 12%"; - private static final String STATUS_CHARGING_PAUSED = "50% - Charging paused"; + private static final String STATUS_CHARGING_FUTURE_BYPASS = "50% - Charging optimized"; + private static final String STATUS_CHARGING_PAUSED = "50% - Charging optimized"; private static final long REMAINING_TIME_NULL = -1; private static final long REMAINING_TIME = 2; // Strings are defined in frameworks/base/packages/SettingsLib/res/values/strings.xml diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTipTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTipTest.java index 69d54777c18..e897a1ca531 100644 --- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTipTest.java +++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/DockDefenderTipTest.java @@ -44,8 +44,6 @@ import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; import org.robolectric.shadows.ShadowLog; -import java.text.NumberFormat; - @RunWith(RobolectricTestRunner.class) public class DockDefenderTipTest { private Context mContext; @@ -85,8 +83,7 @@ public class DockDefenderTipTest { @Test public void testGetTitle() { assertThat(mDockDefenderTipFutureBypass.getTitle(mContext).toString()).isEqualTo( - mContext.getString(R.string.battery_tip_dock_defender_future_bypass_title, - getExtraPercentage(mContext))); + mContext.getString(R.string.battery_tip_dock_defender_future_bypass_title)); assertThat(mDockDefenderTipActive.getTitle(mContext).toString()).isEqualTo( mContext.getString(R.string.battery_tip_dock_defender_active_title)); assertThat(mDockDefenderTipTemporarilyBypassed.getTitle(mContext).toString()).isEqualTo( @@ -97,14 +94,12 @@ public class DockDefenderTipTest { @Test public void testGetSummary() { assertThat(mDockDefenderTipFutureBypass.getSummary(mContext).toString()).isEqualTo( - mContext.getString(R.string.battery_tip_dock_defender_future_bypass_summary, - getExtraPercentage(mContext))); + mContext.getString(R.string.battery_tip_dock_defender_future_bypass_summary)); assertThat(mDockDefenderTipActive.getSummary(mContext).toString()).isEqualTo( - mContext.getString(R.string.battery_tip_dock_defender_active_summary, - getExtraPercentage(mContext))); + mContext.getString(R.string.battery_tip_dock_defender_active_summary)); assertThat(mDockDefenderTipTemporarilyBypassed.getSummary(mContext).toString()).isEqualTo( - mContext.getString(R.string.battery_tip_dock_defender_temporarily_bypassed_summary, - getExtraPercentage(mContext))); + mContext.getString( + R.string.battery_tip_dock_defender_temporarily_bypassed_summary)); assertThat(mDockDefenderTipDisabled.getSummary(mContext)).isNull(); } @@ -195,11 +190,4 @@ public class DockDefenderTipTest { private ShadowLog.LogItem createErrorLog(String msg) { return new ShadowLog.LogItem(Log.ERROR, "tag", msg, null); } - - private String getExtraPercentage(Context context) { - final int extraValue = context.getResources().getInteger( - R.integer.config_battery_extra_tip_value); - return NumberFormat.getPercentInstance().format(extraValue * 0.01f); - } - }