android11电量显示0%,不能及时关机延迟的问题

--- a/alps/frameworks/base/services/core/java/com/android/server/BatteryService.java
+++ b/alps/frameworks/base/services/core/java/com/android/server/BatteryService.java
@@ -384,7 +384,8 @@ public final class BatteryService extends SystemService {
     private void shutdownIfNoPowerLocked() {
         // shut down gracefully if our battery is critically low and we are not powered.
         // wait until the system has booted before attempting to display the shutdown dialog.
-        if (shouldShutdownLocked()) {
+        //if (shouldShutdownLocked()) {
+        if (mHealthInfo.batteryLevel == 0 && !isPoweredLocked(BatteryManager.BATTERY_PLUGGED_ANY)) {
             mHandler.post(new Runnable() {
                 @Override
                 public void run() {

猜你喜欢

转载自blog.csdn.net/lwz622/article/details/120907009