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:org.chromium.latency.walt.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Thread.setDefaultUncaughtExceptionHandler(new LoggingExceptionHandler());
    setContentView(R.layout.activity_main);

    // App bar//from  w  w  w .j  a  va  2  s  . co  m
    toolbar = (Toolbar) findViewById(R.id.toolbar_main);
    setSupportActionBar(toolbar);
    getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
            int stackTopIndex = getSupportFragmentManager().getBackStackEntryCount() - 1;
            if (stackTopIndex >= 0) {
                toolbar.setTitle(getSupportFragmentManager().getBackStackEntryAt(stackTopIndex).getName());
            } else {
                toolbar.setTitle(R.string.app_name);
                getSupportActionBar().setDisplayHomeAsUpEnabled(false);
                // Disable fullscreen mode
                getSupportActionBar().show();
                getWindow().getDecorView().setSystemUiVisibility(0);
            }
        }
    });

    waltDevice = WaltDevice.getInstance(this);

    // Create front page fragment
    FrontPageFragment frontPageFragment = new FrontPageFragment();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.add(R.id.fragment_container, frontPageFragment);
    transaction.commit();

    logger = SimpleLogger.getInstance(this);
    broadcastManager = LocalBroadcastManager.getInstance(this);

    // Add basic version and device info to the log
    logger.log(String.format("WALT v%s  (versionCode=%d)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
    logger.log("WALT protocol version " + WaltDevice.PROTOCOL_VERSION);
    logger.log("DEVICE INFO:");
    logger.log("  " + Build.FINGERPRINT);
    logger.log("  Build.SDK_INT=" + Build.VERSION.SDK_INT);
    logger.log("  os.version=" + System.getProperty("os.version"));

    // Set volume buttons to control media volume
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    requestSystraceWritePermission();
    // Allow network operations on the main thread
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
}

From source file:com.github.javiersantos.piracychecker.LibraryUtils.java

/**
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.//w ww  .  j av  a 2 s  .  c o m
 *
 * Copyright (C) 2013, Vladislav Gingo Skoumal (http://www.skoumal.net)
 */
static boolean isInEmulator(boolean deepCheck) {
    int ratingCheckEmulator = 0;

    if (Build.PRODUCT.contains("sdk") || Build.PRODUCT.contains("Andy")
            || Build.PRODUCT.contains("ttVM_Hdragon") || Build.PRODUCT.contains("google_sdk")
            || Build.PRODUCT.contains("Droid4X") || Build.PRODUCT.contains("nox")
            || Build.PRODUCT.contains("sdk_x86") || Build.PRODUCT.contains("sdk_google")
            || Build.PRODUCT.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MANUFACTURER.equals("unknown") || Build.MANUFACTURER.equals("Genymotion")
            || Build.MANUFACTURER.contains("Andy") || Build.MANUFACTURER.contains("MIT")
            || Build.MANUFACTURER.contains("nox") || Build.MANUFACTURER.contains("TiantianVM")) {
        ratingCheckEmulator++;
    }

    if (Build.BRAND.equals("generic") || Build.BRAND.equals("generic_x86") || Build.BRAND.equals("TTVM")
            || Build.BRAND.contains("Andy")) {
        ratingCheckEmulator++;
    }

    if (Build.DEVICE.contains("generic") || Build.DEVICE.contains("generic_x86")
            || Build.DEVICE.contains("Andy") || Build.DEVICE.contains("ttVM_Hdragon")
            || Build.DEVICE.contains("Droid4X") || Build.DEVICE.contains("nox")
            || Build.DEVICE.contains("generic_x86_64") || Build.DEVICE.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MODEL.equals("sdk") || Build.MODEL.equals("google_sdk") || Build.MODEL.contains("Droid4X")
            || Build.MODEL.contains("TiantianVM") || Build.MODEL.contains("Andy")
            || Build.MODEL.equals("Android SDK built for x86_64")
            || Build.MODEL.equals("Android SDK built for x86")) {
        ratingCheckEmulator++;
    }

    if (Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86") || Build.HARDWARE.contains("nox")
            || Build.HARDWARE.contains("ttVM_x86")) {
        ratingCheckEmulator++;
    }

    if (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("generic/sdk/generic")
            || Build.FINGERPRINT.contains("generic_x86/sdk_x86/generic_x86")
            || Build.FINGERPRINT.contains("Andy") || Build.FINGERPRINT.contains("ttVM_Hdragon")
            || Build.FINGERPRINT.contains("generic_x86_64")
            || Build.FINGERPRINT.contains("generic/google_sdk/generic") || Build.FINGERPRINT.contains("vbox86p")
            || Build.FINGERPRINT.contains("generic/vbox86p/vbox86p")) {
        ratingCheckEmulator++;
    }

    if (deepCheck) {
        try {
            String opengl = GLES20.glGetString(GLES20.GL_RENDERER);
            if (opengl != null) {
                if (opengl.contains("Bluestacks") || opengl.contains("Translator"))
                    ratingCheckEmulator += 10;
            }
        } catch (Exception ignored) {
        }

        try {
            File sharedFolder = new File(Environment.getExternalStorageDirectory().toString()
                    + File.separatorChar + "windows" + File.separatorChar + "BstSharedFolder");
            if (sharedFolder.exists())
                ratingCheckEmulator += 10;
        } catch (Exception ignored) {
        }
    }

    return ratingCheckEmulator > 3;
}

From source file:net.frakbot.FWeather.util.FeedbackService.java

/**
 * Builds a feedback email body with some basic system info.
 *
 * @return Returns the generated system info.
 *///from   w  ww  .  jav  a2  s  .c  om
@SuppressWarnings("StringBufferReplaceableByString")
private String generateFeedbackBody() {
    StringBuilder sb = new StringBuilder("\n\n" + "-----------\n" + "System info\n" + "-----------\n\n");

    // HW information
    sb.append("Device model: ").append(Build.MODEL).append("\n");
    sb.append("Manifacturer: ").append(Build.MANUFACTURER).append("\n");
    sb.append("Brand: ").append(Build.BRAND).append("\n");
    sb.append("CPU ABI: ").append(Build.CPU_ABI).append("\n");
    sb.append("Product: ").append(Build.PRODUCT).append("\n").append("\n");

    // SW information
    sb.append("Android version: ").append(Build.VERSION.CODENAME).append("\n");
    sb.append("Release: ").append(Build.VERSION.RELEASE).append("\n");
    sb.append("Incremental: ").append(Build.VERSION.INCREMENTAL).append("\n");
    sb.append("Build: ").append(Build.FINGERPRINT).append("\n");
    sb.append("Kernel: ").append(getKernelVersion()).append("\n");

    // App info
    sb.append("App version: ").append(getAppVersionNumber(this));

    return sb.toString();
}

From source file:com.aosijia.dragonbutler.ui.widget.ActionSheet.java

public static boolean checkDeviceHasNavigationBar(Context activity) {

    //Emulator/*from  w w w.  j a va 2  s. c o m*/
    if (Build.FINGERPRINT.startsWith("generic"))
        return true;

    int id = activity.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
    return id > 0 && activity.getResources().getBoolean(id);
}

From source file:de.uni_weimar.mheinz.androidtouchscope.TouchScopeActivity.java

@Override
public void onResume() {
    super.onResume();

    if (mActiveScope == null) {
        initScope(!Build.FINGERPRINT.contains("generic"));
    }//  w ww .j  a  va 2  s . c  o  m

    startRunnableAndScope();
}

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

public static void scheduleRegisterTimer(int delay) {
    final int retrydelay = (delay < 500) ? 500 : delay;

    GCMTimer.schedule(new TimerTask() {
        @Override/*  w  w w  . j  a v a2s .  c o m*/
        public void run() {
            if (!IRCCloudApplication.getInstance().getApplicationContext().getSharedPreferences("prefs", 0)
                    .contains("session_key")) {
                return;
            }
            boolean success = false;
            if (getRegistrationId(IRCCloudApplication.getInstance().getApplicationContext()).length() == 0) {
                try {
                    String oldRegId = IRCCloudApplication.getInstance().getApplicationContext()
                            .getSharedPreferences("prefs", 0).getString("gcm_reg_id", "");
                    String regId = GoogleCloudMessaging
                            .getInstance(IRCCloudApplication.getInstance().getApplicationContext())
                            .register(BuildConfig.GCM_ID);
                    int appVersion = getAppVersion();
                    Log.i("IRCCloud", "Saving regId on app version " + appVersion);
                    SharedPreferences.Editor editor = IRCCloudApplication.getInstance().getApplicationContext()
                            .getSharedPreferences("prefs", 0).edit();
                    editor.putString("gcm_reg_id", regId);
                    editor.putInt("gcm_app_version", appVersion);
                    editor.putString("gcm_app_build", Build.FINGERPRINT);
                    editor.remove("gcm_registered");
                    editor.commit();
                    if (oldRegId.length() > 0 && !oldRegId.equals(regId)) {
                        Log.i("IRCCloud", "Unregistering old ID");
                        scheduleUnregisterTimer(1000, oldRegId, true);
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                    Log.w("IRCCloud", "Failed to register device ID, will retry in " + ((retrydelay * 2) / 1000)
                            + " seconds");
                    scheduleRegisterTimer(retrydelay * 2);
                    return;
                } catch (SecurityException e) {
                    //User has blocked GCM via AppOps
                    return;
                }
            }
            Log.i("IRCCloud", "Sending GCM ID to IRCCloud");
            try {
                JSONObject result = NetworkConnection.getInstance().registerGCM(
                        getRegistrationId(IRCCloudApplication.getInstance().getApplicationContext()),
                        IRCCloudApplication.getInstance().getApplicationContext()
                                .getSharedPreferences("prefs", 0).getString("session_key", ""));
                if (result.has("success"))
                    success = result.getBoolean("success");
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (success) {
                SharedPreferences.Editor editor = IRCCloudApplication.getInstance().getApplicationContext()
                        .getSharedPreferences("prefs", 0).edit();
                editor.putBoolean("gcm_registered", true);
                editor.commit();
                Log.d("IRCCloud", "Device successfully registered");
            } else {
                Log.w("IRCCloud", "Failed to register device ID, will retry in " + ((retrydelay * 2) / 1000)
                        + " seconds");
                scheduleRegisterTimer(retrydelay * 2);
            }
        }

    }, delay);

}

From source file:org.c99.wear_imessage.GCMIntentService.java

public static void scheduleRegisterTimer(Context ctx, int delay) {
    final Context context = ctx.getApplicationContext();
    final int retrydelay = (delay < 500) ? 500 : delay;

    GCMTimer.schedule(new TimerTask() {
        @Override//from ww  w .j a v a  2 s  .c  om
        public void run() {
            if (getRegistrationId(context).length() == 0) {
                try {
                    String regId = GoogleCloudMessaging.getInstance(context).register(GCM_ID);
                    int appVersion = getAppVersion(context);
                    SharedPreferences.Editor editor = context.getSharedPreferences("prefs", 0).edit();
                    editor.putString("gcm_reg_id", regId);
                    editor.putInt("gcm_app_version", appVersion);
                    editor.putString("gcm_app_build", Build.FINGERPRINT);
                    editor.remove("gcm_registered");
                    editor.commit();
                } catch (IOException ex) {
                    ex.printStackTrace();
                    scheduleRegisterTimer(context, retrydelay * 2);
                }
            }
        }

    }, delay);

}

From source file:de.schildbach.wallet.ui.ReportIssueDialogFragment.java

private static void appendDeviceInfo(final Appendable report, final Context context) throws IOException {
    final Resources res = context.getResources();
    final android.content.res.Configuration config = res.getConfiguration();
    final ActivityManager activityManager = (ActivityManager) context
            .getSystemService(Context.ACTIVITY_SERVICE);
    final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
            .getSystemService(Context.DEVICE_POLICY_SERVICE);

    report.append("Device Model: " + Build.MODEL + "\n");
    report.append("Android Version: " + Build.VERSION.RELEASE + "\n");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        report.append("Android security patch level: ").append(Build.VERSION.SECURITY_PATCH).append("\n");
    report.append("ABIs: ")
            .append(Joiner.on(", ").skipNulls()
                    .join(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? supportedAbisLollipop()
                            : supportedAbisKitKat()))
            .append("\n");
    report.append("Board: " + Build.BOARD + "\n");
    report.append("Brand: " + Build.BRAND + "\n");
    report.append("Device: " + Build.DEVICE + "\n");
    report.append("Display: " + Build.DISPLAY + "\n");
    report.append("Finger Print: " + Build.FINGERPRINT + "\n");
    report.append("Host: " + Build.HOST + "\n");
    report.append("ID: " + Build.ID + "\n");
    report.append("Product: " + Build.PRODUCT + "\n");
    report.append("Tags: " + Build.TAGS + "\n");
    report.append("Time: " + Build.TIME + "\n");
    report.append("Type: " + Build.TYPE + "\n");
    report.append("User: " + Build.USER + "\n");
    report.append("Configuration: " + config + "\n");
    report.append("Screen Layout: size "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK) + " long "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_LONG_MASK) + "\n");
    report.append("Display Metrics: " + res.getDisplayMetrics() + "\n");
    report.append(//from  w ww. ja v a2s  .  c  o  m
            "Memory Class: " + activityManager.getMemoryClass() + "/" + activityManager.getLargeMemoryClass()
                    + (activityManager.isLowRamDevice() ? " (low RAM device)" : "") + "\n");
    report.append("Storage Encryption Status: " + devicePolicyManager.getStorageEncryptionStatus() + "\n");
    report.append("Bluetooth MAC: " + bluetoothMac() + "\n");
    report.append("Runtime: ").append(System.getProperty("java.vm.name")).append(" ")
            .append(System.getProperty("java.vm.version")).append("\n");
}

From source file:org.c99.wear_imessage.GCMIntentService.java

public static String getRegistrationId(Context context) {
    final SharedPreferences prefs = context.getSharedPreferences("prefs", 0);
    String registrationId = prefs.getString("gcm_reg_id", "");
    if (registrationId != null && registrationId.length() == 0) {
        return "";
    }//from  ww  w. ja v  a 2s  .  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(context);
    if (registeredVersion != currentVersion) {
        return "";
    }
    String build = prefs.getString("gcm_app_build", "");
    if (!Build.FINGERPRINT.equals(build)) {
        return "";
    }
    return registrationId;
}

From source file:org.protocoderrunner.apprunner.api.PDevice.java

@ProtoMethod(description = "Get some device information", example = "")
@ProtoMethodParam(params = { "" })
public DeviceInfo info() {
    DeviceInfo deviceInfo = new DeviceInfo();

    // density dpi
    DisplayMetrics metrics = new DisplayMetrics();

    //TODO reenable this
    //contextUi.get().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    deviceInfo.screenDpi = metrics.densityDpi;

    // id//from  w w w . j  a  va  2 s  .  c  om
    deviceInfo.androidId = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);

    // imei
    deviceInfo.imei = ((TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE))
            .getDeviceId();

    deviceInfo.versionRelease = Build.VERSION.RELEASE;
    deviceInfo.versionRelease = Build.VERSION.INCREMENTAL;
    deviceInfo.sdk = Build.VERSION.SDK;
    deviceInfo.board = Build.BOARD;
    deviceInfo.brand = Build.BRAND;
    deviceInfo.device = Build.DEVICE;
    deviceInfo.fingerPrint = Build.FINGERPRINT;
    deviceInfo.host = Build.HOST;
    deviceInfo.id = Build.ID;
    deviceInfo.cpuAbi = Build.CPU_ABI;
    deviceInfo.cpuAbi2 = Build.CPU_ABI2;

    return deviceInfo;
}