Lines Matching refs:userId

258     int32_t userId = DEFAULT_USER_ID;
268 currentUserId_ = userId;
271 InitUserDir(userId);
272 UpdataWallpaperMap(userId, WALLPAPER_SYSTEM);
273 UpdataWallpaperMap(userId, WALLPAPER_LOCKSCREEN);
275 ClearRedundantFile(userId, WALLPAPER_SYSTEM, WALLPAPER_SYSTEM_ORIG);
276 ClearRedundantFile(userId, WALLPAPER_LOCKSCREEN, WALLPAPER_LOCK_ORIG);
343 int32_t userId = osAccountInfo.GetLocalId();
344 HILOG_INFO("InitUsersOnBoot Current userId: %{public}d", userId);
345 InitUserDir(userId);
346 UpdataWallpaperMap(userId, WALLPAPER_SYSTEM);
347 UpdataWallpaperMap(userId, WALLPAPER_LOCKSCREEN);
348 ClearRedundantFile(userId, WALLPAPER_SYSTEM, WALLPAPER_SYSTEM_ORIG);
349 ClearRedundantFile(userId, WALLPAPER_LOCKSCREEN, WALLPAPER_LOCK_ORIG);
354 void WallpaperService::ClearRedundantFile(int32_t userId, WallpaperType wallpaperType, std::string fileName)
356 HILOG_DEBUG("ClearRedundantFile Current userId: %{public}d", userId);
357 std::string wallpaperFilePath = GetWallpaperDir(userId, wallpaperType) + "/" + fileName;
361 void WallpaperService::OnInitUser(int32_t userId)
363 if (userId < 0) {
364 HILOG_ERROR("userId error, userId = %{public}d", userId);
367 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId);
371 HILOG_ERROR("Force remove user directory path failed, errno %{public}d, userId:%{public}d", errno, userId);
375 if (!InitUserDir(userId)) {
378 UpdataWallpaperMap(userId, WALLPAPER_SYSTEM);
379 UpdataWallpaperMap(userId, WALLPAPER_LOCKSCREEN);
380 HILOG_INFO("OnInitUser success, userId = %{public}d", userId);
383 bool WallpaperService::InitUserDir(int32_t userId)
385 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId);
387 HILOG_ERROR("Failed to create destination path, userId:%{public}d", userId);
392 HILOG_ERROR("Failed to create destination wallpaper system path, userId:%{public}d, type:%{public}s.", userId,
398 HILOG_ERROR("Failed to create destination wallpaper lockscreen path, userId:%{public}d, type:%{public}s.",
399 userId, WALLPAPER_LOCKSCREEN_DIRNAME);
405 bool WallpaperService::RestoreUserResources(int32_t userId, WallpaperData &wallpaperData, WallpaperType wallpaperType)
408 ClearRedundantFile(userId, wallpaperType, WALLPAPER_HOME);
410 ClearRedundantFile(userId, wallpaperType, WALLPAPER_LOCK);
433 void WallpaperService::OnRemovedUser(int32_t userId)
435 if (userId < 0) {
436 HILOG_ERROR("userId error, userId = %{public}d", userId);
439 ClearWallpaperLocked(userId, WALLPAPER_SYSTEM);
440 ClearWallpaperLocked(userId, WALLPAPER_LOCKSCREEN);
441 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId);
446 HILOG_INFO("OnRemovedUser end, userId = %{public}d", userId);
449 void WallpaperService::OnSwitchedUser(int32_t userId)
451 if (userId < 0) {
452 HILOG_ERROR("userId error, userId = %{public}d", userId);
455 if (userId == currentUserId_) {
456 HILOG_ERROR("userId not switch, userId = %{public}d", userId);
459 currentUserId_ = userId;
464 std::string userDir = WALLPAPER_USERID_PATH + std::to_string(userId);
466 HILOG_INFO("User file is not exist, userId = %{public}d", userId);
467 InitUserDir(userId);
468 UpdataWallpaperMap(userId, WALLPAPER_SYSTEM);
469 UpdataWallpaperMap(userId, WALLPAPER_LOCKSCREEN);
472 SendWallpaperChangeEvent(userId, WALLPAPER_SYSTEM);
473 SendWallpaperChangeEvent(userId, WALLPAPER_LOCKSCREEN);
474 SaveColor(userId, WALLPAPER_SYSTEM);
475 SaveColor(userId, WALLPAPER_LOCKSCREEN);
476 HILOG_INFO("OnSwitchedUser end, newUserId = %{public}d", userId);
479 std::string WallpaperService::GetWallpaperDir(int32_t userId, WallpaperType wallpaperType)
481 std::string userIdPath = WALLPAPER_USERID_PATH + std::to_string(userId);
491 bool WallpaperService::GetFileNameFromMap(int32_t userId, WallpaperType wallpaperType, std::string &filePathName)
493 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId)
494 : lockWallpaperMap_.Find(userId);
520 bool WallpaperService::GetPictureFileName(int32_t userId, WallpaperType wallpaperType, std::string &filePathName)
522 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId)
523 : lockWallpaperMap_.Find(userId);
525 HILOG_INFO("WallpaperType:%{public}d, WallpaperMap not found userId: %{public}d", wallpaperType, userId);
526 OnInitUser(userId);
527 iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId)
528 : lockWallpaperMap_.Find(userId);
544 void WallpaperService::UpdataWallpaperMap(int32_t userId, WallpaperType wallpaperType)
548 std::string wallpaperPath = GetWallpaperDir(userId, wallpaperType);
565 wallpaperData.userId = userId;
572 wallpaperMap.InsertOrAssign(userId, wallpaperData);
608 int32_t userId = QueryActiveUserId();
609 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId);
610 ErrorCode ret = GetImageFd(userId, type, wallpaperFd);
620 bool WallpaperService::SaveColor(int32_t userId, WallpaperType wallpaperType)
626 if (!GetPictureFileName(userId, wallpaperType, pathName)) {
701 int32_t userId, WallpaperResourceType resourceType, const std::string &uriOrPixelMap, WallpaperType wallpaperType)
708 bool ret = GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData);
714 wallpaperData.wallpaperFile = GetWallpaperDir(userId, wallpaperType) + "/"
732 if (!SaveWallpaperState(userId, wallpaperType, resourceType)) {
737 systemWallpaperMap_.InsertOrAssign(userId, wallpaperData);
739 lockWallpaperMap_.InsertOrAssign(userId, wallpaperData);
741 if (!SendWallpaperChangeEvent(userId, wallpaperType)) {
770 WallpaperResourceType WallpaperService::GetResType(int32_t userId, WallpaperType wallpaperType)
773 auto iterator = lockWallpaperMap_.Find(userId);
778 auto iterator = systemWallpaperMap_.Find(userId);
794 int32_t userId = QueryActiveUserId();
806 if (!GetWallpaperSafeLocked(userId, wallpaperType, data)) {
811 GetFileNameFromMap(userId, WALLPAPER_SYSTEM, uri);
816 bool WallpaperService::SendWallpaperChangeEvent(int32_t userId, WallpaperType wallpaperType)
819 if (!GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData)) {
866 int32_t userId = QueryActiveUserId();
869 if (!GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData)) {
877 if (!SaveWallpaperState(userId, wallpaperType, PACKAGE)) {
885 systemWallpaperMap_.InsertOrAssign(userId, wallpaperData);
887 lockWallpaperMap_.InsertOrAssign(userId, wallpaperData);
889 if (!SendWallpaperChangeEvent(userId, wallpaperType)) {
913 int32_t userId = QueryActiveUserId();
914 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId);
916 WallpaperResourceType resType = GetResType(userId, type);
923 ErrorCode ret = GetImageSize(userId, type, fdInfo.size);
928 ret = GetImageFd(userId, type, fdInfo.fd);
945 int32_t userId = QueryActiveUserId();
946 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId);
948 auto iterator = lockWallpaperMap_.Find(userId);
953 auto iterator = systemWallpaperMap_.Find(userId);
990 int32_t userId = QueryActiveUserId();
991 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId);
992 if (!CheckUserPermissionById(userId)) {
995 ErrorCode wallpaperErrorCode = SetDefaultDataForWallpaper(userId, type);
1009 ErrorCode WallpaperService::SetDefaultDataForWallpaper(int32_t userId, WallpaperType wallpaperType)
1012 if (!GetWallpaperSafeLocked(userId, wallpaperType, wallpaperData)) {
1015 if (!RestoreUserResources(userId, wallpaperData, wallpaperType)) {
1019 if (!SaveWallpaperState(userId, wallpaperType, DEFAULT)) {
1027 lockWallpaperMap_.InsertOrAssign(userId, wallpaperData);
1029 systemWallpaperMap_.InsertOrAssign(userId, wallpaperData);
1031 if (!SendWallpaperChangeEvent(userId, wallpaperType)) {
1035 SaveColor(userId, wallpaperType);
1082 bool WallpaperService::GetWallpaperSafeLocked(int32_t userId, WallpaperType wallpaperType, WallpaperData &wallpaperData)
1085 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId)
1086 : lockWallpaperMap_.Find(userId);
1089 UpdataWallpaperMap(userId, wallpaperType);
1090 iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId)
1091 : lockWallpaperMap_.Find(userId);
1101 void WallpaperService::ClearWallpaperLocked(int32_t userId, WallpaperType wallpaperType)
1104 auto iterator = wallpaperType == WALLPAPER_SYSTEM ? systemWallpaperMap_.Find(userId)
1105 : lockWallpaperMap_.Find(userId);
1112 lockWallpaperMap_.Erase(userId);
1114 systemWallpaperMap_.Erase(userId);
1192 ErrorCode WallpaperService::GetImageFd(int32_t userId, WallpaperType wallpaperType, int32_t &fd)
1196 if (!GetFileNameFromMap(userId, wallpaperType, filePathName)) {
1199 if (GetResType(userId, wallpaperType) == WallpaperResourceType::PACKAGE) {
1216 ErrorCode WallpaperService::GetImageSize(int32_t userId, WallpaperType wallpaperType, int32_t &size)
1220 HILOG_INFO("userId = %{public}d", userId);
1221 if (!GetPictureFileName(userId, wallpaperType, filePathName)) {
1258 bool WallpaperService::CheckUserPermissionById(int32_t userId)
1261 ErrCode errCode = OsAccountManager::QueryOsAccountById(userId, osAccountInfo);
1277 int32_t userId = QueryActiveUserId();
1278 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId);
1279 if (!CheckUserPermissionById(userId)) {
1316 ErrorCode wallpaperErrorCode = SetWallpaperBackupData(userId, resourceType, uri, type);
1318 SaveColor(userId, type);
1330 int32_t userId = QueryActiveUserId();
1331 HILOG_INFO("QueryCurrentOsAccount userId: %{public}d", userId);
1332 if (!CheckUserPermissionById(userId)) {
1342 ErrorCode wallpaperErrorCode = SetWallpaperBackupData(userId, resourceType, uri, type);
1344 SaveColor(userId, type);
1492 int32_t userId, WallpaperType wallpaperType, WallpaperResourceType resourceType)
1496 if (!GetWallpaperSafeLocked(userId, WALLPAPER_SYSTEM, systemData)
1497 || !GetWallpaperSafeLocked(userId, WALLPAPER_LOCKSCREEN, lockScreenData)) {
1514 std::string userPath = WALLPAPER_USERID_PATH + std::to_string(userId) + "/wallpapercfg";
1533 int32_t userId = QueryActiveUserId();
1534 std::string userPath = WALLPAPER_USERID_PATH + std::to_string(userId) + "/wallpapercfg";
1555 if (!GetWallpaperSafeLocked(userId, WALLPAPER_SYSTEM, systemData)
1556 || !GetWallpaperSafeLocked(userId, WALLPAPER_LOCKSCREEN, lockScreenData)) {