• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 USER_ACCESS_COMMON_UTILS_H
17 #define USER_ACCESS_COMMON_UTILS_H
18 
19 #include "os_account_manager.h"
20 #include "parameter.h"
21 
22 namespace OHOS {
23 namespace FileAccessFwk {
24 
GetDeviceType(std::string & deviceType)25 static bool GetDeviceType(std::string &deviceType)
26 {
27     char deviceTypeChar[PARAM_CONST_VALUE_LEN_MAX];
28     int32_t ret = GetParameter("const.product.devicetype", "0", deviceTypeChar, PARAM_CONST_VALUE_LEN_MAX);
29     if (ret < 0) {
30         HILOG_ERROR("Get deviceType fail. %{public}d", ret);
31         return false;
32     }
33     deviceType = deviceTypeChar;
34     return true;
35 }
36 
GetUserName(std::string & userName)37 static bool GetUserName(std::string &userName)
38 {
39     userName = "currentUser";
40     return true;
41 }
42 
43 } // FileAccessFwk
44 } // OHOS
45 #endif //USER_ACCESS_COMMON_UTILS_H