Example usage for android.os Build HARDWARE

List of usage examples for android.os Build HARDWARE

Introduction

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

Prototype

String HARDWARE

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

Click Source Link

Document

The name of the hardware (from the kernel command line or /proc).

Usage

From source file:com.example.android.camera2video.CameraActivity.java

public static void startLogging(String pathBase) {
    Log.e(TAG, "Logging " + pathBase);
    mLogTime = SystemClock.elapsedRealtime();
    try {/* ww  w .  ja  v  a2  s.c  o m*/
        mFileWriter = new FileWriter(pathBase + ".csv");
        mFileWriter.write("//VERSION_NAME " + BuildConfig.VERSION_NAME + "\n");
        mFileWriter.write("//MODEL " + Build.MODEL + "\n");
        mFileWriter.write("//MANUFACTURER " + Build.MANUFACTURER + "\n");
        mFileWriter.write("//HARDWARE " + Build.HARDWARE + "\n");
        mFileWriter.write("//SERIAL " + Build.SERIAL + "\n");
        mFileWriter.write("//ANDROID " + Build.VERSION.RELEASE + "\n");
        mFileWriter.write("//SDK_INT " + Build.VERSION.SDK_INT + "\n");
        mFileWriter.write("//INCREMENTAL " + Build.VERSION.INCREMENTAL + "\n");
        mFileWriter.write("//CODENAME " + Build.VERSION.CODENAME + "\n");
    } catch (IOException e) {
        e.printStackTrace();
    }
    mLogging = true;
}

From source file:org.cook_e.cook_e.BugReportActivity.java

/**
 * Gathers information about the device running the application and returns it as a JSONObject
 * @return information about the system//  w ww  . j  a va 2 s .  c  o  m
 */
private JSONObject getSystemInformation() {
    final JSONObject json = new JSONObject();

    try {
        final JSONObject build = new JSONObject();
        build.put("version_name", BuildConfig.VERSION_NAME);
        build.put("version_code", BuildConfig.VERSION_CODE);
        build.put("build_type", BuildConfig.BUILD_TYPE);
        build.put("debug", BuildConfig.DEBUG);

        json.put("build", build);

        final JSONObject device = new JSONObject();
        device.put("board", Build.BOARD);
        device.put("bootloader", Build.BOOTLOADER);
        device.put("brand", Build.BRAND);
        device.put("device", Build.DEVICE);
        device.put("display", Build.DISPLAY);
        device.put("fingerprint", Build.FINGERPRINT);
        device.put("hardware", Build.HARDWARE);
        device.put("host", Build.HOST);
        device.put("id", Build.ID);
        device.put("manufacturer", Build.MANUFACTURER);
        device.put("model", Build.MODEL);
        device.put("product", Build.PRODUCT);
        device.put("radio", Build.getRadioVersion());
        device.put("serial", Build.SERIAL);
        device.put("tags", Build.TAGS);
        device.put("time", Build.TIME);
        device.put("type", Build.TYPE);
        device.put("user", Build.USER);

        json.put("device", device);
    } catch (JSONException e) {
        // Ignore
    }

    return json;
}

From source file:library.artaris.cn.library.utils.SystemUtils.java

/**
 * ??//from   ww w.  j  a v a 2s  . c o  m
 * @return
 */
public static boolean isRunningOnEmulator() {
    return Build.BRAND.contains("generic") || Build.DEVICE.contains("generic") || Build.PRODUCT.contains("sdk")
            || Build.HARDWARE.contains("goldfish") || Build.MANUFACTURER.contains("Genymotion")
            || Build.PRODUCT.contains("vbox86p") || Build.DEVICE.contains("vbox86p")
            || Build.HARDWARE.contains("vbox86");
}

From source file:com.fallahpoor.infocenter.fragments.CpuFragment.java

private String getManufacturer() {

    String manufacturer;// w  w  w . j av  a2 s  . c  om
    String hardware = Build.HARDWARE;

    switch (hardware.toLowerCase(Locale.US)) {
    case "qcom":
        manufacturer = getString(R.string.cpu_sub_item_qualcomm);
        break;
    default:
        manufacturer = hardware;
    }

    return manufacturer;

}

