use of android.content.pm.FeatureInfo in project countly-sdk-js by Countly.
the class CrashDetails method getOpenGL.
/**
* Returns the current device openGL version.
*/
static String getOpenGL(Context context) {
PackageManager packageManager = context.getPackageManager();
FeatureInfo[] featureInfos = packageManager.getSystemAvailableFeatures();
if (featureInfos != null && featureInfos.length > 0) {
for (FeatureInfo featureInfo : featureInfos) {
// Null feature name means this feature is the open gl es version feature.
if (featureInfo.name == null) {
if (featureInfo.reqGlEsVersion != FeatureInfo.GL_ES_VERSION_UNDEFINED) {
return Integer.toString((featureInfo.reqGlEsVersion & 0xffff0000) >> 16);
} else {
// Lack of property means OpenGL ES version 1
return "1";
}
}
}
}
return "1";
}
use of android.content.pm.FeatureInfo in project robolectric by robolectric.
the class ShadowPackageManagerTest method getSystemAvailableFeatures.
@Test
public void getSystemAvailableFeatures() {
assertThat(packageManager.getSystemAvailableFeatures()).isNull();
FeatureInfo feature = new FeatureInfo();
feature.reqGlEsVersion = 0x20000;
feature.flags = FeatureInfo.FLAG_REQUIRED;
shadowOf(packageManager).addSystemAvailableFeature(feature);
assertThat(packageManager.getSystemAvailableFeatures()).asList().contains(feature);
shadowOf(packageManager).clearSystemAvailableFeatures();
assertThat(packageManager.getSystemAvailableFeatures()).isNull();
}
Aggregations