Example usage for android.os Build DEVICE

List of usage examples for android.os Build DEVICE

Introduction

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

Prototype

String DEVICE

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

Click Source Link

Document

The name of the industrial design.

Usage

From source file:org.durka.hallmonitor.ViewCoverHallService.java

@Override
public void run() {
    if (!mStateManager.getRootApp()) {
        Log.e(LOG_TAG + ".r", "Required root to use Real Hall service");

        return;/*  w  w w  . j ava2  s.  co m*/
    }

    String neededDevice = "gpio-keys";
    if (Build.DEVICE.equals(DEV_SERRANO_LTE_CM10) || Build.DEVICE.equals(DEV_SERRANO_LTE_CM11)) {
        neededDevice = "sec_keys";
    }
    Events events = new Events();

    events.AddAllDevices();
    String neededDevicePath = "";

    Log.d(LOG_TAG + ".r", "Number of device found:" + events.m_Devs.size());

    Log.d(LOG_TAG + ".r", "Scan device");
    for (InputDevice idev : events.m_Devs) {
        if (!idev.getOpen()) {
            idev.Open(true, mStateManager.getRootApp());
        }
        if (idev.getOpen()) {
            Log.d(LOG_TAG + ".r",
                    " Open: " + idev.getPath() + " / Name: " + idev.getName() + " / Version: "
                            + idev.getVersion() + " / Location: " + idev.getLocation() + " / IdStr: "
                            + idev.getIdStr() + " / Result: " + idev.getOpen());
            if (idev.getName().equals(neededDevice)) {
                Log.d(LOG_TAG + ".r", "Device " + neededDevice + " found");
                neededDevicePath = idev.getPath();
                break;
            }
        }
    }
    events.Release();
    events = null;
    System.gc();

    events = new Events();
    events.AddDevice(neededDevicePath);

    Log.e(LOG_TAG + ".r", "Number of device found:" + events.m_Devs.size());

    InputDevice currentInputDevice = null;
    for (InputDevice idev : events.m_Devs) {
        if (!idev.getOpen()) {
            idev.Open(true, mStateManager.getRootApp());
        }
        currentInputDevice = idev;
        Log.d(LOG_TAG + ".r",
                "Open: " + currentInputDevice.getPath() + " / Name: " + currentInputDevice.getName()
                        + " / Version: " + currentInputDevice.getVersion() + " / Location: "
                        + currentInputDevice.getLocation() + " / IdStr: " + currentInputDevice.getIdStr()
                        + " / Result: " + currentInputDevice.getOpen());
    }

    if (currentInputDevice == null) {
        Log.d(LOG_TAG + ".r", "No device");
        return;
    }

    Log.d(LOG_TAG + ".r", "Start read command");
    while (serviceStarted) {
        if (currentInputDevice.getOpen() && (0 == currentInputDevice.getPollingEvent())) {
            Log.d(LOG_TAG + ".r",
                    "Reading command: " + currentInputDevice.getSuccessfulPollingType() + "/"
                            + currentInputDevice.getSuccessfulPollingCode() + "/"
                            + currentInputDevice.getSuccessfulPollingValue());
            if (currentInputDevice.getSuccessfulPollingCode() == 21
                    && currentInputDevice.getSuccessfulPollingValue() == 0) {
                Log.i(LOG_TAG + ".r", "Cover closed");
                Intent intent = new Intent(mStateManager.getActionCover());
                intent.putExtra(CoreReceiver.EXTRA_LID_STATE, CoreReceiver.LID_CLOSED);
                this.mLocalBroadcastManager.sendBroadcastSync(intent);
            } else if (currentInputDevice.getSuccessfulPollingCode() == 21
                    && currentInputDevice.getSuccessfulPollingValue() == 1) {
                Log.i(LOG_TAG + ".r", "Cover open");
                Intent intent = new Intent(mStateManager.getActionCover());
                intent.putExtra(CoreReceiver.EXTRA_LID_STATE, CoreReceiver.LID_OPEN);
                this.mLocalBroadcastManager.sendBroadcastSync(intent);
            }
        }
    }
    Log.d(LOG_TAG + ".r", "Stop read command");
    events.Release();
    events = null;
    Log.d(LOG_TAG + ".r", "Memory cleaned");
    System.gc();
}

