Java 类android.content.pm.ConfigurationInfo 实例源码

项目:Android_OpenGL_Demo    文件:LessonThreeActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//            mGLSurfaceView.setRenderer(new LessonThreeRenderer());
            mGLSurfaceView.setRenderer(new NativeThreeRenderer());
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
项目:Android_OpenGL_Demo    文件:LessonFiveActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new LessonFiveGLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//            mGLSurfaceView.setRenderer(new LessonFiveRenderer(this));
            mGLSurfaceView.setRenderer(new NativeFiveRenderer(this));
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
项目:Android_OpenGL_Demo    文件:LessonTwoActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//            mGLSurfaceView.setRenderer(new LessonTwoRenderer());
            mGLSurfaceView.setRenderer(new NativeTwoRenderer());
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
项目:Android_OpenGL_Demo    文件:LessonOneActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//             mGLSurfaceView.setRenderer(new LessonOneRenderer());
            // or set a native implementation
            mGLSurfaceView.setRenderer(new NativeOneRenderer());
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
项目:Android_OpenGL_Demo    文件:LessonFourActivity.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mGLSurfaceView = new GLSurfaceView(this);

        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGLSurfaceView.setEGLContextClientVersion(2);

            // Set the renderer to out demo renderer, define below
//            mGLSurfaceView.setRenderer(new LessonFourRenderer(this));
            mGLSurfaceView.setRenderer(new NativeFourRenderer(this));
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }
        setContentView(mGLSurfaceView);
    }
项目:Android_OpenGL_Demo    文件:OpenGLES2WallpaperService.java   
void init(OpenGLEngine engine) {
    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager
            .getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) {
        // Request an OpenGL ES 2.0 compatible context.
        engine.setEGLContextClientVersion(2);

        // Set the renderer to our user-defined renderer.
        engine.setRenderer(getNewRenderer());
    } else {
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        return;
    }
}
项目:Android_OpenGL_Demo    文件:OpenGLES2WallpaperService.java   
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
    super.onCreate(surfaceHolder);

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) 
    {
        // Request an OpenGL ES 2.0 compatible context.
        setEGLContextClientVersion(2);

        // Set the renderer to our user-defined renderer.
        setRenderer(getNewRenderer());
    } 
    else 
    {
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        return;
    }           
}
项目:phonk    文件:OpenGLActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mGLSurfaceView = new GLSurfaceView(this);

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) {
        // Request an OpenGL ES 2.0 compatible context.
        mGLSurfaceView.setEGLContextClientVersion(2);

        // Set the renderer to our demo renderer, defined below.
        mGLSurfaceView.setRenderer(new LessonOneRenderer());
    } else {
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        return;
    }

    setContentView(mGLSurfaceView);
}
项目:device-info    文件:SystemInfoProviderImplTest.java   
@Before
public void setUp() throws Exception {
    mockStatic(Build.class, System.class);
    mockStaticField(Build.VERSION.class, "RELEASE", ANDROID_VERSION);
    mockStaticField(Build.VERSION.class, "SDK_INT", ANDROID_API);
    mockStaticField(Build.class, "ID", BUILD_ID);
    mockStaticField(Build.class, "CPU_ABI", ABI);
    mockStaticField(Build.class, "BOOTLOADER", BOOTLOADER);

    when(System.getProperty(SystemInfoProviderImpl.OS_NAME)).thenReturn(OS_NAME);
    when(System.getProperty(SystemInfoProviderImpl.OS_VERSION)).thenReturn(OS_VERSION);

    ActivityManager mockActivityManager = mock(ActivityManager.class);
    ConfigurationInfo mockConfigInfo = mock(ConfigurationInfo.class);
    when(mMockContext.getSystemService(Application.ACTIVITY_SERVICE)).thenReturn(mockActivityManager);
    when(mockActivityManager.getDeviceConfigurationInfo()).thenReturn(mockConfigInfo);
    when(mockConfigInfo.getGlEsVersion()).thenReturn(OPEN_GL_VERSION);


    mProvider = new SystemInfoProviderImpl(mMockContext);
}
项目:NewsMe    文件:GLSurfaceView.java   
private void checkGLESVersion() {
    if (!mGLESVersionCheckComplete) {
        // mGLESVersion = SystemProperties.getInt(
        // "ro.opengles.version",
        // ConfigurationInfo.GL_ES_VERSION_UNDEFINED);
        ActivityManager am = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        mGLESVersion = info.reqGlEsVersion;
        if (mGLESVersion >= kGLES_20) {
            mMultipleGLESContextsAllowed = true;
        }
        if (LOG_SURFACE) {
            Log.w(TAG, "checkGLESVersion mGLESVersion =" + " "
                    + mGLESVersion + " mMultipleGLESContextsAllowed = "
                    + mMultipleGLESContextsAllowed);
        }
        mGLESVersionCheckComplete = true;
    }
}
项目:Muzesto    文件:Horizon.java   
/**
 * Basic settings for component
 *
 * @param glSurfaceView   - view that will contain the component
 * @param backgroundColor - preferable background color for correct colors blending
 */
