Auto Hide when Android-baseband version is unknown

Source: Internet
Author: User

Android5.1

When the machine is not brushed into the baseband, in the Settings-about tablet, the Baseband version column displays unknown

You now want to not show this column when the baseband version is unknown

Refer to the Android5.1 wallpaper source option with two "wallpapers" option, which shows that these settings are dynamically loaded fragment

First find the place to load about the tablet

packages/apps/settings/src/com/android/settings/ Deviceinfosettings.java

You can see the public class deviceinfosettings extends settingspreferencefragment Implements indexable

Find information about baseband

Private Static FinalString key_baseband_version = "Baseband_version";..... setvaluesummary (key_baseband_version,"Gsm.version.baseband");......//Remove Baseband version if wifi-only deviceif(Utils.iswifionly (Getactivity ())) {
Getpreferencescreen (). Removepreference (Findpreference (key_baseband_version));} ......Private voidsetvaluesummary (string preference, string property) {Try{findpreference (preference). Setsummary (Systemproperties.get (Property,getresources (). getString (r.string. (Device_info_default))); } Catch(RuntimeException e) {//No Recovery } }

WiFi only, non-SIM-enabled machines are not showing baseband versions

Setvaluesummary, took the R.string.device_info_default

Search Device_info_default can be "unknown", "Unknown" and so on.

Add the criteria for deleting baseband, refer to the method used in Setvaluesummary

    Private Boolean Isnobaseband () {        //  Add this method to determine the baseband version        return  systemproperties.get (KEY _baseband_version,                            getresources (). getString (R.string.device_info_default))                            . Equals (Getresources ().  GetString (R.string.device_info_default));    }  //  Remove Baseband version if wifi-only device plus a judging condition   if (utils.iswifionly (Getactivity ()) | | Isnobaseband ()) {        getpreferencescreen (). Removepreference (Findpreference (key_baseband_version));        }

Never use a specific string to determine

such as this:

Systemproperties.get (Key_baseband_version,getresources (). getString (R.string.device_info_default))
. Equals ("Unknown")

If you change a system language, for example, to Chinese, then this judgment will expire.


After the modification is complete, the compilation push goes in, you can see the effect

Auto Hide when Android-baseband version is unknown

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.