android 电池充电状态记录

2023-05-16

摘抄源码记录下
http://androidxref.com/9.0.0_r3/xref/frameworks/native/include/batteryservice/BatteryServiceConstants.h

// This file is autogenerated by hidl-gen. Do not edit manually.
2
3#ifndef HIDL_GENERATED_android_hardware_health_V1_0_EXPORTED_CONSTANTS_H_
4#define HIDL_GENERATED_android_hardware_health_V1_0_EXPORTED_CONSTANTS_H_
5
6#ifdef __cplusplus
7extern “C” {
8#endif
9
10enum {
11 BATTERY_STATUS_UNKNOWN = 1,
12 BATTERY_STATUS_CHARGING = 2,
13 BATTERY_STATUS_DISCHARGING = 3,
14 BATTERY_STATUS_NOT_CHARGING = 4,
15 BATTERY_STATUS_FULL = 5,
16};
17
18enum {
19 BATTERY_HEALTH_UNKNOWN = 1,
20 BATTERY_HEALTH_GOOD = 2,
21 BATTERY_HEALTH_OVERHEAT = 3,
22 BATTERY_HEALTH_DEAD = 4,
23 BATTERY_HEALTH_OVER_VOLTAGE = 5,
24 BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6,
25 BATTERY_HEALTH_COLD = 7,
26};
27
28#ifdef _cplusplus
29}
30#endif
31
32#endif // HIDL_GENERATED_android_hardware_health_V1_0_EXPORTED_CONSTANTS_H

33

