Example usage for android.os Build FINGERPRINT

List of usage examples for android.os Build FINGERPRINT

Introduction

In this page you can find the example usage for android.os Build FINGERPRINT.

Prototype

String FINGERPRINT

To view the source code for android.os Build FINGERPRINT.

Click Source Link

Document

A string that uniquely identifies this build.

Usage

From source file:com.bhb27.isu.Props.java

private void updateState() {
    if (rootAccess) {
        mPropsScreen.removePreference(mPropsRemoveCat);
        String[] value = new String[Constants.props.length];
        String summary = "";
        for (int i = 0; i < Constants.props.length; i++) {
            value[i] = Tools.getprop(Constants.props[i]);
            if (value[i] == null || value[i].isEmpty()) {
                props[i].setValue("");
                summary = getString(R.string.unknown);
                props[i].setSummary(summary);
                props[i].setIcon(R.drawable.interrogation);
            } else {
                props[i].setValue(value[i]);
                summary = value[i];/* w w  w  .j  a v  a 2s . com*/
                props[i].setSummary(summary);
                props[i].setIcon(summary.equals(Constants.props_OK[i]) ? R.drawable.ok : R.drawable.warning);
            }
        }
        String BuildFingerprint = Build.FINGERPRINT;
        String RoBuildFingerprint = Tools.getprop(Constants.robuildfingerprint);
        if (Tools.getprop(Constants.robuildfingerprint)
                .equals(Tools.getprop(Constants.robootbuildfingerprint))) {
            mBuildFingerprint.setSummary(Build.FINGERPRINT + getString(R.string.fingerprint_help));
            // use setIcon(Drawable) instead of setIcon(int) to avoid falls back to the previously-set in a new Drawable that is null
            mBuildFingerprint.setIcon(ContextCompat.getDrawable(getActivity(), R.drawable.warning));
        } else if (RoBuildFingerprint.equals(BuildFingerprint)) {
            mBuildFingerprint.setSummary(Build.FINGERPRINT);
            mBuildFingerprint.setIcon(originalIcon);
        } else {
            mBuildFingerprint.setSummary(RoBuildFingerprint + getString(R.string.fingerprint_apply));
            mBuildFingerprint.setIcon(ContextCompat.getDrawable(getActivity(), R.drawable.exclamation));
        }

        try {
            getActivity().registerReceiver(updatePropsReceiver, new IntentFilter("updatePropsReceiver"));
        } catch (NullPointerException ignored) {
        }
    } else {
        mPropsEdit.setEnabled(false);
        mPropsSpecial.setEnabled(false);
        mPropsKnown.setEnabled(false);
        mPropsKnownList.setEnabled(false);
    }
}

From source file:com.framgia.android.emulator.EmulatorDetector.java

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;
}

From source file:com.jungle.base.utils.MiscUtils.java

public static String getDeviceInfo() {
    // Nexus 5, API-19, google/hammerhead/...../release-keys, TIME-1403892907000, CPU_ABI-armeabi-v7a
    ////w  ww . java2 s. c om
    return new StringBuilder().append(Build.MODEL).append(", API-").append(Build.VERSION.SDK_INT).append(", ")
            .append(Build.FINGERPRINT).append(", TIME-").append(Build.TIME).append(", CPU_ABI-")
            .append(Build.CPU_ABI).toString();
}

From source file:com.irccloud.android.GCMIntentService.java

public static String getRegistrationId(Context context) {
    final SharedPreferences prefs = context.getSharedPreferences("prefs", 0);
    String registrationId = prefs.getString("gcm_reg_id", "");
    if (registrationId.length() == 0) {
        Log.i("IRCCloud", "Registration not found.");
        return "";
    }//w  ww.  java2  s  .c  o m
    // Check if app was updated; if so, it must clear the registration ID
    // since the existing regID is not guaranteed to work with the new
    // app version.
    int registeredVersion = prefs.getInt("gcm_app_version", Integer.MIN_VALUE);
    int currentVersion = getAppVersion();
    if (registeredVersion != currentVersion) {
        Log.i("IRCCloud", "App version changed.");
        return "";
    }
    String build = prefs.getString("gcm_app_build", "");
    if (!Build.FINGERPRINT.equals(build)) {
        Log.i("IRCCloud", "OS version changed.");
        return "";
    }
    return registrationId;
}

