/** * This instantiates the GL10, GL11 and GL20 instances. Includes the check for certain devices * that pretend to support GL11 but f**k up vertex buffer objects. This includes the pixelflinger * which segfaults when buffers are deleted as well as the Motorola CLIQ and the Samsung Behold * II. * * @param gl */ private void setupGL(javax.microedition.khronos.opengles.GL10 gl) { if (gl10 != null || gl20 != null) return; if (view instanceof GLSurfaceView20) { gl20 = new AndroidGL20(); this.gl = gl20; } else { gl10 = new AndroidGL10(gl); this.gl = gl10; if (gl instanceof javax.microedition.khronos.opengles.GL11) { String renderer = gl.glGetString(GL10.GL_RENDERER); if (renderer != null) { // silly GT-I7500 if (!renderer.toLowerCase().contains("pixelflinger") && !(android.os.Build.MODEL.equals("MB200") || android.os.Build.MODEL.equals("MB220") || android.os.Build.MODEL.contains("Behold"))) { gl11 = new AndroidGL11((javax.microedition.khronos.opengles.GL11) gl); gl10 = gl11; } } } } this.glu = new AndroidGLU(); Gdx.gl = this.gl; Gdx.gl10 = gl10; Gdx.gl11 = gl11; Gdx.gl20 = gl20; Gdx.glu = glu; Gdx.app.log("AndroidGraphics", "OGL renderer: " + gl.glGetString(GL10.GL_RENDERER)); Gdx.app.log("AndroidGraphics", "OGL vendor: " + gl.glGetString(GL10.GL_VENDOR)); Gdx.app.log("AndroidGraphics", "OGL version: " + gl.glGetString(GL10.GL_VERSION)); Gdx.app.log("AndroidGraphics", "OGL extensions: " + gl.glGetString(GL10.GL_EXTENSIONS)); }
private void setVideoCover(double time) { ivDone.setEnabled(true); ivUndo.setEnabled(true); flCoverSetted.setVisibility(View.VISIBLE); ivCover.setVisibility(View.GONE); videoCoverTime = time; thumbBmp = mMediaPlayer.videScreenCapture( videoCoverTime, EffectType.EFFECT_VIDEO_DEFAULT_WIDTH, EffectType.EFFECT_VIDEO_DEFAULT_WIDTH); if (android.os.Build.MODEL.equalsIgnoreCase("GT-N7100") || android.os.Build.MODEL.equalsIgnoreCase("GT-I9300") || android.os.Build.MODEL.equals("GT-I9220") || android.os.Build.MODEL.startsWith("GT-I9100")) { Mp4Info info = new Mp4Info(curVideoPath); thumbBmp = ZGraphics.rotate(thumbBmp, info.angle, true); } curAngle = mMediaPlayer.getCurrentOrientation(); Log.d(TAG, "setVideoCover time = " + time + " curAngle = " + curAngle); Bitmap bmp = BitmapUtils.rotate(thumbBmp, (360 - curAngle) % 360, true); ivCoverSetted.setImageBitmap(bmp); OperateNote operate = new OperateNote(); operate.operateType = OPERATE_COVER; operate.videoPath = curVideoPath; operate.angle = curAngle; operate.coverTime = videoCoverTime; operateNotesList.add(operate); }
public static boolean isHTC() { boolean ishtc = false; if (Build.MODEL.contains("htc") || Build.MODEL.contains("HTC")) { ishtc = true; } return ishtc; }
void initMode() { samsung = Build.MODEL.contains("SAMSUNG") || Build.MODEL.contains("SPH-") || Build.MODEL.contains("SGH-") || Build.MODEL.contains("GT-"); if (Receiver.call_state == UserAgent.UA_STATE_INCOMING_CALL && (Receiver.pstn_state == null || Receiver.pstn_state.equals("IDLE"))) setMode(AudioManager.MODE_NORMAL); }
// 判断当前设备是否是模拟器。如果返回TRUE,则当前是模拟器,不是返回FALSE public boolean isEmulator(Context context) { try { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imei = tm.getDeviceId(); if (imei != null && imei.equals("000000000000000")) { return true; } return (Build.MODEL.equals("sdk")) || (Build.MODEL.equals("google_sdk")); } catch (Exception ioe) { } return false; }
public static boolean isMIUI() { Log.i( TAG, "================== current system BRAND=" + android.os.Build.BRAND + " MODEL=" + android.os.Build.MODEL); if (android.os.Build.BRAND.equals("Xiaomi") || android.os.Build.MODEL.startsWith("MI") || android.os.Build.MODEL.startsWith("HM")) { return true; } return false; }
static { BULID_BRAND = Build.BRAND.toLowerCase(); BULID_MODEL = Build.MODEL.toLowerCase(); BULIDM_PRODUCT = Build.PRODUCT.toLowerCase(); BULIDM_RELEASE = Build.VERSION.RELEASE; BULIDM_SDK = Build.VERSION.SDK; if (BULIDM_RELEASE.indexOf("1.1") != -1) { TMP_MAJOR = OS_11; } else if (BULIDM_RELEASE.indexOf("1.5") != -1) { TMP_MAJOR = OS_15; } else if (BULIDM_RELEASE.indexOf("1.6") != -1) { TMP_MAJOR = OS_16; } else if (BULIDM_RELEASE.indexOf("2.0") != -1) { TMP_MAJOR = OS_20; } else if (BULIDM_RELEASE.indexOf("2.1") != -1) { TMP_MAJOR = OS_21; } else if (BULIDM_RELEASE.indexOf("2.2") != -1) { TMP_MAJOR = OS_22; } else if (BULIDM_RELEASE.indexOf("2.3") != -1) { TMP_MAJOR = OS_23; } else if (BULIDM_RELEASE.indexOf("3.0") != -1) { TMP_MAJOR = OS_30; } else { TMP_MAJOR = OS_15; } EMULATOR = BULID_BRAND.indexOf("generic") != -1 && BULID_MODEL.indexOf("sdk") != -1; LOWER_VER = (TMP_MAJOR < OS_16 && !EMULATOR); }
public static String findDeviceID(Context context) { final String android_id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); if (android_id != null) { return android_id; } else { String m_szDevIDShort = "35" + // we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; // 13 digits return m_szDevIDShort; } }
public void savePicture(Context context) { byte[] result = mAlmaCLRShot.processingSaveData(); int frame_len = result.length; int frame = SwapHeap.SwapToHeap(result); PluginManager.getInstance().addToSharedMem("resultframeformat1" + sessionID, "jpeg"); PluginManager.getInstance().addToSharedMem("resultframe1" + sessionID, String.valueOf(frame)); PluginManager.getInstance() .addToSharedMem("resultframelen1" + sessionID, String.valueOf(frame_len)); // Nexus 6 has a original front camera sensor orientation, we have to manage it PluginManager.getInstance() .addToSharedMem( "resultframeorientation1" + sessionID, String.valueOf( (Build.MODEL.contains("Nexus 6") && mCameraMirrored) ? (mDisplayOrientation + 180) % 360 : mDisplayOrientation)); PluginManager.getInstance() .addToSharedMem("resultframemirrored1" + sessionID, String.valueOf(mCameraMirrored)); PluginManager.getInstance() .addToSharedMem("amountofresultframes" + sessionID, String.valueOf(1)); PluginManager.getInstance().addToSharedMem("sessionID", String.valueOf(sessionID)); mAlmaCLRShot.release(); }
public boolean isKindleFire() { if (myIsKindleFire == null) { final String KINDLE_MODEL_REGEXP = ".*kindle(\\s+)fire.*"; myIsKindleFire = Build.MODEL != null && Build.MODEL.toLowerCase().matches(KINDLE_MODEL_REGEXP); } return myIsKindleFire; }
public static boolean shouldEnableCacheOnMemory() { if (Build.MODEL.equalsIgnoreCase("GT-N7100") || (Build.MANUFACTURER.equalsIgnoreCase("SAMSUNG") && android.os.Build.VERSION.RELEASE.equalsIgnoreCase("4.4.2"))) { return false; } return true; }
private void onPickPhoto() { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); if (android.os.Build.MODEL.startsWith("HTC")) { intent.putExtra("folderType", "com.htc.HTCAlbum.ALL_PHOTOS"); } Intent openInChooser = Intent.createChooser(intent, getString(R.string.complete_action_using)); startActivityForResult(openInChooser, PICK_PHOTO); }
/** @return platform id 1 Android 2 Amazon 3 Blackberry */ public static int getPlatform() { if (android.os.Build.BRAND.toLowerCase().contains("blackberry")) { return 1; } else if (android.os.Build.MODEL.toLowerCase().contains("kindle")) { return 2; } else { return 0; } }
public static boolean isBlackBerry() { boolean bb = false; if (android.os.Build.MODEL.contains("BlackBerry") || android.os.Build.BRAND.contains("BlackBerry") || android.os.Build.MANUFACTURER.contains("BlackBerry")) { bb = true; } return bb; }
public static String getUniqueId(Context c) { String m_szImei = ""; // 1 compute IMEI try { TelephonyManager TelephonyMgr = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); m_szImei = TelephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE } catch (Exception e) { } // 2 compute DEVICE ID String m_szDevIDShort = "35" + // we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; // 13 digits if (m_szDevIDShort == null) m_szDevIDShort = ""; // 3 android ID - unreliable String m_szAndroidID = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID); if (m_szAndroidID == null) m_szAndroidID = ""; // 6 SUM THE IDs String m_szLongID = m_szImei + m_szDevIDShort + m_szAndroidID; MessageDigest m = null; try { m = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } m.update(m_szLongID.getBytes(), 0, m_szLongID.length()); byte p_md5Data[] = m.digest(); String m_szUniqueID = new String(); for (int i = 0; i < p_md5Data.length; i++) { int b = (0xFF & p_md5Data[i]); // if it is a single digit, make sure it have 0 in front (proper padding) if (b <= 0xF) m_szUniqueID += "0"; // add number to string m_szUniqueID += Integer.toHexString(b); } m_szUniqueID = m_szUniqueID.toUpperCase(); return m_szUniqueID; }
@Test public void testVersePicker() { // Touch the "new_record" button (the big microphone) onView(withId(R.id.new_record)).perform(click()); // TODO: What's the right way to wait for the UI to update the picker? try { Thread.sleep(2500); } catch (InterruptedException e) { e.printStackTrace(); } // Check to see if this is a Samsung model boolean isSamsung = Build.MODEL.startsWith("SM"); // Go forwards for (int i = 1; i <= 31; i++) { onView(withId(R.id.numberPicker)) .check(matches(hasNumberPickerDisplayedValue(is(new Integer(i).toString())))); if (isSamsung) { // Samsung's number picker is the inverse of the stock one // (clicking on the bottom increments it) onView(withId(R.id.numberPicker)).perform(clickXY(10, 150)); } else { onView(withId(R.id.numberPicker)).perform(clickXY(10, 10)); } // Test for wraparound if (i == 31) { onView(withId(R.id.numberPicker)).check(matches(hasNumberPickerDisplayedValue(is("1")))); } } // Go backwards for (int i = 31; i >= 1; i--) { if (isSamsung) { // Samsung's number picker is the inverse of the stock one // (clicking on the top decrements it) onView(withId(R.id.numberPicker)).perform(clickXY(10, 10)); } else { onView(withId(R.id.numberPicker)).perform(clickXY(10, 200)); } onView(withId(R.id.numberPicker)) .check(matches(hasNumberPickerDisplayedValue(is(new Integer(i).toString())))); // Test for wraparound if (i == 1) { if (isSamsung) { // Samsung's number picker is the inverse of the stock one // (clicking on the top decrements it) onView(withId(R.id.numberPicker)).perform(clickXY(10, 10)); } else { onView(withId(R.id.numberPicker)).perform(clickXY(10, 200)); } onView(withId(R.id.numberPicker)).check(matches(hasNumberPickerDisplayedValue(is("31")))); } } }
private void setFlash(Camera.Parameters paramParameters) { if ((Build.MODEL.contains("Behold II")) && (CameraManager.SDK_INT == 3)) { paramParameters.set("flash-value", 1); } for (; ; ) { paramParameters.set("flash-mode", "off"); return; paramParameters.set("flash-value", 2); } }
public static boolean isEmulator(Context context) { boolean ret = false; try { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imei = tm.getDeviceId(); if (imei != null && imei.equals("000000000000000")) { ret = true; } ret = (Build.MODEL.equals("sdk")) || (Build.MODEL.equals("google_sdk")); if (!ret) { ret = isBlueStacks(); } if (!ret) { ret = isGenymotion(); } } catch (Exception ioe) { } return ret; }
static { com.unity3d.player.q.a = false; A = (Build.MANUFACTURER.equalsIgnoreCase("Amazon") && (Build.MODEL.equalsIgnoreCase("KFTT") || Build.MODEL.equalsIgnoreCase("KFJWI") || Build.MODEL.equalsIgnoreCase("KFJWA") || Build.MODEL.equalsIgnoreCase("KFSOWI") || Build.MODEL.equalsIgnoreCase("KFTHWA") || Build.MODEL.equalsIgnoreCase("KFTHWI") || Build.MODEL.equalsIgnoreCase("KFAPWA") || Build.MODEL.equalsIgnoreCase("KFAPWI"))); }
public static HwCodecImplI createCodec() { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { Log.e(TAG, "MediaCodec not available in this version of Android! Expect errors!"); } Log.i(TAG, "model: " + android.os.Build.MODEL); if (android.os.Build.MODEL.compareTo("Galaxy Nexus") == 0) { return cif.new CodecImpl_GalaxyNexus(); } else if (android.os.Build.MODEL.compareTo("Nexus 7") == 0) { return cif.new CodecImpl_Nexus7(); } else if (android.os.Build.MODEL.compareTo("Nexus S") == 0) { return cif.new CodecImpl_NexusS(); } else { Log.e(TAG, "*** unknown device model ***"); return cif.new CodecImpl_Generic(); } }
public TerminalKeyListener( TerminalManager manager, TerminalBridge bridge, VDUBuffer buffer, String encoding) { this.manager = manager; this.bridge = bridge; this.buffer = buffer; this.encoding = encoding; selectionArea = new SelectionArea(); prefs = PreferenceManager.getDefaultSharedPreferences(manager); prefs.registerOnSharedPreferenceChangeListener(this); hardKeyboard = (manager.res.getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY); hardKeyboard = hardKeyboard && !(Build.MODEL.startsWith("Transformer ") || Build.MODEL.startsWith("ASUS Transformer ")); updateKeymode(); }
public boolean IsXperiaPlay() { return android.os.Build.MODEL.equals("R800a") || android.os.Build.MODEL.equals("R800i") || android.os.Build.MODEL.equals("R800x") || android.os.Build.MODEL.equals("R800at") || android.os.Build.MODEL.equals("SO-01D") || android.os.Build.MODEL.equals("zeus"); }
private void setFlash(Camera.Parameters parameters) { // FIXME: This is a hack to turn the flash off on the Samsung Galaxy. // And this is a hack-hack to work around a different value on the Behold II // Restrict Behold II check to Cupcake, per Samsung's advice // if (Build.MODEL.contains("Behold II") && // CameraManager.SDK_INT == Build.VERSION_CODES.CUPCAKE) { if (Build.MODEL.contains("Behold II") && CameraManager.SDK_INT == 3) { // 3 = Cupcake parameters.set("flash-value", 1); } else { parameters.set("flash-value", 2); } // This is the standard setting to turn the flash off that all devices should honor. parameters.set("flash-mode", "off"); }
void disableKeyguard() { if (mKeyguardManager == null) { mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); mKeyguardLock = mKeyguardManager.newKeyguardLock("Sipdroid"); enabled = true; } if (enabled) { mKeyguardLock.disableKeyguard(); if (Integer.parseInt(Build.VERSION.SDK) == 16 && Build.MODEL.contains("HTC One")) mKeyguardManager.exitKeyguardSecurely( new OnKeyguardExitResult() { public void onKeyguardExitResult(boolean success) {} }); enabled = false; enabletime = SystemClock.elapsedRealtime(); } }
public void dostuff() { cleanUp(getFilesDir()); if (!Build.MODEL.equalsIgnoreCase("SPH-M910")) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Warning Untested Phone!"); builder .setMessage( "Use of Temp Root is recommended. Please insure that your phone is compatible with Joey Krim's permanent root method, before attempting permanent Root.") .setCancelable(true) .setPositiveButton( "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); alert.setOwnerActivity(this); alert.show(); recoverybutton.setVisibility(View.GONE); if (new File("/system/bin/su").exists() || new File("/system/xbin/su").exists()) { unrootbutton.setVisibility(View.GONE); detailtext.setText( "Your device is already rooted. You can remove the root using the Un-root button, which will delete all of the files installed to root your device. You can re-root your device if your root is malfunctioning."); } if (new File("/system/bin/joeykrim-root.sh").exists()) { unrootbutton.setVisibility(View.VISIBLE); } } else { if (new File("/system/bin/su").exists() || new File("/system/xbin/su").exists()) { NeedsRoot = false; unrootbutton.setVisibility(View.GONE); recoverybutton.setVisibility(View.VISIBLE); detailtext.setText( "Your device is already rooted. You can remove the root using the Un-root button, which will delete all of the files installed to root your device. You can re-root your device if your root is malfunctioning. You can also install CM01 custom recovery."); } else { recoverybutton.setVisibility(View.VISIBLE); unrootbutton.setVisibility(View.GONE); } if (new File("/system/bin/joeykrim-root.sh").exists()) { unrootbutton.setVisibility(View.VISIBLE); } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ConnectivityManager connMan = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); view = (TextView) findViewById(R.id.currentIpAddr); button = (Button) findViewById(R.id.firstButton); this.registerReceiver(this.mConn, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); if (connMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) { WifiManager wifiMan = (WifiManager) getSystemService(WIFI_SERVICE); start(wifiMan.getConnectionInfo().getSSID().toString()); } else if (Build.MODEL.equals("sdk")) { start("sdk"); // Android emulator } else { view.setText("Not connected to Wi-Fi"); button.setEnabled(Boolean.FALSE); } }
public String pidxor(String pid) { String deviceId = "35" + Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10 + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10 + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10 + Build.USER.length() % 10; // Library calls this when it's done. return xorTxt(pid, deviceId); }
/** * Tries to figure out if the current phone is Galaxy S based, since it has recording issues This * is pretty nasty since we are string matching, but unless I can get a better way to do it... * * @param */ public static boolean isSamsungGalaxyS() { String manufacturer = android.os.Build.MANUFACTURER.toLowerCase(); String model = android.os.Build.MODEL.toLowerCase(); String device = android.os.Build.DEVICE.toLowerCase(); Log.i( TAG_AUDIOHELPER, String.format("manufacturer: %s, model: %s, device: %s", manufacturer, model, device)); if (manufacturer.equals(MANUFACTURER_SAMSUNG)) { if (device.equals(DEVICE_ID_GALAXY_S)) { Log.i(TAG_AUDIOHELPER, "Samsung Galaxy S detected"); return true; } if (device.equals(DEVICE_ID_CAPTIVATE)) { Log.i(TAG_AUDIOHELPER, "ATT, Samsung Captivate detected"); return true; } if (device.equals(DEVICE_ID_VIBRANT)) { Log.i(TAG_AUDIOHELPER, "T-Mobile US, Samsung Vibrant detected"); return true; } if (device.equals(DEVICE_ID_EPIC)) { Log.i(TAG_AUDIOHELPER, "Sprint, Samsung Epic 4G detected"); return true; } if (device.equals(DEVICE_ID_FASCINATE)) { Log.i(TAG_AUDIOHELPER, "Verizon, Samsung Fascinate detected"); return true; } if (device.equals(DEVICE_ID_MESMERIZE)) { Log.i(TAG_AUDIOHELPER, "Samsung Mesmerize detected"); return true; } } return false; }
@SuppressLint("DefaultLocale") public void testXidioLoginErrorMessagePos() { assertTrue(solo.waitForActivity(TestConstants.FIRST_RUN)); solo.sleep(TestConstants.SLEEP_TIME_1000); if (!Build.MODEL.toLowerCase(Locale.US).contains("comcast")) { solo.enterText( (EditText) solo.getCurrentActivity().findViewById(com.xfinity.xidio.R.id.first_run_username), TestConstants.WRONG_USERNAME); solo.enterText( (EditText) solo.getCurrentActivity().findViewById(com.xfinity.xidio.R.id.first_run_password), TestConstants.PASSWORD); solo.sleep(TestConstants.SLEEP_TIME_500); solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN); solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN); solo.sendKey(KeyEvent.KEYCODE_DPAD_CENTER); solo.sleep(TestConstants.SLEEP_TIME_2000); assertFalse(solo.searchText("Error, check username/password and try again")); solo.sleep(TestConstants.SLEEP_TIME_1000); } }
private DeviceUtils() { isKindleFire = android.os.Build.MODEL.equalsIgnoreCase("kindle fire") ? true : false; }