1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.fuelgauge; 18 19 import android.content.Context; 20 21 import androidx.annotation.NonNull; 22 import androidx.annotation.Nullable; 23 24 import com.android.settings.fuelgauge.batterytip.BatteryTipPolicy; 25 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; 26 27 import java.util.List; 28 29 /** Feature provider for battery settings usage. */ 30 public interface BatterySettingsFeatureProvider { 31 32 /** Returns true if manufacture date should be shown */ isManufactureDateAvailable(Context context, long manufactureDateMs)33 boolean isManufactureDateAvailable(Context context, long manufactureDateMs); 34 35 /** Returns true if first use date should be shown */ isFirstUseDateAvailable(Context context, long firstUseDateMs)36 boolean isFirstUseDateAvailable(Context context, long firstUseDateMs); 37 38 /** Check whether the battery information page is enabled in the About phone page */ isBatteryInfoEnabled(Context context)39 boolean isBatteryInfoEnabled(Context context); 40 41 /** A way to add more battery tip detectors. */ addBatteryTipDetector( Context context, List<BatteryTip> batteryTips, BatteryInfo batteryInfo, BatteryTipPolicy batteryTipPolicy)42 void addBatteryTipDetector( 43 Context context, 44 List<BatteryTip> batteryTips, 45 BatteryInfo batteryInfo, 46 BatteryTipPolicy batteryTipPolicy); 47 48 /** Return a label for the bottom summary during wireless charging. */ 49 @Nullable getWirelessChargingLabel(@onNull Context context, @NonNull BatteryInfo info)50 CharSequence getWirelessChargingLabel(@NonNull Context context, @NonNull BatteryInfo info); 51 52 /** Return a content description for the bottom summary during wireless charging. */ 53 @Nullable getWirelessChargingContentDescription( @onNull Context context, @NonNull BatteryInfo info)54 CharSequence getWirelessChargingContentDescription( 55 @NonNull Context context, @NonNull BatteryInfo info); 56 57 /** Return a charging remaining time label for wireless charging. */ 58 @Nullable getWirelessChargingRemainingLabel( @onNull Context context, long remainingTimeMs, long currentTimeMs)59 CharSequence getWirelessChargingRemainingLabel( 60 @NonNull Context context, long remainingTimeMs, long currentTimeMs); 61 62 /** Return true if it's in the charging optimization mode. */ isChargingOptimizationMode(@onNull Context context)63 boolean isChargingOptimizationMode(@NonNull Context context); 64 65 /** Return a charging remaining time label for charging optimization mode. */ 66 @Nullable getChargingOptimizationRemainingLabel( @onNull Context context, int batteryLevel, int pluggedStatus, long chargeRemainingTimeMs, long currentTimeMs)67 CharSequence getChargingOptimizationRemainingLabel( 68 @NonNull Context context, 69 int batteryLevel, 70 int pluggedStatus, 71 long chargeRemainingTimeMs, 72 long currentTimeMs); 73 74 /** Return a charge label for charging optimization mode. */ 75 @Nullable getChargingOptimizationChargeLabel( @onNull Context context, int batteryLevel, String batteryPercentageString, long chargeRemainingTimeMs, long currentTimeMs)76 CharSequence getChargingOptimizationChargeLabel( 77 @NonNull Context context, 78 int batteryLevel, 79 String batteryPercentageString, 80 long chargeRemainingTimeMs, 81 long currentTimeMs); 82 } 83