Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6965bc87 authored by nagarw's avatar nagarw
Browse files

/platform/frameworks/base: Fix Airplane Mode on/off issue

Issue: Unable to turn off Airplane mode from power button
       after phone reboot

Fix: Initialize mHasTelephony before the PhoneStateLister
     is attached to the TelephonyManager so that correct
     value of mHasTelephony is reflected in the Listener.

CRs-Fixed: 600526

Change-Id: Ide8afd9c16ea90b98b5912dbff440c5fd67b178d
parent 22f95644
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -122,13 +122,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);