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 #include <cstring>
17 
18 #include "parameter.h"
19 #include "securec.h"
20 #include <string>
21 
22 namespace OHOS {
23 namespace {
24 const char *DEVICE_TYPE_OF_PHONE = "phone";
25 const char *DEVICE_TYPE_OF_DEFAULT = "default";
26 const char *EMPTY_STRING = "";
27 const int DEFAULT_SDK_API = 9;
28 const int32_t MAX_LEN = 40;
29 } // namespace
30 
31 char *g_testDeviceType = const_cast<char *>(EMPTY_STRING);
32 
GetDeviceType()33 char *GetDeviceType()
34 {
35     if (strcmp(g_testDeviceType, DEVICE_TYPE_OF_PHONE) == 0) {
36         return const_cast<char *>(DEVICE_TYPE_OF_PHONE);
37     }
38     if (strcmp(g_testDeviceType, DEVICE_TYPE_OF_DEFAULT) == 0) {
39         return const_cast<char *>(DEVICE_TYPE_OF_DEFAULT);
40     }
41 
42     return const_cast<char *>(EMPTY_STRING);
43 }
44 
GetSdkApiVersion()45 int GetSdkApiVersion()
46 {
47     return DEFAULT_SDK_API;
48 }
49 
GetParameter(const char * key,const char * def,char * value,int len)50 int GetParameter(const char *key, const char *def, char *value, int len)
51 {
52     if ((key != nullptr) && (value != nullptr) &&
53         (std::strcmp(key, "persist.bms.supportCompressNativeLibs") == 0)) {
54         char tmp[MAX_LEN] = "true";
55         if (strcpy_s(value, len, tmp) == 0) {
56             return 1;
57         }
58     }
59     return 0;
60 }
61 
GetIntParameter(const char * key,int def)62 int GetIntParameter(const char *key, int def)
63 {
64     return def;
65 }
66 
GetAbiList(void)67 const char *GetAbiList(void)
68 {
69     return "arm64-v8a";
70 }
71 
SetParameter(const char * key,const char * value)72 int SetParameter(const char *key, const char *value)
73 {
74     return 0;
75 }
76 
GetDevUdid(char * udid,int size)77 int GetDevUdid(char *udid, int size)
78 {
79     return 0;
80 }
81 } // OHOS