From source file:com.otaupdater.ROMTab.java

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

    cfg = Config.getInstance(getActivity().getApplicationContext());

    HashMap<String, Object> item;

    item = new HashMap<String, Object>();
    item.put(KEY_TITLE, getString(R.string.main_device));
    item.put(KEY_SUMMARY, android.os.Build.DEVICE.toLowerCase(Locale.US));
    item.put(KEY_ICON, R.drawable.ic_device);
    DATA.add(item);//from   ww  w  .  j  ava  2 s  .  co m

    item = new HashMap<String, Object>();
    item.put(KEY_TITLE, getString(R.string.main_rom));
    item.put(KEY_SUMMARY, android.os.Build.DISPLAY);
    item.put(KEY_ICON, R.drawable.ic_info_outline);
    DATA.add(item);

    String romVersion = PropUtils.getRomOtaVersion();
    if (romVersion == null)
        romVersion = PropUtils.getRomVersion();

    if (PropUtils.isRomOtaEnabled()) {
        Date romDate = PropUtils.getRomOtaDate();
        if (romDate != null) {
            romVersion += " (" + DateFormat.getDateTimeInstance().format(romDate) + ")";
        }

        item = new HashMap<String, Object>();
        item.put(KEY_TITLE, getString(R.string.rom_version));
        item.put(KEY_SUMMARY, romVersion);
        item.put(KEY_ICON, R.drawable.ic_settings);
        DATA.add(item);

        item = new HashMap<String, Object>();
        item.put(KEY_TITLE, getString(R.string.main_otaid));
        item.put(KEY_SUMMARY, PropUtils.getRomOtaID());
        item.put(KEY_ICON, R.drawable.ic_key);
        DATA.add(item);

        item = new HashMap<String, Object>();
        item.put(KEY_TITLE, getString(R.string.updates_avail_title));
        if (cfg.hasStoredRomUpdate()) {
            RomInfo info = cfg.getStoredRomUpdate();
            if (info.isUpdate()) {
                item.put(KEY_SUMMARY, getString(R.string.updates_new, info.name, info.version));
            } else {
                item.put(KEY_SUMMARY, getString(R.string.updates_none));
                cfg.clearStoredRomUpdate();
            }
        } else {
            item.put(KEY_SUMMARY, getString(R.string.updates_none));
        }
        item.put(KEY_ICON, R.drawable.ic_cloud_download);
        AVAIL_UPDATES_IDX = DATA.size();
        DATA.add(item);
    } else {
        if (cfg.hasStoredRomUpdate())
            cfg.clearStoredRomUpdate();

        if (!romVersion.equals(Build.DISPLAY)) {
            item = new HashMap<String, Object>();
            item.put(KEY_TITLE, getString(R.string.rom_version));
            item.put(KEY_SUMMARY, romVersion);
            item.put(KEY_ICON, R.drawable.ic_settings);
            DATA.add(item);
        }

        item = new HashMap<String, Object>();
        item.put(KEY_TITLE, getString(R.string.rom_unsupported));
        item.put(KEY_SUMMARY, getString(R.string.rom_unsupported_summary));
        item.put(KEY_ICON, R.drawable.ic_cloud_off);
        DATA.add(item);
    }
}

From source file:com.anysoftkeyboard.ui.dev.DeveloperUtils.java

