跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Android] adb shell dumpsys battery 疑问求解答

发表于

很早之前看到

下载并安装 Android Debug Bridge (ADB) 工具[1]。

在命令行中输入 adb shell dumpsys battery set usb 0 ,以禁止 USB 充电。

在命令行中输入 adb shell dumpsys battery set usb 1 ,以允许 USB 充电。

可以 ADB 控制充放电。

实际使用一次发现手机电量显示卡在 100 ,实际已经没有电了,重启解决,就没有关心这件事。

今天到 GPT 上问了问,告知我这个命令只是模拟了设备停止通过 USB 充电。,

> .\adb.exe shell dumpsys battery
Current Battery Service state:
  (UPDATES STOPPED -- use 'reset' to restart)
  AC powered: false
  USB powered: false
  Wireless powered: false
  Max charging current: 500000
  Max charging voltage: 4867000
  Charge counter: 1641000
  status: 2
  health: 2
  present: true
  level: 72
  scale: 100
  voltage: 4080
  temperature: 300
  technology: Li-poly

在这个输出中 USB powered:被模拟成了 false ,但是 status: 2 表示正在充电中,

##chatgpt:
从输出结果来看,你已经成功模拟了设备停止通过 USB 充电。以下几点支持这个结论:

USB powered: false
输出中显示 USB powered: false ,表明系统认为设备不再通过 USB 充电。

AC powered: false 和 Wireless powered: false
同时,设备没有通过交流电源或无线充电供电,这表明系统认为设备没有任何外部电源。

status: 2
status: 2 表示设备的电池状态为“充电中”,但由于 USB powered 已设置为 false ,这意味着充电状态可能是之前的模拟结果,并不反映当前的物理状态。

我请求来源 ,chatgpt 给不出。

我在 ADB 文档中没有找到,特地去问了 Gemini ,毕竟都是一家公司的,得到的确实另一个回答

##Gemini
好的,我来为你详细解释一下 adb shell dumpsys battery 命令输出中的 status: 2 的含义。

status: 2 的含义
在 adb shell dumpsys battery 命令的输出中,status: 2 表示设备的电池目前处于放电状态。

其他状态值
除了 status: 2 ,常见的 status 值还有:

0: 电池状态未知。
1: 电池正在充电。
3: 电池已充满。
4: 电池未充电。
5: 电池处于充满状态。

我困惑住了, 感谢看到这里,求一个解答!

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.