Bug_ Learning Essays (mobile data shortcut switch)

Source: Internet
Author: User

4.3

One

Status bar Mobile Data shortcut switch: When you turn on airplane mode or power off, the mobile data state is the opposite of the previous, but moving the data switch from other parts of the system will not work like this.

Analyze the mobile data status update processing, find the place to change its value (find radio log), compare the rest of the system with the status bar on the bottom radio log of its operation to determine the difference; imitate the correct code processing place on the status bar mobile data switch to operate

1>: Mobile data is ultimately frameworks/opt/telephony-msim/frameworks/src/com/codeaurora/internal/telephony/ Msimphonefactory.java is assigned to the inside.

Settings.Global.putInt (Scontext.getcontentresolver (), Settings.Global.MOBILE_DATA, enabled 1:0);

RLOG.D (Log_tag, "set Mobile_data:" + enabled);

2>:LOG.W ("Quicksettingsmodel", New NullPointerException ());

3>:ADB logcat-b radio-v Time >d:radio.txt

Two

Mobile data switch in the settings:

Packages/apps/settings/settings. Java:

Mdataenabler = new Dataenabler (context, new Switch (context));

Implemented through Dataenabler.java, listening to the state and changing:

Private Oncheckedchangelistener mdataenabledlistener= New Oncheckedchangelistener () {

@Override

public void OnCheckedChanged (Compoundbutton buttonview, Boolean isChecked) {

mmobiledataenabled = mconnservice.getmobiledataenabled ();

if (mmobiledataenabled! = mswitch.ischecked ()) {

Mconnservice.setmobiledataenabled (isChecked);

for (int i = 0; i < max_phone_count_tri_sim;i++) {

Settings.Global.putInt (Mcontext.getcontentresolver (),

Settings.Global.MOBILE_DATA + I, isChecked? 1:0);

}

}

}

};

In addition, the insertion of the SIM card settings in the "Traffic usage" of the corresponding Activity:DataUsageSummary.java, which also has the mobile data switch assignment processing; Similar settings for the "mobile data" switch

Related Article

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.