Search in sources :

Example 41 with FeatureInfo

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";
}
Also used : PackageManager(android.content.pm.PackageManager) FeatureInfo(android.content.pm.FeatureInfo)

Example 42 with FeatureInfo

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();
}
Also used : FeatureInfo(android.content.pm.FeatureInfo) Test(org.junit.Test)

Aggregations

FeatureInfo (android.content.pm.FeatureInfo)42 PackageManager (android.content.pm.PackageManager)23 PrintWriter (java.io.PrintWriter)4 ArrayList (java.util.ArrayList)4 FileReader (java.io.FileReader)3 IOException (java.io.IOException)3 NonNull (android.annotation.NonNull)2 IntentFilterVerificationInfo (android.content.pm.IntentFilterVerificationInfo)2 PackageParser (android.content.pm.PackageParser)2 ParceledListSlice (android.content.pm.ParceledListSlice)2 ArrayMap (android.util.ArrayMap)2 FastXmlSerializer (com.android.internal.util.FastXmlSerializer)2 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)2 BufferedOutputStream (java.io.BufferedOutputStream)2 BufferedReader (java.io.BufferedReader)2 FileOutputStream (java.io.FileOutputStream)2 Map (java.util.Map)2 XmlSerializer (org.xmlpull.v1.XmlSerializer)2 RemoteException (android.os.RemoteException)1 NonNull (android.support.annotation.NonNull)1