2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <system_info.h>
20 #include "stc-emulator.h"
21 #include "stc-manager-util.h"
23 static gboolean stc_is_emulated = FALSE;
25 static gboolean __stc_emulator_check_env(void)
30 ret = system_info_get_platform_string("tizen.org/system/model_name", &model);
31 if (ret != SYSTEM_INFO_ERROR_NONE) {
32 STC_LOGE("Failed to get system information(%d)", ret); //LCOV_EXCL_LINE
33 return FALSE; //LCOV_EXCL_LINE
36 if (model && strncmp(model, "Emulator", strlen("Emulator")) == 0) {
37 g_free(model); //LCOV_EXCL_LINE
38 return TRUE; //LCOV_EXCL_LINE
41 g_free(model); //LCOV_EXCL_LINE
42 return FALSE; //LCOV_EXCL_LINE
45 gboolean stc_emulator_is_emulated(void)
47 return stc_is_emulated;
50 void stc_emulator_check_environment(void)
52 stc_is_emulated = __stc_emulator_check_env();
54 STC_LOGD("Emulation environment : %s",
55 stc_is_emulated ? "It's emulated" : "Not emulated");