Update battery settings strings

1. Change "screenTime" to "lastFullChargeTime" in high usage dialog
2. Update "Background restriction" strings
3. Update footer string

Bug: 73018395
Test: RunSettingsRoboTests
Change-Id: I07c149123c4ee1a69dd81c9a9e6eaa5df69b60b4
This commit is contained in:
Lei Yu
2018-04-09 14:35:12 -07:00
parent eaccf907e7
commit 40bb1e8488
7 changed files with 26 additions and 25 deletions

View File

@@ -102,7 +102,10 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme
return new AlertDialog.Builder(context)
.setMessage(getString(R.string.battery_tip_dialog_message,
highUsageTip.getHighUsageAppList().size()))
highUsageTip.getHighUsageAppList().size(),
StringUtil.formatRelativeTime(context,
highUsageTip.getLastFullChargeTimeMs(),
false /* withSeconds */)))
.setView(view)
.setPositiveButton(android.R.string.ok, null)
.create();

View File

@@ -63,7 +63,8 @@ public class HighUsageDetector implements BatteryTipDetector {
@Override
public BatteryTip detect() {
final long screenUsageTimeMs = mBatteryUtils.calculateScreenUsageTime(mBatteryStatsHelper);
final long lastFullChargeTimeMs = mBatteryUtils.calculateLastFullChargeTime(
mBatteryStatsHelper, System.currentTimeMillis());
if (mPolicy.highUsageEnabled) {
parseBatteryData();
if (mDataParser.isDeviceHeavilyUsed() || mPolicy.testHighUsageTip) {
@@ -99,7 +100,7 @@ public class HighUsageDetector implements BatteryTipDetector {
}
}
return new HighUsageTip(screenUsageTimeMs, mHighUsageAppList);
return new HighUsageTip(lastFullChargeTimeMs, mHighUsageAppList);
}
@VisibleForTesting

View File

@@ -26,7 +26,7 @@ import com.android.settings.R;
import com.android.settings.fuelgauge.batterytip.AppInfo;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.utils.StringUtil;
import java.util.List;
/**
@@ -34,28 +34,28 @@ import java.util.List;
*/
public class HighUsageTip extends BatteryTip {
private final long mScreenTimeMs;
private final long mLastFullChargeTimeMs;
@VisibleForTesting
final List<AppInfo> mHighUsageAppList;
public HighUsageTip(long screenTimeMs, List<AppInfo> appList) {
public HighUsageTip(long lastFullChargeTimeMs, List<AppInfo> appList) {
super(TipType.HIGH_DEVICE_USAGE, appList.isEmpty() ? StateType.INVISIBLE : StateType.NEW,
true /* showDialog */);
mScreenTimeMs = screenTimeMs;
mLastFullChargeTimeMs = lastFullChargeTimeMs;
mHighUsageAppList = appList;
}
@VisibleForTesting
HighUsageTip(Parcel in) {
super(in);
mScreenTimeMs = in.readLong();
mLastFullChargeTimeMs = in.readLong();
mHighUsageAppList = in.createTypedArrayList(AppInfo.CREATOR);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeLong(mScreenTimeMs);
dest.writeLong(mLastFullChargeTimeMs);
dest.writeTypedList(mHighUsageAppList);
}
@@ -91,8 +91,8 @@ public class HighUsageTip extends BatteryTip {
}
}
public long getScreenTimeMs() {
return mScreenTimeMs;
public long getLastFullChargeTimeMs() {
return mLastFullChargeTimeMs;
}
public List<AppInfo> getHighUsageAppList() {