Bläddra i källkod

解决Reset Shop后第二次开机设备名称被清空,导致HotelApi重新初始化的问题

Yuping Liang 11 månader sedan
förälder
incheckning
b91b083e5a
2 ändrade filer med 12 tillägg och 7 borttagningar
  1. 2 2
      app/build.gradle
  2. 10 5
      app/src/main/java/com/tcl/customerapi/IService.java

+ 2 - 2
app/build.gradle

@@ -18,8 +18,8 @@ android {
         applicationId "com.tcl.customerapi"
         minSdkVersion 29
         targetSdkVersion 29
-        versionCode 1105
-        versionName "1.1.05"
+        versionCode 1106
+        versionName "1.1.06"
 
         multiDexEnabled true
     }

+ 10 - 5
app/src/main/java/com/tcl/customerapi/IService.java

@@ -152,14 +152,19 @@ public class IService extends android.app.Service {
     @SuppressLint("ApplySharedPref")
     void Init() throws RemoteException {
         SharedPreferences vPreferences = ctx.getSharedPreferences(dataPath, MODE);
-        boolean value = vPreferences.getBoolean("factory_init", true);
-        String deviceName = AHDeviceHelper.getDeviceName();
-        Log.d(TAG, "factory_init: " + value + ", deviceName: " + deviceName);
-        if (!deviceName.isEmpty() && !value) {
+        final boolean factoryInit = vPreferences.getBoolean("factory_init", true);
+        final String deviceName = AHDeviceHelper.getDeviceName();
+        Log.d(TAG, "factory_init: " + factoryInit + ", deviceName: " + deviceName);
+
+        if (deviceName.isEmpty()) {
+            setDeviceName();
+        }
+
+        if (!factoryInit) {
+            Log.d(TAG, "already initialized");
             return;
         }
 
-        setDeviceName();
         //setLauncher();
 
         Log.d(TAG, "restore default logo");