refactor codes.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 24 Aug 2021 06:59:00 +0000 (14:59 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 24 Aug 2021 06:59:00 +0000 (14:59 +0800)
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java

index 1b36959..3df4999 100644 (file)
@@ -927,29 +927,19 @@ public class CoreService extends Service {
             }
         }
         //api直接获取batterylevel取消注册 receiver, 需要重新注册一下。
-
         batteryUtil.registerBroadReceiver();
-
-
         //设置计步清零时间。
         setCleanStepCountAlarm();
-
         //设置睡眠时间(开始睡眠监控)
         setSleepAlarm();
         //设置起床时间(停止睡眠监控)
         setWakeAlarm();
-
-
         //网络协议心跳时间
         setHeartBeatAlarm();
-
         //设置心率检测频率
         setHeartRateDetectAlarm(runtime.getPpgTestCycleInMinutes());
-
         //获取天气时间
         setWeatherAlarm();
-
-
         //获取定位时间
         needLocateInAfterHeartBeat = true;
         setLocationAlarm(runtime.getLocationInstance().getWorkingMod());
index 8913b75..34075c3 100644 (file)
@@ -94,7 +94,6 @@ public class BatteryUtil {
                 ICLogger.i(msg.toString());
                 //处理电压
                 process_battery_level(param1Context, batLevel);
-
             } else if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) {
                 //  mRuntime.setBatteryLow(true);
                 //   if (Config.LOG_TOFILE) ICLogger.logToFile("Battery","BatteryLow !");
@@ -113,12 +112,12 @@ public class BatteryUtil {
                 if (Config.isL03Tracker) {
                     LedUtil.setRedLedOn(true);
                 }
-
             } else if (Intent.ACTION_POWER_DISCONNECTED.equals(intent.getAction())) {
                 ICLogger.i("ACTION_POWER_DISCONNECTED!");
                 mRuntime.setPowerConnected(false);
-                if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "ACTION_POWER_DISCONNECTED !");
-
+                if (Config.LOG_TOFILE) {
+                    ICLogger.logToFile("Battery", "ACTION_POWER_DISCONNECTED !");
+                }
                 if (Config.isL03Tracker) {
                     LedUtil.setRedLedOn(false);
                 }
@@ -189,6 +188,7 @@ public class BatteryUtil {
             warningMsgValues.put(ICDatabaseHelper.warning_msg_create_time, System.currentTimeMillis());
             runtime.getContextProxy().getResolver().insert(Uri.parse(WarningItemProvider.WARNING_MSG),
                     warningMsgValues);
+            //TODO:低电的通知
         }
         //add by TrillGates======end
         ICLogger.d("runtime.getBatteryLevel()==> " + runtime.getBatteryLevel());
@@ -310,6 +310,7 @@ public class BatteryUtil {
         ICLogger.d("isCharging = " + isCharging + " isCharging2 " + isCharging2);
         return isCharging2;
     }
+
     public void unregisterBroadReceiver() {
         (this.mRuntime.getContextProxy()).context.unregisterReceiver(this.batteryChangedReceiver);
     }