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

Commit adddc30c authored by Lei Yu's avatar Lei Yu
Browse files

Update strings for summary tip.

1. Strings for the tip preference
2. Strings for the tip dialog

Change-Id: I59c371328ec735a0b22f707d440f3be85cf59c77
Fixes: 79171948
Test: Manual & RunSettingsRoboTests
parent 99902e1f
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -4995,9 +4995,13 @@
    <string name="battery_abnormal_apps_summary"><xliff:g id="number">%1$d</xliff:g> apps misbehaving</string>
    <!-- Title for the battery summary tip [CHAR LIMIT=NONE] -->
    <string name="battery_tip_summary_title">Battery is in good shape</string>
    <string name="battery_tip_summary_title">Apps are running normally</string>
    <!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
    <string name="battery_tip_summary_summary">Apps are running normally</string>
    <string name="battery_tip_summary_summary" product="default">Phone has typical background battery usage</string>
    <!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
    <string name="battery_tip_summary_summary" product="tablet">Tablet has typical background battery usage</string>
    <!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
    <string name="battery_tip_summary_summary" product="device">Device has typical background battery usage</string>
    <!-- Title for the low battery tip [CHAR LIMIT=NONE] -->
    <string name="battery_tip_low_battery_title">Low battery capacity</string>
    <!-- Summary for the low battery tip [CHAR LIMIT=NONE] -->
@@ -5076,9 +5080,11 @@
    <string name="battery_tip_unrestrict_app_dialog_cancel">Cancel</string>
    <!-- Message for battery tip dialog to show the battery summary -->
    <string name="battery_tip_dialog_summary_message">Based on your usage, your battery usually lasts about <xliff:g id="time_duration">%1$s</xliff:g> when fully charged.\n\nIf you need to extend your battery life, turn on Battery Saver.</string>
    <string name="battery_tip_dialog_summary_message" product="default">Your apps are using a normal amount of battery. If apps use too much battery, your phone will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
    <!-- Message for battery tip dialog to show the battery summary -->
    <string name="battery_tip_dialog_summary_message" product="tablet">Your apps are using a normal amount of battery. If apps use too much battery, your tablet will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
    <!-- Message for battery tip dialog to show the battery summary -->
    <string name="battery_tip_dialog_summary_message_no_estimation">If you need to extend your battery life, turn on Battery Saver</string>
    <string name="battery_tip_dialog_summary_message" product="device">Your apps are using a normal amount of battery. If apps use too much battery, your device will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
    <!-- Title for the smart battery manager preference [CHAR LIMIT=NONE] -->
    <string name="smart_battery_manager_title">Battery Manager</string>
+1 −9
Original line number Diff line number Diff line
@@ -79,16 +79,8 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme

        switch (mBatteryTip.getType()) {
            case BatteryTip.TipType.SUMMARY:
                final long averageTimeMs = ((SummaryTip) mBatteryTip).getAverageTimeMs();
                final String message = context.getString(
                        averageTimeMs == Estimate.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN
                                ? R.string.battery_tip_dialog_summary_message_no_estimation
                                : R.string.battery_tip_dialog_summary_message,
                        StringUtil.formatElapsedTime(context, averageTimeMs,
                                false /* withSeconds */));

                return new AlertDialog.Builder(context)
                        .setMessage(message)
                        .setMessage(R.string.battery_tip_dialog_summary_message)
                        .setPositiveButton(android.R.string.ok, null)
                        .create();
            case BatteryTip.TipType.HIGH_DEVICE_USAGE:
+4 −16
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ public class BatteryTipDialogFragmentTest {
    }

    @Test
    public void testOnCreateDialog_summaryTipWithEstimation_fireDialogWithEstimation() {
    public void testOnCreateDialog_summaryTip_fireDialog() {
        doReturn(AVERAGE_TIME_MS).when(mSummaryTip).getAverageTimeMs();
        mDialogFragment = BatteryTipDialogFragment.newInstance(mSummaryTip, METRICS_KEY);

@@ -209,20 +209,8 @@ public class BatteryTipDialogFragmentTest {
        ShadowAlertDialog shadowDialog = shadowOf(dialog);

        assertThat(shadowDialog.getMessage()).isEqualTo(
                "Based on your usage, your battery usually lasts about 1 hr when fully charged"
                        + ".\n\nIf you need to extend your battery life, turn on Battery Saver.");
    }

    @Test
    public void testOnCreateDialog_summaryTipWithoutEstimation_fireDialogWithoutEstimation() {
        mDialogFragment = BatteryTipDialogFragment.newInstance(mSummaryTip, METRICS_KEY);

        FragmentTestUtil.startFragment(mDialogFragment);

        final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
        ShadowAlertDialog shadowDialog = shadowOf(dialog);

        assertThat(shadowDialog.getMessage()).isEqualTo(
                "If you need to extend your battery life, turn on Battery Saver");
                "Your apps are using a normal amount of battery. If apps use too much battery, "
                        + "your phone will suggest actions you can take.\n\nYou can always turn"
                        + " on Battery Saver if you’re running low on battery.");
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.support.v7.preference.PreferenceScreen;
import android.text.format.DateUtils;

import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.core.InstrumentedPreferenceFragment;
import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
@@ -181,7 +182,9 @@ public class BatteryTipPreferenceControllerTest {
        assertThat(preferenceGroup.getPreferenceCount()).isEqualTo(1);

        final Preference preference = preferenceGroup.getPreference(0);
        assertThat(preference.getTitle()).isEqualTo("Battery is in good shape");
        assertThat(preference.getSummary()).isEqualTo("Apps are running normally");
        assertThat(preference.getTitle()).isEqualTo(
                mContext.getString(R.string.battery_tip_summary_title));
        assertThat(preference.getSummary()).isEqualTo(
                mContext.getString(R.string.battery_tip_summary_summary));
    }
}