1 /*
2 * Copyright (C) 2023 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 "image_system_properties.h"
17
18 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
19 #include <string>
20
21 #include <parameter.h>
22 #include <parameters.h>
23 #endif
24
25 #include "hilog/log_cpp.h"
26 #include "image_log.h"
27
28 extern "C" {
29 extern char* __progname;
30 }
31 namespace OHOS {
32 namespace Media {
GetSkiaEnabled()33 bool ImageSystemProperties::GetSkiaEnabled()
34 {
35 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
36 return system::GetBoolParameter("persist.multimedia.image.skdecode.enabled", true);
37 #else
38 return false;
39 #endif
40 }
41
GetSurfaceBufferEnabled()42 bool ImageSystemProperties::GetSurfaceBufferEnabled()
43 {
44 #if !defined(IOS_PLATFORM) &&!defined(A_PLATFORM)
45 bool isPhone = system::GetParameter("const.product.devicetype", "pc") == "phone";
46 bool isFeatureSupported = false;
47 if (isPhone) {
48 if (strncmp(__progname, "mos.photo", strlen("mos.photo")) == 0 ||
49 strncmp(__progname, "myapplication", strlen("myapplication")) == 0) {
50 isFeatureSupported = true;
51 }
52 }
53 return system::GetBoolParameter("persist.multimedia.image.surfacebuffer.enabled", true) && isFeatureSupported;
54 #else
55 return false;
56 #endif
57 }
58 } // namespace Media
59 } // namespace OHOS