已合并
add account capi #4792
add account capi #4792
已合并
yeyuning创建于 3月24日
3 个文件变更+43-3
@@ -1,5 +1,8 @@
1[1[
2 { "first_introduced": "12",2 { "first_introduced": "12",
3 "name":"OH_OsAccount_GetName"3 "name":"OH_OsAccount_GetName"
4+ },
5+ { "first_introduced": "26.0.0",
6+ "name":"OH_OsAccount_GetNameByLocalId"
4 }7 }
5-]8+]
@@ -35,6 +35,7 @@
35#define OS_ACCOUNT_H35#define OS_ACCOUNT_H
36 36 
37#include <stddef.h>37#include <stddef.h>
38+#include <stdint.h>
38#include "os_account_common.h"39#include "os_account_common.h"
39 40 
40#ifdef __cplusplus41#ifdef __cplusplus
@@ -55,6 +56,25 @@ extern "C" {
55 */56 */
56OsAccount_ErrCode OH_OsAccount_GetName(char *buffer, size_t buffer_size);57OsAccount_ErrCode OH_OsAccount_GetName(char *buffer, size_t buffer_size);
57 58 
59+/**
60+ * @brief Gets the name of the target OS account by its local ID.
61+ *
62+ * @permission ohos.permission.GET_LOCAL_ACCOUNT_IDENTIFIERS
63+ * @param localId The local ID of the target OS account.
64+ * @param name The name character array, which should have space for the name and the terminating character ('\0').
65+ * The maximum size of the name is LOGIN_NAME_MAX.
66+ * @param name_size The size of the name character array.
67+ * @return {@link OS_ACCOUNT_ERR_OK} Indicates success;<br>
68+ * {@link OS_ACCOUNT_ERR_PERMISSION_DENIED} Indicates that permission is denied;<br>
69+ * {@link OS_ACCOUNT_ERR_INTERNAL_ERROR} Indicates the internal error.<br>
70+ * {@link OS_ACCOUNT_ERR_INVALID_PARAMETER} Indicates the <i>name</i> is a NULL pointer or the size of
71+ * the name, including the terminating character ('\0'), is larger than <i>name_size</i>;<br>
72+ * {@link OS_ACCOUNT_ERR_ACCOUNT_NOT_FOUND} Indicates the account not found;<br>
73+ * {@link OS_ACCOUNT_ERR_RESTRICTED_ACCOUNT} Indicates the account is restricted and cannot be queried;
74+ * @since 26.0.0
75+ */
76+OsAccount_ErrCode OH_OsAccount_GetNameByLocalId(int32_t localId, char *name, size_t name_size);
77+ 
58#ifdef __cplusplus78#ifdef __cplusplus
59}79}
60#endif80#endif
@@ -20,7 +20,6 @@
20 * @brief Provide the definition of the C interface for the native OsAccount.20 * @brief Provide the definition of the C interface for the native OsAccount.
21 * @since 1221 * @since 12
22 */22 */
23- 
24/**23/**
25 * @file os_account_common.h24 * @file os_account_common.h
26 *25 *
@@ -47,11 +46,29 @@ typedef enum OsAccount_ErrCode {
47 /** @error Operation is successful.*/46 /** @error Operation is successful.*/
48 OS_ACCOUNT_ERR_OK = 0,47 OS_ACCOUNT_ERR_OK = 0,
49 48 
49+ /**
50+ * @error Permission denied.
51+ * @since 26.0.0
52+ */
53+ OS_ACCOUNT_ERR_PERMISSION_DENIED = 201,
54+ 
50 /** @error Internal error.*/55 /** @error Internal error.*/
51 OS_ACCOUNT_ERR_INTERNAL_ERROR = 12300001,56 OS_ACCOUNT_ERR_INTERNAL_ERROR = 12300001,
52 57 
53 /** @error Invalid parameter.*/58 /** @error Invalid parameter.*/
54- OS_ACCOUNT_ERR_INVALID_PARAMETER = 1230000259+ OS_ACCOUNT_ERR_INVALID_PARAMETER = 12300002,
60+ 
61+ /**
62+ * @error Account not found.
63+ * @since 26.0.0
64+ */
65+ OS_ACCOUNT_ERR_ACCOUNT_NOT_FOUND = 12300003,
66+ 
67+ /**
68+ * @error Restricted account.
69+ * @since 26.0.0
70+ */
71+ OS_ACCOUNT_ERR_RESTRICTED_ACCOUNT = 12300008
55} OsAccount_ErrCode;72} OsAccount_ErrCode;
56 73 
57#ifdef __cplusplus74#ifdef __cplusplus