Browse Source

2.6.3 兼容紫鹏A50和A50R3的小程序全屏展示。添加invoke中bundle内容打印

xulh 8 months ago
parent
commit
be432266d9

+ 57 - 54
app/src/main/java/com/hh/arome/bean/DeviceConfigResultBean.java

@@ -535,6 +535,54 @@ public class DeviceConfigResultBean {
         this.thirdAuth = thirdAuth;
     }
 
+    public static class ManualInIdCardAuthDTO {
+        public String  appId;
+        public String appKey;
+        public String appSecret;
+        public String privateKey;
+
+        public String getAppId() {
+            return appId;
+        }
+
+        public void setAppId(String appId) {
+            this.appId = appId;
+        }
+
+        public String getAppKey() {
+            return appKey;
+        }
+
+        public void setAppKey(String appKey) {
+            this.appKey = appKey;
+        }
+
+        public String getAppSecret() {
+            return appSecret;
+        }
+
+        public void setAppSecret(String appSecret) {
+            this.appSecret = appSecret;
+        }
+
+        public String getPrivateKey() {
+            return privateKey;
+        }
+
+        public void setPrivateKey(String privateKey) {
+            this.privateKey = privateKey;
+        }
+
+        @Override
+        public String toString() {
+            return "ManualInIdCardAuthDTO{" +
+                    "appId='" + appId + '\'' +
+                    ", appKey='" + appKey + '\'' +
+                    ", appSecret='" + appSecret + '\'' +
+                    ", privateKey='" + privateKey + '\'' +
+                    '}';
+        }
+    }
 
     @Override
     public String toString() {
@@ -573,8 +621,6 @@ public class DeviceConfigResultBean {
                 ", appId='" + appId + '\'' +
                 ", appName='" + appName + '\'' +
                 ", signature='" + signature + '\'' +
-                ", machineAppId='" + machineAppId + '\'' +
-                ", serviceAppId='" + serviceAppId + '\'' +
                 ", serviceAddress='" + serviceAddress + '\'' +
                 ", appAuthToken=" + appAuthToken +
                 ", appAuthTokenStatus=" + appAuthTokenStatus +
@@ -582,60 +628,17 @@ public class DeviceConfigResultBean {
                 ", trade='" + trade + '\'' +
                 ", groupId='" + groupId + '\'' +
                 ", isAppGetUserInfo=" + isAppGetUserInfo +
-                ", cameraBrand='" + cameraBrand + '\'' +
-                ", cameraType='" + cameraType + '\'' +
+                ", logPushUrl='" + logPushUrl + '\'' +
+                ", idCardReaderBrand=" + idCardReaderBrand +
+                ", machineAppId='" + machineAppId + '\'' +
+                ", abcpAppId='" + abcpAppId + '\'' +
+                ", serviceAppId='" + serviceAppId + '\'' +
                 ", ampeAppid='" + ampeAppid + '\'' +
                 ", miniProgramAppid='" + miniProgramAppid + '\'' +
-                ", abcpAppId='" + abcpAppId + '\'' +
+                ", cameraBrand='" + cameraBrand + '\'' +
+                ", cameraType='" + cameraType + '\'' +
+                ", manualInIdCard=" + manualInIdCard +
+                ", manualInIdCardAuth=" + manualInIdCardAuth +
                 '}';
     }
-
-    public static class ManualInIdCardAuthDTO {
-        public String  appId;
-        public String appKey;
-        public String appSecret;
-        public String privateKey;
-
-        public String getAppId() {
-            return appId;
-        }
-
-        public void setAppId(String appId) {
-            this.appId = appId;
-        }
-
-        public String getAppKey() {
-            return appKey;
-        }
-
-        public void setAppKey(String appKey) {
-            this.appKey = appKey;
-        }
-
-        public String getAppSecret() {
-            return appSecret;
-        }
-
-        public void setAppSecret(String appSecret) {
-            this.appSecret = appSecret;
-        }
-
-        public String getPrivateKey() {
-            return privateKey;
-        }
-
-        public void setPrivateKey(String privateKey) {
-            this.privateKey = privateKey;
-        }
-
-        @Override
-        public String toString() {
-            return "ManualInIdCardAuthDTO{" +
-                    "appId='" + appId + '\'' +
-                    ", appKey='" + appKey + '\'' +
-                    ", appSecret='" + appSecret + '\'' +
-                    ", privateKey='" + privateKey + '\'' +
-                    '}';
-        }
-    }
 }

+ 4 - 0
app/src/main/java/com/hh/arome/common/Constants.java

@@ -174,6 +174,10 @@ public class Constants {
 
         public static final String ZP_A10 = "A10";
 
+        // 紫鹏-X5 有的是A50R3
+        public static final String ZP_A50 = "A50";
+
+
     }
 
 

+ 44 - 30
app/src/main/java/com/hh/arome/ui/MainActivity.java

@@ -481,8 +481,8 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
     }
 
     IDeviceUI iDeviceUI;
