Example usage for android.os Build TIME

List of usage examples for android.os Build TIME

Introduction

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

Prototype

long TIME

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

Click Source Link

Usage

From source file:Main.java

public static boolean checkVersion(long newVersion, String product) {
    return (Build.TIME <= newVersion * 1000 && (Build.DEVICE.equals(product) || Build.PRODUCT.equals(product)));
}

From source file:Main.java

public static long getBuildTime() {
    return Build.TIME;
}

From source file:Main.java

public static String collectStats(CharSequence flattenedParams) {
    StringBuilder result = new StringBuilder(1000);

    result.append("BOARD=").append(Build.BOARD).append('\n');
    result.append("BRAND=").append(Build.BRAND).append('\n');
    result.append("CPU_ABI=").append(Build.CPU_ABI).append('\n');
    result.append("DEVICE=").append(Build.DEVICE).append('\n');
    result.append("DISPLAY=").append(Build.DISPLAY).append('\n');
    result.append("FINGERPRINT=").append(Build.FINGERPRINT).append('\n');
    result.append("HOST=").append(Build.HOST).append('\n');
    result.append("ID=").append(Build.ID).append('\n');
    result.append("MANUFACTURER=").append(Build.MANUFACTURER).append('\n');
    result.append("MODEL=").append(Build.MODEL).append('\n');
    result.append("PRODUCT=").append(Build.PRODUCT).append('\n');
    result.append("TAGS=").append(Build.TAGS).append('\n');
    result.append("TIME=").append(Build.TIME).append('\n');
    result.append("TYPE=").append(Build.TYPE).append('\n');
    result.append("USER=").append(Build.USER).append('\n');
    result.append("VERSION.CODENAME=").append(Build.VERSION.CODENAME).append('\n');
    result.append("VERSION.INCREMENTAL=").append(Build.VERSION.INCREMENTAL).append('\n');
    result.append("VERSION.RELEASE=").append(Build.VERSION.RELEASE).append('\n');
    result.append("VERSION.SDK_INT=").append(Build.VERSION.SDK_INT).append('\n');

    if (flattenedParams != null) {
        String[] params = SEMICOLON.split(flattenedParams);
        Arrays.sort(params);//from  w  w  w.ja v a 2s .co  m
        for (String param : params) {
            result.append(param).append('\n');
        }
    }

    return result.toString();
}

From source file:at.amartinz.hardware.device.Device.java

protected Device(@NonNull Context context) {
    mContext = context;/*from   w ww  . j a v  a 2s . c  o  m*/

    platformVersion = Build.VERSION.RELEASE;
    platformId = Build.DISPLAY;
    platformType = Build.VERSION.CODENAME + " " + Build.TYPE;
    platformTags = Build.TAGS;
    platformBuildType = HwUtils.getDate(Build.TIME);

    vmVersion = System.getProperty("java.vm.version", "-");
    vmLibrary = getRuntime();

    final Resources res = context.getResources();
    screenWidth = res.getDisplayMetrics().widthPixels;
    screenHeight = res.getDisplayMetrics().heightPixels;

    androidId = getAndroidId(context);
    manufacturer = Build.MANUFACTURER;
    model = Build.MODEL;
    device = Build.DEVICE;
    product = Build.PRODUCT;
    board = Build.BOARD;
    bootloader = Build.BOOTLOADER;
    radio = Build.getRadioVersion();

    // initialize defaults
    hasBusyBox = false;
    hasRoot = false;
    suVersion = "-";
    isSELinuxEnforcing = isSELinuxEnforcing(); // ehm, alright, if you say so...
}

