Java Code Examples for android.os.Build#MANUFACTURER

The following examples show how to use android.os.Build#MANUFACTURER . 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: RxDeviceTool.java    From RxTools-master with Apache License 2.0 5 votes vote down vote up
/**
 * 获取手机唯一标识序列号
 *
 * @return
 */
public static String getUniqueSerialNumber() {
    String phoneName = Build.MODEL;// Galaxy nexus 品牌类型
    String manuFacturer = Build.MANUFACTURER;//samsung 品牌
    Log.d("详细序列号", manuFacturer + "-" + phoneName + "-" + getSerialNumber());
    return manuFacturer + "-" + phoneName + "-" + getSerialNumber();
}
 
Example 2
Source File: GPXExporter.java    From FancyPlaces with GNU General Public License v3.0 5 votes vote down vote up
public String getMetaData() {
    return "<metadata>\n" +
            "\t<author>\n" +
            "\t\t<name>" + Build.MANUFACTURER + " " + Build.MODEL + "</name>\n" +
            "\t</author>\n" +
            "</metadata>";
}
 
Example 3
Source File: ExceptionHelper.java    From Pix-Art-Messenger with GNU General Public License v3.0 5 votes vote down vote up
public static String getDeviceName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if (model.startsWith(manufacturer)) {
        return model;
    } else {
        return manufacturer + " " + model;
    }
}
 
Example 4
Source File: RxCrashTool.java    From RxTools-master with Apache License 2.0 5 votes vote down vote up
/**
 * 获取崩溃头
 *
 * @return 崩溃头
 */
private String getCrashHead() {
    return "\n************* Crash Log Head ****************" +
            "\nDevice Manufacturer: " + Build.MANUFACTURER +// 设备厂商
            "\nDevice Model       : " + Build.MODEL +// 设备型号
            "\nAndroid Version    : " + Build.VERSION.RELEASE +// 系统版本
            "\nAndroid SDK        : " + Build.VERSION.SDK_INT +// SDK版本
            "\nApp VersionName    : " + mVersionName +
            "\nApp VersionCode    : " + mVersionCode +
            "\n************* Crash Log Head ****************\n\n";
}
 
Example 5
Source File: CrashHelper.java    From AndroidCrashHelper with MIT License 5 votes vote down vote up
/**
 * INTERNAL method that returns the device model name with correct capitalization.
 * Taken from: http://stackoverflow.com/a/12707479/1254846
 *
 * @return The device model name (i.e., "LGE Nexus 5")
 */
private static String getDeviceModelName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if (model.startsWith(manufacturer)) {
        return capitalize(model);
    } else {
        return capitalize(manufacturer) + " " + model;
    }
}
 
Example 6
Source File: BluetoothPeripheral.java    From blessed-android with MIT License 5 votes vote down vote up
private int getTimoutThreshold() {
    String manufacturer = Build.MANUFACTURER;
    if (manufacturer.equals("samsung")) {
        return TIMEOUT_THRESHOLD_SAMSUNG;
    } else {
        return TIMEOUT_THRESHOLD_DEFAULT;
    }
}
 
Example 7
Source File: DeviceInfo.java    From Learning-Resources with MIT License 5 votes vote down vote up
public static String getDeviceName() {
    String manufacturer = Build.MANUFACTURER;
    String model = Build.MODEL;
    if (model.startsWith(manufacturer)) {
        return capitalize(model);
    }
    return capitalize(manufacturer) + " " + model;
}
 
Example 8
Source File: RomUtils.java    From Common with Apache License 2.0 5 votes vote down vote up
private static String getManufacturer() {
    try {
        String manufacturer = Build.MANUFACTURER;
        if (!TextUtils.isEmpty(manufacturer)) {
            return manufacturer.toLowerCase();
        }
    } catch (Throwable ignore) {/**/}
    return UNKNOWN;
}
 
Example 9
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 10
Source File: DeviceInfoUtil.java    From SoloPi with Apache License 2.0 4 votes vote down vote up
public static String getDeviceManufacturer() {
    return Build.MANUFACTURER;
}
 
Example 11
Source File: StaticUtils.java    From SimplicityBrowser with MIT License 4 votes vote down vote up
private static boolean isSamsung() {
    String manufacturer = Build.MANUFACTURER;
    if (manufacturer != null) return manufacturer.toLowerCase().equals("samsung");
    return false;
}
 
Example 12
Source File: RomUtils.java    From QPM with Apache License 2.0 4 votes vote down vote up
public static boolean is360Rom() {
    String manufacturer = Build.MANUFACTURER;
    return !TextUtils.isEmpty(manufacturer) && manufacturer.toUpperCase().contains(ROM_QIKU);
}
 
