Java Code Examples for android.os.Build#PRODUCT

The following examples show how to use android.os.Build#PRODUCT . 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: NativeDeviceInfoProvider.java    From YalpStore with GNU General Public License v2.0 6 votes vote down vote up
public String getUserAgentString() {
    return "Android-Finsky/" + URLEncoder.encode(gsfVersionProvider.getVendingVersionString(true)).replace("+", "%20") + " ("
        + "api=3"
        + ",versionCode=" + gsfVersionProvider.getVendingVersionCode(true)
        + ",sdk=" + Build.VERSION.SDK_INT
        + ",device=" + Build.DEVICE
        + ",hardware=" + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO ? Build.HARDWARE : Build.PRODUCT)
        + ",product=" + Build.PRODUCT
        + ",platformVersionRelease=" + Build.VERSION.RELEASE
        + ",model=" + URLEncoder.encode(Build.MODEL).replace("+", "%20")
        + ",buildId=" + Build.ID
        + ",isWideScreen=" + (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? "1" : "0")
        + ",supportedAbis=" + TextUtils.join(";", getPlatforms())
        + ")"
    ;
}
 
Example 2
Source File: FindEmulator.java    From BlogDemo with Apache License 2.0 6 votes vote down vote up
public static boolean hasEmulatorBuild(Context context) {
    String BOARD = Build.BOARD; // The name of the underlying board, like "unknown".
    // This appears to occur often on real hardware... that's sad
    // String BOOTLOADER = android.os.Build.BOOTLOADER; // The system bootloader version number.
    String BRAND = Build.BRAND; // The brand (e.g., carrier) the software is customized for, if any.
    // "generic"
    String DEVICE = Build.DEVICE; // The name of the industrial design. "generic"
    String HARDWARE = Build.HARDWARE; // The name of the hardware (from the kernel command line or
    // /proc). "goldfish"
    String MODEL = Build.MODEL; // The end-user-visible name for the end product. "sdk"
    String PRODUCT = Build.PRODUCT; // The name of the overall product.
    if ((BOARD.compareTo("unknown") == 0) /* || (BOOTLOADER.compareTo("unknown") == 0) */
            || (BRAND.compareTo("generic") == 0) || (DEVICE.compareTo("generic") == 0)
            || (MODEL.compareTo("sdk") == 0) || (PRODUCT.compareTo("sdk") == 0)
            || (HARDWARE.compareTo("goldfish") == 0)) {
        return true;
    }
    return false;
}
 
Example 3
Source File: StatusbarUtil.java    From MainActivityUIUtil with Apache License 2.0 6 votes vote down vote up
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 File: EmulatorDetector.java    From android-emulator-detector with Apache License 2.0 5 votes vote down vote up
public static String getDeviceInfo() {
    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;
}
 
Example 5
Source File: Utils.java    From IPTVFree with Apache License 2.0 5 votes vote down vote up
/**
 * 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 6
Source File: CrashHandler.java    From Pigeon with MIT License 5 votes vote down vote up
/**
 * 收集奔溃异常信息
 *
 * @param e 异常
 */
private void collectionException(Throwable e) {
    final String deviceInfo = Build.DEVICE + Build.VERSION.SDK_INT + Build.PRODUCT;
    final String errorInfo = e.getMessage();
    new Thread() {
        @Override
        public void run() {
            Log.e("system error:  ", "deviceInfo--->>>" + deviceInfo + "|||"+":errorInfo:  " + errorInfo);
        }
    }.start();

}
 
