add OnUserSwitched

Signed-off-by: dengxiaoyu <dengxiaoyu6@huawei.com>
This commit is contained in:
dengxiaoyu 2024-09-09 11:23:46 +08:00
parent 3a236e7ee2
commit c0d6a739db
2 changed files with 2 additions and 7 deletions

View File

@ -24,11 +24,7 @@
namespace OHOS {
namespace DistributedSchedule {
const std::string SETTINGS_DATA_URI =
"datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true&key=Continue_Switch_Status";
const std::string SETTINGS_USER_SECURE_URI =
"datashare:///com.ohos.settingsdata/entry/settingsdata/USER_SETTINGSDATA_SECURE";
class SettingObserver : public AAFwk::DataAbilityObserverStub {
public:
SettingObserver();
@ -59,7 +55,6 @@ public:
private:
std::shared_ptr<DataShare::DataShareHelper> CreateDataShareHelper();
Uri AssembleUri(const std::string &key);
sptr<SettingObserver> GetSettingObserver(const std::string &key);
private:

View File

@ -114,7 +114,7 @@ void DataShareManager::UnregisterObserver(const std::string &key)
Uri uri(AssembleUserSecureUri(userId, key));
dataShareHelper->UnregisterObserver(uri, observer);
dataShareHelper->Release();
std::lock_guard<std::mutex> lockGuard(observerMapMutex_);
settingObserverMap_.erase(key);
HILOGI("DataShareManager UnregisterObserver success with key is %{public}s", key.c_str());