Merge "Update string for all defenders" into tm-qpr-dev am: d388dc1809
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20743066 Change-Id: I271e279c86e90360b9fae18f96dc8c913f9f430f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -6416,21 +6416,21 @@
|
||||
<!-- Summary for the battery high usage tip, which presents apps with highest usage [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_high_usage_summary">See apps with highest usage</string>
|
||||
<!-- Title for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_limited_temporarily_title">Charging is paused</string>
|
||||
<string name="battery_tip_limited_temporarily_title">Charging optimized to protect your battery</string>
|
||||
<!-- Summary for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_limited_temporarily_summary">Protecting battery to extend battery lifespan</string>
|
||||
<string name="battery_tip_limited_temporarily_summary">To help extend your batter\'s lifespan, charging is optimized</string>
|
||||
<!-- Title for the battery dock defender future bypass tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_dock_defender_future_bypass_title">Charging to <xliff:g id="percent" example="10%">%1$s</xliff:g> to protect the battery</string>
|
||||
<string name="battery_tip_dock_defender_future_bypass_title">Charging optimized to protect your battery</string>
|
||||
<!-- Summary for the battery dock defender future bypass tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_dock_defender_future_bypass_summary">When your tablet is docked, charging will be paused at <xliff:g id="percent" example="10%">%1$s</xliff:g> to extend battery lifespan</string>
|
||||
<string name="battery_tip_dock_defender_future_bypass_summary">To help extend your battery\'s lifespan, charging is optimized while docked</string>
|
||||
<!-- Title for the battery dock defender active tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_dock_defender_active_title">Charging paused to protect battery</string>
|
||||
<string name="battery_tip_dock_defender_active_title">Charging optimized to protect your battery</string>
|
||||
<!-- Summary for the battery dock defender active tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_dock_defender_active_summary">When your tablet is docked, charging is paused at <xliff:g id="percent" example="10%">%1$s</xliff:g> to extend battery lifespan</string>
|
||||
<string name="battery_tip_dock_defender_active_summary">To help extend your battery\'s lifespan, charging is optimized while docked</string>
|
||||
<!-- Title for the battery dock defender temporarily bypassed tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_dock_defender_temporarily_bypassed_title">Charging to full</string>
|
||||
<!-- Summary for the battery dock defender temporarily bypassed tip [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_dock_defender_temporarily_bypassed_summary">To protect your battery, charging will be paused at <xliff:g id="percent" example="10%">%1$s</xliff:g> the next time your tablet is docked</string>
|
||||
<string name="battery_tip_dock_defender_temporarily_bypassed_summary">To protect your battery, charging will be optimized the next time your tablet is docked</string>
|
||||
<!-- Content description for the battery limited temporarily tip secondary button [CHAR LIMIT=NONE] -->
|
||||
<string name="battery_tip_limited_temporarily_sec_button_content_description">Learn more about charging is paused</string>
|
||||
<!-- Text of battery limited temporarily tip resume charge button. [CHAR LIMIT=NONE] -->
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user