Lines Matching refs:userId
242 int32_t userId = DEFAULT_USER_ID; in InitData() local
249 currentUserId_ = userId; in InitData()
253 InitUserDir(userId); in InitData()
254 LoadSettingsLocked(userId); in InitData()
255 InitResources(userId, WALLPAPER_SYSTEM); in InitData()
256 InitResources(userId, WALLPAPER_LOCKSCREEN); in InitData()
332 for (auto userId : userIds) { in InitUsersOnBoot() local
333 InitUserDir(userId); in InitUsersOnBoot()
334 LoadSettingsLocked(userId); in InitUsersOnBoot()
335 InitResources(userId, WALLPAPER_SYSTEM); in InitUsersOnBoot()
336 InitResources(userId, WALLPAPER_LOCKSCREEN); in InitUsersOnBoot()
341 void WallpaperService::OnInitUser(int32_t userId) in OnInitUser() argument
343 if (userId < 0) { in OnInitUser()
344 HILOG_ERROR("userId error, userId = %{public}d", userId); in OnInitUser()
347 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId); in OnInitUser()
351 …ROR("Force remove user directory path failed, errno %{public}d, userId:%{public}d", errno, userId); in OnInitUser()
355 if (!InitUserDir(userId)) { in OnInitUser()
358 LoadSettingsLocked(userId); in OnInitUser()
359 InitResources(userId, WALLPAPER_SYSTEM); in OnInitUser()
360 InitResources(userId, WALLPAPER_LOCKSCREEN); in OnInitUser()
361 HILOG_INFO("OnInitUser success, userId = %{public}d", userId); in OnInitUser()
364 void WallpaperService::InitResources(int32_t userId, WallpaperType wallpaperType) in InitResources() argument
367 if (!GetFileNameFromMap(userId, wallpaperType, pathName)) { in InitResources()
368 HILOG_ERROR("Get user file name from map failed, userId = %{public}d", userId); in InitResources()
373 if (!GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData)) { in InitResources()
374 HILOG_ERROR("Get wallpaper data failed, userId = %{public}d", userId); in InitResources()
384 bool WallpaperService::InitUserDir(int32_t userId) in InitUserDir() argument
386 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId); in InitUserDir()
388 HILOG_ERROR("Failed to create destination path, userId:%{public}d ", userId); in InitUserDir()
393 …R("Failed to create destination wallpaper system path, userId:%{public}d, type:%{public}s", userId, in InitUserDir()
400 userId, WALLPAPER_LOCKSCREEN_DIRNAME); in InitUserDir()
421 || !FileDeal::IsFileExist(GetWallpaperDir(wallpaperData.userId, wallpaperType))) { in RestoreUserResources()
434 void WallpaperService::OnRemovedUser(int32_t userId) in OnRemovedUser() argument
436 if (userId < 0) { in OnRemovedUser()
437 HILOG_ERROR("userId error, userId = %{public}d", userId); in OnRemovedUser()
440 ClearWallpaperLocked(userId, WALLPAPER_SYSTEM); in OnRemovedUser()
441 ClearWallpaperLocked(userId, WALLPAPER_LOCKSCREEN); in OnRemovedUser()
442 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId); in OnRemovedUser()
447 HILOG_INFO("OnRemovedUser end, userId = %{public}d", userId); in OnRemovedUser()
450 void WallpaperService::OnSwitchedUser(int32_t userId) in OnSwitchedUser() argument
452 if (userId < 0) { in OnSwitchedUser()
453 HILOG_ERROR("userId error, userId = %{public}d", userId); in OnSwitchedUser()
456 if (userId == currentUserId_) { in OnSwitchedUser()
457 HILOG_ERROR("userId not switch, userId = %{public}d", userId); in OnSwitchedUser()
460 currentUserId_ = userId; in OnSwitchedUser()
465 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId); in OnSwitchedUser()
467 …WALLPAPER_USERID_PATH + std::to_string(userId) + "/" + WALLPAPER_SYSTEM_DIRNAME + "/" + WALLPAPER_… in OnSwitchedUser()
468 …std::string lockFile = WALLPAPER_USERID_PATH + std::to_string(userId) + "/" + WALLPAPER_LOCKSCREEN… in OnSwitchedUser()
470 LoadSettingsLocked(userId); in OnSwitchedUser()
472 HILOG_INFO("User file is not exist, userId = %{public}d", userId); in OnSwitchedUser()
473 InitUserDir(userId); in OnSwitchedUser()
474 InitResources(userId, WALLPAPER_SYSTEM); in OnSwitchedUser()
475 InitResources(userId, WALLPAPER_LOCKSCREEN); in OnSwitchedUser()
478 HILOG_INFO("systemFile is not exist, userId = %{public}d", userId); in OnSwitchedUser()
479 InitResources(userId, WALLPAPER_SYSTEM); in OnSwitchedUser()
482 HILOG_INFO("lockFile is not exist, userId = %{public}d", userId); in OnSwitchedUser()
483 InitResources(userId, WALLPAPER_LOCKSCREEN); in OnSwitchedUser()
487 SendWallpaperChangeEvent(userId, WALLPAPER_SYSTEM); in OnSwitchedUser()
488 SendWallpaperChangeEvent(userId, WALLPAPER_LOCKSCREEN); in OnSwitchedUser()
489 SaveColor(userId, WALLPAPER_SYSTEM); in OnSwitchedUser()
490 SaveColor(userId, WALLPAPER_LOCKSCREEN); in OnSwitchedUser()
491 HILOG_INFO("OnSwitchedUser end, newUserId = %{public}d", userId); in OnSwitchedUser()
499 std::string WallpaperService::GetWallpaperDir(int32_t userId, WallpaperType wallpaperType) in GetWallpaperDir() argument
501 std::string userIdPath = WALLPAPER_USERID_PATH + std::to_string(userId); in GetWallpaperDir()
511 bool WallpaperService::GetFileNameFromMap(int32_t userId, WallpaperType wallpaperType, std::string … in GetFileNameFromMap() argument
513 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId) in GetFileNameFromMap()
514 : lockWallpaperMap_.Find(userId); in GetFileNameFromMap()
540 bool WallpaperService::GetPictureFileName(int32_t userId, WallpaperType wallpaperType, std::string … in GetPictureFileName() argument
542 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId) in GetPictureFileName()
543 : lockWallpaperMap_.Find(userId); in GetPictureFileName()
545 …INFO("WallpaperType:%{public}d ,WallpaperMap not found userId: %{public}d", wallpaperType, userId); in GetPictureFileName()
546 OnInitUser(userId); in GetPictureFileName()
547 iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId) in GetPictureFileName()
548 : lockWallpaperMap_.Find(userId); in GetPictureFileName()
564 void WallpaperService::LoadSettingsLocked(int32_t userId) in LoadSettingsLocked() argument
567 if (!systemWallpaperMap_.Contains(userId)) { in LoadSettingsLocked()
569 std::string wallpaperSystemFilePath = GetWallpaperDir(userId, WALLPAPER_SYSTEM); in LoadSettingsLocked()
570 … WallpaperData wallpaperSystem(userId, wallpaperSystemFilePath + "/" + WALLPAPER_SYSTEM_ORIG); in LoadSettingsLocked()
576 systemWallpaperMap_.InsertOrAssign(userId, wallpaperSystem); in LoadSettingsLocked()
578 if (!lockWallpaperMap_.Contains(userId)) { in LoadSettingsLocked()
580 std::string wallpaperLockScreenFilePath = GetWallpaperDir(userId, WALLPAPER_LOCKSCREEN); in LoadSettingsLocked()
581 … WallpaperData wallpaperLock(userId, wallpaperLockScreenFilePath + "/" + WALLPAPER_LOCK_ORIG); in LoadSettingsLocked()
587 lockWallpaperMap_.InsertOrAssign(userId, wallpaperLock); in LoadSettingsLocked()
622 int32_t userId = QueryActiveUserId(); in GetFile() local
623 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId); in GetFile()
624 ErrorCode ret = GetImageFd(userId, type, wallpaperFd); in GetFile()
634 bool WallpaperService::SaveColor(int32_t userId, WallpaperType wallpaperType) in SaveColor() argument
640 if (!GetPictureFileName(userId, wallpaperType, pathName)) { in SaveColor()
711 …int32_t userId, WallpaperResourceType resourceType, const std::string &uriOrPixelMap, WallpaperTyp… in SetWallpaperBackupData() argument
718 bool ret = GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData); in SetWallpaperBackupData()
737 if (!SaveWallpaperState(userId, wallpaperType, resourceType)) { in SetWallpaperBackupData()
742 systemWallpaperMap_.InsertOrAssign(userId, wallpaperData); in SetWallpaperBackupData()
744 lockWallpaperMap_.InsertOrAssign(userId, wallpaperData); in SetWallpaperBackupData()
746 if (!SendWallpaperChangeEvent(userId, wallpaperType)) { in SetWallpaperBackupData()
775 WallpaperResourceType WallpaperService::GetResType(int32_t userId, WallpaperType wallpaperType) in GetResType() argument
778 auto iterator = lockWallpaperMap_.Find(userId); in GetResType()
783 auto iterator = systemWallpaperMap_.Find(userId); in GetResType()
799 int32_t userId = QueryActiveUserId(); in SendEvent() local
811 if (!GetWallpaperSafeLocked(userId, wallpaperType, data)) { in SendEvent()
816 GetFileNameFromMap(userId, WALLPAPER_SYSTEM, uri); in SendEvent()
821 bool WallpaperService::SendWallpaperChangeEvent(int32_t userId, WallpaperType wallpaperType) in SendWallpaperChangeEvent() argument
824 if (!GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData)) { in SendWallpaperChangeEvent()
871 int32_t userId = QueryActiveUserId(); in SetCustomWallpaper() local
874 if (!GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData)) { in SetCustomWallpaper()
882 if (!SaveWallpaperState(userId, wallpaperType, PACKAGE)) { in SetCustomWallpaper()
890 systemWallpaperMap_.InsertOrAssign(userId, wallpaperData); in SetCustomWallpaper()
892 lockWallpaperMap_.InsertOrAssign(userId, wallpaperData); in SetCustomWallpaper()
894 if (!SendWallpaperChangeEvent(userId, wallpaperType)) { in SetCustomWallpaper()
918 int32_t userId = QueryActiveUserId(); in GetPixelMap() local
919 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId); in GetPixelMap()
921 WallpaperResourceType resType = GetResType(userId, type); in GetPixelMap()
928 ErrorCode ret = GetImageSize(userId, type, fdInfo.size); in GetPixelMap()
933 ret = GetImageFd(userId, type, fdInfo.fd); in GetPixelMap()
950 int32_t userId = QueryActiveUserId(); in GetWallpaperId() local
951 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId); in GetWallpaperId()
953 auto iterator = lockWallpaperMap_.Find(userId); in GetWallpaperId()
958 auto iterator = systemWallpaperMap_.Find(userId); in GetWallpaperId()
995 int32_t userId = QueryActiveUserId(); in ResetWallpaper() local
996 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId); in ResetWallpaper()
997 if (!CheckUserPermissionById(userId)) { in ResetWallpaper()
1000 ErrorCode wallpaperErrorCode = SetDefaultDataForWallpaper(userId, type); in ResetWallpaper()
1014 ErrorCode WallpaperService::SetDefaultDataForWallpaper(int32_t userId, WallpaperType wallpaperType) in SetDefaultDataForWallpaper() argument
1017 if (!GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData)) { in SetDefaultDataForWallpaper()
1024 if (!SaveWallpaperState(userId, wallpaperType, DEFAULT)) { in SetDefaultDataForWallpaper()
1032 lockWallpaperMap_.InsertOrAssign(userId, wallpaperData); in SetDefaultDataForWallpaper()
1034 systemWallpaperMap_.InsertOrAssign(userId, wallpaperData); in SetDefaultDataForWallpaper()
1036 if (!SendWallpaperChangeEvent(userId, wallpaperType)) { in SetDefaultDataForWallpaper()
1040 SaveColor(userId, wallpaperType); in SetDefaultDataForWallpaper()
1087 bool WallpaperService::GetWallpaperSafeLocked(int32_t userId, WallpaperType wallpaperType, Wallpape… in GetWallpaperSafeLocked() argument
1090 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId) in GetWallpaperSafeLocked()
1091 : lockWallpaperMap_.Find(userId); in GetWallpaperSafeLocked()
1094 LoadSettingsLocked(userId); in GetWallpaperSafeLocked()
1095 iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId) in GetWallpaperSafeLocked()
1096 : lockWallpaperMap_.Find(userId); in GetWallpaperSafeLocked()
1106 void WallpaperService::ClearWallpaperLocked(int32_t userId, WallpaperType wallpaperType) in ClearWallpaperLocked() argument
1109 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId) in ClearWallpaperLocked()
1110 : lockWallpaperMap_.Find(userId); in ClearWallpaperLocked()
1117 lockWallpaperMap_.Erase(userId); in ClearWallpaperLocked()
1119 systemWallpaperMap_.Erase(userId); in ClearWallpaperLocked()
1226 ErrorCode WallpaperService::GetImageFd(int32_t userId, WallpaperType wallpaperType, int32_t &fd) in GetImageFd() argument
1230 if (!GetFileNameFromMap(userId, wallpaperType, filePathName)) { in GetImageFd()
1233 if (GetResType(userId, wallpaperType) == WallpaperResourceType::PACKAGE) { in GetImageFd()
1250 ErrorCode WallpaperService::GetImageSize(int32_t userId, WallpaperType wallpaperType, int32_t &size) in GetImageSize() argument
1254 HILOG_INFO("userId = %{public}d", userId); in GetImageSize()
1255 if (!GetPictureFileName(userId, wallpaperType, filePathName)) { in GetImageSize()
1309 bool WallpaperService::CheckUserPermissionById(int32_t userId) in CheckUserPermissionById() argument
1312 ErrCode errCode = OsAccountManager::QueryOsAccountById(userId, osAccountInfo); in CheckUserPermissionById()
1328 int32_t userId = QueryActiveUserId(); in SetWallpaper() local
1329 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId); in SetWallpaper()
1330 if (!CheckUserPermissionById(userId)) { in SetWallpaper()
1367 ErrorCode wallpaperErrorCode = SetWallpaperBackupData(userId, resourceType, uri, type); in SetWallpaper()
1369 SaveColor(userId, type); in SetWallpaper()
1377 int32_t userId = QueryActiveUserId(); in SetWallpaperByPixelMap() local
1378 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId); in SetWallpaperByPixelMap()
1379 if (!CheckUserPermissionById(userId)) { in SetWallpaperByPixelMap()
1389 ErrorCode wallpaperErrorCode = SetWallpaperBackupData(userId, resourceType, uri, type); in SetWallpaperByPixelMap()
1391 SaveColor(userId, type); in SetWallpaperByPixelMap()
1525 int32_t userId, WallpaperType wallpaperType, WallpaperResourceType resourceType) in SaveWallpaperState() argument
1529 if (!GetWallpaperSafeLocked(userId, WALLPAPER_SYSTEM, systemData) in SaveWallpaperState()
1530 || !GetWallpaperSafeLocked(userId, WALLPAPER_LOCKSCREEN, lockScreenData)) { in SaveWallpaperState()
1547 std::string userPath = WALLPAPER_USERID_PATH + std::to_string(userId) + "/wallpapercfg"; in SaveWallpaperState()
1566 int32_t userId = QueryActiveUserId(); in LoadWallpaperState() local
1567 std::string userPath = WALLPAPER_USERID_PATH + std::to_string(userId) + "/wallpapercfg"; in LoadWallpaperState()
1588 if (!GetWallpaperSafeLocked(userId, WALLPAPER_SYSTEM, systemData) in LoadWallpaperState()
1589 || !GetWallpaperSafeLocked(userId, WALLPAPER_LOCKSCREEN, lockScreenData)) { in LoadWallpaperState()