android.content.pm.ConfigurationInfo Java Examples
The following examples show how to use
android.content.pm.ConfigurationInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultProperties.java From under-the-hood with Apache License 2.0 | 6 votes |
/** * 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; }
Example #2
Source File: GlFragment.java From BleSensorTag with MIT License | 6 votes |
@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; }
Example #3
Source File: MapFactory.java From osmdroid with Apache License 2.0 | 6 votes |
/** * 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; }
Example #4
Source File: AndroidGLESUtil.java From java6-android-glframework with Mozilla Public License 2.0 | 6 votes |
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; }
Example #5
Source File: MainActivity.java From opengl with Apache License 2.0 | 6 votes |
@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); }
Example #6
Source File: TilesFrameLayout.java From StarWars.Android with MIT License | 6 votes |
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(); } }
Example #7
Source File: Horizon.java From Muzesto with GNU General Public License v3.0 | 6 votes |
/** * 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(); } }
Example #8
Source File: GLSurfaceView.java From NewsMe with Apache License 2.0 | 6 votes |
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; } }
Example #9
Source File: GlUtil.java From sealrtc-android with MIT License | 6 votes |
/** * Prefer OpenGL ES 3.0, otherwise 2.0 * * @param context * @return */ public static int getSupportGLVersion(Context context) { final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); int version = configurationInfo.reqGlEsVersion >= 0x30000 ? 3 : 2; String glEsVersion = configurationInfo.getGlEsVersion(); Log.d( TAG, "reqGlEsVersion: " + Integer.toHexString(configurationInfo.reqGlEsVersion) + ", glEsVersion: " + glEsVersion + ", return: " + version); return version; }
Example #10
Source File: ViEAndroidGLES20.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
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; }
Example #11
Source File: ViEAndroidGLES20.java From webrtc-app-mono with BSD 3-Clause "New" or "Revised" License | 5 votes |
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; }
Example #12
Source File: ActivityManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Get the device configuration attributes. */ public ConfigurationInfo getDeviceConfigurationInfo() { try { return getService().getDeviceConfigurationInfo(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #13
Source File: GLWallpaperService.java From alynx-live-wallpaper with Apache License 2.0 | 5 votes |
private void createGLSurfaceView() { if (glSurfaceView != null) { glSurfaceView.onDestroy(); glSurfaceView = null; } glSurfaceView = new GLWallpaperSurfaceView(context); final ActivityManager activityManager = (ActivityManager)getSystemService( Context.ACTIVITY_SERVICE ); if (activityManager == null) { throw new RuntimeException("Cannot get ActivityManager"); } final ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo(); if (configInfo.reqGlEsVersion >= 0x30000) { Utils.debug(TAG, "Support GLESv3"); glSurfaceView.setEGLContextClientVersion(3); renderer = new GLES30WallpaperRenderer(context); } else if (configInfo.reqGlEsVersion >= 0x20000) { Utils.debug(TAG, "Fallback to GLESv2"); glSurfaceView.setEGLContextClientVersion(2); renderer = new GLES20WallpaperRenderer(context); } else { Toast.makeText(context, R.string.gles_version, Toast.LENGTH_LONG).show(); throw new RuntimeException("Needs GLESv2 or higher"); } glSurfaceView.setPreserveEGLContextOnPause(true); glSurfaceView.setRenderer(renderer); // On demand render will lead to black screen. glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); }
Example #14
Source File: ARView.java From geoar-app with Apache License 2.0 | 5 votes |
private void init() { if (isInEditMode()) { return; } mCameraView = new CameraView(getContext()); addView(mCameraView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); final ActivityManager activityManager = (ActivityManager) getContext() .getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo config = activityManager .getDeviceConfigurationInfo(); if (config.reqGlEsVersion >= 0x20000 || Build.PRODUCT.startsWith("sdk")) { // Add ARSurfaceView only if OpenGL ES Version 2 supported mARSurfaceView = new ARSurfaceView(this); mARSurfaceView.setKeepScreenOn(true); mARSurfaceView.setZOrderMediaOverlay(true); addView(mARSurfaceView, new FrameLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); } mCanvasOverlayView = new ARCanvasSurfaceView(this); addView(mCanvasOverlayView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); }
Example #15
Source File: MainActivity.java From opengl with Apache License 2.0 | 5 votes |
@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); }
Example #16
Source File: MainActivity.java From opengl with Apache License 2.0 | 5 votes |
private boolean detectOpenGLES30() { ActivityManager am = ( ActivityManager ) getSystemService ( Context.ACTIVITY_SERVICE ); ConfigurationInfo info = am.getDeviceConfigurationInfo(); return ( info.reqGlEsVersion >= 0x30000 ); }
Example #17
Source File: AndEngine.java From tilt-game-android with MIT License | 5 votes |
private static void checkGLES20Support(final Context pContext) throws DeviceNotSupportedException { final ActivityManager activityManager = (ActivityManager) pContext.getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); if (configurationInfo.reqGlEsVersion < 0x20000) { throw new DeviceNotSupportedException(DeviceNotSupportedCause.GLES2_UNSUPPORTED); } }
Example #18
Source File: Utils.java From Android-Applications-Info with Apache License 2.0 | 5 votes |
public static String getInputFeaturesString(int flag) { String string = ""; if ((flag & ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV) != 0) string += "Five way nav"; if ((flag & ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD) != 0) string += (string.length() == 0 ? "" : "|") + "Hard keyboard"; return string.length() == 0 ? "null" : string; }
Example #19
Source File: DetailFragment.java From Android-Applications-Info with Apache License 2.0 | 5 votes |
/** * Boring view inflation / creation */ private View getConfigurationView(ViewGroup viewGroup, View convertView, int index) { ViewHolder viewHolder; if (!checkIfConvertViewMatch(convertView, CONFIGURATION)) { convertView = mLayoutInflater.inflate(R.layout.detail_features, viewGroup); viewHolder = new ViewHolder(); viewHolder.currentViewType = CONFIGURATION; viewHolder.textView1 = (TextView) convertView.findViewById(R.id.name); viewHolder.textView2 = (TextView) convertView.findViewById(R.id.flags); convertView.findViewById(R.id.gles_ver).setVisibility(View.GONE); } else { viewHolder = (ViewHolder) convertView.getTag(); } final ConfigurationInfo configurationInfo = mPackageInfo.configPreferences[index]; convertView.setBackgroundColor(index % 2 == 0 ? mColorGrey1 : mColorGrey2); //GLES ver viewHolder.textView1.setText(getString(R.string.gles_ver) + ": " + configurationInfo.reqGlEsVersion); //Falg viewHolder.textView2.setText(getString(R.string.input_features) + ": " + Utils.getInputFeaturesString(configurationInfo.reqInputFeatures)); return convertView; }
Example #20
Source File: DemoActivity.java From StarWars.Android with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo); ButterKnife.bind(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. ParticleSystemRenderer mRenderer = new ParticleSystemRenderer(mGlSurfaceView); mGlSurfaceView.setRenderer(mRenderer); mGlSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); } else { throw new UnsupportedOperationException(); } if (savedInstanceState == null) { showGreetings(); } }
Example #21
Source File: ActivityManager.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
/** * Get the device configuration attributes. */ public ConfigurationInfo getDeviceConfigurationInfo() { try { return getService().getDeviceConfigurationInfo(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #22
Source File: Device.java From unity-ads-android with Apache License 2.0 | 5 votes |
public static String getGLVersion () { if (ClientProperties.getApplicationContext() != null) { final ActivityManager activityManager = (ActivityManager)ClientProperties.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE); if (activityManager != null) { final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); if (configurationInfo != null) { return configurationInfo.getGlEsVersion(); } } } return null; }
Example #23
Source File: GPUImage.java From SimpleVideoEditor with Apache License 2.0 | 5 votes |
/** * 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; }
Example #24
Source File: VideoView.java From NewsMe with Apache License 2.0 | 5 votes |
public static boolean IsSupported(Context context) { LogS.d(TAG, " IsSupported()"); 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; }
Example #25
Source File: GlUtil.java From PLDroidShortVideo with Apache License 2.0 | 5 votes |
public static int getSupportGLVersion(Context context) { final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); int version = configurationInfo.reqGlEsVersion >= 0x30000 ? 3 : 2; String glEsVersion = configurationInfo.getGlEsVersion(); Log.e(TAG, "reqGlEsVersion: " + Integer.toHexString(configurationInfo.reqGlEsVersion) + ", glEsVersion:" + glEsVersion); return version; }
Example #26
Source File: GPUImage.java From Fatigue-Detection with MIT License | 5 votes |
/** * 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; }
Example #27
Source File: GLSurfaceView.java From EZFilter with MIT License | 5 votes |
private void checkGLESVersion() { if (!mGLESVersionCheckComplete) { mGLESVersion = SystemProperties.getInt( "ro.opengles.version", ConfigurationInfo.GL_ES_VERSION_UNDEFINED); if (mGLESVersion >= kGLES_20) { mMultipleGLESContextsAllowed = true; } if (LOG_SURFACE) { Log.w(TAG, "checkGLESVersion mGLESVersion =" + " " + mGLESVersion + " mMultipleGLESContextsAllowed = " + mMultipleGLESContextsAllowed); } mGLESVersionCheckComplete = true; } }
Example #28
Source File: GLTextureView.java From EZFilter with MIT License | 5 votes |
private void checkGLESVersion() { if (!mGLESVersionCheckComplete) { mGLESVersion = SystemProperties.getInt("ro.opengles.version", ConfigurationInfo.GL_ES_VERSION_UNDEFINED); if (mGLESVersion >= kGLES_20) { mMultipleGLESContextsAllowed = true; } if (LOG_SURFACE) { Log.w(TAG, "checkGLESVersion mGLESVersion =" + " " + mGLESVersion + " mMultipleGLESContextsAllowed = " + mMultipleGLESContextsAllowed); } mGLESVersionCheckComplete = true; } }
Example #29
Source File: ViEAndroidGLES20.java From LiveVideo with Apache License 2.0 | 5 votes |
public static boolean IsSupported(Context context) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo info = am.getDeviceConfigurationInfo(); if (info.reqGlEsVersion >= 0x20000) { Log.w(TAG, "IsSupported true"); // Open GL ES 2.0 is supported. return true; } Log.w(TAG, "IsSupported false"); return false; }
Example #30
Source File: MainActivity.java From opengl with Apache License 2.0 | 4 votes |
private boolean detectOpenGLES30() { ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo info = am.getDeviceConfigurationInfo(); return (info.reqGlEsVersion >= 0x30000); }