private void initView(GLSurfaceView glSurfaceView, @ColorInt int backgroundColor) {
    // check if the system supports opengl es 2.0.
    Context context = glSurfaceView.getContext();
    final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) {
        // Request an OpenGL ES 2.0 compatible context.
        glSurfaceView.setEGLContextClientVersion(2);

        // Set the renderer to our demo renderer, defined below.
        mRenderer = new BezierRenderer(glSurfaceView, backgroundColor);
        glSurfaceView.setRenderer(mRenderer);
        glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    } else {
        throw new UnsupportedOperationException();
    }
}
项目:SinaVideoSdkDemo    文件:GLSurfaceView.java   
private void checkGLESVersion() {
    if (!mGLESVersionCheckComplete) {
        // mGLESVersion = SystemProperties.getInt(
        // "ro.opengles.version",
        // ConfigurationInfo.GL_ES_VERSION_UNDEFINED);
        ActivityManager am = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        mGLESVersion = info.reqGlEsVersion;
        if (mGLESVersion >= kGLES_20) {
            mMultipleGLESContextsAllowed = true;
        }
        if (LOG_SURFACE) {
            Log.w(TAG, "checkGLESVersion mGLESVersion =" + " "
                    + mGLESVersion + " mMultipleGLESContextsAllowed = "
                    + mMultipleGLESContextsAllowed);
        }
        mGLESVersionCheckComplete = true;
    }
}
项目:under-the-hood    文件:DefaultProperties.java   
/**
 * Convince feature to add state of multiple system features.
 * Uses {@link PackageManager#hasSystemFeature(String)} call.
 * <p>
 * See https://developer.android.com/guide/topics/manifest/uses-feature-element.html#features-reference for
 * available system features.
 *
 * @param context               can be null, but will just return an empty list
 * @param labelSystemFeatureMap a map which has ui labels as key and android system feature string
 *                              (as returned as name by {@link PackageManager#getSystemAvailableFeatures()}) as value
 * @return list of page-entries (one for each map entry)
 */
