Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c6204c7c
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c6204c7c
编写于
12月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12643 add account changelogs
Merge pull request !12643 from jidong/dev121901
上级
7ad4fdb2
d5fd47a5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
105 addition
and
0 deletion
+105
-0
zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-account_os_account.md
...logs/OpenHarmony_3.2.8.1/changelogs-account_os_account.md
+105
-0
未找到文件。
zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-account_os_account.md
0 → 100644
浏览文件 @
c6204c7c
# 帐号子系统changeLog
## cl.account_os_account.1 变更错误码定义及其返回方式
针对帐号子系统API存在错误码定义不统一和抛出方式不符合OpenHarmony错误码规范的问题,从API9开始作以下变更:
-
新增统一的错误码定义:
-
[
帐号公共错误码
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-account.md
)
-
[
应用帐号错误码
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-app-account.md
)
-
按以下方式返回错误码:
-
异步接口:错误信息通过AsyncCallback或Promise的error对象返回。其中,参数类型和数量错误信息,通过抛出异常的方式返回。
-
同步接口:错误信息通过抛出异常的方式返回。
**变更影响**
基于此前版本开发的应用,需适配变更后的新错误码和错误信息返回方式,否则会影响原有业务逻辑。
**关键接口/组件变更**
以下接口涉及新错误码和错误信息返回方式变更:
-
class AccountManager
-
activateOsAccount(localId: number, callback: AsyncCallback
<
void
>
): void;
-
removeOsAccount(localId: number, callback: AsyncCallback
<
void
>
): void;
-
setOsAccountConstraints(localId: number, constraints: Array
<
string
>
, enable: boolean, callback: AsyncCallback
<
void
>
): void;
-
setOsAccountName(localId: number, localName: string, callback: AsyncCallback
<
void
>
): void;
-
queryMaxOsAccountNumber(callback: AsyncCallback
<
number
>
): void;
-
queryAllCreatedOsAccounts(callback: AsyncCallback
<
Array
<
OsAccountInfo
>>
): void;
-
createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback
<
OsAccountInfo
>
): void;
-
createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback
<
OsAccountInfo
>
): void;
-
queryOsAccountById(localId: number, callback: AsyncCallback
<
OsAccountInfo
>
): void;
-
getOsAccountProfilePhoto(localId: number, callback: AsyncCallback
<
string
>
): void;
-
setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
<
void
>
): void;
-
on(type: 'activate' | 'activating', name: string, callback: Callback
<
number
>
): void;
-
off(type: 'activate' | 'activating', name: string, callback?: Callback
<
number
>
): void;
-
isMainOsAccount(callback: AsyncCallback
<
boolean
>
): void;
-
queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback
<
Array
<
ConstraintSourceTypeInfo
>>
): void;
-
class UserAuth
-
constructor();
-
getVersion(): number;
-
getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
-
getProperty(request: GetPropertyRequest, callback: AsyncCallback
<
ExecutorProperty
>
): void;
-
setProperty(request: SetPropertyRequest, callback: AsyncCallback
<
number
>
): void;
-
auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
-
authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
-
cancelAuth(contextID: Uint8Array): number;
-
class PINAuth
-
constructor();
-
registerInputer(inputer: IInputer): boolean;
-
unregisterInputer(authType: AuthType): void;
-
class UserIdentityManager
-
constructor();
-
openSession(callback: AsyncCallback
<
Uint8Array
>
): void;
-
addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
-
updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
-
closeSession(): void;
-
cancel(challenge: Uint8Array): number;
-
delUser(token: Uint8Array, callback: IIdmCallback): void;
-
delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void;
-
getAuthInfo(callback: AsyncCallback
<
Array
<
EnrolledCredInfo
>>
): void;
-
interface IInputData
-
onSetData: (authSubType: AuthSubType, data: Uint8Array) =
>
void;
**适配指导**
异步接口的错误信息处理逻辑以activateOsAccount为例,示例代码如下:
```
ts
import
account_osAccount
from
"
@ohos.account.osAccount
"
let
accountMgr
=
account_osAccount
.
getAccountManager
()
let
callbackFunc
=
(
err
)
=>
{
if
(
err
!=
null
)
{
// handle the bussiness error
console
.
log
(
"
account_osAccount failed, error:
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
"
account_osAccount successfully
"
);
}
}
try
{
accountMgr
.
activateOsAccount
(
"
100
"
,
callbackFunc
);
}
catch
(
err
)
{
// handle the parameter type error
console
.
log
(
"
account_osAccount failed for incorrect parameter type, error:
"
+
JSON
.
stringify
(
err
));
}
try
{
accountMgr
.
activateOsAccount
();
}
catch
(
err
)
{
// handle the parameter number error
console
.
log
(
"
account_osAccount failed for incorrect parameter number, error:
"
+
JSON
.
stringify
(
err
));
}
```
同步接口的错误信息处理以registerInputer为例,示例代码如下:
```
ts
import
account_osAccount
from
"
@ohos.account.osAccount
"
let
pinAuth
=
new
account_osAccount
.
PINAuth
()
try
{
pinAuth
.
registerInputer
({})
}
catch
(
err
)
{
// handle the parameter type error
console
.
log
(
"
account_osAccount failed for incorrect parameter type, error:
"
+
JSON
.
stringify
(
err
));
}
try
{
pinAuth
.
registerInputer
()
}
catch
(
err
)
{
// handle the parameter number error
console
.
log
(
"
account_osAccount failed for incorrect parameter number, error:
"
+
JSON
.
stringify
(
err
));
}
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录