Browse Source

涂鸦息屏问题,自动模式关闭页面上报指令

zhangshenjie 2 months ago
parent
commit
cb09ef2b64

+ 1 - 0
BusinessCommon/src/main/java/com/develop/common/food_sdk/FloatWindowManager.kt

@@ -153,6 +153,7 @@ object FloatWindowManager {
         return  EasyFloat.isShow()
     }
     fun isModeDiyShow() :Boolean{
+        Log.i("TAG isMode","isMode :$isMode   modeType:$modeType    isStepShow: "+isStepShow() )
         return  isMode && modeType !="" && isStepShow()
     }
     @Subscribe

+ 12 - 0
BusinessCommon/src/main/java/com/develop/common/ui/CommonBindingActivity.kt

@@ -36,8 +36,10 @@ import com.develop.common.food_sdk.GlobalDevEvent
 import com.develop.common.router.Screens
 import com.develop.common.tag.CURRENT_USER_ID
 import com.develop.common.tag.SCREENSAVER
+import com.develop.common.tag.TURN_UP_KEY_CODE
 import com.develop.common.utils.NoScreenEvent
 import com.develop.common.utils.TimeDownUtil
+import com.develop.common.utils.TuyaSoEvent
 import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevStatus
 import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevPromptEvent
 import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevStatusEvent
@@ -160,6 +162,16 @@ abstract class CommonBindingActivity<T : ViewBinding> : BaseBindingActivity<T>()
         }
     }
 