From source file:ota.otaupdates.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    if (sharedPreferences.getBoolean("force_english", false)) {
        Locale myLocale = new Locale("en");
        Resources res = getResources();
        DisplayMetrics dm = res.getDisplayMetrics();
        Configuration conf = res.getConfiguration();
        conf.locale = myLocale;//  w  ww  . ja va2 s .  c  o m
        res.updateConfiguration(conf, dm);
    }

    if (sharedPreferences.getBoolean("apptheme_light", false))
        setTheme(R.style.AppTheme_Light);
    else
        setTheme(R.style.AppTheme_Dark);

    setContentView(R.layout.activity_main);

    build_url
            .append((Utils.doesPropExist(Constants.URL_PROP)) ? Utils.getProp(Constants.URL_PROP)
                    : getString(R.string.download_url))
            .append("/api/").append(Build.DEVICE).append("/").append(Build.TIME / 1000);

    build_dl_url.append((Utils.doesPropExist(Constants.URL_PROP)) ? Utils.getProp(Constants.URL_PROP)
            : getString(R.string.download_url)).append("/builds/");

    delta_url.append((Utils.doesPropExist(Constants.URL_PROP) ? Utils.getProp(Constants.URL_PROP)
            : getString(R.string.download_url))).append("/delta/").append(Build.VERSION.INCREMENTAL);

    delta_dl_url.append((Utils.doesPropExist(Constants.URL_PROP)) ? Utils.getProp(Constants.URL_PROP)
            : getString(R.string.download_url)).append("/deltas/");

    otaList = new ArrayList<>();
    get_builds();
    pb = (ProgressBar) findViewById(R.id.pb);
    pb.setVisibility(View.VISIBLE);

    final ListView ota_list = (ListView) findViewById(R.id.ota_list);

    adapter = new OTAUpdatesAdapter(getApplicationContext(), R.layout.row, otaList);
    ota_list.setAdapter(adapter);

    final CoordinatorLayout coordinator_root = (CoordinatorLayout) findViewById(R.id.coordinator_root);
    ota_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, final int position, long id) {
            final String url = build_dl_url.toString() + otaList.get(position).getOta_filename();

            if (Build.VERSION.SDK_INT >= 23 && !checkPermission())
                allow_write_sd();
            else if (sharedPreferences.getBoolean("disable_mobile", true) && isMobileDataEnabled()) {
                sb_network = Snackbar.make(coordinator_root, getString(R.string.disable_mobile_message),
                        Snackbar.LENGTH_SHORT);
                sb_network.getView()
                        .setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorSecond));
                sb_network.show();
            } else {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        create_notification(1, getString(R.string.app_name), getString(
                                R.string.downloader_notification, otaList.get(position).getOta_filename()));
                        Utils.DownloadFromUrl(url, otaList.get(position).getOta_filename());
                        ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).cancel(1);
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                if (MD5.checkMD5(otaList.get(position).getOta_md5(),
                                        new File(DL_PATH + otaList.get(position).getOta_filename()))
                                        || !sharedPreferences.getBoolean("md5_checking", true))
                                    trigger_autoinstall(DL_PATH + otaList.get(position).getOta_filename());
                                else {
                                    new AlertDialog.Builder(MainActivity.this)
                                            .setTitle(getString(R.string.md5_title))
                                            .setMessage(getString(R.string.md5_message)).setNeutralButton(
                                                    R.string.button_ok, new DialogInterface.OnClickListener() {
                                                        public void onClick(DialogInterface dialog, int which) {
                                                        }
                                                    })
                                            .show();
                                }
                            }
                        });
                    }
                }).start();
            }
        }
    });

}

From source file:de.schildbach.wallet.util.CrashReporter.java

public 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(Strings.emptyToNull(Build.CPU_ABI),
            Strings.emptyToNull(Build.CPU_ABI2))).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("Memory Class: " + activityManager.getMemoryClass() + "/"
            + activityManager.getLargeMemoryClass()
            + (ActivityManagerCompat.isLowRamDevice(activityManager) ? " (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.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/*from ww  w  .ja v a 2 s .co 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: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  w  w .  j a v a2  s.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: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  w w  .  ja v a 2  s  . c  o m*/
    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:org.zeroxlab.zeroxbenchmark.Benchmark.java

public String getXMLResult() {
        if (mCases.size() == 0)
            return "";

        Date date = new Date();
        //2010-05-28T17:40:25CST
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");

        String xml = "";
        xml += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        xml += "<result";
        xml += " executedTimestamp=\"" + sdf.format(date) + "\"";
        xml += " manufacturer=\"" + Build.MANUFACTURER.replace(' ', '_') + "\"";
        xml += " model=\"" + Build.MODEL.replace(' ', '_') + ":" + Build.DISPLAY + "\"";
        xml += " buildTimestamp=\"" + sdf.format(new Date(Build.TIME)) + "\"";
        xml += " orientation=\"" + Integer.toString(orientation) + "\"";

        try { // read kernel version
            BufferedReader procVersion = new BufferedReader(new FileReader("/proc/version"));
            StringBuffer sbuff = new StringBuffer();
            String tmp;//from  w w w  .  ja v a 2s  .co  m
            while ((tmp = procVersion.readLine()) != null)
                sbuff.append(tmp);
            procVersion.close();
            tmp = sbuff.toString().replace("[\n\r]+", " ").replace(" +", ".");
            xml += " version=\"" + tmp + "\"";
        } catch (IOException e) {
            Log.e(TAG, "opening /proc/version failed: " + e.toString());
        }

        try { // read and parse cpu info
            BufferedReader procVersion = new BufferedReader(new FileReader("/proc/cpuinfo"));
            StringBuffer sbuff = new StringBuffer();
            String tmp;
            while ((tmp = procVersion.readLine()) != null)
                sbuff.append(tmp + "\n");
            procVersion.close();

            tmp = sbuff.toString();

            sbuff = new StringBuffer();

            Pattern p1 = Pattern.compile("(Processor\\s*:\\s*(.*)\\s*[\n\r]+)");
            Matcher m1 = p1.matcher(tmp);
            if (m1.find())
                sbuff.append(m1.group(2));

            Pattern p2 = Pattern.compile("(Hardware\\s*:\\s*(.*)\\s*[\n\r]+)");
            Matcher m2 = p2.matcher(tmp);
            if (m2.find())
                sbuff.append(":" + m2.group(2));

            Pattern p3 = Pattern.compile("(Revision\\s*:\\s*(.*)\\s*[\n\r]+)");
            Matcher m3 = p3.matcher(tmp);
            if (m3.find())
                sbuff.append(":" + m3.group(2));

            Log.e(TAG, sbuff.toString());
            xml += " cpu=\"" + sbuff.toString() + "\"";
        } catch (IOException e) {
            Log.e(TAG, "opening /proc/version failed: " + e.toString());
        }

        xml += ">";

        Case mycase;
        for (int i = 0; i < mCases.size(); i++) {
            mycase = mCases.get(i);
            xml += mycase.getXMLBenchmark();
        }

        xml += "</result>";
        return xml;
    }