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