fixed wetalk dialog tips logical.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 22 Jun 2021 14:48:05 +0000 (22:48 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 22 Jun 2021 14:48:05 +0000 (22:48 +0800)
app/src/main/java/com/enqualcomm/support/LocationClient.java
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/src/main/java/com/enqualcomm/support/utils/DeviceInfoUtil.java
app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java
app/src/main/java/com/enqualcomm/support/utils/SimSignalUtil.java
app/src/main/java/com/enqualcomm/support/utils/Util.java
app/src/main/java/com/ic/protocols/protocol_fzd.java
app/version_code.properties

index 46d14ce..6d9333b 100644 (file)
@@ -1182,7 +1182,7 @@ public class LocationClient {
     // 飞行模式 1 开启 0 关闭
     public void setAirMode(int paramInt) {
         boolean isAirModeOn = this.mSignalUtil.IsAirModeOn();
-        boolean isScreenOn = this.mSignalUtil.isScreenON(runtime.getContextProxy().context);
+        boolean isScreenOn = Util.isScreenON(runtime.getContextProxy().context);
         switch (paramInt) {
 
             case 1:
index 3f09269..0b17eff 100644 (file)
@@ -410,7 +410,8 @@ public class Deliver extends AbstractConnectionService {
     public void onDetach(Connection paramConnection, Runtime paramRuntime) {
     }
 
-    public boolean onReceive(StringMessage paramStringMessage, Connection paramConnection, final Runtime paramRuntime) {
+    public boolean onReceive(StringMessage paramStringMessage,
+                             Connection paramConnection, final Runtime paramRuntime) {
         this.mConnection = paramConnection;
         this.mRuntime = paramRuntime;
         String cmd = paramStringMessage.cmd();
@@ -573,14 +574,12 @@ public class Deliver extends AbstractConnectionService {
                 @Override
                 public void run() {
                     final Context context = (Deliver.this.mRuntime.getContextProxy()).context;
-
                     Contact param2Contact = new Contact(CATEGORY_GROUP,
                             (mRuntime.getContextProxy()).context.getResources().getString(R.string.all_group),
                             Contact.GROUP_ALL);
                     int i = mRuntime.getContextProxy().getTelephonyManager().getCallState();
                     if (!mRuntime.getBatteryLow() && 1 != i && 2 != i) {
                         if (Config.do_broadCast_message) {
-
                             ICLogger.d(Constants.ACTION_MESSAGE_RECEIVED + " " + paramStringMessage.isFromCache());
                             //广播 voice消息
                             Intent intent = new Intent();
@@ -588,14 +587,10 @@ public class Deliver extends AbstractConnectionService {
                             intent.putExtra(Constants.KEY_MESSAGE_TYPE, "voice");
                             intent.putExtra(Constants.KEY_MESSAGE_FROM, "广播消息");
                             intent.putExtra(Constants.KEY_MESSAGE_URL, paramStringMessage.isFromCache());
-
-                            //   playVoice(context,paramStringMessage.isFromCache());
+                            //playVoice(context,paramStringMessage.isFromCache());
                             context.sendBroadcast(intent);
                         }
-                        String isWeTalkActive = Util.getSystemProperties("persist.sys.ic.talk.active", "false");
-                        //如果现在,已经在应用里了,那么就不弹窗了
-                        ICLogger.d("isWeTalkActive == > " + isWeTalkActive);
-                        if (!Config.noVoiceNotifyDialog && "false".equals(isWeTalkActive)) {
+                        if (!Config.noVoiceNotifyDialog) {
                             Intent intent = new Intent();
                             //显示提示窗口
                             intent.setAction(DIALOG_ACTION);
@@ -607,6 +602,19 @@ public class Deliver extends AbstractConnectionService {
                 }
             }, 500);
             return true;
+        } else if ("NewTalkMsg".equals(paramStringMessage.cmd())) {
+            final Context context = (Deliver.this.mRuntime.getContextProxy()).context;
+            String textData = paramStringMessage.isFromCache();
+            Contact param2Contact = new Contact(CATEGORY_GROUP,
+                    (mRuntime.getContextProxy()).context.getResources().getString(R.string.all_group),
+                    Contact.GROUP_ALL, textData);
+            if (!Config.noVoiceNotifyDialog) {
+                Intent intent = new Intent();
+                //显示提示窗口
+                intent.setAction(DIALOG_ACTION);
+                intent.putExtra("talkTextMsg", param2Contact);
+                context.sendBroadcast(intent);
+            }
         } else if ("findDev".equals(paramStringMessage.cmd())) {
             mSendMSGHandler.postDelayed(() -> {
                 final Context context = (mRuntime.getContextProxy()).context;
index 4fa8033..18fd99f 100644 (file)
@@ -28,320 +28,332 @@ import java.util.ArrayList;
 import chestnut.utils.PhoneUtils;
 
 public class DeviceInfoUtil {
-  private static final int CID_LENGTH = 16;
-  
-  public static String getCurStatus(Context paramContext) {
-    String str1;
-    try {
-      str1 = Settings.System.getString(paramContext.getContentResolver(), "eqc_position");
-    } catch (Exception e) {
-      e.printStackTrace();
-      str1 = "1";
+    private static final int CID_LENGTH = 16;
+
+    public static String getCurStatus(Context paramContext) {
+        String str1;
+        try {
+            str1 = Settings.System.getString(paramContext.getContentResolver(), "eqc_position");
+        } catch (Exception e) {
+            e.printStackTrace();
+            str1 = "1";
+        }
+        String str2 = str1;
+        if (str1 == null)
+            str2 = "0";
+        return str2;
+    }
+
+    public static String getModule() {
+
+        return Build.MODEL;
+    }
+
+    public static boolean updateImei(Runtime runtime) {
+
+        String imei = Config.getIMEI(runtime.getContextProxy().context);
+        String cellphoneNumb = DeviceInfoUtil.getNumber(runtime.getContextProxy().context);
+        ICLogger.i("get CellPhoneNumber " + cellphoneNumb);
+        String cid = "";
+        if (imei.isEmpty()) {
+            //如果配置里有IMEI,优先选配置里的,没有则选择系统的
+            imei = PhoneUtils.getIMEI(runtime.getContextProxy().context);
+            cid = PhoneUtils.getIMSI(runtime.getContextProxy().context);
+            if (imei == null) {
+                return false;
+            } else {
+                runtime.setImeiAndCid(imei, cid);
+            }
+        } else {
+            runtime.setImeiAndCid(imei, cid);
+        }
+
+        return true;
+    }
+
+    /**
+     * 得到当前应用版本名称的方法
+     *
+     * @param context :上下文
+     * @throws Exception
+     */
+    public static String getVersionName(Context context) {
+        // 获取packagemanager的实例
+        PackageManager packageManager = context.getPackageManager();
+        // getPackageName()是你当前类的包名
+        try {
+            PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
+            String version = packInfo.versionName;
+            return version;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
     }
-    String str2 = str1;
-    if (str1 == null)
-      str2 = "0"; 
-    return str2;
-  }
-
-  public static String getModule(){
-
-    return Build.MODEL;
-  }
-
-  public static boolean updateImei(Runtime runtime){
-
-    String imei= Config.getIMEI(runtime.getContextProxy().context);
-    String cellphoneNumb= DeviceInfoUtil.getNumber(runtime.getContextProxy().context);
-    ICLogger.i("get CellPhoneNumber "+cellphoneNumb);
-    String cid="";
-    if (imei.isEmpty()){
-      //如果配置里有IMEI,优先选配置里的,没有则选择系统的
-      imei= PhoneUtils.getIMEI(runtime.getContextProxy().context);
-      cid=PhoneUtils.getIMSI(runtime.getContextProxy().context);
-      if(imei==null) {
-        return false;
-      }else{
-        runtime.setImeiAndCid(imei, cid);
-      }
-    }  else{
-      runtime.setImeiAndCid(imei,cid);
+
+    public static String getVersionCode(Context context, String pkgName) {
+        // 获取packagemanager的实例
+        PackageManager packageManager = context.getPackageManager();
+        // getPackageName()是你当前类的包名
+        try {
+            PackageInfo packInfo = packageManager.getPackageInfo(pkgName, 0);
+            String version = "V" + packInfo.versionCode;
+            return version;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
     }
 
-    return true;
-  }
-
-  /**
-   * 得到当前应用版本名称的方法
-   *
-   * @param context
-   *            :上下文
-   * @throws Exception
-   */
-  public static String getVersionName(Context context)  {
-    // 获取packagemanager的实例
-    PackageManager packageManager = context.getPackageManager();
-    // getPackageName()是你当前类的包名
-    try {
-      PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
-      String version = packInfo.versionName;
-      return version;
-
-    }catch (Exception e){
-      e.printStackTrace();
+
+    public static String getVersionCode(Context context) {
+        // 获取packagemanager的实例
+        PackageManager packageManager = context.getPackageManager();
+        // getPackageName()是你当前类的包名
+        try {
+            PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
+            String version = "V" + packInfo.versionCode;
+            return version;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
     }
-    return "";
-  }
-  public static String getVersionCode(Context context,String pkgName)  {
-    // 获取packagemanager的实例
-    PackageManager packageManager = context.getPackageManager();
-    // getPackageName()是你当前类的包名
-    try {
-      PackageInfo packInfo = packageManager.getPackageInfo(pkgName, 0);
-      String version = "V"+packInfo.versionCode;
-      return version;
-
-    }catch (Exception e){
-      e.printStackTrace();
+
+    public static int getCustomId() {
+        int i = -1;
+        try {
+            String customid = Util.getSystemProperties("ro.custom.id");
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("ro.custom.id = ");
+            stringBuilder.append(customid);
+            ICLogger.i(stringBuilder.toString());
+            int j = i;
+            if (customid != null) {
+                j = Integer.valueOf(customid).intValue();
+                try {
+                    StringBuilder stringBuilder1 = new StringBuilder();
+                    stringBuilder1.append("---id=");
+                    stringBuilder1.append(j);
+                    ICLogger.i(stringBuilder1.toString());
+                    return j;
+                } catch (Exception e) {
+                    i = j;
+                }
+            } else {
+                return j;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return i;
     }
-    return "";
-  }
 
+    public static boolean getLockSimInfo(Context paramContext) {
+        int i = 0;
+        try {
+            if (Settings.System.getInt(paramContext.getContentResolver(), "com.eqc.watch.launcher.SimIsBlocked") != 0) {
+                i = 1;
+            }
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append("simIsBlocked:");
+            stringBuilder.append(i);
+            ICLogger.i(stringBuilder.toString());
+        } catch (Settings.SettingNotFoundException e) {
+            e.printStackTrace();
+        }
+        return (i == 1);
+    }
 
+    public static String getNumber(Context paramContext) {
+        return ((TelephonyManager) paramContext.getSystemService(Context.TELEPHONY_SERVICE)).getLine1Number();
+    }
 
-  public static String getVersionCode(Context context)  {
-    // 获取packagemanager的实例
-    PackageManager packageManager = context.getPackageManager();
-    // getPackageName()是你当前类的包名
-    try {
-      PackageInfo packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
-      String version = "V"+packInfo.versionCode;
-      return version;
+    public static String getSN() {
+        try {
+            String str = Util.getSystemProperties("ro.product.partitionpath");
+            StringBuilder stringBuilder = new StringBuilder();
+            stringBuilder.append(str);
+            stringBuilder.append("miscdata");
+            FileInputStream fileInputStream = new FileInputStream(stringBuilder.toString());
+            byte[] arrayOfByte = new byte[128];
+            fileInputStream.read(arrayOfByte);
+            fileInputStream.close();
+            return new String(arrayOfByte, 28, 16);
+        } catch (Exception exception) {
+            exception.printStackTrace();
+            return null;
+        }
+    }
 
-    }catch (Exception e){
-      e.printStackTrace();
+    public static int getStepCount(Context paramContext) {
+        Uri uri = Uri.parse("content://com.eqc.db.watchProvider/step/queryLast");
+        ArrayList arrayList = new ArrayList();
+        Cursor cursor = paramContext.getContentResolver().query(uri, new String[]{"number", "date"}, null, null, null);
+        if (cursor != null && cursor.getCount() > 0) {
+            while (cursor.moveToNext())
+                arrayList.add(new StepCount(cursor.getInt(0), cursor.getString(1)));
+            cursor.close();
+        }
+        return (arrayList.size() > 0) ? ((StepCount) arrayList.get(0)).getStepCount() : 0;
     }
-    return "";
-  }
-  public static int getCustomId() {
-    int i = -1;
-    try {
-      String   customid = Util.getSystemProperties("ro.custom.id");
-      StringBuilder stringBuilder = new StringBuilder();
-      stringBuilder.append("ro.custom.id = ");
-      stringBuilder.append(customid);
-      ICLogger.i(stringBuilder.toString());
-      int j = i;
-      if (customid != null) {
-        j = Integer.valueOf(customid).intValue();
+
+    public static int getStepCount_Custom(Context context) {
         try {
-          StringBuilder stringBuilder1 = new StringBuilder();
-          stringBuilder1.append("---id=");
-          stringBuilder1.append(j);
-          ICLogger.i(stringBuilder1.toString());
-          return j;
+            return Settings.Global.getInt(context.getContentResolver(), "Steps", 0);
         } catch (Exception e) {
-          i = j;
+            e.printStackTrace();
         }
-      } else {
-        return j;
-      }
-    } catch (Exception e) {
-       e.printStackTrace();
+        return 0;
+    }
+
+    public static String getSystemVersion() {
+        return Build.VERSION.RELEASE;
+    }
+
+    public static String getSWVersionDisplayName() {
+        return Build.DISPLAY;
     }
-    return i;
-  }
-
-  public static boolean getLockSimInfo(Context paramContext) {
-    int i = 0;
-    try {
-      if (Settings.System.getInt(paramContext.getContentResolver(), "com.eqc.watch.launcher.SimIsBlocked") != 0) {
-        i = 1;
-      }
-      StringBuilder stringBuilder = new StringBuilder();
-      stringBuilder.append("simIsBlocked:");
-      stringBuilder.append(i);
-      ICLogger.i(stringBuilder.toString());
-    } catch (Settings.SettingNotFoundException e) {
-      e.printStackTrace();
+
+    /**
+     * 判断微聊是否在顶部
+     *
+     * @param paramContext
+     * @return
+     */
+    public static boolean isTopActivity(Context paramContext) {
+        ArrayList<String> arrayList = new ArrayList();
+        arrayList.add("com.ic.icwetalk.MainActivity");
+        return arrayList.contains(((ActivityManager.RunningTaskInfo) ((ActivityManager) paramContext.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0)).topActivity.getClassName());
     }
-    return (i==1);
-  }
-  
-  public static String getNumber(Context paramContext) {
-    return ((TelephonyManager)paramContext.getSystemService(Context.TELEPHONY_SERVICE)).getLine1Number();
-  }
-  
-  public static String getSN() {
-    try {
-      String str=Util.getSystemProperties("ro.product.partitionpath");
-      StringBuilder stringBuilder = new StringBuilder();
-      stringBuilder.append(str);
-      stringBuilder.append("miscdata");
-      FileInputStream fileInputStream = new FileInputStream(stringBuilder.toString());
-      byte[] arrayOfByte = new byte[128];
-      fileInputStream.read(arrayOfByte);
-      fileInputStream.close();
-      return new String(arrayOfByte, 28, 16);
-    } catch (Exception exception) {
-      exception.printStackTrace();
-      return null;
-    } 
-  }
-  
-  public static int getStepCount(Context paramContext) {
-    Uri uri = Uri.parse("content://com.eqc.db.watchProvider/step/queryLast");
-    ArrayList arrayList = new ArrayList();
-    Cursor cursor = paramContext.getContentResolver().query(uri, new String[] { "number", "date" }, null, null, null);
-    if (cursor != null && cursor.getCount() > 0) {
-      while (cursor.moveToNext())
-        arrayList.add(new StepCount(cursor.getInt(0), cursor.getString(1)));
-      cursor.close();
-    } 
-    return (arrayList.size() > 0) ? ((StepCount)arrayList.get(0)).getStepCount() : 0;
-  }
-  
-  public static int getStepCount_Custom(Context context) {
-    try {
-        return Settings.Global.getInt(context.getContentResolver(), "Steps", 0);
-    } catch (Exception e) {
-      e.printStackTrace();
+
+    public static boolean isFactoryTestTopActivity(Context paramContext) {
+        ArrayList<String> arrayList = new ArrayList();
+        arrayList.add("mobile.miki");
+        return arrayList.contains(((ActivityManager.RunningTaskInfo) ((ActivityManager) paramContext.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0)).topActivity.getPackageName());
     }
-    return 0;
-  }
-  
-  public static String getSystemVersion() {
-    return Build.VERSION.RELEASE;
-  }
-
-  public static String getSWVersionDisplayName(){ return Build.DISPLAY;}
-
-  public static boolean isTopActivity(Context paramContext) {
-    ArrayList<String> arrayList = new ArrayList();
-    arrayList.add("com.enqualcomm.imessage.ui.chat.ChatActivity_");
-    return arrayList.contains(((ActivityManager.RunningTaskInfo)((ActivityManager)paramContext.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0)).topActivity.getClassName());
-  }
-  public static boolean isFactoryTestTopActivity(Context paramContext) {
-    ArrayList<String> arrayList = new ArrayList();
-    arrayList.add("mobile.miki");
-    return arrayList.contains(((ActivityManager.RunningTaskInfo)((ActivityManager)paramContext.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0)).topActivity.getPackageName());
-  }
-
-  public static String getDeviceInfo(Runtime runtime){
-
-    SimSignalUtil sim=SimSignalUtil.getInstance(runtime.getContextProxy().context);
-    double wrist_temp;
+
+    public static String getDeviceInfo(Runtime runtime) {
+
+        SimSignalUtil sim = SimSignalUtil.getInstance(runtime.getContextProxy().context);
+        double wrist_temp;
 //    wrist_temp=TemperatureUtil.get_temp_value_adjusted();
-    return new StringBuilder()
-            .append(TimeUtil.getLocalTime2()).append(" ").append(DeviceInfoUtil.getSWVersionDisplayName()).append("\n")
-            .append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))
-            .append(SimSignalUtil.hasSimCard(runtime.getContextProxy().context)?" 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.getSignalInfo()).append("] ")
-            .append(runtime.IMEI())
-            .append("\n Srv [P").append(Config.protocol_no).append(" ").append(runtime.getHost()).append(":").append(runtime.getPort()).append("]").append(KeepAlive.isConnected).append(" , HBcycle ").append(runtime.getHeartBeatCycle())
-            .append("\n ServerConnected is ").append(runtime.isServerProtocolConnected())
+        return new StringBuilder()
+                .append(TimeUtil.getLocalTime2()).append(" ").append(DeviceInfoUtil.getSWVersionDisplayName()).append("\n")
+                .append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))
+                .append(SimSignalUtil.hasSimCard(runtime.getContextProxy().context) ? " 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.getSignalInfo()).append("] ")
+                .append(runtime.IMEI())
+                .append("\n Srv [P").append(Config.protocol_no).append(" ").append(runtime.getHost()).append(":").append(runtime.getPort()).append("]").append(KeepAlive.isConnected).append(" , HBcycle ").append(runtime.getHeartBeatCycle())
+                .append("\n ServerConnected is ").append(runtime.isServerProtocolConnected())
 //            .append(",Temp ").append(String.format("%1$.2f",wrist_temp)).append(",Body ").append(String.format("%1$.2f",TemperatureUtil.getBodyTemp(wrist_temp,26.0f)))
-            .append(",BTIn ").append(runtime.bleInfo.is_in_area)
-            .append(" \n Bat ").append(runtime.getBattery()).append(",").append(runtime.getBatteryVotage())
-            .append(" charged ").append(runtime.isPowerConnected())
-            .append(" StepCount ").append(runtime.getTotalStepCount())
-            .append( "\n Working Mode ").append(runtime.getLocationInstance().getWorkingMod())
-            .append(" \n Location Cycle ").append(runtime.getLocationInstance().getLocation_cycle()).append("s")
-            .append(" \n LocationType ").append(runtime.getLocationInstance().getLocationType())
-            .append(" at ").append(runtime.getLocationInstance().getLocationTime())
-            .append(" \n PPGTestCycle ").append(runtime.getPpgTestCycle()).append("m")
-            .append("\n LastPPG ").append(runtime.getHRS().getPPG())
-            .append(",bph ").append(runtime.getHRS().getBPH())
-            .append(",bpl ").append(runtime.getHRS().getBPL())
-            .append(" at ").append(runtime.getHRS().getTestTime())
-            .append(" \n TempTestCycle ").append(runtime.temp_test_Cycle_Seconds).append("s")
-            .append("\nrealimei:").append(PhoneUtils.getIMEI(runtime.getContextProxy().context))
-            .append("\n").append(runtime.getLBSMultiStationData())
-            .append("\nWiFi Status ").append(Util.isWifiIsOpen(runtime.getContextProxy().context,runtime))
-            .toString();
-  }
-  public static String getShortDeviceInfo(Runtime runtime){
-
-    SimSignalUtil sim=SimSignalUtil.getInstance(runtime.getContextProxy().context);
+                .append(",BTIn ").append(runtime.bleInfo.is_in_area)
+                .append(" \n Bat ").append(runtime.getBattery()).append(",").append(runtime.getBatteryVotage())
+                .append(" charged ").append(runtime.isPowerConnected())
+                .append(" StepCount ").append(runtime.getTotalStepCount())
+                .append("\n Working Mode ").append(runtime.getLocationInstance().getWorkingMod())
+                .append(" \n Location Cycle ").append(runtime.getLocationInstance().getLocation_cycle()).append("s")
+                .append(" \n LocationType ").append(runtime.getLocationInstance().getLocationType())
+                .append(" at ").append(runtime.getLocationInstance().getLocationTime())
+                .append(" \n PPGTestCycle ").append(runtime.getPpgTestCycle()).append("m")
+                .append("\n LastPPG ").append(runtime.getHRS().getPPG())
+                .append(",bph ").append(runtime.getHRS().getBPH())
+                .append(",bpl ").append(runtime.getHRS().getBPL())
+                .append(" at ").append(runtime.getHRS().getTestTime())
+                .append(" \n TempTestCycle ").append(runtime.temp_test_Cycle_Seconds).append("s")
+                .append("\nrealimei:").append(PhoneUtils.getIMEI(runtime.getContextProxy().context))
+                .append("\n").append(runtime.getLBSMultiStationData())
+                .append("\nWiFi Status ").append(Util.isWifiIsOpen(runtime.getContextProxy().context, runtime))
+                .toString();
+    }
+
+    public static String getShortDeviceInfo(Runtime runtime) {
+
+        SimSignalUtil sim = SimSignalUtil.getInstance(runtime.getContextProxy().context);
 //    double wrist_temp=TemperatureUtil.get_temp_value_adjusted();
-    return new StringBuilder("Firmware ")
-            .append(DeviceInfoUtil.getSWVersionDisplayName()).append("\nProtocol ")
-            .append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))
-            .append("\nIMEI ").append(runtime.IMEI())
-            .append("\n"+TimeUtil.getLocalTime()).append("\nNetwork ")
-            .append(SimSignalUtil.hasSimCard(runtime.getContextProxy().context)?" ":" NoSIM ")
-            .append(sim.getNetworkType()==SimSignalUtil.IS_2G?"2G":(sim.getNetworkType()==SimSignalUtil.IS_3G)?"3G":(sim.getNetworkType()==SimSignalUtil.IS_4G?"4G":"unknown"))
-            .append("[").append(runtime.getSignalInfo()).append("]")
-            .append("\nHeartbeat[P").append(Config.protocol_no).append(" ").append(runtime.getSrvIP()).append(":").append(runtime.getPort()).append(",").append(runtime.isServerProtocolConnected()).append(",").append(runtime.getHeartBeatCycle())
-            .append("]\nBat").append(runtime.getBattery()).append(",").append(runtime.getBatteryVotage())
-            .append(" charged ").append(runtime.isPowerConnected())
-            .append(",Step").append(runtime.getTotalStepCount())
-            .append( "\nLocation[M").append(runtime.getLocationInstance().getWorkingMod())
-            .append(",C").append(runtime.getLocationInstance().getLocation_cycle())
-            .append("s,T").append(runtime.getLocationInstance().getLocationType())
-            .append(",").append(runtime.getLocationInstance().getLocationTime())
-            .append(",BTIn").append(runtime.bleInfo.is_in_area)
-            .append("]\nPPG[C").append(runtime.getPpgTestCycle())
+        return new StringBuilder("Firmware ")
+                .append(DeviceInfoUtil.getSWVersionDisplayName()).append("\nProtocol ")
+                .append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))
+                .append("\nIMEI ").append(runtime.IMEI())
+                .append("\n" + TimeUtil.getLocalTime()).append("\nNetwork ")
+                .append(SimSignalUtil.hasSimCard(runtime.getContextProxy().context) ? " " : " NoSIM ")
+                .append(sim.getNetworkType() == SimSignalUtil.IS_2G ? "2G" : (sim.getNetworkType() == SimSignalUtil.IS_3G) ? "3G" : (sim.getNetworkType() == SimSignalUtil.IS_4G ? "4G" : "unknown"))
+                .append("[").append(runtime.getSignalInfo()).append("]")
+                .append("\nHeartbeat[P").append(Config.protocol_no).append(" ").append(runtime.getSrvIP()).append(":").append(runtime.getPort()).append(",").append(runtime.isServerProtocolConnected()).append(",").append(runtime.getHeartBeatCycle())
+                .append("]\nBat").append(runtime.getBattery()).append(",").append(runtime.getBatteryVotage())
+                .append(" charged ").append(runtime.isPowerConnected())
+                .append(",Step").append(runtime.getTotalStepCount())
+                .append("\nLocation[M").append(runtime.getLocationInstance().getWorkingMod())
+                .append(",C").append(runtime.getLocationInstance().getLocation_cycle())
+                .append("s,T").append(runtime.getLocationInstance().getLocationType())
+                .append(",").append(runtime.getLocationInstance().getLocationTime())
+                .append(",BTIn").append(runtime.bleInfo.is_in_area)
+                .append("]\nPPG[C").append(runtime.getPpgTestCycle())
 //            .append(",P").append(runtime.getHRS().getPPG())
 //            .append(",H").append(runtime.getHRS().getBPH())
 //            .append(",L").append(runtime.getHRS().getBPL())
 //            .append(",T").append(String.format("%1$.2f",wrist_temp))
 //            .append(",TA").append(String.format("%1$.2f",TemperatureUtil.getBodyTemp(wrist_temp,26.0f)))
 //            .append(",").append(runtime.getHRS().getTestTime())
-            .append("m]\nTemp[C")
-            .append(runtime.temp_test_Cycle_Seconds).append("s]")
-            .toString();
-  }
-
-  public static String getDeviceVersion(Runtime runtime){
-    return new StringBuilder("Firmware ")
-            .append(DeviceInfoUtil.getSWVersionDisplayName()).append("\nProtocol ")
-            .append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))
-            .append("\nIMEI ").append(runtime.IMEI())
-            .append("\n"+TimeUtil.getLocalTime())
-            .toString();
-  }
-  public static void setLockSimInfo(Context paramContext) {
-    Settings.System.putInt(paramContext.getContentResolver(), "com.eqc.watch.launcher.SimIsBlocked", 1); }
-
-  private static String[][] packagelist={
-          {"com.enqualcomm.support","Protocol"},
-          {"com.ic.blood","BLood"},
-          {"com.ic.launcher","Launcher"},
-          {"com.ic.com.ic.work","Work"},
-          {"com.ic.weather","Weather"},
-          {"com.ic.hardware","Hardware"},
-          {"mobile.miki","FactoryMode"},
-          {"com.ic.dial","Dialer"},
-          {"android.rockchip.update.service","Fota"}
-  };
-
-  public static String getPackageVersionName(Context context , String packagename) {
-    String versionName = "";
-    try {
-      PackageManager pm = context.getPackageManager();
-      PackageInfo pi = pm.getPackageInfo(packagename, 0);
-      versionName = "V"+pi.versionCode;
-      if (versionName == null || versionName.length() <= 0) {
-        return "";
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
+                .append("m]\nTemp[C")
+                .append(runtime.temp_test_Cycle_Seconds).append("s]")
+                .toString();
+    }
+
+    public static String getDeviceVersion(Runtime runtime) {
+        return new StringBuilder("Firmware ")
+                .append(DeviceInfoUtil.getSWVersionDisplayName()).append("\nProtocol ")
+                .append(DeviceInfoUtil.getVersionCode(runtime.getContextProxy().context))
+                .append("\nIMEI ").append(runtime.IMEI())
+                .append("\n" + TimeUtil.getLocalTime())
+                .toString();
+    }
+
+    public static void setLockSimInfo(Context paramContext) {
+        Settings.System.putInt(paramContext.getContentResolver(), "com.eqc.watch.launcher.SimIsBlocked", 1);
     }
-    return versionName;
-  }
-
-  public static String getPackageVersions(Context context){
-      StringBuilder versions=new StringBuilder();
-      versions.append(getSWVersionDisplayName()).append(",");
-      for (String[] packagename: packagelist){
-        versions.append(packagename[1]);
-        versions.append("-");
-        versions.append( getPackageVersionName(context,packagename[0]));
-        versions.append(",");
-      }
-      return versions.toString();
+
+    private static String[][] packagelist = {
+            {"com.enqualcomm.support", "Protocol"},
+            {"com.ic.blood", "BLood"},
+            {"com.ic.launcher", "Launcher"},
+            {"com.ic.com.ic.work", "Work"},
+            {"com.ic.weather", "Weather"},
+            {"com.ic.hardware", "Hardware"},
+            {"mobile.miki", "FactoryMode"},
+            {"com.ic.dial", "Dialer"},
+            {"android.rockchip.update.service", "Fota"}
+    };
+
+    public static String getPackageVersionName(Context context, String packagename) {
+        String versionName = "";
+        try {
+            PackageManager pm = context.getPackageManager();
+            PackageInfo pi = pm.getPackageInfo(packagename, 0);
+            versionName = "V" + pi.versionCode;
+            if (versionName == null || versionName.length() <= 0) {
+                return "";
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return versionName;
+    }
+
+    public static String getPackageVersions(Context context) {
+        StringBuilder versions = new StringBuilder();
+        versions.append(getSWVersionDisplayName()).append(",");
+        for (String[] packagename : packagelist) {
+            versions.append(packagename[1]);
+            versions.append("-");
+            versions.append(getPackageVersionName(context, packagename[0]));
+            versions.append(",");
+        }
+        return versions.toString();
     }
 
 
index cc9e04f..d85866f 100644 (file)
@@ -78,8 +78,10 @@ public class ProcessReceiver extends BroadcastReceiver {
 
     private static Handler mHandler = null;
 
-    private void initMyDialog(final Context context, final Contact contact, int app_id, String msg, boolean needreply) {
-        String var4 = contact == null ? "SMS" : contact.name;
+
+    private void initMyDialog(final Context context, final Contact contact, int app_id, String msg,
+                              boolean needreply) {
+        String fromWhere = contact == null ? "SMS" : contact.name;
 
         if (this.mDialog == null) {
             this.mDialog = new CustomDialog.Builder(context);
@@ -91,34 +93,34 @@ public class ProcessReceiver extends BroadcastReceiver {
                 .append(" , appid ").append(app_id);
 
         ICLogger.i(var5.toString());
-        if (mCustomDialog != null && mCustomDialog.isShowing() && last_message_name != null && var4 != null && last_message_name.equals(var4) && last_app_id == app_id) {
+        if (mCustomDialog != null && mCustomDialog.isShowing() && last_message_name != null && fromWhere != null && last_message_name.equals(fromWhere) && last_app_id == app_id) {
             mCustomDialog.dismiss();
         }
 
-        last_message_name = var4;
+        last_message_name = fromWhere;
         last_app_id = app_id;
         CustomDialog.Builder tmpDialog;
         if (app_id == 1) {
             tmpDialog = this.mDialog.setTitle(context.getString(R.string.setting_title)).setApp(1);
-            StringBuilder var6 = new StringBuilder();
-            var6.append(context.getString(R.string.voiceMessage));
-            var6.append("  ");
-            var6.append(var4);
-            var6.append(context.getString(R.string.voiceMessageEnd));
-            mCustomDialog = tmpDialog.setMessage(var6.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() {
+            StringBuilder contentBuilder = new StringBuilder();
+            contentBuilder.append(context.getString(R.string.voiceMessage));
+            contentBuilder.append("  ");
+            contentBuilder.append(fromWhere);
+            contentBuilder.append(context.getString(R.string.voiceMessageEnd));
+            mCustomDialog = tmpDialog.setMessage(contentBuilder.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface var1x, int var2x) {
                     var1x.dismiss();
                     ComponentName var3 = new ComponentName("com.ic.icwetalk",
                             "com.ic.icwetalk.MainActivity");
-                    Intent var5 = new Intent("android.intent.action.MAIN");
-                    var5.putExtra("ACTIVITY_TYPE", 2);
-                    var5.putExtra("contact", contact);
-                    var5.addCategory("android.intent.category.DEFAULT");
-                    var5.addFlags(FLAG_ACTIVITY_NEW_TASK);
-                    var5.setComponent(var3);
+                    Intent intent = new Intent("android.intent.action.MAIN");
+                    intent.putExtra("ACTIVITY_TYPE", 2);
+                    intent.putExtra("contact", contact);
+                    intent.addCategory("android.intent.category.DEFAULT");
+                    intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
+                    intent.setComponent(var3);
                     VibrateUtil.getInstance(context).vibrateOn(false);
                     try {
-                        context.startActivity(var5);
+                        context.startActivity(intent);
                     } catch (Exception e) {
                         e.printStackTrace();
                         ICLogger.e(e.getMessage(), e);
@@ -137,7 +139,7 @@ public class ProcessReceiver extends BroadcastReceiver {
             tmpDialog = this.mDialog.setTitle(context.getString(R.string.hht_misscall_call)).setApp(app_id);
             StringBuilder var7 = new StringBuilder();
             var7.append(context.getString(R.string.hht_call_start));
-            var7.append(var4);
+            var7.append(fromWhere);
             var7.append(context.getString(R.string.hht_call_end));
             mCustomDialog = tmpDialog.setMessage(var7.toString()).setPositiveButton(context.getString(R.string.ok), new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface var1, int var2) {
@@ -415,11 +417,28 @@ public class ProcessReceiver extends BroadcastReceiver {
                 if (contact != null && !isSilence) {
                     if (!DeviceInfoUtil.isTopActivity(paramContext)) {
                         this.initMyDialog(paramContext, contact, 1, "", false);
+                    }
+                    //屏幕量了
+                    if (!Util.isScreenON(paramContext)) {
+                        this.screenOn(paramContext);
+                        VibrateUtil.getInstance(paramContext).vibrateOn(true);
                         this.playNotificationVoice(paramContext);
+                    }
+                }
+            } else if (paramIntent.hasExtra("talkTextMsg")) {
+                contact = (Contact) paramIntent.getParcelableExtra("talkTextMsg");
+                SharePreferenceUtil.getPrefBoolean(paramContext, "key_is_resume", false);
+                isSilence = SharePreferenceUtil.getPrefBoolean(paramContext, "KEY_ISSILENCE", false);
+                if (contact != null && !isSilence) {
+                    if (!DeviceInfoUtil.isTopActivity(paramContext)) {
+                        this.initMyDialog(paramContext, contact, 1, "", false);
+                    }
+                    //屏幕量了
+                    if (!Util.isScreenON(paramContext)) {
+                        this.screenOn(paramContext);
                         VibrateUtil.getInstance(paramContext).vibrateOn(true);
+                        this.playNotificationVoice(paramContext);
                     }
-
-                    this.screenOn(paramContext);
                 }
             } else if (paramIntent.hasExtra("sms")) {
                 String sms = paramIntent.getStringExtra("sms");
index 6cd75e9..ae7d8e0 100644 (file)
@@ -5,13 +5,11 @@ import android.content.Context;
 import android.content.Intent;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
-import android.os.PowerManager;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 
 import com.enqualcomm.support.bean.Runtime;
 
-import static android.content.Context.POWER_SERVICE;
 import static android.telephony.TelephonyManager.NETWORK_TYPE_CDMA;
 import static android.telephony.TelephonyManager.NETWORK_TYPE_EDGE;
 import static android.telephony.TelephonyManager.NETWORK_TYPE_EVDO_0;
@@ -170,27 +168,6 @@ public class SimSignalUtil {
         this.mNetworkType = ((TelephonyManager) this.context.getSystemService(Context.TELEPHONY_SERVICE)).getNetworkType();
     }
 
-
-    public static boolean isScreenON(Context context) {
-        // If you use less than API20:
-        PowerManager powerManager = (PowerManager) context.getSystemService(POWER_SERVICE);
-        // If the screen is off then the device has been locked
-
-        boolean lisScreenOn;
-
-//      if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
-//
-//        lisScreenOn = powerManager.isInteractive();
-//
-//      } else {
-
-        lisScreenOn = powerManager.isScreenOn();
-
-//      }
-
-        return lisScreenOn;
-    }
-
     public static void send_at_to_reset_simcard(Runtime runtime) {
 
         Intent intent = new Intent("com.eqc.intent.action.getTelephony.lbs");
index d949779..d41c5ec 100644 (file)
@@ -55,6 +55,7 @@ import java.util.zip.ZipFile;
 import java.util.zip.ZipOutputStream;
 
 import static android.content.Context.CONNECTIVITY_SERVICE;
+import static android.content.Context.POWER_SERVICE;
 import static android.content.Context.WIFI_SERVICE;
 import static chestnut.utils.FileUtils.closeIO;
 import static chestnut.utils.FileUtils.createOrExistsDir;
@@ -78,6 +79,15 @@ public class Util {
         }
     }
 
+
+    public static boolean isScreenON(Context context) {
+        PowerManager powerManager = (PowerManager) context.getSystemService(POWER_SERVICE);
+        boolean lisScreenOn;
+        lisScreenOn = powerManager.isScreenOn();
+        return lisScreenOn;
+    }
+
+
     public static void SetRingMode(Context context, int mod, boolean vibmod) {
         AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
         int currentRingmod = am.getRingerMode();
index 3e5b3d8..2aed74f 100644 (file)
@@ -2462,6 +2462,8 @@ public class protocol_fzd {
         message2Db("", textData, FZDDatabaseHelper.MessageType.TEXT);
         //入数据库
         mConnection.send(MESSAGE());
+        //弹窗提示//具体看"NewTalkMsg"的处理
+        mConnection.DeliverCMDMessageToSystem("NewTalkMsg", textData);
     }
 
     private StringMessage TKOne(String result) {
index 038399a..8c2adda 100644 (file)
@@ -1,5 +1,5 @@
-#Tue Jun 22 21:45:53 CST 2021
+#Tue Jun 22 22:43:52 CST 2021
 >>>>>>>=b405d1184f3616d4e894d199cee0eb91613a68db
-VERSION_CODE=831
-=\=\=\=\=\=\=
+VERSION_CODE=834
 <<<<<<<=HEAD
+=\=\=\=\=\=\=