-    int dispalyWidth;
-    int dispalyHeight;
+    int displayWidth;
+    int displayHeight;
 
     @Override
     protected void initData() {
@@ -524,10 +524,10 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
 
         // 获取设备宽高
         DisplayMetrics dm = getResources().getDisplayMetrics();
-        dispalyWidth = dm.widthPixels;
-        dispalyHeight = dm.heightPixels;
-        AppLogUtils.e("dispalyWidth:"+dispalyWidth);
-        AppLogUtils.e("dispalyHeight:"+dispalyHeight);
+        displayWidth = dm.widthPixels;
+        displayHeight = dm.heightPixels;
+        AppLogUtils.e("displayWidth:"+displayWidth);
+        AppLogUtils.e("displayHeight:"+displayHeight);
 
 
         // 权限
@@ -875,37 +875,40 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
 //        ArrayList<String> blackList = new ArrayList<>();
 //        blackList.add("2021002163620647");
 //        themeConfig.putStringArrayList("floatWindowBlacklist", blackList);
-
+        
+        AppLogUtils.e("displayWidth--"+displayWidth);
+        AppLogUtils.e("displayHeight--"+displayHeight);
 
         //竖屏配置,若没有可以不配置
         Bundle portrait = new Bundle();
         //竖屏默认默认值是2 可参考https://opendocs.alipay.com/mini/00v8et?pathHash=8d2d3fa2#3.1%20%E5%90%AF%E5%8A%A8
         portrait.putInt("showType", 2);
-        //默认750 小程序显示的宽度750就是按给定窗口的大小显示,如果是375则是给定窗口大小的一半显示
-        portrait.putInt("launchWidth", dispalyWidth);
+
+
         //横屏配置,若没有可以不配置
         Bundle landscape = new Bundle();
         //横屏默认值是123
         landscape.putInt("showType", 2);
-//        landscape.putInt("launchWidth", 750);
-        landscape.putInt("launchWidth", dispalyWidth);
+
+
+        if(deviceModel.contains(Constants.DeviceModel.ZP_A50)){
+            // 紫鹏X5的配置。按照获取的值左右有边距
+            //竖屏配置的宽度  默认750 小程序显示的宽度750就是按给定窗口的大小显示,如果是375则是给定窗口大小的一半显示
+            portrait.putInt("launchWidth", 750);
+            // 横屏配置的宽度
+            landscape.putInt("launchWidth", 750);
+        }else{
+            //竖屏配置的宽度  默认750 小程序显示的宽度750就是按给定窗口的大小显示,如果是375则是给定窗口大小的一半显示
+            portrait.putInt("launchWidth", displayWidth);
+            // 横屏配置的宽度
+            landscape.putInt("launchWidth", displayWidth);
+        }
+
 
         themeConfig.putBundle("portrait", portrait);
         themeConfig.putBundle("landscape", landscape);
 
 
-//        // 设置自定义titlebar资源加载路径
-//        File resourcePath = new File(MainActivity.this.getExternalFilesDir(null), "cache");
-//        File newFile = new File(resourcePath, "titlebarResPkg-debug.apk");
-//        AppLogUtils.e("newFile--"+newFile.getAbsolutePath());
-//        if (newFile.exists()) {
-//            Uri contentUri = FileProvider.getUriForFile(MainActivity.this, "com.alipay.arome.aromedemo.fileprovider", newFile);
-//            AppLogUtils.e("ampe---contentUri is " + contentUri);
-//            MainActivity.this.grantUriPermission("com.alipay.arome.app", contentUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
-//            themeConfig.putString("localAssetApkPath", contentUri.toString());
-//            themeConfig.putString("localAssetPkgName", "com.example.titlebarResPkg");
-//        }
-
         // 设备信息配置
         Bundle deviceConfig = new Bundle();
         //用于接收广播的应用包名
@@ -3208,28 +3211,31 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
             }
             // 聚合授权-------end
 
