diff --git a/BUILD.gn b/BUILD.gn
index f2f0f0befcebec4bbf9bcadac510a212e03e2508..455086d1637f31292256a417b1a455d6531ac7c8 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -24,6 +24,7 @@ group("accesstoken_build_module_test") {
"//base/security/access_token/interfaces/innerkits/privacy/test:unittest",
"//base/security/access_token/interfaces/innerkits/token_setproc/test:unittest",
"//base/security/access_token/services/accesstokenmanager/test:unittest",
+ "//base/security/access_token/services/privacymanager/test:unittest",
]
}
if (token_sync_enable == true) {
diff --git a/frameworks/privacy/BUILD.gn b/frameworks/privacy/BUILD.gn
index e0106a79d2849a5394bd962dd8c177b0bba4b6f4..0104023ca9147968e715a6af1f95ccc4a6d7d3f1 100644
--- a/frameworks/privacy/BUILD.gn
+++ b/frameworks/privacy/BUILD.gn
@@ -34,6 +34,4 @@ ohos_shared_library("privacy_communication_adapter_cxx") {
]
deps = [ "//utils/native/base:utils" ]
-
- external_deps = [ "ipc:ipc_core" ]
}
diff --git a/services/privacymanager/BUILD.gn b/services/privacymanager/BUILD.gn
index 5d00d6c6548f26200e0d992ec0c9d823725763ab..ce8afb375a3083536a1c344fe32c5922d56caa27 100644
--- a/services/privacymanager/BUILD.gn
+++ b/services/privacymanager/BUILD.gn
@@ -29,6 +29,7 @@ if (is_standard_system) {
"include/common",
"include/database",
"include/record",
+ "include/sensitive",
"include/service",
"//base/security/access_token/frameworks/privacy/include",
"//base/security/access_token/frameworks/common/include",
@@ -51,6 +52,7 @@ if (is_standard_system) {
"src/record/permission_record_repository.cpp",
"src/record/permission_visitor.cpp",
"src/record/permission_visitor_repository.cpp",
+ "src/sensitive/global_switch_manager.cpp",
"src/service/privacy_manager_service.cpp",
"src/service/privacy_manager_stub.cpp",
]
@@ -63,11 +65,17 @@ if (is_standard_system) {
"//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
"//base/security/access_token/services/common/database:accesstoken_database_cxx",
"//base/security/access_token/services/privacymanager:privacy.rc",
+ "//base/security/access_token/services/privacymanager/dialog_ui:dialog_js_files_etc",
+ "//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr",
"//third_party/sqlite:sqlite",
"//utils/native/base:utils",
]
external_deps = [
+ "ability_base:want",
+ "bundle_framework:appexecfwk_base",
+ "bundle_framework:appexecfwk_core",
+ "hiviewdfx_hilog_native:libhilog",
"hiviewdfx_hilog_native:libhilog",
"init:libbegetutil",
"ipc:ipc_core",
diff --git a/services/privacymanager/dialog_ui/BUILD.gn b/services/privacymanager/dialog_ui/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..0668d56455dd3c0396f2c221bf796e063591cb22
--- /dev/null
+++ b/services/privacymanager/dialog_ui/BUILD.gn
@@ -0,0 +1,27 @@
+# Copyright (c) 2022 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//base/notification/distributed_notification_service/notification.gni")
+import("//foundation/arkui/ace_engine/build/ace_gen_sa_dialog_js.gni")
+
+gen_sa_dialog_js("dialog_js_files_etc") {
+ project_path = "//base/security/access_token/services/privacymanager/dialog_ui/"
+ i18n_files = [
+ "i18n/en-US.json",
+ "i18n/zh-CN.json",
+ ]
+ common_files = []
+ dialog_name = "global_switch_dialog"
+ subsystem_name = "security"
+ part_name = "access_token"
+}
diff --git a/services/privacymanager/dialog_ui/common/.gitkeep b/services/privacymanager/dialog_ui/common/.gitkeep
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/services/privacymanager/dialog_ui/i18n/en-US.json b/services/privacymanager/dialog_ui/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..c5ec0165bab1fe1081e50b8f68a95fb123f725b2
--- /dev/null
+++ b/services/privacymanager/dialog_ui/i18n/en-US.json
@@ -0,0 +1,7 @@
+{
+ "message":{
+ "request": "Allowed to send notification?",
+ "allowButton": "Allow",
+ "cancelButton": "Cancel"
+ }
+}
diff --git a/services/privacymanager/dialog_ui/i18n/zh-CN.json b/services/privacymanager/dialog_ui/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..e0d70632552bddbbfa8dda5dffb111e63841b4a1
--- /dev/null
+++ b/services/privacymanager/dialog_ui/i18n/zh-CN.json
@@ -0,0 +1,7 @@
+{
+ "message": {
+ "request": "正在申请开启本机摄像头功能",
+ "allowButton": "开启",
+ "cancelButton": "拒绝"
+ }
+}
diff --git a/services/privacymanager/dialog_ui/pages/index/index.css b/services/privacymanager/dialog_ui/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..727c1ea7124c62f566b86c2d1d7db1f0ee210464
--- /dev/null
+++ b/services/privacymanager/dialog_ui/pages/index/index.css
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ .container {
+ height: 100%;
+ width: 100%;
+ position: relative;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.global-dialog {
+ width: 397vp;
+ height: 117vp;
+ border-radius: 32vp;
+ align-items: center;
+ background-color: rgba(255, 255, 255, 1);
+ display: flex;
+ flex-direction: column;
+ box-shadow: 2vp 2vp 2vp #888888;
+}
+
+.title-bar {
+ width: 100%;
+ height: 34vp;
+ font-size: 14fp;
+ font-weight: 400;
+ word-break: break-word;
+ text-color: #182431;
+ opacity: 1;
+ text-align: center;
+ margin-top: 24vp;
+ font-family: 'HarmonyHeiTi';
+}
+
+.btn-group {
+ align-items: center;
+ flex-direction: row;
+ display: flex;
+ justify-content: center;
+}
+
+.btn-inner {
+ width: 116vp;
+ height: 40vp;
+ margin: 16vp 4vp 16vp 4.5vp;
+ align-items: center;
+}
+
+.btn {
+ width: 100vp;
+ height: 22vp;
+ font-size: 16fp;
+ background-color: rgba(255, 255, 255, 1);
+ text-color: #0d81f2;
+ line-height: 22vp;
+ font-weight: 500;
+ margin: 9vp 8vp;
+}
+
+.split {
+ width: 0.5vp;
+ height: 24vp;
+ background-color: rgba(0, 0, 0, 0.2);
+ align-self: center;
+}
+
+.center {
+ position: relative;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
diff --git a/services/privacymanager/dialog_ui/pages/index/index.hml b/services/privacymanager/dialog_ui/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..c0d544e8cce0fc6f68ac8646af90efcba52c7ce4
--- /dev/null
+++ b/services/privacymanager/dialog_ui/pages/index/index.hml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ {{ prompt }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/services/privacymanager/dialog_ui/pages/index/index.js b/services/privacymanager/dialog_ui/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e5983709c5aa5ca7882d81679abccd4f9bb6d39f
--- /dev/null
+++ b/services/privacymanager/dialog_ui/pages/index/index.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import router from '@ohos.router'
+
+export default {
+ data: {
+ prompt: '',
+ allowButton: '',
+ cancelButton: '',
+ },
+ onInit() {
+ console.info('getParams: ' + JSON.stringify(router.getParams()));
+ this.prompt = router.getParams()['bundleName'] + this.$t("message.request") + '?'
+ this.allowButton = this.$t('message.allowButton');
+ this.cancelButton = this.$t('message.cancelButton');
+ },
+ onAllow() {
+ console.info('clicked allow');
+ callNativeHandler("EVENT_ALLOW", "allow");
+ },
+ onCancel() {
+ console.info('clicked cancel');
+ callNativeHandler("EVENT_CANCEL", "cancel");
+ },
+}
diff --git a/services/privacymanager/include/sensitive/application_status_change_callback.h b/services/privacymanager/include/sensitive/application_status_change_callback.h
new file mode 100644
index 0000000000000000000000000000000000000000..b8d0be5713d6f592c6637d0afaff5d4f16b84e12
--- /dev/null
+++ b/services/privacymanager/include/sensitive/application_status_change_callback.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APPLICATION_STATUS_CHANGE_CALLBACK_H
+#define APPLICATION_STATUS_CHANGE_CALLBACK_H
+
+#include "iapplication_state_observer.h"
+
+namespace OHOS {
+namespace Security {
+namespace AccessToken {
+class ApplicationStatusChangeCallback : public IApplicationStateObserver {
+public:
+ void OnForegroundApplicationChange(const AppStateData& appStateData) override;
+ void OnProcessDied(const ProcesData& processData) override;
+ uint32_t tokenId_ = 0;
+ int32_t state = 0;
+};
+} // namespace AccessToken
+} // namespace Security
+} // namespace OHOS
+#endif // APPLICATION_STATUS_CHANGE_CALLBACK_H
diff --git a/services/privacymanager/include/sensitive/camera_float_window_change_callback.h b/services/privacymanager/include/sensitive/camera_float_window_change_callback.h
new file mode 100644
index 0000000000000000000000000000000000000000..54ff119c01fb1571d0b6eb6c16f987948cc48c40
--- /dev/null
+++ b/services/privacymanager/include/sensitive/camera_float_window_change_callback.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CAMERA_FLOAT_WINDOW_CALLBACK_H
+#define CAMERA_FLOAT_WINDOW_CALLBACK_H
+
+#include "window_manager.h"
+
+namespace OHOS {
+namespace Security {
+namespace AccessToken {
+class CameraFloatWindowChangeCallback : public Rosen::ICameraFloatWindowChangedListener {
+public:
+ void OnCameraFloatWindowChange(uint32_t accessTokenId, bool isShowing) override;
+ uint32_t tokenId_ = 0;
+ bool isShow_ = false;
+};
+} // namespace AccessToken
+} // namespace Security
+} // namespace OHOS
+#endif // CAMERA_FLOAT_WINDOW_CALLBACK_H
diff --git a/services/privacymanager/include/sensitive/global_switch_change_callback.h b/services/privacymanager/include/sensitive/global_switch_change_callback.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4f4343aaec9d624e0fe9d5e95e3839c1db4b0e9
--- /dev/null
+++ b/services/privacymanager/include/sensitive/global_switch_change_callback.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GLOBAL_SWITCH_CHANGE_CALLBACK_H
+#define GLOBAL_SWITCH_CHANGE_CALLBACK_H
+
+namespace OHOS {
+namespace Security {
+namespace AccessToken {
+class CameraSwitchChangeCallback {
+public:
+
+};
+
+class AudioSwitchChangeCallback {
+public:
+
+};
+} // namespace AccessToken
+} // namespace Security
+} // namespace OHOS
+#endif // GLOBAL_SWITCH_CHANGE_CALLBACK_H
diff --git a/services/privacymanager/include/sensitive/resource_manager.h b/services/privacymanager/include/sensitive/resource_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..30cb861bc3d8f20e9464eab334c10181d2d8f5fc
--- /dev/null
+++ b/services/privacymanager/include/sensitive/resource_manager.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RESOURCE_MANAGER_H
+#define RESOURCE_MANAGER_H
+
+#include