Java Code Examples for android.os.Build#BRAND
The following examples show how to use
android.os.Build#BRAND .
These examples are extracted from open source projects.
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 Project: iGap-Android File: RequestUserLogin.java License: GNU Affero General Public License v3.0 | 6 votes |
private void infoApp() { PackageInfo pInfo = null; try { pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } if (pInfo != null) { AppVersion = pInfo.versionName; AppBuildVersion = pInfo.versionCode; } Device = Build.BRAND; Language = Locale.getDefault().getDisplayLanguage(); }
Example 2
Source Project: facebook-api-android-maven File: NativeProtocol.java License: Apache License 2.0 | 6 votes |
public boolean validateSignature(Context context, String packageName) { String brand = Build.BRAND; int applicationFlags = context.getApplicationInfo().flags; if (brand.startsWith("generic") && (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { // We are debugging on an emulator, don't validate package signature. return true; } PackageInfo packageInfo = null; try { packageInfo = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES); } catch (PackageManager.NameNotFoundException e) { return false; } for (Signature signature : packageInfo.signatures) { String hashedSignature = Utility.sha1hash(signature.toByteArray()); if (validAppSignatureHashes.contains(hashedSignature)) { return true; } } return false; }
Example 3
Source Project: MainActivityUIUtil File: StatusbarUtil.java License: Apache License 2.0 | 6 votes |
private static String getHandSetInfo() { String handSetInfo = "手机型号:" + Build.MODEL + "\n系统版本:" + Build.VERSION.RELEASE + "\n产品型号:" + Build.PRODUCT + "\n版本显示:" + Build.DISPLAY + "\n系统定制商:" + Build.BRAND + "\n设备参数:" + Build.DEVICE + "\n开发代号:" + Build.VERSION.CODENAME + "\nSDK版本号:" + Build.VERSION.SDK_INT + "\nCPU类型:" + Build.CPU_ABI + "\n硬件类型:" + Build.HARDWARE + "\n主机:" + Build.HOST + "\n生产ID:" + Build.ID + "\nROM制造商:" + Build.MANUFACTURER // 这行返回的是rom定制商的名称 ; Log.e("tt",handSetInfo); return handSetInfo; }
Example 4
Source Project: DeviceConnect-Android File: ThetaM15.java License: MIT License | 5 votes |
private static boolean isGalaxyDevice() { if ((Build.BRAND != null) && (Build.BRAND.toLowerCase(Locale.ENGLISH).contains(BRAND_SAMSUNG))) { return true; } if ((Build.MANUFACTURER != null) && (Build.MANUFACTURER.toLowerCase(Locale.ENGLISH).contains(MANUFACTURER_SAMSUNG))) { return true; } return false; }
Example 5
Source Project: cronet File: BuildInfo.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
@CalledByNative private static String[] getAll() { BuildInfo buildInfo = getInstance(); String hostPackageName = ContextUtils.getApplicationContext().getPackageName(); return new String[] { Build.BRAND, Build.DEVICE, Build.ID, Build.MANUFACTURER, Build.MODEL, String.valueOf(Build.VERSION.SDK_INT), Build.TYPE, Build.BOARD, hostPackageName, String.valueOf(buildInfo.hostVersionCode), buildInfo.hostPackageLabel, buildInfo.packageName, String.valueOf(buildInfo.versionCode), buildInfo.versionName, buildInfo.androidBuildFingerprint, buildInfo.gmsVersionCode, buildInfo.installerPackageName, buildInfo.abiString, BuildConfig.FIREBASE_APP_ID, buildInfo.customThemes, buildInfo.resourcesVersion, buildInfo.extractedFileSuffix, }; }
Example 6
Source Project: rides-android-sdk File: AppProtocol.java License: MIT License | 5 votes |
private boolean isDebug(@NonNull Context context) { String brand = Build.BRAND; int applicationFlags = context.getApplicationInfo().flags; // We are debugging on an emulator, don't validate package signature. return (brand.startsWith("Android") || brand.startsWith("generic")) && (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; }
Example 7
Source Project: IPTVFree File: Utils.java License: Apache License 2.0 | 5 votes |
/** * Get system information for bug report * @return String */ public static String getSystemInformation() { return "SDK: " + Build.VERSION.SDK_INT + "\n" + "RELEASE: " + Build.VERSION.RELEASE + "\n" + "DEVICE: " + Build.DEVICE + "\n" + "OS VERSION: " + System.getProperty("os.version") + "\n" + "OS NAME: " + System.getProperty("os.name") + "\n" + "MODEL: " + Build.MODEL + "\n" + "PRODUCT: " + Build.PRODUCT + "\n"+ "BRAND: " + Build.BRAND + "\n" + "HARDWARE: " + Build.HARDWARE + "\n" + "BOARD: " + Build.BOARD + "\n"; }
Example 8
Source Project: ArgusAPM File: TraceWriter.java License: Apache License 2.0 | 5 votes |
private synchronized static void log(String tagName, String content, boolean forceFlush) { if (Env.DEBUG) { LogX.d(Env.TAG, SUB_TAG, "tagName = " + tagName + " content = " + content); } if (sWriteThread == null) { sWriteThread = new WriteFileRun(); Thread t = new Thread(sWriteThread); t.setName("ApmTrace.Thread"); t.setDaemon(true); t.setPriority(Thread.MIN_PRIORITY); t.start(); String initContent = "---- Phone=" + Build.BRAND + "/" + Build.MODEL + "/verName:" + " ----"; sQueuePool.offer(new Object[]{tagName, initContent, Boolean.valueOf(forceFlush)}); if (Env.DEBUG) { LogX.d(Env.TAG, SUB_TAG, "init offer content = " + content); } } if (Env.DEBUG) { LogX.d(Env.TAG, SUB_TAG, "offer content = " + content); } sQueuePool.offer(new Object[]{tagName, content, Boolean.valueOf(forceFlush)}); synchronized (LOCKER_WRITE_THREAD) { LOCKER_WRITE_THREAD.notify(); } }
Example 9
Source Project: DragBoardView File: MainActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //<useless> getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); String brand = Build.BRAND; if (brand.contains("Xiaomi")) { setXiaomiDarkMode(this); } else if (brand.contains("Meizu")) { setMeizuDarkMode(this); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { View decor = getWindow().getDecorView(); decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } //</useless> Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); dragBoardView = findViewById(R.id.layout_main); mAdapter = new ColumnAdapter(this); mAdapter.setData(mData); dragBoardView.setHorizontalAdapter(mAdapter); getDataAndRefreshView(); }
Example 10
Source Project: android-emulator-detector File: EmulatorDetector.java License: Apache License 2.0 | 5 votes |
/** * Returns string with human-readable listing of Build.* parameters used in {@link #isEmulator()} method. * @return all involved Build.* parameters and its values */ public static String getDeviceListing() { return "Build.PRODUCT: " + Build.PRODUCT + "\n" + "Build.MANUFACTURER: " + Build.MANUFACTURER + "\n" + "Build.BRAND: " + Build.BRAND + "\n" + "Build.DEVICE: " + Build.DEVICE + "\n" + "Build.MODEL: " + Build.MODEL + "\n" + "Build.HARDWARE: " + Build.HARDWARE + "\n" + "Build.FINGERPRINT: " + Build.FINGERPRINT + "\n" + "Build.TAGS: " + android.os.Build.TAGS + "\n" + "GL_RENDERER: " +android.opengl.GLES20.glGetString(android.opengl.GLES20.GL_RENDERER) + "\n" + "GL_VENDOR: " +android.opengl.GLES20.glGetString(android.opengl.GLES20.GL_VENDOR) + "\n" + "GL_VERSION: " +android.opengl.GLES20.glGetString(android.opengl.GLES20.GL_VERSION) + "\n" + "GL_EXTENSIONS: " +android.opengl.GLES20.glGetString(android.opengl.GLES20.GL_EXTENSIONS) + "\n"; }
Example 11
Source Project: androiddevice.info File: Error.java License: GNU General Public License v2.0 | 5 votes |
public Error(PackageInfo packageinfo, Throwable exception) { packagename = packageinfo.packageName; versionname = packageinfo.versionName; versioncode = Integer.toString(packageinfo.versionCode); model = Build.MODEL; androidversion = Build.VERSION.RELEASE; board = Build.BOARD; device = Build.DEVICE; brand = Build.BRAND; stacktrace = getStacktrace(exception); }
Example 12
Source Project: dexmaker File: InlineStaticMockMaker.java License: Apache License 2.0 | 5 votes |
/** * Create a new mock maker. */ public InlineStaticMockMaker() { if (INITIALIZATION_ERROR != null) { throw new RuntimeException("Could not initialize inline mock maker.\n" + "\n" + "Release: Android " + Build.VERSION.RELEASE + " " + Build.VERSION.INCREMENTAL + "Device: " + Build.BRAND + " " + Build.MODEL, INITIALIZATION_ERROR); } classTransformer = new StaticClassTransformer(AGENT, InlineDexmakerMockMaker .DISPATCHER_CLASS, markerToHandler, classToMarker); }
Example 13
Source Project: letv File: Device.java License: Apache License 2.0 | 5 votes |
public static String getDeviceModel() { String deviceModel; if (Build.MODEL.startsWith(Build.BRAND)) { deviceModel = Build.MODEL; } else { deviceModel = Build.BRAND + Build.MODEL; } if (empty(deviceModel)) { return deviceModel; } return deviceModel.replaceAll(" ", ""); }
Example 14
Source Project: FlyWoo File: CreateConnectionVu.java License: Apache License 2.0 | 4 votes |
public String getPhoneModel() { String str1 = Build.BRAND; String str2 = Build.MODEL; str2 = str1 + "_" + str2; return str2; }
Example 15
Source Project: YCAudioPlayer File: HttpInterceptor.java License: Apache License 2.0 | 4 votes |
private String makeUA() { return Build.BRAND + "/" + Build.MODEL + "/" + Build.VERSION.RELEASE; }
Example 16
Source Project: Box File: DeviceUtils.java License: Apache License 2.0 | 4 votes |
public static String getBrand() { return Build.BRAND; }
Example 17
Source Project: VideoOS-Android-SDK File: AndroidUtil.java License: GNU General Public License v3.0 | 4 votes |
/** * 系统品牌 */ public static String getBrand() { return Build.BRAND; }
Example 18
Source Project: raygun4android File: RaygunEnvironmentMessage.java License: MIT License | 4 votes |
public RaygunEnvironmentMessage(Context context) { try { architecture = Build.CPU_ABI; oSVersion = Build.VERSION.RELEASE; osSDKVersion = Integer.toString(Build.VERSION.SDK_INT); deviceName = Build.MODEL; deviceCode = Build.DEVICE; brand = Build.BRAND; board = Build.BOARD; processorCount = Runtime.getRuntime().availableProcessors(); int orientation = context.getResources().getConfiguration().orientation; if (orientation == 1) { currentOrientation = "Portrait"; } else if (orientation == 2) { currentOrientation = "Landscape"; } else if (orientation == 3) { currentOrientation = "Square"; } else { currentOrientation = "Undefined"; } DisplayMetrics metrics = new DisplayMetrics(); ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics); windowsBoundWidth = metrics.widthPixels; windowsBoundHeight = metrics.heightPixels; TimeZone tz = TimeZone.getDefault(); Date now = new Date(); utcOffset = TimeUnit.SECONDS.convert(tz.getOffset(now.getTime()), TimeUnit.MILLISECONDS) / 3600; locale = context.getResources().getConfiguration().locale.toString(); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); am.getMemoryInfo(mi); availablePhysicalMemory = mi.availMem / 0x100000; Pattern p = Pattern.compile("^\\D*(\\d*).*$"); Matcher m = p.matcher(getTotalRam()); m.find(); String match = m.group(1); totalPhysicalMemory = Long.parseLong(match) / 0x400; StatFs stat = new StatFs(Environment.getDataDirectory().getPath()); long availableBlocks = (long) stat.getAvailableBlocks(); long blockSize = (long) stat.getBlockSize(); diskSpaceFree = (availableBlocks * blockSize) / 0x100000; } catch (Exception e) { RaygunLogger.w("Couldn't get all env data: " + e); } }
Example 19
Source Project: DoraemonKit File: LeakCanary.java License: Apache License 2.0 | 4 votes |
/** * Returns a string representation of the result of a heap analysis. */ public static @NonNull String leakInfo(@NonNull Context context, @NonNull HeapDump heapDump, @NonNull AnalysisResult result, boolean detailed) { PackageManager packageManager = context.getPackageManager(); String packageName = context.getPackageName(); PackageInfo packageInfo; try { packageInfo = packageManager.getPackageInfo(packageName, 0); } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException(e); } String versionName = packageInfo.versionName; int versionCode = packageInfo.versionCode; String info = "In " + packageName + ":" + versionName + ":" + versionCode + ".\n"; String detailedString = ""; if (result.leakFound) { if (result.excludedLeak) { info += "* EXCLUDED LEAK.\n"; } info += "* " + result.className; if (!heapDump.referenceName.equals("")) { info += " (" + heapDump.referenceName + ")"; } info += " has leaked:\n" + result.leakTrace.toString() + "\n"; if (result.retainedHeapSize != AnalysisResult.RETAINED_HEAP_SKIPPED) { info += "* Retaining: " + formatShortFileSize(context, result.retainedHeapSize) + ".\n"; } if (detailed) { detailedString = "\n* Details:\n" + result.leakTrace.toDetailedString(); } } else if (result.failure != null) { // We duplicate the library version & Sha information because bug reports often only contain // the stacktrace. info += "* FAILURE in " + BuildConfig.LEAKCANARY_LIBRARY_VERSION + " " + BuildConfig.GIT_SHA + ":" + Log.getStackTraceString( result.failure) + "\n"; } else { info += "* NO LEAK FOUND.\n\n"; } if (detailed) { detailedString += "* Excluded Refs:\n" + heapDump.excludedRefs; } info += "* Reference Key: " + heapDump.referenceKey + "\n" + "* Device: " + Build.MANUFACTURER + " " + Build.BRAND + " " + Build.MODEL + " " + Build.PRODUCT + "\n" + "* Android Version: " + Build.VERSION.RELEASE + " API: " + Build.VERSION.SDK_INT + " LeakCanary: " + BuildConfig.LEAKCANARY_LIBRARY_VERSION + " " + BuildConfig.GIT_SHA + "\n" + "* Durations: watch=" + heapDump.watchDurationMs + "ms, gc=" + heapDump.gcDurationMs + "ms, heap dump=" + heapDump.heapDumpDurationMs + "ms, analysis=" + result.analysisDurationMs + "ms" + "\n" + detailedString; return info; }
Example 20
Source Project: RePlugin-GameSdk File: HWUtils.java License: Apache License 2.0 | 2 votes |
/** * 获取当前手机系统版本 * * @return */ public static String getPhoneVersion() { return "android_" + Build.BRAND + "_" + Build.VERSION.RELEASE; }