public static String getSysInfo(@Nullable Context context) {
    StringBuilder sb = new StringBuilder();
    sb.append("BRAND:").append(Build.BRAND).append(NEW_LINE);
    sb.append("DEVICE:").append(Build.DEVICE).append(NEW_LINE);
    sb.append("Build ID:").append(Build.DISPLAY).append(NEW_LINE);
    sb.append("changelist number:").append(Build.ID).append("\n");
    sb.append("MODEL:").append(Build.MODEL).append(NEW_LINE);
    sb.append("PRODUCT:").append(Build.PRODUCT).append(NEW_LINE);
    sb.append("TAGS:").append(Build.TAGS).append(NEW_LINE);
    sb.append("VERSION.INCREMENTAL:").append(Build.VERSION.INCREMENTAL).append(NEW_LINE);
    sb.append("VERSION.RELEASE:").append(Build.VERSION.RELEASE).append(NEW_LINE);
    sb.append("VERSION.SDK_INT:").append(Build.VERSION.SDK_INT).append(NEW_LINE);
    if (context != null && context.getResources() != null
            && context.getResources().getConfiguration() != null) {
        Configuration configuration = context.getResources().getConfiguration();
        sb.append("Locale:").append(configuration.locale).append(NEW_LINE);
        sb.append("configuration:").append(configuration.toString()).append(NEW_LINE);
    }/*from   w ww.  ja v  a 2 s  .c o  m*/

    sb.append("That's all I know.");
    return sb.toString();
}

From source file:eu.faircode.netguard.ServiceJob.java

@Override
public boolean onStartJob(JobParameters params) {
    Log.i(TAG, "Start job=" + params.getJobId());

    new AsyncTask<JobParameters, Object, Object>() {

        @Override//  ww  w.j  av a2  s.  c  o m
        protected JobParameters doInBackground(JobParameters... params) {
            Log.i(TAG, "Executing job=" + params[0].getJobId());

            HttpsURLConnection urlConnection = null;
            try {
                String android_id = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
                JSONObject json = new JSONObject();

                json.put("device", Util.sha256(android_id, ""));
                json.put("product", Build.DEVICE);
                json.put("sdk", Build.VERSION.SDK_INT);
                json.put("country", Locale.getDefault().getCountry());

                json.put("netguard", Util.getSelfVersionCode(ServiceJob.this));
                try {
                    json.put("store", getPackageManager().getInstallerPackageName(getPackageName()));
                } catch (Throwable ex) {
                    Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
                    json.put("store", null);
                }

                for (String name : params[0].getExtras().keySet())
                    json.put(name, params[0].getExtras().get(name));

                urlConnection = (HttpsURLConnection) new URL(cUrl).openConnection();
                urlConnection.setConnectTimeout(cTimeOutMs);
                urlConnection.setReadTimeout(cTimeOutMs);
                urlConnection.setRequestProperty("Accept", "application/json");
                urlConnection.setRequestProperty("Content-type", "application/json");
                urlConnection.setRequestMethod("POST");
                urlConnection.setDoInput(true);
                urlConnection.setDoOutput(true);

                OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream());
                out.write(json.toString().getBytes()); // UTF-8
                out.flush();

                int code = urlConnection.getResponseCode();
                if (code != HttpsURLConnection.HTTP_OK)
                    throw new IOException("HTTP " + code);

                InputStreamReader isr = new InputStreamReader(urlConnection.getInputStream());
                Log.i(TAG, "Response=" + Util.readString(isr).toString());

                jobFinished(params[0], false);

                if ("rule".equals(params[0].getExtras().getString("type"))) {
                    SharedPreferences history = getSharedPreferences("history", Context.MODE_PRIVATE);
                    history.edit().putLong(params[0].getExtras().getString("package") + ":submitted",
                            new Date().getTime()).apply();
                }

            } catch (Throwable ex) {
                Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
                jobFinished(params[0], true);

            } finally {
                if (urlConnection != null)
                    urlConnection.disconnect();

                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ignored) {
                }
            }

            return null;
        }
    }.execute(params);

    return true;
}

