From 97282833f6020887ea7d913cedf57fd402704d27 Mon Sep 17 00:00:00 2001 From: adelelimi Date: Sat, 26 Jul 2025 17:18:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86=E9=87=8D=E5=A4=8Drelease?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: adelelimi --- entry/src/main/ets/common/vm/Constants.ts | 1 + .../ets/extensionability/UserAuthAbility.ts | 5 ++++- .../main/ets/pages/components/FaceAuth.ets | 19 +++++++++++++------ .../ets/pages/components/FingerprintAuth.ets | 11 ++++++++--- .../ets/pages/components/PasswordAuth.ets | 2 +- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/entry/src/main/ets/common/vm/Constants.ts b/entry/src/main/ets/common/vm/Constants.ts index 2cad77f..da9e593 100644 --- a/entry/src/main/ets/common/vm/Constants.ts +++ b/entry/src/main/ets/common/vm/Constants.ts @@ -48,6 +48,7 @@ export default class Constants { static noticeEventWidgetLoaded = 'EVENT_AUTH_WIDGET_LOADED'; static noticeEventWidgetReleased = 'EVENT_AUTH_WIDGET_RELEASED'; static noticeEventUserNavigation = 'EVENT_AUTH_USER_NAVIGATION'; + static noticeEventProcessTerminate = 'EVENT_AUTH_PROCESS_TERMINATE'; static numKeyBoard : NumKeyBoardItem[] = [ { diff --git a/entry/src/main/ets/extensionability/UserAuthAbility.ts b/entry/src/main/ets/extensionability/UserAuthAbility.ts index 36bb785..45a659b 100644 --- a/entry/src/main/ets/extensionability/UserAuthAbility.ts +++ b/entry/src/main/ets/extensionability/UserAuthAbility.ts @@ -13,11 +13,12 @@ * limitations under the License. */ +import AuthUtils from '../common/utils/AuthUtils'; +import Constants, { WantParams } from '../common/vm/Constants'; import LogUtils from '../common/utils/LogUtils'; import UserAuthExtensionAbility from '@ohos.app.ability.UserAuthExtensionAbility'; import WindowPrivacyUtils from '../common/utils/WindowPrivacyUtils'; import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession'; -import { WantParams } from '../common/vm/Constants'; const TAG = 'UserAuthAbility'; // The current interface only support string type @@ -63,6 +64,8 @@ export default class UserAuthAbility extends UserAuthExtensionAbility { onSessionDestroy(session): void { LogUtils.info(TAG, 'UserAuthExtensionAbility onSessionDestroy'); + const currentPageAuthType: string = AppStorage.get('currentPageAuthType') as string ?? ''; + AuthUtils.getInstance().sendNotice(Constants.noticeEventProcessTerminate, [currentPageAuthType]); WindowPrivacyUtils.setWindowPrivacyMode(session, false); } } diff --git a/entry/src/main/ets/pages/components/FaceAuth.ets b/entry/src/main/ets/pages/components/FaceAuth.ets index 28b0641..cd4609e 100644 --- a/entry/src/main/ets/pages/components/FaceAuth.ets +++ b/entry/src/main/ets/pages/components/FaceAuth.ets @@ -110,6 +110,7 @@ export default struct FaceAuth { aboutToAppear(): void { LogUtils.debug(TAG, 'aboutToAppear'); + AppStorage.setOrCreate('currentPageAuthType', Constants.noticeTypeFace); try { if (this.dialogType === DialogType.PIN_FACE || this.dialogType === DialogType.FACE) { this.prompt = @@ -249,7 +250,9 @@ export default struct FaceAuth { if (payload.type === Constants.noticeTypePin) { if (payload.result === 0) { AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]); - (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + setTimeout(() => { + (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + }, SECOND); } else if (payload.result && payload.result === Constants.authResultPinExpired) { this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager .getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id); @@ -320,13 +323,15 @@ export default struct FaceAuth { AuthUtils.getInstance() .sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFace]); } - (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + setTimeout(() => { + (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + }, SECOND); } } else if (payload.type === Constants.noticeTypeFinger) { const payload: CmdData = item.payload; - let lockoutDuration: number; - let remainAttempts: number; - let authResult: number; + let lockoutDuration: number = 0; + let remainAttempts: number = 0; + let authResult: number = 0; if (item?.event === CmdNotifyEvents.CMD_NOTIFY_AUTH_TIP) { const tipInfo: string = FuncUtils.getStringFromCharCode(payload.tipInfo); if (tipInfo) { @@ -412,7 +417,9 @@ export default struct FaceAuth { AuthUtils.getInstance() .sendNotice(Constants.noticeEventCancel, [Constants.noticeTypeFace, Constants.noticeTypeFinger]); } - (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + setTimeout(() => { + (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + }, SECOND); } } else { LogUtils.error(TAG, 'onCmdDataChange default'); diff --git a/entry/src/main/ets/pages/components/FingerprintAuth.ets b/entry/src/main/ets/pages/components/FingerprintAuth.ets index 8102f7f..431c881 100644 --- a/entry/src/main/ets/pages/components/FingerprintAuth.ets +++ b/entry/src/main/ets/pages/components/FingerprintAuth.ets @@ -81,6 +81,7 @@ export default struct FingerprintAuth { @Link skipLockedBiometricAuth: boolean; aboutToAppear(): void { + AppStorage.setOrCreate('currentPageAuthType', Constants.noticeTypeFinger); AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFinger]); try { if (this.cmdData && this.cmdData.length > 0) { @@ -154,7 +155,7 @@ export default struct FingerprintAuth { } else { lockoutDuration = payload.lockoutDuration; remainAttempts = payload.remainAttempts; - if (payload.result) { + if (payload.result || authResult === 0) { authResult = payload.result; } else { authResult = -1; @@ -165,7 +166,9 @@ export default struct FingerprintAuth { if (payload.type === Constants.noticeTypePin) { if (authResult === 0) { AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]); - (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + setTimeout(() => { + (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + }, SECOND) } else if (authResult && authResult === Constants.authResultPinExpired) { this.inputValue = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager .getStringSync($r('app.string.unified_authwidget_hint_pwd_error').id); @@ -276,7 +279,9 @@ export default struct FingerprintAuth { if (payload.tipType === UserAuthTipType.SINGLE_AUTH_RESULT) { AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypeFinger]); } - (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + setTimeout(() => { + (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); + }, SECOND); } } else { LogUtils.error(TAG, 'onCmdDataChange default'); diff --git a/entry/src/main/ets/pages/components/PasswordAuth.ets b/entry/src/main/ets/pages/components/PasswordAuth.ets index 8721c00..b922d63 100644 --- a/entry/src/main/ets/pages/components/PasswordAuth.ets +++ b/entry/src/main/ets/pages/components/PasswordAuth.ets @@ -84,7 +84,6 @@ export default struct PasswordAuth { return; } if (payload.result === 0) { - AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]); (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); } this.inputValue = ' '; @@ -94,6 +93,7 @@ export default struct PasswordAuth { } aboutToAppear(): void { + AppStorage.setOrCreate('currentPageAuthType', Constants.noticeTypePin); try { if (this.cmdData && this.cmdData.length > 0) { this.onCmdDataChange('first'); -- Gitee From 951e3ff34f5e73ca646160e715a8c3a0d02f57b8 Mon Sep 17 00:00:00 2001 From: adelelimi Date: Mon, 4 Aug 2025 11:23:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A6=82=E7=8E=87?= =?UTF-8?q?=E6=80=A7=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0onresult=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=8C=87=E7=BA=B9?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: adelelimi --- entry/src/main/ets/common/utils/AuthUtils.ts | 11 ++-- entry/src/main/ets/common/utils/FuncUtils.ts | 4 ++ entry/src/main/ets/common/vm/Constants.ts | 18 +++++- .../ets/extensionability/UserAuthAbility.ts | 10 ++-- entry/src/main/ets/pages/Index.ets | 2 +- .../main/ets/pages/components/FaceAuth.ets | 3 +- .../ets/pages/components/FingerprintAuth.ets | 56 ++++++++++++------- .../ets/pages/components/PasswordAuth.ets | 8 +-- 8 files changed, 75 insertions(+), 37 deletions(-) diff --git a/entry/src/main/ets/common/utils/AuthUtils.ts b/entry/src/main/ets/common/utils/AuthUtils.ts index 53774fd..cd22779 100644 --- a/entry/src/main/ets/common/utils/AuthUtils.ts +++ b/entry/src/main/ets/common/utils/AuthUtils.ts @@ -15,13 +15,15 @@ import userAuth from '@ohos.userIAM.userAuth'; import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession'; -import Constants from '../vm/Constants'; +import Constants, { TipCode } from '../vm/Constants'; import LogUtils from './LogUtils'; +import JSON from '@ohos.util.json'; const TAG = 'AuthUtils'; export default class AuthUtils { private static authUtilsInstance: AuthUtils; + private widgetContextId: bigint = BigInt(AppStorage.get('widgetContextId')) ?? BigInt(-1); public static getInstance(): AuthUtils { if (!AuthUtils.authUtilsInstance) { @@ -30,14 +32,15 @@ export default class AuthUtils { return AuthUtils.authUtilsInstance; } - sendNotice(cmd: string, type: Array): void { + sendNotice(cmd: string, type: Array, tipCode: TipCode = TipCode.NORMAL): void { try { const eventData = { - widgetContextId: AppStorage.get('widgetContextId'), + widgetContextId: this.widgetContextId, event: cmd, version: Constants.noticeVersion, payload: { - type: type + type: type, + tipCode: tipCode } }; const jsonEventData = JSON.stringify(eventData); diff --git a/entry/src/main/ets/common/utils/FuncUtils.ts b/entry/src/main/ets/common/utils/FuncUtils.ts index 4049065..0b4d303 100644 --- a/entry/src/main/ets/common/utils/FuncUtils.ts +++ b/entry/src/main/ets/common/utils/FuncUtils.ts @@ -28,6 +28,10 @@ export class FuncUtils { return textEncoder.encode(value); } + getStringFromCharCode(input: Uint8Array): string { + return String.fromCharCode(...input); + } + getDialogType(type: Array): DialogType { if (type) { if (type.includes(userAuth.UserAuthType.PIN)) { diff --git a/entry/src/main/ets/common/vm/Constants.ts b/entry/src/main/ets/common/vm/Constants.ts index da9e593..c99fbb2 100644 --- a/entry/src/main/ets/common/vm/Constants.ts +++ b/entry/src/main/ets/common/vm/Constants.ts @@ -49,6 +49,7 @@ export default class Constants { static noticeEventWidgetReleased = 'EVENT_AUTH_WIDGET_RELEASED'; static noticeEventUserNavigation = 'EVENT_AUTH_USER_NAVIGATION'; static noticeEventProcessTerminate = 'EVENT_AUTH_PROCESS_TERMINATE'; + static noticeEventAuthSendTip = 'EVENT_AUTH_SEND_TIP'; static numKeyBoard : NumKeyBoardItem[] = [ { @@ -150,7 +151,9 @@ export interface CmdData { remainAttempts: number, lockoutDuration: number, result: number, - sensorInfo?: string + sensorInfo?: string, + tipType?: number, + tipInfo?: Uint8Array } export interface CmdType { @@ -174,6 +177,7 @@ export interface WantParams { navigationButtonText?: string, windowModeType: string, cmd: CmdType[], + widgetContextIdStr?: string, } export interface WidgetCommand { @@ -190,4 +194,14 @@ export enum CmdNotifyEvents { CMD_NOTIFY_AUTH_START = 'CMD_NOTIFY_AUTH_START', CMD_NOTIFY_AUTH_RESULT = 'CMD_NOTIFY_AUTH_RESULT', CMD_NOTIFY_AUTH_TIP = 'CMD_NOTIFY_AUTH_TIP' -} \ No newline at end of file +} + +export enum TipCode { + NORMAL = -1, + // 超时 + TIMEOUT = 2, + // 临时冻结 + TEMPORARILY_LOCKED = 3, + // 永久冻结 + PERMANENTLY_LOCKED = 4, +} diff --git a/entry/src/main/ets/extensionability/UserAuthAbility.ts b/entry/src/main/ets/extensionability/UserAuthAbility.ts index 45a659b..4953d7d 100644 --- a/entry/src/main/ets/extensionability/UserAuthAbility.ts +++ b/entry/src/main/ets/extensionability/UserAuthAbility.ts @@ -13,12 +13,13 @@ * limitations under the License. */ -import AuthUtils from '../common/utils/AuthUtils'; -import Constants, { WantParams } from '../common/vm/Constants'; import LogUtils from '../common/utils/LogUtils'; import UserAuthExtensionAbility from '@ohos.app.ability.UserAuthExtensionAbility'; import WindowPrivacyUtils from '../common/utils/WindowPrivacyUtils'; import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession'; +import Constants, { WantParams } from '../common/vm/Constants'; +import type Want from '@ohos.app.ability.Want'; +import AuthUtils from '../common/utils/AuthUtils'; const TAG = 'UserAuthAbility'; // The current interface only support string type @@ -44,7 +45,7 @@ export default class UserAuthAbility extends UserAuthExtensionAbility { LogUtils.info(TAG, 'UserAuthExtensionAbility onDestroy'); } - onSessionCreate(want, session): void { + onSessionCreate(want: Want, session: UIExtensionContentSession): void { LogUtils.info(TAG, 'UserAuthExtensionAbility onSessionCreate'); AppStorage.setOrCreate('wantParams', want?.parameters?.useriamCmdData); AppStorage.setOrCreate('session', session); @@ -64,8 +65,7 @@ export default class UserAuthAbility extends UserAuthExtensionAbility { onSessionDestroy(session): void { LogUtils.info(TAG, 'UserAuthExtensionAbility onSessionDestroy'); - const currentPageAuthType: string = AppStorage.get('currentPageAuthType') as string ?? ''; - AuthUtils.getInstance().sendNotice(Constants.noticeEventProcessTerminate, [currentPageAuthType]); + AuthUtils.getInstance().sendNotice(Constants.noticeEventProcessTerminate, [Constants.noticeTypePin]); WindowPrivacyUtils.setWindowPrivacyMode(session, false); } } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index bf88e8e..1d0d07f 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -215,7 +215,7 @@ struct Index { return userAuth.UserAuthType.PIN; } }) - AppStorage.setOrCreate('widgetContextId', resultInfo?.widgetContextId); + AppStorage.setOrCreate('widgetContextId', resultInfo?.widgetContextIdStr); this.authType = newType; this.type = resultInfo?.type; this.windowModeType = resultInfo?.windowModeType; diff --git a/entry/src/main/ets/pages/components/FaceAuth.ets b/entry/src/main/ets/pages/components/FaceAuth.ets index cd4609e..4f154cf 100644 --- a/entry/src/main/ets/pages/components/FaceAuth.ets +++ b/entry/src/main/ets/pages/components/FaceAuth.ets @@ -110,7 +110,6 @@ export default struct FaceAuth { aboutToAppear(): void { LogUtils.debug(TAG, 'aboutToAppear'); - AppStorage.setOrCreate('currentPageAuthType', Constants.noticeTypeFace); try { if (this.dialogType === DialogType.PIN_FACE || this.dialogType === DialogType.FACE) { this.prompt = @@ -432,7 +431,7 @@ export default struct FaceAuth { if (this.dialogTypeFlag === SIX_PIN || this.dialogTypeFlag === MULTI_PIN) { AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypePin]); } else { - AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] || + AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, (AppStorage.get('wantParams') as WantParams)?.type as string[]); } (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); diff --git a/entry/src/main/ets/pages/components/FingerprintAuth.ets b/entry/src/main/ets/pages/components/FingerprintAuth.ets index 431c881..a053d03 100644 --- a/entry/src/main/ets/pages/components/FingerprintAuth.ets +++ b/entry/src/main/ets/pages/components/FingerprintAuth.ets @@ -29,7 +29,8 @@ import Constants, { CmdType, FingerPosition, UserAuthTipType, - WantParams + WantParams, + TipCode } from '../../common/vm/Constants'; import common from '@ohos.app.ability.common'; @@ -54,6 +55,7 @@ const ON_SCREEN = 1; const UNDER_SCREEN = 2; const FINGER_SENSOR_POSITION_LINE = 0.75; const SECOND = 1000; +export const AUTH_LOCK_TIME: number = 2147483647; @Component export default struct FingerprintAuth { @@ -79,9 +81,9 @@ export default struct FingerprintAuth { @State isOffFinger: boolean = false; @State screenType: number = 0; @Link skipLockedBiometricAuth: boolean; + private fingerprintTipCode: TipCode = TipCode.NORMAL; aboutToAppear(): void { - AppStorage.setOrCreate('currentPageAuthType', Constants.noticeTypeFinger); AuthUtils.getInstance().sendNotice('EVENT_AUTH_TYPE_READY', [Constants.noticeTypeFinger]); try { if (this.cmdData && this.cmdData.length > 0) { @@ -122,6 +124,9 @@ export default struct FingerprintAuth { } } } + if (this.fingerprintTipCode !== TipCode.NORMAL) { + AuthUtils.getInstance().sendNotice(Constants.noticeEventAuthSendTip, [Constants.noticeTypeFinger], this.fingerprintTipCode); + } } catch (error) { LogUtils.error(TAG, 'aboutToAppear PINAuth catch error: ' + error?.code); (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); @@ -139,27 +144,33 @@ export default struct FingerprintAuth { onCmdDataChange(num?: string): void { this.cmdData.length > 0 && this.cmdData.map((item) => { + LogUtils.error(TAG, `item: ${JSON.stringify(item)}`); const payload: CmdData = item.payload; - let lockoutDuration: number; - let remainAttempts: number; - let authResult: number; - if (item?.event === CmdNotifyEvents.CMD_NOTIFY_AUTH_TIP) { - const tipInfo: string = FuncUtils.getStringFromCharCode(payload.tipInfo); - if (tipInfo) { - lockoutDuration = JSON.parse(tipInfo).lockoutDuration as number; - remainAttempts = JSON.parse(tipInfo).authRemainAttempts as number; - authResult = JSON.parse(tipInfo).authResult as number; + let lockoutDuration: number = 0; + let remainAttempts: number = 0; + let authResult: number = -1; + LogUtils.error(TAG, `payload: ${JSON.stringify(payload)}`); + if (payload.type === Constants.noticeTypeFinger){ + if (item?.event === CmdNotifyEvents.CMD_NOTIFY_AUTH_TIP) { + const tipInfo: string = FuncUtils.getStringFromCharCode(payload.tipInfo); + if (tipInfo) { + lockoutDuration = JSON.parse(tipInfo).lockoutDuration as number; + remainAttempts = JSON.parse(tipInfo).authRemainAttempts as number; + authResult = JSON.parse(tipInfo).authResult as number; + } else { + return; + } } else { - return; + lockoutDuration = payload.lockoutDuration ?? 10000; + remainAttempts = payload.remainAttempts; + authResult = payload.result ?? -1; } - } else { + } else if (payload.type === Constants.noticeTypePin){ lockoutDuration = payload.lockoutDuration; remainAttempts = payload.remainAttempts; - if (payload.result || authResult === 0) { - authResult = payload.result; - } else { - authResult = -1; - } + authResult = payload.result; + } else { + return; } LogUtils.info(TAG, `lockoutDuration: ${lockoutDuration} remainAttempts: ${remainAttempts} authResult: ${authResult}`); @@ -234,6 +245,13 @@ export default struct FingerprintAuth { $r('app.string.unified_authwidget_hint_inscreen_fp').id); } if (remainAttempts === AUTH_LOCK) { + if (num === 'first') { + if (lockoutDuration === AUTH_LOCK_TIME) { + this.fingerprintTipCode = TipCode.PERMANENTLY_LOCKED; + } else { + this.fingerprintTipCode = TipCode.TEMPORARILY_LOCKED; + } + } this.prompt = (AppStorage.get('context') as common.ExtensionContext)?.resourceManager .getStringSync($r('app.string.unified_authwidget_title_number_failed_fp_forbidden').id); this.fingerLock = true; @@ -344,7 +362,7 @@ export default struct FingerprintAuth { if (this.state === SIX_PIN || this.state === MULTI_PIN) { AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [Constants.noticeTypePin]); } else { - AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] || + AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, (AppStorage.get('wantParams') as WantParams)?.type as string[]); } (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); diff --git a/entry/src/main/ets/pages/components/PasswordAuth.ets b/entry/src/main/ets/pages/components/PasswordAuth.ets index b922d63..52ecb9f 100644 --- a/entry/src/main/ets/pages/components/PasswordAuth.ets +++ b/entry/src/main/ets/pages/components/PasswordAuth.ets @@ -84,6 +84,7 @@ export default struct PasswordAuth { return; } if (payload.result === 0) { + AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]); (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); } this.inputValue = ' '; @@ -93,7 +94,6 @@ export default struct PasswordAuth { } aboutToAppear(): void { - AppStorage.setOrCreate('currentPageAuthType', Constants.noticeTypePin); try { if (this.cmdData && this.cmdData.length > 0) { this.onCmdDataChange('first'); @@ -117,7 +117,6 @@ export default struct PasswordAuth { aboutToDisappear(): void { LogUtils.info(TAG, 'aboutToAppear pinAuthManager unregisterInputer'); - AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]); pinAuthManager?.unregisterInputer?.(); } @@ -138,8 +137,9 @@ export default struct PasswordAuth { } handleCancel(): void { - AuthUtils.getInstance().sendNotice(Constants.noticeEventCancel, [] || - (AppStorage.get('wantParams') as WantParams)?.type as string[]); + AuthUtils.getInstance().sendNotice(Constants.noticeEventWidgetReleased, [Constants.noticeTypePin]); + AuthUtils.getInstance() + .sendNotice(Constants.noticeEventCancel, (AppStorage.get('wantParams') as WantParams)?.type as string[]); (AppStorage.get('session') as UIExtensionContentSession)?.terminateSelf(); } -- Gitee