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

Commit 75c2378e authored by Jack Yu's avatar Jack Yu Committed by android-build-merger
Browse files

Merge "Fixed that telephony registry service reference incorrectly assigned" am: b0510407

am: aeb6820f

Change-Id: Ie788700dfe65037d80fb1a42ff3dae1030b37405
parents 65182320 aeb6820f
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -106,8 +106,6 @@ public class TelephonyManager {
    public static final String MODEM_ACTIVITY_RESULT_KEY =
            BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY;

    private static ITelephonyRegistry sRegistry;

    /**
     * The allowed states of Wi-Fi calling.
     *
@@ -178,11 +176,6 @@ public class TelephonyManager {
            mContext = context;
        }
        mSubscriptionManager = SubscriptionManager.from(mContext);

        if (sRegistry == null) {
            sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
                    "telephony.registry"));
        }
    }

    /** @hide */
@@ -3459,6 +3452,10 @@ public class TelephonyManager {
        return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE));
    }

    private ITelephonyRegistry getTelephonyRegistry() {
        return ITelephonyRegistry.Stub.asInterface(ServiceManager.getService("telephony.registry"));
    }

    //
    //
    // PhoneStateListener
@@ -3498,12 +3495,16 @@ public class TelephonyManager {
            if (listener.mSubId == null) {
                listener.mSubId = mSubId;
            }
            sRegistry.listenForSubscriber(listener.mSubId, getOpPackageName(),

            ITelephonyRegistry registry = getTelephonyRegistry();
            if (registry != null) {
                registry.listenForSubscriber(listener.mSubId, getOpPackageName(),
                        listener.callback, events, notifyNow);
            } else {
                Rlog.w(TAG, "telephony registry not ready.");
            }
        } catch (RemoteException ex) {
            // system process dead
        } catch (NullPointerException ex) {
            // system process dead
        }
    }