+//    @Subscribe
+//    fun tuyaSoEvent(event:TuyaSoEvent){
+//        //涂鸦传递值,模拟用户点击,避免息屏情况
+//        locktime = System.currentTimeMillis()
+//        var s = KeyEvent(0, 0, KeyEvent.ACTION_DOWN, TURN_UP_KEY_CODE, 0);
+//        dispatchKeyEvent(s)
+//
+//    }
+
+
     var lock = false
     var locktime: Long = 0
     override fun dispatchTouchEvent(ev: MotionEvent): Boolean {

+ 3 - 1
BusinessCommon/src/main/java/com/develop/common/utils/AppVersionUtil.kt

@@ -605,4 +605,6 @@ object AppVersionUtil {
 }
 
 
-class NoScreenEvent(var noScreen: Boolean)
+class NoScreenEvent(var noScreen: Boolean)
+
+class TuyaSoEvent()

+ 34 - 46
BusinessCommon/src/main/java/com/develop/common/utils/CommonTuyaSoUtils.kt

@@ -1,29 +1,18 @@
 package com.develop.common.utils
 
 import android.os.Bundle
-import android.util.Log
-import com.blankj.utilcode.util.ToastUtils
-import com.develop.base.ext.appGlobalScope
-import com.develop.base.ext.globalApp
 import com.develop.base.ext.navigateTo
 import com.develop.base.util.AppActivityManager
 import com.develop.base.util.TopResumedAtyHolder
 import com.develop.base.util.TuyaEventEntity
-import com.develop.common.R
-import com.develop.common.data_repo.FoodDataProvider
 import com.develop.common.food_sdk.FloatWindowManager
 import com.develop.common.router.Screens
 import com.develop.common.tag.MODE_TYPE
 import com.develop.common.tag.NUMBER_TAG
 import com.develop.common.tag.SOURCE_TAG
 import com.google.gson.Gson
-import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevModes
 import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevStatus
-import com.kuyuntech.cofarcooking.device.sdk.constant.core.WorkModes
 import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
 import org.greenrobot.eventbus.EventBus
 
 object CommonTuyaSoUtils {
@@ -46,44 +35,34 @@ object CommonTuyaSoUtils {
         }
 
 
+        var recipeNumber = number
 
+        if (recipeNumber.contains("@")) {
+            var (numbers, language) = recipeNumber.split("@")
+            recipeNumber = numbers
+        }
 
-        FoodDataProvider.getDatabase().recipeDao().apply {
-            var recipeNumber = number
-            if (recipeNumber.contains("@")) {
-                var (numbers, language) = recipeNumber.split("@")
-                recipeNumber = numbers
-            }
-
-
-            val recipeBean = queryRecipe(recipeNumber)
-            if (recipeBean != null) {
-
-                TopResumedAtyHolder.getCurrentActivity()?.navigateTo(Screens.Cook.COOK_DETAIL) {
-                    withString(
-                        SOURCE_TAG, "local"
-                    )
-                    withString(NUMBER_TAG, number)
-                }
-            } else {
-                TopResumedAtyHolder.getCurrentActivity()?.navigateTo(Screens.Cook.COOK_DETAIL) {
-                    withString(
-                        SOURCE_TAG, "remote"
-                    )
-                    withString(NUMBER_TAG, number)
-                }
-
-            }
 
+        TopResumedAtyHolder.getCurrentActivity()
+        TopResumedAtyHolder.getCurrentActivity()?.navigateTo(Screens.Cook.COOK_DETAIL) {
+            withString(
+                SOURCE_TAG, "local"
+            )
+            withString(NUMBER_TAG, number)
         }
 
 
     }
+
     fun navigateToAdaptedCooking(modeType: String) {
         //判断设备是否正在运行,而还判断是否有挂起程序,挂起程序是否自动程序且还要是diy模式才可以重新进入ModeDetail页面
-        if (CofarSDK.devInfo().runningStatus != DevStatus.STOP && !FloatWindowManager.isModeDiyShow()) {
-            EventBus.getDefault().post(TuyaEventEntity(recipeNumber = "", isType = 0))
-            return
+        if (CofarSDK.devInfo().runningStatus != DevStatus.STOP ) {
+            if (CofarSDK.devInfo().runningInstId != modeType
+                &&(FloatWindowManager.isModeDiyShow() || AppActivityManager.getInstance().topActivity.localClassName.contains(
+                    "ModesDetailActivity") ) ){
+                EventBus.getDefault().post(TuyaEventEntity(recipeNumber = "", isType = 0))
+                return
+            }
         }
         //当时测试有个BUG,料理机点击diy以后,手机没识别,然后手机点击diy模式,会导致程序崩溃,具体日志没看到什么东西,估在这多一个判断
         //当前模式是diy,且当前页面是ModesDetailActivity的时候,return方法
@@ -93,9 +72,10 @@ object CommonTuyaSoUtils {
                 "ModesDetailActivity"
             )
         ) {
-            TuyaUtilsSo.getInstance().mapClean()
-            TuyaUtilsSo.getInstance().uploadData()
-
+            if (CofarSDK.devInfo().runningStatus == DevStatus.STOP){
+                TuyaUtilsSo.getInstance().mapClean()
+                TuyaUtilsSo.getInstance().uploadData()
+            }
             return
         }
 
@@ -121,9 +101,15 @@ object CommonTuyaSoUtils {
 
     }
 
-    fun navigateFinish(){
-        if (AppActivityManager.getInstance().topActivity.localClassName.contains("ModesDetailActivity")){
-            if (CofarSDK.devInfo().runningStatus != DevStatus.STOP){
+    fun tuyaSoEvent(){
+        AppActivityManager.getInstance().topActivity.apply {
+            EventBus.getDefault().post(TuyaSoEvent())
+        }
+    }
+
+    fun navigateFinish() {
+        if (AppActivityManager.getInstance().topActivity.localClassName.contains("ModesDetailActivity")) {
+            if (CofarSDK.devInfo().runningStatus != DevStatus.STOP) {
                 CofarSDK.stop(false)
             }
             AppActivityManager.getInstance().topActivity.finish()
@@ -137,4 +123,6 @@ object CommonTuyaSoUtils {
     }
 
 
+
+
 }

+ 58 - 72
BusinessCommon/src/main/java/com/develop/common/utils/TuyaUtilsSo.java

@@ -50,7 +50,6 @@ public class TuyaUtilsSo {
     public boolean isUser = false;  //避免重复上报问题
 
 
-
     public static TuyaUtilsSo getInstance() {
         if (singleton == null) {
             synchronized (TuyaUtilsSo.class) {
@@ -195,11 +194,11 @@ public class TuyaUtilsSo {
                     }
 
                     //加热方式调整
-                    if (enumValue==2){
+                    if (enumValue == 2) {
                         heatType = 1;
-                    }else if (enumValue==10){
+                    } else if (enumValue == 10) {
                         heatType = 2;
-                    }else {
+                    } else {
                         heatType = 0;
                     }
                     autoMaticType = enumValue;
@@ -209,12 +208,12 @@ public class TuyaUtilsSo {
                     break;
                 case TuyaSoDp.COOKING_TEMPERATURE:
                     byte mode = HeatModes.PU_TONG;
-                    if (heatType==1){
+                    if (heatType == 1) {
                         mode = HeatModes.ZHENG_QI;
-                    }else if (heatType==2){
-                        mode =  HeatModes.SAP_SHUI;
-                    }else {
-                        mode =HeatModes.PU_TONG;
+                    } else if (heatType == 2) {
+                        mode = HeatModes.SAP_SHUI;
+                    } else {
+                        mode = HeatModes.PU_TONG;
                     }
 
                     isUser = true;
@@ -247,7 +246,7 @@ public class TuyaUtilsSo {
                 case TuyaSoDp.SPEED:
                     isUser = true;
                     //速度
-                    CofarSDK.cfgMotorGear((byte)  intValue );
+                    CofarSDK.cfgMotorGear((byte) intValue);
                     break;
                 case TuyaSoDp.REVERSIBLE:
                     isUser = true;
@@ -268,6 +267,7 @@ public class TuyaUtilsSo {
                 case TuyaSoDp.CURRENT_RECIPE_NUMBER:
                     //当前食谱编号
                     CommonTuyaSoUtils.INSTANCE.navigateToRemoteRecipe(strValue);
+                    wakeUpScreen(context);
                     break;
                 case TuyaSoDp.CURRENT_RECIPE_STEP:
                     //当前食谱编号
@@ -284,6 +284,7 @@ public class TuyaUtilsSo {
                     break;
 
             }
+//            CommonTuyaSoUtils.INSTANCE.tuyaSoEvent();
         }
     };
 
@@ -360,7 +361,7 @@ public class TuyaUtilsSo {
         }
 
         CommonTuyaSoUtils.INSTANCE.navigateToAdaptedCooking(type);
-
+        wakeUpScreen(context);
 
     }
 
@@ -453,7 +454,7 @@ public class TuyaUtilsSo {
 
 
     public void uploadData() {
-        if (!tuyaNetwork||!isUser) {
+        if (!tuyaNetwork || !isUser) {
             return;
         }
 
@@ -464,7 +465,7 @@ public class TuyaUtilsSo {
                 DevInfo info = CofarSDK.devInfo();
                 BaseDevMode mode = info.getMode();
                 int time = (int) System.currentTimeMillis();
-                if (getAutoMaticModes(info.getRunningInstId())!=autoMaticType){
+                if (getAutoMaticModes(info.getRunningInstId()) != autoMaticType) {
                     return;
                 }
 
@@ -508,39 +509,6 @@ public class TuyaUtilsSo {
 
                 int automatic = getModes(info.getRunningInstId());
 
-//                DPEvent[] dpEvents = new DPEvent[]{
-//                        new DPEvent(TuyaSoDp.ON_OFF, (byte) DPEvent.Type.PROP_BOOL, 1, 0),
-//                        new DPEvent(TuyaSoDp.START_STOP, (byte) DPEvent.Type.PROP_BOOL, start_stop, 0),
-//                        new DPEvent(TuyaSoDp.AUTOMATIC_PROGRAM, (byte) DPEvent.Type.PROP_ENUM, automatic, 0),
-//                        new DPEvent(TuyaSoDp.WORK_STATE, (byte) DPEvent.Type.PROP_ENUM, work_state, 0),
-//                        new DPEvent(TuyaSoDp.COOKING_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, (int) (info.getTargetTempBuffer() != -1 ? info.getTargetTempBuffer() : info.getTargetTemp()), 0),
-//                        new DPEvent(TuyaSoDp.CURRENT_TEMPERATURE, (byte) DPEvent.Type.PROP_VALUE, (int) CofarUtils.parseTemp(info.getTemp()), 0),
-////                        new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, 1, 0),
-////                        new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE,1, 0),
-//
-//                        new DPEvent(TuyaSoDp.COOKING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getTargetTimeBuffer() != -1 ? info.getTargetTimeBuffer() : info.getTargetTime(), 0),
-//                        new DPEvent(TuyaSoDp.REMAINING_TIME, (byte) DPEvent.Type.PROP_VALUE, info.getRemainTime(), 0),
-//                        new DPEvent(TuyaSoDp.PAUSE, (byte) DPEvent.Type.PROP_BOOL, pause, 0),
-//                        new DPEvent(TuyaSoDp.SPEED, (byte) DPEvent.Type.PROP_VALUE, (int) (info.getMotorGearBuffer() != -1 ? info.getMotorGearBuffer() : info.getMotorGear()), 0),
-//                        new DPEvent(TuyaSoDp.REVERSIBLE, (byte) DPEvent.Type.PROP_BOOL, (int) (info.getMotorDirectionBuffer() != -1 ? info.getMotorDirectionBuffer() : info.getMotorDirection()), 0),
-//                        new DPEvent(TuyaSoDp.POT_STATUS, (byte) DPEvent.Type.PROP_VALUE, pot_status, 0),
-//                        new DPEvent(TuyaSoDp.WEIGHT_NUMBER, (byte) DPEvent.Type.PROP_VALUE, info.getWeight(), 0),
-//                        new DPEvent(TuyaSoDp.POT_CLOVER_STATUS, (byte) DPEvent.Type.PROP_VALUE, (int) info.getPotCloverStatus(), 0),
-//                        new DPEvent(TuyaSoDp.MAX_TIME, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxTime(), 0),
-//                        new DPEvent(TuyaSoDp.MIN_TIME, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinTime(), 0),
-//                        new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxTemp(), 0),
-//                        new DPEvent(TuyaSoDp.MIN_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinTemp(), 0),
-//
-////                        new DPEvent(TuyaSoDp.MAX_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : 88, 0),
-////                        new DPEvent(TuyaSoDp.MIN_TEMP, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : 50, 0),
-//                        new DPEvent(TuyaSoDp.MAX_MOTOR_GEAR, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMaxMotorGear(), 0),
-//                        new DPEvent(TuyaSoDp.MIN_MOTOR_GEAR, (byte) DPEvent.Type.PROP_VALUE, mode == null ? 0 : mode.getMinMotorGear(), 0),
-//                        new DPEvent(TuyaSoDp.TIME_CHANGE, (byte) DPEvent.Type.PROP_BOOL, timeChange, 0),
-//                        new DPEvent(TuyaSoDp.TEMP_CHANGE, (byte) DPEvent.Type.PROP_BOOL, tempChange, 0),
-//                        new DPEvent(TuyaSoDp.MOTOR_GEAR_CHANGE, (byte) DPEvent.Type.PROP_BOOL, motorGearChange, 0),
-//                        new DPEvent(TuyaSoDp.MOTOR_DIRECTION_CHANGE, (byte) DPEvent.Type.PROP_BOOL, motorDirectionChange, 0)
-//
-//                };
 
                 List<DPEvent> dpEvents = new ArrayList<>(Arrays.asList(
                         new DPEvent(TuyaSoDp.ON_OFF, (byte) DPEvent.Type.PROP_BOOL, 1, 0),
@@ -596,16 +564,16 @@ public class TuyaUtilsSo {
                     }
 
                     if (event.type == DPEvent.Type.PROP_BOOL) {
-                        sendDpBool(event.dpid, value,time);
+                        sendDpBool(event.dpid, value, time);
                     }
                     if (event.type == DPEvent.Type.PROP_VALUE) {
-                        sendDpValue(event.dpid, value,time);
+                        sendDpValue(event.dpid, value, time);
                     }
                     if (event.type == DPEvent.Type.PROP_STR) {
-                        sendDpStr(event.dpid, String.valueOf(value),time);
+                        sendDpStr(event.dpid, String.valueOf(value), time);
                     }
                     if (event.type == DPEvent.Type.PROP_ENUM) {
-                        sendDpEnum(event.dpid, value,time);
+                        sendDpEnum(event.dpid, value, time);
                     }
 
                 }
@@ -627,7 +595,7 @@ public class TuyaUtilsSo {
                 DevInfo info = CofarSDK.devInfo();
                 BaseDevMode mode = info.getMode();
                 int time = (int) System.currentTimeMillis();
-                Log.v("tuya_iot",info.toString());
+                Log.v("tuya_iot", info.toString());
 //                BaseDevMode mode = baseDevMode;
 //                Log.e("tuya_iot",mode.toString());
                 int status = info.getStatus();
@@ -757,16 +725,16 @@ public class TuyaUtilsSo {
                     }
 
                     if (event.type == DPEvent.Type.PROP_BOOL) {
-                        sendDpBool(event.dpid, value,time);
+                        sendDpBool(event.dpid, value, time);
                     }
                     if (event.type == DPEvent.Type.PROP_VALUE) {
-                        sendDpValue(event.dpid, value,time);
+                        sendDpValue(event.dpid, value, time);
                     }
                     if (event.type == DPEvent.Type.PROP_STR) {
-                        sendDpStr(event.dpid, String.valueOf(value),time);
+                        sendDpStr(event.dpid, String.valueOf(value), time);
                     }
                     if (event.type == DPEvent.Type.PROP_ENUM) {
-                        sendDpEnum(event.dpid, value,time);
+                        sendDpEnum(event.dpid, value, time);
                     }
 
                 }
@@ -926,15 +894,11 @@ public class TuyaUtilsSo {
 //    }
 
 
-
-
-
-
     private int getModes(String enumValue) {
 
 
-        if (autoMaticType!=-1){
-            return  autoMaticType;
+        if (autoMaticType != -1) {
+            return autoMaticType;
         }
 
         /**
@@ -1007,7 +971,7 @@ public class TuyaUtilsSo {
     }
 
 
-    private int getAutoMaticModes(String enumValue){
+    private int getAutoMaticModes(String enumValue) {
         /**
          * 0 DIY,1 和面(Knead) ,2 蒸汽(Steam), 3 低温慢煮(Sous_vide) ,4 煮米饭(Rice) ,
          * 5 搅碎(Chop) , 6 奶昔(Smoothie),7 称重(Weight) ,8 切丁(Dive), 9 去皮(Peeling) ,10 烧水(Boil_water),11 切丝切片 (Food_processor)
@@ -1082,7 +1046,7 @@ public class TuyaUtilsSo {
         }
     }
 
-    public void sendDpEnum(int dpid, int value,int time_stamp) {
+    public void sendDpEnum(int dpid, int value, int time_stamp) {
         Integer mapInt = map.get(dpid);
         if (mapInt != null) {
             int mapValue = mapInt.intValue();
@@ -1091,7 +1055,7 @@ public class TuyaUtilsSo {
             }
         }
 
-        int code = getTuyaApi().send_dp_enum(dpid, value,time_stamp);
+        int code = getTuyaApi().send_dp_enum(dpid, value, time_stamp);
         //上报成功,避免同一个值重复上报,估在这加map做缓存
         if (code == 0) {
             map.put(dpid, value);
@@ -1100,12 +1064,12 @@ public class TuyaUtilsSo {
 
     }
 
-    public void sendDpStr(int dpid, String value,int time_stamp) {
+    public void sendDpStr(int dpid, String value, int time_stamp) {
 
-        getTuyaApi().send_dp_str(dpid, value,time_stamp);
+        getTuyaApi().send_dp_str(dpid, value, time_stamp);
     }
 
-    public void sendDpValue(int dpid, int value,int time_stamp) {
+    public void sendDpValue(int dpid, int value, int time_stamp) {
         Integer mapInt = map.get(dpid);
         if (mapInt != null) {
             int mapValue = mapInt.intValue();
@@ -1113,7 +1077,7 @@ public class TuyaUtilsSo {
                 return;
             }
         }
-        int code = getTuyaApi().send_dp_value(dpid, value,time_stamp);
+        int code = getTuyaApi().send_dp_value(dpid, value, time_stamp);
         //上报成功,避免同一个值重复上报,估在这加map做缓存
         if (code == 0) {
             map.put(dpid, value);
@@ -1121,7 +1085,7 @@ public class TuyaUtilsSo {
 
     }
 
-    public void sendDpBool(int dpid, int value,int time_stamp) {
+    public void sendDpBool(int dpid, int value, int time_stamp) {
         Integer mapInt = map.get(dpid);
         if (mapInt != null) {
             int mapValue = mapInt.intValue();
@@ -1131,7 +1095,7 @@ public class TuyaUtilsSo {
         }
 
 
-        int code = getTuyaApi().send_dp_bool(dpid, value,time_stamp);
+        int code = getTuyaApi().send_dp_bool(dpid, value, time_stamp);
 
         //上报成功,避免同一个值重复上报,估在这加map做缓存
         if (code == 0) {
@@ -1139,8 +1103,9 @@ public class TuyaUtilsSo {
         }
     }
 
-    public void setDpTemp() {
-        getTuyaApi().send_dp_temp();
+    public void setDpCurrentActivity() {
+        int time = (int)System.currentTimeMillis();
+        getTuyaApi().send_dp_bool(TuyaSoDp.CURRENT_ACTIVITY,1,time);
     }
 
 
@@ -1186,4 +1151,25 @@ public class TuyaUtilsSo {
         getTuyaApi().log_message(tag, msg);
     }
 
+    public void wakeUpScreen(Context context) {
+        PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+        //判断是否息屏,避免重复调用
+        if (!powerManager.isInteractive()) {
+            PowerManager.WakeLock wakeLock = null;
+            // 获取电源管理器的唤醒锁
+            if (powerManager != null) {
+                wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "MyApp::MyWakelockTag");
+                // 唤醒屏幕
+                wakeLock.acquire(0);
+
+                if (wakeLock != null && wakeLock.isHeld()) {
+                    wakeLock.release();
+                    wakeLock = null;
+                }
+            }
+
+        }
+    }
+
+
 }

+ 1 - 1
BusinessStep/src/main/java/com/develop/step/ui/ModesDetailActivity.kt

@@ -383,7 +383,6 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
 
 
         //用于涂鸦指令上报
-
         Handler().postDelayed({
             TuyaUtilsSo.getInstance().mapClean()
             TuyaUtilsSo.getInstance().isUser = true
@@ -396,6 +395,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
 
     override fun onDestroy() {
         super.onDestroy()
+        TuyaUtilsSo.getInstance().setDpCurrentActivity()
         isWidget = false
         viewModel.stopTurbo()
         viewModel.cancelAnimator()

+ 2 - 37
app/src/main/java/com/develop/foodcooking/FoodCookingApp.kt

@@ -244,16 +244,9 @@ class FoodCookingApp : BaseApp() {
         if (minute == 0) {
             minute = 5
         }
-        Settings.System.putInt(
-            contentResolver,
-            Settings.System.SCREEN_OFF_TIMEOUT,
-            (1000 * 60 * minute).toInt()
-        )
-
+        Settings.System.putInt(contentResolver, Settings.System.SCREEN_OFF_TIMEOUT, (1000 * 60 * minute).toInt())
         Settings.Secure.putInt(contentResolver, Settings.Secure.INSTALL_NON_MARKET_APPS, 1)
-
-        val uri: Uri = Settings.System
-            .getUriFor(Settings.System.SCREEN_OFF_TIMEOUT)
+        val uri: Uri = Settings.System.getUriFor(Settings.System.SCREEN_OFF_TIMEOUT)
         contentResolver.notifyChange(uri, null)
         heartBeatInterval = Interval(1, 1, TimeUnit.SECONDS, 5).finish {
             //设备不通讯异常
@@ -269,34 +262,6 @@ class FoodCookingApp : BaseApp() {
 
     }
 
-    fun deleteRoomDb() {
-
-        FoodDataProvider.getUserDatabase().userInfoDao().apply {
-            removeAllOnlineRecipe(CURRENT_USER_ID)
-            removeAllFavouriteRecipe(CURRENT_USER_ID)
-            removeAllHistoryRecipe(CURRENT_USER_ID)
-            removeAllOnUserTag(CURRENT_USER_ID)
-        }
-
-        FoodDataProvider.getUserDatabase().devConfigDao().apply {
-            removeAllDevVersion()
-        }
-
-        Log.d("TAG 删除room", "删除 FoodDataProvider Dao文件")
-
-        val applicationDirectory = cacheDir.parent?.let { File(it) }
-        if (applicationDirectory?.exists() == true) {
-
-            val files = applicationDirectory.listFiles() ?: emptyArray()
-            for (file in files) {
-                //databases目录放着room 的db文件,重新解压需要删除
-                if (file.name.equals("databases")) {
-                    Log.d("TAG 删除room", "删除 databases的room-db文件")
-                    FileUtils.delete(file)
-                }
-            }
-        }
-    }
 
     fun hookWebView() {
         val TAG = "ASDD"

+ 2 - 2
libBase/src/main/java/com/develop/base/ext/GlobaExt.kt

@@ -225,9 +225,9 @@ fun getSN(): String {
 //        return "011D10390020123010190001"
 //        return "011A10390020123010190002"
 //        return "011A10390020123010190002"
-//        return  "011D10390020123010190021";
+        return  "011D10390020123010190021";
 //        return  "011D10390020123010190088";
-        return  "011D10390020123010190003"
+//        return  "011D10390020123010190003"
 //        return  "011A10390020123010190188"
 //        return "011A10390020123010190099"
 //        return "011A10390020123010190009"