From b93c6422dc2cd505c7434b6ed1ca829f08b758a2 Mon Sep 17 00:00:00 2001 From: Handsome_Afraican_Man Date: Wed, 28 Jun 2023 16:24:28 +0800 Subject: [PATCH] IssueNo:#I7GQLF Description:switch hvigor Sig:bundleManager Feature or Bugfix:Feature Binary Source:No Signed-off-by: zhouwenzhi --- adapter/ohos/ModuleJsonUtil.java | 33 +++++++++++----- modulecheck/module.json | 66 +++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 12 deletions(-) diff --git a/adapter/ohos/ModuleJsonUtil.java b/adapter/ohos/ModuleJsonUtil.java index bc17d302..dbae6be0 100644 --- a/adapter/ohos/ModuleJsonUtil.java +++ b/adapter/ohos/ModuleJsonUtil.java @@ -90,6 +90,7 @@ class ModuleJsonUtil { private static final String COMPILE_SDK_VERSION = "compileSdkVersion"; private static final String COMPILE_SDK_TYPE = "compileSdkType"; private static final String PROXY_DATAS = "proxyDatas"; + private static final String PROXY_DATA = "proxyData"; private static final String PROXY_URI = "uri"; private static final Log LOG = new Log(ModuleJsonUtil.class.toString()); @@ -1420,18 +1421,30 @@ class ModuleJsonUtil { throw new BundleException("parse JOSNObject failed in parseProxyDataUri."); } JSONObject moduleObj = jsonObject.getJSONObject(MODULE); - if (!moduleObj.containsKey(PROXY_DATAS)) { + if (!moduleObj.containsKey(PROXY_DATAS) && !moduleObj.containsKey(PROXY_DATA)) { return proxyDataUris; - } - JSONArray proxyDatas = moduleObj.getJSONArray(PROXY_DATAS); - for (int i = 0; i < proxyDatas.size(); ++i) { - JSONObject itemObj = proxyDatas.getJSONObject(i); - if (!itemObj.containsKey(PROXY_URI)) { - LOG.error("parse JOSNObject failed in parseProxyDataUri."); - throw new BundleException("parse JOSNObject failed in parseProxyDataUri."); + } else if (moduleObj.containsKey(PROXY_DATA)) { + JSONArray proxyData = moduleObj.getJSONArray(PROXY_DATA); + for (int i = 0; i < proxyData.size(); ++i) { + JSONObject itemObj = proxyData.getJSONObject(i); + if (!itemObj.containsKey(PROXY_URI)) { + LOG.error("parse JOSNObject failed in parseProxyDataUri."); + throw new BundleException("parse JOSNObject failed in parseProxyDataUri."); + } + String uri = itemObj.getString(PROXY_URI); + proxyDataUris.add(uri); + } + } else { + JSONArray proxyDatas = moduleObj.getJSONArray(PROXY_DATAS); + for (int i = 0; i < proxyDatas.size(); ++i) { + JSONObject itemObj = proxyDatas.getJSONObject(i); + if (!itemObj.containsKey(PROXY_URI)) { + LOG.error("parse JOSNObject failed in parseProxyDataUri."); + throw new BundleException("parse JOSNObject failed in parseProxyDataUri."); + } + String uri = itemObj.getString(PROXY_URI); + proxyDataUris.add(uri); } - String uri = itemObj.getString(PROXY_URI); - proxyDataUris.add(uri); } return proxyDataUris; } diff --git a/modulecheck/module.json b/modulecheck/module.json index b7a671bc..c2dc2aed 100644 --- a/modulecheck/module.json +++ b/modulecheck/module.json @@ -128,7 +128,8 @@ "atomicService", "generateBuildHash", "proxyDatas", - "isolationMode" + "isolationMode", + "proxyData" ] }, "required": [ @@ -175,7 +176,8 @@ "atomicService", "generateBuildHash", "proxyDatas", - "isolationMode" + "isolationMode", + "proxyData" ] }, "required": [ @@ -1243,6 +1245,7 @@ }, "proxyDatas": { "description": "Indicates all the proxy data of the module.", + "deprecationMessage": "Deprecated since api 10, use proxyData instead.", "type": "array", "items": { "type": "object", @@ -1310,6 +1313,65 @@ "nonisolationFirst" ], "default": "nonisolationFirst" + }, + "proxyData": { + "description": "Indicates all the proxy data of the module.", + "type": "array", + "items": { + "type": "object", + "required": [ + "uri" + ], + "propertyNames": { + "enum": [ + "uri", + "requiredReadPermission", + "requiredWritePermission", + "metadata" + ] + }, + "properties": { + "uri": { + "description": "Indicates the uri of the data proxy.", + "type": "string", + "pattern": "^datashareproxy:", + "maxLength": 255 + }, + "requiredReadPermission": { + "description": "Indicates the permission required to read data from the proxy.", + "type": "string", + "maxLength": 255 + }, + "requiredWritePermission": { + "description": "Indicates the permission required to write data to the proxy.", + "type": "string", + "maxLength": 255 + }, + "metadata": { + "description": "Indicates the metadata of the proxy.", + "type": "object", + "propertyNames": { + "enum": [ + "name", + "resource" + ] + }, + "properties": { + "name": { + "description": "Indicates the key of a data element. The value is a string with a maximum of 255 bytes.", + "type": "string", + "maxLength": 255 + }, + "resource": { + "description": "Indicates the resource of a data element.", + "type": "string", + "pattern": "^[$]profile:[0-9a-zA-Z_.]+|(?=.*[{])(?=.*[}])[0-9a-zA-Z_.{}]+$", + "maxLength": 255 + } + } + } + } + } } } } -- Gitee