From source file:at.jclehner.appopsxposed.BugReportBuilder.java

private void collectDeviceInfo(StringBuilder sb) {
    sb.append("\n---------------------------------------------------");
    sb.append("\n------------------- DEVICE INFO -------------------");
    sb.append("\nAndroid version: " + Build.VERSION.RELEASE + " (" + Build.VERSION.SDK_INT + ")");
    sb.append("\nFingerprint    : " + Build.FINGERPRINT);
    sb.append("\nDevice name    : " + Build.MANUFACTURER + " " + Build.MODEL + " (" + Build.PRODUCT + "/"
            + Build.HARDWARE + ")");
    sb.append("\nAppOpsManager  : ");

    try {/*from ww  w .j  av a2s.  com*/
        Class.forName("android.app.AppOpsManager");
        sb.append("YES");
    } catch (ClassNotFoundException e) {
        sb.append("NO!");
    }
}

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

private boolean checkBasic() {
    boolean result = Build.FINGERPRINT.startsWith("generic") || Build.MODEL.contains("google_sdk")
            || Build.MODEL.toLowerCase().contains("droid4x") || Build.MODEL.contains("Emulator")
            || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion")
            || Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86")
            || Build.PRODUCT.equals("sdk") || Build.PRODUCT.equals("google_sdk")
            || Build.PRODUCT.equals("sdk_x86") || Build.PRODUCT.equals("vbox86p")
            || Build.BOARD.toLowerCase().contains("nox") || Build.BOOTLOADER.toLowerCase().contains("nox")
            || Build.HARDWARE.toLowerCase().contains("nox") || Build.PRODUCT.toLowerCase().contains("nox")
            || Build.SERIAL.toLowerCase().contains("nox");

    if (result)//www . ja  va  2  s. c  o  m
        return true;
    result |= Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic");
    if (result)
        return true;
    result |= "google_sdk".equals(Build.PRODUCT);
    return result;
}

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  w w .  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:com.odo.kcl.mobileminer.miner.MinerService.java

private void connectivityChanged() {
    String name = "None";
    ConnectivityManager manager = (ConnectivityManager) getApplicationContext()
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = manager.getActiveNetworkInfo();
    if (netInfo != null) {
        if (netInfo.getState() == NetworkInfo.State.CONNECTED) {
            switch (netInfo.getType()) {
            case ConnectivityManager.TYPE_WIFI:
                wifiData = true;/*  w  w  w  .j  a  va 2 s. c o m*/
                mobileData = false;
                if (!updating)
                    startUpdating();
                WifiManager wifiMgr = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
                WifiInfo wifiInfo = wifiMgr.getConnectionInfo();
                name = wifiInfo.getSSID();
                if (!networkName.equals(name)) {
                    wirelessData = new WifiData(wifiInfo);
                    MinerData helper = new MinerData(context);
                    helper.putWifiNetwork(helper.getWritableDatabase(), wirelessData, new Date());
                    helper.close();
                    networkName = name;
                    networkBroadcast();
                }
                startScan(); // Always scan when we've got WIFI.
                //Log.i("MinerService","CONNECTED: WIFI");
                break;
            case ConnectivityManager.TYPE_MOBILE:
                wifiData = false;
                mobileData = true;
                if ("goldfish".equals(Build.HARDWARE)) {
                    if (!updating)
                        startUpdating();
                } else {
                    updating = false;
                }

                // https://code.google.com/p/android/issues/detail?id=24227
                //String name; Cursor c;
                //c = this.getContentResolver().query(Uri.parse("content://telephony/carriers/preferapn"), null, null, null, null);
                //name = c.getString(c.getColumnIndex("name"));
                TelephonyManager telephonyManager = ((TelephonyManager) this
                        .getSystemService(Context.TELEPHONY_SERVICE));
                name = telephonyManager.getNetworkOperatorName();
                if (!networkName.equals(name)) {
                    MinerData helper = new MinerData(context);
                    helper.putMobileNetwork(helper.getWritableDatabase(), telephonyManager, new Date());
                    helper.close();
                    networkName = name;
                    networkBroadcast();
                }
                //startScan();
                //Log.i("MinerService","CONNECTED MOBILE: "+name);
                break;
            default:
                //Log.i("MinerService",netInfo.getTypeName());
                break;
            }
        } else {
            scanning = false;
        }
    } else {
        scanning = false;
        networkName = "null";
    }

}