32@SystemService(Context.BATTERY_SERVICE)
33public class BatteryManager {
34 /**
35 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
36 * integer containing the current status constant.
37 /
38 public static final String EXTRA_STATUS = “status”;
39
40 /
*
41 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
42 * integer containing the current health constant.
43 /
44 public static final String EXTRA_HEALTH = “health”;
45
46 /
*
47 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
48 * boolean indicating whether a battery is present.
49 /
50 public static final String EXTRA_PRESENT = “present”;
51
52 /
*
53 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
54 * integer field containing the current battery level, from 0 to
55 * {@link #EXTRA_SCALE}.
56 /
57 public static final String EXTRA_LEVEL = “level”;
58
59 /
*
60 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
61 * Boolean field indicating whether the battery is currently considered to be
62 * low, that is whether a {@link Intent#ACTION_BATTERY_LOW} broadcast
63 * has been sent.
64 /
65 public static final String EXTRA_BATTERY_LOW = “battery_low”;
66
67 /
*
68 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
69 * integer containing the maximum battery level.
70 /
71 public static final String EXTRA_SCALE = “scale”;
72
73 /
*
74 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
75 * integer containing the resource ID of a small status bar icon
76 * indicating the current battery state.
77 /
78 public static final String EXTRA_ICON_SMALL = “icon-small”;
79
80 /
*
81 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
82 * integer indicating whether the device is plugged in to a power
83 * source; 0 means it is on battery, other constants are different
84 * types of power sources.
85 /
86 public static final String EXTRA_PLUGGED = “plugged”;
87
88 /
*
89 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
90 * integer containing the current battery voltage level.
91 /
92 public static final String EXTRA_VOLTAGE = “voltage”;
93
94 /
*
95 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
96 * integer containing the current battery temperature.
97 /
98 public static final String EXTRA_TEMPERATURE = “temperature”;
99
100 /
*
101 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
102 * String describing the technology of the current battery.
103 /
104 public static final String EXTRA_TECHNOLOGY = “technology”;
105
106 /
*
107 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
108 * Int value set to nonzero if an unsupported charger is attached
109 * to the device.
110 * {@hide}
111 /
112 public static final String EXTRA_INVALID_CHARGER = “invalid_charger”;
113
114 /
*
115 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
116 * Int value set to the maximum charging current supported by the charger in micro amperes.
117 * {@hide}
118 /
119 public static final String EXTRA_MAX_CHARGING_CURRENT = “max_charging_current”;
120
121 /
*
122 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
123 * Int value set to the maximum charging voltage supported by the charger in micro volts.
124 * {@hide}
125 /
126 public static final String EXTRA_MAX_CHARGING_VOLTAGE = “max_charging_voltage”;
127
128 /
*
129 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
130 * integer containing the charge counter present in the battery.
131 * {@hide}
132 /
133 public static final String EXTRA_CHARGE_COUNTER = “charge_counter”;
134
135 /
*
136 * Extra for {@link android.content.Intent#ACTION_BATTERY_CHANGED}:
137 * Current int sequence number of the update.
138 * {@hide}
139 /
140 public static final String EXTRA_SEQUENCE = “seq”;
141
142 /
*
143 * Extra for {@link android.content.Intent#ACTION_BATTERY_LEVEL_CHANGED}:
144 * Contains list of Bundles representing battery events
145 * @hide
146 /
147 @SystemApi
148 public static final String EXTRA_EVENTS = “android.os.extra.EVENTS”;
149
150 /
*
151 * Extra for event in {@link android.content.Intent#ACTION_BATTERY_LEVEL_CHANGED}:
152 * Long value representing time when event occurred as returned by
153 * {@link android.os.SystemClock#elapsedRealtime()}
154 * @hide
155 /
156 @SystemApi
157 public static final String EXTRA_EVENT_TIMESTAMP = “android.os.extra.EVENT_TIMESTAMP”;
158
159 // values for “status” field in the ACTION_BATTERY_CHANGED Intent
160 public static final int BATTERY_STATUS_UNKNOWN = Constants.BATTERY_STATUS_UNKNOWN;
161 public static final int BATTERY_STATUS_CHARGING = Constants.BATTERY_STATUS_CHARGING;
162 public static final int BATTERY_STATUS_DISCHARGING = Constants.BATTERY_STATUS_DISCHARGING;
163 public static final int BATTERY_STATUS_NOT_CHARGING = Constants.BATTERY_STATUS_NOT_CHARGING;
164 public static final int BATTERY_STATUS_FULL = Constants.BATTERY_STATUS_FULL;
165
166 // values for “health” field in the ACTION_BATTERY_CHANGED Intent
167 public static final int BATTERY_HEALTH_UNKNOWN = Constants.BATTERY_HEALTH_UNKNOWN;
168 public static final int BATTERY_HEALTH_GOOD = Constants.BATTERY_HEALTH_GOOD;
169 public static final int BATTERY_HEALTH_OVERHEAT = Constants.BATTERY_HEALTH_OVERHEAT;
170 public static final int BATTERY_HEALTH_DEAD = Constants.BATTERY_HEALTH_DEAD;
171 public static final int BATTERY_HEALTH_OVER_VOLTAGE = Constants.BATTERY_HEALTH_OVER_VOLTAGE;
172 public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = Constants.BATTERY_HEALTH_UNSPECIFIED_FAILURE;
173 public static final int BATTERY_HEALTH_COLD = Constants.BATTERY_HEALTH_COLD;
174
175 // values of the “plugged” field in the ACTION_BATTERY_CHANGED intent.
176 // These must be powers of 2.
177 /
* Power source is an AC charger. /
178 public static final int BATTERY_PLUGGED_AC = OsProtoEnums.BATTERY_PLUGGED_AC; // = 1
179 /
* Power source is a USB port. /
180 public static final int BATTERY_PLUGGED_USB = OsProtoEnums.BATTERY_PLUGGED_USB; // = 2
181 /
* Power source is wireless. /
182 public static final int BATTERY_PLUGGED_WIRELESS = OsProtoEnums.BATTERY_PLUGGED_WIRELESS; // = 4
183
184 /
* @hide /
185 public static final int BATTERY_PLUGGED_ANY =
186 BATTERY_PLUGGED_AC | BATTERY_PLUGGED_USB | BATTERY_PLUGGED_WIRELESS;
187
188 /
*
189 * Sent when the device’s battery has started charging (or has reached full charge
190 * and the device is on power). This is a good time to do work that you would like to
191 * avoid doing while on battery (that is to avoid draining the user’s battery due to
192 * things they don’t care enough about).
193 *
194 * This is paired with {@link #ACTION_DISCHARGING}. The current state can always
195 * be retrieved with {@link #isCharging()}.
196 /
197 public static final String ACTION_CHARGING = “android.os.action.CHARGING”;
198
199 /
*
200 * Sent when the device’s battery may be discharging, so apps should avoid doing
201 * extraneous work that would cause it to discharge faster.
202 *
203 * This is paired with {@link #ACTION_CHARGING}. The current state can always
204 * be retrieved with {@link #isCharging()}.
205 /
206 public static final String ACTION_DISCHARGING = “android.os.action.DISCHARGING”;
207
208 /

209 * Battery property identifiers. These must match the values in
210 * frameworks/native/include/batteryservice/BatteryService.h
211 /
212 /
* Battery capacity in microampere-hours, as an integer. /
213 public static final int BATTERY_PROPERTY_CHARGE_COUNTER = 1;
214
215 /
*
216 * Instantaneous battery current in microamperes, as an integer. Positive
217 * values indicate net current entering the battery from a charge source,
218 * negative values indicate net current discharging from the battery.
219 /
220 public static final int BATTERY_PROPERTY_CURRENT_NOW = 2;
221
222 /
*
223 * Average battery current in microamperes, as an integer. Positive
224 * values indicate net current entering the battery from a charge source,
225 * negative values indicate net current discharging from the battery.
226 * The time period over which the average is computed may depend on the
227 * fuel gauge hardware and its configuration.
228 /
229 public static final int BATTERY_PROPERTY_CURRENT_AVERAGE = 3;
230
231 /
*
232 * Remaining battery capacity as an integer percentage of total capacity
233 * (with no fractional part).
234 /
235 public static final int BATTERY_PROPERTY_CAPACITY = 4;
236
237 /
*
238 * Battery remaining energy in nanowatt-hours, as a long integer.
239 /
240 public static final int BATTERY_PROPERTY_ENERGY_COUNTER = 5;
241
242 /
*
243 * Battery charge status, from a BATTERY_STATUS_* value.
244 */
245 public static final int BATTERY_PROPERTY_STATUS = 6;

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

android 电池充电状态记录 的相关文章

  • MATLAB Simulink开发ROS无人车与机器人应用 详细教程

    引言 xff1a MATLAB在机器人中的应用 现在大多数机器人开发者都会选择ROS xff0c 在ROS整个框架下 调包 极其容易 很多ROS开发者热衷于 调包 来实现功能 xff0c 却难以在机器人学的理论知识上有所突破 MATLAB的
  • DE1-SOC入门之Linux开发环境搭建

    入手DE1 SOC这块FPGA也有两三个月了 xff0c 将友晶提供的入门学习例程 代码等摸索了一下 xff0c 感觉正常的fpga和arm之间的通信 控制已经没多大问题了 可是很多时候 xff0c 事情没有自己想的那么简单 现在接手的项目
  • sensor_msgs/NavSatFix Message

    1 sensor msgs NavSatStatus Message http docs ros org en api sensor msgs html msg NavSatStatus html Navigation Satellite
  • 零基础如何入门激光SLAM

    零基础如何入门激光SLAM 最近有几个人加我 xff0c 都说是刚开始学激光slam xff0c 基本都是研一 xff0c 也有一些大四的 xff08 大四的都开始学SLAM了 xff01 xff09 情况也都差不多 xff0c 有的是课题
  • 从零开始搭二维激光SLAM --- 栅格地图的构建

    上周搬家 导致这篇文章更新的慢了点 之前的文章我们都是通过scan to scan的方式进行位姿变换的计算 接下来的文章将带领大家体验scan to map的计算位姿变换的方式 首先 来简要介绍一下什么是map 1 地图与占用栅格地图 1
  • 从零开始搭二维激光SLAM --- 基于gtsam的后端优化的代码实现

    上一篇文章我们分析了如何使用ceres进行位姿图的优化 这篇文章来讲一下如何使用gtsam进行位姿图的优化 1 gtsam简介 gtsam是最近几年火起来的一个优化库 GTSAM xff08 Georgia Tech Smoothing a
  • 从零开始学定位 --- kaist数据集体验

    1 Kaist数据集简介 选择数据集选择了好几天 xff0c 最终选择了kaist数据集 xff0c 这个数据集中有 轮速计 xff0c imu gps 16线雷达 xff0c 这些传感器满足了我认为多传感器融合定位的需要 简要介绍一下Ka
  • 从零开始学定位 --- 使用kaist数据集进行LIO-SAM建图

    之前的文章只是将数据的雷达在rviz中进行可视化了 xff0c 并没有实际用起来 这篇文章将使用Kaist Urban08 数据使用LIO SAM进行三维点云地图的构建 1 clone 工程 仓库的地址是 https github com
  • 我的2048天创作纪念日

    距离发布第一篇博客竟然已经2048天了 不知不觉都已经这么长时间了啊 xff0c 真是岁月不饶人啊 随想 5年的时间 xff0c 这5年经历了硕士时期 xff0c 经历了毕业之后的第一份工作 xff0c 第二份工作 xff0c 第三份工作
  • 基于粒子滤波的SLAM(GMapping)算法分析

    本文是 Improved Techniques for Grid Mapping with Rao Blackwellized Particle Filters 的大致翻译 xff0c 难免有不通顺与错误的地方 xff0c 如有错误请指出
  • tf之static_transform_publisher

    tf xff1a transform xff0c ROS中管理3D坐标系变换的工具 只要告诉tf两个相关联坐标系的坐标变换信息 xff0c tf会帮你一直记录这个两个坐标系的坐标变换 xff0c 即使两个坐标系处于运动中 1 tf的命令行用
  • sensor_msgs/PointCloud2 Message

    sensor msgs PointCloud2 Message File sensor msgs PointCloud2 msg Raw Message Definition This message holds a collection
  • 安卓平台及windows平台上基于Gazebo仿真器的px4遥控控制

    这里写自定义目录标题 安卓平台及windows平台上基于Gazebo仿真器的px4遥控控制数据链路描述安卓平台简介安卓平台四旋翼无人机控制安卓平台固定翼无人机控制安卓平台无人车控制安卓遥控器实物控制 桌面平台遥控图形界面桌面平台四旋翼无人机
  • sitl_gazebo,px4模型matlab接口分析,gazebo与matlab联合仿真

    最近在使用matlab建立四旋翼控制程序 xff0c 奈何没有好的可视化仿真软件 xff0c 便想起px4的gazebo仿真环境 xff0c 使用matlab连接px4底层通信模型 xff0c 实现matlab在软件层面的可视化仿真 Gaz
  • 【体验】ESP32-CAM可能是最便宜的“监控”方案,ESP32-CAM程序下载调试

    生活新装备 NEW EQUIPMENT FOR LIFE 抱着试一试的心里 xff0c 买了ESP32 CAM xff0c xff08 你别说 还真对得起 我和RMB xff0c 看下边 xff0c 看下边 xff09 xff1a 当年玩S
  • 【树莓派】树莓派SD卡系统镜像系统备份方法

    微信关注 DLGG创客DIY 设为 星标 xff0c 重磅干货 xff0c 第一时间送达 先感谢漂移菌的技术支持 耐心 细致的帮我解决了一个困扰我很久的问题 树莓派系统备份问题 问题的提出 xff1a 树莓派各种版本系统 xff0c 各种软
  • 【笔记】可能是唯一能让天猫精灵方糖播放本地音乐的智能方案

    微信关注公众号 DLGG创客DIY 设为 星标 xff0c 重磅干货 xff0c 第一时间送达 前言 如上图所示 xff0c 我家也有个同款的天猫精灵方糖 xff0c 买了 xff08 好像是个奖品 xff09 好几年了 xff0c 利用率
  • C++做题网站

    今天小编带大家介绍一下我平时用的C 43 43 做题网站 1 洛谷 平时我发题解一般是选自这个网站 传送链接 xff1a 洛谷 2 黑猫OJ 里面的题很好 传送链接 xff1a 黑猫OJ 3 图灵编程OJ 我最开始用的做题网站 传送链接 x
  • ROS系列:第三章(二)

    系列文章目录 第一章 ROS概述与环境搭建 第二章 ROS通信机制 第三章 ROS通信机制进阶 第四章 ROS运行管理 第五章 ROS常用组件 第六章 机器人系统仿真 第七章 机器人系统仿真 第八章 机器人系统仿真 第九章 机器人系统仿真
  • 手把手系列--STM32H750移植FreeRTOS(二)--优化编译速度

    一 目的 在上一篇 手把手系列 STM32H750移植FreeRTOS 我们已经实现了在ArtPi开发板上使用FreeRTOS 在编译阶段我们发现整个编译过程特别慢 xff0c 那么如何优化编译速度呢 xff1f 本篇的主要目的就是优化整个

随机推荐

  • FreeRTOS如何判断当前上下文是在中断还是在线程环境中

    一 目的 很多小伙伴在使用FreeRTOS API时 xff0c 肯定看到过类似这样的接口 xff1a xSemaphoreGiveFromISR SemaphoreHandle t xSemaphore signed BaseType t
  • 手把手系列--STM32H750移植FreeRTOS(三)--获取CPU占用

    一 目的 在之前的博文中我们移植验证了STM32H750XBH6上运行FreeRTOS系统 xff0c 在实际项目开发中我们经常会遇到获取系统实时运行负载的情况 xff0c 进而对系统进行优化 手把手系列 STM32H750移植FreeRT
  • 【资料分享】工程师必备嵌入式资料合集

    对于许多电子工程师来说 xff0c 各种电路资料 xff0c 学习资料 xff0c 新新技术资料等等 xff0c 都有越多越好的 本篇帖子就为大家整理了一些比较受工程师欢迎的一些电路资料 如果你有心动的话 xff0c 不妨就来搜集一波吧 x
  • HTML网页Javascript跳转代码

    有时候咱们不希望在该页面出现一条长长的链接 xff0c 那就可以采用跳转页了 xff0c 以下是代码 lt html gt lt head gt lt meta http equiv 61 34 Content Type 34 conten
  • 一起尝试写一个自己的小软件

    一起尝试写一个自己的小软件 xff0c 有时候写个小软件 xff0c 会耗费一两个小时 xff0c 有时候耗费几个小时 xff0c 甚至几天 xff0c 但是在写小软件的过程中 xff0c 咱们都是沉浸在软件写好后的美妙体验中 xff0c
  • 网页被挂马了怎么办呢

    首先 xff0c 咱们了解一下网页挂马是什么意思 xff1a 网页挂马指的是把一个木马程序上传到一个网站里面然后用木马生成器生一个网马 xff0c 再上到空间里面 xff01 再加代码使得木马在打开网页时运行 xff01 接下来讲怎么办 如
  • 公司里最看重的是发展机会

    公司里最看重的是发展机会 xff0c 而不是现在的工资 xff0c 这是很多老板都喜欢说的 说的多了 xff0c 咱么那就相信了 虽然说 xff0c 很大程度上 xff0c 今后的日子怎么过 xff0c 取决于现在的想法和奋斗 xff0c
  • 处在八零末期,九零早期,缝隙中的人

    处在八零末期 xff0c 九零早期 xff0c 缝隙中的人 思想既可以与八零年代的人相似 xff0c 又有九零年代那种无法脱掉的稚气 这就是89年 90年出生的人 的特性
  • 马上就下班回家了,让我再写一篇

    马上就下班回家了 xff0c 让我再写一篇 xff0c 写博客让我突然静下来了 同时都纷纷离开了 快了 xff0c 快了 xff0c 马上写好了
  • 我知道自己的未来需要什么

    我知道自己的未来需要什么 xff0c 现在的路就在眼前 xff0c 争取一把 xff0c 奋斗一段时间 xff0c 未来光明坦途正在招手 下班了 xff0c 下次再来
  • 走马观花之《视觉SLAM十四讲》

    1 视觉SLAM 系统概述 SLAM 是Simultaneous Localization and Mapping 的缩写 xff0c 中文译作 同时定位与地图构建 它是指搭载特定传感器的主体 xff0c 在没有环境先验信息的情况下 xff
  • 硬件工程师必会模块之MOS管构成的基本门逻辑电路—看芯片手册框图必备技能

    本文你可以获得什么 xff1f MOS管构成的缓冲器Buffer和漏极开路们OD门是数字电路非常重要的概念 xff0c 怎么构成的 xff1b 反相器 xff0c 线与逻辑怎么玩 xff0c 又怎么用呢 xff1f 根据原理图 xff0c
  • 关于信号量的作用范围

    最近在搞信号量的时候产生了怀疑 xff0c 信号量的作用范围和信号量在任务的位置时候有关系呢 xff1f 答案是有的 xff0c 其实信号量的作用范围是指的从信号量开始到程序的跳转点为止 xff0c 比如一个任务中 xff0c 把信号量放在
  • UNIX 环境高级编程之我见

    UNIX环境高级编程 xff08 第二版 xff09 xff08 人民邮电出版社 xff09 美 W Richard Stevens amp Stephen A Rago 著 本书的主要结构分为以下几个部分 xff1a xff08 1 xf
  • xShell连接ubuntu不成功

    操作环境 xff1a xShell6 43 vm15 43 ubuntu18 04 xShell中以root身份连接虚拟机中的ubuntu时 xff0c 连接不上 xff0c 见下图 xff1a 密码输入的也是对的 xff0c 也能够双向p
  • mac brew install

    brew cask install myprogram base darren 64 Darren 2 project brew cask install docker Error Unknown command cask brew ins
  • mac/linux 系统批量计算文件md5命令

    find type f print0 xargs 0 md5
  • 链表-设计链表

    leetcode 707 设计链表 注意 xff1a 面向对象的思想 这是创建一个自己的链表 xff0c dummyhead和 size初始化都在构造函数中 xff0c 同时自己的链表类也需要定义自己的节点 struct LinkNode链
  • KVM虚拟机使用桥接方式时和宿主机无法通信的解决方案

    KVM虚拟机使用桥接方式时和宿主机无法通信的解决方案 应用场景 虚拟机客户机安装完成后 xff0c 需要为其设置网络接口 xff0c 以便和主机网络 xff0c 客户机之间的网络通信 事实上 xff0c 如果要在安装时使用网络通信 xff0
  • android 电池充电状态记录

    摘抄源码记录下 http androidxref com 9 0 0 r3 xref frameworks native include batteryservice BatteryServiceConstants h This file