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

Commit 6644e252 authored by Salvador Martinez's avatar Salvador Martinez Committed by Android (Google) Code Review
Browse files

Merge "Refactor code to support overridden low battery warning"

parents d406ccab f9e4750a
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -61,11 +61,26 @@
    <!-- When the battery is low, this is displayed to the user in a dialog.  The title of the low battery alert.  [CHAR LIMIT=NONE]-->
    <string name="battery_low_title">Battery is low</string>

    <!-- When the battery is low and hybrid notifications are enabled, this is displayed to the user in a dialog.
         The title of the low battery alert.  [CHAR LIMIT=NONE]-->
    <string name="battery_low_title_hybrid">Battery is low. Turn on Battery Saver</string>

    <!-- A message that appears when the battery level is getting low in a dialog.  This is
        appened to the subtitle of the low battery alert.  "percentage" is the percentage of battery
        appended to the subtitle of the low battery alert.  "percentage" is the percentage of battery
        remaining [CHAR LIMIT=none]-->
    <string name="battery_low_percent_format"><xliff:g id="percentage">%s</xliff:g> remaining</string>

    <!-- A message that appears when the battery remaining estimate is low in a dialog.  This is
    appended to the subtitle of the low battery alert.  "percentage" is the percentage of battery
    remaining. "time" is the amount of time remaining before the phone runs out of battery [CHAR LIMIT=none]-->
    <string name="battery_low_percent_format_hybrid"><xliff:g id="percentage">%s</xliff:g> remaining, about <xliff:g id="time">%s</xliff:g> left based on your usage</string>

    <!-- A message that appears when the battery remaining estimate is low in a dialog and insufficient
    data was present to say it is customized to the user. This is appended to the subtitle of the
    low battery alert.  "percentage" is the percentage of battery remaining. "time" is the amount
     of time remaining before the phone runs out of battery [CHAR LIMIT=none]-->
    <string name="battery_low_percent_format_hybrid_short"><xliff:g id="percentage">%s</xliff:g> remaining, about <xliff:g id="time">%s</xliff:g> left</string>

    <!-- Same as battery_low_percent_format, with a notice about battery saver if on. [CHAR LIMIT=none]-->
    <string name="battery_low_percent_format_saver_started"><xliff:g id="percentage">%s</xliff:g> remaining. Battery Saver is on.</string>

+4 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ import com.android.systemui.plugins.PluginDependencyProvider;
import com.android.systemui.plugins.PluginManager;
import com.android.systemui.plugins.PluginManagerImpl;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.power.EnhancedEstimates;
import com.android.systemui.power.EnhancedEstimatesImpl;
import com.android.systemui.power.PowerNotificationWarnings;
import com.android.systemui.power.PowerUI;
import com.android.systemui.statusbar.phone.ConfigurationControllerImpl;
@@ -310,6 +312,8 @@ public class Dependency extends SystemUI {

        mProviders.put(OverviewProxyService.class, () -> new OverviewProxyService(mContext));

        mProviders.put(EnhancedEstimates.class, () -> new EnhancedEstimatesImpl());

        // Put all dependencies above here so the factory can override them if it wants.
        SystemUIFactory.getInstance().injectDependencies(mProviders, mContext);
    }
+8 −0
Original line number Diff line number Diff line
package com.android.systemui.power;

public interface EnhancedEstimates {

    boolean isHybridNotificationEnabled();

    Estimate getEstimate();
}
+16 −0
Original line number Diff line number Diff line
package com.android.systemui.power;

import android.util.Log;

public class EnhancedEstimatesImpl implements EnhancedEstimates {

    @Override
    public boolean isHybridNotificationEnabled() {
        return false;
    }

    @Override
    public Estimate getEstimate() {
        return null;
    }
}
+11 −0
Original line number Diff line number Diff line
package com.android.systemui.power;

public class Estimate {
    public final long estimateMillis;
    public final boolean isBasedOnUsage;

    public Estimate(long estimateMillis, boolean isBasedOnUsage) {
        this.estimateMillis = estimateMillis;
        this.isBasedOnUsage = isBasedOnUsage;
    }
}
Loading