mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
change GetOsAccountType
Signed-off-by: dengxiaoyu <dengxiaoyu6@huawei.com>
This commit is contained in:
parent
24350f6c38
commit
8dd6726bed
@ -31,7 +31,7 @@ public:
|
||||
|
||||
void OnReceiveEvent(const EventFwk::CommonEventData &eventData);
|
||||
int32_t GetForegroundOsAccountLocalId();
|
||||
ErrCode GetOsAccountType(int32_t &accountId);
|
||||
void OnUserSwitched(int32_t &accountId);
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -98,24 +98,22 @@ int32_t CommonEventListener::GetForegroundOsAccountLocalId()
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
HILOGD("GetForegroundOsAccountLocalId accountId is: %{public}d", accountId);
|
||||
GetOsAccountType(accountId);
|
||||
OnUserSwitched(accountId);
|
||||
return accountId;
|
||||
}
|
||||
|
||||
ErrCode CommonEventListener::GetOsAccountType(int32_t& accountId)
|
||||
void CommonEventListener::OnUserSwitched(int32_t& accountId)
|
||||
{
|
||||
AccountSA::OsAccountType type;
|
||||
ErrCode err = AccountSA::OsAccountManager::GetOsAccountType(accountId, type);
|
||||
if (err != ERR_OK) {
|
||||
HILOGE("GetOsAccountType passing param invalid or return error!, err : %{public}d", err);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
if (type == AccountSA::OsAccountType::PRIVATE) {
|
||||
HILOGI("GetOsAccountType : OsAccountType is PRIVATE, type : %{public}d", type);
|
||||
DataShareManager::GetInstance().UpdateSwitchStatus(SwitchStatusDependency::GetInstance()
|
||||
.CONTINUE_SWITCH_STATUS_KEY, SwitchStatusDependency::GetInstance().CONTINUE_SWITCH_OFF);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
@ -114,10 +114,7 @@ void DataShareManager::UnregisterObserver(const std::string &key)
|
||||
Uri uri(AssembleUserSecureUri(userId, key));
|
||||
dataShareHelper->UnregisterObserver(uri, observer);
|
||||
dataShareHelper->Release();
|
||||
if (observer != nullptr) {
|
||||
HILOGI("UnregisterObserver delete observer");
|
||||
delete observer;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lockGuard(observerMapMutex_);
|
||||
settingObserverMap_.erase(key);
|
||||
HILOGI("DataShareManager UnregisterObserver success with key is %{public}s", key.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user