提交 71457975 编写于 作者: C cc_ggboy

account arkts告警清理

Signed-off-by: Ncc_ggboy <chenweimin8@huawei.com>
上级 ba0e70f1
...@@ -90,9 +90,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -90,9 +90,7 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
} }
}); });
} catch (err) { } catch (err) {
let code = (err as BusinessError).code console.log('activateOsAccount failed, error:' + JSON.stringify(err));
let message = (err as BusinessError).message
console.error(`activateOsAccount failed, code is ${code}, message is ${message}`);
} }
``` ```
...@@ -180,9 +178,7 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -180,9 +178,7 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void
} }
}); });
} catch (err) { } catch (err) {
let code = (err as BusinessError).code console.log('checkMultiOsAccountEnabled failed, error:' + JSON.stringify(err));
let message = (err as BusinessError).message
console.error(`checkMultiOsAccountEnabled failed, code is ${code}, message is ${message}`);
} }
``` ```
...@@ -218,9 +214,7 @@ checkMultiOsAccountEnabled(): Promise&lt;boolean&gt; ...@@ -218,9 +214,7 @@ checkMultiOsAccountEnabled(): Promise&lt;boolean&gt;
console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`); console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
}); });
} catch (err) { } catch (err) {
let code = (err as BusinessError).code console.log('checkMultiOsAccountEnabled failed, error:' + JSON.stringify(err));
let message = (err as BusinessError).message
console.error(`checkMultiOsAccountEnabled failed, code is ${code}, message is ${message}`);
} }
``` ```
...@@ -3544,7 +3538,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall ...@@ -3544,7 +3538,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall
```ts ```ts
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; let domainInfo: account_osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err: BusinessError, localId: number) => { accountManager.getOsAccountLocalIdFromDomain(domainInfo, (err: BusinessError, localId: number) => {
if (err) { if (err) {
...@@ -3586,7 +3580,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number& ...@@ -3586,7 +3580,7 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&
```ts ```ts
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
let accountManager = account_osAccount.getAccountManager(); let accountManager = account_osAccount.getAccountManager();
let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; let domainInfo: account_osAccount.DomainAccountInfo = {domain: 'testDomain', accountName: 'testAccountName'};
accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((localId: number) => { accountManager.getOsAccountLocalIdFromDomain(domainInfo).then((localId: number) => {
console.log('getOsAccountLocalIdFromDomain successfully, localId: ' + localId); console.log('getOsAccountLocalIdFromDomain successfully, localId: ' + localId);
}).catch((err: BusinessError) => { }).catch((err: BusinessError) => {
...@@ -4128,10 +4122,10 @@ getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number; ...@@ -4128,10 +4122,10 @@ getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
**示例:** **示例:**
```ts ```ts
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let authType = account_osAccount.AuthType.PIN; let authType: account_osAccount.AuthType = account_osAccount.AuthType.PIN;
let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1; let authTrustLevel: account_osAccount.AuthTrustLevel = account_osAccount.AuthTrustLevel.ATL1;
try { try {
let status = userAuth.getAvailableStatus(authType, authTrustLevel); let status: number = userAuth.getAvailableStatus(authType, authTrustLevel);
console.log('getAvailableStatus status = ' + status); console.log('getAvailableStatus status = ' + status);
} catch (e) { } catch (e) {
console.log('getAvailableStatus exception = ' + JSON.stringify(e)); console.log('getAvailableStatus exception = ' + JSON.stringify(e));
...@@ -4168,7 +4162,7 @@ getProperty(request: GetPropertyRequest, callback: AsyncCallback&lt;ExecutorProp ...@@ -4168,7 +4162,7 @@ getProperty(request: GetPropertyRequest, callback: AsyncCallback&lt;ExecutorProp
```ts ```ts
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let keys = [ let keys: Array<account_osAccount.GetPropertyType> = [
account_osAccount.GetPropertyType.AUTH_SUB_TYPE, account_osAccount.GetPropertyType.AUTH_SUB_TYPE,
account_osAccount.GetPropertyType.REMAIN_TIMES, account_osAccount.GetPropertyType.REMAIN_TIMES,
account_osAccount.GetPropertyType.FREEZING_TIME account_osAccount.GetPropertyType.FREEZING_TIME
...@@ -4222,7 +4216,7 @@ getProperty(request: GetPropertyRequest): Promise&lt;ExecutorProperty&gt;; ...@@ -4222,7 +4216,7 @@ getProperty(request: GetPropertyRequest): Promise&lt;ExecutorProperty&gt;;
```ts ```ts
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let keys = [ let keys: Array<account_osAccount.GetPropertyType> = [
account_osAccount.GetPropertyType.AUTH_SUB_TYPE, account_osAccount.GetPropertyType.AUTH_SUB_TYPE,
account_osAccount.GetPropertyType.REMAIN_TIMES, account_osAccount.GetPropertyType.REMAIN_TIMES,
account_osAccount.GetPropertyType.FREEZING_TIME account_osAccount.GetPropertyType.FREEZING_TIME
...@@ -4325,13 +4319,13 @@ setProperty(request: SetPropertyRequest): Promise&lt;void&gt;; ...@@ -4325,13 +4319,13 @@ setProperty(request: SetPropertyRequest): Promise&lt;void&gt;;
```ts ```ts
import { BusinessError } from '@ohos.base'; import { BusinessError } from '@ohos.base';
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let request2: account_osAccount.SetPropertyRequest = { let request: account_osAccount.SetPropertyRequest = {
authType: account_osAccount.AuthType.PIN, authType: account_osAccount.AuthType.PIN,
key: account_osAccount.SetPropertyType.INIT_ALGORITHM, key: account_osAccount.SetPropertyType.INIT_ALGORITHM,
setInfo: new Uint8Array([0]) setInfo: new Uint8Array([0])
}; };
try { try {
userAuth.setProperty(request2).then(() => { userAuth.setProperty(request).then(() => {
console.log('setProperty successfully'); console.log('setProperty successfully');
}).catch((err: BusinessError) => { }).catch((err: BusinessError) => {
console.log('setProperty failed, error = ' + JSON.stringify(err)); console.log('setProperty failed, error = ' + JSON.stringify(err));
...@@ -4386,12 +4380,12 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, ...@@ -4386,12 +4380,12 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel,
**示例:** **示例:**
```ts ```ts
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let challenge = new Uint8Array([0]); let challenge: Uint8Array = new Uint8Array([0]);
let authType = account_osAccount.AuthType.PIN; let authType: account_osAccount.AuthType = account_osAccount.AuthType.PIN;
let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1; let authTrustLevel: account_osAccount.AuthTrustLevel = account_osAccount.AuthTrustLevel.ATL1;
try { try {
userAuth.auth(challenge, authType, authTrustLevel, { userAuth.auth(challenge, authType, authTrustLevel, {
onResult: (result,extraInfo) => { onResult: (result: number, extraInfo: account_osAccount.AuthResult) => {
console.log('auth result = ' + result); console.log('auth result = ' + result);
console.log('auth extraInfo = ' + JSON.stringify(extraInfo)); console.log('auth extraInfo = ' + JSON.stringify(extraInfo));
} }
...@@ -4448,9 +4442,9 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev ...@@ -4448,9 +4442,9 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev
```ts ```ts
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let userID: number = 100; let userID: number = 100;
let challenge = new Uint8Array([0]); let challenge: Uint8Array = new Uint8Array([0]);
let authType = account_osAccount.AuthType.PIN; let authType: account_osAccount.AuthType = account_osAccount.AuthType.PIN;
let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1; let authTrustLevel: account_osAccount.AuthTrustLevel = account_osAccount.AuthTrustLevel.ATL1;
try { try {
userAuth.authUser(userID, challenge, authType, authTrustLevel, { userAuth.authUser(userID, challenge, authType, authTrustLevel, {
onResult: (result,extraInfo) => { onResult: (result,extraInfo) => {
...@@ -4493,7 +4487,7 @@ cancelAuth(contextID: Uint8Array): void; ...@@ -4493,7 +4487,7 @@ cancelAuth(contextID: Uint8Array): void;
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let pinAuth: account_osAccount.PINAuth = new account_osAccount.PINAuth(); let pinAuth: account_osAccount.PINAuth = new account_osAccount.PINAuth();
let challenge = new Uint8Array([0]); let challenge = new Uint8Array([0]);
let contextId = userAuth.auth(challenge, account_osAccount.AuthType.PIN, account_osAccount.AuthTrustLevel.ATL1, { let contextId: Uint8Array = userAuth.auth(challenge, account_osAccount.AuthType.PIN, account_osAccount.AuthTrustLevel.ATL1, {
onResult: (result: number, extraInfo: account_osAccount.AuthResult) => { onResult: (result: number, extraInfo: account_osAccount.AuthResult) => {
console.log('auth result = ' + result); console.log('auth result = ' + result);
console.log('auth extraInfo = ' + JSON.stringify(extraInfo)); console.log('auth extraInfo = ' + JSON.stringify(extraInfo));
...@@ -4621,7 +4615,7 @@ static registerInputer(authType: AuthType, inputer: IInputer): void ...@@ -4621,7 +4615,7 @@ static registerInputer(authType: AuthType, inputer: IInputer): void
**示例:** **示例:**
```ts ```ts
let authType = account_osAccount.AuthType.DOMAIN; let authType: account_osAccount.AuthType = account_osAccount.AuthType.DOMAIN;
let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0]); let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0]);
try { try {
account_osAccount.InputerManager.registerInputer(authType, { account_osAccount.InputerManager.registerInputer(authType, {
...@@ -4661,7 +4655,7 @@ static unregisterInputer(authType: AuthType): void ...@@ -4661,7 +4655,7 @@ static unregisterInputer(authType: AuthType): void
**示例:** **示例:**
```ts ```ts
let authType = account_osAccount.AuthType.DOMAIN; let authType: account_osAccount.AuthType = account_osAccount.AuthType.DOMAIN;
try { try {
account_osAccount.InputerManager.unregisterInputer(authType); account_osAccount.InputerManager.unregisterInputer(authType);
console.log('unregisterInputer success.'); console.log('unregisterInputer success.');
...@@ -4726,9 +4720,9 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs ...@@ -4726,9 +4720,9 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs
} }
account_osAccount.DomainAccountManager.registerPlugin(plugin); account_osAccount.DomainAccountManager.registerPlugin(plugin);
let userAuth = new account_osAccount.UserAuth(); let userAuth = new account_osAccount.UserAuth();
let challenge = new Uint8Array([0]); let challenge: Uint8Array = new Uint8Array([0]);
let authType = account_osAccount.AuthType.DOMAIN; let authType: account_osAccount.AuthType = account_osAccount.AuthType.DOMAIN;
let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1; let authTrustLevel: account_osAccount.AuthTrustLevel = account_osAccount.AuthTrustLevel.ATL1;
try { try {
userAuth.auth(challenge, authType, authTrustLevel, { userAuth.auth(challenge, authType, authTrustLevel, {
onResult: (resultCode: number, authResult: account_osAccount.AuthResult) => { onResult: (resultCode: number, authResult: account_osAccount.AuthResult) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册