<orderEntry type="module" module-name="dNSCache"/>\r
<orderEntry type="module" module-name="dNSCache"/>\r
<orderEntry type="module" module-name="dNSCache"/>\r
+ <orderEntry type="module" module-name="dNSCache"/>\r
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK"/>\r
</component>\r
</module>\r
private static int ant_status_event_reported=0; // 0 表示无消息, 1表示有消息需要发送, 大于1表示timeout时间内又有新消息,可以忽略不计\r
private static long anti_event_receivedTime=0;\r
private static int last_send_antoff_event=-1;\r
- private AudioService mAudioService=null;\r
private Handler mHandler=null;\r
PowerManager.WakeLock mWakeLock = null;\r
public AntiMonitorService(){\r
}\r
\r
}else if (msg.what == 200){\r
- if( mAudioService!=null)\r
- mAudioService.stop();\r
+ AudioService.getInstance().stop();\r
}\r
}\r
};\r
}\r
private void play_notify(){\r
\r
- if (this.mAudioService == null)\r
- this.mAudioService = new AudioService();\r
-\r
- this.mAudioService.play(mContext.getAssets(), "antioff.mp3");\r
+ AudioService.getInstance().play(mContext.getAssets(), "antioff.mp3");\r
if(mHandler!=null)\r
mHandler.sendEmptyMessageDelayed(200,5000);\r
\r
\r
public class AudioService implements MediaPlayer.OnErrorListener, MediaPlayer.OnCompletionListener {\r
private MediaPlayer mMediaPlayer;\r
- \r
+\r
+ private static AudioService mAudioService=null;\r
public AudioService() { initMediaPlayer(); }\r
- \r
+\r
+ public static AudioService getInstance(){\r
+ if (mAudioService==null)\r
+ mAudioService=new AudioService();\r
+ return mAudioService;\r
+ }\r
private void initMediaPlayer() {\r
release();\r
this.mMediaPlayer = new MediaPlayer();\r
return false;\r
}\r
\r
- private AudioService mAudioService;\r
+\r
private void playVoice(Context paramContext,String voicefile) {\r
- if (this.mAudioService == null)\r
- this.mAudioService = new AudioService();\r
- this.mAudioService.play(voicefile);\r
+ AudioService.getInstance().play(voicefile);\r
}\r
\r
public static void releaseOneWakeLock() {\r
}\r
}\r
};\r
- private AudioService mAudioService=null;\r
private Handler mHandler=null;\r
PowerManager.WakeLock mWakeLock = null;\r
\r
private void play_waning_notify(Context context){\r
-\r
- if (this.mAudioService == null)\r
- this.mAudioService = new AudioService();\r
-\r
- this.mAudioService.play(context.getAssets(), "warning.mp3");\r
+ AudioService.getInstance().play(context.getAssets(), "warning.mp3");\r
}\r
private void send_batterylow_event_broadcast(Context context,int batlow){\r
\r
mWakeLock.release();\r
}\r
}else if (msg.what == 200){\r
- if( mAudioService!=null)\r
- mAudioService.stop();\r
+ AudioService.getInstance().stop();\r
}\r
}\r
};\r
import com.enqualcomm.support.bean.Silent;\r
import com.enqualcomm.support.bean.Runtime;\r
import com.enqualcomm.support.bean.VoiceContent;\r
+import com.enqualcomm.support.service.AudioService;\r
\r
import java.lang.reflect.Method;\r
import java.util.ArrayList;\r
sendMsgBroadcast(this.context,msg,msgType);\r
\r
}\r
-\r
+ private static void play_waning_notify(Context context){\r
+ AudioService.getInstance().play(context.getAssets(), "warning.mp3");\r
+ }\r
public static void sendMsgBroadcast(Context _context,String msg, int msgType) {\r
- Intent intent = new Intent("action.ic.srvPushTxt");\r
- intent.putExtra("msgType", 0); //0 代表 server下发消息,1代表 SMS消息\r
- intent.putExtra("txtMsg", msg);\r
- _context.sendBroadcast(intent);\r
\r
if (msgType==0){\r
- Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
+ Observable.timer(50L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
public void call(Long param1Long) {\r
if(Config.noPushTxtNotifyDialog==false) {\r
Intent intent = new Intent();\r
intent.setAction(DIALOG_ACTION);\r
intent.putExtra("pushtxt", msg);\r
_context.sendBroadcast(intent);\r
+ }else{\r
+ WakeLockUtil.ScreenOnWakeLockTemperary(_context);\r
+ play_waning_notify(_context);\r
+ try {\r
+ Thread.sleep(2000);\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ }\r
}\r
+ Intent intent = new Intent("action.ic.srvPushTxt");\r
+ intent.putExtra("msgType", 0); //0 代表 server下发消息,1代表 SMS消息\r
+ intent.putExtra("txtMsg", msg);\r
+ _context.sendBroadcast(intent);\r
}\r
});\r
}else{\r
- Observable.timer(500L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
+ Observable.timer(50L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
public void call(Long param1Long) {\r
if(Config.noSMSNotifyDialog==false) {\r
Intent intent = new Intent();\r
intent.setAction(DIALOG_ACTION);\r
intent.putExtra("sms", msg);\r
_context.sendBroadcast(intent);\r
+ }else{\r
+ WakeLockUtil.ScreenOnWakeLockTemperary(_context);\r
+ play_waning_notify(_context);\r
+ try {\r
+ Thread.sleep(2000);\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ }\r
}\r
+\r
+ Intent intent = new Intent("action.ic.srvPushTxt");\r
+ intent.putExtra("msgType", 0); //0 代表 server下发消息,1代表 SMS消息\r
+ intent.putExtra("txtMsg", msg);\r
+ _context.sendBroadcast(intent);\r
}\r
});\r
}\r
+\r
+\r
+\r
+\r
}\r
public void sendStheartRateBroadcast(String paramString, int paramInt) {\r
Intent intent = new Intent();\r
\r
private static CustomDialog mCustomDialog;\r
\r
- private AudioService mAudioService;\r
- \r
private CustomNotification mCustomNotification;\r
\r
private CustomDialog.Builder mDialog;\r
}\r
private void playFindDevVoice(Context context){\r
\r
- if (this.mAudioService == null)\r
- this.mAudioService = new AudioService();\r
-\r
- this.mAudioService.play(context.getAssets(), "Campus_Life.ogg");\r
+ AudioService.getInstance().play(context.getAssets(), "Campus_Life.ogg");\r
\r
}\r
private void stopmediaplayer(){\r
- if (this.mAudioService != null)\r
- this.mAudioService.stop();\r
+ AudioService.getInstance().stop();\r
}\r
private void playNotificationVoice(Context paramContext) {\r
- if (this.mAudioService == null)\r
- this.mAudioService = new AudioService(); \r
- this.mAudioService.play(paramContext.getAssets(), "ring_msg.mp3");\r
+ AudioService.getInstance().play(paramContext.getAssets(), "ring_msg.mp3");\r
}\r
\r
private void playshutdownsound(Context paramContext) {\r
- if (this.mAudioService == null)\r
- this.mAudioService = new AudioService();\r
- this.mAudioService.play(paramContext.getAssets(), "shutdownsound.mp3");\r
+ AudioService.getInstance().play(paramContext.getAssets(), "shutdownsound.mp3");\r
}\r
\r
+\r
private void screenOn(Context paramContext) {\r
final PowerManager.WakeLock wakelock = ((PowerManager)paramContext.getSystemService(Context.POWER_SERVICE)).newWakeLock(ACQUIRE_CAUSES_WAKEUP| SCREEN_DIM_WAKE_LOCK, ProcessReceiver.class.getSimpleName());\r
wakelock.acquire();\r
package com.enqualcomm.support.utils;\r
\r
import android.content.Context;\r
+import android.os.Handler;\r
+import android.os.Message;\r
import android.os.PowerManager;\r
\r
+import com.enqualcomm.support.service.AudioService;\r
+\r
import java.util.Objects;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import rx.Observable;\r
+import rx.functions.Action1;\r
+\r
+import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP;\r
+import static android.os.PowerManager.SCREEN_DIM_WAKE_LOCK;\r
\r
\r
public class WakeLockUtil {\r
+\r
public static PowerManager.WakeLock getScreenOnWakeLock(Context context, String tag) {\r
PowerManager.WakeLock wakeLock = ((PowerManager)(context.getSystemService(Context.POWER_SERVICE))).newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, tag);\r
// wakeLock.acquire(900000L);\r
wakeLock.acquire();\r
return wakeLock;\r
}\r
+ public static void ScreenOnWakeLockTemperary(Context context) {\r
+ final PowerManager.WakeLock wakelock = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).newWakeLock(ACQUIRE_CAUSES_WAKEUP| SCREEN_DIM_WAKE_LOCK, WakeLockUtil.class.getSimpleName());\r
+ wakelock.acquire();\r
+ Observable.timer(5000L, TimeUnit.MILLISECONDS).subscribe(new Action1<Long>() {\r
+ public void call(Long param1Long) { wakelock.release(); }\r
+ });\r
+ }\r
+\r
}\r
\r
-#Thu Jul 16 16:57:07 CST 2020\r
-VERSION_CODE=452\r
+#Fri Jul 17 13:08:38 CST 2020\r
+VERSION_CODE=453\r