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

Commit 2f90d558 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9414670 from 3aca71cf to tm-qpr2-release

Change-Id: Ic62396633e0305160213fa45cd55b1610151fc68
parents 6026d7b1 3aca71cf
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -6410,21 +6410,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] -->
@@ -8141,6 +8141,8 @@
    <string name="help_url_battery" translatable="false"></string>
    <!-- Help URL, Battery Defender [DO NOT TRANSLATE] -->
    <string name="help_url_battery_defender" translatable="false"></string>
    <!-- Help URL, Dock Defender [DO NOT TRANSLATE] -->
    <string name="help_url_dock_defender" translatable="false"></string>
    <!-- Help URL, Accounts [DO NOT TRANSLATE] -->
    <string name="help_url_accounts" translatable="false"></string>
    <!-- Help URL, Choose lockscreen [DO NOT TRANSLATE] -->
+1 −1
Original line number Diff line number Diff line
@@ -301,7 +301,6 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements

            notifyBackupManager();
            logMetricCategory(selectedPreference);
            mBatteryOptimizeUtils.setAppUsageState(selectedPreference);
            Log.d(TAG, "Leave with mode: " + selectedPreference);
        }
    }
@@ -468,6 +467,7 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
        updatePreferenceState(mUnrestrictedPreference, selectedKey);
        updatePreferenceState(mOptimizePreference, selectedKey);
        updatePreferenceState(mRestrictedPreference, selectedKey);
	mBatteryOptimizeUtils.setAppUsageState(getSelectedPreference());
    }

    private void updatePreferenceState(SelectorWithWidgetPreference preference,
+2 −8
Original line number Diff line number Diff line
@@ -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);
+1 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.content.pm.UserInfo;
import android.os.AsyncTask;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.ArraySet;
@@ -222,10 +221,8 @@ public class BatteryOptimizeUtils {
                mode == MODE_RESTRICTED ? AppOpsManager.MODE_IGNORED : AppOpsManager.MODE_ALLOWED;
        final boolean allowListed = mode == MODE_UNRESTRICTED;

        AsyncTask.execute(() -> {
        setAppOptimizationModeInternal(appOpsManagerMode, allowListed, uid, packageName,
                    batteryUtils, powerAllowlistBackend);
        });
    }

    private static void setAppOptimizationModeInternal(
+5 −19
Original line number Diff line number Diff line
@@ -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;
        }
@@ -145,12 +139,11 @@ public class DockDefenderTip extends BatteryTip {
        }

        cardPreference.setSecondaryButtonText(context.getString(R.string.learn_more));
        //TODO: update helper string
        cardPreference.setSecondaryButtonClickListener(
                button -> button.startActivityForResult(
                        HelpUtils.getHelpIntent(
                                context,
                                context.getString(R.string.help_url_battery_defender),
                                context.getString(R.string.help_url_dock_defender),
                                /* backupContext */ ""), /* requestCode */ 0));
        cardPreference.setSecondaryButtonVisible(true);
        cardPreference.setSecondaryButtonContentDescription(context.getString(
@@ -174,13 +167,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);
Loading