From source file:com.fastbootmobile.encore.app.OmniMusic.java

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

    // We need to filter here whether we're initializing the main app or an aux attached plugin
    String appName = Utils.getAppNameByPID(this, android.os.Process.myPid());
    final String process = appName.substring(appName.indexOf(':') + 1);

    Sentry.setCaptureListener(new Sentry.SentryEventCaptureListener() {
        @Override//from  w w w  .ja v  a2 s.co m
        public Sentry.SentryEventBuilder beforeCapture(Sentry.SentryEventBuilder sentryEventBuilder) {
            JSONObject tags = sentryEventBuilder.getTags();
            try {
                tags.put("OS", "Android " + Build.VERSION.RELEASE);
                tags.put("OSCodename", Build.VERSION.CODENAME);
                tags.put("Device", Build.DEVICE);
                tags.put("Model", Build.MODEL);
                tags.put("Manufacturer", Build.MANUFACTURER);
                tags.put("AppVersionCode", String.valueOf(BuildConfig.VERSION_CODE));
                tags.put("AppVersionName", BuildConfig.VERSION_NAME);
                tags.put("AppFlavor", BuildConfig.FLAVOR);
            } catch (JSONException e) {
                Log.e(TAG, "Failed to put a tag into Sentry", e);
            }

            sentryEventBuilder.addModule(process, BuildConfig.VERSION_NAME);
            return sentryEventBuilder;
        }
    });
    Sentry.init(this,
            "https://4dc1acbdb1cb423282e2a59f553e1153:9415087b9e1348c3ba4bed44be599f6a@sentry.fastboot.mobi/2");

    // Setup LeakCanary
    mRefWatcher = LeakCanary.install(this);

    if (PROCESS_APP.equals(process)) {
        // Setup the plugins system
        ProviderAggregator.getDefault().setContext(getApplicationContext());
        PluginsLookup.getDefault().initialize(getApplicationContext());

        /**
         * Note about the cache and EchoNest: The HTTP cache would sometimes cache request
         * we didn't want (such as status query for Taste Profile update). We're using
         * a hacked jEN library that doesn't cache these requests.
         */
        // Setup network cache
        try {
            final File httpCacheDir = new File(getCacheDir(), "http");
            final long httpCacheSize = 100 * 1024 * 1024; // 100 MiB
            final HttpResponseCache cache = HttpResponseCache.install(httpCacheDir, httpCacheSize);

            Log.i(TAG, "HTTP Cache size: " + cache.size() / 1024 / 1024 + "MB");
        } catch (IOException e) {
            Log.w(TAG, "HTTP response cache installation failed", e);
        }

        // Setup image cache
        ImageCache.getDefault().initialize(getApplicationContext());

        // Setup Automix system
        AutoMixManager.getDefault().initialize(getApplicationContext());

        // Setup custom fonts
        CalligraphyConfig.initDefault("fonts/Roboto-Regular.ttf", R.attr.fontPath);
    }
}

From source file:de.hackerspacebremen.communication.HackerspaceComm.java

