|
|
|
@ -3,6 +3,7 @@ package qianmu.container.handler; |
|
|
|
import android.app.ActivityManager; |
|
|
|
import android.content.Context; |
|
|
|
import android.content.Intent; |
|
|
|
import android.hardware.display.DisplayManager; |
|
|
|
import android.os.Build; |
|
|
|
import android.os.Debug; |
|
|
|
import android.os.Handler; |
|
|
|
@ -10,6 +11,7 @@ import android.os.Looper; |
|
|
|
import android.os.Message; |
|
|
|
import android.text.format.Formatter; |
|
|
|
import android.util.Log; |
|
|
|
import android.view.Display; |
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
|
|
|
|
@ -128,6 +130,7 @@ public class ContainerHandler extends Handler { |
|
|
|
public void onSuccess() { |
|
|
|
//检查,MQTT状态
|
|
|
|
mqttState(); |
|
|
|
printDisplayStatus(); |
|
|
|
sendEmptyMessageDelayed(MQTT_ALIVE,15000); |
|
|
|
sendEmptyMessageDelayed(MQTT_ALIVE,35000); |
|
|
|
sendEmptyMessageDelayed(MQTT_ALIVE,55000); |
|
|
|
@ -150,6 +153,25 @@ public class ContainerHandler extends Handler { |
|
|
|
LoggerUtil.e("heartBeatDelayTime", StringUtil.getThrowableStr(t)); |
|
|
|
} |
|
|
|
} |
|
|
|
//获取屏幕状态
|
|
|
|
private static void printDisplayStatus() { |
|
|
|
DisplayManager dm = (DisplayManager) MyApplication.getInstance().getSystemService(Context.DISPLAY_SERVICE); |
|
|
|
Display[] displays = dm.getDisplays(); |
|
|
|
for (Display display : displays) { |
|
|
|
LoggerUtil.e("显示器状态:", getDisplayStateString(display.getState())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static String getDisplayStateString(int state) { |
|
|
|
switch (state) { |
|
|
|
case Display.STATE_OFF: return "显示器关闭"; |
|
|
|
case Display.STATE_ON: return "显示器正常"; |
|
|
|
case Display.STATE_DOZE: return "显示器休眠"; |
|
|
|
case Display.STATE_DOZE_SUSPEND: return "设备休眠"; |
|
|
|
case Display.STATE_ON_SUSPEND: return "显示器正常,CPU休眠"; |
|
|
|
default: return "未知状态"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*** |
|
|
|
* 看门狗功能(新版欣威视通) |
|
|
|
|