+            AppLogUtils.e("displayHeight:"+displayHeight);
+            AppLogUtils.e("displayWidth:"+displayWidth);
+
 
             if(Constants.DeviceModel.D2.equals(deviceModel)){
 
-                AppLogUtils.e("dispalyHeight:"+dispalyHeight);
-                AppLogUtils.e("displayWidth:"+dispalyHeight*0.625);
-                AppLogUtils.e("displayX:"+(dispalyWidth-(dispalyHeight*0.625))/2);
+                AppLogUtils.e("displayHeight:"+displayHeight);
+                AppLogUtils.e("displayWidth:"+displayHeight*0.625);
+                AppLogUtils.e("displayX:"+(displayWidth-(displayHeight*0.625))/2);
 
                 // D2访客机刷脸屏幕设置-----begin
                 // 是否悬浮,默认false
                 extInfo.put("isFloat",true);
                 // 显示X偏移,默认0    (宽度-刷脸界面宽度)/2   越大越往右边偏移
-                extInfo.put("displayX",(dispalyWidth-(dispalyHeight*0.625))/2+41);
+                extInfo.put("displayX",(displayWidth-(displayHeight*0.625))/2+41);
 //            extInfo.put("displayX",0);
                 // 显示Y偏移,默认0
                 extInfo.put("displayY",-300);
 //            extInfo.put("displayY",0);
                 // 显示宽度,默认屏幕宽度
 //            extInfo.put("displayWidth",675);
-                extInfo.put("displayWidth",(dispalyHeight*0.625));// 如果+1.5的话,就会是悬浮状态(其余黑色)
+                extInfo.put("displayWidth",(displayHeight*0.625));// 如果+1.5的话,就会是悬浮状态(其余黑色)
                 // 显示宽度,默认屏幕⾼度
 //            extInfo.put("displayHeight",1080);
-                extInfo.put("displayHeight",dispalyHeight);
+                extInfo.put("displayHeight",displayHeight);
                 // 主副屏,0主 1副
                 extInfo.put("displayMode",0);
                 // D2访客机刷脸屏幕设置-----end
@@ -5190,6 +5196,9 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
 
         AppLogUtils.e("invoke -- params = " + params.toString());
 
+        // 打印用
+        final Map<String, Object> paramsNew = params;
+
         BPaaSApi.getInstance().invoke(ConfigData.getDeviceConfigResultBean().getAbcpAppId(),
                 "BPaasVerifyID", params, mSessionId, new BPaaSCallback() {
                     @Override
@@ -5198,6 +5207,8 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
                         // 非主线程
                         AppLogUtils.e("---调用刷脸invoke onResponse = " + new Gson().toJson(bPaaSResponse) + "-----CardOrCode = " + CardOrCode);
 
+
+
                         int code = bPaaSResponse.getCode();
 
                         // 日志开始----------------begin
@@ -5208,8 +5219,11 @@ public class MainActivity extends BaseHHActivity implements DeviceConfigContract
                         // 日志内容
                         StringBuilder logContentSb = new StringBuilder();
                         logContentSb.append(logNode).append(WARP)
+                                .append("params = ").append(paramsNew).append(WARP)
                                 .append("code = ").append(code).append(WARP)
-                                .append("bPaaSResponse = ").append(bPaaSResponse);
+                                .append("bPaaSResponse = ").append(bPaaSResponse).append(WARP)
+                                .append("bPaaSResponseJson = ").append(gson.toJson(bPaaSResponse)).append(WARP)
+                        ;
 
                         // 开始保存本地日志
                         AppLogUtils.saveLog(LogType.Logcat, new StringBuilder()

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

@@ -29,10 +29,10 @@ public final class DeviceUtils {
             Method get = c.getMethod("get", String.class);
             if (Build.VERSION.SDK_INT <= 28) {//28 is andoird 9.0 24-7.0 22-5.1
                 serial = (String) get.invoke(c, "ro.serialno");
-                AppLogUtils.e("SDK_INT <= 28--serial:"+serial);
+                AppLogUtils.i("SDK_INT <= 28--serial:"+serial);
             } else {
                 serial = (String) get.invoke(c, "persist.sys.hrSerial");//vendor.gsm.serial
-                AppLogUtils.e("SDK_INT > 28--serial:"+serial);
+                AppLogUtils.i("SDK_INT > 28--serial:"+serial);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -48,7 +48,7 @@ public final class DeviceUtils {
 
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                 serial = Build.getSerial();
-                AppLogUtils.e("SDK_INT >= O--serial:"+serial);
+                AppLogUtils.i("SDK_INT >= O--serial:"+serial);
                 if(!TextUtils.isEmpty(serial)&&!serial.equals("unknown")) {
                     // 判断非空和非unknown,则返回
                     return serial;
@@ -59,7 +59,7 @@ public final class DeviceUtils {
 
             if(TextUtils.isEmpty(serial)) {
                 serial = Build.SERIAL;
-                AppLogUtils.e("SDK_INT < O--serial:"+serial);
+                AppLogUtils.i("SDK_INT < O--serial:"+serial);
                 if(!TextUtils.isEmpty(serial)&&!serial.equals("unknown")) {
                     // 判断非空和非unknown,则返回
                     return serial;

+ 2 - 2
config.gradle

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