From 8ff9496ba21767ef7777ec176b1fbbbcb2153032 Mon Sep 17 00:00:00 2001 From: snickersun Date: Mon, 10 Feb 2020 23:14:13 +0800 Subject: [PATCH] =?utf8?q?=E6=B7=BB=E5=8A=A0SOS=20=E6=B6=88=E6=81=AF?= =?utf8?q?=E9=80=BB=E8=BE=91=EF=BC=9A=20=E9=95=BF=E6=8C=895=E7=A7=92?= =?utf8?q?=E5=90=8E=E8=A7=A6=E5=8F=91SOS=EF=BC=8C=E9=A6=96=E5=85=88?= =?utf8?q?=E5=8F=91=E9=80=81AP10=E6=8A=A5=E8=AD=A6=E6=B6=88=E6=81=AF?= =?utf8?q?=EF=BC=88wifi=E5=AE=9A=E4=BD=8D=EF=BC=89=EF=BC=8C=E7=84=B6?= =?utf8?q?=E5=90=8E=E6=AF=8F=E5=88=86=E9=92=9F=E5=AE=9A=E4=BD=8D=E4=B8=80?= =?utf8?q?=E6=AC=A1=EF=BC=88gps=E5=AE=9A=E4=BD=8D=EF=BC=89=E4=B8=8A?= =?utf8?q?=E6=8A=A5=EF=BC=8C=E5=90=8C=E6=97=B6=E6=AF=8F=E5=88=86=E9=92=9F?= =?utf8?q?=E6=B5=8B=E9=87=8F=E4=B8=80=E6=AC=A1=E5=BF=83=E7=8E=87=E4=B8=8A?= =?utf8?q?=E6=8A=A5=EF=BC=8C=E6=8C=81=E7=BB=AD5=E5=88=86=E9=92=9F=E5=90=8E?= =?utf8?q?=E6=81=A2=E5=A4=8D=E9=BB=98=E8=AE=A4=E5=80=BC=E3=80=82=20?= =?utf8?q?=E8=A7=A6=E5=8F=91SOS=E7=9A=84=E5=90=8C=E6=97=B6=E4=BC=9A?= =?utf8?q?=E5=BC=80=E5=A7=8B=E8=BD=AE=E7=95=AA=E6=8B=A8=E6=89=93SOS?= =?utf8?q?=E5=8F=B7=E7=A0=81=EF=BC=8C=E6=8B=A8=E6=89=93=E5=8F=B7=E7=A0=81?= =?utf8?q?=E6=97=B6=E4=B8=8D=E8=83=BD=E4=BC=A0=E8=BE=93=E6=95=B0=E6=8D=AE?= =?utf8?q?=EF=BC=8C=E6=8C=82=E6=96=AD=E5=90=8E=E4=B8=8A=E6=8A=A5AP10?= =?utf8?q?=E6=8A=A5=E8=AD=A6=E5=8F=8AAP01=E5=AE=9A=E4=BD=8D=E6=95=B0?= =?utf8?q?=E6=8D=AE=E3=80=82=20=E6=AD=A4=E5=8A=9F=E8=83=BD=E8=A6=81?= =?utf8?q?=E7=BB=93=E5=90=88=E4=BF=AE=E6=94=B9PhoneWindowManager.java?= =?utf8?q?=E6=9D=A5=E5=AE=9E=E7=8E=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 4 +- .../com/enqualcomm/support/Constants.java | 8 +- .../com/enqualcomm/support/CoreService.java | 86 ++++++++++++++++++- .../enqualcomm/support/LocationClient.java | 56 ++++++++---- .../enqualcomm/support/adapter/LBSHelper.java | 3 + .../support/adapter/protocolAPIHelper.java | 5 +- .../support/service/SilentManager.java | 17 ++-- .../enqualcomm/support/utils/BatteryUtil.java | 6 +- .../support/utils/ProcessReceiver.java | 35 +++----- .../support/utils/SimSignalUtil.java | 17 +++- 10 files changed, 182 insertions(+), 55 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 80fba61b..6d430603 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -112,6 +112,7 @@ + - + + diff --git a/app/src/main/java/com/enqualcomm/support/Constants.java b/app/src/main/java/com/enqualcomm/support/Constants.java index 06bdf74f..f50b5927 100644 --- a/app/src/main/java/com/enqualcomm/support/Constants.java +++ b/app/src/main/java/com/enqualcomm/support/Constants.java @@ -60,7 +60,13 @@ public interface Constants { public static final String ACTION_SCANPAIRMESSAGE = "com.enqualcomm.imessage.scanPairMessage"; public static final String ACTION_SEDN_VIDOE_CALL_REQ = "com.enqualcomm.imessage.sendVideoCall"; - + + public static final String ACTION_SEND_SOS_MSG = "com.enqualcomm.support.action_send_sos"; + + public static final String ACTION_SEND_EMEGENCY_LOCATION_START = "action.emegency.location.start"; + public static final String ACTION_SEND_EMEGENCY_LOCATION_STOP = "action.emegency.location.stop"; + public static final String ACTION_LOCAL_SOS_ACTION = "com.enqualcomm.support.local_sos"; + public static final String ACTION_SEND_SOS_VIDEO_FILE = "com.enqualcomm.support.action_send_sos_video_file"; public static final String ACTION_SEND_VIDEO_FILES = "com.enqualcomm.support.ACTION_SEND_VIDEO_FILES"; diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 1fd094ed..e55b9e12 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -18,6 +18,8 @@ import android.os.SystemClock; import android.util.Log; import android.widget.Toast; +import com.enqualcomm.support.bean.ICLocation; +import com.enqualcomm.support.utils.ServiceUtil; import com.ic.jni.ICJniUtils; import com.enqualcomm.support.Constants; import com.enqualcomm.support.GSensorListener; @@ -68,9 +70,14 @@ import java.util.TimerTask; import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; import static com.enqualcomm.support.Constants.ACTION_ALARM_ADD_DATAPOINTS; +import static com.enqualcomm.support.Constants.ACTION_BATTERY_LOW_MSG; import static com.enqualcomm.support.Constants.ACTION_EQC_ALARM; import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START; +import static com.enqualcomm.support.Constants.ACTION_LOCAL_SOS_ACTION; import static com.enqualcomm.support.Constants.ACTION_LOCATION_ALARM; +import static com.enqualcomm.support.Constants.ACTION_SEND_EMEGENCY_LOCATION_START; +import static com.enqualcomm.support.Constants.ACTION_SEND_EMEGENCY_LOCATION_STOP; +import static com.enqualcomm.support.Constants.ACTION_SEND_SOS_MSG; import static com.enqualcomm.support.Constants.HEART_ALARM; import static com.enqualcomm.support.Constants.KEY_SAVE_STEP_COUNT; import static com.enqualcomm.support.Constants.KEY_STEP_COUNT; @@ -113,7 +120,7 @@ public class CoreService extends Service { .append(TimeUtil.getSystemTime3()) .append(SimSignalUtil.hasSimCard(this)?" SIM ":" NoSIM ") .append(sim.getNetworkType()==SimSignalUtil.IS_2G?"2G":(sim.getNetworkType()==SimSignalUtil.IS_3G)?"3G":(sim.getNetworkType()==SimSignalUtil.IS_4G?"4G":"unknown")) - .append(" ").append(runtime.getSignalStrength()) + .append(" [").append(runtime.getSignalStrength()+100).append(",Mini:").append(SimSignalUtil.getMinSignalStrength(sim.getNetworkType())).append("]") .append("\n Connecttion ").append(this.connection.isServerConnected()) .append(" KeepAlive ").append(KeepAlive.isConnected) .append("\n ServerConnected is ").append(runtime.isServerProtocolConnected()) @@ -178,7 +185,57 @@ public class CoreService extends Service { AlarmWakeUp.isNeedWakeUpAlarm(CoreService.this.runtime); } }; + private BroadcastReceiver broadcastSOSReceiver = new BroadcastReceiver() { + public void onReceive(Context param1Context, Intent param1Intent) { + + StringBuilder stringBuilder2 = new StringBuilder(); + stringBuilder2.append("broadcastReceiver action=="); + stringBuilder2.append(param1Intent.getAction()); + Logger.i(stringBuilder2.toString()); + + if (ACTION_SEND_EMEGENCY_LOCATION_START.equals(param1Intent.getAction())){ + runtime.getLocationInstance().setWorkingMod(CUSTOM_MOD); + runtime.getLocationInstance().setLocation_cycle(1); + runtime.setPpgTestCycle(1); + setLocationAlarm(CUSTOM_MOD); + setHeartRateDetectAlarm(runtime.getPpgTestCycle()); + setEmegencyLocationSTOPAlarm(5); + }else if (ACTION_LOCAL_SOS_ACTION.endsWith(param1Intent.getAction())){ + +// if( param1Intent.getIntExtra("type", 1) == 1) { + setHeartRateDetectAlarm(runtime.getPpgTestCycle()); + HeartRateManager.triggerPPGtest(); + + runtime.setAlarmType(false,runtime.getBatteryLow(),true,false); + //trigger AP10 报警定位 + CoreService.this.locationClient.triggerSOSLocationProcess(); + //开启紧急定位模式,GPS 优先1分钟一次定位,持续5分钟 + runtime.getLocationInstance().setWorkingMod(CUSTOM_MOD); + runtime.getLocationInstance().setLocation_cycle(1); + setLocationAlarm(CUSTOM_MOD); + //SOS模式,心率测试1分钟一次,持续5分钟 + runtime.setPpgTestCycle(1); + setHeartRateDetectAlarm(runtime.getPpgTestCycle()); + + //设置5分钟后结束紧急定位模式 + setEmegencyLocationSTOPAlarm(5); + + trigger_SOS_Call(); + + } + } + }; + private void trigger_SOS_Call(){ + try { + Intent intent = new Intent("com.eqc.shutdown_sos"); + intent.putExtra("type",1); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + this.startActivity(intent); + }catch (Exception e){ + e.printStackTrace(); + } + } private static class ServerHandler implements ConnectionListener { private final WeakReference mReference; @@ -307,7 +364,6 @@ public class CoreService extends Service { return sendChatMessage; } - private void loadSettings(){ this.runtime.setPpgTestCycle(Config.getPPGTestCycle(this)); this.runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(this)); @@ -470,6 +526,13 @@ public class CoreService extends Service { intentFilter.addAction("com.eqc.intent.action.callback.at"); registerReceiver(this.AtCallbackBroadcastReceiver, intentFilter); + //添加SOSMSG 接收 + intentFilter = new IntentFilter(); + intentFilter.addAction(ACTION_SEND_EMEGENCY_LOCATION_START); + intentFilter.addAction(ACTION_LOCAL_SOS_ACTION); + registerReceiver(broadcastSOSReceiver,intentFilter); + + //初始化Sim信号 this.mSignalUtil = SimSignalUtil.getInstance(this); @@ -633,6 +696,16 @@ public class CoreService extends Service { //此处消息从timer来 setHeartRateDetectAlarm(runtime.getPpgTestCycle()); + }else if(ACTION_SEND_EMEGENCY_LOCATION_STOP.equals(paramIntent.getAction())){ + //stop Emegency location Stop + loadSettings(); //回复之前的 工作模式即可 + }else if (ACTION_BATTERY_LOW_MSG.equals(paramIntent.getAction())){ + + runtime.setAlarmType(false,runtime.getBatteryLow(),false,false); + //trigger AP10 报警定位 + CoreService.this.locationClient.triggerSOSLocationProcess(); + + return Service.START_STICKY; } this.invokeHandlerServiceChain.processUserRequest(paramIntent, this.connection, this.runtime); } @@ -673,6 +746,15 @@ public class CoreService extends Service { public void setHeartRateDetectAlarm(int heartRateDetectAlarmCycle){ AlarmHelper.setRealTimeAlarm(runtime.getContextProxy().context,heartRateDetectAlarmCycle,ACTION_HEATR_RATE_START); } + + + public void setEmegencyLocationSTOPAlarm(int delayTimeInMinutes){ + StringBuilder sb=new StringBuilder(); + AlarmHelper.setRealTimeAlarm(runtime.getContextProxy().context,delayTimeInMinutes, ACTION_SEND_EMEGENCY_LOCATION_STOP); + sb.append(" tEmegencyLocationSTOPAlarm "+ACTION_SEND_EMEGENCY_LOCATION_STOP); + Logger.i(sb.toString()); + if (Config.LOG_TOFILE) FileOutputUtil.fileOutput(runtime.getCacheDir(),"LocationAlarm",sb.toString()); + } public void setLocationAlarm(int mod) { // int mod=runtime.getLocationInstance().getWorkingMod(); StringBuilder sb=new StringBuilder(); diff --git a/app/src/main/java/com/enqualcomm/support/LocationClient.java b/app/src/main/java/com/enqualcomm/support/LocationClient.java index 132d86ce..d4294395 100644 --- a/app/src/main/java/com/enqualcomm/support/LocationClient.java +++ b/app/src/main/java/com/enqualcomm/support/LocationClient.java @@ -111,7 +111,8 @@ public class LocationClient { private SimSignalUtil mSignalUtil; private NMEAListener nmeaListener; - + + private boolean startSOSLocation=false; private int preLbsCid; int preNetworkTypeNomber; @@ -190,7 +191,10 @@ public class LocationClient { public void triggerLocationProcess(){ mhandler.sendEmptyMessage(0); } - + + public void triggerSOSLocationProcess(){ + mhandler.sendEmptyMessage(2); + } private static int checktimes=0; private static boolean timeout=false; @@ -243,6 +247,10 @@ public class LocationClient { }); }else if (msg.what == 0){ startLocationProcess(runtime.getLocationInstance().getWorkingMod()); + }else if (msg.what == 2){ + startSOSLocation=true;//启动SOS定位,为了快速响应,只要wifi定位即可。 + forceLocation=1; + startLocationProcess(ICLocation.NORMAL_MOD); } @@ -277,16 +285,24 @@ public class LocationClient { switch(mode){ case ICLocation.EMERGNECY_MOD: case ICLocation.REALTIME_MOD: + case ICLocation.CUSTOM_MOD: - //GPS 优先的话多给些时间(10秒) + //GPS 优先的话多给些时间(10秒) if (checktimes> 50) timeout=true; - if ((lbs_ok && timeout==true) ||(lbs_ok && gps_ok && wifi_ok )||(lbs_ok&&gps_nosignal&&wifi_ok)){ + if ((lbs_ok && timeout==true) ||(lbs_ok && ( gps_ok || startSOSLocation==true ) && wifi_ok )||(lbs_ok&&gps_nosignal&&wifi_ok)){ + - String AP01_CMD=protocolAPIHelper.AP01(runtime); + if (startSOSLocation==true){ - Deliver.sendLocationMSG(AP01_CMD); + String AP10_CMD = protocolAPIHelper.AP10(runtime); + Deliver.sendLocationMSG(AP10_CMD); + startSOSLocation=false; + }else { + String AP01_CMD = protocolAPIHelper.AP01(runtime); + Deliver.sendLocationMSG(AP01_CMD); + } if (mTimer!=null){ @@ -317,8 +333,22 @@ public class LocationClient { if ((lbs_ok && timeout==true) ||(lbs_ok && wifi_ok )){ - String AP01_CMD=protocolAPIHelper.AP01(runtime); - Deliver.sendLocationMSG(AP01_CMD); + String locationtype="LBS"; + if (wifi_ok){ + locationtype="WiFi"; + } + runtime.getLocationInstance().setLocationType(locationtype); + runtime.getLocationInstance().setLocationTime(TimeUtil.getSystemTime3()); + + if (startSOSLocation==true){ + String AP10_CMD = protocolAPIHelper.AP10(runtime); + Deliver.sendLocationMSG(AP10_CMD); + startSOSLocation=false; + + }else { + String AP01_CMD = protocolAPIHelper.AP01(runtime); + Deliver.sendLocationMSG(AP01_CMD); + } if (mTimer!=null){ mTimer.cancel(); @@ -326,12 +356,7 @@ public class LocationClient { } isLocating = false; - String locationtype="LBS"; - if (wifi_ok){ - locationtype="WiFi"; - } - runtime.getLocationInstance().setLocationType(locationtype); - runtime.getLocationInstance().setLocationTime(TimeUtil.getSystemTime3()); + }else if (timeout==true){ Logger.i("timeout no location "); @@ -402,7 +427,7 @@ public void updateCellInfo() { } // 不强制定位 且 WorkingMod 不是紧急模式,且 没有移动过 - if ( !(( forceLocation == 1 ) || ( mod == 4 )) && ( runtime.getLastStepCount() == runtime.getTotalStepCount()) ){ + if ( !(( forceLocation == 1 ) || ( mod == ICLocation.REALTIME_MOD ) || (mod == ICLocation.CUSTOM_MOD)) && ( runtime.getLastStepCount() == runtime.getTotalStepCount()) ){ Logger.i("No Move ,skip location!"); return ; } @@ -418,6 +443,7 @@ public void updateCellInfo() { switch(mod){ case ICLocation.EMERGNECY_MOD: case ICLocation.REALTIME_MOD: + case ICLocation.CUSTOM_MOD: startGpsLocate(); break; } diff --git a/app/src/main/java/com/enqualcomm/support/adapter/LBSHelper.java b/app/src/main/java/com/enqualcomm/support/adapter/LBSHelper.java index a4865ff0..1eb15a96 100644 --- a/app/src/main/java/com/enqualcomm/support/adapter/LBSHelper.java +++ b/app/src/main/java/com/enqualcomm/support/adapter/LBSHelper.java @@ -25,6 +25,7 @@ import com.enqualcomm.support.Config; import com.enqualcomm.support.bean.Runtime; import com.enqualcomm.support.utils.FileOutputUtil; import com.enqualcomm.support.utils.Logger; +import com.enqualcomm.support.utils.SimSignalUtil; import java.util.Collections; import java.util.Comparator; @@ -371,6 +372,8 @@ public class LBSHelper { } } + + public interface OnWiFiInfoListener { void getWifiInfoCallBack(String var1); } diff --git a/app/src/main/java/com/enqualcomm/support/adapter/protocolAPIHelper.java b/app/src/main/java/com/enqualcomm/support/adapter/protocolAPIHelper.java index 98706fea..52498767 100644 --- a/app/src/main/java/com/enqualcomm/support/adapter/protocolAPIHelper.java +++ b/app/src/main/java/com/enqualcomm/support/adapter/protocolAPIHelper.java @@ -352,7 +352,7 @@ public class protocolAPIHelper { .append(ds.getLBSData()).append(CMDSPLIT) .append(ds.getAlarmType()).append(CMDSPLIT) .append(ds.getLanguage()).append(CMDSPLIT) - .append(0).append(CMDSPLIT) //不回复地址 + .append("00").append(CMDSPLIT) //不回复地址 .append(ds.getWifiInfo()).append(CMDEND).toString(); } @@ -1083,9 +1083,8 @@ public static String AP15(String index){ Config.setLocationCycle(runtime.getContextProxy().context,Integer.valueOf(time)); runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(runtime.getContextProxy().context)); runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(runtime.getContextProxy().context)); + //set AlarmCycle and trigger Location CoreService.getInstance().setLocationAlarm(runtime.getLocationInstance().getWorkingMod()); - - }else{ Logger.i("BP15 format error"); } diff --git a/app/src/main/java/com/enqualcomm/support/service/SilentManager.java b/app/src/main/java/com/enqualcomm/support/service/SilentManager.java index 285eb348..bcc296a2 100644 --- a/app/src/main/java/com/enqualcomm/support/service/SilentManager.java +++ b/app/src/main/java/com/enqualcomm/support/service/SilentManager.java @@ -37,6 +37,7 @@ import java.util.Iterator; import static android.telephony.TelephonyManager.CALL_STATE_OFFHOOK; import static android.telephony.TelephonyManager.CALL_STATE_RINGING; +import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START; public class SilentManager extends AbstractInvokeHandlerService { private static final long ONE_WEEK = 604800000L; @@ -71,15 +72,15 @@ public class SilentManager extends AbstractInvokeHandlerService { switch(var1) { case 0: SilentManager.this.isCalling = false; - if (SilentManager.this.haveHandSilence) { - SilentManager.this.handSilence(SilentManager.this.mContext, SilentManager.this.mValue_isSilence); - } +// if (SilentManager.this.haveHandSilence) { +// SilentManager.this.handSilence(SilentManager.this.mContext, SilentManager.this.mValue_isSilence); +// } break; case 1: SilentManager.this.isCalling = true; - Intent var3 = new Intent(); - var3.setAction("com.enqualcomm.support.CloseUnreadMsg"); - SilentManager.this.mContext.sendBroadcast(var3); +// Intent var3 = new Intent(); +// var3.setAction("com.enqualcomm.support.CloseUnreadMsg"); +// SilentManager.this.mContext.sendBroadcast(var3); break; case 2: SilentManager.this.isCalling = true; @@ -471,8 +472,8 @@ public class SilentManager extends AbstractInvokeHandlerService { this.mInterval = var5.interval; if (!var1) { - AlarmHelper.setRealTimeAlarm(this.mContext, Integer.parseInt(this.mInterval), "com.eqc.heartrate.action.SILENT_START"); - this.mRuntime.getContextProxy().sendStheartRateBroadcast("com.eqc.heartrate.action.SILENT_START", 0); +// AlarmHelper.setRealTimeAlarm(this.mContext, Integer.parseInt(this.mInterval), ACTION_HEATR_RATE_START); +// this.mRuntime.getContextProxy().sendStheartRateBroadcast(ACTION_HEATR_RATE_START, 0); } var1 = true; diff --git a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java index c4959490..4704db9e 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java @@ -10,9 +10,11 @@ import android.os.BatteryManager; import android.os.Build; import com.enqualcomm.support.Config; +import com.enqualcomm.support.CoreService; import com.enqualcomm.support.bean.Runtime; import static android.content.Context.BATTERY_SERVICE; +import static com.enqualcomm.support.Constants.ACTION_BATTERY_LOW_MSG; public class BatteryUtil { private BroadcastReceiver batteryChangedReceiver = new BroadcastReceiver() { @@ -84,8 +86,10 @@ public class BatteryUtil { if ("android.intent.action.BATTERY_LOW".equals(param1Intent.getAction())) { BatteryUtil.this.mRuntime.setBatteryLow(true); Logger.i("lowbattery finish video_end_call"); + + ComponentName componentName = new ComponentName("com.enqualcomm.support", "com.enqualcomm.support.CoreService"); - Intent intent = (new Intent("com.enqualcomm.support.lowbatteryMsg")).setComponent(componentName); + Intent intent = (new Intent(ACTION_BATTERY_LOW_MSG)).setComponent(componentName); (mRuntime.getContextProxy()).context.startService(intent); } } diff --git a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java index 6acc8891..ac6004b8 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java @@ -19,6 +19,8 @@ import android.view.View; import android.view.WindowManager; +import com.enqualcomm.support.CoreService; +import com.enqualcomm.support.LocationClient; import com.enqualcomm.support.R; import com.enqualcomm.support.bean.NotificationParam; import com.ic.jni.ICJniUtils; @@ -39,6 +41,8 @@ import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP; import static android.os.PowerManager.SCREEN_DIM_WAKE_LOCK; import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START; import static com.enqualcomm.support.Constants.ACTION_REMOTE_CAMERA; +import static com.enqualcomm.support.Constants.ACTION_SEND_EMEGENCY_LOCATION_START; +import static com.enqualcomm.support.Constants.ACTION_SEND_SOS_MSG; import static com.enqualcomm.support.Constants.RESUME_ACTION; import static com.enqualcomm.support.Constants.SOS_ACTION; import static com.enqualcomm.support.Constants.STEP_COUNT_ALARM_ACTION; @@ -423,23 +427,15 @@ public class ProcessReceiver extends BroadcastReceiver { ICJniUtils.resetStepCount(); AlarmHelper.setCleanStepCountAlarm(paramContext, 23, 59, STEP_COUNT_ALARM_ACTION); return; - } - if (RESUME_ACTION.equals(str)) { + }else if (RESUME_ACTION.equals(str)) { SharPreferenceUtil.setPrefBoolean(paramContext, "key_is_resume", paramIntent.getBooleanExtra("is_resume", false)); return; - } - if (SOS_ACTION.equals(str)) { - if (paramIntent.getIntExtra("sos_end", 0) == 0) { - sendStheartRateBroadcast(paramContext, ACTION_HEATR_RATE_START, 3); - return; - } - } else { - String str1; - if (ACTION_REMOTE_CAMERA.equals(str)) { + }else if (ACTION_REMOTE_CAMERA.equals(str)) { + String str1; str1 = paramIntent.getStringExtra("key_remote_number"); (new CameraUtil(paramContext)).getPictur(str1); return; - } + } @@ -457,15 +453,6 @@ public class ProcessReceiver extends BroadcastReceiver { this.screenOn(paramContext); } - } else if ("com.enqualcomm.imessage.SOS_ACTION".equals(str)) { - if (paramIntent.getIntExtra("sos_end", 0) == 0) { -// EqcAlgorithmNative.native_EqcAlgorithmMethod3(8); - this.sendStheartRateBroadcast(paramContext, "com.eqc.heartrate.action.SILENT_START", 3); - //trigger AP10 报警定位 - } - } else if ("com.enqualcomm.support.ACTION_REMOTE_CAMERA".equals(paramIntent.getAction())) { - String var7 = paramIntent.getStringExtra("key_remote_number"); - (new CameraUtil(paramContext)).getPictur(var7); } else if (!"com.enqualcomm.support.CloseUnreadMsg".equals(paramIntent.getAction()) && !"android.intent.action.BATTERY_LOW".equals(paramIntent.getAction())) { if ("com.enqualcomm.support.ACTION_MISSED_CALL_GET".equals(str)) { Contact var8 = (Contact)paramIntent.getParcelableExtra("contact"); @@ -496,7 +483,11 @@ public class ProcessReceiver extends BroadcastReceiver { intent.putExtra("stheartRateType", paramInt); paramContext.sendBroadcast(intent); } - + public void sendSOSBroadcast(Context paramContext, String actionStr) { + Intent intent = new Intent(); + intent.setAction(actionStr); + paramContext.sendBroadcast(intent); + } } diff --git a/app/src/main/java/com/enqualcomm/support/utils/SimSignalUtil.java b/app/src/main/java/com/enqualcomm/support/utils/SimSignalUtil.java index 14d95f17..888c3598 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/SimSignalUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/SimSignalUtil.java @@ -60,7 +60,20 @@ public class SimSignalUtil { stringBuilder.append(paramInt2); Logger.i(stringBuilder.toString()); } - + public static int getMinSignalStrength(int NetworkType) { + byte b2 = -105; + switch (NetworkType) { + case SimSignalUtil.IS_2G: + case SimSignalUtil.IS_3G: + break; + case SimSignalUtil.IS_4G: + b2 = -100; + break; + default: + break; + } + return b2; + } public static boolean hasSimCard(Context context) { TelephonyManager telMgr = (TelephonyManager) @@ -75,7 +88,7 @@ public class SimSignalUtil { result = false; break; } - Logger.i( result ? "有SIM卡" : "无SIM卡"); +// Logger.i( result ? "有SIM卡" : "无SIM卡"); return result; } -- 2.17.1