From source file:me.piebridge.prevent.ui.UserGuideActivity.java

private String getVersionInfo(boolean showAppVersion) {
    StringBuilder sb = new StringBuilder();
    String licenseName;//from   w w w.j av a2 s  . c o  m
    if (!BuildConfig.DONATE) {
        licenseName = null;
    } else if (showAppVersion) {
        licenseName = LicenseUtils.getLicense(this);
    } else {
        licenseName = LicenseUtils.getLicenseName(this);
    }
    if (!TextUtils.isEmpty(licenseName)) {
        sb.append(licenseName);
        sb.append("\n");
    }
    showVersion(sb);
    sb.append("Android: ");
    sb.append(Locale.getDefault());
    sb.append("-");
    sb.append(Build.VERSION.RELEASE);
    sb.append("\n");
    if (showAppVersion) {
        sb.append(getString(R.string.app_name));
        sb.append(": ");
        sb.append(BuildConfig.VERSION_NAME);
        sb.append("\n");
    }
    sb.append(Build.FINGERPRINT);
    return sb.toString();
}

From source file:com.google.android.dialer.provider.DialerProvider.java

@Override
public boolean onCreate() {
    Context context = getContext();
    StringBuilder sb = new StringBuilder("GoogleDialer ");
    try {/*w  w  w .ja  v  a 2 s  .  c  om*/
        sb.append(context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName);
        sb.append(" ");
        sb.append(Build.FINGERPRINT);
        mUserAgent = sb.toString();
        return true;
    } catch (PackageManager.NameNotFoundException e) {
        // TODO: Assuming a return false should be here
        return false;
    }
}

From source file:com.irccloud.android.activity.BaseActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_logout:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Logout");
        builder.setMessage("Would you like to logout of IRCCloud?");

        builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

            @Override/*from  w  ww.  j  ava  2  s  .  co  m*/
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        builder.setPositiveButton("Logout", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                conn.logout();
                if (mGoogleApiClient.isConnected()) {
                    Auth.CredentialsApi.disableAutoSignIn(mGoogleApiClient)
                            .setResultCallback(new ResultCallback<Status>() {
                                @Override
                                public void onResult(Status status) {
                                    Intent i = new Intent(BaseActivity.this, LoginActivity.class);
                                    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
                                    startActivity(i);
                                    finish();
                                }
                            });
                } else {
                    Intent i = new Intent(BaseActivity.this, LoginActivity.class);
                    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
                    startActivity(i);
                    finish();
                }
            }
        });
        AlertDialog dialog = builder.create();
        dialog.setOwnerActivity(this);
        dialog.show();
        break;
    case R.id.menu_settings:
        Intent i = new Intent(this, PreferencesActivity.class);
        startActivity(i);
        break;
    case R.id.menu_feedback:
        try {
            String bugReport = "Briefly describe the issue below:\n\n\n\n\n" + "===========\n"
                    + ((NetworkConnection.getInstance().getUserInfo() != null)
                            ? ("UID: " + NetworkConnection.getInstance().getUserInfo().id + "\n")
                            : "")
                    + "App version: " + getPackageManager().getPackageInfo(getPackageName(), 0).versionName
                    + " (" + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + ")\n"
                    + "Device: " + Build.MODEL + "\n" + "Android version: " + Build.VERSION.RELEASE + "\n"
                    + "Firmware fingerprint: " + Build.FINGERPRINT + "\n";

            File logsDir = new File(getFilesDir(),
                    ".Fabric/com.crashlytics.sdk.android.crashlytics-core/log-files/");
            File log = null;
            File output = null;
            if (logsDir.exists()) {
                long max = Long.MIN_VALUE;
                for (File f : logsDir.listFiles()) {
                    if (f.lastModified() > max) {
                        max = f.lastModified();
                        log = f;
                    }
                }

                if (log != null) {
                    File f = new File(getFilesDir(), "logs");
                    f.mkdirs();
                    output = new File(f, LOG_FILENAME);
                    byte[] b = new byte[1];

                    FileOutputStream out = new FileOutputStream(output);
                    FileInputStream is = new FileInputStream(log);
                    is.skip(5);

                    while (is.available() > 0 && is.read(b, 0, 1) > 0) {
                        if (b[0] == ' ') {
                            while (is.available() > 0 && is.read(b, 0, 1) > 0) {
                                out.write(b);
                                if (b[0] == '\n')
                                    break;
                            }
                        }
                    }
                    is.close();
                    out.close();
                }
            }

            Intent email = new Intent(Intent.ACTION_SEND);
            email.setData(Uri.parse("mailto:"));
            email.setType("message/rfc822");
            email.putExtra(Intent.EXTRA_EMAIL, new String[] { "IRCCloud Team <team@irccloud.com>" });
            email.putExtra(Intent.EXTRA_TEXT, bugReport);
            email.putExtra(Intent.EXTRA_SUBJECT, "IRCCloud for Android");
            if (log != null) {
                email.putExtra(Intent.EXTRA_STREAM,
                        FileProvider.getUriForFile(this, getPackageName() + ".fileprovider", output));
            }
            startActivityForResult(Intent.createChooser(email, "Send Feedback:"), 0);
        } catch (Exception e) {
            Toast.makeText(this, "Unable to generate email report: " + e.getMessage(), Toast.LENGTH_SHORT)
                    .show();
            Crashlytics.logException(e);
            NetworkConnection.printStackTraceToCrashlytics(e);
        }
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.entertailion.android.dial.ServerFinder.java