protected final JSONObject doInBackground(final JSONObject... data) {
    final String userAgent = "HackerSpaceBremen/" + this.appVersionName + "; Android/" + Build.VERSION.RELEASE
            + "; " + Build.MANUFACTURER + "; " + Build.DEVICE + "; " + Build.MODEL;

    HttpClient httpclient = new DefaultHttpClient();
    HttpParams httpBodyParams = httpclient.getParams();
    httpBodyParams.setParameter(CoreProtocolPNames.USER_AGENT, userAgent);

    String response = null;//w  w w .  ja  va  2s . c o  m
    int responseCode = 0;
    String httpOrS = HTTPS;
    if (httpReq) {
        httpOrS = HTTP;
    }

    if (getReq) {
        try {
            final HttpURLConnection connection = client
                    .open(new URL(httpOrS + SERVERURL + this.servletUrl + "?" + getParams));
            InputStream in = null;
            try {
                // Read the response.
                in = connection.getInputStream();
                final byte[] resp = readFully(in);
                response = new String(resp, Constants.UTF8);
                responseCode = connection.getResponseCode();
            } finally {
                if (in != null)
                    in.close();
            }
            // HttpGet httpget = new HttpGet(httpOrS + SERVERURL
            // + this.servletUrl + "?" + getParams);
            // response = httpclient.execute(httpget);
        } catch (IOException e) {
            errorcode = -1;
            cancel(false);
            return null;
        }
    } else {
        try {
            HttpURLConnection connection = client.open(new URL(httpOrS + SERVERURL + this.servletUrl));
            OutputStream out = null;
            InputStream in = null;
            try {
                // Write the request.
                connection.setRequestMethod("POST");
                out = connection.getOutputStream();
                out.write(createBody().getBytes(Constants.UTF8));
                out.close();

                responseCode = connection.getResponseCode();
                in = connection.getInputStream();
                response = readFirstLine(in);
            } finally {
                // Clean up.
                if (out != null)
                    out.close();
                if (in != null)
                    in.close();
            }
            // HttpPost httpPost = new HttpPost(httpOrS + SERVERURL
            // + this.servletUrl);
            // httpPost.setEntity(new UrlEncodedFormEntity(postParams,
            // "UTF-8"));
            // response = httpclient.execute(httpPost);

        } catch (IOException e) {
            errorcode = -1;
            cancel(false);
            return null;
        }
    }

    httpState = responseCode;

    JSONObject resData = new JSONObject();
    String resString = "";
    try {
        resString = response;
        resData = new JSONObject(resString);
        if (httpState != 200) {
            errorcode = resData.getInt("CODE");
            cancel(false);
            return null;
        }

    } catch (JSONException e) {
        if (httpState != 200) {
            errorcode = httpState;
        } else {
            errorcode = -2;
        }
        cancel(false);
        return null;
    }

    return resData;
}

From source file:org.LK8000.LK8000.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (serviceClass == null)
        serviceClass = MyService.class;

    super.onCreate(savedInstanceState);
    //    Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());

    Fabric fabric = new Fabric.Builder(this).debuggable(true).kits(new Crashlytics(), new CrashlyticsNdk())
            .build();/*  w  ww  .  j a v a  2 s . c  om*/

    Fabric.with(fabric);

    Log.d(TAG, "ABI=" + Build.CPU_ABI);
    Log.d(TAG, "PRODUCT=" + Build.PRODUCT);
    Log.d(TAG, "MANUFACTURER=" + Build.MANUFACTURER);
    Log.d(TAG, "MODEL=" + Build.MODEL);
    Log.d(TAG, "DEVICE=" + Build.DEVICE);
    Log.d(TAG, "BOARD=" + Build.BOARD);
    Log.d(TAG, "FINGERPRINT=" + Build.FINGERPRINT);

    if (!Loader.loaded) {
        TextView tv = new TextView(this);
        tv.setText("Failed to load the native LK8000 libary.\n"
                + "Report this problem to us, and include the following information:\n" + "ABI=" + Build.CPU_ABI
                + "\n" + "PRODUCT=" + Build.PRODUCT + "\n" + "FINGERPRINT=" + Build.FINGERPRINT + "\n"
                + "error=" + Loader.error);
        setContentView(tv);
        return;
    }

    initialiseNative();

    NetUtil.initialise(this);
    InternalGPS.Initialize();
    NonGPSSensors.Initialize();

    IOIOHelper.onCreateContext(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR)
        // Bluetooth suppoert was added in Android 2.0 "Eclair"
        BluetoothHelper.Initialize(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
        // the DownloadManager was added in Android 2.3 "Gingerbread"
        DownloadUtil.Initialise(getApplicationContext());

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        UsbSerialHelper.Initialise(this);
    }

    SoundUtil.Initialise();

    // fullscreen mode
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().addFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    /* Workaround for layout problems in Android KitKat with immersive full
       screen mode: Sometimes the content view was not initialized with the
       correct size, which caused graphics artifacts. */
    if (android.os.Build.VERSION.SDK_INT >= 19) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
                | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
                | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
                | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    }

    enableImmersiveModeIfSupported();

    TextView tv = new TextView(this);
    tv.setText("Loading LK8000...");
    setContentView(tv);

    batteryReceiver = new BatteryReceiver();
    registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));

    SharedPreferences settings = getSharedPreferences("LK8000", 0);
    int screenOrientation = settings.getInt("screenOrientation", 0);
    switch (screenOrientation) {
    case 0:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
        break;
    case 1:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;
    case 2:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
    case 3:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
        break;
    case 4:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        break;
    default:
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    }

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

}

