From: snickersun Date: Fri, 17 Jul 2020 06:04:41 +0000 (+0800) Subject: release V453 X-Git-Url: http://git.snicker.com.cn/sitemap.xml?a=commitdiff_plain;h=23bf3e2e64a38334a0b406a89dfd99f6418bd577;p=protocol_srv.git release V453 为文本接收 不弹出窗口时添加亮屏及接收提示。 把所有音频播放都放到AudioService中 --- diff --git a/app/app.iml b/app/app.iml index ebbc2302..586ced2e 100644 --- a/app/app.iml +++ b/app/app.iml @@ -129,6 +129,7 @@ + diff --git a/app/release/ICSer_V452_2007161657_release.apk b/app/release/ICSer_V453_2007171308_release.apk similarity index 79% rename from app/release/ICSer_V452_2007161657_release.apk rename to app/release/ICSer_V453_2007171308_release.apk index 091d0a2c..aa389a8f 100644 Binary files a/app/release/ICSer_V452_2007161657_release.apk and b/app/release/ICSer_V453_2007171308_release.apk differ diff --git a/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java b/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java index 698eb839..9f4a5bbe 100644 --- a/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java +++ b/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java @@ -40,7 +40,6 @@ public class AntiMonitorService extends AbstractInvokeHandlerService { private static int ant_status_event_reported=0; // 0 表示无消息, 1表示有消息需要发送, 大于1表示timeout时间内又有新消息,可以忽略不计 private static long anti_event_receivedTime=0; private static int last_send_antoff_event=-1; - private AudioService mAudioService=null; private Handler mHandler=null; PowerManager.WakeLock mWakeLock = null; public AntiMonitorService(){ @@ -57,8 +56,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService { } }else if (msg.what == 200){ - if( mAudioService!=null) - mAudioService.stop(); + AudioService.getInstance().stop(); } } }; @@ -71,10 +69,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService { } private void play_notify(){ - if (this.mAudioService == null) - this.mAudioService = new AudioService(); - - this.mAudioService.play(mContext.getAssets(), "antioff.mp3"); + AudioService.getInstance().play(mContext.getAssets(), "antioff.mp3"); if(mHandler!=null) mHandler.sendEmptyMessageDelayed(200,5000); diff --git a/app/src/main/java/com/enqualcomm/support/service/AudioService.java b/app/src/main/java/com/enqualcomm/support/service/AudioService.java index ccc26d30..0d372ff1 100644 --- a/app/src/main/java/com/enqualcomm/support/service/AudioService.java +++ b/app/src/main/java/com/enqualcomm/support/service/AudioService.java @@ -9,9 +9,15 @@ import com.enqualcomm.support.utils.ICLogger; public class AudioService implements MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener { private MediaPlayer mMediaPlayer; - + + private static AudioService mAudioService=null; public AudioService() { initMediaPlayer(); } - + + public static AudioService getInstance(){ + if (mAudioService==null) + mAudioService=new AudioService(); + return mAudioService; + } private void initMediaPlayer() { release(); this.mMediaPlayer = new MediaPlayer(); diff --git a/app/src/main/java/com/enqualcomm/support/service/Deliver.java b/app/src/main/java/com/enqualcomm/support/service/Deliver.java index bb617474..b945024e 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Deliver.java +++ b/app/src/main/java/com/enqualcomm/support/service/Deliver.java @@ -425,11 +425,9 @@ public static void sendLocationMSG( String Msg){ return false; } - private AudioService mAudioService; + private void playVoice(Context paramContext,String voicefile) { - if (this.mAudioService == null) - this.mAudioService = new AudioService(); - this.mAudioService.play(voicefile); + AudioService.getInstance().play(voicefile); } public static void releaseOneWakeLock() { 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 c34f93d4..51046c23 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java @@ -142,16 +142,11 @@ public class BatteryUtil { } } }; - private AudioService mAudioService=null; private Handler mHandler=null; PowerManager.WakeLock mWakeLock = null; private void play_waning_notify(Context context){ - - if (this.mAudioService == null) - this.mAudioService = new AudioService(); - - this.mAudioService.play(context.getAssets(), "warning.mp3"); + AudioService.getInstance().play(context.getAssets(), "warning.mp3"); } private void send_batterylow_event_broadcast(Context context,int batlow){ @@ -178,8 +173,7 @@ public class BatteryUtil { mWakeLock.release(); } }else if (msg.what == 200){ - if( mAudioService!=null) - mAudioService.stop(); + AudioService.getInstance().stop(); } } }; 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 c05eba55..92824b3e 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java @@ -24,6 +24,7 @@ import com.enqualcomm.support.bean.NoticeContent; import com.enqualcomm.support.bean.Silent; import com.enqualcomm.support.bean.Runtime; import com.enqualcomm.support.bean.VoiceContent; +import com.enqualcomm.support.service.AudioService; import java.lang.reflect.Method; import java.util.ArrayList; @@ -327,36 +328,63 @@ public class ContextProxy { sendMsgBroadcast(this.context,msg,msgType); } - + private static void play_waning_notify(Context context){ + AudioService.getInstance().play(context.getAssets(), "warning.mp3"); + } public static void sendMsgBroadcast(Context _context,String msg, int msgType) { - Intent intent = new Intent("action.ic.srvPushTxt"); - intent.putExtra("msgType", 0); //0 代表 server下发消息,1代表 SMS消息 - intent.putExtra("txtMsg", msg); - _context.sendBroadcast(intent); if (msgType==0){ - Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1() { + Observable.timer(50L, TimeUnit.MILLISECONDS).subscribe(new Action1() { public void call(Long param1Long) { if(Config.noPushTxtNotifyDialog==false) { Intent intent = new Intent(); intent.setAction(DIALOG_ACTION); intent.putExtra("pushtxt", msg); _context.sendBroadcast(intent); + }else{ + WakeLockUtil.ScreenOnWakeLockTemperary(_context); + play_waning_notify(_context); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); + } } + Intent intent = new Intent("action.ic.srvPushTxt"); + intent.putExtra("msgType", 0); //0 代表 server下发消息,1代表 SMS消息 + intent.putExtra("txtMsg", msg); + _context.sendBroadcast(intent); } }); }else{ - Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1() { + Observable.timer(50L, TimeUnit.MILLISECONDS).subscribe(new Action1() { public void call(Long param1Long) { if(Config.noSMSNotifyDialog==false) { Intent intent = new Intent(); intent.setAction(DIALOG_ACTION); intent.putExtra("sms", msg); _context.sendBroadcast(intent); + }else{ + WakeLockUtil.ScreenOnWakeLockTemperary(_context); + play_waning_notify(_context); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + e.printStackTrace(); + } } + + Intent intent = new Intent("action.ic.srvPushTxt"); + intent.putExtra("msgType", 0); //0 代表 server下发消息,1代表 SMS消息 + intent.putExtra("txtMsg", msg); + _context.sendBroadcast(intent); } }); } + + + + } public void sendStheartRateBroadcast(String paramString, int paramInt) { Intent intent = new 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 133df780..97d675d4 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java @@ -74,8 +74,6 @@ public class ProcessReceiver extends BroadcastReceiver { private static CustomDialog mCustomDialog; - private AudioService mAudioService; - private CustomNotification mCustomNotification; private CustomDialog.Builder mDialog; @@ -217,28 +215,21 @@ public class ProcessReceiver extends BroadcastReceiver { } private void playFindDevVoice(Context context){ - if (this.mAudioService == null) - this.mAudioService = new AudioService(); - - this.mAudioService.play(context.getAssets(), "Campus_Life.ogg"); + AudioService.getInstance().play(context.getAssets(), "Campus_Life.ogg"); } private void stopmediaplayer(){ - if (this.mAudioService != null) - this.mAudioService.stop(); + AudioService.getInstance().stop(); } private void playNotificationVoice(Context paramContext) { - if (this.mAudioService == null) - this.mAudioService = new AudioService(); - this.mAudioService.play(paramContext.getAssets(), "ring_msg.mp3"); + AudioService.getInstance().play(paramContext.getAssets(), "ring_msg.mp3"); } private void playshutdownsound(Context paramContext) { - if (this.mAudioService == null) - this.mAudioService = new AudioService(); - this.mAudioService.play(paramContext.getAssets(), "shutdownsound.mp3"); + AudioService.getInstance().play(paramContext.getAssets(), "shutdownsound.mp3"); } + private void screenOn(Context paramContext) { final PowerManager.WakeLock wakelock = ((PowerManager)paramContext.getSystemService(Context.POWER_SERVICE)).newWakeLock(ACQUIRE_CAUSES_WAKEUP| SCREEN_DIM_WAKE_LOCK, ProcessReceiver.class.getSimpleName()); wakelock.acquire(); diff --git a/app/src/main/java/com/enqualcomm/support/utils/WakeLockUtil.java b/app/src/main/java/com/enqualcomm/support/utils/WakeLockUtil.java index 374b2274..2095c3de 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/WakeLockUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/WakeLockUtil.java @@ -1,17 +1,37 @@ package com.enqualcomm.support.utils; import android.content.Context; +import android.os.Handler; +import android.os.Message; import android.os.PowerManager; +import com.enqualcomm.support.service.AudioService; + import java.util.Objects; +import java.util.concurrent.TimeUnit; + +import rx.Observable; +import rx.functions.Action1; + +import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP; +import static android.os.PowerManager.SCREEN_DIM_WAKE_LOCK; public class WakeLockUtil { + public static PowerManager.WakeLock getScreenOnWakeLock(Context context, String tag) { PowerManager.WakeLock wakeLock = ((PowerManager)(context.getSystemService(Context.POWER_SERVICE))).newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, tag); // wakeLock.acquire(900000L); wakeLock.acquire(); return wakeLock; } + public static void ScreenOnWakeLockTemperary(Context context) { + final PowerManager.WakeLock wakelock = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).newWakeLock(ACQUIRE_CAUSES_WAKEUP| SCREEN_DIM_WAKE_LOCK, WakeLockUtil.class.getSimpleName()); + wakelock.acquire(); + Observable.timer(5000L, TimeUnit.MILLISECONDS).subscribe(new Action1() { + public void call(Long param1Long) { wakelock.release(); } + }); + } + } diff --git a/app/version_code.properties b/app/version_code.properties index 5bfb822e..490f5997 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Thu Jul 16 16:57:07 CST 2020 -VERSION_CODE=452 +#Fri Jul 17 13:08:38 CST 2020 +VERSION_CODE=453