提交 6c3ca987 编写于 作者: X xinking129

fix code check

Signed-off-by: Nxinking129 <xinxin13@huawei.com>
上级 b02c7e67
...@@ -13,19 +13,15 @@ ...@@ -13,19 +13,15 @@
* limitations under the License. * limitations under the License.
*/ */
import ActionExtensionAbility from '@ohos.app.ability.ActionExtensionAbility'; import ActionExtensionAbility from '@ohos.app.ability.ActionExtensionAbility';
import wantConstant from '@ohos.app.ability.wantConstant';
import commonEvent from '@ohos.commonEventManager';
import hilog from '@ohos.hilog';
export default class UiExtAbility extends ActionExtensionAbility { export default class UiExtAbility extends ActionExtensionAbility {
onCreate() { onCreate() {
hilog.info(0x0000, 'testTag', 'UIExtAbility onCreate want: %{public}s');
console.info('=======>UIExtAbility onCreate======>'); console.info('=======>UIExtAbility onCreate======>');
} }
onSessionCreate(want, session) { onSessionCreate(want, session) {
console.log(`want: ${JSON.stringify(want)}}`); console.log(`want: ${JSON.stringify(want)}}`);
var storage: LocalStorage = new LocalStorage({ let storage: LocalStorage = new LocalStorage({
'session': session 'session': session
}); });
session.loadContent('pages/Page', storage); session.loadContent('pages/Page', storage);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import ActionExtensionAbility from '@ohos.app.ability.ActionExtensionAbility'; import ActionExtensionAbility from '@ohos.app.ability.ActionExtensionAbility';
import commonEventManager from '@ohos.commonEventManager'; import commonEventManager from '@ohos.commonEventManager';
var count = 0; let count = 0;
const TIME_OUT = 500; const TIME_OUT = 500;
export default class ActsActionExtensionAbility extends ActionExtensionAbility { export default class ActsActionExtensionAbility extends ActionExtensionAbility {
storage: LocalStorage; storage: LocalStorage;
...@@ -28,18 +28,18 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility { ...@@ -28,18 +28,18 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility {
onForeground() { onForeground() {
console.log('====>ActsActionExtensionAbility onForeground called'); console.log('====>ActsActionExtensionAbility onForeground called');
count++; count++;
var options = { let options = {
parameters: { parameters: {
'count': count 'count': count
} }
} };
commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function (){}); commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function () {});
} }
onBackground() { onBackground() {
console.log('====>ActsActionExtensionAbility onBackground called'); console.log('====>ActsActionExtensionAbility onBackground called');
count++; count++;
commonEventManager.publish('ACTS_TEST_BACKGROUND', function (){}); commonEventManager.publish('ACTS_TEST_BACKGROUND', function () {});
setTimeout(() => { setTimeout(() => {
globalThis.session.terminateSelf(); globalThis.session.terminateSelf();
}, TIME_OUT); }, TIME_OUT);
...@@ -61,12 +61,12 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility { ...@@ -61,12 +61,12 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility {
onDestroy() { onDestroy() {
console.log('====>ActsActionExtensionAbility onDestroy called'); console.log('====>ActsActionExtensionAbility onDestroy called');
count++; count++;
var options = { let options = {
parameters: { parameters: {
'count': count 'count': count
} }
} };
commonEventManager.publish('ACTS_TEST_DESTROY', options, function (){}); commonEventManager.publish('ACTS_TEST_DESTROY', options, function () {});
} }
onSessionDestroy(session) { onSessionDestroy(session) {
......
...@@ -29,8 +29,8 @@ export default class EntryAbility extends UIAbility { ...@@ -29,8 +29,8 @@ export default class EntryAbility extends UIAbility {
'ability.want.params.uiExtensionType': 'action' 'ability.want.params.uiExtensionType': 'action'
} }
}).catch((err)=>{ }).catch((err)=>{
console.info('====>ActionExtensionAbility_0100 err:'+ JSON.stringify(err)); console.info('====>ActionExtensionAbility_0100 err:' + JSON.stringify(err));
}) });
} }
if (want.action === 'AsyncCallback_0200') { if (want.action === 'AsyncCallback_0200') {
......
...@@ -25,7 +25,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -25,7 +25,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
onSessionCreate(want, session) { onSessionCreate(want, session) {
console.log(`want: ${JSON.stringify(want)}}`); console.log(`want: ${JSON.stringify(want)}}`);
var storage: LocalStorage = new LocalStorage({ let storage: LocalStorage = new LocalStorage({
'session': session 'session': session
}); });
session.loadContent('pages/Page', storage); session.loadContent('pages/Page', storage);
...@@ -42,7 +42,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -42,7 +42,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
} }
}, (error) => { }, (error) => {
console.info('=======>Acts_ActionExtensionAbility_1000 error.code ======>' + error.code); console.info('=======>Acts_ActionExtensionAbility_1000 error.code ======>' + error.code);
var commonEventData = { let commonEventData = {
parameters: { parameters: {
num: error.code num: error.code
} }
...@@ -64,7 +64,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -64,7 +64,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
} }
}).then(() => { }).then(() => {
console.info('=======>Acts_ActionExtensionAbility_1100 UIExtAbility startAbility success ======>'); console.info('=======>Acts_ActionExtensionAbility_1100 UIExtAbility startAbility success ======>');
var commonEventData = { let commonEventData = {
parameters: { parameters: {
str: 'success' str: 'success'
} }
...@@ -74,7 +74,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -74,7 +74,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
}); });
}).catch((err) => { }).catch((err) => {
console.debug('====>Acts_ActionExtensionAbility_1100 UIExtAbility startAbility err:' + JSON.stringify(err)); console.debug('====>Acts_ActionExtensionAbility_1100 UIExtAbility startAbility err:' + JSON.stringify(err));
}) });
} }
if (want.action === 'Acts_ActionExtensionAbility_1200') { if (want.action === 'Acts_ActionExtensionAbility_1200') {
...@@ -88,7 +88,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -88,7 +88,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
} }
}, (error) => { }, (error) => {
console.info('=======>Acts_ActionExtensionAbility_1200 error.code ======>' + error.code); console.info('=======>Acts_ActionExtensionAbility_1200 error.code ======>' + error.code);
var commonEventData = { let commonEventData = {
parameters: { parameters: {
num: error.code num: error.code
} }
...@@ -112,7 +112,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -112,7 +112,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
console.info('=======>Acts_ActionExtensionAbility_1300 error.code ======>' + error.code); console.info('=======>Acts_ActionExtensionAbility_1300 error.code ======>' + error.code);
console.info('=======>Acts_ActionExtensionAbility_1300 data.resultCode ======>' + data.resultCode); console.info('=======>Acts_ActionExtensionAbility_1300 data.resultCode ======>' + data.resultCode);
console.info('=======>Acts_ActionExtensionAbility_1300 data.action ======>' + data.want.parameters.action); console.info('=======>Acts_ActionExtensionAbility_1300 data.action ======>' + data.want.parameters.action);
var commonEventData = { let commonEventData = {
parameters: { parameters: {
num: error.code, num: error.code,
str: data.want.parameters.action, str: data.want.parameters.action,
...@@ -137,7 +137,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -137,7 +137,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
}).then((data) => { }).then((data) => {
console.info('=======>Acts_ActionExtensionAbility_1400 data.resultCode ======>' + data.resultCode); console.info('=======>Acts_ActionExtensionAbility_1400 data.resultCode ======>' + data.resultCode);
console.info('=======>Acts_ActionExtensionAbility_1400 data.action ======>' + data.want.parameters.action); console.info('=======>Acts_ActionExtensionAbility_1400 data.action ======>' + data.want.parameters.action);
var commonEventData = { let commonEventData = {
parameters: { parameters: {
str: data.want.parameters.action, str: data.want.parameters.action,
result: data.resultCode result: data.resultCode
...@@ -162,7 +162,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -162,7 +162,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
} }
}, (error, data) => { }, (error, data) => {
console.info('=======>Acts_ActionExtensionAbility_1500 first from own error.code ======>' + error.code); console.info('=======>Acts_ActionExtensionAbility_1500 first from own error.code ======>' + error.code);
var commonEventData = { let commonEventData = {
parameters: { parameters: {
num: error.code num: error.code
} }
...@@ -179,7 +179,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -179,7 +179,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
parameters: { parameters: {
'result': data 'result': data
} }
} };
commonEvent.publish('setReceiveDataCallback', options, (err) => { commonEvent.publish('setReceiveDataCallback', options, (err) => {
console.log('Acts_ActionExtensionAbility_1600'); console.log('Acts_ActionExtensionAbility_1600');
}); });
...@@ -194,7 +194,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -194,7 +194,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
abilityName: 'ActsActionExtensionAbility' abilityName: 'ActsActionExtensionAbility'
}, (error, data) => { }, (error, data) => {
console.info('=======>Acts_ActionExtensionAbility_1800 first from own error.code ======>' + error.code); console.info('=======>Acts_ActionExtensionAbility_1800 first from own error.code ======>' + error.code);
var commonEventData = { let commonEventData = {
parameters: { parameters: {
num: error.code num: error.code
} }
...@@ -210,7 +210,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -210,7 +210,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
parameters: { parameters: {
'context': this.context 'context': this.context
} }
} };
commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => { commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => {
console.log('Acts_ActionExtensionAbility_context'); console.log('Acts_ActionExtensionAbility_context');
}); });
...@@ -330,24 +330,24 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -330,24 +330,24 @@ export default class UiExtAbility extends ActionExtensionAbility {
} }
if (want.action === 'Acts_ActionExtensionAbility_3000') { if (want.action === 'Acts_ActionExtensionAbility_3000') {
var moduleContext = this.context.createModuleContext('entry'); let moduleContext = this.context.createModuleContext('entry');
let options = { let options = {
parameters: { parameters: {
'bundleName': moduleContext.applicationInfo.name 'bundleName': moduleContext.applicationInfo.name
} }
} };
commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => { commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => {
console.log('Acts_ActionExtensionAbility_context'); console.log('Acts_ActionExtensionAbility_context');
}); });
} }
if (want.action === 'Acts_ActionExtensionAbility_3100') { if (want.action === 'Acts_ActionExtensionAbility_3100') {
var moduleContext = this.context.createModuleContext('entry_test'); let moduleContext = this.context.createModuleContext('entry_test');
let options = { let options = {
parameters: { parameters: {
'bundleName': moduleContext.applicationInfo.name 'bundleName': moduleContext.applicationInfo.name
} }
} };
commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => { commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => {
console.log('Acts_ActionExtensionAbility_context'); console.log('Acts_ActionExtensionAbility_context');
}); });
...@@ -355,7 +355,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -355,7 +355,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
if (want.action === 'Acts_ActionExtensionAbility_3200') { if (want.action === 'Acts_ActionExtensionAbility_3200') {
try { try {
var moduleContext = this.context.createModuleContext('entry_assist'); let moduleContext = this.context.createModuleContext('entry_assist');
} catch { } catch {
console.log('createModuleContext err'); console.log('createModuleContext err');
} }
...@@ -363,7 +363,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -363,7 +363,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
parameters: { parameters: {
'moduleContext': moduleContext 'moduleContext': moduleContext
} }
} };
commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => { commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => {
console.log('Acts_ActionExtensionAbility_context'); console.log('Acts_ActionExtensionAbility_context');
}); });
...@@ -371,7 +371,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -371,7 +371,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
if (want.action === 'Acts_ActionExtensionAbility_3300') { if (want.action === 'Acts_ActionExtensionAbility_3300') {
try { try {
var moduleContext = this.context.createModuleContext('abc'); let moduleContext = this.context.createModuleContext('abc');
} catch { } catch {
console.log('createModuleContext err'); console.log('createModuleContext err');
} }
...@@ -379,7 +379,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -379,7 +379,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
parameters: { parameters: {
'moduleContext': moduleContext 'moduleContext': moduleContext
} }
} };
commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => { commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => {
console.log('Acts_ActionExtensionAbility_context'); console.log('Acts_ActionExtensionAbility_context');
}); });
...@@ -387,7 +387,7 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -387,7 +387,7 @@ export default class UiExtAbility extends ActionExtensionAbility {
if (want.action === 'Acts_ActionExtensionAbility_3400') { if (want.action === 'Acts_ActionExtensionAbility_3400') {
try { try {
var moduleContext = this.context.createModuleContext(undefined); let moduleContext = this.context.createModuleContext(undefined);
} catch { } catch {
console.log('createModuleContext err'); console.log('createModuleContext err');
} }
...@@ -395,19 +395,19 @@ export default class UiExtAbility extends ActionExtensionAbility { ...@@ -395,19 +395,19 @@ export default class UiExtAbility extends ActionExtensionAbility {
parameters: { parameters: {
'moduleContext': moduleContext 'moduleContext': moduleContext
} }
} };
commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => { commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => {
console.log('Acts_ActionExtensionAbility_context'); console.log('Acts_ActionExtensionAbility_context');
}); });
} }
if (want.action === 'Acts_ActionExtensionAbility_3500') { if (want.action === 'Acts_ActionExtensionAbility_3500') {
var applicationContext = this.context.getApplicationContext(); let applicationContext = this.context.getApplicationContext();
let options = { let options = {
parameters: { parameters: {
'applicationContext': applicationContext 'applicationContext': applicationContext
} }
} };
commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => { commonEvent.publish('ACTS_TEST_CONTEXT', options, (err) => {
console.log('Acts_ActionExtensionAbility_context'); console.log('Acts_ActionExtensionAbility_context');
}); });
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import ActionExtensionAbility from '@ohos.app.ability.ActionExtensionAbility'; import ActionExtensionAbility from '@ohos.app.ability.ActionExtensionAbility';
import commonEventManager from '@ohos.commonEventManager'; import commonEventManager from '@ohos.commonEventManager';
var count = 0; let count = 0;
const TIME_OUT = 500; const TIME_OUT = 500;
export default class ActsActionExtensionAbility extends ActionExtensionAbility { export default class ActsActionExtensionAbility extends ActionExtensionAbility {
storage: LocalStorage; storage: LocalStorage;
...@@ -32,14 +32,14 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility { ...@@ -32,14 +32,14 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility {
parameters: { parameters: {
'count': count 'count': count
} }
} };
commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function (){}); commonEventManager.publish('ACTS_TEST_FOREGROUND', options, function () {});
} }
onBackground() { onBackground() {
console.log('====>ActsActionExtensionAbility onBackground called'); console.log('====>ActsActionExtensionAbility onBackground called');
count++; count++;
commonEventManager.publish('ACTS_TEST_BACKGROUND', function (){}); commonEventManager.publish('ACTS_TEST_BACKGROUND', function () {});
setTimeout(() => { setTimeout(() => {
globalThis.session.terminateSelf(); globalThis.session.terminateSelf();
}, TIME_OUT); }, TIME_OUT);
...@@ -61,12 +61,12 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility { ...@@ -61,12 +61,12 @@ export default class ActsActionExtensionAbility extends ActionExtensionAbility {
onDestroy() { onDestroy() {
console.log('====>ActsActionExtensionAbility onDestroy called'); console.log('====>ActsActionExtensionAbility onDestroy called');
count++; count++;
var options = { let options = {
parameters: { parameters: {
'count': count 'count': count
} }
} };
commonEventManager.publish('ACTS_TEST_DESTROY', options, function (){}); commonEventManager.publish('ACTS_TEST_DESTROY', options, function () {});
} }
onSessionDestroy(session) { onSessionDestroy(session) {
......
...@@ -31,7 +31,7 @@ export default class FeatureActionExtensionAbility extends ActionExtensionAbilit ...@@ -31,7 +31,7 @@ export default class FeatureActionExtensionAbility extends ActionExtensionAbilit
onSessionCreate(want, session) { onSessionCreate(want, session) {
console.log('====>FeatureActionExtensionAbility onSessionCreate called'); console.log('====>FeatureActionExtensionAbility onSessionCreate called');
commonEventManager.publish('ACTS_FEATURE_CREATE', function (){}); commonEventManager.publish('ACTS_FEATURE_CREATE', function () {});
if (want.action === 'Acts_ActionExtensionAbility_0400') { if (want.action === 'Acts_ActionExtensionAbility_0400') {
this.context.startAbility({ this.context.startAbility({
bundleName: 'com.example.actsactionextensionabilitytest', bundleName: 'com.example.actsactionextensionabilitytest',
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility';
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
import window from '@ohos.window'; import type window from '@ohos.window';
export default class FeatureAbility extends UIAbility { export default class FeatureAbility extends UIAbility {
onCreate(want, launchParam) { onCreate(want, launchParam) {
......
...@@ -16,8 +16,8 @@ import hilog from '@ohos.hilog'; ...@@ -16,8 +16,8 @@ import hilog from '@ohos.hilog';
import TestRunner from '@ohos.application.testRunner'; import TestRunner from '@ohos.application.testRunner';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
var abilityDelegator = undefined; let abilityDelegator = undefined;
var abilityDelegatorArguments = undefined; let abilityDelegatorArguments = undefined;
async function onAbilityCreateCallback() { async function onAbilityCreateCallback() {
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
...@@ -39,14 +39,14 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -39,14 +39,14 @@ export default class OpenHarmonyTestRunner implements TestRunner {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments(); abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility';
var lMonitor = { let lMonitor = {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback); abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback);
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName;
var debug = abilityDelegatorArguments.parameters['-D']; let debug = abilityDelegatorArguments.parameters['-D'];
if (debug == 'true') { if (debug == 'true') {
cmd += ' -D'; cmd += ' -D';
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册