2 * Copyright (C) 2012-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
21 #include "AndroidFeatures.h"
23 #include "utils/log.h"
25 #include <cpu-features.h>
27 bool CAndroidFeatures::HasNeon()
29 if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM)
30 return ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0);
34 int CAndroidFeatures::GetVersion()
36 static int version = -1;
43 CXBMCApp::AttachCurrentThread(&jenv, NULL);
45 jclass jcOsBuild = jenv->FindClass("android/os/Build$VERSION");
46 if (jcOsBuild == NULL)
48 CLog::Log(LOGERROR, "%s: Error getting class android.os.Build.VERSION", __PRETTY_FUNCTION__);
52 jint iSdkVersion = jenv->GetStaticIntField(jcOsBuild, jenv->GetStaticFieldID(jcOsBuild, "SDK_INT", "I"));
53 CLog::Log(LOGDEBUG, "%s: android.os.Build.VERSION %d", __PRETTY_FUNCTION__, (int)iSdkVersion);
57 // <= 15 IceCreamSandwich
59 version = iSdkVersion;
61 jenv->DeleteLocalRef(jcOsBuild);
62 CXBMCApp::DetachCurrentThread();
67 std::string CAndroidFeatures::GetLibiomxName()
69 std::string strOMXLibName;
70 int version = GetVersion();
74 strOMXLibName = "libiomx-10.so";
76 else if (version <= 13)
77 strOMXLibName = "libiomx-13.so";
79 else if (version <= 15)
80 strOMXLibName = "libiomx-14.so";
82 strOMXLibName = "unknown";