private boolean isSimulator() {
    return Build.FINGERPRINT.startsWith("generic");
}

From source file:org.brandroid.openmanager.fragments.DialogHandler.java

public static String getDeviceInfo() {
    String ret = "";
    String sep = "\n";
    ret += sep + "Build Info:" + sep;
    ret += "SDK: " + Build.VERSION.SDK_INT + sep;
    if (OpenExplorer.SCREEN_WIDTH > -1)
        ret += "Screen: " + OpenExplorer.SCREEN_WIDTH + "x" + OpenExplorer.SCREEN_HEIGHT + sep;
    if (OpenExplorer.SCREEN_DPI > -1)
        ret += "DPI: " + OpenExplorer.SCREEN_DPI + sep;
    ret += "Lang: " + getLangCode() + sep;
    ret += "Fingerprint: " + Build.FINGERPRINT + sep;
    ret += "Manufacturer: " + Build.MANUFACTURER + sep;
    ret += "Model: " + Build.MODEL + sep;
    ret += "Product: " + Build.PRODUCT + sep;
    ret += "Brand: " + Build.BRAND + sep;
    ret += "Board: " + Build.BOARD + sep;
    ret += "Bootloader: " + Build.BOOTLOADER + sep;
    ret += "Hardware: " + Build.HARDWARE + sep;
    ret += "Display: " + Build.DISPLAY + sep;
    ret += "Language: " + Locale.getDefault().getDisplayLanguage() + sep;
    ret += "Country: " + Locale.getDefault().getDisplayCountry() + sep;
    ret += "Tags: " + Build.TAGS + sep;
    ret += "Type: " + Build.TYPE + sep;
    ret += "User: " + Build.USER + sep;
    if (Build.UNKNOWN != null)
        ret += "Unknown: " + Build.UNKNOWN + sep;
    ret += "ID: " + Build.ID;
    return ret;//from  w  w w  .  j av  a2  s.c  om
}

From source file:de.mkrtchyan.recoverytools.RecoveryTools.java

