(1) The Alps/framework/base/packages/settingsprovider/res/values/defaults.xml
The "Bluetooth" in the face Airplane_mode_toggleable_radios label is removed.
(2) The following modifications are made in the Packages/apps/settings/src/android/settings/bluetoothangel/bluetoothenabler.java document:
1.import the following two packages:
Import Android.database.ContentObserver;
Import Com.android.settings.AirplaneModeEnabler;
Import Android.os.Handler;
2. Add the following statement at the end of the resume () method:
Add
Mcontext.getcontentresolver (). Registercontentobserver (
Settings.System.getUriFor (Settings.System.AIRPLANE_MODE_ON), True,
Mairplanemodeobserver);
Mswitch.setenabled (!shoulddisablebt ());
Add End
3. In the Pause () method, add the following statement:
Add
Mcontext.getcontentresolver (). Unregistercontentobserver (Mairplanemodeobserver);
Add End
4. Comment out the following statement in the Setswitch () method:
mswitch.setenabled (IsOn | | isoff);
Add the following statement:
Mswitch.setenabled (!shoulddisablebt ()); Add
5. Place the Bluetoothadapter.state_on,bluetoothadapter.off and default in the Handlestatechanged () method
Mswitch.setenabled (True) in these three case; modified to:
Mswitch.setenabled (!shoulddisablebt ()); Add
6. Add the following methods and member variables to the class Bluetoothenabler:
Add
Private Boolean shoulddisablebt () {
String toggleable = Settings.System.getString (Mcontext.getcontentresolver (),
Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
if (toggleable = = NULL | |!toggleable.contains (Settings.System.RADIO_BLUETOOTH)) {
Return Airplanemodeenabler.isairplanemodeon (Mcontext);
}
return false;
}
Add
Private Contentobserver Mairplanemodeobserver = new Contentobserver (new
Handler ()) {
@Override
public void OnChange (Boolean selfchange) {
Onairplanemodechanged ();
}
};
Add
private void onairplanemodechanged () {
Mswitch.setenabled (! Airplanemodeenabler.isairplanemodeon (Mcontext));
}
(3) ALPS. Jb. Mp\alps\frameworks\base\packages\systemui\src\com\android\systemui\statusbar\tool
Bar\connectionswitchpannel.java
In private broadcastreceiver mintentreceiver = new Broadcastreceiver () {
Inside the OnReceive () function.
else if (action.equals (intent.action_airplane_mode_changed)) {
This decision branch is added in the last:
Add for AIRPLAN-BT Toggle State
Mbluetoothstatetracker.setairlinemode (enabled);
Mbluetoothicon.getconfigview (). setenabled (Mbluetoothstatetracker.isclickable ());
Add End
Add the following code to the Bluetoothstatetracker class
Class Bluetoothstatetracker extends Statetracker {
Add
Private
Boolean misairlinemode = false;
public void Setairlinemode (Boolean
Enable) {
if (DBG) {
XLOG.I (TAG, "Bluetooth Setairlinemode
Called, Enabled is: "+ enable);
}
Misairlinemode = enable;
}
public Boolean isclickable () {
XLOG.I (TAG, "BT Misairlinemode
Is "+ Misairlinemode +", misuserswitching is "+ misuserswitching);
Return
!misairlinemode && super.isclickable ();
}
Add End
(4) \alps\packages\apps\settings\src\com\android\settings\widget\settingsappwidgetprovider.java
Add
Import Com.android.settings.AirplaneModeEnabler;
Add End
else if ((Featureoption.mtk_bt_support) && (ButtonID = = Button_bluetooth)) {
Sbluetoothstate.togglestate (context);
Add
if (! Airplanemodeenabler.isairplanemodeon (context)) {
Sbluetoothstate.togglestate (context);
}
Add End
}
Android disables Bluetooth when flying mode is turned on