From source file:com.android.test.gallery3d.common.HttpClientFactory.java

private static String getUserAgent(Context context) {
    if (sUserAgent == null) {
        PackageInfo pi;// ww w .java  2s . c  o m
        try {
            pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        } catch (NameNotFoundException e) {
            throw new IllegalStateException("getPackageInfo failed");
        }
        sUserAgent = String.format("%s/%s; %s/%s/%s/%s; %s/%s/%s", pi.packageName, pi.versionName, Build.BRAND,
                Build.DEVICE, Build.MODEL, Build.ID, Build.VERSION.SDK, Build.VERSION.RELEASE,
                Build.VERSION.INCREMENTAL);
    }
    return sUserAgent;
}

From source file:com.android.fastergallery.common.HttpClientFactory.java

private static String getUserAgent(Context context) {
    if (sUserAgent == null) {
        PackageInfo pi;/*from  w w  w.  j  a va  2s  .c  o m*/
        try {
            pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        } catch (NameNotFoundException e) {
            throw new IllegalStateException("getPackageInfo failed");
        }
        sUserAgent = String.format("%s/%s; %s/%s/%s/%s; %s/%s/%s", pi.packageName, pi.versionName, Build.BRAND,
                Build.DEVICE, Build.MODEL, Build.ID, Build.VERSION.SDK_INT, Build.VERSION.RELEASE,
                Build.VERSION.INCREMENTAL);
    }
    return sUserAgent;
}

