Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 17a46313 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update battery settings strings" into pi-dev

parents 79580c94 40bb1e84
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -4899,10 +4899,6 @@
    <string name="background_activity_title">Background restriction</string>
    <!-- Summary for the background activity [CHAR_LIMIT=120] -->
    <string name="background_activity_summary">Allow the app to run in the background</string>
    <!-- Summary for the background activity when it is on [CHAR_LIMIT=120] -->
    <string name="background_activity_summary_on">App can run in the background when not in use</string>
    <!-- Summary for the background activity when it is off [CHAR_LIMIT=120] -->
    <string name="background_activity_summary_off">App\'s background activity is limited when not in use</string>
    <!-- Summary for the background activity when it is disabled [CHAR_LIMIT=120] -->
    <string name="background_activity_summary_disabled">App not allowed to run in background</string>
    <!-- TODO: Pending UX review. Summary for the background activity when it is whitlisted [CHAR_LIMIT=120] -->
@@ -5023,11 +5019,11 @@
    <!-- Summary for the battery high usage tip, which presents battery may run out soon [CHAR LIMIT=NONE] -->
    <string name="battery_tip_high_usage_summary">Battery may run out soon</string>
    <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
    <string name="battery_tip_dialog_message" product="default">Your phone has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last charge:</string>
    <string name="battery_tip_dialog_message" product="default">Your phone has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last full charge(<xliff:g id="time_period_ago" example="1 hr ago">%2$s</xliff:g>):</string>
    <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
    <string name="battery_tip_dialog_message" product="tablet">Your tablet has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last charge:</string>
    <string name="battery_tip_dialog_message" product="tablet">Your tablet has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last full charge(<xliff:g id="time_period_ago" example="1 hr ago">%2$s</xliff:g>):</string>
    <!-- Message for battery tip dialog to show the status about the battery [CHAR LIMIT=NONE] -->
    <string name="battery_tip_dialog_message" product="device">Your device has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last charge:</string>
    <string name="battery_tip_dialog_message" product="device">Your device has been used more than usual. Your battery may run out sooner than expected.\n\nTop <xliff:g id="number">%1$d</xliff:g> apps since last full charge(<xliff:g id="time_period_ago" example="1 hr ago">%2$s</xliff:g>):</string>
    <!-- Title for restricted app preference, showing how many app need to be restricted [CHAR LIMIT=NONE] -->
    <plurals name="battery_tip_restrict_title">
        <item quantity="one">Restrict %1$d app</item>
@@ -5097,7 +5093,7 @@
    </plurals>
    <!-- Footer message for restrict app details page -->
    <string name="restricted_app_detail_footer">Apps shown here aren\'t behaving properly and have been using battery in the background.\n\nThese apps are now blocked from using battery in the background. As a result, some app notifications may be delayed.</string>
    <string name="restricted_app_detail_footer">These apps have been using battery in the background. Restricted apps may not work properly and notifications may be delayed.</string>
    <!-- Title for auto restriction toggle -->
    <string name="battery_auto_restriction_title">Use Battery Manager</string>
@@ -8022,7 +8018,7 @@
    <string name="encryption_interstitial_no">No</string>
    <!-- Label to say yes to the question of whether app is restricted. [CHAR LIMIT=20] -->
    <string name="restricted_true_label">App can\u2019t use battery in background</string>
    <string name="restricted_true_label">Restricted</string>
    <!-- Label to say no to the question of whether app is restricted. [CHAR LIMIT=20] -->
    <string name="restricted_false_label">App can use battery in background</string>
+4 −1
Original line number Diff line number Diff line
@@ -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();
+3 −2
Original line number Diff line number Diff line
@@ -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
+8 −8
Original line number Diff line number Diff line
@@ -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() {
+1 −1
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ public class BackgroundActivityPreferenceControllerTest {

        mController.updateSummary(mPreference);

        assertThat(mPreference.getSummary()).isEqualTo("App can\u2019t use battery in background");
        assertThat(mPreference.getSummary()).isEqualTo("Restricted");
    }

    @Test
Loading