From 148fc493591e56126b02aba1c9d1f2d5c749c071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=8E=AF?= <18108170464@163.com> Date: Fri, 8 Mar 2024 15:55:26 +0800 Subject: [PATCH 01/12] =?UTF-8?q?fixed=2049a2106=20from=20https://gitee.co?= =?UTF-8?q?m/rtggg/applications=5Fsystemui/pulls/444=20I8S42V=EF=BC=8C?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E6=80=A7=E9=97=AE=E9=A2=98=E6=95=B4=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=A0=88=E5=90=8D=EF=BC=9AnotificationSlotSet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王环 <18108170464@163.com> --- .../src/main/ets/pages/slotSetting.ets | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets b/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets index 7716af27..3a8bf042 100644 --- a/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets +++ b/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets @@ -234,7 +234,12 @@ export default struct SlotSetting { } notificationSlotSet() { - Log.showDebug(TAG, `notificationSlotSet slotInfo:${JSON.stringify(this.slotInfo)}`) + Log.showDebug(TAG, `notificationSlotSet slotInfo:${JSON.stringify(this.slotInfo)}`); + if (this.appInfo.appBundleName == null || this.slotInfo == null) { + Log.showError(TAG, `notificationSlotSet, invalid parameter, bundle: ${this.appInfo?.appBundleName} ` + + `uid: ${this.appInfo?.appUid}`); + return; + } NotificationListener.notificationSlotSet({ bundle: this.appInfo.appBundleName, uid: this.appInfo.appUid }, this.slotInfo); } } \ No newline at end of file -- Gitee From 495fbcfeda8aabcc9c19a11aadbc373fa4b7a11c Mon Sep 17 00:00:00 2001 From: hlzhangaj Date: Mon, 11 Mar 2024 07:07:50 +0000 Subject: [PATCH 02/12] =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9D=83=E5=A4=B4=E5=92=8C=E8=AE=B8?= =?UTF-8?q?=E5=8F=AF=E8=AF=81=E5=A4=B4=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hlzhangaj --- .../src/main/ets/common/IndicatorConfig.ts | 13 ++++++++++++- .../src/main/ets/viewmodel/ViewModel.ts | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/product/default/navigationBar/src/main/ets/common/IndicatorConfig.ts b/product/default/navigationBar/src/main/ets/common/IndicatorConfig.ts index aaa4c738..9297060f 100644 --- a/product/default/navigationBar/src/main/ets/common/IndicatorConfig.ts +++ b/product/default/navigationBar/src/main/ets/common/IndicatorConfig.ts @@ -1,5 +1,16 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + * Copyright (c) 2024 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. */ export default class IndicatorStyle { diff --git a/product/default/navigationBar/src/main/ets/viewmodel/ViewModel.ts b/product/default/navigationBar/src/main/ets/viewmodel/ViewModel.ts index 25dcb679..bbf38c12 100644 --- a/product/default/navigationBar/src/main/ets/viewmodel/ViewModel.ts +++ b/product/default/navigationBar/src/main/ets/viewmodel/ViewModel.ts @@ -1,5 +1,16 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + * Copyright (c)2024 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 privacyManager from '@ohos.privacyManager'; -- Gitee From 8e6bb2e26d579b828848f90846478a512bd6ab33 Mon Sep 17 00:00:00 2001 From: AiQing <540946344@qq.com> Date: Sat, 16 Mar 2024 18:07:48 +0800 Subject: [PATCH 03/12] =?UTF-8?q?fixed=20e999d6d=20from=20https://gitee.co?= =?UTF-8?q?m/rtggg/applications=5Fsystemui/pulls/449=20=E2=80=9CI8S42V:?= =?UTF-8?q?=E8=BF=9B=E7=A8=8Bcom.ohos.systemui=E4=B8=8B=E5=87=BA=E7=8E=B0j?= =?UTF-8?q?scrash=EF=BC=8C=E6=A0=88=E5=90=8D=EF=BC=9AnotificationSlotSet?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: AiQing <540946344@qq.com> --- .../notificationmanagement/src/main/ets/pages/slotSetting.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets b/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets index 3a8bf042..f63e08d8 100644 --- a/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets +++ b/product/default/notificationmanagement/src/main/ets/pages/slotSetting.ets @@ -235,7 +235,7 @@ export default struct SlotSetting { notificationSlotSet() { Log.showDebug(TAG, `notificationSlotSet slotInfo:${JSON.stringify(this.slotInfo)}`); - if (this.appInfo.appBundleName == null || this.slotInfo == null) { + if (this.appInfo.appBundleName == null || typeof(this.appInfo.appUid) !== 'number' || this.slotInfo == null) { Log.showError(TAG, `notificationSlotSet, invalid parameter, bundle: ${this.appInfo?.appBundleName} ` + `uid: ${this.appInfo?.appUid}`); return; -- Gitee From 7a336fb79c7658807d802deb77366e027b5e06ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=8E=AF?= <18108170464@163.com> Date: Mon, 25 Mar 2024 17:09:16 +0800 Subject: [PATCH 04/12] =?UTF-8?q?fixed=204cae859=20from=20https://gitee.co?= =?UTF-8?q?m/rtggg/applications=5Fsystemui/pulls/452=20I8S42V:=E8=BF=9B?= =?UTF-8?q?=E7=A8=8Bcom.ohos.systemui=E4=B8=8B=E5=87=BA=E7=8E=B0jscrash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王环 <18108170464@163.com> --- .../main/ets/com/ohos/model/notificationListener.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/features/managementcomponent/src/main/ets/com/ohos/model/notificationListener.ts b/features/managementcomponent/src/main/ets/com/ohos/model/notificationListener.ts index 5fcd6810..5fdbaa12 100644 --- a/features/managementcomponent/src/main/ets/com/ohos/model/notificationListener.ts +++ b/features/managementcomponent/src/main/ets/com/ohos/model/notificationListener.ts @@ -153,9 +153,13 @@ export class NotificationListener { notificationSlotSet(bundleOption: BundleOption, data: NotificationManager.NotificationSlot): void { Log.showDebug(TAG, `notificationSlotSet bundleOption:${JSON.stringify(bundleOption)} data:${JSON.stringify(data)}`); - NotificationManager.setSlotByBundle(bundleOption, data, (err, result) => { - Log.showInfo(TAG, `notificationSlotSet err:${JSON.stringify(err)} result:${JSON.stringify(result)}`); - }); + try { + NotificationManager.setSlotByBundle(bundleOption, data, (err, result) => { + Log.showInfo(TAG, `notificationSlotSet err:${JSON.stringify(err)} result:${JSON.stringify(result)}`); + }); + } catch (err) { + Log.showError(TAG, `notificationSlotSet error => ${JSON.stringify(err)}`); + } } async isDistributedEnabled(): Promise { -- Gitee From f604a2458d71d6da79f51e868c2e70d4bbf6ad24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=8E=AF?= <18108170464@163.com> Date: Sat, 30 Mar 2024 11:09:10 +0800 Subject: [PATCH 05/12] =?UTF-8?q?fixed=2035de1c0=20from=20https://gitee.co?= =?UTF-8?q?m/rtggg/applications=5Fsystemui/pulls/455=20I8OQNN:=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=AA=97=E5=8F=A3=E5=BC=80=E6=94=BE=E7=9A=84?= =?UTF-8?q?=E5=88=86=E5=B1=8F=E6=9D=A1type=E7=B1=BB=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=88=86=E5=B1=8F=E6=9D=A1=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王环 <18108170464@163.com> --- common/src/main/ets/default/WindowManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/ets/default/WindowManager.ts b/common/src/main/ets/default/WindowManager.ts index 0dfc71fb..e0921837 100644 --- a/common/src/main/ets/default/WindowManager.ts +++ b/common/src/main/ets/default/WindowManager.ts @@ -55,7 +55,7 @@ const SYSTEM_WINDOW_TYPE_MAP: { [key in WindowType]: Window.WindowType } = { SystemUi_ControlPanel: Window.WindowType.TYPE_VOLUME_OVERLAY, SystemUi_VolumePanel: Window.WindowType.TYPE_VOLUME_OVERLAY, SystemUi_BannerNotice: Window.WindowType.TYPE_VOLUME_OVERLAY, - SystemUi_SplitBar: 2101, + SystemUi_SplitBar: Window.WindowType.TYPE_DIVIDER, SystemUi_PrivacyIndicator: Window.WindowType.TYPE_VOLUME_OVERLAY }; -- Gitee From 3044d2441eacf44fe7db58c334a71a547ff34ec8 Mon Sep 17 00:00:00 2001 From: gaoxiangzhong <2323004635@qq.com> Date: Sat, 30 Mar 2024 15:43:30 +0800 Subject: [PATCH 06/12] =?UTF-8?q?fixed=2068b5bca=20from=20https://gitee.co?= =?UTF-8?q?m/gxiangz/applications=5Fsystemui/pulls/457=20=E9=94=81?= =?UTF-8?q?=E5=B1=8F=E7=95=8C=E9=9D=A2=E9=95=BF=E6=8C=89=E7=94=B5=E6=BA=90?= =?UTF-8?q?=E9=94=AE=E6=97=A0=E6=B3=95=E5=94=A4=E9=86=92=E9=94=81=E5=B1=8F?= =?UTF-8?q?=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gaoxiangzhong <2323004635@qq.com> --- .../default/dialog/src/main/ets/ServiceExtAbility/ExtAbility.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/default/dialog/src/main/ets/ServiceExtAbility/ExtAbility.ts b/product/default/dialog/src/main/ets/ServiceExtAbility/ExtAbility.ts index c098907b..661f9d46 100644 --- a/product/default/dialog/src/main/ets/ServiceExtAbility/ExtAbility.ts +++ b/product/default/dialog/src/main/ets/ServiceExtAbility/ExtAbility.ts @@ -110,7 +110,7 @@ class Stub extends rpc.RemoteObject { const win = await window.createWindow({ ctx: controller.getContext(), name: windowName, - windowType: window.WindowType.TYPE_FLOAT + windowType: parameters?.bundleName == "com.ohos.powerdialog" ? window.WindowType.TYPE_SCREENSHOT : window.WindowType.TYPE_FLOAT }); Log.showDebug(TAG, 'createWindow '); -- Gitee From b97f15b33374ba2bb6a01b921da214c4e2e8fc11 Mon Sep 17 00:00:00 2001 From: kejintao Date: Mon, 25 Mar 2024 16:33:22 +0800 Subject: [PATCH 07/12] =?UTF-8?q?fixed=2003b4a64=20from=20https://gitee.co?= =?UTF-8?q?m/dancingke/applications=5Fsystemui/pulls/451=20=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C12=E5=B0=8F=E6=97=B6=E7=A8=B3=E5=AE=9A=E6=80=A7?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=8C=E5=87=BA=E7=8E=B0jscrash=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: kejintao --- .../src/main/ets/com/ohos/noticeItem/view/item/generalItem.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/generalItem.ets b/features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/generalItem.ets index e3954cf9..87a24cd8 100644 --- a/features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/generalItem.ets +++ b/features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/generalItem.ets @@ -84,7 +84,7 @@ export default struct GeneralItem { itemData: this.itemData }); - if (this.isExpand && this.itemData.actionButtons.length) { + if (this.isExpand && this.itemData.actionButtons?.length) { ActionComponent({ itemData: this.itemData }) } else { Blank().height(Layout.ITEM_MARGIN) -- Gitee From 2b6e5cd245cc416c6a2004311e92c4fbaccda8d1 Mon Sep 17 00:00:00 2001 From: yuwenzheng Date: Sun, 7 Apr 2024 15:58:16 +0800 Subject: [PATCH 08/12] =?UTF-8?q?fixed=202b3f958=20from=20https://gitee.co?= =?UTF-8?q?m/ywz666/applications=5Fsystemui/pulls/461=20=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=9F=B3=E9=87=8F=E6=9D=A1=E7=9A=84=E8=AE=BE=E7=BD=AE=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E8=B7=B3=E8=BD=AC=E8=87=B3=E8=B7=B3=E8=BD=AC=E8=87=B3?= =?UTF-8?q?=E9=9F=B3=E9=87=8F=E8=AE=BE=E7=BD=AE=E5=AD=90=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yuwenzheng --- .../src/main/ets/com/ohos/pages/VolumePanelComponent.ets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/features/volumepanelcomponent/src/main/ets/com/ohos/pages/VolumePanelComponent.ets b/features/volumepanelcomponent/src/main/ets/com/ohos/pages/VolumePanelComponent.ets index 31e6e650..55ca6ee4 100644 --- a/features/volumepanelcomponent/src/main/ets/com/ohos/pages/VolumePanelComponent.ets +++ b/features/volumepanelcomponent/src/main/ets/com/ohos/pages/VolumePanelComponent.ets @@ -131,6 +131,9 @@ export default struct VolumePanelComponent { AbilityManager.startAbility(AbilityManager.getContext(AbilityManager.ABILITY_NAME_VOLUME_PANEL), { bundleName: 'com.ohos.settings', abilityName: 'com.ohos.settings.MainAbility', + parameters: { + router: 'volumeControl' + }, }); VolumeWindowController.getInstance().setWindowState(false); } -- Gitee From d2d430ca32477f5008375089502d7175982d80bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B1=9F=E6=B6=9B?= Date: Tue, 9 Apr 2024 10:18:48 +0800 Subject: [PATCH 09/12] =?UTF-8?q?fixed=20daf5425=20from=20https://gitee.co?= =?UTF-8?q?m/yang-jiangtao001/applications=5Fsystemui/pulls/464=204?= =?UTF-8?q?=E6=9C=881=E6=97=A5=E8=BF=9B=E8=A1=8C12=E5=B0=8F=E6=97=B6?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=8C=E5=87=BA=E7=8E=B0jscrash=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=BA=94=E7=94=A8=EF=BC=9Acom.ohos.systemu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杨江涛 --- .../src/main/ets/default/viewmodel/AirplaneVM.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts b/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts index e6dec6e5..28d01b12 100644 --- a/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts +++ b/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts @@ -39,14 +39,14 @@ class AirplaneVM implements AirplaneServiceListener { constructor() { this.context = AbilityManager.getContext(AbilityManager.getContextName(AbilityManager.ABILITY_NAME_CONTROL_PANEL)); if (this.context == undefined || this.context == null) { - Log.showInfo(TAG, `constructor: ${context}`); + Log.showInfo(TAG, `constructor: ${this.context}`); return; } try { this.mAirplaneStatus = settings.getValueSync(this.context, Constants.KEY_AIRPLANE_MODE_STATUS, AIRPLANE_MODE_STATUS.OFF) === AIRPLANE_MODE_STATUS.ON } catch (err) { - Log.showError(TAG, `AirplaneVM: ${context}, ${JSON.stringify(err)}`); + Log.showError(TAG, `AirplaneVM: ${this.context}, ${JSON.stringify(err)}`); } AppStorage.SetOrCreate('Airplane_Status', this.mAirplaneStatus); } -- Gitee From 8fb843b24b06cb35d97e359d3d31a3af3d8620dc Mon Sep 17 00:00:00 2001 From: "zhangxiong076@chinasoftinc.com" Date: Wed, 10 Apr 2024 10:01:13 +0800 Subject: [PATCH 10/12] =?UTF-8?q?fixed=20593401b=20from=20https://gitee.co?= =?UTF-8?q?m/zhangxcode/applications=5Fsystemui/pulls/468=20=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=8A=A8=E7=94=BB=E5=88=87=E6=8D=A2=E8=87=B35X?= =?UTF-8?q?=E6=88=9610X=EF=BC=8C=E4=B8=8B=E8=BD=BD=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A0=8F=EF=BC=8C=E7=8A=B6=E6=80=81=E6=A0=8F=E4=BC=9A=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product/phone/dropdownpanel/src/main/ets/pages/index.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/product/phone/dropdownpanel/src/main/ets/pages/index.ets b/product/phone/dropdownpanel/src/main/ets/pages/index.ets index ca1ad1e0..ff50ec78 100644 --- a/product/phone/dropdownpanel/src/main/ets/pages/index.ets +++ b/product/phone/dropdownpanel/src/main/ets/pages/index.ets @@ -279,6 +279,7 @@ struct Index { Log.showDebug(TAG, `hideSelf`) this._animateTo({...SHOW_ANIM_CONFIG, onFinish: () => { Log.showInfo(TAG, `hideSelf, hide anim finish.`); + }, finishCallback:()=>{ WindowManager.hideWindow(WindowType.DROPDOWN_PANEL) }}, () => { this.componentOptAreaTranslateY = (-this.componentOptAreaHeightPX * 0.1) + 'px' @@ -290,7 +291,7 @@ struct Index { _animateTo(config, callback) { Log.showDebug(TAG, `_animateTo, config: ${JSON.stringify(config)}`) animateTo(config, callback) - setTimeout(config.onFinish, config.duration + config.delay) + setTimeout(config.finishCallback, config.duration + config.delay) } build() { -- Gitee From d62e492de4ebbf3428981307de816e3f69a65fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=8E=AF?= <18108170464@163.com> Date: Mon, 22 Apr 2024 10:28:03 +0800 Subject: [PATCH 11/12] =?UTF-8?q?4.1release=20I9IBHJ=E3=80=90reboot?= =?UTF-8?q?=E3=80=91=E5=87=BA=E7=8E=B03=E6=AC=A1=20=E8=BF=9B=E7=A8=8Bcom.o?= =?UTF-8?q?hos.systemui=E5=87=BA=E7=8E=B0jscrash=EF=BC=8C=E6=A0=88?= =?UTF-8?q?=E5=90=8D=EF=BC=9AAirplaneVM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王环 <18108170464@163.com> --- .../src/main/ets/default/viewmodel/AirplaneVM.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts b/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts index 28d01b12..887be5db 100644 --- a/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts +++ b/features/airplanecomponent/src/main/ets/default/viewmodel/AirplaneVM.ts @@ -39,7 +39,7 @@ class AirplaneVM implements AirplaneServiceListener { constructor() { this.context = AbilityManager.getContext(AbilityManager.getContextName(AbilityManager.ABILITY_NAME_CONTROL_PANEL)); if (this.context == undefined || this.context == null) { - Log.showInfo(TAG, `constructor: ${this.context}`); + Log.showInfo(TAG, `constructor, this.context is null`); return; } try { -- Gitee From cf6d0067d9a3beeea779de528ca878e264b43c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=8E=AF?= <18108170464@163.com> Date: Sat, 18 May 2024 19:24:21 +0800 Subject: [PATCH 12/12] =?UTF-8?q?weekly=5F20240513=20[3/5]=20=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E8=AE=BE=E5=A4=87=EF=BC=8C=E6=89=8B=E5=8A=BF=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E5=BC=80=E5=90=AF=E4=B8=89=E9=94=AE=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E4=BB=8D=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王环 <18108170464@163.com> --- .../ets/viewmodel/NavigationBarViewModel.ts | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/product/default/navigationBar/src/main/ets/viewmodel/NavigationBarViewModel.ts b/product/default/navigationBar/src/main/ets/viewmodel/NavigationBarViewModel.ts index 002f7441..08d30cd9 100644 --- a/product/default/navigationBar/src/main/ets/viewmodel/NavigationBarViewModel.ts +++ b/product/default/navigationBar/src/main/ets/viewmodel/NavigationBarViewModel.ts @@ -32,6 +32,10 @@ const NAVIGATION_BAE_VIEW_MODEL_KEY = 'AppStorage_NavigationBarViewModel'; const NAVIGATION_BAR_COMPONENT_DATA_KEY = 'AppStorage_NavigationBarComponentData'; +const RETRY_INTERVAL_MS = 1500; + +const MAX_RETRY_TIME = 5; + export default class NavigationBarViewModel { private readonly settingDataKey = 'settings.display.navigationbar_status'; private readonly urivar: string; @@ -57,17 +61,34 @@ export default class NavigationBarViewModel { Log.showInfo(TAG, 'context: ' + AbilityManager.getContext(AbilityManager.ABILITY_NAME_NAVIGATION_BAR)); } this.initNavigationBarStatus(); - this.initHelper(this.dataChangesCallback.bind(this)); + this.initHelper(this.dataChangesCallback.bind(this), MAX_RETRY_TIME); } - private async initHelper(callback: () => void): Promise { + private async initHelper(callback: () => void, retryTimes: number): Promise { + if (retryTimes < 1) { + Log.showInfo(TAG, 'initHelper, retry too many times'); + return; + } + Log.showInfo(TAG, 'initHelper in, retry times: %{public}d', MAX_RETRY_TIME - retryTimes + 1); this.urivar = Constants.getUriSync(Constants.KEY_NAVIGATIONBAR_STATUS); - this.helper = await dataShare.createDataShareHelper(AbilityManager.getContext(AbilityManager.ABILITY_NAME_NAVIGATION_BAR), this.urivar); - Log.showInfo(TAG, 'initHelper, helper: ' + this.helper + ', uri: ' + this.urivar); - this.helper.on('dataChange', this.urivar, () => { - Log.showInfo(TAG, 'onDataChange.'); - callback(); - }); + try { + this.helper = await dataShare.createDataShareHelper(AbilityManager.getContext(AbilityManager.ABILITY_NAME_NAVIGATION_BAR), this.urivar); + Log.showInfo(TAG, 'initHelper, helper: ' + this.helper + ', uri: ' + this.urivar); + this.helper.on('dataChange', this.urivar, () => { + Log.showInfo(TAG, 'onDataChange.'); + callback(); + }); + } catch (err) { + Log.showError(TAG, 'initHelper error, code: ' + err?.code + ', message: ' + err?.message); + await this.sleep(RETRY_INTERVAL_MS); + this.initHelper(this.dataChangesCallback.bind(this), retryTimes - 1); + } + } + + private sleep (time: number) { + return new Promise(resolve => { + setTimeout(resolve, time); + }) } install(): void { -- Gitee