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

Commit c6d34d6c authored by ykhung's avatar ykhung Committed by YK Hung
Browse files

Add incompatible charging battery tip UI and card skeleton

Bug: 263193978
Bug: 246960554
Test: make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge.batterytip"
Change-Id: I8180022bd39f66c88463a2552c6050669bb0357c
parent 2593fcd1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M8,22q-0.425,0 -0.713,-0.288Q7,21.425 7,21L7,5q0,-0.425 0.287,-0.713Q7.575,4 8,4h2L10,2h4v2h2q0.425,0 0.712,0.287Q17,4.575 17,5v16q0,0.425 -0.288,0.712Q16.425,22 16,22zM11,20l4,-7.5h-2L13,7l-4,7.5h2z"/>
</vector>
+8 −0
Original line number Diff line number Diff line
@@ -5086,6 +5086,12 @@
    <string name="battery_tip_unrestrict_app_dialog_cancel">Cancel</string>
    <!-- Charge to full button for battery defender tips [CHAR LIMIT=NONE] -->
    <string name="battery_tip_charge_to_full_button">Charge to full</string>
    <!-- Title of incompatible charging battery tip [CHAR LIMIT=NONE] -->
    <string name="battery_tip_incompatible_charging_title">Incompatible charging setup</string>
    <!-- Message of incompatible charging battery tip [CHAR LIMIT=NONE] -->
    <string name="battery_tip_incompatible_charging_message">Your battery is not charging or is charging very slowly</string>
    <!-- Content description for the incompatible charging battery tip button [CHAR LIMIT=NONE] -->
    <string name="battery_tip_incompatible_charging_content_description">Learn more about incompatible charging</string>
    <!-- Title for the smart battery manager preference [CHAR LIMIT=NONE] -->
    <string name="smart_battery_manager_title">Battery Manager</string>
@@ -6388,6 +6394,8 @@
    <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, Incompatible charging [DO NOT TRANSLATE] -->
    <string name="help_url_incompatible_charging" translatable="false"></string>
    <!-- Help URL, Accounts [DO NOT TRANSLATE] -->
    <string name="help_url_accounts" translatable="false"></string>
    <!-- Help URL, Choose lockscreen [DO NOT TRANSLATE] -->
+0 −4
Original line number Diff line number Diff line
@@ -106,10 +106,6 @@ public class BatteryDefenderTip extends BatteryTip {
                R.string.battery_tip_limited_temporarily_sec_button_content_description));
    }

    private CardPreference castToCardPreferenceSafely(Preference preference) {
        return preference instanceof CardPreference ? (CardPreference) preference : null;
    }

    private void resumeCharging(Context context) {
        final Intent intent =
                FeatureFactory.getFactory(context)
+15 −7
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import androidx.annotation.IntDef;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;

import com.android.settings.widget.CardPreference;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;

import java.lang.annotation.Retention;
@@ -59,7 +60,8 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
            TipType.LOW_BATTERY,
            TipType.REMOVE_APP_RESTRICTION,
            TipType.BATTERY_DEFENDER,
            TipType.DOCK_DEFENDER})
            TipType.DOCK_DEFENDER,
            TipType.INCOMPATIBLE_CHARGER})
    public @interface TipType {
        int SMART_BATTERY_MANAGER = 0;
        int APP_RESTRICTION = 1;
@@ -71,6 +73,7 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
        int REMOVE_APP_RESTRICTION = 7;
        int BATTERY_DEFENDER = 8;
        int DOCK_DEFENDER = 9;
        int INCOMPATIBLE_CHARGER = 10;
    }

    @VisibleForTesting
@@ -81,12 +84,13 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
        TIP_ORDER.append(TipType.LOW_BATTERY, 1);
        TIP_ORDER.append(TipType.BATTERY_DEFENDER, 2);
        TIP_ORDER.append(TipType.DOCK_DEFENDER, 3);
        TIP_ORDER.append(TipType.APP_RESTRICTION, 4);
        TIP_ORDER.append(TipType.HIGH_DEVICE_USAGE, 5);
        TIP_ORDER.append(TipType.SUMMARY, 6);
        TIP_ORDER.append(TipType.SMART_BATTERY_MANAGER, 7);
        TIP_ORDER.append(TipType.REDUCED_BATTERY, 8);
        TIP_ORDER.append(TipType.REMOVE_APP_RESTRICTION, 9);
        TIP_ORDER.append(TipType.INCOMPATIBLE_CHARGER, 4);
        TIP_ORDER.append(TipType.APP_RESTRICTION, 5);
        TIP_ORDER.append(TipType.HIGH_DEVICE_USAGE, 6);
        TIP_ORDER.append(TipType.SUMMARY, 7);
        TIP_ORDER.append(TipType.SMART_BATTERY_MANAGER, 8);
        TIP_ORDER.append(TipType.REDUCED_BATTERY, 9);
        TIP_ORDER.append(TipType.REMOVE_APP_RESTRICTION, 10);
    }

    private static final String KEY_PREFIX = "key_battery_tip";
@@ -203,4 +207,8 @@ public abstract class BatteryTip implements Comparable<BatteryTip>, Parcelable {
    public String toString() {
        return "type=" + mType + " state=" + mState;
    }

    CardPreference castToCardPreferenceSafely(Preference preference) {
        return preference instanceof CardPreference ? (CardPreference) preference : null;
    }
}
+0 −4
Original line number Diff line number Diff line
@@ -151,10 +151,6 @@ public class DockDefenderTip extends BatteryTip {

    }

    private CardPreference castToCardPreferenceSafely(Preference preference) {
        return preference instanceof CardPreference ? (CardPreference) preference : null;
    }

    private void resumeCharging(Context context) {
        final Intent intent =
                FeatureFactory.getFactory(context)
Loading