Browse Source

2.6.2 兼容紫鹏11,A50(X5)的sn获取

xulh 9 months ago
parent
commit
452afb751c

+ 6 - 2
app/src/main/java/com/hh/arome/ui/MainActivity.java

@@ -5143,7 +5143,8 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
 //        if (Config.taskStatus.equals("doing") || Config.taskStatus.equals("wait")) {
 //        if (Config.taskStatus.equals("doing") || Config.taskStatus.equals("wait")) {
         ConfigData.setFaceScenicUtile(faceScenicUtile, true);
         ConfigData.setFaceScenicUtile(faceScenicUtile, true);
         Map<String, Object> params = new HashMap<>();
         Map<String, Object> params = new HashMap<>();
-        params.put("checkWay", ConfigData.checkWay);
+//        params.put("checkWay", ConfigData.checkWay);
+        params.put("checkWay", "scanFace");
 
 
         invoke(params, ConfigData.mSessionId);
         invoke(params, ConfigData.mSessionId);
 //        }
 //        }
@@ -5183,9 +5184,12 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
             params = new HashMap<>();
             params = new HashMap<>();
         }
         }
 
 
-        AppLogUtils.e("invoke -- params = " + params.toString());
+
 
 
         params.put(BPaaSApi.KEY_BPAAS_IPC_TIME_OUT, -1L);
         params.put(BPaaSApi.KEY_BPAAS_IPC_TIME_OUT, -1L);
+
+        AppLogUtils.e("invoke -- params = " + params.toString());
+
         BPaaSApi.getInstance().invoke(ConfigData.getDeviceConfigResultBean().getAbcpAppId(),
         BPaaSApi.getInstance().invoke(ConfigData.getDeviceConfigResultBean().getAbcpAppId(),
                 "BPaasVerifyID", params, mSessionId, new BPaaSCallback() {
                 "BPaasVerifyID", params, mSessionId, new BPaaSCallback() {
                     @Override
                     @Override

+ 30 - 4
app/src/main/java/com/hh/arome/utlis/device/DeviceUtils.java

@@ -29,23 +29,49 @@ public final class DeviceUtils {
             Method get = c.getMethod("get", String.class);
             Method get = c.getMethod("get", String.class);
             if (Build.VERSION.SDK_INT <= 28) {//28 is andoird 9.0 24-7.0 22-5.1
             if (Build.VERSION.SDK_INT <= 28) {//28 is andoird 9.0 24-7.0 22-5.1
                 serial = (String) get.invoke(c, "ro.serialno");
                 serial = (String) get.invoke(c, "ro.serialno");
+                AppLogUtils.e("SDK_INT <= 28--serial:"+serial);
             } else {
             } else {
                 serial = (String) get.invoke(c, "persist.sys.hrSerial");//vendor.gsm.serial
                 serial = (String) get.invoke(c, "persist.sys.hrSerial");//vendor.gsm.serial
+                AppLogUtils.e("SDK_INT > 28--serial:"+serial);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
 
 
-        // 兼容版本11的紫鹏
         if (TextUtils.isEmpty(serial)) {
         if (TextUtils.isEmpty(serial)) {
-            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
-                // 注意清单文件加上READ_PHONE_STATE权限,不然还是会获取失败
+//            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
+//                // 注意清单文件加上READ_PHONE_STATE权限,不然还是会获取失败
+//                serial = Build.getSerial();
+//            }else{
+//                serial = Build.SERIAL;
+//            }
+
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                 serial = Build.getSerial();
                 serial = Build.getSerial();
-            }else{
+                AppLogUtils.e("SDK_INT >= O--serial:"+serial);
+                if(!TextUtils.isEmpty(serial)&&!serial.equals("unknown")) {
+                    // 判断非空和非unknown,则返回
+                    return serial;
+                }else{
+                    serial = "";
+                }
+            }
+
+            if(TextUtils.isEmpty(serial)) {
                 serial = Build.SERIAL;
                 serial = Build.SERIAL;
+                AppLogUtils.e("SDK_INT < O--serial:"+serial);
+                if(!TextUtils.isEmpty(serial)&&!serial.equals("unknown")) {
+                    // 判断非空和非unknown,则返回
+                    return serial;
+                }else{
+                    serial = "";
+                }
             }
             }
         }
         }
 
 
+
+
+
         if (TextUtils.isEmpty(serial)) {
         if (TextUtils.isEmpty(serial)) {
             serial = "sn号获取失败";
             serial = "sn号获取失败";
         }
         }

+ 2 - 2
config.gradle

@@ -7,8 +7,8 @@ ext {
 //            minSdkVersion    : 24,
 //            minSdkVersion    : 24,
             minSdkVersion    : 21,
             minSdkVersion    : 21,
             targetSdkVersion : 22,
             targetSdkVersion : 22,
-            versionCode      : 16,
-            versionName      : "2.6.1"
+            versionCode      : 17,
+            versionName      : "2.6.2"
     ]
     ]
     //依赖 配置
     //依赖 配置
     dependencies = [
     dependencies = [