Airplane Mode in Emergency Callback Mode (ECM)
When user tries to change Airplane Mode between ON & OFF in ECM mode, a notice should be shown to indicate it's in ECM mode, and ask if user wants to exit ECM, if yes, then the Airplane Mode is changed after ECM mode exit. If not, Airplane Mode should not be changed.
This commit is contained in:
committed by
Wink Saville
parent
b89653cb95
commit
71cc49e480
@@ -22,11 +22,14 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemProperties;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.Preference;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.ServiceState;
|
||||
|
||||
import com.android.internal.telephony.TelephonyProperties;
|
||||
|
||||
public class AirplaneModeEnabler implements Preference.OnPreferenceChangeListener {
|
||||
|
||||
private final Context mContext;
|
||||
@@ -111,8 +114,23 @@ public class AirplaneModeEnabler implements Preference.OnPreferenceChangeListene
|
||||
* Called when someone clicks on the checkbox preference.
|
||||
*/
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
setAirplaneModeOn((Boolean) newValue);
|
||||
if (Boolean.parseBoolean(
|
||||
SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) {
|
||||
// In ECM mode, do not update database at this point
|
||||
} else {
|
||||
setAirplaneModeOn((Boolean) newValue);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setAirplaneModeInECM(boolean isECMExit, boolean isAirplaneModeOn) {
|
||||
if (isECMExit) {
|
||||
// update database based on the current checkbox state
|
||||
setAirplaneModeOn(isAirplaneModeOn);
|
||||
} else {
|
||||
// update checkbox state based on database value
|
||||
onAirplaneModeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user