Update low battery tips string am: 6d836d2d51
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14048550 Change-Id: I20ef817e4cd7bea00cc4ea6b74a35c7ea82022c6
This commit is contained in:
@@ -89,8 +89,7 @@ public class BatteryTipLoader extends AsyncLoaderCompat<List<BatteryTip>> {
|
||||
final List<BatteryTip> tips = new ArrayList<>();
|
||||
tips.add(new SummaryTip(BatteryTip.StateType.NEW,
|
||||
EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN));
|
||||
tips.add(new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */,
|
||||
"Fake data"));
|
||||
tips.add(new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */));
|
||||
|
||||
return tips;
|
||||
}
|
||||
|
@@ -61,7 +61,6 @@ public class LowBatteryDetector implements BatteryTipDetector {
|
||||
state = BatteryTip.StateType.NEW;
|
||||
}
|
||||
|
||||
return new LowBatteryTip(
|
||||
state, powerSaveModeOn, mBatteryInfo.suggestionLabel);
|
||||
return new LowBatteryTip(state, powerSaveModeOn);
|
||||
}
|
||||
}
|
||||
|
@@ -21,34 +21,36 @@ import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
/**
|
||||
* Tip to show current battery level is low or remaining time is less than a certain period
|
||||
*/
|
||||
public class LowBatteryTip extends EarlyWarningTip {
|
||||
private CharSequence mSummary;
|
||||
|
||||
public LowBatteryTip(@StateType int state, boolean powerSaveModeOn, CharSequence summary) {
|
||||
public LowBatteryTip(@StateType int state, boolean powerSaveModeOn) {
|
||||
super(state, powerSaveModeOn);
|
||||
mType = TipType.LOW_BATTERY;
|
||||
mSummary = summary;
|
||||
}
|
||||
|
||||
public LowBatteryTip(Parcel in) {
|
||||
super(in);
|
||||
mSummary = in.readCharSequence();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getTitle(Context context) {
|
||||
return context.getString(R.string.battery_tip_low_battery_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getSummary(Context context) {
|
||||
return mSummary;
|
||||
return context.getString(R.string.battery_tip_low_battery_summary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeCharSequence(mSummary);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -67,8 +67,7 @@ public class BatteryTipUtilsTest {
|
||||
mEarlyWarningTip = spy(
|
||||
new EarlyWarningTip(BatteryTip.StateType.NEW, true /* powerSaveModeOn */));
|
||||
mLowBatteryTip = spy(
|
||||
new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */,
|
||||
"" /* summary */));
|
||||
new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */));
|
||||
mBatteryDefenderTip = spy(new BatteryDefenderTip(BatteryTip.StateType.NEW));
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class LowBatteryTipTest {
|
||||
|
||||
private static final CharSequence SUMMARY = "Only 15 minutes left";
|
||||
private static final CharSequence SUMMARY = "Turn on Battery Saver to extend battery life";
|
||||
|
||||
@Mock
|
||||
private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
@@ -48,8 +48,7 @@ public class LowBatteryTipTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mLowBatteryTip = new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */,
|
||||
SUMMARY);
|
||||
mLowBatteryTip = new LowBatteryTip(BatteryTip.StateType.NEW, false /* powerSaveModeOn */);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -64,6 +63,13 @@ public class LowBatteryTipTest {
|
||||
assertThat(parcelTip.getSummary(mContext)).isEqualTo(SUMMARY);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_tipNew_showTitle() {
|
||||
mLowBatteryTip.mState = BatteryTip.StateType.NEW;
|
||||
|
||||
assertThat(mLowBatteryTip.getTitle(mContext)).isEqualTo("Battery level low");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSummary_tipNew_showSummary() {
|
||||
mLowBatteryTip.mState = BatteryTip.StateType.NEW;
|
||||
|
@@ -85,7 +85,7 @@ public class BatteryFixSliceTest {
|
||||
@Test
|
||||
public void refreshBatteryTips_hasImportantTip_shouldReturnTrue() {
|
||||
final List<BatteryTip> tips = new ArrayList<>();
|
||||
tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false, ""));
|
||||
tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false));
|
||||
tips.add(new EarlyWarningTip(BatteryTip.StateType.NEW, false));
|
||||
ShadowBatteryTipLoader.setBatteryTips(tips);
|
||||
|
||||
@@ -102,7 +102,7 @@ public class BatteryFixSliceTest {
|
||||
.setPackageName("com.android.settings")
|
||||
.setScreenOnTimeMs(10000L)
|
||||
.build());
|
||||
tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false, ""));
|
||||
tips.add(new LowBatteryTip(BatteryTip.StateType.INVISIBLE, false));
|
||||
tips.add(new EarlyWarningTip(BatteryTip.StateType.HANDLED, false));
|
||||
tips.add(new HighUsageTip(1000L, appList));
|
||||
ShadowBatteryTipLoader.setBatteryTips(tips);
|
||||
|
Reference in New Issue
Block a user