public static List<PageEntry<?>> createSystemFeatureInfo(@Nullable Context context, Map<CharSequence, String> labelSystemFeatureMap) {
    List<PageEntry<?>> entries = new ArrayList<>();
    if (context != null) {

        for (Map.Entry<CharSequence, String> entry : labelSystemFeatureMap.entrySet()) {
            boolean supported;
            if (entry.getValue().matches("^-?\\d+$")) {
                final ConfigurationInfo configurationInfo = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getDeviceConfigurationInfo();
                supported = configurationInfo.reqGlEsVersion >= Integer.valueOf(entry.getValue());
            } else {
                supported = context.getPackageManager().hasSystemFeature(entry.getValue());
            }
            entries.add(Hood.get().createPropertyEntry(entry.getKey(), String.valueOf(supported)));
        }
    }
    return entries;
}
项目:BLE_Fun    文件:GlFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();
    final View v = inflater.inflate(getContentViewId(), container, false);

    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();
    if (info.reqGlEsVersion < 0x20000)
        throw new Error("OpenGL ES 2.0 is not supported by this device");

    loading = v.findViewById(R.id.loading);
    gLView = (GLSurfaceView) v.findViewById(R.id.gl);
    renderer = new ModelRenderer(context);
    renderer.setSurfaceView(gLView);
    gLView.setRenderer(renderer);

    loader.loadModel(getActivity(), this);
    return v;
}
项目:StarWars.Android    文件:TilesFrameLayout.java   
private void initGlSurfaceView() {
    mGLSurfaceView = new StarWarsTilesGLSurfaceView(getContext());
    mGLSurfaceView.setBackgroundColor(Color.TRANSPARENT);

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getContext().getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) {
        // Request an OpenGL ES 2.0 compatible context.
        mGLSurfaceView.setEGLContextClientVersion(2);

        mRenderer = new StarWarsRenderer(mGLSurfaceView, this, mAnimationDuration, mNumberOfTilesX);
        mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
        mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
        mGLSurfaceView.setRenderer(mRenderer);
        mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
        mGLSurfaceView.setZOrderOnTop(true);
    } else {
        throw new UnsupportedOperationException();
    }
}
项目:binea_project_for_android    文件:BaseOpenglActivity.java   
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGlSurfaceView = new GLSurfaceView(this);

    final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo deviceConfigurationInfo = am.getDeviceConfigurationInfo();
    mIsSupportedEs2 =
            deviceConfigurationInfo.reqGlEsVersion >= 0x20000 || (Build.VERSION.SDK_INT
                    >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
                    && (Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith(
                    "unknow") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains(
                    "Emulator") || Build.MODEL.contains("Android SDK built for x86")));
    mGlSurfaceView.setEGLContextClientVersion(2);
    if (mIsSupportedEs2) {
        setGlSurfaceViewRenderer();
        mRenderSet = true;
    } else {
        Toast.makeText(this, "This device does not support OpenGl ES 2.0", Toast.LENGTH_SHORT)
                .show();
        return;
    }
    setContentView(mGlSurfaceView);
}
项目:android-livewallpaper    文件:PuvoGLWallpaperService.java   
@Override
public void onCreate(SurfaceHolder surfaceHolder)
{
    super.onCreate(surfaceHolder);
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) {
        puvoGLSurfaceView = new PuvoGLSurfaceView(PuvoGLWallpaperService.this);

        setEGLContextClientVersion(2);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            setPreserveEGLContextOnPause(true);
            setEGConfigChooser();
        }
        setRenderer(getNewRenderer());
        setRenderMode();
    } else {
        throw new RuntimeException("system doesn't support OpenGL ES 2.0");
    }
}
项目:MCESensorTagWorkshopFull    文件:GlFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();
    final View v = inflater.inflate(getContentViewId(), container, false);

    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();
    if (info.reqGlEsVersion < 0x20000)
        throw new Error("OpenGL ES 2.0 is not supported by this device");

    loading = v.findViewById(R.id.loading);
    gLView = (GLSurfaceView) v.findViewById(R.id.gl);
    renderer = new ModelRenderer(context);
    renderer.setSurfaceView(gLView);
    gLView.setRenderer(renderer);

    loader.loadModel(getActivity(), this);
    return v;
}
项目:PortalLW    文件:RajawaliFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSurfaceView = new GLSurfaceView(this.getActivity());

    ActivityManager am = (ActivityManager) this.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    if (checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if (info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);

    if (mMultisamplingEnabled)
        createMultisampleConfig();
}
项目:PortalLW    文件:RajawaliActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSurfaceView = new GLSurfaceView(this);

    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    if (checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if (info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);
    mLayout = new FrameLayout(this);
    mLayout.addView(mSurfaceView);

    if (mMultisamplingEnabled)
        createMultisampleConfig();

    setContentView(mLayout);
}
项目:PortalLW    文件:RajawaliFragmentActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSurfaceView = new GLSurfaceView(this);

    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    if (checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if (info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);
    mLayout = new FrameLayout(this);
    mLayout.addView(mSurfaceView);

    if (mMultisamplingEnabled)
        createMultisampleConfig();

    setContentView(mLayout);
}
项目:IRobot-Android    文件:RajawaliFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSurfaceView = new GLSurfaceView(this.getActivity());

    ActivityManager am = (ActivityManager)this.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    if(checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if(info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);

    if(mMultisamplingEnabled)
        createMultisampleConfig();
}
项目:IRobot-Android    文件:RajawaliActivity.java   
protected void createSurfaceView()
{
    mSurfaceView = new GLSurfaceView(this);

    ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
    if(checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if(info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);

    mLayout = new FrameLayout(this);
    mLayout.addView(mSurfaceView);

    if(mMultisamplingEnabled)
        createMultisampleConfig();

    setContentView(mLayout);
}
项目:opengl    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    // Turn off the window's title bar
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    super.onCreate(savedInstanceState);
    mGLSurfaceView = new GLSurfaceView(this);
    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
    if (supportsEs2)
    {
        // Request an OpenGL ES 2.0 compatible context.
        mGLSurfaceView.setEGLContextClientVersion(2);
        // Set the renderer to our demo renderer, defined below.
        mGLSurfaceView.setRenderer(new LessonOneRenderer());
    }
    else
    {
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        return;
    }
    setContentView(mGLSurfaceView);
}
项目:java6-android-glframework    文件:AndroidGLESUtil.java   
public static IGLVersion getGLVersion(Context context)
{
   IGLVersion glVersion = XeGLUnknown.GL_UNKNOWN;

   final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
   final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();

   String glesVersionString = configurationInfo.getGlEsVersion();

   // This is messy...
   if (XeGLES2.GLES2_0.versionString.equals(glesVersionString))
   {
      glVersion = XeGLES2.GLES2_0;
   }
   else if (XeGLES3.GLES3_0.versionString.equals(glesVersionString))
   {
      glVersion = XeGLES3.GLES3_0;
   }
   else if (XeGLES3.GLES3_1.versionString.equals(glesVersionString))
   {
      glVersion = XeGLES3.GLES3_1;
   }

   return glVersion;
}
项目:Unofficial_sensortag_app    文件:GlFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();
    final View v = inflater.inflate(getContentViewId(), container, false);

    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();
    if (info.reqGlEsVersion < 0x20000)
        throw new Error("OpenGL ES 2.0 is not supported by this device");

    loading = v.findViewById(R.id.loading);
    gLView = (GLSurfaceView) v.findViewById(R.id.gl);
    renderer = new ModelRenderer(context);
    renderer.setSurfaceView(gLView);
    gLView.setRenderer(renderer);

    loader.loadModel(getActivity(), this);
    return v;
}
项目:osmdroid    文件:MapFactory.java   
/**
 * Check whether Google Maps v2 is supported on this device.
 */
