Przeglądaj źródła

修改系统休眠功能,不再使用黑色背景覆盖

weizhengliang 1 rok temu
rodzic
commit
fddce33e44

+ 2 - 0
android_bed/src/main/h7_3128/AndroidManifest.xml

@@ -10,6 +10,8 @@
     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
     <uses-permission android:name="android.permission.STATUS_BAR" />
 
+    <uses-permission android:name="android.permission.DEVICE_POWER" />
+
     <application
         android:hardwareAccelerated="false"
         android:allowBackup="true"

+ 4 - 0
android_bed/src/main/h7_3128/java/com/wdkl/app/ncs/callingbed/activity/AppUpdateActivity.kt

@@ -157,4 +157,8 @@ class AppUpdateActivity :BaseActivity<AppUpdatePresenter, UpdateLayBinding>(), A
 
         })
     }
+
+    override fun keepScreenOn(): Boolean {
+        return true
+    }
 }

+ 87 - 32
android_bed/src/main/h7_3128/java/com/wdkl/app/ncs/callingbed/activity/CallingbedActivity.kt

@@ -129,7 +129,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
     private var broadcastChannelId: String = ""
     private var playing = false
 
-    private var sleepCountdown = false
+    /*private var sleepCountdown = false
     private val updateHandler: Handler = object : Handler(Looper.getMainLooper()) {
         override fun handleMessage(msg: Message) {
             //熄屏时间到,当前是夜晚且亮度为0则切换到黑屏界面
@@ -160,7 +160,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
     fun turnScreenOff() {
         black_view.visibility = View.VISIBLE
-    }
+    }*/
 
     override fun getLayId(): Int {
         return R.layout.callingbed2_main_lay
@@ -221,7 +221,12 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
         Utils.setStatusBarDisable(activity, Utils.STATUS_BAR_DISABLE_EXPAND)
 
         //保持屏幕常亮
-        AppTool.Setting.setScreenOffTimeOut2(applicationContext, 2147483647)
+        //AppTool.Setting.setScreenOffTimeOut2(applicationContext, 2147483647)
+
+        //亮屏
+        AppUtil.wakeUp(activity)
+        //设置默认熄屏时间为1分钟
+        AppTool.Setting.setScreenOffTimeOut(applicationContext, Constant.SLEEP_MINUTE)
 
         checkServer()
 
@@ -416,7 +421,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
     }
 
     private fun switchFragment(id: Int, fragment: Fragment, tag: String) {
-        resetSleepTime()
+        //resetSleepTime()
 
         supportFragmentManager.beginTransaction()
                 .replace(id, fragment, tag)
@@ -425,8 +430,8 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
     }
 
     private fun addCallFragment(fragment: Fragment) {
-        cancelSleep()
-        black_view.visibility = View.GONE
+        //cancelSleep()
+        //black_view.visibility = View.GONE
 
         //先切换到首页
         if (!mainFragment.equals(curFragment)) {
@@ -461,15 +466,15 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
     }
 
     override fun bindEvent() {
-        black_view.setOnClickListener {
+        /*black_view.setOnClickListener {
             resetSleepTime()
             black_view.visibility = View.GONE
             return@setOnClickListener
-        }
+        }*/
 
         tv_btn_home.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             //首页
             if (!mainFragment.equals(curFragment)) {
@@ -479,7 +484,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
         tv_btn_more.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             //更多
             if (!qrFragment.equals(curFragment)) {
@@ -489,7 +494,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
         tv_btn_advice.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             //医嘱
             if (!adviceFragment.equals(curFragment)) {
@@ -499,7 +504,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
         tv_btn_cost.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             //费用
             if (!costFragment.equals(curFragment)) {
@@ -509,7 +514,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
         tv_btn_support.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             //增援
             if (Constant.TCP_CONNECTED) {
@@ -532,7 +537,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
         tv_btn_voice_call.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             val time = System.currentTimeMillis()
             if (time - clickTime > 2000) {
@@ -561,7 +566,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
         tv_broadcast_stop.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             broadcastOn = false
             stopBroadcast(true)
@@ -569,7 +574,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
         tv_broadcast_state.setOnClickListener {
             //重置黑屏时间
-            resetSleepTime()
+            //resetSleepTime()
 
             if (playing) {
                 pauseBroadcast()
@@ -581,7 +586,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
         seekbar_bc_volume.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
             override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
                 //重置黑屏时间
-                resetSleepTime()
+                //resetSleepTime()
             }
 
             override fun onStartTrackingTouch(seekBar: SeekBar?) {
@@ -646,7 +651,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
     override fun onResume() {
         super.onResume()
         //重置黑屏时间
-        resetSleepTime()
+        //resetSleepTime()
     }
 
     override fun destory() {
@@ -660,7 +665,10 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
         handler.removeCallbacksAndMessages(null)
         SoundPoolManager.getInstance().release()
         stopBroadcast(false)
-        cancelSleep()
+        //cancelSleep()
+
+        //亮屏
+        AppUtil.wakeUp(activity)
     }
 
     //数据加载错误
@@ -794,9 +802,9 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
             Constant.SLEEP_MINUTE = partSetting.sleepSecondsBed
             Constant.NIGHT_BRIGHTNESS = partSetting.nightLight
-            if (sleepCountdown) {
+            /*if (sleepCountdown) {
                 resetSleepTime()
-            }
+            }*/
 
             VoiceManagerUtil.setCallVoice(activity, partSetting.dayBedVol)
         } catch (ex: Exception) {
@@ -900,8 +908,8 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
         showMessage("current version: " + BuildConfig.VERSION_NAME + "_" + BuildConfig.VERSION_CODE + ", new version: " + newAppVersion + "_" + appInfo.versionNo)
 
         if (BuildConfig.VERSION_CODE < appInfo.versionNo) {
-            cancelSleep()
-            black_view.visibility = View.GONE
+            //cancelSleep()
+            //black_view.visibility = View.GONE
 
             if (!Constant.APP_UPDATING) {
                 //showMessage("即将升级...")
@@ -933,6 +941,9 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
             override fun run() {
                 try {
                     initDevice()
+
+                    //容错处理,设置熄屏时间
+                    setScreenOffTime()
                 } catch (e: Exception) {
                     //
                 }
@@ -974,24 +985,26 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
         //buffer[0],buffer[6]: 手柄按键;
         //buffer[5]: 面板呼叫键;
         //buffer[8]: 面板挂断键;
-        if (black_view.visibility == View.VISIBLE) {
+        //if (black_view.visibility == View.VISIBLE) {
             if (buffer[0].toInt() == 1 || buffer[0].toInt() == 2
                 || buffer[5].toInt() == 1 || buffer[5].toInt() == 2
                 || buffer[6].toInt() == 1 || buffer[6].toInt() == 2) {
 
-                runOnUiThread {
+                AppUtil.wakeUp(activity)
+                /*runOnUiThread {
                     cancelSleep()
                     black_view.visibility = View.GONE
-                }
+                }*/
             } else if (buffer[8].toInt() == 1 || buffer[8].toInt() == 2) {
-                runOnUiThread {
+                AppUtil.wakeUp(activity)
+                /*runOnUiThread {
                     cancelSleep()
                     black_view.visibility = View.GONE
-                }
+                }*/
 
                 return
             }
-        }
+        //}
 
         //测试模式
         if (testFragment == curFragment) {
@@ -1153,6 +1166,9 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
                         startBroadcast()
                     }
                 }, 2000)
+
+                //退出通话,重新设置熄屏时间
+                setScreenOffTime()
             }
 
             //Sip注册状态
@@ -1182,9 +1198,12 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
                     if (tcpModel.getType() == TcpType.VOICE) {
                         if (tcpModel.data != null) {
                             if (tcpModel.action == TcpAction.VoiceAction.CALL || tcpModel.action == TcpAction.VoiceAction.VCALL) {
-                                if (black_view.visibility == View.VISIBLE) {
+                                /*if (black_view.visibility == View.VISIBLE) {
                                     black_view.visibility = View.GONE
-                                }
+                                }*/
+
+                                //亮屏
+                                AppUtil.wakeUp(activity)
 
                                 val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                                 Constant.fromId = tcpModel.fromId
@@ -1246,6 +1265,9 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
                             SOSHelper.sosStop()
                         }
                     } else if (tcpModel.type == TcpType.BROADCAST) {
+                        //亮屏
+                        AppUtil.wakeUp(activity)
+
                         if (tcpModel.action == TcpAction.BroadcastAction.START) {
                             if (Constant.TCP_CONNECTED && !TextUtils.isEmpty(Constant.SIP_ID)) {
                                 if (tcpModel.data != null && !broadcastOn) {
@@ -1266,6 +1288,9 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
                     } else if (tcpModel.type == TcpType.DEVICE) {
                         //检查APP版本
                         if (tcpModel.getAction() == TcpAction.DeviceAction.APP_UPDATE) {
+                            //亮屏
+                            AppUtil.wakeUp(activity)
+
                             checkAppVersion()
                         } else if (tcpModel.action == TcpAction.DeviceAction.RESTART) {
                             //收到重启app指令,若当前处于正常待机状态则直接重启app,否则等待通话结束再重启
@@ -1327,6 +1352,9 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
 
                     //探视
                     if (tcpModel.type == TcpType.VIDEO) {
+                        //亮屏
+                        AppUtil.wakeUp(activity)
+
                         val interactionVO = Gson().fromJson(tcpModel.data.toString(), InteractionVO::class.java)
                         if (tcpModel.action == TcpAction.VideoAction.VIDEO_INVITE_JOIN) {
                             if (Constant.CALL_STATE != Constant.CALL_STANDBY) {
@@ -1617,7 +1645,7 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
             Constant.day_state = 1
         }
 
-        if (Constant.day_state == 1 && Constant.NIGHT_BRIGHTNESS == 0) {
+        /*if (Constant.day_state == 1 && Constant.NIGHT_BRIGHTNESS == 0) {
             //夜晚
             if (!Constant.IS_RECORDING && !sleepCountdown && skyCallFragment == null && black_view.visibility == View.GONE) {
                 black_view.visibility = View.VISIBLE
@@ -1627,6 +1655,16 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
             if (black_view.visibility == View.VISIBLE) {
                 black_view.visibility = View.GONE
             }
+        }*/
+
+
+        if (Constant.day_state == 0) {
+            //白天亮屏
+            AppUtil.wakeUp(activity)
+        }
+
+        if (forceSet) {
+            setScreenOffTime()
         }
     }
 
@@ -1651,4 +1689,21 @@ class CallingbedActivity :BaseActivity<CallingbedActivityPresenter, Callingbed2M
             }
         }
     }
+
+    override fun keepScreenOn(): Boolean {
+        return false
+    }
+
+    private fun setScreenOffTime() {
+        //如果当前是夜晚模式且亮度为0则设置自动熄屏
+        if (Constant.NIGHT_BRIGHTNESS == 0 && Constant.day_state == 1 && !Constant.IS_RECORDING && skyCallFragment == null) {
+            //根据服务器设置自动熄屏时间
+            Log.d(TAG, "set screen off timeout: ${Constant.SLEEP_MINUTE}")
+            AppTool.Setting.setScreenOffTimeOut(applicationContext, Constant.SLEEP_MINUTE)
+        } else {
+            //屏幕常亮
+            Log.d(TAG, "keep screen on")
+            AppTool.Setting.setScreenOffTimeOut2(applicationContext, 2147483647)
+        }
+    }
 }

+ 3 - 3
android_bed/src/main/h7_3128/java/com/wdkl/app/ncs/callingbed/agreement/CallingbedAgreement.kt

@@ -10,9 +10,9 @@ interface CallingbedAgreement {
     //检查APP版本
     fun checkAppVersion()
 
-    fun startCountDownSleep()
+    //fun startCountDownSleep()
 
-    fun cancelSleep()
+    //fun cancelSleep()
 
-    fun resetSleepTime()
+    //fun resetSleepTime()
 }

+ 5 - 0
android_bed/src/main/h7_3128/java/com/wdkl/app/ncs/callingbed/fragment/BaseCallFragment.kt

@@ -12,6 +12,8 @@ import com.enation.javashop.utils.base.tool.BaseToolActivity
 import com.wdkl.app.ncs.callingbed.R
 import com.wdkl.app.ncs.callingbed.helper.SerialPortHelper
 import com.wdkl.app.ncs.callingbed.settings.SettingConfig
+import com.wdkl.ncs.android.lib.base.BaseApplication
+import com.wdkl.ncs.android.lib.utils.AppTool
 import com.wdkl.ncs.android.lib.utils.showMessage
 import com.wdkl.ncs.android.middleware.common.Constant
 import com.wdkl.ncs.android.middleware.common.MessageEvent
@@ -43,6 +45,9 @@ abstract class BaseCallFragment: Fragment(), View.OnTouchListener {
         if (arguments.getSerializable("tcp_model") != null) {
             tcpModel = arguments.getSerializable("tcp_model") as TcpModel
         }
+
+        //通话界面,屏幕保持常亮
+        AppTool.Setting.setScreenOffTimeOut2(BaseApplication.appContext, 2147483647)
     }
 
     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {

+ 9 - 8
android_bed/src/main/h7_3128/java/com/wdkl/app/ncs/callingbed/fragment/QrCodeFragment.kt

@@ -120,11 +120,12 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrCodeLayBinding>()
 
     override fun bindEvent() {
         tv_btn_screen_off.setOnClickListener {
-            (activity as CallingbedActivity).turnScreenOff()
+            //(activity as CallingbedActivity).turnScreenOff()
+            AppUtil.goToSleep(activity)
         }
 
         tv_btn_update_app.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
+            //(activity as CallingbedActivity).resetSleepTime()
 
             (activity as CallingbedActivity).checkAppVersion()
         }
@@ -150,7 +151,7 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrCodeLayBinding>()
 
         //长按二维码启动camera预览
         view_qr_code.setOnLongClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
+            //(activity as CallingbedActivity).resetSleepTime()
 
             if (Constant.supportCamera) {
                 if (frame_camera_view.visibility == View.GONE) {
@@ -164,7 +165,7 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrCodeLayBinding>()
         }
 
         view_qr_code.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
+            //(activity as CallingbedActivity).resetSleepTime()
 
             val time = System.currentTimeMillis()
             if (time - clickTime < 1500) {
@@ -182,7 +183,7 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrCodeLayBinding>()
 
         //点击10次床位textview进入系统设置
         tv_about_me.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
+            //(activity as CallingbedActivity).resetSleepTime()
 
             val time = System.currentTimeMillis()
             if (time - clickTime < 1500) {
@@ -203,13 +204,13 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrCodeLayBinding>()
         }
 
         tv_btn_server_config.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
+            //(activity as CallingbedActivity).resetSleepTime()
 
             ServerConfigDialogHelper.showPasswordDialog(activity)
         }
 
         tv_device_test.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
+            //(activity as CallingbedActivity).resetSleepTime()
 
             PasswordDialogHelper.showPasswordDialog(activity) {
                 (activity as CallingbedActivity).startTestMode()
@@ -217,7 +218,7 @@ class QrCodeFragment : BaseFragment<QrCodeFragmentPresenter, QrCodeLayBinding>()
         }
 
         tv_btn_language_setting.setOnClickListener {
-            (activity as CallingbedActivity).resetSleepTime()
+            //(activity as CallingbedActivity).resetSleepTime()
 
             LanguageSetDialogHelper.showDialog(activity)
         }

+ 2 - 2
android_bed/src/main/h7_3128/java/com/wdkl/app/ncs/callingbed/fragment/SkyCallFragment.kt

@@ -67,7 +67,7 @@ class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
 
     override fun init() {
         //取消黑屏
-        (activity as CallingbedActivity).cancelSleep()
+        //(activity as CallingbedActivity).cancelSleep()
 
         //初始化计时器
         initCountDownTimer(sky_voice_call_timeout)
@@ -211,7 +211,7 @@ class SkyCallFragment: BaseCallFragment(), CallSessionCallback {
         handler.removeCallbacksAndMessages(null)
 
         //恢复黑屏
-        (activity as CallingbedActivity).startCountDownSleep()
+        //(activity as CallingbedActivity).startCountDownSleep()
     }
 
     private fun startOutgoing() {

+ 36 - 0
android_bed/src/main/h7_3128/java/com/wdkl/app/ncs/callingbed/helper/AppUtil.java

@@ -2,12 +2,16 @@ package com.wdkl.app.ncs.callingbed.helper;
 
 import android.app.AlarmManager;
 import android.content.Context;
+import android.os.PowerManager;
+import android.os.SystemClock;
 import android.text.TextUtils;
+import android.util.Log;
 
 import com.wdkl.ncs.android.middleware.common.Constant;
 
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
 import java.util.Calendar;
 
 public class AppUtil {
@@ -114,4 +118,36 @@ public class AppUtil {
 
         return false;
     }
+
+    /**
+     * 关闭屏幕 ,其实是使系统休眠
+     * @param context
+     */
+    public static void goToSleep(Context context) {
+        PowerManager powerManager= (PowerManager)context.getSystemService(Context.POWER_SERVICE);
+        try {
+            Log.e("power", "go to sleep");
+            powerManager.getClass().getMethod("goToSleep", new Class[]{long.class}).invoke(powerManager, SystemClock.uptimeMillis());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 唤醒屏幕
+     * @param context
+     */
+    public static void wakeUp(Context context) {
+        PowerManager powerManager= (PowerManager)context.getSystemService(Context.POWER_SERVICE);
+        try {
+            boolean screenOn = powerManager.isInteractive();
+            Log.e("power", "screenOn = " + screenOn + ", wake up check...");
+            if (!screenOn) {
+                powerManager.getClass().getMethod("wakeUp", new Class[]{long.class}).invoke(powerManager, SystemClock.uptimeMillis());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
 }

+ 2 - 2
android_bed/src/main/h7_3128/res/layout/callingbed2_main_lay.xml

@@ -221,13 +221,13 @@
             android:layout_height="match_parent" />
 
         <!--black screen-->
-        <LinearLayout
+        <!--<LinearLayout
             android:id="@+id/black_view"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:orientation="horizontal"
             android:background="#000000"
-            android:visibility="gone"/>
+            android:visibility="gone"/>-->
 
     </RelativeLayout>
 </layout>

+ 13 - 4
common/src/main/code/com/wdkl/ncs/android/lib/base/BaseActivity.kt

@@ -78,10 +78,17 @@ abstract class BaseActivity<PresenterType : BaseContract.BasePresenter, DataBind
         }
         /**父类初始化*/
         super.onCreate(savedInstanceState)
-        window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN or
-                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
-                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
-                WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
+
+        if (keepScreenOn()) {
+            window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN or
+                        WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON or
+                        WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
+                        WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
+        } else {
+            window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN or
+                    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
+                    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
+        }
 
         requestWindowFeature(Window.FEATURE_NO_TITLE)
 
@@ -159,6 +166,8 @@ abstract class BaseActivity<PresenterType : BaseContract.BasePresenter, DataBind
         errorLog("PageDestory","页面销毁======>$localClassName")
     }
 
+    protected abstract fun keepScreenOn(): Boolean
+
     /**
      * @author  LDD
      * @From   com.wdkl.ncs.android.lib.base.BaseActivity

+ 4 - 4
common/src/main/code/com/wdkl/ncs/android/lib/utils/AppTool.kt

@@ -320,12 +320,12 @@ object AppTool {
         fun setScreenOffTimeOut(context: Context, timeout: Int) {
             try {
                 //2147483647 永不休眠时间
-                if (!"rk3128".equals(Build.MODEL)) {
+                //if (!"rk3128".equals(Build.MODEL)) {
                     Settings.System.putInt(
                             context.contentResolver,
                             Settings.System.SCREEN_OFF_TIMEOUT, timeout * 60 * 1000
                     )
-                }
+                //}
             } catch (e: java.lang.Exception) {
                 e.printStackTrace()
             }
@@ -335,9 +335,9 @@ object AppTool {
         fun setScreenOffTimeOut2(context: Context, time: Int) {
             try {
                 //2147483647 永不休眠时间
-                if (!"rk3128".equals(Build.MODEL)) {
+                //if (!"rk3128".equals(Build.MODEL)) {
                     Settings.System.putInt(context.contentResolver, Settings.System.SCREEN_OFF_TIMEOUT, time)
-                }
+                //}
             } catch (e: java.lang.Exception) {
                 e.printStackTrace()
             }

+ 2 - 5
welcome/src/main/code/com/wdkl/ncs/android/component/welcome/activity/WelcomeActivity.kt

@@ -232,10 +232,7 @@ class WelcomeActivity :BaseActivity<WelcomePresenter, ActivityWelcomeBinding>(),
         }
     }
 
-    /**
-     * 重写返回监听事件 直接销毁页面
-     */
-    override fun onBackPressed() {
-        finish()
+    override fun keepScreenOn(): Boolean {
+        return true
     }
 }