From: k.liang Date: Fri, 22 Oct 2021 12:13:55 +0000 (+0800) Subject: AA-解决定时定位bug X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=30b6b9f0b456a1586642ae022db192b839e08696;p=icsupport.git AA-解决定时定位bug --- diff --git a/app/release/output.json b/app/release/output.json index f4a9a220..9e205da7 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":984,"versionName":"2110221046","enabled":true,"outputFile":"ICSer_V984_2110221046_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V984_2110221046_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":988,"versionName":"2110222005","enabled":true,"outputFile":"ICSer_V988_2110222005_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V988_2110222005_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 30805842..8327c70e 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -221,8 +221,9 @@ public class CoreService extends Service { setWeatherAlarm(); runtime.getContextProxy().sendBroadcast(ACTION_ALARM_ALARM_CHANGE, runtime); //更新Alarm // setLocationAlarm(runtime.getLocationInstance().getWorkingMod()); - if (cmcm_call_eiot_into_powersave_mode() == 0) + if (cmcm_call_eiot_into_powersave_mode() == 0) { AlarmWakeUp.isNeedWakeUpAlarm(runtime); + } } }; private final BroadcastReceiver broadcastSOSReceiver = new BroadcastReceiver() { diff --git a/app/src/main/java/com/enqualcomm/support/utils/AlarmWakeUp.java b/app/src/main/java/com/enqualcomm/support/utils/AlarmWakeUp.java index da199c49..43cef784 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/AlarmWakeUp.java +++ b/app/src/main/java/com/enqualcomm/support/utils/AlarmWakeUp.java @@ -16,28 +16,30 @@ import static com.enqualcomm.support.Constants.SERVICE_CLS_NAME; import static com.enqualcomm.support.Constants.SERVICE_PKG_NAME; public class AlarmWakeUp { - private static long lastAlarmTime; - - public static void isNeedWakeUpAlarm(Runtime runtime) { - long l = SystemClock.elapsedRealtime(); -// int i = Config.getAlarmCycle(runtime.getContextProxy().context); - int i = Config.getLocationCycle(runtime.getContextProxy().context); - if (l - lastAlarmTime > ((i + 1) * 60 * 1000)) { //达到cycle时间则唤醒CoreService并发送定位消息 - ComponentName componentName = new ComponentName(SERVICE_PKG_NAME, SERVICE_CLS_NAME); -// Intent intent = (new Intent(CoreService.ACTION_ALARM)).setComponent(componentName); - Intent intent = (new Intent(Constants.ACTION_LOCATION_ALARM)).setComponent(componentName); - (runtime.getContextProxy()).context.startService(intent); - - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("isNeedWakeUpAlarm currentTimeMillis="); - stringBuilder.append(l); - stringBuilder.append("---lastAlarmTime="); - stringBuilder.append(lastAlarmTime); - ICLogger.i("AlarmWakeUp "+ stringBuilder.toString()); - if (Config.LOG_TOFILE) ICLogger.logToFile( "alarmCycle", stringBuilder.toString()); - } - } - - public static void setAlarmWakeUpTime() { lastAlarmTime = SystemClock.elapsedRealtime(); } + private static long lastAlarmTime; + + public static void isNeedWakeUpAlarm(Runtime runtime) { + long l = SystemClock.elapsedRealtime(); + int i = Config.getLocationCycle(runtime.getContextProxy().context); + if (l - lastAlarmTime > ((i + 1) * 60 * 1000)) { //达到cycle时间则唤醒CoreService并发送定位消息 + ComponentName componentName = new ComponentName(SERVICE_PKG_NAME, SERVICE_CLS_NAME); + Intent intent = (new Intent(Constants.ACTION_LOCATION_ALARM)).setComponent(componentName); + (runtime.getContextProxy()).context.startService(intent); + + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("isNeedWakeUpAlarm currentTimeMillis="); + stringBuilder.append(l); + stringBuilder.append("---lastAlarmTime="); + stringBuilder.append(lastAlarmTime); + ICLogger.i("AlarmWakeUp " + stringBuilder.toString()); + if (Config.LOG_TOFILE) { + ICLogger.logToFile("alarmCycle", stringBuilder.toString()); + } + } + } + + public static void setAlarmWakeUpTime() { + lastAlarmTime = SystemClock.elapsedRealtime(); + } } diff --git a/app/src/main/java/com/ic/protocols/protocol_anan.java b/app/src/main/java/com/ic/protocols/protocol_anan.java index bcb02ce9..f591006f 100644 --- a/app/src/main/java/com/ic/protocols/protocol_anan.java +++ b/app/src/main/java/com/ic/protocols/protocol_anan.java @@ -1478,7 +1478,12 @@ public class protocol_anan { ICLogger.i("BP15 , 定位周期=" + time + "秒"); try { Config.setLocationMode(runtime.getContextProxy().context, ICLocation.CUSTOM_MOD8_GPS); - Config.setLocationCycle(runtime.getContextProxy().context, Integer.parseInt(time)); + int timeInt = Integer.parseInt(time); + //add k.liang 不知道为啥,不设置定位周期的时候返回的是5,设置之后为300,坑 + if(timeInt < 15){ + timeInt = timeInt * 60; + } + Config.setLocationCycle(runtime.getContextProxy().context, timeInt); runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(runtime.getContextProxy().context)); runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(runtime.getContextProxy().context)); //set AlarmCycle and trigger Location diff --git a/app/version_code.properties b/app/version_code.properties index 3c47b877..f294bbef 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Fri Oct 22 10:46:09 CST 2021 -VERSION_CODE=984 +#Fri Oct 22 20:05:07 CST 2021 +VERSION_CODE=988 diff --git a/local.properties b/local.properties index a5707c55..c15156fc 100644 --- a/local.properties +++ b/local.properties @@ -5,4 +5,4 @@ # For customization when using a Version Control System, please read the # header note. #Fri Oct 15 10:40:33 CST 2021 -sdk.dir=E\:\\Android\\Sdk +sdk.dir=D\:\\android\\Android\\sdk