public static boolean isGoogleMapsV2Supported(final Context aContext) {
    try {
        // first check if Google Play Services is available
        int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(aContext);
        if (resultCode == ConnectionResult.SUCCESS) {
            // then check if OpenGL ES 2.0 is available
            final ActivityManager activityManager =
                    (ActivityManager) aContext.getSystemService(Context.ACTIVITY_SERVICE);
            final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
            return configurationInfo.reqGlEsVersion >= 0x20000;
        }
    } catch (Throwable e) {
    }
    return false;
}
项目:loopback-android-getting-started    文件:LessonThreeFragment.java   
boolean detectGoogleMapsSupport() {
    // 1. Check for OpenGL ES 2.0
    final ActivityManager activityManager =
            (ActivityManager)getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo =
            activityManager.getDeviceConfigurationInfo();
    if (configurationInfo.reqGlEsVersion < 0x20000) {
        Log.w("LessonThreeFragment", "Device does not support OpenGL ES 2.0");
        return false;
    }

    // 2. Check for Google Play Services availability
    final int playServicesStatus =
            GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
    if (playServicesStatus != ConnectionResult.SUCCESS
            && Build.HARDWARE.contains("golfdish")) {
        // It's not possible to install or update Google Play on an emulator
        Log.w("LessonThreeFragment",
                "Detected an emulator with missing or outdated Play Services.");
        return false;
    }

    Log.i("LessonThreeFragment", "Locations will be displayed in Google Maps.");
    return true;
}
项目:loopback-android-getting-started    文件:LessonThreeFragment.java   
boolean detectGoogleMapsSupport() {
    // 1. Check for OpenGL ES 2.0
    final ActivityManager activityManager =
            (ActivityManager)getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo =
            activityManager.getDeviceConfigurationInfo();
    if (configurationInfo.reqGlEsVersion < 0x20000) {
        Log.w("LessonThreeFragment", "Device does not support OpenGL ES 2.0");
        return false;
    }

    // 2. Check for Google Play Services availability
    final int playServicesStatus =
            GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
    if (playServicesStatus != ConnectionResult.SUCCESS
            && Build.HARDWARE.contains("golfdish")) {
        // It's not possible to install or update Google Play on an emulator
        Log.w("LessonThreeFragment",
                "Detected an emulator with missing or outdated Play Services.");
        return false;
    }

    Log.i("LessonThreeFragment", "Locations will be displayed in Google Maps.");
    return true;
}
项目:MarsImagesAndroid    文件:RajawaliFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSurfaceView = new GLSurfaceView(this.getActivity());

    ActivityManager am = (ActivityManager)this.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
    if(checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if(info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);

    if(mMultisamplingEnabled)
        createMultisampleConfig();
}
项目:MarsImagesAndroid    文件:RajawaliActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSurfaceView = new GLSurfaceView(this);

    ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
    if(checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if(info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);
    mLayout = new FrameLayout(this);
    mLayout.addView(mSurfaceView);

    if(mMultisamplingEnabled)
        createMultisampleConfig();

    setContentView(mLayout);
}
项目:MarsImagesAndroid    文件:RajawaliFragmentActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSurfaceView = new GLSurfaceView(this);

    ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
    if(checkOpenGLVersion) {
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
        if(info.reqGlEsVersion < 0x20000)
            throw new Error("OpenGL ES 2.0 is not supported by this device");
    }
    mSurfaceView.setEGLContextClientVersion(2);
    mLayout = new FrameLayout(this);
    mLayout.addView(mSurfaceView);

    if(mMultisamplingEnabled)
        createMultisampleConfig();

    setContentView(mLayout);
}
项目:BleSensorTag    文件:GlFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();
    final View v = inflater.inflate(getContentViewId(), container, false);

    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();
    if (info.reqGlEsVersion < 0x20000)
        throw new Error("OpenGL ES 2.0 is not supported by this device");

    loading = v.findViewById(R.id.loading);
    gLView = (GLSurfaceView) v.findViewById(R.id.gl);
    renderer = new ModelRenderer(context);
    renderer.setSurfaceView(gLView);
    gLView.setRenderer(renderer);

    loader.loadModel(getActivity(), this);
    return v;
}
项目:CSipSimple    文件:ViEAndroidGLES20.java   
public static boolean IsSupported(Context context) {
    ActivityManager am =
            (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();
    if(info.reqGlEsVersion >= 0x20000) {
        // Open GL ES 2.0 is supported.
        return true;
    }
    return false;
}
项目:Fatigue-Detection    文件:GPUImage.java   
/**
 * Checks if OpenGL ES 2.0 is supported on the current device.
 *
 * @param context the context
 * @return true, if successful
 */
private boolean supportsOpenGLES2(final Context context) {
    final ActivityManager activityManager = (ActivityManager)
            context.getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo =
            activityManager.getDeviceConfigurationInfo();
    return configurationInfo.reqGlEsVersion >= 0x20000;
}
项目:3D_Wallpaper    文件:GLWallpaperService.java   
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
    super.onCreate(surfaceHolder);
    glSurfaceView = new WallpaperGLSurfaceView(GLWallpaperService.this);

    ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();

    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000
            || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 &&
            (Build.FINGERPRINT.startsWith("generic")
                    || Build.FINGERPRINT.startsWith("unknown")
                    || Build.MODEL.contains("google_sdk")
                    || Build.MODEL.contains("Emulator")
                    || Build.MODEL.contains("Android SDK built for x86")));

    particlesRenderer = new ParticlesRenderer(GLWallpaperService.this);
    if (supportsEs2) {
        glSurfaceView.setEGLContextClientVersion(2);
        glSurfaceView.setRenderer(particlesRenderer);
        rendererSet = true;
    } else {
        Toast.makeText(GLWallpaperService.this, "not support egl 2.0", Toast.LENGTH_LONG);
        return;
    }

    DisplayMetrics dm = getResources().getDisplayMetrics();
    screenX = dm.widthPixels;
    screenY = dm.heightPixels;
}
项目:Android_OpenGL_Demo    文件:NativeLesson1Activity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    boolean supportES2 = configurationInfo.reqGlEsVersion >= 0x2000;
    if (supportES2) {
        mGlSurfaceView = new GLSurfaceView(this);
        mGlSurfaceView.setEGLContextClientVersion(2);
        mGlSurfaceView.setRenderer(new RendererWrapper());
        rendererSet = true;
        setContentView(mGlSurfaceView);
    }
}
项目:Android_OpenGL_Demo    文件:LessonEightActivity.java   
@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mGlSurfaceView = new LessonEightGLSurfaceView(this);
        setContentView(mGlSurfaceView);
        // Check if the system support OpenGL ES 2.0
        final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
        final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

        if (supportsEs2) {
            // Request an OpenGL ES 2.0 compatible context.
            mGlSurfaceView.setEGLContextClientVersion(2);

            final DisplayMetrics displayMetrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);

            // Set the renderer to our demo renderer, defined below.