From source file:org.samcrow.ridgesurvey.MainActivity.java

/**
 * Sets up the map view in {@link #mMap}
 *//*from   w  w w .j  ava  2  s .c o m*/
private void setUpMap() throws IOException {

    // Start loading orthophoto images in the background
    final TileFolderLoad loadTask = new TileFolderLoad(this, R.raw.tiles, "ortho_tiles", "jpeg");
    loadTask.setDoneHandler(new DoneHandler() {
        @Override
        public void done(TileFolder result) {
            addOrthophotos(result);
        }
    });
    loadTask.execute();

    mMap = (MapView) findViewById(R.id.map);
    // Disable built-in zoom controls, unless running in an emulator or if the device
    // does not support basic multi-touch
    if (Build.HARDWARE.equals("goldfish")
            || !(getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH))) {
        mMap.setBuiltInZoomControls(true);
    } else {
        mMap.setBuiltInZoomControls(false);
    }

    {
        // Limit view to the bounds of the map file
        MapFile mapFile = new MapFile(Storage.getResourceAsFile(this, R.raw.jasper_ridge_map));
        mMap.getModel().mapViewPosition.setMapLimit(mapFile.boundingBox());
        mMap.getModel().mapViewPosition.setZoomLevelMin(START_POSITION.zoomLevel);
    }

    // Get colors
    final Iterator<Integer> colors = Palette.getColorsRepeating();

    final List<Layer> routeLayers = new ArrayList<>();
    // Try to load sites
    List<Route> routes = null;
    try {
        routes = SiteStorage.readRoutes(getResources().openRawResource(R.raw.sites));
        final ObservationDatabase db = new ObservationDatabase(this);
        for (Route route : routes) {
            if (!route.getSites().isEmpty()) {

                // Solve the traveling salesman problem, starting at the southwesternmost point
                double minLatitude = Double.MAX_VALUE;
                double minLongitude = Double.MAX_VALUE;
                Site start = null;
                for (Site site : route.getSites()) {
                    final double latitude = site.getPosition().latitude;
                    final double longitude = site.getPosition().longitude;
                    if (latitude < minLatitude && longitude < minLongitude) {
                        minLatitude = latitude;
                        minLongitude = longitude;
                        start = site;
                    }
                }

                final OrderedRoute solution = new Nearest().solve(route, start);
                final int color = colors.next();
                final Layer routeLayer = new RouteLayer(db, route, solution, color, mSelectionManager);
                routeLayers.add(routeLayer);
            }
        }
    } catch (IOException e) {
        new AlertDialog.Builder(this).setTitle(R.string.failed_to_load_sites)
                .setMessage(e.getLocalizedMessage()).show();
        Log.e(TAG, "Failed to load sites", e);
    }

    // Location layers
    final RouteLineLayer routeLineLayer = new RouteLineLayer(this);
    mSelectionManager.addSelectionListener(routeLineLayer);
    mLocationFinder.addListener(routeLineLayer);
    final MyLocationLayer locationLayer = new MyLocationLayer(getMyLocationDrawable());
    mLocationFinder.addListener(locationLayer);

    // If a selected site was saved, restore it
    if (routes != null && mPreferences.contains(SELECTED_SITE_KEY)) {
        final int selectedSiteId = mPreferences.getInt(SELECTED_SITE_KEY, 0);
        for (Route route : routes) {
            for (Site site : route.getSites()) {
                if (site.getId() == selectedSiteId) {
                    Log.d(TAG, "Restoring selected site " + selectedSiteId);
                    mSelectionManager.setSelectedSite(site, route);
                }
            }
        }
    }

    // Add layers to the map
    mMap.getLayerManager().getLayers().add(routeLineLayer);
    mMap.getLayerManager().getLayers().addAll(routeLayers);
    mMap.getLayerManager().getLayers().add(locationLayer);
}

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  w w w. j  a va 2  s  .  c  om*/
}