1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_DM_MULTIPLE_USER_CONNECTOR_H 17 #define OHOS_DM_MULTIPLE_USER_CONNECTOR_H 18 19 #include <cstdint> 20 #include <mutex> 21 #include <string> 22 namespace OHOS { 23 namespace DistributedHardware { 24 class MultipleUserConnector { 25 public: 26 /** 27 * @tc.name: MultipleUserConnector::GetCurrentAccountUserID 28 * @tc.desc: Get Current Account UserID of the Multiple User Connector 29 * @tc.type: FUNC 30 */ 31 static int32_t GetCurrentAccountUserID(void); 32 33 /** 34 * @tc.name: MultipleUserConnector::SetSwitchOldUserId 35 * @tc.desc: Set Switch Old UserId of the Multiple User Connector 36 * @tc.type: FUNC 37 */ 38 static void SetSwitchOldUserId(int32_t userId); 39 40 /** 41 * @tc.name: MultipleUserConnector::GetSwitchOldUserId 42 * @tc.desc: Get Switc hOld UserId of the Multiple User Connector 43 * @tc.type: FUNC 44 */ 45 static int32_t GetSwitchOldUserId(void); 46 47 /** 48 * @tc.name: MultipleUserConnector::GetOhosAccountId 49 * @tc.desc: Get Current AccountId of the Multiple User Connector 50 * @tc.type: FUNC 51 */ 52 static std::string GetOhosAccountId(void); 53 54 /** 55 * @tc.name: MultipleUserConnector::SetSwitchOldAccountId 56 * @tc.desc: Set Switch Old UserId of the Multiple User Connector 57 * @tc.type: FUNC 58 */ 59 static void SetSwitchOldAccountId(std::string accountId); 60 61 /** 62 * @tc.name: MultipleUserConnector::GetSwitchOldAccountId 63 * @tc.desc: Get Switc hOld UserId of the Multiple User Connector 64 * @tc.type: FUNC 65 */ 66 static std::string GetSwitchOldAccountId(void); 67 68 /** 69 * @tc.name: MultipleUserConnector::SetSwitchOldAccountName 70 * @tc.desc: Set Switch Old AccountName of the Multiple User Connector 71 * @tc.type: FUNC 72 */ 73 static void SetSwitchOldAccountName(std::string accountName); 74 75 /** 76 * @tc.name: MultipleUserConnector::GetOhosAccountName 77 * @tc.desc: Get Current AccountName of the Multiple User Connector 78 * @tc.type: FUNC 79 */ 80 static std::string GetOhosAccountName(void); 81 82 /** 83 * @tc.name: MultipleUserConnector::GetSwitchOldAccountName 84 * @tc.desc: Get Switc Old AccountName of the Multiple User Connector 85 * @tc.type: FUNC 86 */ 87 static std::string GetSwitchOldAccountName(void); 88 private: 89 static int32_t oldUserId_; 90 static std::string accountId_; 91 static std::string accountName_; 92 static std::mutex lock_; 93 }; 94 } // namespace DistributedHardware 95 } // namespace OHOS 96 #endif // OHOS_DM_MULTIPLE_USER_CONNECTOR_H 97