GlobalActions: Fix Airplane Mode on/off issue
Issue: Unable to turn off Airplane mode from power button
after phone reboot
Fix: Initialize mHasTelephony before the PhoneStateListener is
registered to the TelephonyManager so that correct value
of mHasTelephony is reflected when onServiceStateChanged
callback is called.
Bug: 13697360
Change-Id: Ide8afd9c16ea90b98b5912dbff440c5fd67b178d
This commit is contained in:
committed by
Hariprasad Jayakumar
parent
77ceb5e8f1
commit
c3b7e6fd44
@@ -121,13 +121,14 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
||||
filter.addAction(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
|
||||
context.registerReceiver(mBroadcastReceiver, filter);
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
mHasTelephony = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
|
||||
|
||||
// get notified of phone state changes
|
||||
TelephonyManager telephonyManager =
|
||||
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
telephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE);
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
mHasTelephony = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
|
||||
mContext.getContentResolver().registerContentObserver(
|
||||
Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON), true,
|
||||
mAirplaneModeObserver);
|
||||
|
||||
Reference in New Issue
Block a user