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 * @tc.name: MultipleUserConnector::SetSwitchOldAccountName 69 * @tc.desc: Set Switch Old AccountName of the Multiple User Connector 70 * @tc.type: FUNC 71 */ 72 static void SetSwitchOldAccountName(std::string accountName); 73 /** 74 * @tc.name: MultipleUserConnector::GetOhosAccountName 75 * @tc.desc: Get Current AccountName of the Multiple User Connector 76 * @tc.type: FUNC 77 */ 78 static std::string GetOhosAccountName(void); 79 /** 80 * @tc.name: MultipleUserConnector::GetSwitchOldAccountName 81 * @tc.desc: Get Switc AccountName of the Multiple User Connector 82 * @tc.type: FUNC 83 */ 84 static std::string GetSwitchOldAccountName(void); 85 private: 86 static int32_t oldUserId_; 87 static std::string accountId_; 88 static std::string accountName_; 89 static std::mutex lock_; 90 }; 91 } // namespace DistributedHardware 92 } // namespace OHOS 93 #endif // OHOS_DM_MULTIPLE_USER_CONNECTOR_H 94