Android examples for Android OS:OS Build
collect Build Information and return a string
//package com.java2s; import java.util.Arrays; import java.util.regex.Pattern; import android.hardware.Camera; import android.os.Build; public class Main { private static final Pattern SEMICOLON = Pattern.compile(";"); public static String collectStats(Camera.Parameters parameters) { return collectStats(parameters.flatten()); }/*from w ww. java2s . co m*/ public static String collectStats(CharSequence flattenedParams) { StringBuilder result = new StringBuilder(1000); result.append("BOARD=").append(Build.BOARD).append('\n'); result.append("BRAND=").append(Build.BRAND).append('\n'); result.append("CPU_ABI=").append(Build.CPU_ABI).append('\n'); result.append("DEVICE=").append(Build.DEVICE).append('\n'); result.append("DISPLAY=").append(Build.DISPLAY).append('\n'); result.append("FINGERPRINT=").append(Build.FINGERPRINT) .append('\n'); result.append("HOST=").append(Build.HOST).append('\n'); result.append("ID=").append(Build.ID).append('\n'); result.append("MANUFACTURER=").append(Build.MANUFACTURER) .append('\n'); result.append("MODEL=").append(Build.MODEL).append('\n'); result.append("PRODUCT=").append(Build.PRODUCT).append('\n'); result.append("TAGS=").append(Build.TAGS).append('\n'); result.append("TIME=").append(Build.TIME).append('\n'); result.append("TYPE=").append(Build.TYPE).append('\n'); result.append("USER=").append(Build.USER).append('\n'); result.append("VERSION.CODENAME=").append(Build.VERSION.CODENAME) .append('\n'); result.append("VERSION.INCREMENTAL=") .append(Build.VERSION.INCREMENTAL).append('\n'); result.append("VERSION.RELEASE=").append(Build.VERSION.RELEASE) .append('\n'); result.append("VERSION.SDK_INT=").append(Build.VERSION.SDK_INT) .append('\n'); if (flattenedParams != null) { String[] params = SEMICOLON.split(flattenedParams); Arrays.sort(params); for (String param : params) { result.append(param).append('\n'); } } return result.toString(); } }