diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json index 28a55ddb65354e29174945a7afb0339a9e119969..c9b3aef9d608692e7c5b23ddc592f90557a41f40 100644 --- a/AppScope/resources/base/element/string.json +++ b/AppScope/resources/base/element/string.json @@ -2,20 +2,12 @@ "string": [ { "name": "app_name", - "value": "CameraSample" + "value": "CameraDataCollection" }, { "name": "CONTENT_TYPE_UNKNOWN", "value": "未知类型" }, - { - "name": "ALLOW_WLAN", - "value": "允许“相机”使用无线数据?" - }, - { - "name": "reason", - "value": "保存图片" - }, { "name": "CLOSE_WLAN", "value": "关闭无线数据时,部分功能可能无法使用。" diff --git a/README.md b/README.md index bd6c5e9111a9ad1d5ff4551403127d9fb78bf6e2..d2e2de4ba8f85725d18d4befb8c1729642cd32dc 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ | ![auth](screenshot/device/ndk_camera.png) | 使用说明 -1. 弹出是否允许“CameraSample”使用相机?点击“允许” -2. 弹出是否允许“CameraSample”使用麦克风?点击“允许” -3. 弹出是否允许“CameraSample”访问文件?点击“允许” -4. 弹出是否允许“CameraSample”访问图片和视频?点击“允许” +1. 弹出是否允许“相机数据采集保存”使用相机?点击“允许” +2. 弹出是否允许“相机数据采集保存”使用麦克风?点击“允许” +3. 弹出是否允许“相机数据采集保存”访问文件?点击“允许” +4. 弹出是否允许“相机数据采集保存”访问图片和视频?点击“允许” 5. 进入预览界面,预览正常,点击画面模糊处,画面会变得清晰,对焦效果明显 6. 进入预览界面,预览正常,上下滑动屏幕,屏幕场景亮度发生变化,曝光效果明显 7. 进入预览界面,预览正常,进入拍照模式,点击拍照按钮,拍照正常,左下角会生成照片缩略图,点击左下角缩略图,能够跳转到图库,图片保存正常,打开图片显示正常 diff --git a/entry/obfuscation-rules.txt b/entry/obfuscation-rules.txt index 985b2aeb7658286b17bd26eab8f217c3fe75ea8b..a1dfa0bd175984dc49e641436aa67b1de1b8abeb 100644 --- a/entry/obfuscation-rules.txt +++ b/entry/obfuscation-rules.txt @@ -15,4 +15,8 @@ # Keep options: # -keep-property-name: specifies property names that you want to keep -# -keep-global-name: specifies names that you want to keep in the global scope \ No newline at end of file +# -keep-global-name: specifies names that you want to keep in the global scope +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 6e1ae0a4ce95985aa8cca0012ed44a27b12bc80a..0a9e1298f21f02600e7b9970a8e0633da1689489 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -112,10 +112,7 @@ struct Index { this.atManager.requestPermissionsFromUser(this.appContext, [ 'ohos.permission.CAMERA', 'ohos.permission.MICROPHONE', - 'ohos.permission.READ_MEDIA', - 'ohos.permission.WRITE_MEDIA', - 'ohos.permission.WRITE_IMAGEVIDEO', - 'ohos.permission.READ_IMAGEVIDEO' + 'ohos.permission.WRITE_IMAGEVIDEO' ]).then(() => { Logger.info(TAG, `request Permissions success!`); this.onShow = true; diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index c9054eae6785dab8826ef975b9700193def67bbc..8722f47520579dc2e92e0a85a17fb0c0ba3129e2 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -37,33 +37,33 @@ "requestPermissions": [ { "name": "ohos.permission.CAMERA", - "reason": "$string:ALLOW_WLAN", - "usedScene": {} + "reason": "$string:reason_camera", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } }, { "name": "ohos.permission.MICROPHONE", - "reason": "$string:ALLOW_WLAN", - "usedScene": {} - }, - { - "name": "ohos.permission.WRITE_MEDIA", - "reason": "$string:ALLOW_WLAN", - "usedScene": {} - }, - { - "name": "ohos.permission.READ_MEDIA", - "reason": "$string:ALLOW_WLAN", - "usedScene": {} + "reason": "$string:reason_microphone", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } }, { "name": "ohos.permission.WRITE_IMAGEVIDEO", - "reason": "$string:reason", - "usedScene": {} - }, - { - "name": "ohos.permission.READ_IMAGEVIDEO", - "reason": "$string:reason", - "usedScene": {} + "reason": "$string:reason_write_imagevideo", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } } ] } diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index c2e8e96d56e48afc1284869a6f8428549161ffab..bf5f3fa26ab27e0980be6b5e120b7d11da81fec9 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "ndk_camera_demo" + "value": "CameraDataCollection" }, { "name": "photo", @@ -19,6 +19,18 @@ { "name": "video", "value": "video" + }, + { + "name": "reason_camera", + "value": "Used for taking photos and recording videos" + }, + { + "name": "reason_microphone", + "value": "Used for recording audio during video recording" + }, + { + "name": "reason_write_imagevideo", + "value": "Used for saving photos and videos" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index c2e8e96d56e48afc1284869a6f8428549161ffab..bf5f3fa26ab27e0980be6b5e120b7d11da81fec9 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "ndk_camera_demo" + "value": "CameraDataCollection" }, { "name": "photo", @@ -19,6 +19,18 @@ { "name": "video", "value": "video" + }, + { + "name": "reason_camera", + "value": "Used for taking photos and recording videos" + }, + { + "name": "reason_microphone", + "value": "Used for recording audio during video recording" + }, + { + "name": "reason_write_imagevideo", + "value": "Used for saving photos and videos" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index 432bd4552af19d4d7753eaf62314fd6fc3090a66..65c0162d2a7bd0f9e68adb94f463c0797f8d8343 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "ndk_camera_demo" + "value": "相机数据采集保存" }, { "name": "photo", @@ -19,6 +19,18 @@ { "name": "video", "value": "录像" + }, + { + "name": "reason_camera", + "value": "用于拍照录像" + }, + { + "name": "reason_microphone", + "value": "用于录像录制音频" + }, + { + "name": "reason_write_imagevideo", + "value": "用于保存照片录像" } ] } \ No newline at end of file