From source file:com.stoutner.privacybrowser.AboutTabFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View tabLayout;//from  w ww. j a  v a2  s .c o  m

    // Load the about tab layout.  Tab numbers start at 0.
    if (tabNumber == 0) {
        // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
        // The fragment will take care of attaching the root automatically.
        tabLayout = inflater.inflate(R.layout.about_tab_version, container, false);

        // Version.
        TextView versionNumberText = (TextView) tabLayout.findViewById(R.id.about_version_number_text);
        String version = getString(R.string.version) + " " + BuildConfig.VERSION_NAME + " ("
                + getString(R.string.version_code) + " " + Integer.toString(BuildConfig.VERSION_CODE) + ")";
        versionNumberText.setText(version);

        // Brand.
        TextView versionBrandText = (TextView) tabLayout.findViewById(R.id.about_version_brand_text);
        versionBrandText.setText(Build.BRAND);

        // Manufacturer.
        TextView versionManufacturerText = (TextView) tabLayout
                .findViewById(R.id.about_version_manufacturer_text);
        versionManufacturerText.setText(Build.MANUFACTURER);

        // Model.
        TextView versionModelText = (TextView) tabLayout.findViewById(R.id.about_version_model_text);
        versionModelText.setText(Build.MODEL);

        // Device.
        TextView versionDeviceText = (TextView) tabLayout.findViewById(R.id.about_version_device_text);
        versionDeviceText.setText(Build.DEVICE);

        // Bootloader.
        TextView versionBootloaderText = (TextView) tabLayout.findViewById(R.id.about_version_bootloader_text);
        versionBootloaderText.setText(Build.BOOTLOADER);

        // Radio.
        TextView versionRadioText = (TextView) tabLayout.findViewById(R.id.about_version_radio_text);
        // Hide versionRadioTextView if there is no radio.
        if (Build.getRadioVersion().equals("")) {
            TextView versionRadioTitle = (TextView) tabLayout.findViewById(R.id.about_version_radio_title);
            versionRadioTitle.setVisibility(View.GONE);
            versionRadioText.setVisibility(View.GONE);
        } else { // Else, set the text.
            versionRadioText.setText(Build.getRadioVersion());
        }

        // Android.
        TextView versionAndroidText = (TextView) tabLayout.findViewById(R.id.about_version_android_text);
        String android = Build.VERSION.RELEASE + " (" + getString(R.string.api) + " "
                + Integer.toString(Build.VERSION.SDK_INT) + ")";
        versionAndroidText.setText(android);

        // Build.
        TextView versionBuildText = (TextView) tabLayout.findViewById(R.id.about_version_build_text);
        versionBuildText.setText(Build.DISPLAY);

        // Security Patch.
        TextView versionSecurityPatchText = (TextView) tabLayout
                .findViewById(R.id.about_version_securitypatch_text);
        // Build.VERSION.SECURITY_PATCH is only available for SDK_INT >= 23.
        if (Build.VERSION.SDK_INT >= 23) {
            versionSecurityPatchText.setText(Build.VERSION.SECURITY_PATCH);
        } else { // Hide versionSecurityPatchTextView.
            TextView versionSecurityPatchTitle = (TextView) tabLayout
                    .findViewById(R.id.about_version_securitypatch_title);
            versionSecurityPatchTitle.setVisibility(View.GONE);
            versionSecurityPatchText.setVisibility(View.GONE);
        }

        // webViewLayout is only used to get the default user agent from about_tab_webview.  It is not used to render content on the screen.
        View webViewLayout = inflater.inflate(R.layout.about_tab_webview, container, false);
        WebView tabLayoutWebView = (WebView) webViewLayout.findViewById(R.id.about_tab_webview);
        String userAgentString = tabLayoutWebView.getSettings().getUserAgentString();

        // WebKit.
        TextView versionWebKitText = (TextView) tabLayout.findViewById(R.id.about_version_webkit_text);
        // Select the substring that begins after "Safari/" and goes to the end of the string.
        String webkitVersion = userAgentString.substring(userAgentString.indexOf("Safari/") + 7);
        versionWebKitText.setText(webkitVersion);

        // Chrome.
        TextView versionChromeText = (TextView) tabLayout.findViewById(R.id.about_version_chrome_text);
        // Select the substring that begins after "Chrome/" and goes until the next " ".
        String chromeVersion = userAgentString.substring(userAgentString.indexOf("Chrome/") + 7,
                userAgentString.indexOf(" ", userAgentString.indexOf("Chrome/")));
        versionChromeText.setText(chromeVersion);
    } else { // load a WebView for all the other tabs.  Tab numbers start at 0.
        // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
        // The fragment will take care of attaching the root automatically.
        tabLayout = inflater.inflate(R.layout.about_tab_webview, container, false);
        WebView tabWebView = (WebView) tabLayout;

        switch (tabNumber) {
        case 1:
            tabWebView.loadUrl("file:///android_asset/about_permissions.html");
            break;

        case 2:
            tabWebView.loadUrl("file:///android_asset/about_privacy_policy.html");
            break;

        case 3:
            tabWebView.loadUrl("file:///android_asset/about_changelog.html");
            break;

        case 4:
            tabWebView.loadUrl("file:///android_asset/about_license.html");
            break;

        case 5:
            tabWebView.loadUrl("file:///android_asset/about_contributors.html");
            break;

        case 6:
            tabWebView.loadUrl("file:///android_asset/about_links.html");

        default:
            break;
        }
    }

    return tabLayout;
}