From 6ada28d16543b6e36828e4a45235efcaa6bb3e04 Mon Sep 17 00:00:00 2001 From: snickersun Date: Fri, 4 Dec 2020 03:19:15 +0800 Subject: [PATCH] =?utf8?q?1=E3=80=81protocol=5Fic=20=E4=BF=AE=E5=A4=8DBPWL?= =?utf8?q?=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF=202=E3=80=81protocol=5Ffzd?= =?utf8?q?=20=E4=BF=AE=E5=A4=8DSILENCE2=20=E6=A0=BC=E5=BC=8F=E8=AE=BE?= =?utf8?q?=E7=BD=AE=E9=94=99=E8=AF=AF=EF=BC=8C=203=E3=80=81=E5=AE=8C?= =?utf8?q?=E5=96=84silence=E9=85=8D=E7=BD=AE=E9=80=BB=E8=BE=91=EF=BC=8C?= =?utf8?q?=E5=AF=B9=E9=9F=B3=E9=87=8F=EF=BC=8C=E9=9C=87=E5=8A=A8=EF=BC=8C?= =?utf8?q?=E6=9D=A5=E7=94=B5=E6=B6=88=E6=81=AF=E7=AD=89=E9=83=BD=E8=BF=9B?= =?utf8?q?=E8=A1=8C=E7=A6=81=E7=94=A8=E5=92=8C=E6=81=A2=E5=A4=8D=204?= =?utf8?q?=E3=80=81=E4=BF=AE=E5=A4=8D=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA?= =?utf8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E9=80=82=E9=85=8D=E9=98=B2=E8=B5=B0?= =?utf8?q?=E4=B8=A2=E6=97=B6=E9=97=B4=E8=AE=BE=E7=BD=AE=E6=A0=BC=E5=BC=8F?= =?utf8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/com/enqualcomm/support/Config.java | 2 ++ .../com/enqualcomm/support/CoreService.java | 7 ++++--- .../support/service/SilentManager.java | 21 ++++++++++++------- .../support/utils/ContextProxy.java | 7 +++++++ .../enqualcomm/support/utils/DBHelper.java | 2 ++ .../enqualcomm/support/utils/TimeUtil.java | 20 +++++++++++------- .../java/com/ic/protocols/protocol_fzd.java | 15 ++++++------- .../java/com/ic/protocols/protocol_ic.java | 2 +- local.properties | 4 ++-- 9 files changed, 53 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/enqualcomm/support/Config.java b/app/src/main/java/com/enqualcomm/support/Config.java index ddcd0509..e5c6c7af 100644 --- a/app/src/main/java/com/enqualcomm/support/Config.java +++ b/app/src/main/java/com/enqualcomm/support/Config.java @@ -567,6 +567,8 @@ public class Config { C5_noBroadCastActionStrip=true; }else if(custom_name.equals("L02")){ noPushTxtReadReply=false;//即爱需要阅读反馈 + }else{ + noBroadCastPushTxtNotify=true; } diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 23616594..b7a39bea 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -413,7 +413,8 @@ public class CoreService extends Service { int newVolume = intent.getIntExtra("android.media.EXTRA_VOLUME_STREAM_VALUE", 0); int oldVolume = intent.getIntExtra("android.media.EXTRA_PREV_VOLUME_STREAM_VALUE", 0); - if (newVolume != oldVolume) { + boolean isSilence = SharPreferenceUtil.getPrefBoolean(context, "KEY_ISSILENCE", false); + if (newVolume != oldVolume && !isSilence) { ICLogger.i("Volume changed old "+oldVolume+" new "+newVolume); Config.setMasterVolume(context,newVolume); } @@ -451,13 +452,13 @@ public class CoreService extends Service { } - + SilentManager silentManager; private AbstractInvokeHandlerService getInvokeHandlerServiceChain() { ICLogger.i("getInvokeHandlerServiceChain"); SendChatMessage sendChatMessage = new SendChatMessage(); HeartRateManager heartRateManager= new HeartRateManager(this.runtime,this.connection); antiservice = new AntiMonitorService(); - SilentManager silentManager = SilentManager.getInstance();// new SilentManager(); + silentManager = SilentManager.getInstance();// new SilentManager(); sendChatMessage.setNext(heartRateManager); heartRateManager.setNext(silentManager); silentManager.setNext(antiservice); 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 ae863254..1f1136c6 100644 --- a/app/src/main/java/com/enqualcomm/support/service/SilentManager.java +++ b/app/src/main/java/com/enqualcomm/support/service/SilentManager.java @@ -289,7 +289,8 @@ public class SilentManager extends AbstractInvokeHandlerService { this.mTodayWeek = calendar.get(Calendar.DAY_OF_WEEK); Silent silent; - for(Iterator it = this.silentList.iterator() ; it.hasNext(); silent.endTimeMillis = calendar.getTimeInMillis()) { + Iterator it = this.silentList.iterator(); + while( it.hasNext()) { silent = (Silent)it.next(); calendar.set(Calendar.SECOND, 0); int hour = Integer.parseInt(silent.start.substring(2, 4)); @@ -297,10 +298,11 @@ public class SilentManager extends AbstractInvokeHandlerService { calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minutes); silent.startTimeMillis = calendar.getTimeInMillis(); - minutes = Integer.parseInt(silent.end.substring(2, 4)); - hour = Integer.parseInt(silent.end.substring(5, 7)); - calendar.set(Calendar.HOUR_OF_DAY, minutes); - calendar.set(Calendar.MINUTE, hour); + hour = Integer.parseInt(silent.end.substring(2, 4)); + minutes = Integer.parseInt(silent.end.substring(5, 7)); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minutes); + silent.endTimeMillis = calendar.getTimeInMillis(); } } @@ -367,8 +369,8 @@ public class SilentManager extends AbstractInvokeHandlerService { private void handSilence(Context var1, boolean var2) { this.mValue_isSilence = var2; - setSilentConfig(var1,var2); + /* if (this.isCalling) { this.haveHandSilence = true; } else { @@ -382,7 +384,7 @@ public class SilentManager extends AbstractInvokeHandlerService { // ComponentName var4 = new ComponentName(SERVICE_PKG_NAME, SERVICE_CLS_NAME); // Intent var5 = (new Intent("com.enqualcomm.support.ACTION_VIDEO_END_CALL")).setComponent(var4); // this.mRuntime.getContextProxy().context.startService(var5); - } + }*/ } private void handleSilent(Runtime runtime, boolean silent) { @@ -605,6 +607,11 @@ public class SilentManager extends AbstractInvokeHandlerService { } private void onSilentStateChange(boolean var1) { + + SharPreferenceUtil.setPrefBoolean(mContext, "KEY_ISSILENCE", var1); + setSilentConfig(mContext,var1); + + if (this.alarms != null) { if (var1) { this.cancelAlarm(this.alarms); diff --git a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java index f045590d..412a2ba8 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java @@ -372,6 +372,7 @@ public class ContextProxy { new Handler().postDelayed(new Runnable() { @Override public void run() { + //本应用弹出消息框 if (Config.noPushTxtNotifyDialog == false) { Intent intent = new Intent(); intent.setAction(DIALOG_ACTION); @@ -383,6 +384,7 @@ public class ContextProxy { VibrateUtil.getInstance(_context).VibrateOnOnce(true); Util.mSleep(2000); } + //launcher 弹出消息 if(Config.noBroadCastPushTxtNotify==false) { Intent intent = new Intent(ActionSrvPushTxt); intent.putExtra("msgType", msgType); //0 代表 server下发消息,1代表 SMS消息 @@ -397,6 +399,7 @@ public class ContextProxy { new Handler().postDelayed(new Runnable() { @Override public void run() { + //本应用弹出消息框 if (Config.noPushTxtNotifyDialog == false) { Intent intent = new Intent(); intent.setAction(DIALOG_ACTION); @@ -408,6 +411,7 @@ public class ContextProxy { VibrateUtil.getInstance(_context).VibrateOnOnce(true); Util.mSleep(2000); } + //launcher 弹出消息 if (Config.noBroadCastPushTxtNotify == false) { Intent intent = new Intent(ActionSrvPushTxt); intent.putExtra("msgType", msgType); //0 代表 server下发消息,1代表 SMS消息,2代表有提示音的消息 @@ -423,6 +427,7 @@ public class ContextProxy { new Handler().postDelayed(new Runnable() { @Override public void run() { + //本应用弹出消息框 if (Config.noPushTxtNotifyDialog == false) { Intent intent = new Intent(); intent.setAction(DIALOG_ACTION); @@ -443,6 +448,7 @@ public class ContextProxy { new Handler().postDelayed(new Runnable() { @Override public void run() { + //本应用弹出消息框 if(Config.noSMSNotifyDialog==false) { Intent intent = new Intent(); intent.setAction(DIALOG_ACTION); @@ -454,6 +460,7 @@ public class ContextProxy { VibrateUtil.getInstance(_context).VibrateOnOnce(true); Util.mSleep(2000); } + //launcher 弹出消息 if(Config.noBroadCastPushTxtNotify==false) { Intent intent = new Intent(ActionSrvPushTxt); intent.putExtra("msgType", msgType); //0 代表 server下发消息,1代表 SMS消息,2代表有提示音的消息 diff --git a/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java b/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java index 2a498e77..3988a92b 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java +++ b/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java @@ -774,6 +774,8 @@ public class DBHelper { contentValues.put("WEEK", silent.week); contentValues.put("STATUS", silent.status); contentValues.put("CUR_SYS_STATUS", current_sys_status); + ICLogger.i("add silience "+silent.start+"-"+silent.end+" "+silent.week+" "+silent.status+" "+current_sys_status); + } this.cr.bulkInsert(ICContentProvider.SILENT_URI, contentValueslist); diff --git a/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java b/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java index 5d8616ca..8215a08a 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java @@ -209,8 +209,7 @@ public class TimeUtil { android.provider.Settings.Global.AUTO_TIME, checked); } - - public static void setSysDateTime(Context mContext,Date datetime,int timezone){ + public static void setSysDateTime(Context mContext,Date datetime,int timezone,boolean addtimezoneToTime){ AlarmManager alarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE); Locale.getDefault().getDisplayCountry(); @@ -228,12 +227,14 @@ public class TimeUtil { ICLogger.i("====origin time " + c.getTime().toString()+" time zone "+c.getTimeZone()); c.setTime(datetime); - if (is24Hour(mContext)){ - c.add(Calendar.HOUR_OF_DAY, timezone);//24小时制 - }else{ - c.add(Calendar.HOUR, timezone);//12小时制 + if (addtimezoneToTime) { + if (is24Hour(mContext)) { + c.add(Calendar.HOUR_OF_DAY, timezone);//24小时制 + } else { + c.add(Calendar.HOUR, timezone);//12小时制 + } + c.setTimeZone(tz); } - c.setTimeZone(tz); // alarmManager.setTimeZone(); long when = c.getTimeInMillis(); @@ -252,6 +253,11 @@ public class TimeUtil { ICLogger.i("====set time to " + d.getTime().toString()+" time zone "+d.getTimeZone()); + } + public static void setSysDateTime(Context mContext,Date datetime,int timezone){ + + setSysDateTime(mContext,datetime,timezone,true); + } public static void setSysTime(Context mContext,int hour,int minute,int secounds){ diff --git a/app/src/main/java/com/ic/protocols/protocol_fzd.java b/app/src/main/java/com/ic/protocols/protocol_fzd.java index 5e49880e..ad66aace 100644 --- a/app/src/main/java/com/ic/protocols/protocol_fzd.java +++ b/app/src/main/java/com/ic/protocols/protocol_fzd.java @@ -424,8 +424,8 @@ public class protocol_fzd { if(sl.length==4) { String start,end,status; - start="T"+sl[0]; - end="T"+sl[1]; + start="ST"+sl[0]; + end="ST"+sl[1]; status=sl[2].equals("1")?"ON":"OFF"; char[] week=sl[3].toCharArray(); StringBuilder week_sb=new StringBuilder(); @@ -436,7 +436,7 @@ public class protocol_fzd { } Silent silent=new Silent(start,end, week_sb.toString(),status); slist.add(silent); - ICLogger.i("set alarm "+start +" " + end + " "+ week_sb.toString()+ " "+status); + ICLogger.i("set silence "+start +" " + end + " "+ week_sb.toString()+ " "+status); }else{ ICLogger.i("免打扰时间格式错误,skip"); } @@ -461,6 +461,7 @@ public class protocol_fzd { String date=list[2].trim(); String time=list[1].trim(); Date datetime= TimeUtil.parseDatetiime(date,time); + int timezone; try { @@ -476,7 +477,7 @@ public class protocol_fzd { ICLogger.i("==="+TimeUtil.getDefaultTimeZone()); - TimeUtil.setSysDateTime(runtime.getContextProxy().context,datetime,timezone); + TimeUtil.setSysDateTime(runtime.getContextProxy().context,datetime,timezone,false); ICLogger.i("==="+TimeUtil.getDefaultTimeZone()); } // Set Datetime 20200505112734 @@ -757,7 +758,7 @@ public class protocol_fzd { String list[]=data.split(CMDSPLIT); int listlen=list.length; - boolean ispared= (( listlen >0) && (listlen%2 == 0)); + boolean ispared= (( listlen >=0) && (listlen%2 == 0)); if (ispared){ ArrayList contactArray=new ArrayList(); for(int i=0; i contactArray=new ArrayList(); if(Config.custom_name.equals("YT")) { diff --git a/local.properties b/local.properties index 38825a3a..5da8e42a 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Tue Dec 01 09:24:14 CST 2020 -sdk.dir=C\:\\Users\\incar\\AppData\\Local\\Android\\Sdk +#Fri Dec 04 01:32:30 CST 2020 +sdk.dir=D\:\\Android\\Sdk -- 2.17.1