Example 7
Source File: AppUtils.java    From CrashReporter with Apache License 2.0 5 votes vote down vote up
public static String getDeviceDetails(Context context) {

        return "Device Information\n"
                + "\nDEVICE.ID : " + getDeviceId(context)
                + "\nUSER.ID : " + getUserIdentity(context)
                + "\nAPP.VERSION : " + getAppVersion(context)
                + "\nLAUNCHER.APP : " + getCurrentLauncherApp(context)
                + "\nTIMEZONE : " + timeZone()
                + "\nVERSION.RELEASE : " + Build.VERSION.RELEASE
                + "\nVERSION.INCREMENTAL : " + Build.VERSION.INCREMENTAL
                + "\nVERSION.SDK.NUMBER : " + Build.VERSION.SDK_INT
                + "\nBOARD : " + Build.BOARD
                + "\nBOOTLOADER : " + Build.BOOTLOADER
                + "\nBRAND : " + Build.BRAND
                + "\nCPU_ABI : " + Build.CPU_ABI
                + "\nCPU_ABI2 : " + Build.CPU_ABI2
                + "\nDISPLAY : " + Build.DISPLAY
                + "\nFINGERPRINT : " + Build.FINGERPRINT
                + "\nHARDWARE : " + Build.HARDWARE
                + "\nHOST : " + Build.HOST
                + "\nID : " + Build.ID
                + "\nMANUFACTURER : " + Build.MANUFACTURER
                + "\nMODEL : " + Build.MODEL
                + "\nPRODUCT : " + Build.PRODUCT
                + "\nSERIAL : " + Build.SERIAL
                + "\nTAGS : " + Build.TAGS
                + "\nTIME : " + Build.TIME
                + "\nTYPE : " + Build.TYPE
                + "\nUNKNOWN : " + Build.UNKNOWN
                + "\nUSER : " + Build.USER;
    }
 
Example 8
Source File: CrashHandler.java    From iMoney with Apache License 2.0 5 votes vote down vote up
private void collectionException(Throwable e) {

        final String exception = e.getMessage();
        // 手机用户手机的设备信息
        final String message = Build.DEVICE + ":" + Build.MODEL + ":" + Build.PRODUCT + ":" + Build.VERSION.SDK_INT;
        // 模拟联网操作
        new Thread() {
            @Override
            public void run() {
                Log.e("TAG", "exception = " + exception + ",message = " + message);
            }
        }.start();
    }
 
Example 9
Source File: SystemUtils.java    From tilt-game-android with MIT License 5 votes vote down vote up
public static boolean isEmulator() {
	if (Build.PRODUCT != null && Build.PRODUCT.equals("google_sdk")) {
		return true;
	} else if (Build.MODEL != null && Build.MODEL.equals("google_sdk")) {
		return true;
	} else if (Build.BRAND != null && Build.BRAND.startsWith("generic")){
		return true;
	} else if (Build.DEVICE != null && Build.DEVICE.startsWith("generic")) {
		return true;
	} else {
		return false;
	}
}
 
