diff --git a/CHANGELOG.md b/CHANGELOG.md index 25393503674da35e2f1719c285b38c1da8e3158a..e23e5a89994ba55301d5f23966a216529789767d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.0.2-SNAPSHOT +* 修改FindBugs + ## 0.0.1-SNAPSHOT ohos第一个版本 * 实现了原库的大部分api diff --git a/README.md b/README.md index 63eca1d26cb923bc37b91f9d58fa95e1423478bc..e9a559f3546546291e1156fdc585f208890634e0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ - 项目移植状态:获取设备IMSI未实现 - 调用差异:无 - 基线版本:Release v1.1 -- 开发版本:sdk5,DevEco Studio 2.1 Release +- 开发版本:sdk6,DevEco Studio 2.2 Beta1 #### 效果演示 @@ -29,11 +29,11 @@ allprojects { 2.在entry模块的build.gradle文件中 ```gradle dependencies { - implementation('com.gitee.chinasoft_ohos:safe-java-js-webview-bridge:0.0.1-SNAPSHOT') + implementation('com.gitee.chinasoft_ohos:safe-java-js-webview-bridge:0.0.2-SNAPSHOT') ...... } ``` -在sdk5,DevEco Studio 2.1 Release下项目可直接运行,如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 +在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行,如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 #### 使用说明 @@ -176,7 +176,7 @@ CodeCheck代码测试无异常 CloudTest代码测试无异常 -火绒安全病毒安全检测通过 +病毒安全检测通过 当前版本demo功能与原组件基本无差异 diff --git a/build.gradle b/build.gradle index 83d884f02e8af69834e5d58b7b639f22d0a08708..bf479ca657fb6b63c48c13c097af23041e8b2e1e 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.huawei.ohos.app' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } @@ -19,8 +19,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.4.2' - classpath 'com.huawei.ohos:decctest:1.0.0.6' + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' } } diff --git a/library/build.gradle b/library/build.gradle index 92793218e9f37fdd28f85e7fb27e751c08a2c520..0f12dfb2b98a91f6d5f2d0828ded814d4f9ec934 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.huawei.ohos.library' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/library/src/main/config.json b/library/src/main/config.json index b2adf3e62b06ee8bc483b96245c98d3c35ba67d3..0268a73a01e9934942bbad75bf2f9b3fcdbe1d31 100644 --- a/library/src/main/config.json +++ b/library/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": { diff --git a/library/src/main/java/cn/pedant/SafeWebViewBridge/JsCallJava.java b/library/src/main/java/cn/pedant/SafeWebViewBridge/JsCallJava.java index 952ab3dc20f600428cf2eb68b329ac9481716a33..e659db888fe09569817b82a9af8dfca295b03649 100644 --- a/library/src/main/java/cn/pedant/SafeWebViewBridge/JsCallJava.java +++ b/library/src/main/java/cn/pedant/SafeWebViewBridge/JsCallJava.java @@ -78,7 +78,7 @@ public class JsCallJava { } private String genJavaMethodSign(Method method) { - String sign = method.getName(); + StringBuilder sign = new StringBuilder(method.getName()); Class[] argsTypes = method.getParameterTypes(); int len = argsTypes.length; if (len < 1 || argsTypes[0] != WebView.class) { @@ -88,23 +88,23 @@ public class JsCallJava { for (int kk = 1; kk < len; kk++) { Class cls = argsTypes[kk]; if (cls == String.class) { - sign += "_S"; + sign.append("_S"); } else if (cls == int.class || cls == long.class || cls == float.class || cls == double.class) { - sign += "_N"; + sign.append("_N"); } else if (cls == boolean.class) { - sign += "_B"; + sign.append("_B"); } else if (cls == JsonObject.class) { - sign += "_O"; + sign.append("_O"); } else if (cls == JsCallback.class) { - sign += "_F"; + sign.append("_F"); } else { - sign += "_P"; + sign.append("_P"); } } - return sign; + return sign.toString(); } /** diff --git a/sample/build.gradle b/sample/build.gradle index 718f09660cf3c716cfabcb5da80861ffd706cfbf..6f79f10aa00549191dc9ce1ba376889bfc1c2aee 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.huawei.ohos.hap' apply plugin: 'com.huawei.ohos.decctest' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/sample/src/main/config.json b/sample/src/main/config.json index 238ada5d24bcf1659f06cd0119d17f0806a694f0..14130750370c17449a480a2648cb776f9abd3ec9 100644 --- a/sample/src/main/config.json +++ b/sample/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": { @@ -28,7 +23,8 @@ "distro": { "deliveryWithInstall": true, "moduleName": "sample", - "moduleType": "entry" + "moduleType": "entry", + "installationFree":false }, "abilities": [ { diff --git a/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/HostJsScope.java b/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/HostJsScope.java index 63b60859f06add3ec43742eac8524cbe16a33bec..166ec5a16f5bb087b326fdcb5ab41f4902c85383 100644 --- a/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/HostJsScope.java +++ b/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/HostJsScope.java @@ -226,6 +226,30 @@ public class HostJsScope { int intField; String strField; boolean isBoolField; + + public int getIntField() { + return intField; + } + + public void setIntField(int intField) { + this.intField = intField; + } + + public String getStrField() { + return strField; + } + + public void setStrField(String strField) { + this.strField = strField; + } + + public boolean isBoolField() { + return isBoolField; + } + + public void setBoolField(boolean boolField) { + isBoolField = boolField; + } } /** @@ -236,9 +260,9 @@ public class HostJsScope { */ public static List retJavaObject(WebView view) { RetJavaObj obj = new RetJavaObj(); - obj.intField = 1; - obj.strField = "mine str"; - obj.isBoolField = true; + obj.setIntField(1); + obj.setStrField("mine str"); + obj.setBoolField(true); List rets = new ArrayList(); rets.add(obj); return rets; diff --git a/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/WebAbilitySlice.java b/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/WebAbilitySlice.java index 83967dbea83e3c6865c7055e8be07e1d2b5d9693..716a7284cdf64fec24fcf43a9ab3430380341ddc 100644 --- a/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/WebAbilitySlice.java +++ b/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/WebAbilitySlice.java @@ -45,7 +45,7 @@ public class WebAbilitySlice extends AbilitySlice { super.onForeground(intent); } - public class CustomChromeClient extends InjectedChromeClient { + static class CustomChromeClient extends InjectedChromeClient { /** * 构造 * diff --git a/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/util/TaskExecutor.java b/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/util/TaskExecutor.java index e623c5066be1d1854b660793afef5ce65e02f4c3..604edcb4ff2f022490d423671a738910bfcfeaac 100644 --- a/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/util/TaskExecutor.java +++ b/sample/src/main/java/cn/pedant/SafeWebViewBridge/sample/util/TaskExecutor.java @@ -22,18 +22,18 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TaskExecutor { - private static ScheduledThreadPoolExecutor gScheduledThreadPoolExecutor = null; - private static EventHandler gMainHandler = null; + private static volatile ScheduledThreadPoolExecutor gScheduledThreadPoolExecutor = null; + private static volatile EventHandler gMainHandler = null; /** * 不包含网络传输处理过程的线程池执行对象 */ - private static ExecutorService gThreadPoolExecutor = null; + private static volatile ExecutorService gThreadPoolExecutor = null; /** * 包含网络传输处理过程的线程池执行对象 */ - private static ExecutorService gNetProcessThreadPoolExecutor = null; + private static volatile ExecutorService gNetProcessThreadPoolExecutor = null; /** * 执行不包含网络传输处理过程的线程