public void report(final boolean isCancelable) {
    final Dialog reportDialog = mNotifyer.createDialog(R.string.commentar, R.layout.dialog_comment, false,
            true);/* www.  j av a  2 s .  c om*/
    new Thread(new Runnable() {
        @Override
        public void run() {
            /** Creates a report Email including a Comment and important device infos */
            final Button bGo = (Button) reportDialog.findViewById(R.id.bGo);
            bGo.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    if (!Common.getBooleanPref(mContext, PREF_NAME, PREF_KEY_ADS))
                        Toast.makeText(mContext, R.string.please_ads, Toast.LENGTH_SHORT).show();
                    Toast.makeText(mContext, R.string.donate_to_support, Toast.LENGTH_SHORT).show();
                    try {
                        ArrayList<File> files = new ArrayList<File>();
                        File TestResults = new File(mContext.getFilesDir(), "results.txt");
                        try {
                            if (TestResults.exists()) {
                                if (TestResults.delete()) {
                                    FileOutputStream fos = openFileOutput(TestResults.getName(),
                                            Context.MODE_PRIVATE);
                                    fos.write(("Recovery-Tools:\n\n"
                                            + mShell.execCommand(
                                                    "ls -lR " + PathToRecoveryTools.getAbsolutePath())
                                            + "\nCache Tree:\n" + mShell.execCommand("ls -lR /cache") + "\n"
                                            + "\nMTD result:\n" + mShell.execCommand("cat /proc/mtd") + "\n"
                                            + "\nDevice Tree:\n\n" + mShell.execCommand("ls -lR /dev"))
                                                    .getBytes());
                                }
                                files.add(TestResults);
                            }
                        } catch (FileNotFoundException e) {
                            e.printStackTrace();
                        }
                        if (getPackageManager() != null) {
                            PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                            EditText text = (EditText) reportDialog.findViewById(R.id.etComment);
                            String comment = "";
                            if (text.getText() != null)
                                comment = text.getText().toString();
                            Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
                            intent.setType("text/plain");
                            intent.putExtra(Intent.EXTRA_EMAIL,
                                    new String[] { "ashotmkrtchyan1995@gmail.com" });
                            intent.putExtra(Intent.EXTRA_SUBJECT, "Recovery-Tools report");
                            intent.putExtra(Intent.EXTRA_TEXT, "Package Infos:" + "\n\nName: "
                                    + pInfo.packageName + "\nVersionName: " + pInfo.versionName
                                    + "\nVersionCode: " + pInfo.versionCode + "\n\n\nProduct Info: "
                                    + "\n\nManufacture: " + android.os.Build.MANUFACTURER + "\nDevice: "
                                    + Build.DEVICE + " (" + mDevice.getDeviceName() + ")" + "\nBoard: "
                                    + Build.BOARD + "\nBrand: " + Build.BRAND + "\nModel: " + Build.MODEL
                                    + "\nFingerprint: " + Build.FINGERPRINT + "\nAndroid SDK Level: "
                                    + Build.VERSION.CODENAME + " (" + Build.VERSION.SDK_INT + ")"
                                    + "\nRecovery Supported: " + mDevice.isRecoverySupported()
                                    + "\nRecovery Path: " + mDevice.getRecoveryPath() + "\nRecovery Version: "
                                    + mDevice.getRecoveryVersion() + "\nRecovery MTD: "
                                    + mDevice.isRecoveryMTD() + "\nRecovery DD: " + mDevice.isRecoveryDD()
                                    + "\nKernel Supported: " + mDevice.isKernelSupported() + "\nKernel Path: "
                                    + mDevice.getKernelPath() + "\nKernel Version: "
                                    + mDevice.getKernelVersion() + "\nKernel MTD: " + mDevice.isKernelMTD()
                                    + "\nKernel DD: " + mDevice.isKernelDD() + "\n\nCWM: "
                                    + mDevice.isCwmSupported() + "\nTWRP: " + mDevice.isTwrpSupported()
                                    + "\nPHILZ: " + mDevice.isPhilzSupported()
                                    + "\n\n\n===========COMMENT==========\n" + comment
                                    + "\n===========COMMENT END==========\n" + "\n===========PREFS==========\n"
                                    + getAllPrefs() + "\n===========PREFS END==========\n");
                            File CommandLogs = new File(mContext.getFilesDir(), Shell.Logs);
                            if (CommandLogs.exists()) {
                                files.add(CommandLogs);
                            }
                            files.add(new File(getFilesDir(), "last_log.txt"));
                            ArrayList<Uri> uris = new ArrayList<Uri>();
                            for (File file : files) {
                                mShell.execCommand("cp " + file.getAbsolutePath() + " "
                                        + new File(mContext.getFilesDir(), file.getName()).getAbsolutePath());
                                file = new File(mContext.getFilesDir(), file.getName());
                                mToolbox.setFilePermissions(file, "644");
                                uris.add(Uri.fromFile(file));
                            }
                            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
                            startActivity(Intent.createChooser(intent, "Send over Gmail"));
                            reportDialog.dismiss();
                        }
                    } catch (Exception e) {
                        reportDialog.dismiss();
                        Notifyer.showExceptionToast(mContext, TAG, e);
                    }
                }
            });
        }
    }).start();
    reportDialog.setCancelable(isCancelable);
    reportDialog.show();
}