//            mRender = (Action) new LessonEightRenderer(this);
            mRender = (Action) new NativeEightRenderer(this);
            mGlSurfaceView.setRenderer((GLSurfaceView.Renderer) mRender, displayMetrics.density);
        } else {
            // This is where you could create an OpenGL ES 1.x compatible
            // renderer if you wanted to support both ES 1 and ES 2
            return;
        }

    }
项目:Android_OpenGL_Demo    文件:OpenGLES2WallpaperService.java   
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
    super.onCreate(surfaceHolder);

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) 
    {
        // Request an OpenGL ES 2.0 compatible context.
        setEGLContextClientVersion(2);

        // On Honeycomb+ devices, this improves the performance when
        // leaving and resuming the live wallpaper.
        setPreserveEGLContextOnPause(true);

        // Set the renderer to our user-defined renderer.
        setRenderer(getNewRenderer());
    } 
    else 
    {
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        return;
    }           
}
项目:Android_OpenGL_Demo    文件:LessonThreeActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);

    mGLSurfaceView = new GLSurfaceView(this);

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

    if (supportsEs2) 
    {
        // Request an OpenGL ES 2.0 compatible context.
        mGLSurfaceView.setEGLContextClientVersion(2);

        // Set the renderer to our demo renderer, defined below.
        mGLSurfaceView.setRenderer(new LessonThreeRenderer());
    } 
    else 
    {
        // This is where you could create an OpenGL ES 1.x compatible
        // renderer if you wanted to support both ES 1 and ES 2.
        return;
    }

    setContentView(mGLSurfaceView);
}