Example 13
Source File: DeviceHelper.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
/** device factory */
public String getFactory() {
	return Build.MANUFACTURER;
}
 
Example 14
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 15
Source File: CrashActivity.java    From Crasher with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_crash);

    toolbar = findViewById(R.id.toolbar);
    name = findViewById(R.id.name);
    message = findViewById(R.id.message);
    description = findViewById(R.id.description);
    copy = findViewById(R.id.copy);
    share = findViewById(R.id.share);
    email = findViewById(R.id.email);
    stackTraceHeader = findViewById(R.id.stackTraceHeader);
    stackTraceArrow = findViewById(R.id.stackTraceArrow);
    stackTrace = findViewById(R.id.stackTrace);

    setSupportActionBar(toolbar);
    actionBar = getSupportActionBar();

    int color = getIntent().getIntExtra(EXTRA_COLOR, ContextCompat.getColor(this, R.color.colorPrimary));
    int colorDark = ColorUtils.darkColor(color);
    boolean isColorDark = ColorUtils.isColorDark(color);

    toolbar.setBackgroundColor(color);
    toolbar.setTitleTextColor(isColorDark ? Color.WHITE : Color.BLACK);

    copy.setBackgroundColor(colorDark);
    copy.setTextColor(colorDark);
    copy.setOnClickListener(this);

    share.setBackgroundColor(colorDark);
    share.setTextColor(colorDark);
    share.setOnClickListener(this);

    email.setBackgroundColor(colorDark);
    email.setTextColor(colorDark);
    if (getIntent().hasExtra(EXTRA_EMAIL)) {
        email.setOnClickListener(this);
    } else email.setVisibility(View.GONE);

    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(String.format(Locale.getDefault(), getString(R.string.title_crasher_crashed), getString(R.string.app_name)));
        actionBar.setHomeAsUpIndicator(ImageUtils.getVectorDrawable(this, R.drawable.ic_crasher_back, isColorDark ? Color.WHITE : Color.BLACK));
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setStatusBarColor(colorDark);
        getWindow().setNavigationBarColor(colorDark);
    }

    String stack = getIntent().getStringExtra(EXTRA_STACK_TRACE);
    String stackCause = CrashUtils.getCause(this, stack);

    String nameString = getIntent().getStringExtra(EXTRA_NAME) + (stackCause != null ? " at " + stackCause : "");
    String messageString = getIntent().getStringExtra(EXTRA_NAME);

    name.setText(nameString);
    if (messageString != null && messageString.length() > 0)
        message.setText(messageString);
    else message.setVisibility(View.GONE);

    description.setText(String.format(Locale.getDefault(), getString(R.string.msg_crasher_crashed), getString(R.string.app_name)));

    stackTrace.setText(stack);
    stackTraceHeader.setOnClickListener(this);
    if (BuildConfig.DEBUG)
        stackTraceHeader.callOnClick();

    body = nameString + "\n" + (messageString != null ? messageString : "") + "\n\n" + stack
            + "\n\nAndroid Version: " + Build.VERSION.SDK_INT
            + "\nDevice Manufacturer: " + Build.MANUFACTURER
            + "\nDevice Model: " + Build.MODEL
            + "\n\n" + (getIntent().hasExtra(EXTRA_DEBUG_MESSAGE) ? getIntent().getStringExtra(EXTRA_DEBUG_MESSAGE) : "");
}
 
Example 16
Source File: AVMixPushManager.java    From java-unified-sdk with Apache License 2.0 4 votes vote down vote up
private static boolean isXiaomiPhone() {
  final String phoneManufacturer = Build.MANUFACTURER;
  return !StringUtil.isEmpty(phoneManufacturer)
      && phoneManufacturer.toLowerCase().contains("xiaomi");
}
 
Example 17
Source File: AndroidUtil.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public static String getManufacturer() {
    return Build.MANUFACTURER;
}
 
Example 18
Source File: ApkUtils.java    From TowerCollector with Mozilla Public License 2.0 4 votes vote down vote up
public static String getDeviceName() {
    return Build.MANUFACTURER + " " + Build.MODEL;
}
 
Example 19
Source File: DeviceUtil.java    From imsdk-android with MIT License 2 votes vote down vote up
/**
 * 设备厂商
 *
 * @return
 */
public static String getPhoneBrand() {
    return Build.BOARD + "  " + Build.MANUFACTURER;
}
 
Example 20
Source File: DeviceUtils.java    From Common with Apache License 2.0 2 votes vote down vote up
/**
 * Return the manufacturer of the product/hardware.
 * <p>e.g. Xiaomi</p>
 *
 * @return the manufacturer of the product/hardware
 */
public static String getManufacturer() {
    return Build.MANUFACTURER;
}