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

Commit ec3e5cca authored by Chirayu Desai's avatar Chirayu Desai Committed by Bruno Martins
Browse files

Account for PhoneMonitor API change

* Needed after:
https://github.com/LineageOS/android_frameworks_base/commit/84a90870aa021fa168fab4db613fb87f8d58a4c1

Change-Id: Ie6c28388f28b97af273f7c93fc6b5b56b518370a
parent b0f5aa95
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.Looper;
import android.os.SystemProperties;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
@@ -102,7 +105,7 @@ public class PhoneMonitor {
        private int mSubId = -1;

        public SubscriptionStateTracker(int subId) {
            super(subId);
            super(new HandlerExecutor(new Handler(Looper.myLooper())));
            mSubId = subId;
        }

@@ -193,7 +196,7 @@ public class PhoneMonitor {
            if (mTrackers.indexOfKey(subId) < 0) {
                SubscriptionStateTracker tracker = new SubscriptionStateTracker(subId);
                mTrackers.put(subId, tracker);
                mTelephony.listen(tracker, LISTEN_SERVICE_STATE
                mTelephony.createForSubscriptionId(subId).listen(tracker, LISTEN_SERVICE_STATE
                        | LISTEN_SIGNAL_STRENGTHS
                        | LISTEN_DATA_CONNECTION_STATE);
            }
@@ -218,11 +221,11 @@ public class PhoneMonitor {
    }

    public String getSimOperatorName(int subId) {
        return mTelephony.getSimOperatorName(subId);
        return mTelephony.createForSubscriptionId(subId).getSimOperatorName();
    }

    public String getNetworkOperatorName(int subId) {
        return mTelephony.getNetworkOperatorName(subId);
        return mTelephony.createForSubscriptionId(subId).getNetworkOperatorName();
    }

    public ServiceState getServiceStateForSubscriber(int subId) {
@@ -299,7 +302,7 @@ public class PhoneMonitor {
    }

    public boolean isGSM(int subId) {
        return mTelephony.getCurrentPhoneType(subId) == PHONE_TYPE_GSM;
        return mTelephony.createForSubscriptionId(subId).getCurrentPhoneType() == PHONE_TYPE_GSM;
    }

    public boolean isLte(int subId) {
@@ -307,10 +310,11 @@ public class PhoneMonitor {
    }

    public int getLteOnCdmaMode(int subId) {
        if (mTelephony == null || mTelephony.getLteOnCdmaMode(subId) == LTE_ON_CDMA_UNKNOWN) {
        if (mTelephony == null || mTelephony.createForSubscriptionId(subId).getLteOnCdmaMode()
                    == LTE_ON_CDMA_UNKNOWN) {
            return SystemProperties.getInt("telephony.lteOnCdmaDevice", LTE_ON_CDMA_UNKNOWN);
        }
        return mTelephony.getLteOnCdmaMode(subId);
        return mTelephony.createForSubscriptionId(subId).getLteOnCdmaMode();
    }

    private void logPhoneState(String prefix) {
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ public class SetupWizardUtils {
            android.provider.Settings.Global.putInt(context.getContentResolver(),
                    android.provider.Settings.Global.MOBILE_DATA + phoneId, enabled ? 1 : 0);
            int subId = SubscriptionManager.getDefaultDataSubscriptionId();
            tm.setDataEnabled(subId, enabled);
            tm.createForSubscriptionId(subId).setDataEnabled(enabled);
        } else {
            android.provider.Settings.Global.putInt(context.getContentResolver(),
                    android.provider.Settings.Global.MOBILE_DATA, enabled ? 1 : 0);