diff --git a/features/brightnesscomponent/src/main/ets/default/brightnessManager.ts b/features/brightnesscomponent/src/main/ets/default/brightnessManager.ts index ef66d3e8c0c2a3fb7f0e49649ae82005a503df2c..6e879ae311660b72fda70faf3f5b219765617644 100644 --- a/features/brightnesscomponent/src/main/ets/default/brightnessManager.ts +++ b/features/brightnesscomponent/src/main/ets/default/brightnessManager.ts @@ -38,7 +38,7 @@ export class brightnessManager { constructor() { this.uri = Constants.getUriSync(Constants.KEY_BRIGHTNESS_STATUS); Log.showInfo(TAG, 'settings geturi of brightness is ' + Constants.URI_VAR); - this.context = AbilityManager.getContext(AbilityManager.ABILITY_NAME_CONTROL_PANEL); + this.context = AbilityManager.getContext(AbilityManager.getContextName(AbilityManager.ABILITY_NAME_CONTROL_PANEL)); this.init(); } @@ -49,11 +49,6 @@ export class brightnessManager { } public createDataShare() { - if (this.context == undefined || this.context == null) { - Log.showInfo(TAG, `constructor, this.context is null`); - return; - } - Log.showInfo(TAG, `createDataShare, this.context ${this.context}`); const UPDATE_INTERVAL = 500; const timer = setInterval(() => { dataShare.createDataShareHelper(this.context, this.uri)