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

Commit cad4c069 authored by Zaiyue Xue's avatar Zaiyue Xue
Browse files

Clean up unused code in AdvancedPowerUsageDetail class

Bug: 262802531
Test: presubmit
Change-Id: Ide91bd5312296945effb5a54422bda2c9623341d
parent 5fc863fc
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -5037,43 +5037,31 @@
    <!-- Description for battery total and background usage time for an app, i.e. 1 hr 15 min total • 39 min background since last full charge. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_and_bg_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • <xliff:g id="time" example="39 min">^2</xliff:g> background\nsince last full charge</string>
    <!-- Description for battery total and background usage time for an app, i.e. 1 hr 15 min total • 39 min background for past 24 hr. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_and_bg_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • <xliff:g id="time" example="39 min">^2</xliff:g> background\nfor past 24 hr</string>
    <!-- Description for battery total and background usage time in a time period for an app, i.e. 1 hr 15 min total • 39 min background for 12 am-2 am. Note: ^1, ^2 and ^3 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_and_bg_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • <xliff:g id="time" example="39 min">^2</xliff:g> background\nfor <xliff:g id="time_period" example="12 am-2 am">^3</xliff:g></string>
    <!-- Description for battery total usage time is less than a minute for an app since last full charge [CHAR LIMIT=120] -->
    <string name="battery_total_usage_less_minute">Total less than a minute since last full charge</string>
    <!-- Description for battery total usage time is less than a minute for an app for past 24 hr [CHAR LIMIT=120] -->
    <string name="battery_total_usage_less_minute_24hr">Total less than a minute for past 24 hr</string>
    <!-- Description for battery total usage time is less than a minute in a time period for an app, i.e. Total less than a minute for 12 am-2 am. Note: ^1 should be used in all translations[CHAR LIMIT=120] -->
    <string name="battery_total_usage_less_minute_with_period">Total less than a minute for <xliff:g id="time_period" example="12 am-2 am">^1</xliff:g></string>
    <!-- Description for battery background usage time is less than a minute for an app since last full charge [CHAR LIMIT=120] -->
    <string name="battery_bg_usage_less_minute">Background less than a minute since last full charge</string>
    <!-- Description for battery background usage time is less than a minute for an app for past 24 hr [CHAR LIMIT=120] -->
    <string name="battery_bg_usage_less_minute_24hr">Background less than a minute for past 24 hr</string>
    <!-- Description for battery background usage time is less than a minute in a time period for an app, i.e. Background less than a minute for 12 am-2 am. Note: ^1 should be used in all translations[CHAR LIMIT=120] -->
    <string name="battery_bg_usage_less_minute_with_period">Background less than a minute for <xliff:g id="time_period" example="12 am-2 am">^1</xliff:g></string>
    <!-- Description for battery total usage time for an app, i.e. 1 hr 15 min total since last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total since last full charge</string>
    <!-- Description for battery total usage time for an app, i.e. 1 hr 15 min total for past 24 hr. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total for past 24 hr</string>
    <!-- Description for battery total usage time in a time period for an app, i.e. 1 hr 15 min total for 12 am-2 am. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total for <xliff:g id="time_period" example="12 am-2 am">^2</xliff:g></string>
    <!-- Description for battery background usage time for an app, i.e. 1 hr 15 min background since last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_bg_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> background since last full charge</string>
    <!-- Description for battery background usage time for an app, i.e. 1 hr 15 min background for past 24 hr. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_bg_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> background for past 24 hr</string>
    <!-- Description for battery background usage time in a time period for an app, i.e. 1 hr 15 min background for 12 am-2 am. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_bg_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> background for <xliff:g id="time_period" example="12 am-2 am">^2</xliff:g></string>
    <!-- Description for battery total usage with background usage time less than a minute for an app, i.e. 1 hr 15 min total • background less than a minute since last full charge. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_usage_and_bg_less_minute_usage"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • background less than a minute\nsince last full charge</string>
    <!-- Description for battery total usage with background usage time less than a minute for an app, i.e. 1 hr 15 min total • background less than a minute for past 24 hr. Note: ^1 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_usage_and_bg_less_minute_usage_24hr"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • background less than a minute\nfor past 24 hr</string>
    <!-- Description for battery total usage with background usage time less than a minute in a time period for an app, i.e. 1 hr 15 min total • background less than a minute for 12 am-2 am. Note: ^1 and ^2 should be used in all translations [CHAR LIMIT=120] -->
    <string name="battery_total_usage_and_bg_less_minute_usage_with_period"><xliff:g id="time" example="1 hr 15 min">^1</xliff:g> total • background less than a minute\nfor <xliff:g id="time_period" example="12 am-2 am">^2</xliff:g></string>
+0 −52
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.settings.fuelgauge;

import android.annotation.UserIdInt;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.backup.BackupManager;
@@ -210,14 +209,6 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
                .launch();
    }

    private static @UserIdInt int getUserIdToLaunchAdvancePowerUsageDetail(
            BatteryEntry batteryEntry) {
        if (batteryEntry.isUserEntry()) {
            return ActivityManager.getCurrentUser();
        }
        return UserHandle.getUserId(batteryEntry.getUid());
    }

    /**
     * Start packageName's battery detail page.
     */
@@ -550,49 +541,6 @@ public class AdvancedPowerUsageDetail extends DashboardFragment implements
        }
    }

    private CharSequence getAppPast24HrActiveSummary(
            long foregroundTimeMs, long backgroundTimeMs, long totalTimeMs) {
        // Shows background summary only if we don't have foreground usage time.
        if (foregroundTimeMs == 0 && backgroundTimeMs != 0) {
            return backgroundTimeMs < DateUtils.MINUTE_IN_MILLIS
                    ? getText(R.string.battery_bg_usage_less_minute_24hr)
                    : TextUtils.expandTemplate(getText(R.string.battery_bg_usage_24hr),
                            StringUtil.formatElapsedTime(
                                    getContext(),
                                    backgroundTimeMs,
                                    /* withSeconds */ false,
                                    /* collapseTimeUnit */ false));
        // Shows total usage summary only if total usage time is small.
        } else if (totalTimeMs < DateUtils.MINUTE_IN_MILLIS) {
            return getText(R.string.battery_total_usage_less_minute_24hr);
        // Shows different total usage summary when background usage time is small.
        } else if (backgroundTimeMs < DateUtils.MINUTE_IN_MILLIS) {
            return TextUtils.expandTemplate(
                    getText(backgroundTimeMs == 0
                            ? R.string.battery_total_usage_24hr
                            : R.string.battery_total_usage_and_bg_less_minute_usage_24hr),
                    StringUtil.formatElapsedTime(
                            getContext(),
                            totalTimeMs,
                            /* withSeconds */ false,
                            /* collapseTimeUnit */ false));
        // Shows default summary.
        } else {
            return TextUtils.expandTemplate(
                    getText(R.string.battery_total_and_bg_usage_24hr),
                    StringUtil.formatElapsedTime(
                            getContext(),
                            totalTimeMs,
                            /* withSeconds */ false,
                            /* collapseTimeUnit */ false),
                    StringUtil.formatElapsedTime(
                            getContext(),
                            backgroundTimeMs,
                            /* withSeconds */ false,
                            /* collapseTimeUnit */ false));
        }
    }

    private CharSequence getAppActiveSummaryWithSlotTime(
            long foregroundTimeMs, long backgroundTimeMs, long totalTimeMs, String slotTime) {
        // Shows background summary only if we don't have foreground usage time.