Example 10
Source File: LeakCanary.java    From DoraemonKit with Apache License 2.0 4 votes vote down vote up
/**
 * 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 11
Source File: DeviceUtils.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
public static boolean isMiBox2Device() {
    String manufacturer = Build.MANUFACTURER;
    String productName = Build.PRODUCT;
    return manufacturer.equalsIgnoreCase("Xiaomi")
        && productName.equalsIgnoreCase("dredd");
}
 
Example 12
Source File: RNDeviceModule.java    From react-native-device-info with MIT License 4 votes vote down vote up
@ReactMethod(isBlockingSynchronousMethod = true)
public String getProductSync() { return Build.PRODUCT; }
 
Example 13
Source File: DeviceUtils.java    From ZGDanmaku with Apache License 2.0 4 votes vote down vote up
public static boolean isMagicBoxDevice() {
    String manufacturer = Build.MANUFACTURER;
    String productName = Build.PRODUCT;
    return manufacturer.equalsIgnoreCase("MagicBox")
        && productName.equalsIgnoreCase("MagicBox");
}
 
Example 14
Source File: DeviceUtils.java    From Box with Apache License 2.0 4 votes vote down vote up
public static String getProduct() {
    return Build.PRODUCT;
}
 
Example 15
Source File: HelpActivity.java    From InviZible with GNU General Public License v3.0 4 votes vote down vote up
private String collectInfo() {
    String info;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        info = "BRAND " + Build.BRAND + (char) 10 +
                "MODEL " + Build.MODEL + (char) 10 +
                "MANUFACTURER " + Build.MANUFACTURER + (char) 10 +
                "PRODUCT " + Build.PRODUCT + (char) 10 +
                "DEVICE " + Build.DEVICE + (char) 10 +
                "BOARD " + Build.BOARD + (char) 10 +
                "HARDWARE " + Build.HARDWARE + (char) 10 +
                "SUPPORTED_ABIS " + Arrays.toString(Build.SUPPORTED_ABIS) + (char) 10 +
                "SUPPORTED_32_BIT_ABIS " + Arrays.toString(Build.SUPPORTED_32_BIT_ABIS) + (char) 10 +
                "SUPPORTED_64_BIT_ABIS " + Arrays.toString(Build.SUPPORTED_64_BIT_ABIS) + (char) 10 +
                "SDK_INT " + Build.VERSION.SDK_INT + (char) 10 +
                "APP_VERSION_CODE " + BuildConfig.VERSION_CODE + (char) 10 +
                "APP_VERSION_NAME " + BuildConfig.VERSION_NAME + (char) 10 +
                "APP_PROC_VERSION " + TopFragment.appProcVersion + (char) 10 +
                "CAN_FILTER " + Util.canFilter(this) + (char) 10 +
                "APP_VERSION " + TopFragment.appVersion + (char) 10 +
                "DNSCRYPT_INTERNAL_VERSION " + TopFragment.DNSCryptVersion + (char) 10 +
                "TOR_INTERNAL_VERSION " + TopFragment.TorVersion + (char) 10 +
                "I2PD_INTERNAL_VERSION " + TopFragment.ITPDVersion + (char) 10 +
                "SIGN_VERSION " + TopFragment.appSign;
    } else {
        info = "BRAND " + Build.BRAND + (char) 10 +
                "MODEL " + Build.MODEL + (char) 10 +
                "MANUFACTURER " + Build.MANUFACTURER + (char) 10 +
                "PRODUCT " + Build.PRODUCT + (char) 10 +
                "DEVICE " + Build.DEVICE + (char) 10 +
                "BOARD " + Build.BOARD + (char) 10 +
                "HARDWARE " + Build.HARDWARE + (char) 10 +
                "SDK_INT " + Build.VERSION.SDK_INT + (char) 10 +
                "APP_VERSION_CODE " + BuildConfig.VERSION_CODE + (char) 10 +
                "APP_VERSION_NAME " + BuildConfig.VERSION_NAME + (char) 10 +
                "APP_PROC_VERSION " + TopFragment.appProcVersion + (char) 10 +
                "CAN_FILTER " + Util.canFilter(this) + (char) 10 +
                "APP_VERSION " + TopFragment.appVersion + (char) 10 +
                "DNSCRYPT_INTERNAL_VERSION " + TopFragment.DNSCryptVersion + (char) 10 +
                "TOR_INTERNAL_VERSION " + TopFragment.TorVersion + (char) 10 +
                "I2PD_INTERNAL_VERSION " + TopFragment.ITPDVersion + (char) 10 +
                "SIGN_VERSION " + TopFragment.appSign;
    }

    return info;
}
 
Example 16
Source File: PLUtils.java    From panoramagl with Apache License 2.0 4 votes vote down vote up
public static boolean isEmulator() {
    String product = Build.PRODUCT;
    return (product != null && (product.equals("sdk") || product.contains("_sdk") || product.contains("sdk_")));
}
 
Example 17
Source File: PLUtils.java    From PanoramaGL with Apache License 2.0 4 votes vote down vote up
public static boolean isEmulator()
{
    String product = Build.PRODUCT;
    return (product != null && (product.equals("sdk") || product.contains("_sdk") || product.contains("sdk_")));
}
 
Example 18
Source File: DeviceUtils.java    From DevUtils with Apache License 2.0 2 votes vote down vote up
/**
 * 获取整个产品的名称
 * @return 整个产品的名称
 */
public static String getProduct() {
    return Build.PRODUCT;
}
 
Example 19
Source File: UiDevice.java    From za-Farmer with MIT License 2 votes vote down vote up
/**
 * Retrieves the product name of the device.
 *
 * This method provides information on what type of device the test is running on. This value is
 * the same as returned by invoking #adb shell getprop ro.product.name.
 *
 * @return product name of the device
 * @since API Level 17
 */
public String getProductName() {
    Tracer.trace();
    return Build.PRODUCT;
}
 
Example 20
Source File: KeyStoreManager.java    From DeviceConnect-Android with MIT License 2 votes vote down vote up
/**
 * Returns the name that should be used in a new certificate.
 * <p>
 * The format is:
 * "CN=Device Connect-server/PRODUCT/DEVICE/MODEL/unique identifier"
 * @param id ID
 * @return Certificate Name
 */
private static String getCertificateName(final String id) {
    return "CN=Device Connect-server/" + Build.PRODUCT + "/" + Build.DEVICE + "/" + Build.MODEL + "/" + id;
}