From 01c74296858859ac387ab86c1aa7f0e25fc6c4fb Mon Sep 17 00:00:00 2001 From: xdongs Date: Wed, 23 Apr 2025 10:03:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=A2=83=E6=98=93=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E4=BD=BF=E8=83=BD=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xdongs --- .../include/advanced_notification_service.h | 3 ++- services/ans/include/notification_dialog.h | 3 ++- .../ans/include/notification_dialog_manager.h | 3 ++- .../advanced_notification_publish_service.cpp | 20 ++++++++++++------- services/ans/src/notification_dialog.cpp | 4 +++- .../ans/src/notification_dialog_manager.cpp | 6 ++++-- .../notification_dialog_test.cpp | 2 ++ .../NotificationServiceExtAbility.ts | 10 +++++++--- .../src/main/ets/pages/notificationDialog.ets | 8 +++++--- .../main/resources/base/element/string.json | 6 +++++- .../main/resources/bo_CN/element/string.json | 6 +++++- .../src/main/resources/ug/element/string.json | 6 +++++- .../main/resources/zh_CN/element/string.json | 6 +++++- .../main/resources/zh_HK/element/string.json | 6 +++++- .../main/resources/zh_TW/element/string.json | 6 +++++- 15 files changed, 70 insertions(+), 25 deletions(-) diff --git a/services/ans/include/advanced_notification_service.h b/services/ans/include/advanced_notification_service.h index 05f1c035d..ecb5dfddd 100644 --- a/services/ans/include/advanced_notification_service.h +++ b/services/ans/include/advanced_notification_service.h @@ -1473,7 +1473,8 @@ private: const sptr &callback, const sptr &callerToken, const sptr bundleOption, - const bool innerLake); + const bool innerLake, + const bool easyAbroad); void ClearSlotTypeData(const sptr &request, int32_t callingUid, int32_t sourceType); bool GetSystemBoolParameter(const std::string &key, const bool defaultValue); diff --git a/services/ans/include/notification_dialog.h b/services/ans/include/notification_dialog.h index 0703496de..81b36ded6 100644 --- a/services/ans/include/notification_dialog.h +++ b/services/ans/include/notification_dialog.h @@ -35,7 +35,8 @@ public: int32_t uid, std::string appBundleName, const sptr &callerToken, - const bool innerLake); + const bool innerLake, + const bool easyAbroad); static int32_t GetUidByBundleName(const std::string &bundleName); }; diff --git a/services/ans/include/notification_dialog_manager.h b/services/ans/include/notification_dialog_manager.h index dc5f848cd..0212faef0 100644 --- a/services/ans/include/notification_dialog_manager.h +++ b/services/ans/include/notification_dialog_manager.h @@ -85,7 +85,8 @@ public: const sptr& bundle, const sptr& callback, const sptr& callerToken, - const bool innerLake + const bool innerLake, + const bool easyAbroad ); /* diff --git a/services/ans/src/advanced_notification_publish_service.cpp b/services/ans/src/advanced_notification_publish_service.cpp index cc15e96db..5db64d57c 100644 --- a/services/ans/src/advanced_notification_publish_service.cpp +++ b/services/ans/src/advanced_notification_publish_service.cpp @@ -75,8 +75,9 @@ constexpr const char *CONTACT_DATA = "datashare:///com.ohos.contactsdataability/ constexpr const char *SUPPORT_INTEGELLIGENT_SCENE = "true"; constexpr int32_t OPERATION_TYPE_COMMON_EVENT = 4; const static std::string BUNDLE_NAME_ZYT = "com.zhuoyi.appstore.lite"; -const static std::string BUNDLE_NAME_ABROAD = "com.easy.transfer.abroad"; +const static std::string BUNDLE_NAME_ABROAD = "com.easy.abroad"; const static std::string INSTALL_SOURCE_EASYABROAD = "com.easy.abroad"; +constexpr int32_t ZERO_USER_ID = 0; constexpr int32_t BADGE_NUM_LIMIT = 0; constexpr int32_t CLEAR_SLOT_FROM_AVSEESAION = 1; constexpr int32_t CLEAR_SLOT_FROM_RSS = 2; @@ -1023,7 +1024,7 @@ ErrCode AdvancedNotificationService::RequestEnableNotification(const std::string return ERR_ANS_INVALID_PARAM; } sptr bundleOption = GenerateBundleOption(); - return CommonRequestEnableNotification(deviceId, callback, callerToken, bundleOption, false); + return CommonRequestEnableNotification(deviceId, callback, callerToken, bundleOption, false, false); } ErrCode AdvancedNotificationService::RequestEnableNotification(const std::string bundleName, const int32_t uid) @@ -1038,20 +1039,24 @@ ErrCode AdvancedNotificationService::RequestEnableNotification(const std::string } AppExecFwk::BundleInfo bundleInfo; - BundleManagerHelper::GetInstance()->GetBundleInfoV9(bundleName, 1, bundleInfo, 0); + bool ret = BundleManagerHelper::GetInstance()->GetBundleInfoV9(bundleName, + static_cast(AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION), + bundleInfo, ZERO_USER_ID); + bool easyAbroad = false; if (bundleInfo.applicationInfo.installSource == INSTALL_SOURCE_EASYABROAD) { ANS_LOGI("RequestEnableNotification abroad app"); - return ERR_ANS_NOT_ALLOWED; + easyAbroad = true; } sptr bundleOption = new (std::nothrow) NotificationBundleOption(bundleName, uid); - return CommonRequestEnableNotification("", nullptr, nullptr, bundleOption, true); + return CommonRequestEnableNotification("", nullptr, nullptr, bundleOption, true, easyAbroad); } ErrCode AdvancedNotificationService::CommonRequestEnableNotification(const std::string &deviceId, const sptr &callback, const sptr &callerToken, const sptr bundleOption, - const bool innerLake) + const bool innerLake, + const bool easyAbroad) { ANS_LOGI("%{public}s", __FUNCTION__); ErrCode result = ERR_OK; @@ -1100,7 +1105,8 @@ ErrCode AdvancedNotificationService::CommonRequestEnableNotification(const std:: return ERROR_INTERNAL_ERROR; } - result = dialogManager_->RequestEnableNotificationDailog(bundleOption, callback, callerToken, innerLake); + result = dialogManager_->RequestEnableNotificationDailog(bundleOption, + callback, callerToken, innerLake, easyAbroad); if (result == ERR_OK) { result = ERR_ANS_DIALOG_POP_SUCCEEDED; } diff --git a/services/ans/src/notification_dialog.cpp b/services/ans/src/notification_dialog.cpp index ac53a9545..49414be2c 100644 --- a/services/ans/src/notification_dialog.cpp +++ b/services/ans/src/notification_dialog.cpp @@ -45,7 +45,8 @@ ErrCode NotificationDialog::StartEnableNotificationDialogAbility( int32_t uid, std::string appBundleName, const sptr &callerToken, - const bool innerLake) + const bool innerLake, + const bool easyAbroad) { ANS_LOGD("%{public}s, Enter.", __func__); @@ -78,6 +79,7 @@ ErrCode NotificationDialog::StartEnableNotificationDialogAbility( root["bundleUid"] = uid; root["ability.want.params.uiExtensionType"] = uiExtensionType; root["innerLake"] = innerLake; + root["easyAbroad"] = easyAbroad; std::string command = root.dump(); auto connection_ = sptr(new (std::nothrow) SystemDialogConnectStb(command)); diff --git a/services/ans/src/notification_dialog_manager.cpp b/services/ans/src/notification_dialog_manager.cpp index 80e17b778..eae96cf6d 100644 --- a/services/ans/src/notification_dialog_manager.cpp +++ b/services/ans/src/notification_dialog_manager.cpp @@ -89,7 +89,8 @@ ErrCode NotificationDialogManager::RequestEnableNotificationDailog( const sptr& bundle, const sptr& callback, const sptr& callerToken, - const bool innerLake) + const bool innerLake, + const bool easyAbroad) { if (!AddDialogInfoIfNotExist(bundle, callback)) { ANS_LOGE("AddDialogIfNotExist failed. Dialog already exists. bundle = %{public}s", @@ -102,7 +103,8 @@ ErrCode NotificationDialogManager::RequestEnableNotificationDailog( bundle->GetUid(), bundle->GetBundleName(), callerToken, - innerLake); + innerLake, + easyAbroad); if (result != ERR_OK) { ANS_LOGE("StartEnableNotificationDialogAbility failed, result = %{public}d", result); std::unique_ptr dialogInfoRemoved = nullptr; diff --git a/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp b/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp index b7f5b3e98..845f03551 100644 --- a/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp +++ b/services/ans/test/unittest/notification_dialog_test/notification_dialog_test.cpp @@ -75,6 +75,7 @@ HWTEST_F(NotificationDialogTest, NotificationDialog_00300, Function | SmallTest uid, bundleName, callerToken, + false, false); ASSERT_EQ(result3, ERR_ANS_INVALID_BUNDLE); } @@ -101,6 +102,7 @@ HWTEST_F(NotificationDialogTest, NotificationDialog_00400, Function | SmallTest uid, bundleName, callerToken, + false, false); ASSERT_EQ(result3, ERR_ANS_INVALID_BUNDLE); } diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/ServiceExtAbility/NotificationServiceExtAbility.ts b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/ServiceExtAbility/NotificationServiceExtAbility.ts index 286cd2027..3b17ff753 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/ServiceExtAbility/NotificationServiceExtAbility.ts +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/ServiceExtAbility/NotificationServiceExtAbility.ts @@ -94,8 +94,9 @@ export class EnableNotificationDialog { subWindow: window.Window; initSubWindowSize: boolean; innerLake: boolean; + easyAbroad: boolean; - constructor(id: number, want: Want, stageModel: boolean, innerLake: boolean) { + constructor(id: number, want: Want, stageModel: boolean, innerLake: boolean, easyAbroad: boolean) { this.id = id; this.want = want; this.stageModel = stageModel; @@ -103,6 +104,7 @@ export class EnableNotificationDialog { this.extensionWindow = undefined; this.initSubWindowSize = false; this.innerLake = innerLake; + this.easyAbroad = easyAbroad; } @@ -286,6 +288,7 @@ class NotificationDialogServiceExtensionAbility extends UIExtensionAbility { let bundleName = want.parameters['ohos.aafwk.param.callerBundleName']; let bundleUid = want.parameters['ohos.aafwk.param.callerUid']; let innerLake = false; + let easyAbroad = false; if (bundleName !== EnableNotificationDialog.SCENEBOARD_BUNDLE && bundleName !== EnableNotificationDialog.SYSTEMUI_BUNDLE) { want.parameters.bundleName = bundleName; @@ -295,11 +298,12 @@ class NotificationDialogServiceExtensionAbility extends UIExtensionAbility { } else { stageModel = false; innerLake = Boolean(want.parameters.innerLake); - console.log(TAG, ` un stage model innerLake = , ${innerLake}`); + easyAbroad = Boolean(want.parameters.easyAbroad); + console.log(TAG, ` un stage model innerLake = ${innerLake}, easyAbroad = ${easyAbroad}`); } console.log(TAG, `UIExtAbility onSessionCreate bundleName ${want.parameters.bundleName}` + `uid ${want.parameters.bundleUid}`); - let dialog = new EnableNotificationDialog(1, want, stageModel, innerLake); + let dialog = new EnableNotificationDialog(1, want, stageModel, innerLake, easyAbroad); await dialog.createUiExtensionWindow(session, stageModel); AppStorage.setOrCreate('dialog', dialog); } catch (err) { diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets index d17bf72ec..881bb7da7 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/ets/pages/notificationDialog.ets @@ -151,10 +151,12 @@ struct PermissionDialog { Row() { Flex({ justifyContent: FlexAlign.Center }) { Text() { - if (!this.dialog.innerLake) { - Span(permission.reason) - } else { + if (this.dialog.easyAbroad) { + Span($r('app.string.reason_cjy')) + } else if (this.dialog.innerLake) { Span($r('app.string.reason_zyt')) + } else { + Span(permission.reason) } } .fontSize(Constants.DIALOG_DESP_FONT_SIZE) diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/base/element/string.json b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/base/element/string.json index e0aebc605..1105e854c 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/base/element/string.json +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/base/element/string.json @@ -22,7 +22,11 @@ }, { "name":"reason_zyt", - "value":"These may include lock screen and banner notifications as well as sounds and vibration. You can modify these settings in EasyAbroad > App management." + "value":"These may include lock screen notifications, banners, badges, sounds, and vibration. You can change these settings in DroiTong > App management." + }, + { + "name":"reason_cjy", + "value":"These may include lock screen notifications, banners, badges, sounds, and vibration. You can change these settings in EasyAbroad > App management." }, { "name":"ALLOW", diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/bo_CN/element/string.json b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/bo_CN/element/string.json index b10e0f9b7..8005286b0 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/bo_CN/element/string.json +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/bo_CN/element/string.json @@ -22,7 +22,11 @@ }, { "name":"reason_zyt", - "value":"བརྡ་ཐོའི་དྲན་སྐུལ་གྱི་ཐབས་ལམ་ལ་སྒོ་ལྕགས་བརྙན་ཡོལ་དང་། འཕྲེད་བྱང་། དྲིལ་སྒྲ། སྦིར་བརྡ་སོགས་ཚུད་སྲིད། ༼ཀྲུའོ་དབྱི་ཐུང་༽>༼ ཉེར་སྤྱོད་དོ་དམ་༽ལ་བསྐྱོད་ནས་བཅོས་ཆོག" + "value":"བརྡ་ཐོའི་དྲན་སྐུལ་གྱི་ཐབས་ལམ་ལ་སྒོ་ལྕགས་བརྙན་ཡོལ་དང་། འཕྲེད་བྱང་། ཟུར་རྟགས། དྲིལ་སྒྲ། སྦིར་བརྡ་བཅས་ཚུད་སྲིད། ༼DroiTong༽>༼ ཉེར་སྤྱོད་དོ་དམ་༽ལ་བསྐྱོད་ནས་བཅོས་ཆོག" + }, + { + "name":"reason_cjy", + "value":"བརྡ་ཐོའི་དྲན་སྐུལ་གྱི་ཐབས་ལམ་ལ་སྒོ་ལྕགས་བརྙན་ཡོལ་དང་། འཕྲེད་བྱང་། ཟུར་རྟགས། དྲིལ་སྒྲ། སྦིར་བརྡ་བཅས་ཚུད་སྲིད། ༼ཁོངས་བརྒལ་བདེ་༽>༼ ཉེར་སྤྱོད་དོ་དམ་༽ལ་བསྐྱོད་ནས་བཅོས་ཆོག" }, { "name":"ALLOW", diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/ug/element/string.json b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/ug/element/string.json index 3dc2ca7d0..3ae91b8e3 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/ug/element/string.json +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/ug/element/string.json @@ -22,7 +22,11 @@ }, { "name":"reason_zyt", - "value":"قۇلۇپ ئېكرانى، بالداق، ئاۋاز ۋە تىترەش قاتارلىقلار شۇنىڭ ئىچىدە. DroiTong > ئەپ باشقۇرۇش دېگەن ئورۇندىن ئۆزگەرتەلەيسىز." + "value":"قۇلۇپ ئېكرانى، بالداق، تامغا، ئاۋاز ۋە تىترەش شۇنىڭ ئىچىدە. DroiTong > ئەپ باشقۇرۇش دېگەن ئورۇندىن ئۆزگەرتەلەيسىز." + }, + { + "name":"reason_cjy", + "value":"قۇلۇپ ئېكرانى، بالداق، تامغا، ئاۋاز ۋە تىترەش شۇنىڭ ئىچىدە. چۇجىڭيى (چېگرا قولايلىقى) > ئەپ باشقۇرۇش دېگەن ئورۇندىن ئۆزگەرتەلەيسىز." }, { "name":"ALLOW", diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_CN/element/string.json b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_CN/element/string.json index 6fea84da7..42858e4c4 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_CN/element/string.json +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_CN/element/string.json @@ -22,7 +22,11 @@ }, { "name":"reason_zyt", - "value":"通知提醒方式可能包括锁屏、横幅、响铃、振动等。可前往“卓易通”>“应用管理”更改。" + "value":"通知提醒方式可能包括锁屏、横幅、角标、响铃、振动。可前往“卓易通”>“应用管理”更改。" + }, + { + "name":"reason_cjy", + "value":"通知提醒方式可能包括锁屏、横幅、角标、响铃、振动。可前往“出境易”>“应用管理”更改。" }, { "name":"ALLOW", diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_HK/element/string.json b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_HK/element/string.json index ad424151c..581988e83 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_HK/element/string.json +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_HK/element/string.json @@ -22,7 +22,11 @@ }, { "name":"reason_zyt", - "value":"通知提醒方式可能包括鎖屏、橫幅、響鬧和震動等。可前往「卓易通」>「應用程式管理」更改。" + "value":"通知提醒方式可能包括鎖屏、橫幅、徽章圖標、響鬧、震動。可前往「卓易通」>「應用程式管理」更改。" + }, + { + "name":"reason_cjy", + "value":"通知提醒方式可能包括鎖屏、橫幅、徽章圖標、響鬧、震動。可前往「出境易」>「應用程式管理」更改。" }, { "name":"ALLOW", diff --git a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_TW/element/string.json b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_TW/element/string.json index 728172bed..ab97ad289 100644 --- a/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_TW/element/string.json +++ b/services/dialog_ui/enable_notification_dialog/entry/src/main/resources/zh_TW/element/string.json @@ -22,7 +22,11 @@ }, { "name":"reason_zyt", - "value":"通知提醒方式可能包括鎖定螢幕、橫幅、響鈴、振動等。您可以前往「卓易通」>「應用程式管理」變更。" + "value":"通知提醒方式可能包括鎖定螢幕、橫幅、徽章圖示、響鈴和振動。您可以前往「卓易通」>「應用程式管理」變更。" + }, + { + "name":"reason_cjy", + "value":"通知提醒方式可能包括鎖定螢幕、橫幅、徽章圖示、響鈴和振動。您可以前往「出境易」>「應用程式管理」變更。" }, { "name":"ALLOW", -- Gitee