PowerManagerService

简介: PowerManagerService

1.唤醒盒子   使盒子进入假待机

PowerManager powerManager = (PowerManager) getContext().getSystemService(Context.POWER_SERVICE);
        if (mode.equals("0")) {
            powerManager.goToSleep(SystemClock.uptimeMillis());  进入假待机
        } else if (mode.equals("1")) {
            powerManager.wakeUp(SystemClock.uptimeMillis());     唤醒盒子
        }

2.判断盒子是否处于假待机

PowerManager powerManager = (PowerManager) getContext().getSystemService(Context.POWER_SERVICE);
powerManager.isInteractive();

3.几种状态

frameworks\base\core\java\android\os\PowerManagerInternal.java

/**
* Wakefulness: The device is asleep. It can only be awoken by a call to wakeUp().
* The screen should be off or in the process of being turned off by the display controller.
* The device typically passes through the dozing state first.
*/
public static final int WAKEFULNESS_ASLEEP = 0;  深度睡眠
/**
* Wakefulness: The device is fully awake. It can be put to sleep by a call to goToSleep().
* When the user activity timeout expires, the device may start dreaming or go to sleep.
*/ 
public static final int WAKEFULNESS_AWAKE = 1;   唤醒状态
/**
* Wakefulness: The device is dreaming. It can be awoken by a call to wakeUp(),
* which ends the dream. The device goes to sleep when goToSleep() is called, when
* the dream ends or when unplugged.
* User activity may brighten the screen but does not end the dream.
*/
public static final int WAKEFULNESS_DREAMING = 2;   屏保   
/**
* Wakefulness: The device is dozing. It is almost asleep but is allowing a special
* low-power "doze" dream to run which keeps the display on but lets the application
* processor be suspended. It can be awoken by a call to wakeUp() which ends the dream.
* The device fully goes to sleep if the dream cannot be started or ends on its own.
*/
public static final int WAKEFULNESS_DOZING = 3;   浅睡眠
目录
相关文章
|
Java Shell Linux
Android——编译(一):编译make的基础知识
Android——编译(一):编译make的基础知识
852 0
|
算法 搜索推荐 Android开发
android的A/B到底是什么?OTA升级又是什么?
android的A/B到底是什么?OTA升级又是什么?
1831 0
|
存储 数据安全/隐私保护
Rockchip系列之VendorStorage 浅浅的介绍(1)
Rockchip系列之VendorStorage 浅浅的介绍(1)
2124 0
|
开发工具 Android开发
rk平台Android12屏幕永不休眠
rk平台Android12屏幕永不休眠
880 1
|
算法 网络协议 Ubuntu
启用BBR拥塞控制算法
BBR是谷歌开发的TCP拥塞控制算法,能显著提升高延迟、轻微丢包网络下的传输性能。本文介绍在Linux系统上启用和验证BBR的步骤,包括检查内核版本、修改sysctl配置、应用并验证设置,帮助用户优化网络传输速度。
2134 0
|
机器学习/深度学习 数据采集 人工智能
【机器学习】集成学习(Bagging)——随机森林(RandomForest)(理论+图解+公式推导)
【机器学习】集成学习(Bagging)——随机森林(RandomForest)(理论+图解+公式推导)
2182 0
【机器学习】集成学习(Bagging)——随机森林(RandomForest)(理论+图解+公式推导)
|
编解码 Android开发
selinux报avc denied权限和编译报neverallow 解决方案
selinux报avc denied权限和编译报neverallow 解决方案
2473 2
|
XML Java API
Android 浅度解析:系统框架层修改,编译,推送相关操作
Android 浅度解析:系统框架层修改,编译,推送相关操作
1956 0
|
编解码 Linux Android开发
linux文件组 avc: denied { dac_read_search } for capability=2
linux文件组 avc: denied { dac_read_search } for capability=2
1135 0

热门文章

最新文章