diff --git a/common/src/main/ets/default/layoutconfig/LayoutConfigManager.ts b/common/src/main/ets/default/layoutconfig/LayoutConfigManager.ts index 98d0b6a2..3fe5fcc6 100644 --- a/common/src/main/ets/default/layoutconfig/LayoutConfigManager.ts +++ b/common/src/main/ets/default/layoutconfig/LayoutConfigManager.ts @@ -138,9 +138,11 @@ class LayoutConfigManager { private getTargetTypeConfigs(configType: number) { let configArr = new Array(); - configArr = configArr.concat(this.mProductConfig[configType]); - configArr = configArr.concat(this.mFeatureConfig[configType]); - configArr = configArr.concat(this.mCommonConfig[configType]); + if (this.mProductConfig[configType] && this.mFeatureConfig[configType] && this.mCommonConfig[configType]) { + configArr = configArr.concat(this.mProductConfig[configType]); + configArr = configArr.concat(this.mFeatureConfig[configType]); + configArr = configArr.concat(this.mCommonConfig[configType]); + } return configArr; } } diff --git a/product/pad/src/main/ets/MainAbility/MainAbility.ts b/product/pad/src/main/ets/MainAbility/MainAbility.ts index 5a3f8134..6583f250 100644 --- a/product/pad/src/main/ets/MainAbility/MainAbility.ts +++ b/product/pad/src/main/ets/MainAbility/MainAbility.ts @@ -87,13 +87,14 @@ export default class MainAbility extends ServiceExtension { } private registerInputConsumer(): void { - // register/unregister HOME inputConsumer - inputConsumer.on('key', { + let onKeyCodeHome = { preKeys: [], finalKey: KeyCode.KEYCODE_HOME, finalKeyDownDuration: 0, isFinalKeyDown: true - }, () => { + } + // register/unregister HOME inputConsumer + inputConsumer.on('key', onKeyCodeHome, () => { Log.showInfo(TAG, 'HOME inputConsumer homeEvent start'); globalThis.desktopContext.startAbility({ bundleName: CommonConstants.LAUNCHER_BUNDLE, @@ -106,33 +107,36 @@ export default class MainAbility extends ServiceExtension { Log.showDebug(TAG, 'HOME inputConsumer startAbility Promise in service failed.'); }); }); - // register/unregister RECENT inputConsumer - inputConsumer.on('key', { + let onKeyCodeFunction = { preKeys: [], finalKey: KeyCode.KEYCODE_FUNCTION, finalKeyDownDuration: 0, isFinalKeyDown: true - }, () => { + } + // register/unregister RECENT inputConsumer + inputConsumer.on('key', onKeyCodeFunction, () => { Log.showInfo(TAG, 'RECENT inputConsumer recentEvent start'); windowManager.createWindowWithName(windowManager.RECENT_WINDOW_NAME, windowManager.RECENT_RANK); }); } private unregisterInputConsumer(): void { - // unregister HOME inputConsumer - inputConsumer.off('key', { + let offKeyCodeHome = { preKeys: [], finalKey: KeyCode.KEYCODE_HOME, finalKeyDownDuration: 0, isFinalKeyDown: true - }); - // unregister RECENT inputConsumer - inputConsumer.off('key', { + } + // unregister HOME inputConsumer + inputConsumer.off('key', offKeyCodeHome); + let offKeyCodeFunction = { preKeys: [], finalKey: KeyCode.KEYCODE_FUNCTION, finalKeyDownDuration: 0, isFinalKeyDown: true - }); + } + // unregister RECENT inputConsumer + inputConsumer.off('key', offKeyCodeFunction); } private initGlobalConst(): void { diff --git a/product/phone/src/main/ets/MainAbility/MainAbility.ts b/product/phone/src/main/ets/MainAbility/MainAbility.ts index 26d629c2..ffae128f 100644 --- a/product/phone/src/main/ets/MainAbility/MainAbility.ts +++ b/product/phone/src/main/ets/MainAbility/MainAbility.ts @@ -89,13 +89,14 @@ export default class MainAbility extends ServiceExtension { } private registerInputConsumer(): void { - // register/unregister HOME inputConsumer - inputConsumer.on('key', { + let onKeyCodeHome = { preKeys: [], finalKey: KeyCode.KEYCODE_HOME, finalKeyDownDuration: 0, isFinalKeyDown: true - }, () => { + } + // register/unregister HOME inputConsumer + inputConsumer.on('key', onKeyCodeHome, () => { Log.showInfo(TAG, 'HOME inputConsumer homeEvent start'); globalThis.desktopContext.startAbility({ bundleName: CommonConstants.LAUNCHER_BUNDLE, @@ -108,33 +109,36 @@ export default class MainAbility extends ServiceExtension { Log.showDebug(TAG, 'HOME inputConsumer startAbility Promise in service failed.'); }); }); - // register/unregister RECENT inputConsumer - inputConsumer.on('key', { + let onKeyCodeFunction = { preKeys: [], finalKey: KeyCode.KEYCODE_FUNCTION, finalKeyDownDuration: 0, isFinalKeyDown: true - }, () => { + } + // register/unregister RECENT inputConsumer + inputConsumer.on('key', onKeyCodeFunction, () => { Log.showInfo(TAG, 'RECENT inputConsumer recentEvent start'); windowManager.createWindowWithName(windowManager.RECENT_WINDOW_NAME, windowManager.RECENT_RANK); }); } private unregisterInputConsumer(): void { - // unregister HOME inputConsumer - inputConsumer.off('key', { + let offKeyCodeHome = { preKeys: [], finalKey: KeyCode.KEYCODE_HOME, finalKeyDownDuration: 0, isFinalKeyDown: true - }); - // unregister RECENT inputConsumer - inputConsumer.off('key', { + } + // unregister HOME inputConsumer + inputConsumer.off('key', offKeyCodeHome); + let offKeyCodeFunction = { preKeys: [], finalKey: KeyCode.KEYCODE_FUNCTION, finalKeyDownDuration: 0, isFinalKeyDown: true - }); + } + // unregister RECENT inputConsumer + inputConsumer.off('key', offKeyCodeFunction); } private initGlobalConst(): void {