List of usage examples for android.app ActivityManager getDeviceConfigurationInfo
public ConfigurationInfo getDeviceConfigurationInfo()
From source file:Main.java
@SuppressWarnings("unused") public static String getOpenGLVersion(Context context) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo info = am.getDeviceConfigurationInfo(); return info.getGlEsVersion(); }
From source file:Main.java
/** * Gets the openGL version that is actually available on this device (ie GL_VERSION_31). * * @param context/*from w ww . j a v a2s. c o m*/ * @return */ public static int getDeviceGLVersion(Context context) { final ActivityManager activityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); return configurationInfo.reqGlEsVersion; }
From source file:Main.java
public static boolean useMapsV2(final Context context) { if (Build.VERSION.SDK_INT >= 8) { final ActivityManager activityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000; return supportsEs2; }//from w w w . j av a 2 s . c o m return false; }
From source file:cn.videochat.VideoChat.java
public static boolean IsSupportOpenGLES2(Context context) { ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); return configurationInfo.reqGlEsVersion >= 0x20000; }
From source file:com.manning.androidhacks.hack032.MainActivity.java
private boolean detectOpenGLES20() { ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo info = am.getDeviceConfigurationInfo(); return (info.reqGlEsVersion >= 0x20000); }
From source file:com.projecto.mapav2.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try {/* w w w . java2 s . co m*/ setContentView(R.layout.activity_main); mapa = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); if (mapa != null) { mapa.addMarker(new MarkerOptions().position(LOCATION_SURRREY).title("Find me here!")); mapa.setMyLocationEnabled(true); mapa.setTrafficEnabled(true); mapa.setMapType(GoogleMap.MAP_TYPE_HYBRID); } gps = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context); GlEsVersion = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)) .getDeviceConfigurationInfo().getGlEsVersion(); try { versionCode = context.getPackageManager().getPackageInfo("com.android.vending", 0).versionCode; versionCode2 = context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode; } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { pm = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA).metaData.getString("com.google.android.maps.v2.API_KEY"); } catch (NameNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000; Toast.makeText(MainActivity.this, "isGooglePlayServicesAvailable" + gps + "\n" + "GlEsVersion " + GlEsVersion + "\n" + "versionCode Vending" + versionCode + "\nversionCode GMS " + versionCode2 + "\n" + "getPackageManager " + pm + "\n" + "supportsEs2 " + supportsEs2 + "\n" + "getVersionFromPackageManager " + getVersionFromPackageManager(this) + "\n", Toast.LENGTH_LONG).show(); } catch (Exception e) { e.printStackTrace(); Log.d(INPUT_SERVICE, e.toString()); } int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context); Log.e("Maps", "Result int value::" + result); switch (result) { case ConnectionResult.SUCCESS: Log.e("Maps", "RESULT:: SUCCESS"); break; case ConnectionResult.DEVELOPER_ERROR: Log.e("Maps", "RESULT:: DE"); break; case ConnectionResult.INTERNAL_ERROR: Log.e("Maps", "RESULT:: IE"); break; case ConnectionResult.INVALID_ACCOUNT: Log.e("Maps", "RESULT:: IA"); break; case ConnectionResult.NETWORK_ERROR: Log.e("Maps", "RESULT:: NE"); break; case ConnectionResult.RESOLUTION_REQUIRED: Log.e("Maps", "RESULT:: RR"); break; case ConnectionResult.SERVICE_DISABLED: Log.e("Maps", "RESULT:: SD"); break; case ConnectionResult.SERVICE_INVALID: Log.e("Maps", "RESULT:: SI"); break; case ConnectionResult.SERVICE_MISSING: Log.e("Maps", "RESULT:: SM"); break; case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: Log.e("Maps", "RESULT:: SVUR"); break; case ConnectionResult.SIGN_IN_REQUIRED: Log.e("Maps", "RESULT:: SIR"); break; default: break; } mapa.setMapType(GoogleMap.MAP_TYPE_NORMAL); mapa.setMyLocationEnabled(true); Log.e("Maps", "------EOC-------"); }
From source file:org.godotengine.godot.Godot.java
public int getGLESVersionCode() { ActivityManager am = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo deviceInfo = am.getDeviceConfigurationInfo(); return deviceInfo.reqGlEsVersion; }
From source file:org.uoyabause.android.YabauseHandler.java
private void readPreferences() { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); boolean extmemory = sharedPref.getBoolean("pref_extend_internal_memory", true); YabauseRunnable.enableExtendedMemory(extmemory ? 1 : 0); Log.d(TAG, "enable Extended Memory " + extmemory); YabauseRunnable.enableRotateScreen(sharedPref.getBoolean("pref_rotate_screen", false) ? 1 : 0); boolean fps = sharedPref.getBoolean("pref_fps", false); YabauseRunnable.enableFPS(fps ? 1 : 0); Log.d(TAG, "enable FPS " + fps); boolean frameskip = sharedPref.getBoolean("pref_frameskip", true); YabauseRunnable.enableFrameskip(frameskip ? 1 : 0); Log.d(TAG, "enable enableFrameskip " + frameskip); String cpu = sharedPref.getString("pref_cpu", "2"); Integer icpu = new Integer(cpu); YabauseRunnable.setCpu(icpu.intValue()); Log.d(TAG, "cpu " + icpu.toString()); String sfilter = sharedPref.getString("pref_filter", "0"); Integer ifilter = new Integer(sfilter); YabauseRunnable.setFilter(ifilter);//from w w w .ja va2 s . c o m Log.d(TAG, "setFilter " + ifilter.toString()); String sPg = sharedPref.getString("pref_polygon_generation", "0"); Integer iPg = new Integer(sPg); YabauseRunnable.setPolygonGenerationMode(iPg); Log.d(TAG, "setPolygonGenerationMode " + iPg.toString()); boolean audioout = sharedPref.getBoolean("pref_audio", true); if (audioout) { audio.unmute(audio.USER); } else { audio.mute(audio.USER); } Log.d(TAG, "Audio " + audioout); String bios = sharedPref.getString("pref_bios", ""); if (bios.length() > 0) { YabauseStorage storage = YabauseStorage.getStorage(); biospath = storage.getBiosPath(bios); } else biospath = ""; Log.d(TAG, "bios " + bios); String cart = sharedPref.getString("pref_cart", ""); if (cart.length() > 0) { Integer i = new Integer(cart); carttype = i.intValue(); } else carttype = -1; Log.d(TAG, "cart " + cart); final ActivityManager activityManager = (ActivityManager) getSystemService(this.ACTIVITY_SERVICE); final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo(); final boolean supportsEs3 = configurationInfo.reqGlEsVersion >= 0x30000; String video; if (supportsEs3) { video = sharedPref.getString("pref_video", "1"); } else { video = sharedPref.getString("pref_video", "2"); } if (video.length() > 0) { Integer i = new Integer(video); video_interface = i.intValue(); } else { video_interface = -1; } Log.d(TAG, "video " + video); // InputDevice String selInputdevice = sharedPref.getString("pref_player1_inputdevice", "65535"); padm = PadManager.getPadManager(); Log.d(TAG, "input " + selInputdevice); // First time if (selInputdevice.equals("65535")) { // if game pad is connected use it. if (padm.getDeviceCount() > 0) { padm.setPlayer1InputDevice(null); Editor editor = sharedPref.edit(); editor.putString("pref_player1_inputdevice", padm.getId(0)); editor.commit(); // if no game pad is detected use on-screen game pad. } else { Editor editor = sharedPref.edit(); editor.putString("pref_player1_inputdevice", Integer.toString(-1)); editor.commit(); } } YabausePad pad = (YabausePad) findViewById(R.id.yabause_pad); if (padm.getDeviceCount() > 0 && !selInputdevice.equals("-1")) { pad.show(false); Log.d(TAG, "ScreenPad Disable"); padm.setPlayer1InputDevice(selInputdevice); } else { pad.show(true); Log.d(TAG, "ScreenPad Enable"); padm.setPlayer1InputDevice(null); } String selInputdevice2 = sharedPref.getString("pref_player2_inputdevice", "65535"); if (!selInputdevice.equals("65535")) { padm.setPlayer2InputDevice(selInputdevice2); } else { padm.setPlayer2InputDevice(null); } Log.d(TAG, "input " + selInputdevice2); Log.d(TAG, "getGamePath " + getGamePath()); Log.d(TAG, "getMemoryPath " + getMemoryPath()); Log.d(TAG, "getCartridgePath " + getCartridgePath()); String ssound = sharedPref.getString("pref_sound_engine", "1"); Integer isound = new Integer(ssound); YabauseRunnable.setSoundEngine(isound); Log.d(TAG, "setSoundEngine " + isound.toString()); boolean analog = sharedPref.getBoolean("pref_analog_pad", false); //((Switch)findViewById(R.id.pad_mode_switch)).setChecked(analog); Log.d(TAG, "analog pad? " + analog); YabausePad padv = (YabausePad) findViewById(R.id.yabause_pad); if (analog) { Yabause.this.padm.setAnalogMode(PadManager.MODE_ANALOG); YabauseRunnable.switch_padmode(PadManager.MODE_ANALOG); padv.setPadMode(PadManager.MODE_ANALOG); } else { Yabause.this.padm.setAnalogMode(PadManager.MODE_HAT); YabauseRunnable.switch_padmode(PadManager.MODE_HAT); padv.setPadMode(PadManager.MODE_HAT); } Integer resolution_setting = new Integer(sharedPref.getString("pref_resolution", "0")); YabauseRunnable.setResolutionMode(resolution_setting); Integer scsp_sync = new Integer(sharedPref.getString("pref_scsp_sync_per_frame", "1")); YabauseRunnable.setScspSyncPerFrame(scsp_sync); }
From source file:com.landenlabs.all_devtool.SystemFragment.java
public void updateList() { // Time today = new Time(Time.getCurrentTimezone()); // today.setToNow(); // today.format(" %H:%M:%S") Date dt = new Date(); m_titleTime.setText(m_timeFormat.format(dt)); boolean expandAll = m_list.isEmpty(); m_list.clear();//from w w w . j av a 2 s . c o m // Swap colors int color = m_rowColor1; m_rowColor1 = m_rowColor2; m_rowColor2 = color; ActivityManager actMgr = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); try { String androidIDStr = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID); addBuild("Android ID", androidIDStr); try { AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getContext()); final String adIdStr = adInfo.getId(); final boolean isLAT = adInfo.isLimitAdTrackingEnabled(); addBuild("Ad ID", adIdStr); } catch (IOException e) { // Unrecoverable error connecting to Google Play services (e.g., // the old version of the service doesn't support getting AdvertisingId). } catch (GooglePlayServicesNotAvailableException e) { // Google Play services is not available entirely. } /* try { InstanceID instanceID = InstanceID.getInstance(getContext()); if (instanceID != null) { // Requires a Google Developer project ID. String authorizedEntity = "<need to make this on google developer site>"; instanceID.getToken(authorizedEntity, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); addBuild("Instance ID", instanceID.getId()); } } catch (Exception ex) { } */ ConfigurationInfo info = actMgr.getDeviceConfigurationInfo(); addBuild("OpenGL", info.getGlEsVersion()); } catch (Exception ex) { m_log.e(ex.getMessage()); } try { long heapSize = Debug.getNativeHeapSize(); // long maxHeap = Runtime.getRuntime().maxMemory(); // ConfigurationInfo cfgInfo = actMgr.getDeviceConfigurationInfo(); int largHeapMb = actMgr.getLargeMemoryClass(); int heapMb = actMgr.getMemoryClass(); MemoryInfo memInfo = new MemoryInfo(); actMgr.getMemoryInfo(memInfo); final String sFmtMB = "%.2f MB"; Map<String, String> listStr = new TreeMap<String, String>(); listStr.put("Mem Available (now)", String.format(sFmtMB, (double) memInfo.availMem / MB)); listStr.put("Mem LowWhenOnlyAvail", String.format(sFmtMB, (double) memInfo.threshold / MB)); if (Build.VERSION.SDK_INT >= 16) { listStr.put("Mem Installed", String.format(sFmtMB, (double) memInfo.totalMem / MB)); } listStr.put("Heap (this app)", String.format(sFmtMB, (double) heapSize / MB)); listStr.put("HeapMax (default)", String.format(sFmtMB, (double) heapMb)); listStr.put("HeapMax (large)", String.format(sFmtMB, (double) largHeapMb)); addBuild("Memory...", listStr); } catch (Exception ex) { m_log.e(ex.getMessage()); } try { List<ProcessErrorStateInfo> procErrList = actMgr.getProcessesInErrorState(); int errCnt = (procErrList == null ? 0 : procErrList.size()); procErrList = null; // List<RunningAppProcessInfo> procList = actMgr.getRunningAppProcesses(); int procCnt = actMgr.getRunningAppProcesses().size(); int srvCnt = actMgr.getRunningServices(100).size(); Map<String, String> listStr = new TreeMap<String, String>(); listStr.put("#Processes", String.valueOf(procCnt)); listStr.put("#Proc With Err", String.valueOf(errCnt)); listStr.put("#Services", String.valueOf(srvCnt)); // Requires special permission // int taskCnt = actMgr.getRunningTasks(100).size(); // listStr.put("#Tasks", String.valueOf(taskCnt)); addBuild("Processes...", listStr); } catch (Exception ex) { m_log.e("System-Processes %s", ex.getMessage()); } try { Map<String, String> listStr = new LinkedHashMap<String, String>(); listStr.put("LargeIconDensity", String.valueOf(actMgr.getLauncherLargeIconDensity())); listStr.put("LargeIconSize", String.valueOf(actMgr.getLauncherLargeIconSize())); putIf(listStr, "isRunningInTestHarness", "Yes", ActivityManager.isRunningInTestHarness()); putIf(listStr, "isUserAMonkey", "Yes", ActivityManager.isUserAMonkey()); addBuild("Misc...", listStr); } catch (Exception ex) { m_log.e("System-Misc %s", ex.getMessage()); } // --------------- Locale / Timezone ------------- try { Locale ourLocale = Locale.getDefault(); Date m_date = new Date(); TimeZone tz = TimeZone.getDefault(); Map<String, String> localeListStr = new LinkedHashMap<String, String>(); localeListStr.put("Locale Name", ourLocale.getDisplayName()); localeListStr.put(" Variant", ourLocale.getVariant()); localeListStr.put(" Country", ourLocale.getCountry()); localeListStr.put(" Country ISO", ourLocale.getISO3Country()); localeListStr.put(" Language", ourLocale.getLanguage()); localeListStr.put(" Language ISO", ourLocale.getISO3Language()); localeListStr.put(" Language Dsp", ourLocale.getDisplayLanguage()); localeListStr.put("TimeZoneID", tz.getID()); localeListStr.put(" DayLightSavings", tz.useDaylightTime() ? "Yes" : "No"); localeListStr.put(" In DLS", tz.inDaylightTime(m_date) ? "Yes" : "No"); localeListStr.put(" Short Name", tz.getDisplayName(false, TimeZone.SHORT, ourLocale)); localeListStr.put(" Long Name", tz.getDisplayName(false, TimeZone.LONG, ourLocale)); addBuild("Locale TZ...", localeListStr); } catch (Exception ex) { m_log.e("Locale/TZ %s", ex.getMessage()); } // --------------- Location Services ------------- try { Map<String, String> listStr = new LinkedHashMap<String, String>(); final LocationManager locMgr = (LocationManager) getActivity() .getSystemService(Context.LOCATION_SERVICE); GpsStatus gpsStatus = locMgr.getGpsStatus(null); if (gpsStatus != null) { listStr.put("Sec ToGetGPS", String.valueOf(gpsStatus.getTimeToFirstFix())); Iterable<GpsSatellite> satellites = gpsStatus.getSatellites(); Iterator<GpsSatellite> sat = satellites.iterator(); while (sat.hasNext()) { GpsSatellite satellite = sat.next(); putIf(listStr, String.format("Azm:%.0f, Elev:%.0f", satellite.getAzimuth(), satellite.getElevation()), String.format("%.2f Snr", satellite.getSnr()), satellite.usedInFix()); } } Location location = null; if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { location = locMgr.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (null == location) location = locMgr.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (null == location) location = locMgr.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER); } if (null != location) { listStr.put(location.getProvider() + " lat,lng", String.format("%.3f, %.3f", location.getLatitude(), location.getLongitude())); } if (listStr.size() != 0) { List<String> gpsProviders = locMgr.getAllProviders(); int idx = 1; for (String providerName : gpsProviders) { LocationProvider provider = locMgr.getProvider(providerName); if (null != provider) { listStr.put(providerName, (locMgr.isProviderEnabled(providerName) ? "On " : "Off ") + String.format("Accuracy:%d Pwr:%d", provider.getAccuracy(), provider.getPowerRequirement())); } } addBuild("GPS...", listStr); } else addBuild("GPS", "Off"); } catch (Exception ex) { m_log.e(ex.getMessage()); } // --------------- Application Info ------------- ApplicationInfo appInfo = getActivity().getApplicationInfo(); if (null != appInfo) { Map<String, String> appList = new LinkedHashMap<String, String>(); try { appList.put("ProcName", appInfo.processName); appList.put("PkgName", appInfo.packageName); appList.put("DataDir", appInfo.dataDir); appList.put("SrcDir", appInfo.sourceDir); // appList.put("PkgResDir", getActivity().getPackageResourcePath()); // appList.put("PkgCodeDir", getActivity().getPackageCodePath()); String[] dbList = getActivity().databaseList(); if (dbList != null && dbList.length != 0) appList.put("DataBase", dbList[0]); // getActivity().getComponentName(). } catch (Exception ex) { } addBuild("AppInfo...", appList); } // --------------- Account Services ------------- final AccountManager accMgr = (AccountManager) getActivity().getSystemService(Context.ACCOUNT_SERVICE); if (null != accMgr) { Map<String, String> strList = new LinkedHashMap<String, String>(); try { for (Account account : accMgr.getAccounts()) { strList.put(account.name, account.type); } } catch (Exception ex) { m_log.e(ex.getMessage()); } addBuild("Accounts...", strList); } // --------------- Package Features ------------- PackageManager pm = getActivity().getPackageManager(); FeatureInfo[] features = pm.getSystemAvailableFeatures(); if (features != null) { Map<String, String> strList = new LinkedHashMap<String, String>(); for (FeatureInfo featureInfo : features) { strList.put(featureInfo.name, ""); } addBuild("Features...", strList); } // --------------- Sensor Services ------------- final SensorManager senMgr = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); if (null != senMgr) { Map<String, String> strList = new LinkedHashMap<String, String>(); // Sensor accelerometer = senMgr.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); // senMgr.registerListener(foo, accelerometer, SensorManager.SENSOR_DELAY_NORMAL); List<Sensor> listSensor = senMgr.getSensorList(Sensor.TYPE_ALL); try { for (Sensor sensor : listSensor) { strList.put(sensor.getName(), sensor.getVendor()); } } catch (Exception ex) { m_log.e(ex.getMessage()); } addBuild("Sensors...", strList); } try { if (Build.VERSION.SDK_INT >= 17) { final UserManager userMgr = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); if (null != userMgr) { try { addBuild("UserName", userMgr.getUserName()); } catch (Exception ex) { m_log.e(ex.getMessage()); } } } } catch (Exception ex) { } try { Map<String, String> strList = new LinkedHashMap<String, String>(); int screenTimeout = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT); strList.put("ScreenTimeOut", String.valueOf(screenTimeout / 1000)); int rotate = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.ACCELEROMETER_ROTATION); strList.put("RotateEnabled", String.valueOf(rotate)); if (Build.VERSION.SDK_INT >= 17) { // Global added in API 17 int adb = Settings.Global.getInt(getActivity().getContentResolver(), Settings.Global.ADB_ENABLED); strList.put("AdbEnabled", String.valueOf(adb)); } addBuild("Settings...", strList); } catch (Exception ex) { } if (expandAll) { // updateList(); int count = m_list.size(); for (int position = 0; position < count; position++) m_listView.expandGroup(position); } m_adapter.notifyDataSetChanged(); }