Android P 省电策略BatterySaverPolicy文件

BatterySaverPolicy 源码

  • frameworks/base/services/core/java/com/android/server/power/BatterySaverPolicy.java
    粗略看了下很有作为,感觉是目前5.0、6.0、7.0、8.0中变化比较大的部分
/**
 * Class to decide whether to turn on battery saver mode for specific service
 *
 * IMPORTANT: This class shares the power manager lock, which is very low in the lock hierarchy.
 * Do not call out with the lock held, such as AccessibilityManager. (Settings provider is okay.)
 *
 * Test:
 atest ${ANDROID_BUILD_TOP}/frameworks/base/services/tests/servicestests/src/com/android/server/power/BatterySaverPolicyTest.java
 */
public class BatterySaverPolicy extends ContentObserver {
    private static final String TAG = "BatterySaverPolicy";

    public static final boolean DEBUG = true; // DO NOT SUBMIT WITH TRUE.

    // Secure setting for GPS behavior when battery saver mode is on.
    public static final String SECURE_KEY_GPS_MODE = "batterySaverGpsMode";

    private static final String KEY_GPS_MODE = "gps_mode"; // GPS 省电
    private static final String KEY_VIBRATION_DISABLED = "vibration_disabled"; // 禁用触摸震动
    private static final String KEY_ANIMATION_DISABLED = "animation_disabled"; // 禁用动画,但是这里可能会带来闪屏现象
    private static final String KEY_SOUNDTRIGGER_DISABLED = "soundtrigger_disabled"; // 禁用触摸声音
    private static final String KEY_FIREWALL_DISABLED = "firewall_disabled"; // 联网防火墙
    private static final String KEY_ADJUST_BRIGHTNESS_DISABLED = "adjust_brightness_disabled";// 屏幕亮度省电
    private static final String KEY_DATASAVER_DISABLED = "datasaver_disabled"; // 流量节省
    private static final String KEY_LAUNCH_BOOST_DISABLED = "launch_boost_disabled"; // 启动加速
    private static final String KEY_ADJUST_BRIGHTNESS_FACTOR = "adjust_brightness_factor"; // 屏幕亮度
    private static final String KEY_FULLBACKUP_DEFERRED = "fullbackup_deferred"; // 新机制
    private static final String KEY_KEYVALUE_DEFERRED = "keyvaluebackup_deferred";// 新机制
    private static final String KEY_FORCE_ALL_APPS_STANDBY = "force_all_apps_standby";// 新机制
    private static final String KEY_FORCE_BACKGROUND_CHECK = "force_background_check";// 新机制
    private static final String KEY_OPTIONAL_SENSORS_DISABLED = "optional_sensors_disabled";// 新机制 传感器省电
    private static final String KEY_AOD_DISABLED = "aod_disabled";
    private static final String KEY_SEND_TRON_LOG = "send_tron_log";

    private static final String KEY_CPU_FREQ_INTERACTIVE = "cpufreq-i"; // CPU模式切换
    private static final String KEY_CPU_FREQ_NONINTERACTIVE = "cpufreq-n";

    private final Object mLock;
    private final Handler mHandler;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

法迪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值