mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-23 02:00:01 +00:00
修改内源问题
Signed-off-by: jidong <jidong4@huawei.com>
This commit is contained in:
parent
b511acd52c
commit
a899fa34c1
0
README_zh.md
Executable file → Normal file
0
README_zh.md
Executable file → Normal file
0
figures/zh-cn_image_0000001123704367.png
Executable file → Normal file
0
figures/zh-cn_image_0000001123704367.png
Executable file → Normal file
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
0
figures/zh-cn_image_account_struct.png
Executable file → Normal file
0
figures/zh-cn_image_account_struct.png
Executable file → Normal file
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -857,7 +857,6 @@ HWTEST_F(AppAccountManagerTest, AppAccountManager_SetOAuthToken_0200, TestSize.L
|
||||
HWTEST_F(AppAccountManagerTest, AppAccountManager_DeleteOAuthToken_0100, TestSize.Level1)
|
||||
{
|
||||
ACCOUNT_LOGI("AppAccountManager_DeleteOAuthToken_0100");
|
||||
std::string token;
|
||||
ErrCode result = AppAccountManager::DeleteOAuthToken(STRING_EMPTY, STRING_OWNER, STRING_AUTH_TYPE, STRING_TOKEN);
|
||||
EXPECT_EQ(result, ERR_APPACCOUNT_KIT_INVALID_PARAMETER);
|
||||
|
||||
|
0
frameworks/common/BUILD.gn
Executable file → Normal file
0
frameworks/common/BUILD.gn
Executable file → Normal file
6
frameworks/common/account_error/include/account_error_no.h
Executable file → Normal file
6
frameworks/common/account_error/include/account_error_no.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_INCLUDE_ACCOUNT_ERROR_NO_H
|
||||
#define BASE_ACCOUNT_INCLUDE_ACCOUNT_ERROR_NO_H
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_COMMON_ACCOUNT_ERROR_INCLUDE_ACCOUNT_ERROR_NO_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_COMMON_ACCOUNT_ERROR_INCLUDE_ACCOUNT_ERROR_NO_H
|
||||
|
||||
#include "errors.h"
|
||||
|
||||
@ -420,4 +420,4 @@ enum {
|
||||
};
|
||||
} // namespace OHOS
|
||||
|
||||
#endif /* BASE_ACCOUNT_INCLUDE_ACCOUNT_ERROR_NO_H */
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_COMMON_ACCOUNT_ERROR_INCLUDE_ACCOUNT_ERROR_NO_H
|
||||
|
@ -12,13 +12,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_COMMON_DATABASE_IACCOUNT_INFO_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_COMMON_DATABASE_IACCOUNT_INFO_H
|
||||
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_COMMON_DATABASE_INCLUDE_IACCOUNT_INFO_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_COMMON_DATABASE_INCLUDE_IACCOUNT_INFO_H
|
||||
|
||||
#include <string>
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
using Json = nlohmann::json;
|
||||
@ -86,4 +86,4 @@ void GetDataByType(const Json &jsonObject, const nlohmann::detail::iter_impl<con
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_COMMON_DATABASE_IACCOUNT_INFO_H
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_COMMON_DATABASE_INCLUDE_IACCOUNT_INFO_H
|
||||
|
7
frameworks/common/log/include/account_log_wrapper.h
Executable file → Normal file
7
frameworks/common/log/include/account_log_wrapper.h
Executable file → Normal file
@ -13,13 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H
|
||||
#define BASE_ACCOUNT_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H
|
||||
|
||||
#include <string>
|
||||
#include "hilog/log.h"
|
||||
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
enum class AccountLogLevel { DEBUG = 0, INFO, WARN, ERROR, FATAL };
|
||||
@ -63,4 +62,4 @@ private:
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // BASE_ACCOUNT_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H
|
||||
|
0
frameworks/common/log/src/account_log_wrapper.cpp
Executable file → Normal file
0
frameworks/common/log/src/account_log_wrapper.cpp
Executable file → Normal file
10
frameworks/common/perf_stat/include/perf_stat.h
Executable file → Normal file
10
frameworks/common/perf_stat/include/perf_stat.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_SERVICES_COMMON_INCLUDE_PERF_STAT_H
|
||||
#define BASE_ACCOUNT_SERVICES_COMMON_INCLUDE_PERF_STAT_H
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_COMMON_PERF_STAT_INCLUDE_PERF_STAT_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_COMMON_PERF_STAT_INCLUDE_PERF_STAT_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
@ -84,7 +84,7 @@ private:
|
||||
|
||||
bool enableStat_ = true;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // BASE_ACCOUNT_SERVICES_COMMON_INCLUDE_PERF_STAT_H
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_COMMON_PERF_STAT_INCLUDE_PERF_STAT_H
|
||||
|
0
frameworks/common/perf_stat/src/perf_stat.cpp
Executable file → Normal file
0
frameworks/common/perf_stat/src/perf_stat.cpp
Executable file → Normal file
0
frameworks/common/test/BUILD.gn
Executable file → Normal file
0
frameworks/common/test/BUILD.gn
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_log_test/BUILD.gn
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_log_test/BUILD.gn
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_log_test/account_log_test.cpp
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_log_test/account_log_test.cpp
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_perf_test/BUILD.gn
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_perf_test/BUILD.gn
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_perf_test/account_perf_stat_test.cpp
Executable file → Normal file
0
frameworks/common/test/unittest/common_account_perf_test/account_perf_stat_test.cpp
Executable file → Normal file
2
frameworks/ohosaccount/account_kits_headers.gni
Executable file → Normal file
2
frameworks/ohosaccount/account_kits_headers.gni
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
2
frameworks/ohosaccount/native/BUILD.gn
Executable file → Normal file
2
frameworks/ohosaccount/native/BUILD.gn
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
0
frameworks/ohosaccount/native/src/account_proxy.cpp
Executable file → Normal file
0
frameworks/ohosaccount/native/src/account_proxy.cpp
Executable file → Normal file
22
frameworks/ohosaccount/native/src/ohos_account_kits.cpp
Executable file → Normal file
22
frameworks/ohosaccount/native/src/ohos_account_kits.cpp
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -13,14 +13,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ohos_account_kits.h"
|
||||
#include "ohos_account_kits_impl.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
#include "ohos_account_kits.h"
|
||||
#include "ohos_account_kits_impl.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
OhosAccountKits& OhosAccountKits::GetInstance()
|
||||
{
|
||||
return DelayedRefSingleton<OhosAccountKitsImpl>::GetInstance();
|
||||
}
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
{
|
||||
return DelayedRefSingleton<OhosAccountKitsImpl>::GetInstance();
|
||||
}
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
0
frameworks/ohosaccount/native/src/ohos_account_kits_impl.cpp
Executable file → Normal file
0
frameworks/ohosaccount/native/src/ohos_account_kits_impl.cpp
Executable file → Normal file
2
frameworks/ohosaccount/test/BUILD.gn
Executable file → Normal file
2
frameworks/ohosaccount/test/BUILD.gn
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
2
frameworks/ohosaccount/test/moduletests/account_mgr_test/BUILD.gn
Executable file → Normal file
2
frameworks/ohosaccount/test/moduletests/account_mgr_test/BUILD.gn
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
2
frameworks/ohosaccount/test/moduletests/account_mgr_test/account_mgr_inner_sdk_func_test.cpp
Executable file → Normal file
2
frameworks/ohosaccount/test/moduletests/account_mgr_test/account_mgr_inner_sdk_func_test.cpp
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -41,8 +41,6 @@ config("os_account_core_config") {
|
||||
}
|
||||
|
||||
config("os_account_core_public_config") {
|
||||
# visibility = [ ":*" ]
|
||||
|
||||
include_dirs = [
|
||||
"${os_account_core_path}/include",
|
||||
"${os_account_interfaces_native_path}/include",
|
||||
|
@ -12,8 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_IOS_ACCOUNT_H
|
||||
#define OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_IOS_ACCOUNT_H
|
||||
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_IOS_ACCOUNT_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_IOS_ACCOUNT_H
|
||||
|
||||
#include <string>
|
||||
#include "iremote_broker.h"
|
||||
#include "iremote_object.h"
|
||||
@ -21,6 +23,7 @@
|
||||
#include "account_error_no.h"
|
||||
#include "os_account_constants.h"
|
||||
#include "os_account_event_listener.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class IOsAccount : public IRemoteBroker {
|
||||
@ -123,4 +126,5 @@ public:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_IOS_ACCOUNT_H
|
||||
|
@ -12,10 +12,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_H
|
||||
#define OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_H
|
||||
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_H
|
||||
|
||||
#include "ios_account.h"
|
||||
#include "os_account_event_listener.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class OsAccount {
|
||||
@ -82,4 +85,5 @@ private:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif /* OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_H */
|
||||
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_H
|
||||
|
@ -24,9 +24,9 @@ namespace AccountSA {
|
||||
class OsAccountEventListener : public OsAccountEventStub {
|
||||
public:
|
||||
explicit OsAccountEventListener(const std::shared_ptr<OsAccountSubscriber> &subscriber);
|
||||
virtual ~OsAccountEventListener() override;
|
||||
~OsAccountEventListener() override;
|
||||
|
||||
virtual void OnAccountsChanged(const int &id) override;
|
||||
void OnAccountsChanged(const int &id) override;
|
||||
|
||||
void Stop();
|
||||
|
||||
|
@ -24,9 +24,9 @@ namespace AccountSA {
|
||||
class OsAccountEventProxy : public IRemoteProxy<IOsAccountEvent> {
|
||||
public:
|
||||
explicit OsAccountEventProxy(const sptr<IRemoteObject> &object);
|
||||
virtual ~OsAccountEventProxy() override;
|
||||
~OsAccountEventProxy() override;
|
||||
|
||||
virtual void OnAccountsChanged(const int &id) override;
|
||||
void OnAccountsChanged(const int &id) override;
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
|
@ -24,9 +24,9 @@ namespace AccountSA {
|
||||
class OsAccountEventStub : public IRemoteStub<IOsAccountEvent> {
|
||||
public:
|
||||
OsAccountEventStub();
|
||||
virtual ~OsAccountEventStub() override;
|
||||
~OsAccountEventStub() override;
|
||||
|
||||
virtual int OnRemoteRequest(
|
||||
int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
|
@ -12,67 +12,70 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_PROXY_H
|
||||
#define OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_PROXY_H
|
||||
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_PROXY_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_PROXY_H
|
||||
|
||||
#include "ios_account.h"
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class OsAccountProxy : public IRemoteProxy<IOsAccount> {
|
||||
public:
|
||||
explicit OsAccountProxy(const sptr<IRemoteObject> &object);
|
||||
virtual ~OsAccountProxy() override;
|
||||
~OsAccountProxy() override;
|
||||
|
||||
virtual ErrCode CreateOsAccount(
|
||||
ErrCode CreateOsAccount(
|
||||
const std::string &name, const OsAccountType &type, OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode CreateOsAccountForDomain(
|
||||
ErrCode CreateOsAccountForDomain(
|
||||
const OsAccountType &type, const DomainAccountInfo &domainInfo, OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode RemoveOsAccount(const int id) override;
|
||||
virtual ErrCode IsOsAccountExists(const int id, bool &isOsAccountExists) override;
|
||||
virtual ErrCode IsOsAccountActived(const int id, bool &isOsAccountActived) override;
|
||||
virtual ErrCode IsOsAccountConstraintEnable(
|
||||
ErrCode RemoveOsAccount(const int id) override;
|
||||
ErrCode IsOsAccountExists(const int id, bool &isOsAccountExists) override;
|
||||
ErrCode IsOsAccountActived(const int id, bool &isOsAccountActived) override;
|
||||
ErrCode IsOsAccountConstraintEnable(
|
||||
const int id, const std::string &constraint, bool &isConstraintEnable) override;
|
||||
virtual ErrCode IsOsAccountVerified(const int id, bool &isVerified) override;
|
||||
virtual ErrCode GetCreatedOsAccountsCount(unsigned int &osAccountsCount) override;
|
||||
virtual ErrCode GetOsAccountLocalIdFromProcess(int &id) override;
|
||||
virtual ErrCode GetOsAccountLocalIdFromDomain(const DomainAccountInfo &domainInfo, int &id) override;
|
||||
virtual ErrCode QueryMaxOsAccountNumber(int &maxOsAccountNumber) override;
|
||||
virtual ErrCode GetOsAccountAllConstraints(const int id, std::vector<std::string> &constraints) override;
|
||||
virtual ErrCode QueryAllCreatedOsAccounts(std::vector<OsAccountInfo> &osAccountInfos) override;
|
||||
virtual ErrCode QueryCurrentOsAccount(OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode QueryOsAccountById(const int id, OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode GetOsAccountTypeFromProcess(OsAccountType &type) override;
|
||||
virtual ErrCode GetOsAccountProfilePhoto(const int id, std::string &photo) override;
|
||||
virtual ErrCode IsMultiOsAccountEnable(bool &isMultiOsAccountEnable) override;
|
||||
virtual ErrCode SetOsAccountName(const int id, const std::string &localName) override;
|
||||
virtual ErrCode SetOsAccountConstraints(
|
||||
ErrCode IsOsAccountVerified(const int id, bool &isVerified) override;
|
||||
ErrCode GetCreatedOsAccountsCount(unsigned int &osAccountsCount) override;
|
||||
ErrCode GetOsAccountLocalIdFromProcess(int &id) override;
|
||||
ErrCode GetOsAccountLocalIdFromDomain(const DomainAccountInfo &domainInfo, int &id) override;
|
||||
ErrCode QueryMaxOsAccountNumber(int &maxOsAccountNumber) override;
|
||||
ErrCode GetOsAccountAllConstraints(const int id, std::vector<std::string> &constraints) override;
|
||||
ErrCode QueryAllCreatedOsAccounts(std::vector<OsAccountInfo> &osAccountInfos) override;
|
||||
ErrCode QueryCurrentOsAccount(OsAccountInfo &osAccountInfo) override;
|
||||
ErrCode QueryOsAccountById(const int id, OsAccountInfo &osAccountInfo) override;
|
||||
ErrCode GetOsAccountTypeFromProcess(OsAccountType &type) override;
|
||||
ErrCode GetOsAccountProfilePhoto(const int id, std::string &photo) override;
|
||||
ErrCode IsMultiOsAccountEnable(bool &isMultiOsAccountEnable) override;
|
||||
ErrCode SetOsAccountName(const int id, const std::string &localName) override;
|
||||
ErrCode SetOsAccountConstraints(
|
||||
const int id, const std::vector<std::string> &constraints, const bool enable) override;
|
||||
virtual ErrCode SetOsAccountProfilePhoto(const int id, const std::string &photo) override;
|
||||
virtual ErrCode ActivateOsAccount(const int id) override;
|
||||
virtual ErrCode StartOsAccount(const int id) override;
|
||||
virtual ErrCode StopOsAccount(const int id) override;
|
||||
virtual ErrCode GetOsAccountLocalIdBySerialNumber(const int64_t serialNumber, int &id) override;
|
||||
virtual ErrCode GetSerialNumberByOsAccountLocalId(const int &id, int64_t &serialNumber) override;
|
||||
virtual ErrCode SubscribeOsAccount(
|
||||
ErrCode SetOsAccountProfilePhoto(const int id, const std::string &photo) override;
|
||||
ErrCode ActivateOsAccount(const int id) override;
|
||||
ErrCode StartOsAccount(const int id) override;
|
||||
ErrCode StopOsAccount(const int id) override;
|
||||
ErrCode GetOsAccountLocalIdBySerialNumber(const int64_t serialNumber, int &id) override;
|
||||
ErrCode GetSerialNumberByOsAccountLocalId(const int &id, int64_t &serialNumber) override;
|
||||
ErrCode SubscribeOsAccount(
|
||||
const OsAccountSubscribeInfo &subscribeInfo, const sptr<IRemoteObject> &eventListener) override;
|
||||
virtual ErrCode UnsubscribeOsAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
virtual OS_ACCOUNT_SWITCH_MOD GetOsAccountSwitchMod() override;
|
||||
virtual ErrCode IsCurrentOsAccountVerified(bool &isVerified) override;
|
||||
virtual ErrCode IsOsAccountCompleted(const int id, bool &isOsAccountCompleted) override;
|
||||
virtual ErrCode SetCurrentOsAccountIsVerified(const bool isVerified) override;
|
||||
virtual ErrCode SetOsAccountIsVerified(const int id, const bool isVerified) override;
|
||||
virtual ErrCode DumpState(const int &id, std::vector<std::string> &state) override;
|
||||
ErrCode UnsubscribeOsAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
OS_ACCOUNT_SWITCH_MOD GetOsAccountSwitchMod() override;
|
||||
ErrCode IsCurrentOsAccountVerified(bool &isVerified) override;
|
||||
ErrCode IsOsAccountCompleted(const int id, bool &isOsAccountCompleted) override;
|
||||
ErrCode SetCurrentOsAccountIsVerified(const bool isVerified) override;
|
||||
ErrCode SetOsAccountIsVerified(const int id, const bool isVerified) override;
|
||||
ErrCode DumpState(const int &id, std::vector<std::string> &state) override;
|
||||
|
||||
virtual void CreateBasicAccounts() override;
|
||||
virtual ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID,
|
||||
void CreateBasicAccounts() override;
|
||||
ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID,
|
||||
int &createdOsAccountNum) override;
|
||||
virtual ErrCode GetSerialNumberFromDatabase(const std::string& storeID, int64_t &serialNumber) override;
|
||||
virtual ErrCode GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id) override;
|
||||
virtual ErrCode GetOsAccountFromDatabase(const std::string& storeID, const int id,
|
||||
ErrCode GetSerialNumberFromDatabase(const std::string& storeID, int64_t &serialNumber) override;
|
||||
ErrCode GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id) override;
|
||||
ErrCode GetOsAccountFromDatabase(const std::string& storeID, const int id,
|
||||
OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode GetOsAccountListFromDatabase(const std::string& storeID,
|
||||
ErrCode GetOsAccountListFromDatabase(const std::string& storeID,
|
||||
std::vector<OsAccountInfo> &osAccountList) override;
|
||||
virtual ErrCode QueryActiveOsAccountIds(std::vector<int32_t>& ids) override;
|
||||
ErrCode QueryActiveOsAccountIds(std::vector<int32_t>& ids) override;
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
@ -86,4 +89,5 @@ private:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif /* OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_PROXY_H */
|
||||
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_PROXY_H
|
||||
|
@ -12,18 +12,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_STUB_H
|
||||
#define OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_STUB_H
|
||||
|
||||
#ifndef OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_STUB_H
|
||||
#define OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_STUB_H
|
||||
|
||||
#include "ios_account.h"
|
||||
#include "iremote_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class OsAccountStub : public IRemoteStub<IOsAccount> {
|
||||
public:
|
||||
using MessageProcFunction = ErrCode (OsAccountStub::*)(MessageParcel &data, MessageParcel &reply);
|
||||
OsAccountStub();
|
||||
virtual ~OsAccountStub() override;
|
||||
virtual int OnRemoteRequest(
|
||||
~OsAccountStub() override;
|
||||
int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
@ -80,4 +83,5 @@ private:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif /* OS_ACCOUNT_FRAMEWORK_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_STUB_H */
|
||||
|
||||
#endif // OS_ACCOUNT_FRAMEWORKS_OSACCOUNT_CORE_INCLUDE_OS_ACCOUNT_STUB_H
|
||||
|
@ -1267,7 +1267,7 @@ bool OsAccountProxy::ReadParcelableVector(std::vector<T> &parcelableInfos, Messa
|
||||
ACCOUNT_LOGI("Account read Parcelable size is %{public}d", infoSize);
|
||||
parcelableInfos.clear();
|
||||
for (uint32_t index = 0; index < infoSize; index++) {
|
||||
T *info = data.ReadParcelable<T>();
|
||||
std::shared_ptr<T> info(data.ReadParcelable<T>());
|
||||
if (info == nullptr) {
|
||||
ACCOUNT_LOGE("Account read Parcelable infos failed.");
|
||||
return false;
|
||||
|
@ -233,7 +233,7 @@ bool OsAccountStub::ReadParcelableVector(std::vector<T> &parcelableInfos, Messag
|
||||
|
||||
parcelableInfos.clear();
|
||||
for (uint32_t index = 0; index < infoSize; index++) {
|
||||
T *info = data.ReadParcelable<T>();
|
||||
std::shared_ptr<T> info(data.ReadParcelable<T>());
|
||||
if (info == nullptr) {
|
||||
ACCOUNT_LOGE("read Parcelable infos failed.");
|
||||
return false;
|
||||
|
@ -1037,7 +1037,7 @@ HWTEST_F(OsAccountManagerModuleTest, OsAccountManagerModuleTest053, TestSize.Lev
|
||||
std::string osAccountName = domainInfo.domain_ + "/" + domainInfo.accountName_;
|
||||
checkValid = (osAccountInfo.GetLocalName() == osAccountName);
|
||||
EXPECT_EQ(checkValid, true);
|
||||
|
||||
|
||||
EXPECT_EQ(OsAccountManager::RemoveOsAccount(osAccountInfo.GetLocalId()), ERR_OK);
|
||||
}
|
||||
|
||||
@ -1363,7 +1363,7 @@ HWTEST_F(OsAccountManagerModuleTest, OsAccountManagerModuleTest065, TestSize.Lev
|
||||
OsAccountInfo osAccountInfo;
|
||||
ret = OsAccountManager::GetOsAccountFromDatabase(storeID, osAccountInfoOne.GetLocalId(), osAccountInfo);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
|
||||
|
||||
// remove the new os account
|
||||
ret = OsAccountManager::RemoveOsAccount(osAccountInfoOne.GetLocalId());
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
6
interfaces/innerkits/ohosaccount/native/include/account_info.h
Executable file → Normal file
6
interfaces/innerkits/ohosaccount/native/include/account_info.h
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -73,7 +73,7 @@ public:
|
||||
OhosAccountInfo()
|
||||
{
|
||||
status_ = ACCOUNT_STATE_UNBOUND;
|
||||
};
|
||||
}
|
||||
~OhosAccountInfo() {};
|
||||
};
|
||||
|
||||
@ -115,7 +115,7 @@ public:
|
||||
bindTime_ = 0;
|
||||
}
|
||||
|
||||
~AccountInfo() {};
|
||||
~AccountInfo() {}
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
2
interfaces/innerkits/ohosaccount/native/include/device_account_info.h
Executable file → Normal file
2
interfaces/innerkits/ohosaccount/native/include/device_account_info.h
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
0
interfaces/innerkits/ohosaccount/native/include/iaccount.h
Executable file → Normal file
0
interfaces/innerkits/ohosaccount/native/include/iaccount.h
Executable file → Normal file
56
interfaces/innerkits/ohosaccount/native/include/ohos_account_kits.h
Executable file → Normal file
56
interfaces/innerkits/ohosaccount/native/include/ohos_account_kits.h
Executable file → Normal file
@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_OHOS_ACCOUNT_KITS_H
|
||||
#define BASE_ACCOUNT_OHOS_ACCOUNT_KITS_H
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
*
|
||||
* @return Instance of ohos account manager.
|
||||
*/
|
||||
static OhosAccountKits& GetInstance();
|
||||
static OhosAccountKits& GetInstance();
|
||||
|
||||
/**
|
||||
* Query OHOS Account Info.
|
||||
@ -45,18 +45,18 @@ public:
|
||||
virtual std::pair<bool, OhosAccountInfo> QueryOhosAccountInfo() = 0;
|
||||
|
||||
/**
|
||||
* Update OHOS Account Info.
|
||||
*
|
||||
* @param accountName Indicates the name of the OS account used for a distributed system.
|
||||
* @param uid Uniquely identifies the OS account used for a distributed system.
|
||||
* @param eventStr Indicates the event of the OS account used for a distributed system.
|
||||
* @return Returns {@code true} if the distributed information of the account is updated;
|
||||
* returns {@code false} otherwise.
|
||||
*/
|
||||
virtual bool UpdateOhosAccountInfo(const std::string& accountName, const std::string& uid,
|
||||
const std::string& eventStr) = 0;
|
||||
|
||||
/**
|
||||
* Update OHOS Account Info.
|
||||
*
|
||||
* @param accountName Indicates the name of the OS account used for a distributed system.
|
||||
* @param uid Uniquely identifies the OS account used for a distributed system.
|
||||
* @param eventStr Indicates the event of the OS account used for a distributed system.
|
||||
* @return Returns {@code true} if the distributed information of the account is updated;
|
||||
* returns {@code false} otherwise.
|
||||
*/
|
||||
virtual bool UpdateOhosAccountInfo(const std::string& accountName, const std::string& uid,
|
||||
const std::string& eventStr) = 0;
|
||||
|
||||
/**
|
||||
* Query Device Account Id.
|
||||
*
|
||||
* @param device account id.
|
||||
|
38
interfaces/innerkits/ohosaccount/native/include/ohos_account_kits_impl.h
Executable file → Normal file
38
interfaces/innerkits/ohosaccount/native/include/ohos_account_kits_impl.h
Executable file → Normal file
@ -1,25 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_OHOS_ACCOUNT_KITS_IMPL_H
|
||||
#define BASE_ACCOUNT_OHOS_ACCOUNT_KITS_IMPL_H
|
||||
|
||||
#include <mutex>
|
||||
#include "ipc_skeleton.h"
|
||||
#include "ohos_account_kits.h"
|
||||
#include "singleton.h"
|
||||
#include "ohos_account_kits.h"
|
||||
#include "singleton.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
@ -28,8 +28,8 @@ class OhosAccountKitsImpl final : public OhosAccountKits, public DelayedRefSingl
|
||||
|
||||
public:
|
||||
DISALLOW_COPY_AND_MOVE(OhosAccountKitsImpl);
|
||||
bool UpdateOhosAccountInfo(const std::string& accountName, const std::string& uid,
|
||||
const std::string& eventStr) final;
|
||||
bool UpdateOhosAccountInfo(const std::string& accountName, const std::string& uid,
|
||||
const std::string& eventStr) final;
|
||||
std::pair<bool, OhosAccountInfo> QueryOhosAccountInfo() final;
|
||||
ErrCode QueryDeviceAccountId(std::int32_t& accountId) final;
|
||||
std::int32_t GetDeviceAccountIdByUID(std::int32_t& uid) final;
|
||||
|
@ -88,17 +88,17 @@ public:
|
||||
|
||||
void SetLastLoginTime(const int64_t lastLoginTime);
|
||||
|
||||
virtual Json ToJson() const override;
|
||||
Json ToJson() const override;
|
||||
|
||||
virtual void FromJson(const Json &jsonObject) override;
|
||||
void FromJson(const Json &jsonObject) override;
|
||||
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
|
||||
virtual std::string ToString() const override;
|
||||
std::string ToString() const override;
|
||||
|
||||
virtual std::string GetPrimeKey() const override;
|
||||
std::string GetPrimeKey() const override;
|
||||
|
||||
static OsAccountInfo *Unmarshalling(Parcel &parcel);
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
ErrCode GetName(std::string &name) const;
|
||||
ErrCode SetName(const std::string &name);
|
||||
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
static OsAccountSubscribeInfo *Unmarshalling(Parcel &parcel);
|
||||
|
||||
private:
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_APPACCOUNT_ACCOUNT_H
|
||||
#define NAPI_APPACCOUNT_ACCOUNT_H
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_H
|
||||
|
||||
#include "napi/native_api.h"
|
||||
|
||||
@ -59,4 +59,4 @@ private:
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // NAPI_APPACCOUNT_ACCOUNT_H
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_H
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_APP_ACCOUNT_ACCOUNT_AUTHENTICATOR_STUB_H
|
||||
#define NAPI_APP_ACCOUNT_ACCOUNT_AUTHENTICATOR_STUB_H
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_AUTHENTICATOR_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_AUTHENTICATOR_H
|
||||
|
||||
#include <mutex>
|
||||
|
||||
@ -47,13 +47,13 @@ class NapiAppAccountAuthenticator : public AccountSA::AppAccountAuthenticatorStu
|
||||
public:
|
||||
NapiAppAccountAuthenticator(const napi_env &env,
|
||||
const napi_ref &addAccountImplicitlyRef, const napi_ref &authenticateRef);
|
||||
virtual ~NapiAppAccountAuthenticator() override;
|
||||
~NapiAppAccountAuthenticator() override;
|
||||
bool CheckObjectLegality() const override;
|
||||
int GetObjectType() const override;
|
||||
static napi_value Init(napi_env env, napi_value exports);
|
||||
virtual ErrCode AddAccountImplicitly(const std::string &authType, const std::string &callerBundleName,
|
||||
ErrCode AddAccountImplicitly(const std::string &authType, const std::string &callerBundleName,
|
||||
const AAFwk::WantParams &options, const sptr<IRemoteObject> &callback) override;
|
||||
virtual ErrCode Authenticate(
|
||||
ErrCode Authenticate(
|
||||
const std::string &name, const std::string &authType, const std::string &callerBundleName,
|
||||
const AAFwk::WantParams &options, const sptr<IRemoteObject> &callback) override;
|
||||
|
||||
@ -68,4 +68,4 @@ private:
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // NAPI_APP_ACCOUNT_ACCOUNT_AUTHENTICATOR_H
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_AUTHENTICATOR_H
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_APP_ACCOUNT_AUTHENTICATOR_CALLBACK_PROXY_H
|
||||
#define NAPI_APP_ACCOUNT_AUTHENTICATOR_CALLBACK_PROXY_H
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_AUTHENTICATOR_CALLBACK_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_AUTHENTICATOR_CALLBACK_H
|
||||
|
||||
#include "iapp_account_authenticator_callback.h"
|
||||
#include "iremote_proxy.h"
|
||||
@ -47,6 +47,7 @@ struct CallbackParam {
|
||||
napi_ref callbackRef;
|
||||
NapiAppAccountAuthenticatorCallback *callback;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
#endif // NAPI_APP_ACCOUNT_AUTHENTICATOR_CALLBACK_PROXY_H
|
||||
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_AUTHENTICATOR_CALLBACK_H
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_APP_ACCOUNT_COMMON
|
||||
#define NAPI_APP_ACCOUNT_COMMON
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_COMMON_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_COMMON_H
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include "app_account_authenticator_callback_stub.h"
|
||||
@ -55,10 +55,10 @@ extern std::map<AppAccountManager *, std::vector<AsyncContextForSubscribe *>> g_
|
||||
|
||||
class SubscriberPtr : public AppAccountSubscriber {
|
||||
public:
|
||||
SubscriberPtr(const AppAccountSubscribeInfo &subscribeInfo);
|
||||
explicit SubscriberPtr(const AppAccountSubscribeInfo &subscribeInfo);
|
||||
~SubscriberPtr();
|
||||
|
||||
virtual void OnAccountsChanged(const std::vector<AppAccountInfo> &accounts) override;
|
||||
void OnAccountsChanged(const std::vector<AppAccountInfo> &accounts) override;
|
||||
|
||||
void SetEnv(const napi_env &env);
|
||||
void SetCallbackRef(const napi_ref &ref);
|
||||
@ -164,8 +164,8 @@ public:
|
||||
AppAccountManagerCallback();
|
||||
~AppAccountManagerCallback();
|
||||
|
||||
virtual void OnResult(int32_t resultCode, const AAFwk::Want &result) override;
|
||||
virtual void OnRequestRedirected(AAFwk::Want &request) override;
|
||||
void OnResult(int32_t resultCode, const AAFwk::Want &result) override;
|
||||
void OnRequestRedirected(AAFwk::Want &request) override;
|
||||
|
||||
void SetEnv(const napi_env &env);
|
||||
void SetResultRef(const napi_ref &ref);
|
||||
@ -261,4 +261,4 @@ void UnsubscribeCallbackCompletedCB(napi_env env, napi_status status, void *data
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
|
||||
#endif /* NAPI_APP_ACCOUNT_COMMON */
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_COMMON_H
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_APP_ACCOUNT_CONSTANTS
|
||||
#define NAPI_APP_ACCOUNT_CONSTANTS
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_CONSTANT_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_CONSTANT_H
|
||||
|
||||
#include "napi/native_api.h"
|
||||
|
||||
@ -26,4 +26,5 @@ public:
|
||||
};
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
#endif // NAPI_APP_ACCOUNT_CONSTANTS
|
||||
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_APPACCOUNT_INCLUDE_NAPI_APP_ACCOUNT_CONSTANT_H
|
||||
|
@ -146,14 +146,14 @@ napi_value NapiAppAccount::AddAccount(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("AddAccount, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::AddAccount(asyncContext->name, asyncContext->extraInfo);
|
||||
ACCOUNT_LOGI("Addcount errcode parameter is %{public}d", asyncContext->errCode);
|
||||
asyncContext->status = asyncContext->errCode == 0 ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("AddAccount, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value addResult[RESULT_COUNT] = {0};
|
||||
addResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &addResult[PARAMONE]);
|
||||
@ -162,7 +162,7 @@ napi_value NapiAppAccount::AddAccount(napi_env env, napi_callback_info cbInfo)
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -195,7 +195,7 @@ napi_value NapiAppAccount::AddAccountImplicitly(napi_env env, napi_callback_info
|
||||
resourceName,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("AddAccountImplicitly, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::AddAccountImplicitly(asyncContext->owner,
|
||||
asyncContext->authType, asyncContext->options, asyncContext->appAccountMgrCb);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -203,7 +203,7 @@ napi_value NapiAppAccount::AddAccountImplicitly(napi_env env, napi_callback_info
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("AddAccountImplicitly, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
AAFwk::Want errResult;
|
||||
if ((asyncContext->errCode != 0) && (asyncContext->appAccountMgrCb != nullptr)) {
|
||||
asyncContext->appAccountMgrCb->OnResult(asyncContext->errCode, errResult);
|
||||
@ -212,7 +212,7 @@ napi_value NapiAppAccount::AddAccountImplicitly(napi_env env, napi_callback_info
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return NapiGetNull(env);
|
||||
@ -248,14 +248,14 @@ napi_value NapiAppAccount::DeleteAccount(napi_env env, napi_callback_info cbInfo
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("DeleteAccount, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::DeleteAccount(asyncContext->name);
|
||||
ACCOUNT_LOGI("Deleteaccount errcode parameter is %{public}d", asyncContext->errCode);
|
||||
asyncContext->status = asyncContext->errCode == 0 ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("DeleteAccount, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value delResult[RESULT_COUNT] = {0};
|
||||
delResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &delResult[PARAMONE]);
|
||||
@ -264,7 +264,7 @@ napi_value NapiAppAccount::DeleteAccount(napi_env env, napi_callback_info cbInfo
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -302,14 +302,14 @@ napi_value NapiAppAccount::DisableAppAccess(napi_env env, napi_callback_info cbI
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("DisableAppAccess, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::DisableAppAccess(asyncContext->name, asyncContext->bundleName);
|
||||
ACCOUNT_LOGI("DisableAppAccess errcode parameter is %{public}d", asyncContext->errCode);
|
||||
asyncContext->status = asyncContext->errCode == 0 ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("DisableAppAccess, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value disResult[RESULT_COUNT] = {0};
|
||||
disResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &disResult[PARAMONE]);
|
||||
@ -318,7 +318,7 @@ napi_value NapiAppAccount::DisableAppAccess(napi_env env, napi_callback_info cbI
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -356,14 +356,14 @@ napi_value NapiAppAccount::EnableAppAccess(napi_env env, napi_callback_info cbIn
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("EnableAppAccess, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::EnableAppAccess(asyncContext->name, asyncContext->bundleName);
|
||||
ACCOUNT_LOGI("EnableAppAccess errcode parameter is %{public}d", asyncContext->errCode);
|
||||
asyncContext->status = asyncContext->errCode == 0 ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("EnableAppAccess, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value enResult[RESULT_COUNT] = {0};
|
||||
enResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &enResult[PARAMONE]);
|
||||
@ -372,7 +372,7 @@ napi_value NapiAppAccount::EnableAppAccess(napi_env env, napi_callback_info cbIn
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -408,7 +408,7 @@ napi_value NapiAppAccount::CheckAppAccountSyncEnable(napi_env env, napi_callback
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("CheckAppAccountSyncEnable, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode =
|
||||
AppAccountManager::CheckAppAccountSyncEnable(asyncContext->name, asyncContext->result);
|
||||
ACCOUNT_LOGI("CheckAppAccountSyncEnable errcode parameter is %{public}d", asyncContext->errCode);
|
||||
@ -416,7 +416,7 @@ napi_value NapiAppAccount::CheckAppAccountSyncEnable(napi_env env, napi_callback
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("CheckAppAccountSyncEnable, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value checkResult[RESULT_COUNT] = {0};
|
||||
checkResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_boolean(env, asyncContext->result, &checkResult[PARAMONE]);
|
||||
@ -425,7 +425,7 @@ napi_value NapiAppAccount::CheckAppAccountSyncEnable(napi_env env, napi_callback
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -463,7 +463,7 @@ napi_value NapiAppAccount::SetAccountCredential(napi_env env, napi_callback_info
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("SetAccountCredential, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::SetAccountCredential(
|
||||
asyncContext->name, asyncContext->credentialType, asyncContext->credential);
|
||||
ACCOUNT_LOGI("SetAccountCredential errcode parameter is %{public}d", asyncContext->errCode);
|
||||
@ -471,7 +471,7 @@ napi_value NapiAppAccount::SetAccountCredential(napi_env env, napi_callback_info
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("SetAccountCredential, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value setResult[RESULT_COUNT] = {0};
|
||||
setResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &setResult[PARAMONE]);
|
||||
@ -480,7 +480,7 @@ napi_value NapiAppAccount::SetAccountCredential(napi_env env, napi_callback_info
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -518,7 +518,7 @@ napi_value NapiAppAccount::SetAccountExtraInfo(napi_env env, napi_callback_info
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("SetAccountExtraInfo, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::SetAccountExtraInfo(
|
||||
asyncContext->name, asyncContext->extraInfo);
|
||||
ACCOUNT_LOGI("SetAccountExtraInfo errcode parameter is %{public}d", asyncContext->errCode);
|
||||
@ -526,7 +526,7 @@ napi_value NapiAppAccount::SetAccountExtraInfo(napi_env env, napi_callback_info
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("SetAccountExtraInfo, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value setResult[RESULT_COUNT] = {0};
|
||||
setResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &setResult[PARAMONE]);
|
||||
@ -535,7 +535,7 @@ napi_value NapiAppAccount::SetAccountExtraInfo(napi_env env, napi_callback_info
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -571,7 +571,7 @@ napi_value NapiAppAccount::SetAppAccountSyncEnable(napi_env env, napi_callback_i
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("SetAppAccountSyncEnable, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode =
|
||||
AppAccountManager::SetAppAccountSyncEnable(asyncContext->name, asyncContext->isEnable);
|
||||
ACCOUNT_LOGI("SetAppAccountSyncEnable errcode parameter is %{public}d", asyncContext->errCode);
|
||||
@ -579,7 +579,7 @@ napi_value NapiAppAccount::SetAppAccountSyncEnable(napi_env env, napi_callback_i
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("SetAppAccountSyncEnable, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value setResult[RESULT_COUNT] = {0};
|
||||
setResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &setResult[PARAMONE]);
|
||||
@ -588,7 +588,7 @@ napi_value NapiAppAccount::SetAppAccountSyncEnable(napi_env env, napi_callback_i
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -624,7 +624,7 @@ napi_value NapiAppAccount::SetAssociatedData(napi_env env, napi_callback_info cb
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("SetAssociatedData, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode =
|
||||
AppAccountManager::SetAssociatedData(asyncContext->name, asyncContext->key, asyncContext->value);
|
||||
ACCOUNT_LOGI("SetAssociatedData errcode parameter is %{public}d", asyncContext->errCode);
|
||||
@ -632,7 +632,7 @@ napi_value NapiAppAccount::SetAssociatedData(napi_env env, napi_callback_info cb
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("SetAssociatedData, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value setResult[RESULT_COUNT] = {0};
|
||||
setResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &setResult[PARAMONE]);
|
||||
@ -641,7 +641,7 @@ napi_value NapiAppAccount::SetAssociatedData(napi_env env, napi_callback_info cb
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -676,14 +676,14 @@ napi_value NapiAppAccount::GetAllAccessibleAccounts(napi_env env, napi_callback_
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetAllAccessibleAccounts, napi_create_async_work running.");
|
||||
GetAccountsAsyncContext *asyncContext = (GetAccountsAsyncContext *)data;
|
||||
GetAccountsAsyncContext *asyncContext = reinterpret_cast<GetAccountsAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::GetAllAccessibleAccounts(asyncContext->appAccounts);
|
||||
ACCOUNT_LOGI("GetAllAccessibleAccounts errcode parameter is %{public}d", asyncContext->errCode);
|
||||
asyncContext->status = asyncContext->errCode == 0 ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAllAccessibleAccounts, napi_create_async_work complete.");
|
||||
GetAccountsAsyncContext *asyncContext = (GetAccountsAsyncContext *)data;
|
||||
GetAccountsAsyncContext *asyncContext = reinterpret_cast<GetAccountsAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_array(env, &getResult[PARAMONE]);
|
||||
@ -693,7 +693,7 @@ napi_value NapiAppAccount::GetAllAccessibleAccounts(napi_env env, napi_callback_
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -728,14 +728,14 @@ napi_value NapiAppAccount::GetAllAccounts(napi_env env, napi_callback_info cbInf
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetAllAccounts, napi_create_async_work running.");
|
||||
GetAccountsAsyncContext *asyncContext = (GetAccountsAsyncContext *)data;
|
||||
GetAccountsAsyncContext *asyncContext = reinterpret_cast<GetAccountsAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::GetAllAccounts(asyncContext->owner, asyncContext->appAccounts);
|
||||
ACCOUNT_LOGI("GetAllAccounts errcode parameter is %{public}d", asyncContext->errCode);
|
||||
asyncContext->status = asyncContext->errCode == 0 ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAllAccounts, napi_create_async_work complete.");
|
||||
GetAccountsAsyncContext *asyncContext = (GetAccountsAsyncContext *)data;
|
||||
GetAccountsAsyncContext *asyncContext = reinterpret_cast<GetAccountsAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_array(env, &getResult[PARAMONE]);
|
||||
@ -745,7 +745,7 @@ napi_value NapiAppAccount::GetAllAccounts(napi_env env, napi_callback_info cbInf
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -783,7 +783,7 @@ napi_value NapiAppAccount::GetAccountCredential(napi_env env, napi_callback_info
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetAccountCredential, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::GetAccountCredential(
|
||||
asyncContext->name, asyncContext->credentialType, asyncContext->credential);
|
||||
ACCOUNT_LOGI("GetAccountCredential errcode parameter is %{public}d", asyncContext->errCode);
|
||||
@ -791,7 +791,7 @@ napi_value NapiAppAccount::GetAccountCredential(napi_env env, napi_callback_info
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAccountCredential, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_string_utf8(env, asyncContext->credential.c_str(), NAPI_AUTO_LENGTH, &getResult[PARAMONE]);
|
||||
@ -800,7 +800,7 @@ napi_value NapiAppAccount::GetAccountCredential(napi_env env, napi_callback_info
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -836,14 +836,14 @@ napi_value NapiAppAccount::GetAccountExtraInfo(napi_env env, napi_callback_info
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetAccountExtraInfo, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode = AppAccountManager::GetAccountExtraInfo(asyncContext->name, asyncContext->extraInfo);
|
||||
ACCOUNT_LOGI("GetAccountExtraInfo errcode parameter is %{public}d", asyncContext->errCode);
|
||||
asyncContext->status = asyncContext->errCode == 0 ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAccountExtraInfo, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_string_utf8(env, asyncContext->extraInfo.c_str(), NAPI_AUTO_LENGTH, &getResult[PARAMONE]);
|
||||
@ -852,7 +852,7 @@ napi_value NapiAppAccount::GetAccountExtraInfo(napi_env env, napi_callback_info
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -888,7 +888,7 @@ napi_value NapiAppAccount::GetAssociatedData(napi_env env, napi_callback_info cb
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetAssociatedData, napi_create_async_work running.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
asyncContext->errCode =
|
||||
AppAccountManager::GetAssociatedData(asyncContext->name, asyncContext->key, asyncContext->value);
|
||||
ACCOUNT_LOGI("GetAssociatedData errcode parameter is %{public}d", asyncContext->errCode);
|
||||
@ -896,7 +896,7 @@ napi_value NapiAppAccount::GetAssociatedData(napi_env env, napi_callback_info cb
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAssociatedData, napi_create_async_work complete.");
|
||||
AppAccountAsyncContext *asyncContext = (AppAccountAsyncContext *)data;
|
||||
AppAccountAsyncContext *asyncContext = reinterpret_cast<AppAccountAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_string_utf8(env, asyncContext->value.c_str(), NAPI_AUTO_LENGTH, &getResult[PARAMONE]);
|
||||
@ -905,7 +905,7 @@ napi_value NapiAppAccount::GetAssociatedData(napi_env env, napi_callback_info cb
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -937,7 +937,7 @@ napi_value NapiAppAccount::Authenticate(napi_env env, napi_callback_info cbInfo)
|
||||
resourceName,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("Authenticate, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::Authenticate(asyncContext->name, asyncContext->owner,
|
||||
asyncContext->authType, asyncContext->options, asyncContext->appAccountMgrCb);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -945,7 +945,7 @@ napi_value NapiAppAccount::Authenticate(napi_env env, napi_callback_info cbInfo)
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("Authenticate, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
AAFwk::Want errResult;
|
||||
if ((asyncContext->errCode != 0) && (asyncContext->appAccountMgrCb != nullptr)) {
|
||||
asyncContext->appAccountMgrCb->OnResult(asyncContext->errCode, errResult);
|
||||
@ -954,7 +954,7 @@ napi_value NapiAppAccount::Authenticate(napi_env env, napi_callback_info cbInfo)
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return NapiGetNull(env);
|
||||
@ -987,7 +987,7 @@ napi_value NapiAppAccount::GetOAuthToken(napi_env env, napi_callback_info cbInfo
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetOAuthToken, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::GetOAuthToken(
|
||||
asyncContext->name, asyncContext->owner, asyncContext->authType, asyncContext->token);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -996,7 +996,7 @@ napi_value NapiAppAccount::GetOAuthToken(napi_env env, napi_callback_info cbInfo
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetOAuthToken, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_string_utf8(env, asyncContext->token.c_str(), NAPI_AUTO_LENGTH, &getResult[PARAMONE]);
|
||||
@ -1005,7 +1005,7 @@ napi_value NapiAppAccount::GetOAuthToken(napi_env env, napi_callback_info cbInfo
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -1037,7 +1037,7 @@ napi_value NapiAppAccount::SetOAuthToken(napi_env env, napi_callback_info cbInfo
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("SetOAuthToken, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::SetOAuthToken(
|
||||
asyncContext->name, asyncContext->authType, asyncContext->token);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1046,7 +1046,7 @@ napi_value NapiAppAccount::SetOAuthToken(napi_env env, napi_callback_info cbInfo
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("SetOAuthToken, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value setResult[RESULT_COUNT] = {0};
|
||||
setResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &setResult[PARAMONE]);
|
||||
@ -1055,7 +1055,7 @@ napi_value NapiAppAccount::SetOAuthToken(napi_env env, napi_callback_info cbInfo
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
return result;
|
||||
@ -1088,7 +1088,7 @@ napi_value NapiAppAccount::DeleteOAuthToken(napi_env env, napi_callback_info cbI
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("DeleteOAuthToken, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::DeleteOAuthToken(
|
||||
asyncContext->name, asyncContext->owner, asyncContext->authType, asyncContext->token);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1097,7 +1097,7 @@ napi_value NapiAppAccount::DeleteOAuthToken(napi_env env, napi_callback_info cbI
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("DeleteOAuthToken, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value delResult[RESULT_COUNT] = {0};
|
||||
delResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_undefined(env, &delResult[PARAMONE]);
|
||||
@ -1106,7 +1106,7 @@ napi_value NapiAppAccount::DeleteOAuthToken(napi_env env, napi_callback_info cbI
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return result;
|
||||
@ -1139,7 +1139,7 @@ napi_value NapiAppAccount::SetOAuthTokenVisibility(napi_env env, napi_callback_i
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("DisableOAuthTokenAccess, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::SetOAuthTokenVisibility(
|
||||
asyncContext->name, asyncContext->authType, asyncContext->bundleName, asyncContext->isVisible);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1148,7 +1148,7 @@ napi_value NapiAppAccount::SetOAuthTokenVisibility(napi_env env, napi_callback_i
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("DisableOAuthTokenAccess, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value setResult[RESULT_COUNT] = {0};
|
||||
setResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_boolean(env, asyncContext->isVisible, &setResult[PARAMONE]);
|
||||
@ -1157,7 +1157,7 @@ napi_value NapiAppAccount::SetOAuthTokenVisibility(napi_env env, napi_callback_i
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return result;
|
||||
@ -1190,7 +1190,7 @@ napi_value NapiAppAccount::CheckOAuthTokenVisibility(napi_env env, napi_callback
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("CheckOAuthTokenVisibility, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::CheckOAuthTokenVisibility(
|
||||
asyncContext->name, asyncContext->authType, asyncContext->bundleName, asyncContext->isVisible);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1199,7 +1199,7 @@ napi_value NapiAppAccount::CheckOAuthTokenVisibility(napi_env env, napi_callback
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("CheckOAuthTokenVisibility, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value checkResult[RESULT_COUNT] = {0};
|
||||
checkResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_get_boolean(env, asyncContext->isVisible, &checkResult[PARAMONE]);
|
||||
@ -1208,7 +1208,7 @@ napi_value NapiAppAccount::CheckOAuthTokenVisibility(napi_env env, napi_callback
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return result;
|
||||
@ -1241,7 +1241,7 @@ napi_value NapiAppAccount::GetAuthenticatorInfo(napi_env env, napi_callback_info
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetAuthenticatorInfo, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::GetAuthenticatorInfo(
|
||||
asyncContext->owner, asyncContext->authenticatorInfo);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1250,7 +1250,7 @@ napi_value NapiAppAccount::GetAuthenticatorInfo(napi_env env, napi_callback_info
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAuthenticatorInfo, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_object(env, &getResult[PARAMONE]);
|
||||
@ -1260,7 +1260,7 @@ napi_value NapiAppAccount::GetAuthenticatorInfo(napi_env env, napi_callback_info
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return result;
|
||||
@ -1293,7 +1293,7 @@ napi_value NapiAppAccount::GetAllOAuthTokens(napi_env env, napi_callback_info cb
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetAllOAuthTokens, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::GetAllOAuthTokens(
|
||||
asyncContext->name, asyncContext->owner, asyncContext->oauthTokenInfos);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1302,7 +1302,7 @@ napi_value NapiAppAccount::GetAllOAuthTokens(napi_env env, napi_callback_info cb
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAllOAuthTokens, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_array(env, &getResult[PARAMONE]);
|
||||
@ -1312,7 +1312,7 @@ napi_value NapiAppAccount::GetAllOAuthTokens(napi_env env, napi_callback_info cb
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return result;
|
||||
@ -1345,7 +1345,7 @@ napi_value NapiAppAccount::GetOAuthList(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("GetOAuthList, napi_create_async_work running.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::GetOAuthList(
|
||||
asyncContext->name, asyncContext->authType, asyncContext->authList);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1354,7 +1354,7 @@ napi_value NapiAppAccount::GetOAuthList(napi_env env, napi_callback_info cbInfo)
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetOAuthList, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
napi_create_array(env, &getResult[PARAMONE]);
|
||||
@ -1364,7 +1364,7 @@ napi_value NapiAppAccount::GetOAuthList(napi_env env, napi_callback_info cbInfo)
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return result;
|
||||
@ -1396,7 +1396,7 @@ napi_value NapiAppAccount::GetAuthenticatorCallback(napi_env env, napi_callback_
|
||||
nullptr,
|
||||
resource,
|
||||
[](napi_env env, void *data) {
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
ErrCode errCode = AppAccountManager::GetAuthenticatorCallback(
|
||||
asyncContext->sessionId, asyncContext->authenticatorCb);
|
||||
asyncContext->errCode = ConvertToJSErrCode(errCode);
|
||||
@ -1405,7 +1405,7 @@ napi_value NapiAppAccount::GetAuthenticatorCallback(napi_env env, napi_callback_
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("GetAuthenticatorCallback, napi_create_async_work complete.");
|
||||
OAuthAsyncContext *asyncContext = (OAuthAsyncContext *)data;
|
||||
OAuthAsyncContext *asyncContext = reinterpret_cast<OAuthAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, asyncContext->errCode);
|
||||
GetAuthenticatorCallbackForResult(env, asyncContext->authenticatorCb, &getResult[PARAMONE]);
|
||||
@ -1414,7 +1414,7 @@ napi_value NapiAppAccount::GetAuthenticatorCallback(napi_env env, napi_callback_
|
||||
delete asyncContext;
|
||||
asyncContext = nullptr;
|
||||
},
|
||||
(void *)asyncContext,
|
||||
reinterpret_cast<void *>(asyncContext),
|
||||
&asyncContext->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, asyncContext->work));
|
||||
return result;
|
||||
@ -1455,7 +1455,7 @@ napi_value NapiAppAccount::Subscribe(napi_env env, napi_callback_info cbInfo)
|
||||
}
|
||||
asyncContextForOn->callbackRef = callback;
|
||||
AppAccountManager *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
napi_unwrap(env, thisVar, reinterpret_cast<void **>(&objectInfo));
|
||||
asyncContextForOn->appAccountManager = objectInfo;
|
||||
|
||||
{
|
||||
@ -1472,10 +1472,10 @@ napi_value NapiAppAccount::Subscribe(napi_env env, napi_callback_info cbInfo)
|
||||
SubscribeExecuteCB,
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("Subscribe, napi_create_async_work complete.");
|
||||
AsyncContextForSubscribe *asyncContextForOn = (AsyncContextForSubscribe *)data;
|
||||
AsyncContextForSubscribe *asyncContextForOn = reinterpret_cast<AsyncContextForSubscribe *>(data);
|
||||
napi_delete_async_work(env, asyncContextForOn->work);
|
||||
},
|
||||
(void *)asyncContextForOn,
|
||||
reinterpret_cast<void *>(asyncContextForOn),
|
||||
&asyncContextForOn->work);
|
||||
napi_queue_async_work(env, asyncContextForOn->work);
|
||||
return NapiGetNull(env);
|
||||
@ -1505,7 +1505,7 @@ napi_value NapiAppAccount::Unsubscribe(napi_env env, napi_callback_info cbInfo)
|
||||
asyncContextForOff->callbackRef = nullptr;
|
||||
|
||||
AppAccountManager *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
napi_unwrap(env, thisVar, reinterpret_cast<void **>(&objectInfo));
|
||||
|
||||
asyncContextForOff->appAccountManager = objectInfo;
|
||||
asyncContextForOff->callbackRef = callback;
|
||||
@ -1526,7 +1526,7 @@ napi_value NapiAppAccount::Unsubscribe(napi_env env, napi_callback_info cbInfo)
|
||||
resourceName,
|
||||
UnsubscribeExecuteCB,
|
||||
UnsubscribeCallbackCompletedCB,
|
||||
(void *)asyncContextForOff,
|
||||
reinterpret_cast<void *>(asyncContextForOff),
|
||||
&asyncContextForOff->work);
|
||||
napi_queue_async_work(env, asyncContextForOff->work);
|
||||
return NapiGetNull(env);
|
||||
|
@ -186,7 +186,7 @@ void UvQueueWorkCallJsFunction(uv_work_t *work, int status)
|
||||
if (param->funcName == Constants::OAUTH_ACTION_ADD_ACCOUNT_IMPLICITLY) {
|
||||
napi_get_reference_value(param->env, param->addAccountImplicitlyRef, &jsFunction);
|
||||
ret = napi_call_function(param->env, undefined, jsFunction, ARGS_SIZE_FOUR, &argv2[1], &returnVal);
|
||||
} else if (param->funcName == Constants::OAUTH_ACTION_AUTHENTICATE) {
|
||||
} else {
|
||||
napi_get_reference_value(param->env, param->authenticateRef, &jsFunction);
|
||||
ret = napi_call_function(param->env, undefined, jsFunction, ARGS_SIZE_FIVE, argv2, &returnVal);
|
||||
}
|
||||
@ -200,8 +200,8 @@ void UvQueueWorkCallJsFunction(uv_work_t *work, int status)
|
||||
ErrCode NapiAppAccountAuthenticator::CallJsFunction(AuthParam *param)
|
||||
{
|
||||
ACCOUNT_LOGI("Enter");
|
||||
if (param == nullptr) {
|
||||
ACCOUNT_LOGE("param is nullptr!");
|
||||
if ((param == nullptr) || (param->lockInfo == nullptr)) {
|
||||
ACCOUNT_LOGE("param or lockInfo is nullptr!");
|
||||
return ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR;
|
||||
}
|
||||
uv_loop_s *loop = nullptr;
|
||||
|
@ -71,7 +71,7 @@ static void ParseContextForOnResult(napi_env env, napi_callback_info cbInfo, Cal
|
||||
napi_value argv[ARGS_SIZE_FOUR] = {0};
|
||||
napi_value thisVar = nullptr;
|
||||
napi_get_cb_info(env, cbInfo, &argc, argv, &thisVar, nullptr);
|
||||
napi_unwrap(env, thisVar, (void **)&(param->callback));
|
||||
napi_unwrap(env, thisVar, reinterpret_cast<void **>(&(param->callback)));
|
||||
for (size_t i = 0; i < argc; ++i) {
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
napi_typeof(env, argv[i], &valueType);
|
||||
@ -95,7 +95,7 @@ static void ParseContextForRequestRedirected(napi_env env, napi_callback_info cb
|
||||
napi_value argv[ARGS_SIZE_ONE] = {0};
|
||||
napi_value thisVar = nullptr;
|
||||
napi_get_cb_info(env, cbInfo, &argc, argv, &thisVar, nullptr);
|
||||
napi_unwrap(env, thisVar, (void **)&(param->callback));
|
||||
napi_unwrap(env, thisVar, reinterpret_cast<void **>(&(param->callback)));
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
napi_typeof(env, argv[0], &valueType);
|
||||
if (valueType == napi_object) {
|
||||
@ -127,7 +127,11 @@ napi_value NapiAppAccountAuthenticatorCallback::JsOnResult(napi_env env, napi_ca
|
||||
resourceName,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("JsOnResult, napi_create_async_work running.");
|
||||
CallbackParam *param = (CallbackParam *)data;
|
||||
CallbackParam *param = reinterpret_cast<CallbackParam *>(data);
|
||||
if ((param == nullptr) || (param->callback == nullptr)) {
|
||||
ACCOUNT_LOGE("invalid parameters");
|
||||
return;
|
||||
}
|
||||
auto callbackProxy = iface_cast<IAppAccountAuthenticatorCallback>(param->callback->GetRemoteObject());
|
||||
if ((callbackProxy != nullptr) && (callbackProxy->AsObject() != nullptr)) {
|
||||
AAFwk::Want result;
|
||||
@ -137,12 +141,12 @@ napi_value NapiAppAccountAuthenticatorCallback::JsOnResult(napi_env env, napi_ca
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("JsOnResult, napi_create_async_work complete.");
|
||||
CallbackParam *param = (CallbackParam *)data;
|
||||
CallbackParam *param = reinterpret_cast<CallbackParam *>(data);
|
||||
napi_delete_async_work(env, param->work);
|
||||
delete param;
|
||||
param = nullptr;
|
||||
},
|
||||
(void *)param,
|
||||
reinterpret_cast<void *>(param),
|
||||
¶m->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, param->work));
|
||||
return NapiGetNull(env);
|
||||
@ -168,7 +172,11 @@ napi_value NapiAppAccountAuthenticatorCallback::JsOnRequestRedirected(napi_env e
|
||||
resourceName,
|
||||
[](napi_env env, void *data) {
|
||||
ACCOUNT_LOGI("JsOnRequestRedirected, napi_create_async_work running.");
|
||||
CallbackParam *param = (CallbackParam *)data;
|
||||
CallbackParam *param = reinterpret_cast<CallbackParam *>(data);
|
||||
if ((param == nullptr) || (param->callback == nullptr)) {
|
||||
ACCOUNT_LOGE("invalid parameters");
|
||||
return;
|
||||
}
|
||||
auto callbackProxy = iface_cast<IAppAccountAuthenticatorCallback>(param->callback->GetRemoteObject());
|
||||
if ((callbackProxy != nullptr) && (callbackProxy->AsObject() != nullptr)) {
|
||||
callbackProxy->OnRequestRedirected(param->request);
|
||||
@ -176,12 +184,12 @@ napi_value NapiAppAccountAuthenticatorCallback::JsOnRequestRedirected(napi_env e
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("JsOnRequestRedirected, napi_create_async_work complete.");
|
||||
CallbackParam *param = (CallbackParam *)data;
|
||||
CallbackParam *param = reinterpret_cast<CallbackParam *>(data);
|
||||
napi_delete_async_work(env, param->work);
|
||||
delete param;
|
||||
param = nullptr;
|
||||
},
|
||||
(void *)param,
|
||||
reinterpret_cast<void *>(param),
|
||||
¶m->work));
|
||||
NAPI_CALL(env, napi_queue_async_work(env, param->work));
|
||||
return NapiGetNull(env);
|
||||
@ -217,5 +225,5 @@ napi_value NapiAppAccountAuthenticatorCallback::JsConstructor(napi_env env, napi
|
||||
NAPI_ASSERT(env, status == napi_ok, "wrap js AuthenticatorStub and native callback failed");
|
||||
return thisVar;
|
||||
}
|
||||
} // namespace AccountSA
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
|
@ -39,7 +39,7 @@ void UvQueueWorkOnAppAccountsChanged(uv_work_t *work, int status)
|
||||
if (work == nullptr || work->data == nullptr) {
|
||||
return;
|
||||
}
|
||||
SubscriberAccountsWorker *subscriberAccountsWorkerData = (SubscriberAccountsWorker *)work->data;
|
||||
SubscriberAccountsWorker *subscriberAccountsWorkerData = reinterpret_cast<SubscriberAccountsWorker *>(work->data);
|
||||
uint32_t index = 0;
|
||||
napi_value results[ARGS_SIZE_ONE] = {nullptr};
|
||||
napi_create_array(subscriberAccountsWorkerData->env, &results[0]);
|
||||
@ -84,9 +84,6 @@ void SubscriberPtr::OnAccountsChanged(const std::vector<AppAccountInfo> &account
|
||||
{
|
||||
ACCOUNT_LOGI("enter");
|
||||
|
||||
ErrCode result;
|
||||
std::string owner;
|
||||
std::string name;
|
||||
uv_loop_s *loop = nullptr;
|
||||
napi_get_uv_event_loop(env_, &loop);
|
||||
if (loop == nullptr) {
|
||||
@ -106,21 +103,13 @@ void SubscriberPtr::OnAccountsChanged(const std::vector<AppAccountInfo> &account
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto account : accounts_) {
|
||||
result = account.GetOwner(owner);
|
||||
ACCOUNT_LOGI("owner = %{public}s", owner.c_str());
|
||||
|
||||
result = account.GetName(name);
|
||||
ACCOUNT_LOGI("name = %{public}s", name.c_str());
|
||||
}
|
||||
|
||||
subscriberAccountsWorker->accounts = accounts_;
|
||||
subscriberAccountsWorker->env = env_;
|
||||
subscriberAccountsWorker->ref = ref_;
|
||||
|
||||
ACCOUNT_LOGI("subscriberAccountsWorker->ref == %{public}p", subscriberAccountsWorker->ref);
|
||||
|
||||
work->data = (void *)subscriberAccountsWorker;
|
||||
work->data = reinterpret_cast<void *>(subscriberAccountsWorker);
|
||||
|
||||
uv_queue_work(loop, work, [](uv_work_t *work) {}, UvQueueWorkOnAppAccountsChanged);
|
||||
|
||||
@ -153,7 +142,7 @@ void UvQueueWorkOnResult(uv_work_t *work, int status)
|
||||
ACCOUNT_LOGE("work or data is nullptr");
|
||||
return;
|
||||
}
|
||||
AuthenticatorCallbackParam *data = (AuthenticatorCallbackParam *)work->data;
|
||||
AuthenticatorCallbackParam *data = reinterpret_cast<AuthenticatorCallbackParam *>(work->data);
|
||||
napi_value results[ARGS_SIZE_TWO] = {nullptr};
|
||||
results[0] = GetErrorCodeValue(data->env, data->resultCode);
|
||||
results[ARGS_SIZE_ONE] = AppExecFwk::WrapWantParams(data->env, data->result);
|
||||
@ -180,7 +169,7 @@ void UvQueueWorkOnRequestRedirected(uv_work_t *work, int status)
|
||||
ACCOUNT_LOGE("work or data is nullptr");
|
||||
return;
|
||||
}
|
||||
AuthenticatorCallbackParam *data = (AuthenticatorCallbackParam *)work->data;
|
||||
AuthenticatorCallbackParam *data = reinterpret_cast<AuthenticatorCallbackParam *>(work->data);
|
||||
napi_value results[ARGS_SIZE_ONE] = {nullptr};
|
||||
results[0] = AppExecFwk::WrapWant(data->env, data->request);
|
||||
napi_value undefined = nullptr;
|
||||
@ -215,7 +204,7 @@ void AppAccountManagerCallback::OnResult(int32_t resultCode, const AAFwk::Want &
|
||||
.resultRef = resultRef_,
|
||||
.requestRedirectedRef = requestRedirectedRef_,
|
||||
};
|
||||
work->data = (void *)param;
|
||||
work->data = reinterpret_cast<void *>(param);
|
||||
uv_queue_work(loop, work, [](uv_work_t *work) {}, UvQueueWorkOnResult);
|
||||
}
|
||||
|
||||
@ -239,7 +228,7 @@ void AppAccountManagerCallback::OnRequestRedirected(AAFwk::Want &request)
|
||||
.resultRef = resultRef_,
|
||||
.requestRedirectedRef = requestRedirectedRef_,
|
||||
};
|
||||
work->data = (void *)param;
|
||||
work->data = reinterpret_cast<void *>(param);
|
||||
uv_queue_work(loop, work, [](uv_work_t *work) {}, UvQueueWorkOnRequestRedirected);
|
||||
}
|
||||
|
||||
@ -383,7 +372,7 @@ void GetAuthenticatorCallbackForResult(napi_env env, sptr<IRemoteObject> callbac
|
||||
return;
|
||||
}
|
||||
napi_value remote;
|
||||
napi_create_int64(env, reinterpret_cast<int64_t>((IRemoteObject *) callback), &remote);
|
||||
napi_create_int64(env, reinterpret_cast<int64_t>((IRemoteObject *)callback), &remote);
|
||||
napi_value global = nullptr;
|
||||
napi_get_global(env, &global);
|
||||
if (global == nullptr) {
|
||||
@ -450,7 +439,7 @@ void ParseContextForSetExInfo(napi_env env, napi_callback_info cbInfo, AppAccoun
|
||||
}
|
||||
}
|
||||
|
||||
void ParseArguments(napi_env env, napi_value *argv, const napi_valuetype *valueTypes, size_t &argc)
|
||||
void ParseArguments(napi_env env, napi_value *argv, const napi_valuetype *valueTypes, size_t argc)
|
||||
{
|
||||
napi_valuetype valuetype = napi_undefined;
|
||||
for (size_t i = 0; i < argc; ++i) {
|
||||
@ -489,7 +478,7 @@ void ParseContextForAuthenticate(napi_env env, napi_callback_info cbInfo, OAuthA
|
||||
napi_get_named_property(env, global, "ability", &abilityObj);
|
||||
if (abilityObj != nullptr) {
|
||||
AppExecFwk::Ability *ability = nullptr;
|
||||
napi_get_value_external(env, abilityObj, (void **)&ability);
|
||||
napi_get_value_external(env, abilityObj, reinterpret_cast<void **>(&ability));
|
||||
auto abilityInfo = ability->GetAbilityInfo();
|
||||
asyncContext->options.SetParam(Constants::KEY_CALLER_ABILITY_NAME, abilityInfo->name);
|
||||
}
|
||||
@ -1000,7 +989,7 @@ napi_value ParseParametersByUnsubscribe(
|
||||
void SubscribeExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("Subscribe, napi_create_async_work running.");
|
||||
AsyncContextForSubscribe *asyncContextForOn = (AsyncContextForSubscribe *)data;
|
||||
AsyncContextForSubscribe *asyncContextForOn = reinterpret_cast<AsyncContextForSubscribe *>(data);
|
||||
asyncContextForOn->subscriber->SetEnv(env);
|
||||
asyncContextForOn->subscriber->SetCallbackRef(asyncContextForOn->callbackRef);
|
||||
int errCode = AppAccountManager::SubscribeAppAccount(asyncContextForOn->subscriber);
|
||||
@ -1010,7 +999,7 @@ void SubscribeExecuteCB(napi_env env, void *data)
|
||||
void UnsubscribeExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("Unsubscribe napi_create_async_work start.");
|
||||
AsyncContextForUnsubscribe *asyncContextForOff = (AsyncContextForUnsubscribe *)data;
|
||||
AsyncContextForUnsubscribe *asyncContextForOff = reinterpret_cast<AsyncContextForUnsubscribe *>(data);
|
||||
for (auto offSubscriber : asyncContextForOff->subscribers) {
|
||||
int errCode = AppAccountManager::UnsubscribeAppAccount(offSubscriber);
|
||||
ACCOUNT_LOGI("Unsubscribe errcode parameter is %{public}d", errCode);
|
||||
@ -1020,7 +1009,7 @@ void UnsubscribeExecuteCB(napi_env env, void *data)
|
||||
void UnsubscribeCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("Unsubscribe napi_create_async_work end.");
|
||||
AsyncContextForUnsubscribe *asyncContextForOff = (AsyncContextForUnsubscribe *)data;
|
||||
AsyncContextForUnsubscribe *asyncContextForOff = reinterpret_cast<AsyncContextForUnsubscribe *>(data);
|
||||
if (asyncContextForOff == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
2
interfaces/kits/napi/distributedaccount/BUILD.gn
Executable file → Normal file
2
interfaces/kits/napi/distributedaccount/BUILD.gn
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
8
interfaces/kits/napi/distributedaccount/include/napi_distributed_account.h
Executable file → Normal file
8
interfaces/kits/napi/distributedaccount/include/napi_distributed_account.h
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_DISTRIBUTED_ACCOUNT_H
|
||||
#define NAPI_DISTRIBUTED_ACCOUNT_H
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_DISTRIBUTEDACCOUNT_INCLUDE_NAPI_DISTRIBUTED_ACCOUNT_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_DISTRIBUTEDACCOUNT_INCLUDE_NAPI_DISTRIBUTED_ACCOUNT_H
|
||||
|
||||
#include "napi/native_api.h"
|
||||
|
||||
@ -34,4 +34,4 @@ private:
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // NAPI_DISTRIBUTED_ACCOUNT_H
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_DISTRIBUTEDACCOUNT_INCLUDE_NAPI_DISTRIBUTED_ACCOUNT_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -120,9 +120,9 @@ void ProcessSetNamedProperty(napi_env env, const DistributedAccountAsyncContext
|
||||
napi_set_named_property(env, result[1], PROPERTY_KEY_EVENT.c_str(), value);
|
||||
napi_value scalable = nullptr;
|
||||
napi_create_object(env, &scalable);
|
||||
for (const auto &[key, value]:asyncContext->scalableData) {
|
||||
for (const auto &[key, val]:asyncContext->scalableData) {
|
||||
napi_value jsValue = nullptr;
|
||||
napi_create_string_utf8(env, value.c_str(), value.size(), &jsValue);
|
||||
napi_create_string_utf8(env, val.c_str(), val.size(), &jsValue);
|
||||
napi_set_named_property(env, scalable, key.c_str(), jsValue);
|
||||
}
|
||||
napi_set_named_property(env, result[1], PROPERTY_KEY_SCALABLE.c_str(), scalable);
|
||||
@ -205,7 +205,7 @@ napi_value NapiDistributedAccount::QueryOhosAccountInfo(napi_env env, napi_callb
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource,
|
||||
[](napi_env env, void *data) {
|
||||
DistributedAccountAsyncContext *asyncContext = (DistributedAccountAsyncContext*)data;
|
||||
DistributedAccountAsyncContext *asyncContext = reinterpret_cast<DistributedAccountAsyncContext *>(data);
|
||||
std::pair<bool, OhosAccountInfo> accountInfo = OhosAccountKits::GetInstance().QueryOhosAccountInfo();
|
||||
if (accountInfo.first) {
|
||||
asyncContext->name = accountInfo.second.name_;
|
||||
@ -218,12 +218,12 @@ napi_value NapiDistributedAccount::QueryOhosAccountInfo(napi_env env, napi_callb
|
||||
}
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
DistributedAccountAsyncContext *asyncContext = (DistributedAccountAsyncContext*)data;
|
||||
DistributedAccountAsyncContext *asyncContext = reinterpret_cast<DistributedAccountAsyncContext *>(data);
|
||||
ProcessSetNamedProperty(env, asyncContext);
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
delete asyncContext;
|
||||
},
|
||||
(void*)asyncContext, &asyncContext->work);
|
||||
reinterpret_cast<void *>(asyncContext), &asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
|
||||
return result;
|
||||
@ -254,12 +254,12 @@ napi_value NapiDistributedAccount::UpdateOsAccountDistributedInfo(napi_env env,
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource,
|
||||
[](napi_env env, void *data) {
|
||||
DistributedAccountAsyncContext *asyncContext = (DistributedAccountAsyncContext*)data;
|
||||
DistributedAccountAsyncContext *asyncContext = reinterpret_cast<DistributedAccountAsyncContext *>(data);
|
||||
asyncContext->status = OhosAccountKits::GetInstance().UpdateOhosAccountInfo(asyncContext->name,
|
||||
asyncContext->id, asyncContext->event) ? napi_ok : napi_generic_failure;
|
||||
},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
DistributedAccountAsyncContext *asyncContext = (DistributedAccountAsyncContext*)data;
|
||||
DistributedAccountAsyncContext *asyncContext = reinterpret_cast<DistributedAccountAsyncContext *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
if (asyncContext->status == napi_ok) {
|
||||
napi_get_undefined(env, &result[0]);
|
||||
@ -274,7 +274,7 @@ napi_value NapiDistributedAccount::UpdateOsAccountDistributedInfo(napi_env env,
|
||||
napi_delete_async_work(env, asyncContext->work);
|
||||
delete asyncContext;
|
||||
},
|
||||
(void*)asyncContext, &asyncContext->work);
|
||||
reinterpret_cast<void *>(asyncContext), &asyncContext->work);
|
||||
napi_queue_async_work(env, asyncContext->work);
|
||||
|
||||
return result;
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_OS_ACCOUNT_H
|
||||
#define NAPI_OS_ACCOUNT_H
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_OSACCOUNT_INCLUDE_NAPI_OS_ACCOUNT_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_OSACCOUNT_INCLUDE_NAPI_OS_ACCOUNT_H
|
||||
|
||||
#include <uv.h>
|
||||
#include <map>
|
||||
@ -36,10 +36,10 @@ static thread_local napi_ref osAccountRef_ = nullptr;
|
||||
|
||||
class SubscriberPtr : public OsAccountSubscriber {
|
||||
public:
|
||||
SubscriberPtr(const OsAccountSubscribeInfo &subscribeInfo);
|
||||
explicit SubscriberPtr(const OsAccountSubscribeInfo &subscribeInfo);
|
||||
~SubscriberPtr();
|
||||
|
||||
virtual void OnAccountsChanged(const int &id) override;
|
||||
void OnAccountsChanged(const int &id) override;
|
||||
|
||||
void SetEnv(const napi_env &env);
|
||||
void SetCallbackRef(const napi_ref &ref);
|
||||
@ -498,4 +498,5 @@ void UnsubscribeCallbackCompletedCB(napi_env env, napi_status status, void *data
|
||||
void SetEnumProperty(napi_env env, napi_value dstObj, const int objValue, const char *propName);
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
#endif // NAPI_OS_ACCOUNT_H
|
||||
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_OSACCOUNT_INCLUDE_NAPI_OS_ACCOUNT_H
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NAPI_OS_ACCOUNT_COMMON_H
|
||||
#define NAPI_OS_ACCOUNT_COMMON_H
|
||||
#ifndef OS_ACCOUNT_INTERFACES_KITS_NAPI_OSACCOUNT_INCLUDE_NAPI_OS_ACCOUNT_COMMON_H
|
||||
#define OS_ACCOUNT_INTERFACES_KITS_NAPI_OSACCOUNT_INCLUDE_NAPI_OS_ACCOUNT_COMMON_H
|
||||
|
||||
#include "account_info.h"
|
||||
#include "napi_os_account.h"
|
||||
@ -23,8 +23,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountJsKit {
|
||||
#define PARAM0 0
|
||||
#define PARAM1 1
|
||||
constexpr std::int32_t MAX_VALUE_LEN = 4096;
|
||||
constexpr std::int32_t MAX_SUBSCRIBER_NAME_LEN = 1024;
|
||||
constexpr const std::int32_t STR_MAX_SIZE = 256;
|
||||
@ -284,4 +282,5 @@ napi_value ParseParaToUnsubscriber(const napi_env &env, const size_t &argc, cons
|
||||
napi_ref &callback, OS_ACCOUNT_SUBSCRIBE_TYPE &offType, std::string &offName);
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
#endif // NAPI_OS_ACCOUNT_COMMON_H
|
||||
|
||||
#endif // OS_ACCOUNT_INTERFACES_KITS_NAPI_OSACCOUNT_INCLUDE_NAPI_OS_ACCOUNT_COMMON_H
|
||||
|
@ -169,7 +169,7 @@ napi_value QueryOsAccountById(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
QueryOAByIdExecuteCB,
|
||||
QueryOAByIdCallbackCompletedCB,
|
||||
(void *)queryOAByIdCB,
|
||||
reinterpret_cast<void *>(queryOAByIdCB),
|
||||
&queryOAByIdCB->work);
|
||||
|
||||
napi_queue_async_work(env, queryOAByIdCB->work);
|
||||
@ -205,8 +205,8 @@ napi_value RemoveOsAccount(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "RemoveOsAccount", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, RemoveOAExecuteCB, RemoveOACallbackCompletedCB, (void *)removeOACB, &removeOACB->work);
|
||||
napi_create_async_work(env, nullptr, resource, RemoveOAExecuteCB, RemoveOACallbackCompletedCB,
|
||||
reinterpret_cast<void *>(removeOACB), &removeOACB->work);
|
||||
|
||||
napi_queue_async_work(env, removeOACB->work);
|
||||
return result;
|
||||
@ -246,7 +246,7 @@ napi_value SetOsAccountName(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
SetOANameExecuteCB,
|
||||
SetOANameCallbackCompletedCB,
|
||||
(void *)setOANameCB,
|
||||
reinterpret_cast<void *>(setOANameCB),
|
||||
&setOANameCB->work);
|
||||
|
||||
napi_queue_async_work(env, setOANameCB->work);
|
||||
@ -287,7 +287,7 @@ napi_value SetOsAccountConstraints(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
SetOAConsExecuteCB,
|
||||
SetOAConsCallbackCompletedCB,
|
||||
(void *)setOAConsCB,
|
||||
reinterpret_cast<void *>(setOAConsCB),
|
||||
&setOAConsCB->work);
|
||||
|
||||
napi_queue_async_work(env, setOAConsCB->work);
|
||||
@ -328,7 +328,7 @@ napi_value ActivateOsAccount(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
ActivateOAExecuteCB,
|
||||
ActivateOACallbackCompletedCB,
|
||||
(void *)activeOACB,
|
||||
reinterpret_cast<void *>(activeOACB),
|
||||
&activeOACB->work);
|
||||
|
||||
napi_queue_async_work(env, activeOACB->work);
|
||||
@ -364,8 +364,8 @@ napi_value CreateOsAccount(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "CreateOsAccount", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, CreateOAExecuteCB, CreateOACallbackCompletedCB, (void *)createOACB, &createOACB->work);
|
||||
napi_create_async_work(env, nullptr, resource, CreateOAExecuteCB, CreateOACallbackCompletedCB,
|
||||
reinterpret_cast<void *>(createOACB), &createOACB->work);
|
||||
|
||||
napi_queue_async_work(env, createOACB->work);
|
||||
return result;
|
||||
@ -399,8 +399,8 @@ napi_value CreateOsAccountForDomain(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "CreateOsAccountForDomain", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(env, nullptr, resource, CreateOAForDomainExecuteCB,
|
||||
CreateOAForDomainCallbackCompletedCB, (void *)createOAForDomainCB, &createOAForDomainCB->work);
|
||||
napi_create_async_work(env, nullptr, resource, CreateOAForDomainExecuteCB, CreateOAForDomainCallbackCompletedCB,
|
||||
reinterpret_cast<void *>(createOAForDomainCB), &createOAForDomainCB->work);
|
||||
|
||||
napi_queue_async_work(env, createOAForDomainCB->work);
|
||||
return result;
|
||||
@ -436,7 +436,7 @@ napi_value GetCreatedOsAccountsCount(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
GetOACountExecuteCB,
|
||||
GetOACountCallbackCompletedCB,
|
||||
(void *)getOACount,
|
||||
reinterpret_cast<void *>(getOACount),
|
||||
&getOACount->work);
|
||||
|
||||
napi_queue_async_work(env, getOACount->work);
|
||||
@ -473,7 +473,7 @@ napi_value GetDistributedVirtualDeviceId(napi_env env, napi_callback_info cbInfo
|
||||
resource,
|
||||
DbDeviceIdExecuteCB,
|
||||
DbDeviceIdCallbackCompletedCB,
|
||||
(void *)dbDeviceId,
|
||||
reinterpret_cast<void *>(dbDeviceId),
|
||||
&dbDeviceId->work);
|
||||
|
||||
napi_queue_async_work(env, dbDeviceId->work);
|
||||
@ -513,7 +513,7 @@ napi_value GetOsAccountAllConstraints(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
GetAllConsExecuteCB,
|
||||
GetAllConsCallbackCompletedCB,
|
||||
(void *)getAllConsCB,
|
||||
reinterpret_cast<void *>(getAllConsCB),
|
||||
&getAllConsCB->work);
|
||||
|
||||
napi_queue_async_work(env, getAllConsCB->work);
|
||||
@ -550,7 +550,7 @@ napi_value GetOsAccountLocalIdFromProcess(napi_env env, napi_callback_info cbInf
|
||||
resource,
|
||||
GetProcessIdExecuteCB,
|
||||
GetProcessIdCallbackCompletedCB,
|
||||
(void *)getIdCB,
|
||||
reinterpret_cast<void *>(getIdCB),
|
||||
&getIdCB->work);
|
||||
|
||||
napi_queue_async_work(env, getIdCB->work);
|
||||
@ -587,7 +587,7 @@ napi_value QueryAllCreatedOsAccounts(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
QueryCreateOAExecuteCB,
|
||||
QueryCreateOACallbackCompletedCB,
|
||||
(void *)queryAllOA,
|
||||
reinterpret_cast<void *>(queryAllOA),
|
||||
&queryAllOA->work);
|
||||
|
||||
napi_queue_async_work(env, queryAllOA->work);
|
||||
@ -624,7 +624,7 @@ napi_value QueryActivatedOsAccountIds(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
QueryActiveIdsExecuteCB,
|
||||
QueryActiveIdsCallbackCompletedCB,
|
||||
(void *)queryActiveIds,
|
||||
reinterpret_cast<void *>(queryActiveIds),
|
||||
&queryActiveIds->work);
|
||||
|
||||
napi_queue_async_work(env, queryActiveIds->work);
|
||||
@ -660,8 +660,8 @@ napi_value GetOsAccountProfilePhoto(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "GetOsAccountProfilePhoto", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, GetOAPhoteExecuteCB, GetOAPhoteCallbackCompletedCB, (void *)getPhoto, &getPhoto->work);
|
||||
napi_create_async_work(env, nullptr, resource, GetOAPhoteExecuteCB, GetOAPhoteCallbackCompletedCB,
|
||||
reinterpret_cast<void *>(getPhoto), &getPhoto->work);
|
||||
|
||||
napi_queue_async_work(env, getPhoto->work);
|
||||
return result;
|
||||
@ -697,7 +697,7 @@ napi_value QueryCurrentOsAccount(napi_env env, napi_callback_info cbInfo)
|
||||
resource,
|
||||
QueryCurrentOAExecuteCB,
|
||||
QueryCurrentOACallbackCompletedCB,
|
||||
(void *)currentOA,
|
||||
reinterpret_cast<void *>(currentOA),
|
||||
¤tOA->work);
|
||||
|
||||
napi_queue_async_work(env, currentOA->work);
|
||||
@ -732,8 +732,8 @@ napi_value GetOsAccountLocalIdFromUid(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "GetOsAccountLocalIdFromUid", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, GetIdByUidExecuteCB, GetIdByUidCallbackCompletedCB, (void *)idByUid, &idByUid->work);
|
||||
napi_create_async_work(env, nullptr, resource, GetIdByUidExecuteCB, GetIdByUidCallbackCompletedCB,
|
||||
reinterpret_cast<void *>(idByUid), &idByUid->work);
|
||||
|
||||
napi_queue_async_work(env, idByUid->work);
|
||||
return result;
|
||||
@ -767,8 +767,8 @@ napi_value GetOsAccountLocalIdFromDomain(napi_env env, napi_callback_info cbInfo
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "GetOsAccountLocalIdFromDomain", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(env, nullptr, resource, GetIdByDomainExecuteCB,
|
||||
GetIdByDomainCallbackCompletedCB, (void *)idByDomain, &idByDomain->work);
|
||||
napi_create_async_work(env, nullptr, resource, GetIdByDomainExecuteCB, GetIdByDomainCallbackCompletedCB,
|
||||
reinterpret_cast<void *>(idByDomain), &idByDomain->work);
|
||||
|
||||
napi_queue_async_work(env, idByDomain->work);
|
||||
return result;
|
||||
@ -802,8 +802,8 @@ napi_value SetOsAccountProfilePhoto(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "SetOsAccountProfilePhoto", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, SetPhotoExecuteCB, SetPhotoCompletedCB, (void *)setPhoto, &setPhoto->work);
|
||||
napi_create_async_work(env, nullptr, resource, SetPhotoExecuteCB, SetPhotoCompletedCB,
|
||||
reinterpret_cast<void *>(setPhoto), &setPhoto->work);
|
||||
|
||||
napi_queue_async_work(env, setPhoto->work);
|
||||
return result;
|
||||
@ -834,8 +834,8 @@ napi_value QueryMaxOsAccountNumber(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "QueryMaxOsAccountNumber", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, QueryMaxNumExecuteCB, QueryMaxNumCompletedCB, (void *)maxNum, &maxNum->work);
|
||||
napi_create_async_work(env, nullptr, resource, QueryMaxNumExecuteCB, QueryMaxNumCompletedCB,
|
||||
reinterpret_cast<void *>(maxNum), &maxNum->work);
|
||||
|
||||
napi_queue_async_work(env, maxNum->work);
|
||||
return result;
|
||||
@ -869,8 +869,8 @@ napi_value IsOsAccountActived(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "IsOsAccountActived", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, IsActivedExecuteCB, IsActivedCompletedCB, (void *)isActived, &isActived->work);
|
||||
napi_create_async_work(env, nullptr, resource, IsActivedExecuteCB, IsActivedCompletedCB,
|
||||
reinterpret_cast<void *>(isActived), &isActived->work);
|
||||
|
||||
napi_queue_async_work(env, isActived->work);
|
||||
return result;
|
||||
@ -904,8 +904,8 @@ napi_value IsOsAccountConstraintEnable(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "IsOsAccountConstraintEnable", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, IsEnableExecuteCB, IsEnableCompletedCB, (void *)isEnable, &isEnable->work);
|
||||
napi_create_async_work(env, nullptr, resource, IsEnableExecuteCB, IsEnableCompletedCB,
|
||||
reinterpret_cast<void *>(isEnable), &isEnable->work);
|
||||
|
||||
napi_queue_async_work(env, isEnable->work);
|
||||
return result;
|
||||
@ -936,8 +936,8 @@ napi_value GetOsAccountTypeFromProcess(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "GetOsAccountTypeFromProcess", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, GetTypeExecuteCB, GetTypeCompletedCB, (void *)getType, &getType->work);
|
||||
napi_create_async_work(env, nullptr, resource, GetTypeExecuteCB, GetTypeCompletedCB,
|
||||
reinterpret_cast<void *>(getType), &getType->work);
|
||||
|
||||
napi_queue_async_work(env, getType->work);
|
||||
return result;
|
||||
@ -968,8 +968,8 @@ napi_value IsMultiOsAccountEnable(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "IsMultiOsAccountEnable", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, IsMultiEnExecuteCB, IsMultiEnCompletedCB, (void *)multiEn, &multiEn->work);
|
||||
napi_create_async_work(env, nullptr, resource, IsMultiEnExecuteCB, IsMultiEnCompletedCB,
|
||||
reinterpret_cast<void *>(multiEn), &multiEn->work);
|
||||
|
||||
napi_queue_async_work(env, multiEn->work);
|
||||
return result;
|
||||
@ -1003,8 +1003,8 @@ napi_value IsOsAccountVerified(napi_env env, napi_callback_info cbInfo)
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "IsOsAccountVerified", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, IsVerifiedExecuteCB, IsVerifiedCompletedCB, (void *)isVerified, &isVerified->work);
|
||||
napi_create_async_work(env, nullptr, resource, IsVerifiedExecuteCB, IsVerifiedCompletedCB,
|
||||
reinterpret_cast<void *>(isVerified), &isVerified->work);
|
||||
|
||||
napi_queue_async_work(env, isVerified->work);
|
||||
return result;
|
||||
@ -1038,8 +1038,8 @@ napi_value GetOsAccountLocalIdBySerialNumber(napi_env env, napi_callback_info cb
|
||||
napi_value resource = nullptr;
|
||||
napi_create_string_utf8(env, "GetOsAccountLocalIdBySerialNumber", NAPI_AUTO_LENGTH, &resource);
|
||||
|
||||
napi_create_async_work(
|
||||
env, nullptr, resource, SerialNumIdExecuteCB, SerialNumIdCompletedCB, (void *)serialNumId, &serialNumId->work);
|
||||
napi_create_async_work(env, nullptr, resource, SerialNumIdExecuteCB, SerialNumIdCompletedCB,
|
||||
reinterpret_cast<void *>(serialNumId), &serialNumId->work);
|
||||
|
||||
napi_queue_async_work(env, serialNumId->work);
|
||||
return result;
|
||||
@ -1078,7 +1078,7 @@ napi_value GetSerialNumberByOsAccountLocalId(napi_env env, napi_callback_info cb
|
||||
resource,
|
||||
GetSerialNumExecuteCB,
|
||||
GetSerialNumCompletedCB,
|
||||
(void *)getSerialNum,
|
||||
reinterpret_cast<void *>(getSerialNum),
|
||||
&getSerialNum->work);
|
||||
|
||||
napi_queue_async_work(env, getSerialNum->work);
|
||||
@ -1116,18 +1116,18 @@ napi_value IsTestOsAccount(napi_env env, napi_callback_info cbInfo)
|
||||
[](napi_env env, void *data) {},
|
||||
[](napi_env env, napi_status status, void *data) {
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
IsTestOAInfo *isTest = (IsTestOAInfo *)data;
|
||||
IsTestOAInfo *isTest = reinterpret_cast<IsTestOAInfo *>(data);
|
||||
isTest->errCode = 0;
|
||||
isTest->isTestOsAccount = false;
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
result[PARAM0] = GetErrorCodeValue(env, isTest->errCode);
|
||||
napi_get_boolean(env, isTest->isTestOsAccount, &result[PARAM1]);
|
||||
CBOrPromiseIsTestOA(env, isTest, result[PARAM0], result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, isTest->errCode);
|
||||
napi_get_boolean(env, isTest->isTestOsAccount, &result[PARAMONE]);
|
||||
CBOrPromiseIsTestOA(env, isTest, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, isTest->work);
|
||||
delete isTest;
|
||||
isTest = nullptr;
|
||||
},
|
||||
(void *)isTest,
|
||||
reinterpret_cast<void *>(isTest),
|
||||
&isTest->work);
|
||||
|
||||
napi_queue_async_work(env, isTest->work);
|
||||
@ -1171,7 +1171,7 @@ napi_value Subscribe(napi_env env, napi_callback_info cbInfo)
|
||||
subscribeCBInfo->subscriber = std::make_shared<SubscriberPtr>(subscribeInfo);
|
||||
|
||||
OsAccountManager *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
napi_unwrap(env, thisVar, reinterpret_cast<void **>(&objectInfo));
|
||||
subscribeCBInfo->osManager = objectInfo;
|
||||
ACCOUNT_LOGI("OsAccountManager objectInfo = %{public}p", objectInfo);
|
||||
|
||||
@ -1189,7 +1189,7 @@ napi_value Subscribe(napi_env env, napi_callback_info cbInfo)
|
||||
resourceName,
|
||||
SubscribeExecuteCB,
|
||||
SubscribeCompletedCB,
|
||||
(void *)subscribeCBInfo,
|
||||
reinterpret_cast<void *>(subscribeCBInfo),
|
||||
&subscribeCBInfo->work);
|
||||
napi_queue_async_work(env, subscribeCBInfo->work);
|
||||
return WrapVoidToJS(env);
|
||||
@ -1228,7 +1228,7 @@ void SubscriberPtr::OnAccountsChanged(const int &id_)
|
||||
subscriberOAWorker->env = env_;
|
||||
subscriberOAWorker->ref = ref_;
|
||||
subscriberOAWorker->subscriber = this;
|
||||
work->data = (void *)subscriberOAWorker;
|
||||
work->data = reinterpret_cast<void *>(subscriberOAWorker);
|
||||
uv_queue_work(loop, work, [](uv_work_t *work) {}, UvQueueWorkOnAccountsChanged);
|
||||
|
||||
ACCOUNT_LOGI("end");
|
||||
@ -1240,10 +1240,10 @@ void UvQueueWorkOnAccountsChanged(uv_work_t *work, int status)
|
||||
if (work == nullptr || work->data == nullptr) {
|
||||
return;
|
||||
}
|
||||
SubscriberOAWorker *subscriberOAWorkerData = (SubscriberOAWorker *)work->data;
|
||||
SubscriberOAWorker *subscriberOAWorkerData = reinterpret_cast<SubscriberOAWorker *>(work->data);
|
||||
|
||||
napi_value result[ARGS_SIZE_ONE] = {nullptr};
|
||||
napi_create_int32(subscriberOAWorkerData->env, subscriberOAWorkerData->id, &result[PARAM0]);
|
||||
napi_create_int32(subscriberOAWorkerData->env, subscriberOAWorkerData->id, &result[PARAMZERO]);
|
||||
|
||||
napi_value undefined = nullptr;
|
||||
napi_get_undefined(subscriberOAWorkerData->env, &undefined);
|
||||
@ -1319,7 +1319,7 @@ napi_value Unsubscribe(napi_env env, napi_callback_info cbInfo)
|
||||
}
|
||||
|
||||
OsAccountManager *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
napi_unwrap(env, thisVar, reinterpret_cast<void **>(&objectInfo));
|
||||
unsubscribeCBInfo->osManager = objectInfo;
|
||||
unsubscribeCBInfo->callbackRef = callback;
|
||||
unsubscribeCBInfo->osSubscribeType = offType;
|
||||
@ -1344,7 +1344,7 @@ napi_value Unsubscribe(napi_env env, napi_callback_info cbInfo)
|
||||
resourceName,
|
||||
UnsubscribeExecuteCB,
|
||||
UnsubscribeCallbackCompletedCB,
|
||||
(void *)unsubscribeCBInfo,
|
||||
reinterpret_cast<void *>(unsubscribeCBInfo),
|
||||
&unsubscribeCBInfo->work);
|
||||
napi_queue_async_work(env, unsubscribeCBInfo->work);
|
||||
return WrapVoidToJS(env);
|
||||
@ -1383,7 +1383,7 @@ void FindSubscriberInMap(
|
||||
void UnsubscribeExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
UnsubscribeCBInfo *unsubscribeCBInfo = (UnsubscribeCBInfo *)data;
|
||||
UnsubscribeCBInfo *unsubscribeCBInfo = reinterpret_cast<UnsubscribeCBInfo *>(data);
|
||||
ACCOUNT_LOGI("UnsubscribeExecuteCB Off size = %{public}zu", unsubscribeCBInfo->subscribers.size());
|
||||
for (auto offSubscriber : unsubscribeCBInfo->subscribers) {
|
||||
int errCode = OsAccountManager::UnsubscribeOsAccount(offSubscriber);
|
||||
@ -1394,7 +1394,7 @@ void UnsubscribeExecuteCB(napi_env env, void *data)
|
||||
void UnsubscribeCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete.");
|
||||
UnsubscribeCBInfo *unsubscribeCBInfo = (UnsubscribeCBInfo *)data;
|
||||
UnsubscribeCBInfo *unsubscribeCBInfo = reinterpret_cast<UnsubscribeCBInfo *>(data);
|
||||
if (unsubscribeCBInfo == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -1411,7 +1411,7 @@ void UnsubscribeCallbackCompletedCB(napi_env env, napi_status status, void *data
|
||||
napi_get_reference_value(env, unsubscribeCBInfo->callbackRef, &callback);
|
||||
|
||||
napi_value results[ARGS_SIZE_ONE] = {nullptr};
|
||||
results[PARAM0] = result;
|
||||
results[PARAMZERO] = result;
|
||||
|
||||
NAPI_CALL_RETURN_VOID(
|
||||
env, napi_call_function(env, undefined, callback, ARGS_SIZE_ONE, &results[0], &resultout));
|
||||
|
@ -13,9 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "napi_os_account.h"
|
||||
#include "napi_os_account_common.h"
|
||||
|
||||
#include "napi_os_account.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountJsKit {
|
||||
napi_value WrapVoidToJS(napi_env env)
|
||||
@ -94,7 +95,7 @@ napi_value ParseParaQueryOAByIdCB(napi_env env, napi_callback_info cbInfo, Query
|
||||
void QueryOAByIdExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
QueryOAByIdAsyncContext *queryOAByIdCB = (QueryOAByIdAsyncContext *)data;
|
||||
QueryOAByIdAsyncContext *queryOAByIdCB = reinterpret_cast<QueryOAByIdAsyncContext *>(data);
|
||||
queryOAByIdCB->errCode = OsAccountManager::QueryOsAccountById(queryOAByIdCB->id, queryOAByIdCB->osAccountInfos);
|
||||
ACCOUNT_LOGI("errcode is %{public}d", queryOAByIdCB->errCode);
|
||||
queryOAByIdCB->status = (queryOAByIdCB->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -103,12 +104,12 @@ void QueryOAByIdExecuteCB(napi_env env, void *data)
|
||||
void QueryOAByIdCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
QueryOAByIdAsyncContext *queryOAByIdCB = (QueryOAByIdAsyncContext *)data;
|
||||
QueryOAByIdAsyncContext *queryOAByIdCB = reinterpret_cast<QueryOAByIdAsyncContext *>(data);
|
||||
napi_value queryResult[RESULT_COUNT] = {0};
|
||||
queryResult[PARAM0] = GetErrorCodeValue(env, queryOAByIdCB->errCode);
|
||||
napi_create_object(env, &queryResult[PARAM1]);
|
||||
GetOACBInfoToJs(env, queryOAByIdCB->osAccountInfos, queryResult[PARAM1]);
|
||||
CBOrPromiseToQueryOAById(env, queryOAByIdCB, queryResult[PARAM0], queryResult[PARAM1]);
|
||||
queryResult[PARAMZERO] = GetErrorCodeValue(env, queryOAByIdCB->errCode);
|
||||
napi_create_object(env, &queryResult[PARAMONE]);
|
||||
GetOACBInfoToJs(env, queryOAByIdCB->osAccountInfos, queryResult[PARAMONE]);
|
||||
CBOrPromiseToQueryOAById(env, queryOAByIdCB, queryResult[PARAMZERO], queryResult[PARAMONE]);
|
||||
napi_delete_async_work(env, queryOAByIdCB->work);
|
||||
delete queryOAByIdCB;
|
||||
queryOAByIdCB = nullptr;
|
||||
@ -220,14 +221,8 @@ void GetOACBInfoToJs(napi_env env, OsAccountInfo &info, napi_value objOAInfo)
|
||||
napi_set_named_property(env, dbInfoToJs, "event", value);
|
||||
|
||||
// scalableData
|
||||
std::map<std::string, std::string> scalableData = {};
|
||||
napi_value scalable = nullptr;
|
||||
napi_create_object(env, &scalable);
|
||||
for (const auto &[key, item] : scalableData) {
|
||||
napi_value jsValue = nullptr;
|
||||
napi_create_string_utf8(env, item.c_str(), item.size(), &jsValue);
|
||||
napi_set_named_property(env, scalable, key.c_str(), jsValue);
|
||||
}
|
||||
napi_set_named_property(env, dbInfoToJs, "scalableData", scalable);
|
||||
} else {
|
||||
napi_get_undefined(env, &dbInfoToJs);
|
||||
@ -316,7 +311,7 @@ napi_value ParseParaRemoveOACB(napi_env env, napi_callback_info cbInfo, RemoveOA
|
||||
void RemoveOAExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
RemoveOAAsyncContext *removeOACB = (RemoveOAAsyncContext *)data;
|
||||
RemoveOAAsyncContext *removeOACB = reinterpret_cast<RemoveOAAsyncContext *>(data);
|
||||
removeOACB->errCode = OsAccountManager::RemoveOsAccount(removeOACB->id);
|
||||
ACCOUNT_LOGI("errcode is %{public}d", removeOACB->errCode);
|
||||
removeOACB->status = (removeOACB->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -325,11 +320,11 @@ void RemoveOAExecuteCB(napi_env env, void *data)
|
||||
void RemoveOACallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
RemoveOAAsyncContext *removeOACB = (RemoveOAAsyncContext *)data;
|
||||
RemoveOAAsyncContext *removeOACB = reinterpret_cast<RemoveOAAsyncContext *>(data);
|
||||
napi_value rmResult[RESULT_COUNT] = {0};
|
||||
rmResult[PARAM0] = GetErrorCodeValue(env, removeOACB->errCode);
|
||||
napi_get_undefined(env, &rmResult[PARAM1]);
|
||||
CBOrPromiseToRemoveOA(env, removeOACB, rmResult[PARAM0], rmResult[PARAM1]);
|
||||
rmResult[PARAMZERO] = GetErrorCodeValue(env, removeOACB->errCode);
|
||||
napi_get_undefined(env, &rmResult[PARAMONE]);
|
||||
CBOrPromiseToRemoveOA(env, removeOACB, rmResult[PARAMZERO], rmResult[PARAMONE]);
|
||||
napi_delete_async_work(env, removeOACB->work);
|
||||
delete removeOACB;
|
||||
removeOACB = nullptr;
|
||||
@ -386,7 +381,7 @@ napi_value ParseParaSetOAName(napi_env env, napi_callback_info cbInfo, SetOAName
|
||||
void SetOANameExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
SetOANameAsyncContext *setOANameCB = (SetOANameAsyncContext *)data;
|
||||
SetOANameAsyncContext *setOANameCB = reinterpret_cast<SetOANameAsyncContext *>(data);
|
||||
setOANameCB->errCode = OsAccountManager::SetOsAccountName(setOANameCB->id, setOANameCB->name);
|
||||
ACCOUNT_LOGI("errcode is %{public}d", setOANameCB->errCode);
|
||||
setOANameCB->status = (setOANameCB->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -395,11 +390,11 @@ void SetOANameExecuteCB(napi_env env, void *data)
|
||||
void SetOANameCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
SetOANameAsyncContext *setOANameCB = (SetOANameAsyncContext *)data;
|
||||
SetOANameAsyncContext *setOANameCB = reinterpret_cast<SetOANameAsyncContext *>(data);
|
||||
napi_value setNameResult[RESULT_COUNT] = {0};
|
||||
setNameResult[PARAM0] = GetErrorCodeValue(env, setOANameCB->errCode);
|
||||
napi_get_undefined(env, &setNameResult[PARAM1]);
|
||||
CBOrPromiseToSetOAName(env, setOANameCB, setNameResult[PARAM0], setNameResult[PARAM1]);
|
||||
setNameResult[PARAMZERO] = GetErrorCodeValue(env, setOANameCB->errCode);
|
||||
napi_get_undefined(env, &setNameResult[PARAMONE]);
|
||||
CBOrPromiseToSetOAName(env, setOANameCB, setNameResult[PARAMZERO], setNameResult[PARAMONE]);
|
||||
napi_delete_async_work(env, setOANameCB->work);
|
||||
delete setOANameCB;
|
||||
setOANameCB = nullptr;
|
||||
@ -489,7 +484,7 @@ napi_value ParseParaSetOAConstraints(napi_env env, napi_callback_info cbInfo, Se
|
||||
void SetOAConsExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
SetOAConsAsyncContext *setOAConsCB = (SetOAConsAsyncContext *)data;
|
||||
SetOAConsAsyncContext *setOAConsCB = reinterpret_cast<SetOAConsAsyncContext *>(data);
|
||||
setOAConsCB->errCode =
|
||||
OsAccountManager::SetOsAccountConstraints(setOAConsCB->id, setOAConsCB->constraints, setOAConsCB->enable);
|
||||
ACCOUNT_LOGI("errcode is %{public}d", setOAConsCB->errCode);
|
||||
@ -499,11 +494,11 @@ void SetOAConsExecuteCB(napi_env env, void *data)
|
||||
void SetOAConsCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
SetOAConsAsyncContext *setOAConsCB = (SetOAConsAsyncContext *)data;
|
||||
SetOAConsAsyncContext *setOAConsCB = reinterpret_cast<SetOAConsAsyncContext *>(data);
|
||||
napi_value setConsResult[RESULT_COUNT] = {0};
|
||||
setConsResult[PARAM0] = GetErrorCodeValue(env, setOAConsCB->errCode);
|
||||
napi_get_undefined(env, &setConsResult[PARAM1]);
|
||||
CBOrPromiseToSetOACons(env, setOAConsCB, setConsResult[PARAM0], setConsResult[PARAM1]);
|
||||
setConsResult[PARAMZERO] = GetErrorCodeValue(env, setOAConsCB->errCode);
|
||||
napi_get_undefined(env, &setConsResult[PARAMONE]);
|
||||
CBOrPromiseToSetOACons(env, setOAConsCB, setConsResult[PARAMZERO], setConsResult[PARAMONE]);
|
||||
napi_delete_async_work(env, setOAConsCB->work);
|
||||
delete setOAConsCB;
|
||||
setOAConsCB = nullptr;
|
||||
@ -558,7 +553,7 @@ napi_value ParseParaActiveOA(napi_env env, napi_callback_info cbInfo, ActivateOA
|
||||
void ActivateOAExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
ActivateOAAsyncContext *activateOACB = (ActivateOAAsyncContext *)data;
|
||||
ActivateOAAsyncContext *activateOACB = reinterpret_cast<ActivateOAAsyncContext *>(data);
|
||||
activateOACB->errCode = OsAccountManager::ActivateOsAccount(activateOACB->id);
|
||||
ACCOUNT_LOGI("errcode is %{public}d", activateOACB->errCode);
|
||||
activateOACB->status = (activateOACB->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -567,11 +562,11 @@ void ActivateOAExecuteCB(napi_env env, void *data)
|
||||
void ActivateOACallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
ActivateOAAsyncContext *activateOA = (ActivateOAAsyncContext *)data;
|
||||
ActivateOAAsyncContext *activateOA = reinterpret_cast<ActivateOAAsyncContext *>(data);
|
||||
napi_value activateResult[RESULT_COUNT] = {0};
|
||||
activateResult[PARAM0] = GetErrorCodeValue(env, activateOA->errCode);
|
||||
napi_get_undefined(env, &activateResult[PARAM1]);
|
||||
CBOrPromiseToActivateOA(env, activateOA, activateResult[PARAM0], activateResult[PARAM1]);
|
||||
activateResult[PARAMZERO] = GetErrorCodeValue(env, activateOA->errCode);
|
||||
napi_get_undefined(env, &activateResult[PARAMONE]);
|
||||
CBOrPromiseToActivateOA(env, activateOA, activateResult[PARAMZERO], activateResult[PARAMONE]);
|
||||
napi_delete_async_work(env, activateOA->work);
|
||||
delete activateOA;
|
||||
activateOA = nullptr;
|
||||
@ -660,7 +655,7 @@ napi_value ParseParaCreateOAForDomain(napi_env env, napi_callback_info cbInfo,
|
||||
void CreateOAExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
CreateOAAsyncContext *createOACB = (CreateOAAsyncContext *)data;
|
||||
CreateOAAsyncContext *createOACB = reinterpret_cast<CreateOAAsyncContext *>(data);
|
||||
createOACB->errCode =
|
||||
OsAccountManager::CreateOsAccount(createOACB->name, createOACB->type, createOACB->osAccountInfos);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", createOACB->errCode);
|
||||
@ -670,7 +665,7 @@ void CreateOAExecuteCB(napi_env env, void *data)
|
||||
void CreateOAForDomainExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
CreateOAForDomainAsyncContext *createOAForDomainCB = (CreateOAForDomainAsyncContext *)data;
|
||||
CreateOAForDomainAsyncContext *createOAForDomainCB = reinterpret_cast<CreateOAForDomainAsyncContext *>(data);
|
||||
createOAForDomainCB->errCode = OsAccountManager::CreateOsAccountForDomain(createOAForDomainCB->type,
|
||||
createOAForDomainCB->domainInfo, createOAForDomainCB->osAccountInfos);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", createOAForDomainCB->errCode);
|
||||
@ -680,12 +675,12 @@ void CreateOAForDomainExecuteCB(napi_env env, void *data)
|
||||
void CreateOACallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
CreateOAAsyncContext *createOACB = (CreateOAAsyncContext *)data;
|
||||
CreateOAAsyncContext *createOACB = reinterpret_cast<CreateOAAsyncContext *>(data);
|
||||
napi_value createResult[RESULT_COUNT] = {0};
|
||||
createResult[PARAM0] = GetErrorCodeValue(env, createOACB->errCode);
|
||||
napi_create_object(env, &createResult[PARAM1]);
|
||||
GetOACBInfoToJs(env, createOACB->osAccountInfos, createResult[PARAM1]);
|
||||
CBOrPromiseToCreateOA(env, createOACB, createResult[PARAM0], createResult[PARAM1]);
|
||||
createResult[PARAMZERO] = GetErrorCodeValue(env, createOACB->errCode);
|
||||
napi_create_object(env, &createResult[PARAMONE]);
|
||||
GetOACBInfoToJs(env, createOACB->osAccountInfos, createResult[PARAMONE]);
|
||||
CBOrPromiseToCreateOA(env, createOACB, createResult[PARAMZERO], createResult[PARAMONE]);
|
||||
napi_delete_async_work(env, createOACB->work);
|
||||
delete createOACB;
|
||||
createOACB = nullptr;
|
||||
@ -694,12 +689,12 @@ void CreateOACallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
void CreateOAForDomainCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
CreateOAForDomainAsyncContext *createOAForDomainCB = (CreateOAForDomainAsyncContext *)data;
|
||||
CreateOAForDomainAsyncContext *createOAForDomainCB = reinterpret_cast<CreateOAForDomainAsyncContext *>(data);
|
||||
napi_value createResult[RESULT_COUNT] = {0};
|
||||
createResult[PARAM0] = GetErrorCodeValue(env, createOAForDomainCB->errCode);
|
||||
napi_create_object(env, &createResult[PARAM1]);
|
||||
GetOACBInfoToJs(env, createOAForDomainCB->osAccountInfos, createResult[PARAM1]);
|
||||
CBOrPromiseToCreateOAForDomain(env, createOAForDomainCB, createResult[PARAM0], createResult[PARAM1]);
|
||||
createResult[PARAMZERO] = GetErrorCodeValue(env, createOAForDomainCB->errCode);
|
||||
napi_create_object(env, &createResult[PARAMONE]);
|
||||
GetOACBInfoToJs(env, createOAForDomainCB->osAccountInfos, createResult[PARAMONE]);
|
||||
CBOrPromiseToCreateOAForDomain(env, createOAForDomainCB, createResult[PARAMZERO], createResult[PARAMONE]);
|
||||
napi_delete_async_work(env, createOAForDomainCB->work);
|
||||
delete createOAForDomainCB;
|
||||
createOAForDomainCB = nullptr;
|
||||
@ -771,7 +766,7 @@ void ParseParaGetOACount(napi_env env, napi_callback_info cbInfo, GetOACountAsyn
|
||||
void GetOACountExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetOACountAsyncContext *getOACount = (GetOACountAsyncContext *)data;
|
||||
GetOACountAsyncContext *getOACount = reinterpret_cast<GetOACountAsyncContext *>(data);
|
||||
getOACount->errCode = OsAccountManager::GetCreatedOsAccountsCount(getOACount->osAccountsCount);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", getOACount->errCode);
|
||||
getOACount->status = (getOACount->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -780,11 +775,11 @@ void GetOACountExecuteCB(napi_env env, void *data)
|
||||
void GetOACountCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetOACountAsyncContext *getOACount = (GetOACountAsyncContext *)data;
|
||||
GetOACountAsyncContext *getOACount = reinterpret_cast<GetOACountAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAM0] = GetErrorCodeValue(env, getOACount->errCode);
|
||||
napi_create_uint32(env, getOACount->osAccountsCount, &getResult[PARAM1]);
|
||||
CBOrPromiseToGetOACount(env, getOACount, getResult[PARAM0], getResult[PARAM1]);
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, getOACount->errCode);
|
||||
napi_create_uint32(env, getOACount->osAccountsCount, &getResult[PARAMONE]);
|
||||
CBOrPromiseToGetOACount(env, getOACount, getResult[PARAMZERO], getResult[PARAMONE]);
|
||||
napi_delete_async_work(env, getOACount->work);
|
||||
delete getOACount;
|
||||
getOACount = nullptr;
|
||||
@ -832,7 +827,7 @@ void ParseParaDbDeviceId(napi_env env, napi_callback_info cbInfo, DbDeviceIdAsyn
|
||||
void DbDeviceIdExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
DbDeviceIdAsyncContext *dbDeviceId = (DbDeviceIdAsyncContext *)data;
|
||||
DbDeviceIdAsyncContext *dbDeviceId = reinterpret_cast<DbDeviceIdAsyncContext *>(data);
|
||||
dbDeviceId->errCode = OsAccountManager::GetDistributedVirtualDeviceId(dbDeviceId->deviceId);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", dbDeviceId->errCode);
|
||||
dbDeviceId->status = (dbDeviceId->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -841,11 +836,11 @@ void DbDeviceIdExecuteCB(napi_env env, void *data)
|
||||
void DbDeviceIdCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
DbDeviceIdAsyncContext *dbDeviceId = (DbDeviceIdAsyncContext *)data;
|
||||
DbDeviceIdAsyncContext *dbDeviceId = reinterpret_cast<DbDeviceIdAsyncContext *>(data);
|
||||
napi_value dbIdResult[RESULT_COUNT] = {0};
|
||||
dbIdResult[PARAM0] = GetErrorCodeValue(env, dbDeviceId->errCode);
|
||||
napi_create_string_utf8(env, dbDeviceId->deviceId.c_str(), NAPI_AUTO_LENGTH, &dbIdResult[PARAM1]);
|
||||
CBOrPromiseToDbDeviceId(env, dbDeviceId, dbIdResult[PARAM0], dbIdResult[PARAM1]);
|
||||
dbIdResult[PARAMZERO] = GetErrorCodeValue(env, dbDeviceId->errCode);
|
||||
napi_create_string_utf8(env, dbDeviceId->deviceId.c_str(), NAPI_AUTO_LENGTH, &dbIdResult[PARAMONE]);
|
||||
CBOrPromiseToDbDeviceId(env, dbDeviceId, dbIdResult[PARAMZERO], dbIdResult[PARAMONE]);
|
||||
napi_delete_async_work(env, dbDeviceId->work);
|
||||
delete dbDeviceId;
|
||||
dbDeviceId = nullptr;
|
||||
@ -900,7 +895,7 @@ napi_value ParseParaGetAllCons(napi_env env, napi_callback_info cbInfo, GetAllCo
|
||||
void GetAllConsExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetAllConsAsyncContext *getAllConsCB = (GetAllConsAsyncContext *)data;
|
||||
GetAllConsAsyncContext *getAllConsCB = reinterpret_cast<GetAllConsAsyncContext *>(data);
|
||||
getAllConsCB->errCode = OsAccountManager::GetOsAccountAllConstraints(getAllConsCB->id, getAllConsCB->constraints);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", getAllConsCB->errCode);
|
||||
getAllConsCB->status = (getAllConsCB->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -909,12 +904,12 @@ void GetAllConsExecuteCB(napi_env env, void *data)
|
||||
void GetAllConsCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetAllConsAsyncContext *getAllConsCB = (GetAllConsAsyncContext *)data;
|
||||
GetAllConsAsyncContext *getAllConsCB = reinterpret_cast<GetAllConsAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAM0] = GetErrorCodeValue(env, getAllConsCB->errCode);
|
||||
napi_create_array(env, &getResult[PARAM1]);
|
||||
GetAllAccountCons(env, getAllConsCB->constraints, getResult[PARAM1]);
|
||||
CBOrPromiseToGetAllCons(env, getAllConsCB, getResult[PARAM0], getResult[PARAM1]);
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, getAllConsCB->errCode);
|
||||
napi_create_array(env, &getResult[PARAMONE]);
|
||||
GetAllAccountCons(env, getAllConsCB->constraints, getResult[PARAMONE]);
|
||||
CBOrPromiseToGetAllCons(env, getAllConsCB, getResult[PARAMZERO], getResult[PARAMONE]);
|
||||
napi_delete_async_work(env, getAllConsCB->work);
|
||||
delete getAllConsCB;
|
||||
getAllConsCB = nullptr;
|
||||
@ -990,7 +985,7 @@ void ParseParaProcessId(napi_env env, napi_callback_info cbInfo, GetIdAsyncConte
|
||||
void GetProcessIdExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetIdAsyncContext *getIdCB = (GetIdAsyncContext *)data;
|
||||
GetIdAsyncContext *getIdCB = reinterpret_cast<GetIdAsyncContext *>(data);
|
||||
getIdCB->errCode = OsAccountManager::GetOsAccountLocalIdFromProcess(getIdCB->id);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", getIdCB->errCode);
|
||||
getIdCB->status = (getIdCB->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -999,11 +994,11 @@ void GetProcessIdExecuteCB(napi_env env, void *data)
|
||||
void GetProcessIdCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetIdAsyncContext *getIdCB = (GetIdAsyncContext *)data;
|
||||
GetIdAsyncContext *getIdCB = reinterpret_cast<GetIdAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAM0] = GetErrorCodeValue(env, getIdCB->errCode);
|
||||
napi_create_int32(env, getIdCB->id, &getResult[PARAM1]);
|
||||
CBOrPromiseToGetProcessId(env, getIdCB, getResult[PARAM0], getResult[PARAM1]);
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, getIdCB->errCode);
|
||||
napi_create_int32(env, getIdCB->id, &getResult[PARAMONE]);
|
||||
CBOrPromiseToGetProcessId(env, getIdCB, getResult[PARAMZERO], getResult[PARAMONE]);
|
||||
napi_delete_async_work(env, getIdCB->work);
|
||||
delete getIdCB;
|
||||
getIdCB = nullptr;
|
||||
@ -1065,7 +1060,7 @@ void ParseQueryActiveIds(napi_env env, napi_callback_info cbInfo, QueryActiveIds
|
||||
void QueryCreateOAExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
QueryCreateOAAsyncContext *queryAllOA = (QueryCreateOAAsyncContext *)data;
|
||||
QueryCreateOAAsyncContext *queryAllOA = reinterpret_cast<QueryCreateOAAsyncContext *>(data);
|
||||
queryAllOA->errCode = OsAccountManager::QueryAllCreatedOsAccounts(queryAllOA->osAccountInfos);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", queryAllOA->errCode);
|
||||
queryAllOA->status = (queryAllOA->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1074,7 +1069,7 @@ void QueryCreateOAExecuteCB(napi_env env, void *data)
|
||||
void QueryActiveIdsExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
QueryActiveIdsAsyncContext *queryActiveIds = (QueryActiveIdsAsyncContext *)data;
|
||||
QueryActiveIdsAsyncContext *queryActiveIds = reinterpret_cast<QueryActiveIdsAsyncContext *>(data);
|
||||
queryActiveIds->errCode = OsAccountManager::QueryActiveOsAccountIds(queryActiveIds->osAccountIds);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", queryActiveIds->errCode);
|
||||
queryActiveIds->status = (queryActiveIds->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1083,12 +1078,12 @@ void QueryActiveIdsExecuteCB(napi_env env, void *data)
|
||||
void QueryCreateOACallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
QueryCreateOAAsyncContext *queryAllOA = (QueryCreateOAAsyncContext *)data;
|
||||
QueryCreateOAAsyncContext *queryAllOA = reinterpret_cast<QueryCreateOAAsyncContext *>(data);
|
||||
napi_value queryResult[RESULT_COUNT] = {0};
|
||||
queryResult[PARAM0] = GetErrorCodeValue(env, queryAllOA->errCode);
|
||||
napi_create_array(env, &queryResult[PARAM1]);
|
||||
QueryOAInfoForResult(env, queryAllOA->osAccountInfos, queryResult[PARAM1]);
|
||||
CBOrPromiseToQueryOA(env, queryAllOA, queryResult[PARAM0], queryResult[PARAM1]);
|
||||
queryResult[PARAMZERO] = GetErrorCodeValue(env, queryAllOA->errCode);
|
||||
napi_create_array(env, &queryResult[PARAMONE]);
|
||||
QueryOAInfoForResult(env, queryAllOA->osAccountInfos, queryResult[PARAMONE]);
|
||||
CBOrPromiseToQueryOA(env, queryAllOA, queryResult[PARAMZERO], queryResult[PARAMONE]);
|
||||
napi_delete_async_work(env, queryAllOA->work);
|
||||
delete queryAllOA;
|
||||
queryAllOA = nullptr;
|
||||
@ -1097,12 +1092,12 @@ void QueryCreateOACallbackCompletedCB(napi_env env, napi_status status, void *da
|
||||
void QueryActiveIdsCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
QueryActiveIdsAsyncContext *queryActiveIds = (QueryActiveIdsAsyncContext *)data;
|
||||
QueryActiveIdsAsyncContext *queryActiveIds = reinterpret_cast<QueryActiveIdsAsyncContext *>(data);
|
||||
napi_value queryResult[RESULT_COUNT] = {0};
|
||||
queryResult[PARAM0] = GetErrorCodeValue(env, queryActiveIds->errCode);
|
||||
napi_create_array(env, &queryResult[PARAM1]);
|
||||
GetActiveIds(env, queryActiveIds->osAccountIds, queryResult[PARAM1]);
|
||||
CBOrPromiseToQueryActiveIds(env, queryActiveIds, queryResult[PARAM0], queryResult[PARAM1]);
|
||||
queryResult[PARAMZERO] = GetErrorCodeValue(env, queryActiveIds->errCode);
|
||||
napi_create_array(env, &queryResult[PARAMONE]);
|
||||
GetActiveIds(env, queryActiveIds->osAccountIds, queryResult[PARAMONE]);
|
||||
CBOrPromiseToQueryActiveIds(env, queryActiveIds, queryResult[PARAMZERO], queryResult[PARAMONE]);
|
||||
napi_delete_async_work(env, queryActiveIds->work);
|
||||
delete queryActiveIds;
|
||||
queryActiveIds = nullptr;
|
||||
@ -1196,7 +1191,7 @@ napi_value ParseParaGetPhote(napi_env env, napi_callback_info cbInfo, GetOAPhoto
|
||||
void GetOAPhoteExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetOAPhotoAsyncContext *getPhoto = (GetOAPhotoAsyncContext *)data;
|
||||
GetOAPhotoAsyncContext *getPhoto = reinterpret_cast<GetOAPhotoAsyncContext *>(data);
|
||||
getPhoto->errCode = OsAccountManager::GetOsAccountProfilePhoto(getPhoto->id, getPhoto->photo);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", getPhoto->errCode);
|
||||
getPhoto->status = (getPhoto->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1205,11 +1200,11 @@ void GetOAPhoteExecuteCB(napi_env env, void *data)
|
||||
void GetOAPhoteCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetOAPhotoAsyncContext *getPhoto = (GetOAPhotoAsyncContext *)data;
|
||||
GetOAPhotoAsyncContext *getPhoto = reinterpret_cast<GetOAPhotoAsyncContext *>(data);
|
||||
napi_value getResult[RESULT_COUNT] = {0};
|
||||
getResult[PARAM0] = GetErrorCodeValue(env, getPhoto->errCode);
|
||||
napi_create_string_utf8(env, getPhoto->photo.c_str(), NAPI_AUTO_LENGTH, &getResult[PARAM1]);
|
||||
CBOrPromiseToGetPhoto(env, getPhoto, getResult[PARAM0], getResult[PARAM1]);
|
||||
getResult[PARAMZERO] = GetErrorCodeValue(env, getPhoto->errCode);
|
||||
napi_create_string_utf8(env, getPhoto->photo.c_str(), NAPI_AUTO_LENGTH, &getResult[PARAMONE]);
|
||||
CBOrPromiseToGetPhoto(env, getPhoto, getResult[PARAMZERO], getResult[PARAMONE]);
|
||||
napi_delete_async_work(env, getPhoto->work);
|
||||
delete getPhoto;
|
||||
getPhoto = nullptr;
|
||||
@ -1257,7 +1252,7 @@ void ParseParaCurrentOA(napi_env env, napi_callback_info cbInfo, CurrentOAAsyncC
|
||||
void QueryCurrentOAExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
CurrentOAAsyncContext *currentOA = (CurrentOAAsyncContext *)data;
|
||||
CurrentOAAsyncContext *currentOA = reinterpret_cast<CurrentOAAsyncContext *>(data);
|
||||
currentOA->errCode = OsAccountManager::QueryCurrentOsAccount(currentOA->osAccountInfos);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", currentOA->errCode);
|
||||
currentOA->status = (currentOA->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1266,12 +1261,12 @@ void QueryCurrentOAExecuteCB(napi_env env, void *data)
|
||||
void QueryCurrentOACallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
CurrentOAAsyncContext *currentOA = (CurrentOAAsyncContext *)data;
|
||||
CurrentOAAsyncContext *currentOA = reinterpret_cast<CurrentOAAsyncContext *>(data);
|
||||
napi_value queryResult[RESULT_COUNT] = {0};
|
||||
queryResult[PARAM0] = GetErrorCodeValue(env, currentOA->errCode);
|
||||
napi_create_object(env, &queryResult[PARAM1]);
|
||||
GetOACBInfoToJs(env, currentOA->osAccountInfos, queryResult[PARAM1]);
|
||||
CBOrPromiseQueryCurrentOA(env, currentOA, queryResult[PARAM0], queryResult[PARAM1]);
|
||||
queryResult[PARAMZERO] = GetErrorCodeValue(env, currentOA->errCode);
|
||||
napi_create_object(env, &queryResult[PARAMONE]);
|
||||
GetOACBInfoToJs(env, currentOA->osAccountInfos, queryResult[PARAMONE]);
|
||||
CBOrPromiseQueryCurrentOA(env, currentOA, queryResult[PARAMZERO], queryResult[PARAMONE]);
|
||||
napi_delete_async_work(env, currentOA->work);
|
||||
delete currentOA;
|
||||
currentOA = nullptr;
|
||||
@ -1355,7 +1350,7 @@ napi_value ParseParaGetIdByDomain(napi_env env, napi_callback_info cbInfo, GetId
|
||||
void GetIdByUidExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetIdByUidAsyncContext *idByUid = (GetIdByUidAsyncContext *)data;
|
||||
GetIdByUidAsyncContext *idByUid = reinterpret_cast<GetIdByUidAsyncContext *>(data);
|
||||
idByUid->errCode = OsAccountManager::GetOsAccountLocalIdFromUid(idByUid->uid, idByUid->id);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", idByUid->errCode);
|
||||
idByUid->status = (idByUid->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1364,7 +1359,7 @@ void GetIdByUidExecuteCB(napi_env env, void *data)
|
||||
void GetIdByDomainExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetIdByDomainAsyncContext *idByDomain = (GetIdByDomainAsyncContext *)data;
|
||||
GetIdByDomainAsyncContext *idByDomain = reinterpret_cast<GetIdByDomainAsyncContext *>(data);
|
||||
idByDomain->errCode = OsAccountManager::GetOsAccountLocalIdFromDomain(
|
||||
idByDomain->domainInfo, idByDomain->id);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", idByDomain->errCode);
|
||||
@ -1374,11 +1369,11 @@ void GetIdByDomainExecuteCB(napi_env env, void *data)
|
||||
void GetIdByUidCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetIdByUidAsyncContext *idByUid = (GetIdByUidAsyncContext *)data;
|
||||
GetIdByUidAsyncContext *idByUid = reinterpret_cast<GetIdByUidAsyncContext *>(data);
|
||||
napi_value uidResult[RESULT_COUNT] = {0};
|
||||
uidResult[PARAM0] = GetErrorCodeValue(env, idByUid->errCode);
|
||||
napi_create_int32(env, idByUid->id, &uidResult[PARAM1]);
|
||||
CBOrPromiseGetIdByUid(env, idByUid, uidResult[PARAM0], uidResult[PARAM1]);
|
||||
uidResult[PARAMZERO] = GetErrorCodeValue(env, idByUid->errCode);
|
||||
napi_create_int32(env, idByUid->id, &uidResult[PARAMONE]);
|
||||
CBOrPromiseGetIdByUid(env, idByUid, uidResult[PARAMZERO], uidResult[PARAMONE]);
|
||||
napi_delete_async_work(env, idByUid->work);
|
||||
delete idByUid;
|
||||
idByUid = nullptr;
|
||||
@ -1387,11 +1382,11 @@ void GetIdByUidCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
void GetIdByDomainCallbackCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetIdByDomainAsyncContext *idByDomain = (GetIdByDomainAsyncContext *)data;
|
||||
GetIdByDomainAsyncContext *idByDomain = reinterpret_cast<GetIdByDomainAsyncContext *>(data);
|
||||
napi_value uidResult[RESULT_COUNT] = {0};
|
||||
uidResult[PARAM0] = GetErrorCodeValue(env, idByDomain->errCode);
|
||||
napi_create_int32(env, idByDomain->id, &uidResult[PARAM1]);
|
||||
CBOrPromiseGetIdByDomain(env, idByDomain, uidResult[PARAM0], uidResult[PARAM1]);
|
||||
uidResult[PARAMZERO] = GetErrorCodeValue(env, idByDomain->errCode);
|
||||
napi_create_int32(env, idByDomain->id, &uidResult[PARAMONE]);
|
||||
CBOrPromiseGetIdByDomain(env, idByDomain, uidResult[PARAMZERO], uidResult[PARAMONE]);
|
||||
napi_delete_async_work(env, idByDomain->work);
|
||||
delete idByDomain;
|
||||
idByDomain = nullptr;
|
||||
@ -1472,7 +1467,7 @@ napi_value ParseParaSetPhoto(napi_env env, napi_callback_info cbInfo, SetOAPhoto
|
||||
void SetPhotoExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
SetOAPhotoAsyncContext *setPhoto = (SetOAPhotoAsyncContext *)data;
|
||||
SetOAPhotoAsyncContext *setPhoto = reinterpret_cast<SetOAPhotoAsyncContext *>(data);
|
||||
setPhoto->errCode = OsAccountManager::SetOsAccountProfilePhoto(setPhoto->id, setPhoto->photo);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", setPhoto->errCode);
|
||||
setPhoto->status = (setPhoto->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1481,11 +1476,11 @@ void SetPhotoExecuteCB(napi_env env, void *data)
|
||||
void SetPhotoCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
SetOAPhotoAsyncContext *setPhoto = (SetOAPhotoAsyncContext *)data;
|
||||
SetOAPhotoAsyncContext *setPhoto = reinterpret_cast<SetOAPhotoAsyncContext *>(data);
|
||||
napi_value setResult[RESULT_COUNT] = {0};
|
||||
setResult[PARAM0] = GetErrorCodeValue(env, setPhoto->errCode);
|
||||
napi_get_undefined(env, &setResult[PARAM1]);
|
||||
CBOrPromiseSetPhoto(env, setPhoto, setResult[PARAM0], setResult[PARAM1]);
|
||||
setResult[PARAMZERO] = GetErrorCodeValue(env, setPhoto->errCode);
|
||||
napi_get_undefined(env, &setResult[PARAMONE]);
|
||||
CBOrPromiseSetPhoto(env, setPhoto, setResult[PARAMZERO], setResult[PARAMONE]);
|
||||
napi_delete_async_work(env, setPhoto->work);
|
||||
delete setPhoto;
|
||||
setPhoto = nullptr;
|
||||
@ -1533,7 +1528,7 @@ void ParseParaQueryMaxNum(napi_env env, napi_callback_info cbInfo, QueryMaxNumAs
|
||||
void QueryMaxNumExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
QueryMaxNumAsyncContext *maxNum = (QueryMaxNumAsyncContext *)data;
|
||||
QueryMaxNumAsyncContext *maxNum = reinterpret_cast<QueryMaxNumAsyncContext *>(data);
|
||||
maxNum->errCode = OsAccountManager::QueryMaxOsAccountNumber(maxNum->maxOsAccountNumber);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", maxNum->errCode);
|
||||
maxNum->status = (maxNum->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1542,11 +1537,11 @@ void QueryMaxNumExecuteCB(napi_env env, void *data)
|
||||
void QueryMaxNumCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
QueryMaxNumAsyncContext *maxNum = (QueryMaxNumAsyncContext *)data;
|
||||
QueryMaxNumAsyncContext *maxNum = reinterpret_cast<QueryMaxNumAsyncContext *>(data);
|
||||
napi_value queryResult[RESULT_COUNT] = {0};
|
||||
queryResult[PARAM0] = GetErrorCodeValue(env, maxNum->errCode);
|
||||
napi_create_int32(env, maxNum->maxOsAccountNumber, &queryResult[PARAM1]);
|
||||
CBOrPromiseMaxNum(env, maxNum, queryResult[PARAM0], queryResult[PARAM1]);
|
||||
queryResult[PARAMZERO] = GetErrorCodeValue(env, maxNum->errCode);
|
||||
napi_create_int32(env, maxNum->maxOsAccountNumber, &queryResult[PARAMONE]);
|
||||
CBOrPromiseMaxNum(env, maxNum, queryResult[PARAMZERO], queryResult[PARAMONE]);
|
||||
napi_delete_async_work(env, maxNum->work);
|
||||
delete maxNum;
|
||||
maxNum = nullptr;
|
||||
@ -1601,7 +1596,7 @@ napi_value ParseParaIsActived(napi_env env, napi_callback_info cbInfo, IsActived
|
||||
void IsActivedExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
IsActivedAsyncContext *isActived = (IsActivedAsyncContext *)data;
|
||||
IsActivedAsyncContext *isActived = reinterpret_cast<IsActivedAsyncContext *>(data);
|
||||
isActived->errCode = OsAccountManager::IsOsAccountActived(isActived->id, isActived->isOsAccountActived);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", isActived->errCode);
|
||||
isActived->status = (isActived->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1610,11 +1605,11 @@ void IsActivedExecuteCB(napi_env env, void *data)
|
||||
void IsActivedCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
IsActivedAsyncContext *isActived = (IsActivedAsyncContext *)data;
|
||||
IsActivedAsyncContext *isActived = reinterpret_cast<IsActivedAsyncContext *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
result[PARAM0] = GetErrorCodeValue(env, isActived->errCode);
|
||||
napi_get_boolean(env, isActived->isOsAccountActived, &result[PARAM1]);
|
||||
CBOrPromiseIsActived(env, isActived, result[PARAM0], result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, isActived->errCode);
|
||||
napi_get_boolean(env, isActived->isOsAccountActived, &result[PARAMONE]);
|
||||
CBOrPromiseIsActived(env, isActived, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, isActived->work);
|
||||
delete isActived;
|
||||
isActived = nullptr;
|
||||
@ -1671,7 +1666,7 @@ napi_value ParseParaIsEnable(napi_env env, napi_callback_info cbInfo, IsConEnabl
|
||||
void IsEnableExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
IsConEnableAsyncContext *isEnable = (IsConEnableAsyncContext *)data;
|
||||
IsConEnableAsyncContext *isEnable = reinterpret_cast<IsConEnableAsyncContext *>(data);
|
||||
isEnable->errCode =
|
||||
OsAccountManager::IsOsAccountConstraintEnable(isEnable->id, isEnable->constraint, isEnable->isConsEnable);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", isEnable->errCode);
|
||||
@ -1681,11 +1676,11 @@ void IsEnableExecuteCB(napi_env env, void *data)
|
||||
void IsEnableCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
IsConEnableAsyncContext *isEnable = (IsConEnableAsyncContext *)data;
|
||||
IsConEnableAsyncContext *isEnable = reinterpret_cast<IsConEnableAsyncContext *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
result[PARAM0] = GetErrorCodeValue(env, isEnable->errCode);
|
||||
napi_get_boolean(env, isEnable->isConsEnable, &result[PARAM1]);
|
||||
CBOrPromiseIsEnable(env, isEnable, result[PARAM0], result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, isEnable->errCode);
|
||||
napi_get_boolean(env, isEnable->isConsEnable, &result[PARAMONE]);
|
||||
CBOrPromiseIsEnable(env, isEnable, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, isEnable->work);
|
||||
delete isEnable;
|
||||
isEnable = nullptr;
|
||||
@ -1733,7 +1728,7 @@ void ParseParaGetType(napi_env env, napi_callback_info cbInfo, GetTypeAsyncConte
|
||||
void GetTypeExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetTypeAsyncContext *getType = (GetTypeAsyncContext *)data;
|
||||
GetTypeAsyncContext *getType = reinterpret_cast<GetTypeAsyncContext *>(data);
|
||||
getType->errCode = OsAccountManager::GetOsAccountTypeFromProcess(getType->type);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", getType->errCode);
|
||||
getType->status = (getType->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1742,29 +1737,29 @@ void GetTypeExecuteCB(napi_env env, void *data)
|
||||
void GetTypeCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetTypeAsyncContext *getType = (GetTypeAsyncContext *)data;
|
||||
GetTypeAsyncContext *getType = reinterpret_cast<GetTypeAsyncContext *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
napi_value jsType = nullptr;
|
||||
int cType = static_cast<int>(getType->type);
|
||||
result[PARAM0] = GetErrorCodeValue(env, getType->errCode);
|
||||
napi_create_object(env, &result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, getType->errCode);
|
||||
napi_create_object(env, &result[PARAMONE]);
|
||||
napi_create_int32(env, cType, &jsType);
|
||||
|
||||
switch (cType) {
|
||||
case PARAMZERO:
|
||||
napi_set_named_property(env, result[PARAM1], "ADMIN", jsType);
|
||||
napi_set_named_property(env, result[PARAMONE], "ADMIN", jsType);
|
||||
break;
|
||||
case PARAMONE:
|
||||
napi_set_named_property(env, result[PARAM1], "NORMAL", jsType);
|
||||
napi_set_named_property(env, result[PARAMONE], "NORMAL", jsType);
|
||||
break;
|
||||
case PARAMTWO:
|
||||
napi_set_named_property(env, result[PARAM1], "GUEST", jsType);
|
||||
napi_set_named_property(env, result[PARAMONE], "GUEST", jsType);
|
||||
break;
|
||||
default:
|
||||
ACCOUNT_LOGI("cType %{public}d is an invalid value", cType);
|
||||
break;
|
||||
}
|
||||
CBOrPromiseGetType(env, getType, result[PARAM0], result[PARAM1]);
|
||||
CBOrPromiseGetType(env, getType, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, getType->work);
|
||||
delete getType;
|
||||
getType = nullptr;
|
||||
@ -1812,7 +1807,7 @@ void ParseParaIsMultiEn(napi_env env, napi_callback_info cbInfo, IsMultiEnAsyncC
|
||||
void IsMultiEnExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
IsMultiEnAsyncContext *multiEn = (IsMultiEnAsyncContext *)data;
|
||||
IsMultiEnAsyncContext *multiEn = reinterpret_cast<IsMultiEnAsyncContext *>(data);
|
||||
multiEn->errCode = OsAccountManager::IsMultiOsAccountEnable(multiEn->isMultiOAEnable);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", multiEn->errCode);
|
||||
multiEn->status = (multiEn->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1821,11 +1816,11 @@ void IsMultiEnExecuteCB(napi_env env, void *data)
|
||||
void IsMultiEnCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
IsMultiEnAsyncContext *multiEn = (IsMultiEnAsyncContext *)data;
|
||||
IsMultiEnAsyncContext *multiEn = reinterpret_cast<IsMultiEnAsyncContext *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
result[PARAM0] = GetErrorCodeValue(env, multiEn->errCode);
|
||||
napi_get_boolean(env, multiEn->isMultiOAEnable, &result[PARAM1]);
|
||||
CBOrPromiseIsMultiEn(env, multiEn, result[PARAM0], result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, multiEn->errCode);
|
||||
napi_get_boolean(env, multiEn->isMultiOAEnable, &result[PARAMONE]);
|
||||
CBOrPromiseIsMultiEn(env, multiEn, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, multiEn->work);
|
||||
delete multiEn;
|
||||
multiEn = nullptr;
|
||||
@ -1883,7 +1878,7 @@ napi_value ParseParaIsVerified(napi_env env, napi_callback_info cbInfo, IsVerifi
|
||||
void IsVerifiedExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
IsVerifiedAsyncContext *isVerified = (IsVerifiedAsyncContext *)data;
|
||||
IsVerifiedAsyncContext *isVerified = reinterpret_cast<IsVerifiedAsyncContext *>(data);
|
||||
isVerified->errCode = OsAccountManager::IsOsAccountVerified(isVerified->id, isVerified->isTestOA);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", isVerified->errCode);
|
||||
isVerified->status = (isVerified->errCode == 0) ? napi_ok : napi_generic_failure;
|
||||
@ -1892,11 +1887,11 @@ void IsVerifiedExecuteCB(napi_env env, void *data)
|
||||
void IsVerifiedCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
IsVerifiedAsyncContext *isVerified = (IsVerifiedAsyncContext *)data;
|
||||
IsVerifiedAsyncContext *isVerified = reinterpret_cast<IsVerifiedAsyncContext *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
result[PARAM0] = GetErrorCodeValue(env, isVerified->errCode);
|
||||
napi_get_boolean(env, isVerified->isTestOA, &result[PARAM1]);
|
||||
CBOrPromiseIsVerified(env, isVerified, result[PARAM0], result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, isVerified->errCode);
|
||||
napi_get_boolean(env, isVerified->isTestOA, &result[PARAMONE]);
|
||||
CBOrPromiseIsVerified(env, isVerified, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, isVerified->work);
|
||||
delete isVerified;
|
||||
isVerified = nullptr;
|
||||
@ -1951,7 +1946,7 @@ napi_value ParseParaSerialNumId(napi_env env, napi_callback_info cbInfo, GetSeri
|
||||
void SerialNumIdExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetSerialNumIdCBInfo *serialNumId = (GetSerialNumIdCBInfo *)data;
|
||||
GetSerialNumIdCBInfo *serialNumId = reinterpret_cast<GetSerialNumIdCBInfo *>(data);
|
||||
serialNumId->errCode =
|
||||
OsAccountManager::GetOsAccountLocalIdBySerialNumber(serialNumId->serialNumber, serialNumId->id);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", serialNumId->errCode);
|
||||
@ -1961,11 +1956,11 @@ void SerialNumIdExecuteCB(napi_env env, void *data)
|
||||
void SerialNumIdCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetSerialNumIdCBInfo *serialNumId = (GetSerialNumIdCBInfo *)data;
|
||||
GetSerialNumIdCBInfo *serialNumId = reinterpret_cast<GetSerialNumIdCBInfo *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
result[PARAM0] = GetErrorCodeValue(env, serialNumId->errCode);
|
||||
napi_create_int32(env, serialNumId->id, &result[PARAM1]);
|
||||
CBOrPromiseSerialNum(env, serialNumId, result[PARAM0], result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, serialNumId->errCode);
|
||||
napi_create_int32(env, serialNumId->id, &result[PARAMONE]);
|
||||
CBOrPromiseSerialNum(env, serialNumId, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, serialNumId->work);
|
||||
delete serialNumId;
|
||||
serialNumId = nullptr;
|
||||
@ -2020,7 +2015,7 @@ napi_value ParseParaGetSerialNum(napi_env env, napi_callback_info cbInfo, GetSer
|
||||
void GetSerialNumExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
GetSerialNumForOAInfo *getSerialNum = (GetSerialNumForOAInfo *)data;
|
||||
GetSerialNumForOAInfo *getSerialNum = reinterpret_cast<GetSerialNumForOAInfo *>(data);
|
||||
getSerialNum->errCode =
|
||||
OsAccountManager::GetSerialNumberByOsAccountLocalId(getSerialNum->id, getSerialNum->serialNum);
|
||||
ACCOUNT_LOGI("errocde is %{public}d", getSerialNum->errCode);
|
||||
@ -2030,11 +2025,11 @@ void GetSerialNumExecuteCB(napi_env env, void *data)
|
||||
void GetSerialNumCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete");
|
||||
GetSerialNumForOAInfo *getSerialNum = (GetSerialNumForOAInfo *)data;
|
||||
GetSerialNumForOAInfo *getSerialNum = reinterpret_cast<GetSerialNumForOAInfo *>(data);
|
||||
napi_value result[RESULT_COUNT] = {0};
|
||||
result[PARAM0] = GetErrorCodeValue(env, getSerialNum->errCode);
|
||||
napi_create_int64(env, getSerialNum->serialNum, &result[PARAM1]);
|
||||
CBOrPromiseGetSerialNum(env, getSerialNum, result[PARAM0], result[PARAM1]);
|
||||
result[PARAMZERO] = GetErrorCodeValue(env, getSerialNum->errCode);
|
||||
napi_create_int64(env, getSerialNum->serialNum, &result[PARAMONE]);
|
||||
CBOrPromiseGetSerialNum(env, getSerialNum, result[PARAMZERO], result[PARAMONE]);
|
||||
napi_delete_async_work(env, getSerialNum->work);
|
||||
delete getSerialNum;
|
||||
getSerialNum = nullptr;
|
||||
@ -2153,7 +2148,7 @@ napi_value ParseParaToSubscriber(const napi_env &env, const napi_value (&argv)[A
|
||||
void SubscribeExecuteCB(napi_env env, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work running");
|
||||
SubscribeCBInfo *subscribeCBInfo = (SubscribeCBInfo *)data;
|
||||
SubscribeCBInfo *subscribeCBInfo = reinterpret_cast<SubscribeCBInfo *>(data);
|
||||
subscribeCBInfo->subscriber->SetEnv(env);
|
||||
subscribeCBInfo->subscriber->SetCallbackRef(subscribeCBInfo->callbackRef);
|
||||
int errCode = OsAccountManager::SubscribeOsAccount(subscribeCBInfo->subscriber);
|
||||
@ -2163,7 +2158,7 @@ void SubscribeExecuteCB(napi_env env, void *data)
|
||||
void SubscribeCompletedCB(napi_env env, napi_status status, void *data)
|
||||
{
|
||||
ACCOUNT_LOGI("napi_create_async_work complete.");
|
||||
SubscribeCBInfo *subscribeCBInfo = (SubscribeCBInfo *)data;
|
||||
SubscribeCBInfo *subscribeCBInfo = reinterpret_cast<SubscribeCBInfo *>(data);
|
||||
napi_delete_async_work(env, subscribeCBInfo->work);
|
||||
}
|
||||
|
||||
|
2
os_account.gni
Executable file → Normal file
2
os_account.gni
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
2
sa_profile/200.xml
Executable file → Normal file
2
sa_profile/200.xml
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
2
sa_profile/BUILD.gn
Executable file → Normal file
2
sa_profile/BUILD.gn
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
2
services/BUILD.gn
Executable file → Normal file
2
services/BUILD.gn
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
2
services/accountmgr/accountmgr.rc
Executable file → Normal file
2
services/accountmgr/accountmgr.rc
Executable file → Normal file
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_DATA_STORAGE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_DATA_STORAGE_H
|
||||
|
||||
|
11
services/accountmgr/include/account_dump_helper.h
Executable file → Normal file
11
services/accountmgr/include/account_dump_helper.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_SERVICES_INCLUDE_DUMP_HELPER_H
|
||||
#define BASE_ACCOUNT_SERVICES_INCLUDE_DUMP_HELPER_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_DUMP_HELPER_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_DUMP_HELPER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -40,6 +40,7 @@ private:
|
||||
bool SimulateInputEvent(const std::string &eventStr, std::string &result) const;
|
||||
bool SetLogLevel(const std::string& levelStr, std::string& result) const;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // BASE_ACCOUNT_SERVICES_INCLUDE_DUMP_HELPER_H
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_DUMP_HELPER_H
|
||||
|
10
services/accountmgr/include/account_event_provider.h
Executable file → Normal file
10
services/accountmgr/include/account_event_provider.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ACCOUNT_ACCOUNT_EVENT_PROVIDER_H
|
||||
#define ACCOUNT_ACCOUNT_EVENT_PROVIDER_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_EVENT_PROVIDER_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_EVENT_PROVIDER_H
|
||||
|
||||
#include <string>
|
||||
#include "account_error_no.h"
|
||||
@ -26,7 +26,7 @@ class AccountEventProvider {
|
||||
public:
|
||||
static bool EventPublish(const std::string& event);
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // ACCOUNT_ACCOUNT_EVENT_PROVIDER_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_EVENT_PROVIDER_H
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ACCOUNT_HELPER_DATA_H
|
||||
#define ACCOUNT_HELPER_DATA_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_HELPER_DATA_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_HELPER_DATA_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -27,6 +27,7 @@ public:
|
||||
static std::vector<std::string> GetBundleNameTrustList();
|
||||
static std::map<std::string, std::string> GetAccountEventMap();
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // ACCOUNT_HELPER_DATA_H
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_HELPER_DATA_H
|
||||
|
11
services/accountmgr/include/account_mgr_service.h
Executable file → Normal file
11
services/accountmgr/include/account_mgr_service.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_INCLUDE_ACCOUNT_SERVICE_H
|
||||
#define BASE_ACCOUNT_INCLUDE_ACCOUNT_SERVICE_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_MGR_SERVICE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_MGR_SERVICE_H
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@ -50,8 +50,8 @@ public:
|
||||
sptr<IRemoteObject> GetAppAccountService() override;
|
||||
sptr<IRemoteObject> GetOsAccountService() override;
|
||||
|
||||
virtual void OnStart() override;
|
||||
virtual void OnStop() override;
|
||||
void OnStart() override;
|
||||
void OnStop() override;
|
||||
bool IsServiceStarted(void) const override;
|
||||
static AccountMgrService &GetInstance()
|
||||
{
|
||||
@ -76,4 +76,5 @@ private:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // BASE_ACCOUNT_INCLUDE_ACCOUNT_SERVICE_H
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_MGR_SERVICE_H
|
||||
|
@ -26,7 +26,6 @@ public:
|
||||
AccountPermissionManager();
|
||||
~AccountPermissionManager();
|
||||
|
||||
bool IsSystemUid(const uid_t &uid) const;
|
||||
ErrCode VerifyPermission(const std::string &permissionName);
|
||||
|
||||
static const std::string DISTRIBUTED_DATASYNC;
|
||||
@ -34,10 +33,6 @@ public:
|
||||
static const std::string MANAGE_LOCAL_ACCOUNTS;
|
||||
static const std::string INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION;
|
||||
static const std::string INTERACT_ACROSS_LOCAL_ACCOUNTS;
|
||||
|
||||
private:
|
||||
static constexpr uid_t MIN_SYSTEM_UID = 2100;
|
||||
static constexpr uid_t MAX_SYSTEM_UID = 2899;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
6
services/accountmgr/include/account_proxy.h
Executable file → Normal file
6
services/accountmgr/include/account_proxy.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ACCOUNT_PROXY_H
|
||||
#define ACCOUNT_PROXY_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_PROXY_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_PROXY_H
|
||||
|
||||
#include "iaccount.h"
|
||||
#include "account_info.h"
|
||||
@ -43,4 +43,4 @@ private:
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // ACCOUNT_PROXY_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_PROXY_H
|
||||
|
37
services/accountmgr/include/account_state_action.h
Executable file → Normal file
37
services/accountmgr/include/account_state_action.h
Executable file → Normal file
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_INCLUDE_ACCOUNT_STATE_ACTION_H
|
||||
#define BASE_ACCOUNT_INCLUDE_ACCOUNT_STATE_ACTION_H
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STATE_ACTION_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STATE_ACTION_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
@ -54,4 +54,5 @@ private:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // BASE_ACCOUNT_INCLUDE_ACCOUNT_STATE_ACTION_H
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STATE_ACTION_H
|
||||
|
53
services/accountmgr/include/account_state_machine.h
Executable file → Normal file
53
services/accountmgr/include/account_state_machine.h
Executable file → Normal file
@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_INCLUDE_ACCOUNT_STATE_MACHINE_H
|
||||
#define BASE_ACCOUNT_INCLUDE_ACCOUNT_STATE_MACHINE_H
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STATE_MACHINE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STATE_MACHINE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
@ -113,17 +113,17 @@ public:
|
||||
* Account state machine Constructor.
|
||||
*/
|
||||
AccountStateMachine() : currentState_(ACCOUNT_STATE_UNBOUND)
|
||||
{
|
||||
OnInitialize();
|
||||
}
|
||||
{
|
||||
OnInitialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Account state machine Destructor.
|
||||
*/
|
||||
~AccountStateMachine()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Account state machine initialize.
|
||||
@ -170,6 +170,7 @@ private:
|
||||
int currentState_;
|
||||
std::map<int, std::map<int, AccountStateAction *>> stateMachineMap_;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // BASE_ACCOUNT_INCLUDE_ACCOUNT_STATE_MACHINE_H
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STATE_MACHINE_H
|
||||
|
6
services/accountmgr/include/account_stub.h
Executable file → Normal file
6
services/accountmgr/include/account_stub.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ACCOUNT_STUB_H
|
||||
#define ACCOUNT_STUB_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H
|
||||
|
||||
#include "iaccount.h"
|
||||
#include "iaccount_context.h"
|
||||
@ -48,4 +48,4 @@ private:
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // ACCOUNT_STUB_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H
|
||||
|
@ -27,10 +27,11 @@ class AppAccountAuthenticatorSession;
|
||||
class AppAccountAuthenticatorCallback : public AppAccountAuthenticatorCallbackStub {
|
||||
public:
|
||||
explicit AppAccountAuthenticatorCallback(AppAccountAuthenticatorSession *session);
|
||||
virtual ~AppAccountAuthenticatorCallback() override;
|
||||
~AppAccountAuthenticatorCallback() override;
|
||||
|
||||
void OnResult(int32_t resultCode, const AAFwk::Want &result) override;
|
||||
void OnRequestRedirected(AAFwk::Want &request) override;
|
||||
|
||||
virtual void OnResult(int32_t resultCode, const AAFwk::Want &result) override;
|
||||
virtual void OnRequestRedirected(AAFwk::Want &request) override;
|
||||
private:
|
||||
AppAccountAuthenticatorSession *session_;
|
||||
};
|
||||
|
@ -24,10 +24,10 @@ namespace AccountSA {
|
||||
class AppAccountAuthenticatorCallbackProxy : public IRemoteProxy<IAppAccountAuthenticatorCallback> {
|
||||
public:
|
||||
explicit AppAccountAuthenticatorCallbackProxy(const sptr<IRemoteObject> &object);
|
||||
virtual ~AppAccountAuthenticatorCallbackProxy() override;
|
||||
~AppAccountAuthenticatorCallbackProxy() override;
|
||||
|
||||
virtual void OnResult(int32_t resultCode, const AAFwk::Want &result) override;
|
||||
virtual void OnRequestRedirected(AAFwk::Want &request) override;
|
||||
void OnResult(int32_t resultCode, const AAFwk::Want &result) override;
|
||||
void OnRequestRedirected(AAFwk::Want &request) override;
|
||||
|
||||
private:
|
||||
ErrCode SendRequest(IAppAccountAuthenticatorCallback::Message code, MessageParcel &data, MessageParcel &reply);
|
||||
|
@ -24,8 +24,8 @@ namespace AccountSA {
|
||||
class AppAccountAuthenticatorCallbackStub : public IRemoteStub<IAppAccountAuthenticatorCallback> {
|
||||
public:
|
||||
AppAccountAuthenticatorCallbackStub();
|
||||
virtual ~AppAccountAuthenticatorCallbackStub() override;
|
||||
virtual int OnRemoteRequest(
|
||||
~AppAccountAuthenticatorCallbackStub() override;
|
||||
int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
|
@ -29,8 +29,10 @@ public:
|
||||
AppAccountAuthenticatorManager();
|
||||
virtual ~AppAccountAuthenticatorManager();
|
||||
ErrCode GetAuthenticatorInfo(const OAuthRequest &request, AuthenticatorInfo &info);
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
private:
|
||||
bool isInitialized_ = false;
|
||||
sptr<AppExecFwk::IBundleMgr> bundleMgr_ = nullptr;
|
||||
@ -38,4 +40,4 @@ private:
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATOR_MANAGER_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATOR_MANAGER_H
|
||||
|
@ -24,11 +24,11 @@ namespace AccountSA {
|
||||
class AppAccountAuthenticatorProxy : public IRemoteProxy<IAppAccountAuthenticator> {
|
||||
public:
|
||||
explicit AppAccountAuthenticatorProxy(const sptr<IRemoteObject> &object);
|
||||
virtual ~AppAccountAuthenticatorProxy() override;
|
||||
~AppAccountAuthenticatorProxy() override;
|
||||
|
||||
virtual ErrCode AddAccountImplicitly(const std::string &authType, const std::string &callerBundleName,
|
||||
ErrCode AddAccountImplicitly(const std::string &authType, const std::string &callerBundleName,
|
||||
const AAFwk::WantParams &options, const sptr<IRemoteObject> &callback) override;
|
||||
virtual ErrCode Authenticate(
|
||||
ErrCode Authenticate(
|
||||
const std::string &name, const std::string &authType, const std::string &callerBundleName,
|
||||
const AAFwk::WantParams &options, const sptr<IRemoteObject> &callback) override;
|
||||
|
||||
|
@ -30,42 +30,44 @@
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticatorSession;
|
||||
namespace {
|
||||
class ClientDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
|
||||
class SessionClientDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
ClientDeathRecipient(AppAccountAuthenticatorSession *session);
|
||||
virtual ~ClientDeathRecipient() = default;
|
||||
explicit SessionClientDeathRecipient(AppAccountAuthenticatorSession *session);
|
||||
virtual ~SessionClientDeathRecipient() = default;
|
||||
|
||||
virtual void OnRemoteDied(const wptr<IRemoteObject> &remote);
|
||||
void SetSession(AppAccountAuthenticatorSession *session);
|
||||
|
||||
private:
|
||||
AppAccountAuthenticatorSession *session_;
|
||||
};
|
||||
|
||||
class ServerDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
class SessionServerDeathRecipient : public IRemoteObject::DeathRecipient {
|
||||
public:
|
||||
ServerDeathRecipient(AppAccountAuthenticatorSession *session);
|
||||
virtual ~ServerDeathRecipient() = default;
|
||||
explicit SessionServerDeathRecipient(AppAccountAuthenticatorSession *session);
|
||||
virtual ~SessionServerDeathRecipient() = default;
|
||||
|
||||
virtual void OnRemoteDied(const wptr<IRemoteObject> &remote);
|
||||
void SetSession(AppAccountAuthenticatorSession *session);
|
||||
|
||||
private:
|
||||
AppAccountAuthenticatorSession *session_;
|
||||
};
|
||||
|
||||
class SessionConnection : public AAFwk::AbilityConnectionStub {
|
||||
public:
|
||||
SessionConnection(AppAccountAuthenticatorSession *session);
|
||||
explicit SessionConnection(AppAccountAuthenticatorSession *session);
|
||||
virtual ~SessionConnection();
|
||||
|
||||
void OnAbilityConnectDone(
|
||||
const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int32_t resultCode) override;
|
||||
void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) override;
|
||||
void SetSession(AppAccountAuthenticatorSession *session);
|
||||
|
||||
private:
|
||||
AppAccountAuthenticatorSession *session_;
|
||||
};
|
||||
}
|
||||
|
||||
class AppAccountAuthenticatorSession {
|
||||
public:
|
||||
@ -84,23 +86,26 @@ public:
|
||||
std::string GetSessionId() const;
|
||||
void GetRequest(OAuthRequest &request) const;
|
||||
ErrCode GetAuthenticatorCallback(const OAuthRequest &request, sptr<IRemoteObject> &callback) const;
|
||||
|
||||
private:
|
||||
sptr<AppExecFwk::IBundleMgr> GetBundleMgrProxy();
|
||||
int32_t UpdateAuthInfo(const AAFwk::Want &result) const;
|
||||
int32_t OnAuthenticateDone(const AAFwk::Want &result) const;
|
||||
int32_t OnAddAccountImplicitlyDone(const AAFwk::Want &result) const;
|
||||
|
||||
private:
|
||||
std::string action_;
|
||||
std::string sessionId_;
|
||||
OAuthRequest request_;
|
||||
sptr<SessionConnection> conn_ = nullptr;
|
||||
sptr<ClientDeathRecipient> clientDeathRecipient_ = nullptr;
|
||||
sptr<ServerDeathRecipient> serverDeathRecipient_ = nullptr;
|
||||
sptr<SessionClientDeathRecipient> clientDeathRecipient_ = nullptr;
|
||||
sptr<SessionServerDeathRecipient> serverDeathRecipient_ = nullptr;
|
||||
sptr<IAppAccountAuthenticatorCallback> authenticatorCb_ = nullptr;
|
||||
sptr<IAppAccountAuthenticator> authenticatorProxy_ = nullptr;
|
||||
std::shared_ptr<AppAccountAuthenticatorSessionManager> sessionManager_ = nullptr;
|
||||
std::shared_ptr<AppAccountControlManager> controlManager_ = nullptr;
|
||||
std::shared_ptr<AppAccountAuthenticatorManager> authenticatorMgr_ = nullptr;
|
||||
int32_t userId_;
|
||||
pid_t ownerUid_;
|
||||
bool isInitialized_ = false;
|
||||
bool isOpened_ = false;
|
||||
@ -109,4 +114,4 @@ private:
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATOR_SESSION_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATOR_SESSION_H
|
||||
|
@ -29,17 +29,18 @@ namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticatorSession;
|
||||
class AppAccountAuthenticatorSessionManager;
|
||||
namespace {
|
||||
class AppStateObserver : public AppExecFwk::ApplicationStateObserverStub {
|
||||
|
||||
class SessionAppStateObserver : public AppExecFwk::ApplicationStateObserverStub {
|
||||
public:
|
||||
AppStateObserver(AppAccountAuthenticatorSessionManager *sessionManager);
|
||||
virtual ~AppStateObserver() = default;
|
||||
virtual void OnAbilityStateChanged(const AppExecFwk::AbilityStateData &abilityStateData) override;
|
||||
explicit SessionAppStateObserver(AppAccountAuthenticatorSessionManager *sessionManager);
|
||||
virtual ~SessionAppStateObserver() = default;
|
||||
|
||||
void OnAbilityStateChanged(const AppExecFwk::AbilityStateData &abilityStateData) override;
|
||||
void SetSessionManager(AppAccountAuthenticatorSessionManager *sessionManager);
|
||||
|
||||
private:
|
||||
AppAccountAuthenticatorSessionManager *sessionManager_;
|
||||
};
|
||||
}
|
||||
|
||||
class AppAccountAuthenticatorSessionManager : public DelayedSingleton<AppAccountAuthenticatorSessionManager> {
|
||||
public:
|
||||
@ -53,10 +54,11 @@ public:
|
||||
void Init();
|
||||
void CloseSession(const std::string &sessionId);
|
||||
ErrCode OpenSession(const std::string &action, const OAuthRequest &request);
|
||||
|
||||
private:
|
||||
std::mutex mutex_;
|
||||
sptr<AppExecFwk::IAppMgr> iAppMgr_;
|
||||
sptr<AppStateObserver> appStateObserver_;
|
||||
sptr<SessionAppStateObserver> appStateObserver_;
|
||||
std::map<std::string, std::shared_ptr<AppAccountAuthenticatorSession>> sessionMap_;
|
||||
std::map<std::string, std::set<std::string>> abilitySessions_;
|
||||
bool isInitialized_ = false;
|
||||
@ -64,4 +66,4 @@ private:
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATOR_SESSION_MANAGER_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATOR_SESSION_MANAGER_H
|
||||
|
@ -24,8 +24,8 @@ namespace AccountSA {
|
||||
class AppAccountAuthenticatorStub : public IRemoteStub<IAppAccountAuthenticator> {
|
||||
public:
|
||||
AppAccountAuthenticatorStub();
|
||||
virtual ~AppAccountAuthenticatorStub() override;
|
||||
virtual int OnRemoteRequest(
|
||||
~AppAccountAuthenticatorStub() override;
|
||||
int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -24,9 +24,9 @@ namespace AccountSA {
|
||||
class AppAccountEventListener : public AppAccountEventStub {
|
||||
public:
|
||||
explicit AppAccountEventListener(const std::shared_ptr<AppAccountSubscriber> &subscriber);
|
||||
virtual ~AppAccountEventListener() override;
|
||||
~AppAccountEventListener() override;
|
||||
|
||||
virtual void OnAccountsChanged(const std::vector<AppAccountInfo> &accounts) override;
|
||||
void OnAccountsChanged(const std::vector<AppAccountInfo> &accounts) override;
|
||||
|
||||
void Stop();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -24,9 +24,9 @@ namespace AccountSA {
|
||||
class AppAccountEventProxy : public IRemoteProxy<IAppAccountEvent> {
|
||||
public:
|
||||
explicit AppAccountEventProxy(const sptr<IRemoteObject> &object);
|
||||
virtual ~AppAccountEventProxy() override;
|
||||
~AppAccountEventProxy() override;
|
||||
|
||||
virtual void OnAccountsChanged(const std::vector<AppAccountInfo> &accounts) override;
|
||||
void OnAccountsChanged(const std::vector<AppAccountInfo> &accounts) override;
|
||||
|
||||
private:
|
||||
ErrCode SendRequest(IAppAccountEvent::Message code, MessageParcel &data, MessageParcel &reply);
|
||||
|
@ -24,8 +24,8 @@ namespace AccountSA {
|
||||
class AppAccountEventStub : public IRemoteStub<IAppAccountEvent> {
|
||||
public:
|
||||
AppAccountEventStub();
|
||||
virtual ~AppAccountEventStub() override;
|
||||
virtual int OnRemoteRequest(
|
||||
~AppAccountEventStub() override;
|
||||
int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
|
@ -25,11 +25,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
namespace {
|
||||
constexpr uint32_t MAX_TOKEN_NUMBER = 128;
|
||||
constexpr uint32_t MAX_OAUTH_LIST_SIZE = 512;
|
||||
}
|
||||
|
||||
struct OAuthTokenInfo {
|
||||
std::string authType;
|
||||
std::string token;
|
||||
@ -75,13 +70,13 @@ public:
|
||||
ErrCode GetAllOAuthTokens(std::vector<OAuthTokenInfo> &tokenInfos) const;
|
||||
ErrCode GetOAuthList(const std::string &authType, std::set<std::string> &oauthList) const;
|
||||
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
static AppAccountInfo *Unmarshalling(Parcel &parcel);
|
||||
|
||||
virtual Json ToJson() const override;
|
||||
virtual void FromJson(const Json &jsonObject) override;
|
||||
virtual std::string ToString() const override;
|
||||
virtual std::string GetPrimeKey() const override;
|
||||
Json ToJson() const override;
|
||||
void FromJson(const Json &jsonObject) override;
|
||||
std::string ToString() const override;
|
||||
std::string GetPrimeKey() const override;
|
||||
|
||||
private:
|
||||
void ParseTokenInfosFromJson(const Json &jsonObject);
|
||||
|
@ -27,57 +27,57 @@ namespace AccountSA {
|
||||
class AppAccountManagerService : public AppAccountStub {
|
||||
public:
|
||||
AppAccountManagerService();
|
||||
virtual ~AppAccountManagerService() override;
|
||||
~AppAccountManagerService() override;
|
||||
|
||||
virtual ErrCode AddAccount(const std::string &name, const std::string &extraInfo) override;
|
||||
virtual ErrCode AddAccountImplicitly(
|
||||
ErrCode AddAccount(const std::string &name, const std::string &extraInfo) override;
|
||||
ErrCode AddAccountImplicitly(
|
||||
const std::string &owner, const std::string &authType, const AAFwk::Want &options,
|
||||
const sptr<IRemoteObject> &callback) override;
|
||||
virtual ErrCode DeleteAccount(const std::string &name) override;
|
||||
ErrCode DeleteAccount(const std::string &name) override;
|
||||
|
||||
virtual ErrCode GetAccountExtraInfo(const std::string &name, std::string &extraInfo) override;
|
||||
virtual ErrCode SetAccountExtraInfo(const std::string &name, const std::string &extraInfo) override;
|
||||
ErrCode GetAccountExtraInfo(const std::string &name, std::string &extraInfo) override;
|
||||
ErrCode SetAccountExtraInfo(const std::string &name, const std::string &extraInfo) override;
|
||||
|
||||
virtual ErrCode EnableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
virtual ErrCode DisableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
ErrCode EnableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
ErrCode DisableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
|
||||
virtual ErrCode CheckAppAccountSyncEnable(const std::string &name, bool &syncEnable) override;
|
||||
virtual ErrCode SetAppAccountSyncEnable(const std::string &name, const bool &syncEnable) override;
|
||||
ErrCode CheckAppAccountSyncEnable(const std::string &name, bool &syncEnable) override;
|
||||
ErrCode SetAppAccountSyncEnable(const std::string &name, const bool &syncEnable) override;
|
||||
|
||||
virtual ErrCode GetAssociatedData(const std::string &name, const std::string &key, std::string &value) override;
|
||||
virtual ErrCode SetAssociatedData(
|
||||
ErrCode GetAssociatedData(const std::string &name, const std::string &key, std::string &value) override;
|
||||
ErrCode SetAssociatedData(
|
||||
const std::string &name, const std::string &key, const std::string &value) override;
|
||||
|
||||
virtual ErrCode GetAccountCredential(
|
||||
ErrCode GetAccountCredential(
|
||||
const std::string &name, const std::string &credentialType, std::string &credential) override;
|
||||
virtual ErrCode SetAccountCredential(
|
||||
ErrCode SetAccountCredential(
|
||||
const std::string &name, const std::string &credentialType, const std::string &credential) override;
|
||||
|
||||
virtual ErrCode Authenticate(const std::string &name, const std::string &owner, const std::string &authType,
|
||||
ErrCode Authenticate(const std::string &name, const std::string &owner, const std::string &authType,
|
||||
const AAFwk::Want &options, const sptr<IRemoteObject> &callback) override;
|
||||
virtual ErrCode GetOAuthToken(
|
||||
ErrCode GetOAuthToken(
|
||||
const std::string &name, const std::string &owner, const std::string &authType, std::string &token) override;
|
||||
virtual ErrCode SetOAuthToken(
|
||||
ErrCode SetOAuthToken(
|
||||
const std::string &name, const std::string &authType, const std::string &token) override;
|
||||
virtual ErrCode DeleteOAuthToken(const std::string &name, const std::string &owner,
|
||||
ErrCode DeleteOAuthToken(const std::string &name, const std::string &owner,
|
||||
const std::string &authType, const std::string &token) override;
|
||||
virtual ErrCode SetOAuthTokenVisibility(const std::string &name, const std::string &authType,
|
||||
ErrCode SetOAuthTokenVisibility(const std::string &name, const std::string &authType,
|
||||
const std::string &bundleName, bool isVisible) override;
|
||||
virtual ErrCode CheckOAuthTokenVisibility(const std::string &name, const std::string &authType,
|
||||
ErrCode CheckOAuthTokenVisibility(const std::string &name, const std::string &authType,
|
||||
const std::string &bundleName, bool &isVisible) override;
|
||||
virtual ErrCode GetAuthenticatorInfo(const std::string &owner, AuthenticatorInfo &info) override;
|
||||
virtual ErrCode GetAllOAuthTokens(const std::string &name, const std::string &owner,
|
||||
ErrCode GetAuthenticatorInfo(const std::string &owner, AuthenticatorInfo &info) override;
|
||||
ErrCode GetAllOAuthTokens(const std::string &name, const std::string &owner,
|
||||
std::vector<OAuthTokenInfo> &tokenInfos) override;
|
||||
virtual ErrCode GetOAuthList(const std::string &name, const std::string &authType,
|
||||
ErrCode GetOAuthList(const std::string &name, const std::string &authType,
|
||||
std::set<std::string> &oauthList) override;
|
||||
virtual ErrCode GetAuthenticatorCallback(const std::string &sessionId, sptr<IRemoteObject> &callback) override;
|
||||
ErrCode GetAuthenticatorCallback(const std::string &sessionId, sptr<IRemoteObject> &callback) override;
|
||||
|
||||
virtual ErrCode GetAllAccounts(const std::string &owner, std::vector<AppAccountInfo> &appAccounts) override;
|
||||
virtual ErrCode GetAllAccessibleAccounts(std::vector<AppAccountInfo> &appAccounts) override;
|
||||
ErrCode GetAllAccounts(const std::string &owner, std::vector<AppAccountInfo> &appAccounts) override;
|
||||
ErrCode GetAllAccessibleAccounts(std::vector<AppAccountInfo> &appAccounts) override;
|
||||
|
||||
virtual ErrCode SubscribeAppAccount(
|
||||
ErrCode SubscribeAppAccount(
|
||||
const AppAccountSubscribeInfo &subscribeInfo, const sptr<IRemoteObject> &eventListener) override;
|
||||
virtual ErrCode UnsubscribeAppAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
ErrCode UnsubscribeAppAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
|
||||
virtual ErrCode OnPackageRemoved(const uid_t &uid, const std::string &bundleName);
|
||||
|
||||
|
@ -24,56 +24,56 @@ namespace AccountSA {
|
||||
class AppAccountProxy : public IRemoteProxy<IAppAccount> {
|
||||
public:
|
||||
explicit AppAccountProxy(const sptr<IRemoteObject> &object);
|
||||
virtual ~AppAccountProxy() override;
|
||||
~AppAccountProxy() override;
|
||||
|
||||
virtual ErrCode AddAccount(const std::string &name, const std::string &extraInfo) override;
|
||||
virtual ErrCode AddAccountImplicitly(const std::string &owner, const std::string &authType,
|
||||
ErrCode AddAccount(const std::string &name, const std::string &extraInfo) override;
|
||||
ErrCode AddAccountImplicitly(const std::string &owner, const std::string &authType,
|
||||
const AAFwk::Want &options, const sptr<IRemoteObject> &callback) override;
|
||||
virtual ErrCode DeleteAccount(const std::string &name) override;
|
||||
ErrCode DeleteAccount(const std::string &name) override;
|
||||
|
||||
virtual ErrCode GetAccountExtraInfo(const std::string &name, std::string &extraInfo) override;
|
||||
virtual ErrCode SetAccountExtraInfo(const std::string &name, const std::string &extraInfo) override;
|
||||
ErrCode GetAccountExtraInfo(const std::string &name, std::string &extraInfo) override;
|
||||
ErrCode SetAccountExtraInfo(const std::string &name, const std::string &extraInfo) override;
|
||||
|
||||
virtual ErrCode EnableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
virtual ErrCode DisableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
ErrCode EnableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
ErrCode DisableAppAccess(const std::string &name, const std::string &authorizedApp) override;
|
||||
|
||||
virtual ErrCode CheckAppAccountSyncEnable(const std::string &name, bool &syncEnable) override;
|
||||
virtual ErrCode SetAppAccountSyncEnable(const std::string &name, const bool &syncEnable) override;
|
||||
ErrCode CheckAppAccountSyncEnable(const std::string &name, bool &syncEnable) override;
|
||||
ErrCode SetAppAccountSyncEnable(const std::string &name, const bool &syncEnable) override;
|
||||
|
||||
virtual ErrCode GetAssociatedData(const std::string &name, const std::string &key, std::string &value) override;
|
||||
virtual ErrCode SetAssociatedData(
|
||||
ErrCode GetAssociatedData(const std::string &name, const std::string &key, std::string &value) override;
|
||||
ErrCode SetAssociatedData(
|
||||
const std::string &name, const std::string &key, const std::string &value) override;
|
||||
|
||||
virtual ErrCode GetAccountCredential(
|
||||
ErrCode GetAccountCredential(
|
||||
const std::string &name, const std::string &credentialType, std::string &credential) override;
|
||||
virtual ErrCode SetAccountCredential(
|
||||
ErrCode SetAccountCredential(
|
||||
const std::string &name, const std::string &credentialType, const std::string &credential) override;
|
||||
|
||||
virtual ErrCode Authenticate(const std::string &name, const std::string &owner, const std::string &authType,
|
||||
ErrCode Authenticate(const std::string &name, const std::string &owner, const std::string &authType,
|
||||
const AAFwk::Want &options, const sptr<IRemoteObject> &callback) override;
|
||||
virtual ErrCode GetOAuthToken(
|
||||
ErrCode GetOAuthToken(
|
||||
const std::string &name, const std::string &owner, const std::string &authType, std::string &token) override;
|
||||
virtual ErrCode SetOAuthToken(
|
||||
ErrCode SetOAuthToken(
|
||||
const std::string &name, const std::string &authType, const std::string &token) override;
|
||||
virtual ErrCode DeleteOAuthToken(const std::string &name, const std::string &owner, const std::string &authType,
|
||||
ErrCode DeleteOAuthToken(const std::string &name, const std::string &owner, const std::string &authType,
|
||||
const std::string &token) override;
|
||||
virtual ErrCode SetOAuthTokenVisibility(
|
||||
ErrCode SetOAuthTokenVisibility(
|
||||
const std::string &name, const std::string &authType, const std::string &bundleName, bool isVisible) override;
|
||||
virtual ErrCode CheckOAuthTokenVisibility(
|
||||
ErrCode CheckOAuthTokenVisibility(
|
||||
const std::string &name, const std::string &authType, const std::string &bundleName, bool &isVisible) override;
|
||||
virtual ErrCode GetAuthenticatorInfo(const std::string &owner, AuthenticatorInfo &info) override;
|
||||
virtual ErrCode GetAllOAuthTokens(
|
||||
ErrCode GetAuthenticatorInfo(const std::string &owner, AuthenticatorInfo &info) override;
|
||||
ErrCode GetAllOAuthTokens(
|
||||
const std::string &name, const std::string &owner, std::vector<OAuthTokenInfo> &tokenInfos) override;
|
||||
virtual ErrCode GetOAuthList(
|
||||
ErrCode GetOAuthList(
|
||||
const std::string &name, const std::string &authType, std::set<std::string> &oauthList) override;
|
||||
virtual ErrCode GetAuthenticatorCallback(const std::string &sessionId, sptr<IRemoteObject> &callback) override;
|
||||
ErrCode GetAuthenticatorCallback(const std::string &sessionId, sptr<IRemoteObject> &callback) override;
|
||||
|
||||
virtual ErrCode GetAllAccounts(const std::string &owner, std::vector<AppAccountInfo> &appAccounts) override;
|
||||
virtual ErrCode GetAllAccessibleAccounts(std::vector<AppAccountInfo> &appAccounts) override;
|
||||
ErrCode GetAllAccounts(const std::string &owner, std::vector<AppAccountInfo> &appAccounts) override;
|
||||
ErrCode GetAllAccessibleAccounts(std::vector<AppAccountInfo> &appAccounts) override;
|
||||
|
||||
virtual ErrCode SubscribeAppAccount(
|
||||
ErrCode SubscribeAppAccount(
|
||||
const AppAccountSubscribeInfo &subscribeInfo, const sptr<IRemoteObject> &eventListener) override;
|
||||
virtual ErrCode UnsubscribeAppAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
ErrCode UnsubscribeAppAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
|
||||
private:
|
||||
ErrCode SendRequest(IAppAccount::Message code, MessageParcel &data, MessageParcel &reply);
|
||||
|
@ -26,8 +26,8 @@ public:
|
||||
using MessageProcFunction = ErrCode (AppAccountStub::*)(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
AppAccountStub();
|
||||
virtual ~AppAccountStub() override;
|
||||
virtual int OnRemoteRequest(
|
||||
~AppAccountStub() override;
|
||||
int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -30,7 +30,7 @@ public:
|
||||
ErrCode GetOwners(std::vector<std::string> &owners) const;
|
||||
ErrCode SetOwners(const std::vector<std::string> &owners);
|
||||
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
static AppAccountSubscribeInfo *Unmarshalling(Parcel &parcel);
|
||||
|
||||
private:
|
||||
|
45
services/accountmgr/include/iaccount_context.h
Executable file → Normal file
45
services/accountmgr/include/iaccount_context.h
Executable file → Normal file
@ -1,23 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_CONTEXT_H
|
||||
#define BASE_ACCOUNT_CONTEXT_H
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IACCOUNT_CONTEXT_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IACCOUNT_CONTEXT_H
|
||||
|
||||
#include "message_parcel.h"
|
||||
|
||||
#include "message_parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class IAccountContext {
|
||||
@ -40,6 +40,7 @@ protected:
|
||||
private:
|
||||
static IAccountContext *instance_;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // BASE_ACCOUNT_CONTEXT_H
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IACCOUNT_CONTEXT_H
|
||||
|
13
services/accountmgr/include/ohos_account_data_deal.h
Executable file → Normal file
13
services/accountmgr/include/ohos_account_data_deal.h
Executable file → Normal file
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef BASE_ACCOUNT_INCLUDE_OHOS_ACCOUNT_DATA_DEAL_H
|
||||
#define BASE_ACCOUNT_INCLUDE_OHOS_ACCOUNT_DATA_DEAL_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OHOS_ACCOUNT_DATA_DEAL_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OHOS_ACCOUNT_DATA_DEAL_H
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
@ -32,7 +32,7 @@ public:
|
||||
ErrCode Init(std::int32_t userId);
|
||||
ErrCode AccountInfoFromJson(AccountInfo &accountInfo, const std::int32_t userId);
|
||||
ErrCode AccountInfoToJson(const AccountInfo &accountInfo) const;
|
||||
~OhosAccountDataDeal() {};
|
||||
~OhosAccountDataDeal() {}
|
||||
|
||||
private:
|
||||
bool initOk_;
|
||||
@ -42,6 +42,7 @@ private:
|
||||
void BuildJsonFileFromScratch(std::int32_t userId) const;
|
||||
void SaveAccountInfo(const AccountInfo &accountInfo) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // BASE_ACCOUNT_INCLUDE_OHOS_ACCOUNT_DATA_DEAL_H
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OHOS_ACCOUNT_DATA_DEAL_H
|
||||
|
131
services/accountmgr/include/ohos_account_manager.h
Executable file → Normal file
131
services/accountmgr/include/ohos_account_manager.h
Executable file → Normal file
@ -1,26 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ACCOUNT_OHOSACCOUNTMANAGER_H
|
||||
#define ACCOUNT_OHOSACCOUNTMANAGER_H
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OHOS_ACCOUNT_MANAGER_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OHOS_ACCOUNT_MANAGER_H
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include "account_info.h"
|
||||
#include "account_state_machine.h"
|
||||
#include "account_state_machine.h"
|
||||
#include "ohos_account_data_deal.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -28,8 +28,8 @@ namespace AccountSA {
|
||||
const std::string ACCOUNT_CFG_DIR_ROOT_PATH = "/data/system/users/";
|
||||
|
||||
class OhosAccountManager;
|
||||
using OhosAccountEventFunc = bool (OhosAccountManager::*)(const std::string &name, const std::string &uid,
|
||||
const std::string &eventStr);
|
||||
using OhosAccountEventFunc = bool (OhosAccountManager::*)(const std::string &name, const std::string &uid,
|
||||
const std::string &eventStr);
|
||||
/**
|
||||
* Ohos account manager
|
||||
*/
|
||||
@ -58,7 +58,7 @@ public:
|
||||
/**
|
||||
* Process an account event.
|
||||
*
|
||||
* @param curOhosAccount current ohos account info
|
||||
* @param curOhosAccount current ohos account info
|
||||
* @param eventStr ohos account state change event
|
||||
* @return true if the processing was completed, otherwise false
|
||||
*/
|
||||
@ -68,8 +68,8 @@ public:
|
||||
* login ohos (for distributed network) account.
|
||||
*
|
||||
* @param name ohos account name
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @return true if the processing was completed, otherwise false
|
||||
*/
|
||||
bool LoginOhosAccount(const std::string &name, const std::string &uid, const std::string &eventStr);
|
||||
@ -78,8 +78,8 @@ public:
|
||||
* logout ohos (for distributed network) account.
|
||||
*
|
||||
* @param name ohos account name
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @return true if the processing was completed, otherwise false
|
||||
*/
|
||||
bool LogoutOhosAccount(const std::string &name, const std::string &uid, const std::string &eventStr);
|
||||
@ -88,8 +88,8 @@ public:
|
||||
* logoff ohos (for distributed network) account.
|
||||
*
|
||||
* @param name ohos account name
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @return true if the processing was completed, otherwise false
|
||||
*/
|
||||
bool LogoffOhosAccount(const std::string &name, const std::string &uid, const std::string &eventStr);
|
||||
@ -98,8 +98,8 @@ public:
|
||||
* Handle token_invalid event of ohos (for distributed network) account .
|
||||
*
|
||||
* @param name ohos account name
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @return true if the processing was completed, otherwise false
|
||||
*/
|
||||
bool HandleOhosAccountTokenInvalidEvent(const std::string &name,
|
||||
@ -112,17 +112,17 @@ public:
|
||||
* @return None
|
||||
*/
|
||||
void HandleDevAccountSwitchEvent();
|
||||
|
||||
/**
|
||||
* Ohos account state change.
|
||||
*
|
||||
* @param name ohos account name
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @return true if the processing was completed, otherwise false
|
||||
*/
|
||||
bool OhosAccountStateChange(const std::string &name, const std::string &uid, const std::string &eventStr);
|
||||
|
||||
|
||||
/**
|
||||
* Ohos account state change.
|
||||
*
|
||||
* @param name ohos account name
|
||||
* @param uid ohos account uid
|
||||
* @param eventStr ohos account state change event
|
||||
* @return true if the processing was completed, otherwise false
|
||||
*/
|
||||
bool OhosAccountStateChange(const std::string &name, const std::string &uid, const std::string &eventStr);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Account state machine.
|
||||
@ -132,7 +132,7 @@ private:
|
||||
/**
|
||||
* Deal with file storage.
|
||||
*/
|
||||
std::unique_ptr<OhosAccountDataDeal> dataDealer_{};
|
||||
std::unique_ptr<OhosAccountDataDeal> dataDealer_{};
|
||||
|
||||
/**
|
||||
* event mapper.
|
||||
@ -164,31 +164,32 @@ private:
|
||||
|
||||
/**
|
||||
* Clear current account config.
|
||||
* @param curOhosAccountInfo current ohos account info.
|
||||
* @param curOhosAccountInfo current ohos account info.
|
||||
* @param clrStatus account status.
|
||||
*/
|
||||
bool ClearOhosAccount(AccountInfo &curOhosAccountInfo, std::int32_t clrStatus = ACCOUNT_STATE_UNBOUND) const;
|
||||
|
||||
/**
|
||||
* Check whether the ohos account can be bound to the current user or not
|
||||
* @return true if can.
|
||||
*/
|
||||
bool CheckOhosAccountCanBind(const std::string &newOhosUid) const;
|
||||
|
||||
/**
|
||||
* Get current ohos account info and check whether input information match or not
|
||||
* @return true if matches.
|
||||
*/
|
||||
bool GetCurOhosAccountAndCheckMatch(AccountInfo &curOhosAccountInfo,
|
||||
const std::string &inputName,
|
||||
const std::string &inputUid,
|
||||
const std::int32_t callingUserId) const;
|
||||
|
||||
/**
|
||||
* event function map
|
||||
*/
|
||||
std::map<std::string, OhosAccountEventFunc> eventFuncMap_;
|
||||
|
||||
/**
|
||||
* Check whether the ohos account can be bound to the current user or not
|
||||
* @return true if can.
|
||||
*/
|
||||
bool CheckOhosAccountCanBind(const std::string &newOhosUid) const;
|
||||
|
||||
/**
|
||||
* Get current ohos account info and check whether input information match or not
|
||||
* @return true if matches.
|
||||
*/
|
||||
bool GetCurOhosAccountAndCheckMatch(AccountInfo &curOhosAccountInfo,
|
||||
const std::string &inputName,
|
||||
const std::string &inputUid,
|
||||
const std::int32_t callingUserId) const;
|
||||
|
||||
/**
|
||||
* event function map
|
||||
*/
|
||||
std::map<std::string, OhosAccountEventFunc> eventFuncMap_;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // ACCOUNT_OHOSACCOUNTMANAGER_H
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OHOS_ACCOUNT_MANAGER_H
|
||||
|
@ -12,13 +12,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_H
|
||||
|
||||
#include <string>
|
||||
#include "account_error_no.h"
|
||||
#include "os_account_info.h"
|
||||
#include "iremote_object.h"
|
||||
#include "os_account_subscribe_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class IInnerOsAccount {
|
||||
@ -71,4 +74,5 @@ public:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif /* OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_H */
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_H
|
||||
|
@ -12,65 +12,68 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_MANAGER_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_MANAGER_H
|
||||
|
||||
#include <memory>
|
||||
#include "iinner_os_account.h"
|
||||
#include "ios_account_control.h"
|
||||
#include "ios_account_subscribe.h"
|
||||
#include "os_account_standard_interface.h"
|
||||
#include "singleton.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class IInnerOsAccountManager : public IInnerOsAccount, public DelayedSingleton<IInnerOsAccountManager> {
|
||||
public:
|
||||
IInnerOsAccountManager();
|
||||
virtual ~IInnerOsAccountManager() = default;
|
||||
virtual void Init() override;
|
||||
virtual ErrCode CreateOsAccount(
|
||||
void Init() override;
|
||||
ErrCode CreateOsAccount(
|
||||
const std::string &name, const OsAccountType &type, OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode CreateOsAccountForDomain(
|
||||
ErrCode CreateOsAccountForDomain(
|
||||
const OsAccountType &type, const DomainAccountInfo &domainInfo, OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode RemoveOsAccount(const int id) override;
|
||||
virtual ErrCode IsOsAccountExists(const int id, bool &isOsAccountExits) override;
|
||||
virtual ErrCode IsOsAccountActived(const int id, bool &isOsAccountActived) override;
|
||||
virtual ErrCode IsOsAccountConstraintEnable(
|
||||
ErrCode RemoveOsAccount(const int id) override;
|
||||
ErrCode IsOsAccountExists(const int id, bool &isOsAccountExits) override;
|
||||
ErrCode IsOsAccountActived(const int id, bool &isOsAccountActived) override;
|
||||
ErrCode IsOsAccountConstraintEnable(
|
||||
const int id, const std::string &constraint, bool &isOsAccountConstraintEnable) override;
|
||||
virtual ErrCode IsOsAccountVerified(const int id, bool &isVerified) override;
|
||||
virtual ErrCode GetCreatedOsAccountsCount(unsigned int &createdOsAccountCount) override;
|
||||
virtual ErrCode QueryMaxOsAccountNumber(int &maxOsAccountNumber) override;
|
||||
virtual ErrCode GetOsAccountAllConstraints(const int id, std::vector<std::string> &constraints) override;
|
||||
virtual ErrCode QueryAllCreatedOsAccounts(std::vector<OsAccountInfo> &osAccountInfos) override;
|
||||
virtual ErrCode QueryOsAccountById(const int id, OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode GetOsAccountType(const int id, OsAccountType &type) override;
|
||||
virtual ErrCode GetOsAccountProfilePhoto(const int id, std::string &photo) override;
|
||||
virtual ErrCode IsMultiOsAccountEnable(bool &isMultiOsAccountEnable) override;
|
||||
virtual ErrCode SetOsAccountName(const int id, const std::string &name) override;
|
||||
virtual ErrCode SetOsAccountConstraints(
|
||||
ErrCode IsOsAccountVerified(const int id, bool &isVerified) override;
|
||||
ErrCode GetCreatedOsAccountsCount(unsigned int &createdOsAccountCount) override;
|
||||
ErrCode QueryMaxOsAccountNumber(int &maxOsAccountNumber) override;
|
||||
ErrCode GetOsAccountAllConstraints(const int id, std::vector<std::string> &constraints) override;
|
||||
ErrCode QueryAllCreatedOsAccounts(std::vector<OsAccountInfo> &osAccountInfos) override;
|
||||
ErrCode QueryOsAccountById(const int id, OsAccountInfo &osAccountInfo) override;
|
||||
ErrCode GetOsAccountType(const int id, OsAccountType &type) override;
|
||||
ErrCode GetOsAccountProfilePhoto(const int id, std::string &photo) override;
|
||||
ErrCode IsMultiOsAccountEnable(bool &isMultiOsAccountEnable) override;
|
||||
ErrCode SetOsAccountName(const int id, const std::string &name) override;
|
||||
ErrCode SetOsAccountConstraints(
|
||||
const int id, const std::vector<std::string> &constraints, const bool enable) override;
|
||||
virtual ErrCode SetOsAccountProfilePhoto(const int id, const std::string &photo) override;
|
||||
virtual ErrCode ActivateOsAccount(const int id) override;
|
||||
virtual ErrCode StartOsAccount(const int id) override;
|
||||
virtual ErrCode StopOsAccount(const int id) override;
|
||||
virtual ErrCode GetOsAccountLocalIdBySerialNumber(const int64_t serialNumber, int &id) override;
|
||||
virtual ErrCode GetSerialNumberByOsAccountLocalId(const int &id, int64_t &serialNumber) override;
|
||||
virtual ErrCode SubscribeOsAccount(
|
||||
ErrCode SetOsAccountProfilePhoto(const int id, const std::string &photo) override;
|
||||
ErrCode ActivateOsAccount(const int id) override;
|
||||
ErrCode StartOsAccount(const int id) override;
|
||||
ErrCode StopOsAccount(const int id) override;
|
||||
ErrCode GetOsAccountLocalIdBySerialNumber(const int64_t serialNumber, int &id) override;
|
||||
ErrCode GetSerialNumberByOsAccountLocalId(const int &id, int64_t &serialNumber) override;
|
||||
ErrCode SubscribeOsAccount(
|
||||
const OsAccountSubscribeInfo &subscribeInfo, const sptr<IRemoteObject> &eventListener) override;
|
||||
virtual ErrCode UnsubscribeOsAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
virtual OS_ACCOUNT_SWITCH_MOD GetOsAccountSwitchMod() override;
|
||||
virtual ErrCode IsOsAccountCompleted(const int id, bool &isOsAccountCompleted) override;
|
||||
virtual ErrCode SetOsAccountIsVerified(const int id, const bool isVerified) override;
|
||||
virtual ErrCode IsAllowedCreateAdmin(bool &isAllowedCreateAdmin) override;
|
||||
virtual ErrCode GetOsAccountLocalIdFromDomain(const DomainAccountInfo &domainInfo, int &id) override;
|
||||
virtual ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID,
|
||||
ErrCode UnsubscribeOsAccount(const sptr<IRemoteObject> &eventListener) override;
|
||||
OS_ACCOUNT_SWITCH_MOD GetOsAccountSwitchMod() override;
|
||||
ErrCode IsOsAccountCompleted(const int id, bool &isOsAccountCompleted) override;
|
||||
ErrCode SetOsAccountIsVerified(const int id, const bool isVerified) override;
|
||||
ErrCode IsAllowedCreateAdmin(bool &isAllowedCreateAdmin) override;
|
||||
ErrCode GetOsAccountLocalIdFromDomain(const DomainAccountInfo &domainInfo, int &id) override;
|
||||
ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID,
|
||||
int &createdOsAccountNum) override;
|
||||
virtual ErrCode GetSerialNumberFromDatabase(const std::string& storeID, int64_t &serialNumber) override;
|
||||
virtual ErrCode GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id) override;
|
||||
virtual ErrCode GetOsAccountFromDatabase(const std::string& storeID, const int id,
|
||||
ErrCode GetSerialNumberFromDatabase(const std::string& storeID, int64_t &serialNumber) override;
|
||||
ErrCode GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id) override;
|
||||
ErrCode GetOsAccountFromDatabase(const std::string& storeID, const int id,
|
||||
OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode GetOsAccountListFromDatabase(const std::string& storeID,
|
||||
ErrCode GetOsAccountListFromDatabase(const std::string& storeID,
|
||||
std::vector<OsAccountInfo> &osAccountList) override;
|
||||
virtual ErrCode QueryActiveOsAccountIds(std::vector<int32_t>& ids) override;
|
||||
ErrCode QueryActiveOsAccountIds(std::vector<int32_t>& ids) override;
|
||||
|
||||
private:
|
||||
void StartAccount();
|
||||
@ -116,4 +119,5 @@ private:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif /* OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_MANAGER_H */
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_MANAGER_H
|
||||
|
@ -49,4 +49,5 @@ public:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif /* OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IOS_ACCOUNT_CONTROL_H */
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IOS_ACCOUNT_CONTROL_H
|
||||
|
@ -12,8 +12,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_CONTROL_FILE_MANAGER_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_CONTROL_FILE_MANAGER_H
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include "ios_account_control.h"
|
||||
@ -26,31 +28,31 @@ class OsAccountControlFileManager : public IOsAccountControl {
|
||||
public:
|
||||
OsAccountControlFileManager();
|
||||
virtual ~OsAccountControlFileManager();
|
||||
virtual void Init() override;
|
||||
virtual ErrCode GetOsAccountList(std::vector<OsAccountInfo> &osAccountList) override;
|
||||
virtual ErrCode GetOsAccountInfoById(const int id, OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode GetConstraintsByType(const OsAccountType type, std::vector<std::string> &constratins) override;
|
||||
virtual ErrCode InsertOsAccount(OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode DelOsAccount(const int id) override;
|
||||
virtual ErrCode UpdateOsAccount(OsAccountInfo &osAccountInfo) override;
|
||||
virtual ErrCode GetMaxCreatedOsAccountNum(int &maxCreatedOsAccountNum) override;
|
||||
virtual ErrCode GetSerialNumber(int64_t &serialNumber) override;
|
||||
virtual ErrCode GetAllowCreateId(int &id) override;
|
||||
virtual ErrCode IsOsAccountExists(const int id, bool &isExists) override;
|
||||
virtual ErrCode GetPhotoById(const int id, std::string &photo) override;
|
||||
virtual ErrCode SetPhotoById(const int id, const std::string &photo) override;
|
||||
virtual ErrCode GetIsMultiOsAccountEnable(bool &isMultiOsAccountEnable) override;
|
||||
virtual ErrCode IsConstrarionsInTypeList(const std::vector<std::string> &constrains, bool &isExists) override;
|
||||
virtual ErrCode IsAllowedCreateAdmin(bool &isAllowedCreateAdmin) override;
|
||||
void Init() override;
|
||||
ErrCode GetOsAccountList(std::vector<OsAccountInfo> &osAccountList) override;
|
||||
ErrCode GetOsAccountInfoById(const int id, OsAccountInfo &osAccountInfo) override;
|
||||
ErrCode GetConstraintsByType(const OsAccountType type, std::vector<std::string> &constratins) override;
|
||||
ErrCode InsertOsAccount(OsAccountInfo &osAccountInfo) override;
|
||||
ErrCode DelOsAccount(const int id) override;
|
||||
ErrCode UpdateOsAccount(OsAccountInfo &osAccountInfo) override;
|
||||
ErrCode GetMaxCreatedOsAccountNum(int &maxCreatedOsAccountNum) override;
|
||||
ErrCode GetSerialNumber(int64_t &serialNumber) override;
|
||||
ErrCode GetAllowCreateId(int &id) override;
|
||||
ErrCode IsOsAccountExists(const int id, bool &isExists) override;
|
||||
ErrCode GetPhotoById(const int id, std::string &photo) override;
|
||||
ErrCode SetPhotoById(const int id, const std::string &photo) override;
|
||||
ErrCode GetIsMultiOsAccountEnable(bool &isMultiOsAccountEnable) override;
|
||||
ErrCode IsConstrarionsInTypeList(const std::vector<std::string> &constrains, bool &isExists) override;
|
||||
ErrCode IsAllowedCreateAdmin(bool &isAllowedCreateAdmin) override;
|
||||
|
||||
virtual ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID,
|
||||
ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID,
|
||||
int &createdOsAccountNum) override;
|
||||
virtual ErrCode GetSerialNumberFromDatabase(const std::string& storeID,
|
||||
ErrCode GetSerialNumberFromDatabase(const std::string& storeID,
|
||||
int64_t &serialNumber) override;
|
||||
virtual ErrCode GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id) override;
|
||||
virtual ErrCode GetOsAccountFromDatabase(const std::string& storeID,
|
||||
ErrCode GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id) override;
|
||||
ErrCode GetOsAccountFromDatabase(const std::string& storeID,
|
||||
const int id, OsAccountInfo& osAccountInfo) override;
|
||||
virtual ErrCode GetOsAccountListFromDatabase(const std::string& storeID,
|
||||
ErrCode GetOsAccountListFromDatabase(const std::string& storeID,
|
||||
std::vector<OsAccountInfo>& osAccountList) override;
|
||||
|
||||
private:
|
||||
@ -70,4 +72,5 @@ private:
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif /* OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_CONTROL_FILE_MANAGER_H */
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_CONTROL_FILE_MANAGER_H
|
@ -12,20 +12,24 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_DATA_STORAGE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_DATA_STORAGE_H
|
||||
|
||||
#include "os_account_constants.h"
|
||||
#include "os_account_info.h"
|
||||
#include "account_data_storage.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class OsAccountDataStorage : public AccountDataStorage {
|
||||
public:
|
||||
OsAccountDataStorage(const std::string &appId, const std::string &storeId, const bool &autoSync);
|
||||
virtual ~OsAccountDataStorage();
|
||||
virtual void SaveEntries(std::vector<OHOS::DistributedKv::Entry> allEntries,
|
||||
void SaveEntries(std::vector<OHOS::DistributedKv::Entry> allEntries,
|
||||
std::map<std::string, std::shared_ptr<IAccountInfo>> &infos) override;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_DATA_STORAGE_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user