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

Commit eeacf937 authored by Wink Saville's avatar Wink Saville
Browse files

Empty triangle displayed for radio signal but calls & data work

TelephonyRegistry: when default sub id is requested set isLegacyApp to
true so when ACTION_DEFAULT_SUBSCRIPTION_CHANGED is received the
TelephonyRegistry.Record.subId will be updated.

SubInfoRecord: Add SubInfoRecord toString for easier debugging

SubscriptionManager: Add putPHoneIdAndSubIdExtra(intent, phoneId, subId)
as this allows explicit setup of phoneId and subId and does not rely on
a phone's subId being set.

Bug: 15669560
Change-Id: I645ddb35b964b08dcb46f881c9d02b932d128950
parent 2c749d24
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {

        @Override
        public String toString() {
            return "{pkgForDebug=" + pkgForDebug + " callerUid=" + callerUid +
            return "{pkgForDebug=" + pkgForDebug + " callerUid=" + callerUid + " subId=" + subId +
                    " events=" + Integer.toHexString(events) + "}";
        }
    }
@@ -208,11 +208,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
            String action = intent.getAction();
            Slog.d(TAG, "mBroadcastReceiver: action=" + action);
            if (Intent.ACTION_USER_SWITCHED.equals(action)) {
                mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHED,
                       intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0), 0));
                int userHandle = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
                if (DBG) Slog.d(TAG, "onReceive: userHandle=" + userHandle);
                mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHED, userHandle, 0));
            } else if (action.equals(TelephonyIntents.ACTION_DEFAULT_SUBSCRIPTION_CHANGED)) {
                mDefaultSubId = intent.getLongExtra(PhoneConstants.SUBSCRIPTION_KEY,
                        SubscriptionManager.getDefaultSubId());
                if (DBG) Slog.d(TAG, "onReceive: mDefaultSubId=" + mDefaultSubId);
                mHandler.sendMessage(mHandler.obtainMessage(MSG_UPDATE_DEFAULT_SUB, 0, 0));
            }
        }
@@ -340,18 +342,19 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    // the received subId value update the isLegacyApp field
                    if ((r.subId <= 0) || (r.subId == SubscriptionManager.INVALID_SUB_ID)) {
                        r.subId = mDefaultSubId;
                        r.isLegacyApp = true; // FIXME: is this needed ??
                        r.isLegacyApp = true; // r.subId is to be update when default changes.
                    }
                    if (r.subId == SubscriptionManager.DEFAULT_SUB_ID) {
                        r.subId = mDefaultSubId;
                        r.isLegacyApp = true; // r.subId is to be update when default changes.
                        if (DBG) Slog.i(TAG, "listen: DEFAULT_SUB_ID");
                    }
                    mRecords.add(r);
                    if (DBG) Slog.i(TAG, "listen: add new record=" + r);
                    if (DBG) Slog.i(TAG, "listen: add new record");
                }
                int phoneId = SubscriptionManager.getPhoneId(subId);
                int send = events & (events ^ r.events);
                r.events = events;
                if (DBG) Slog.i(TAG, "listen: set events record=" + r);
                if (notifyNow && validatePhoneId(phoneId)) {
                    if ((events & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) {
                        try {
@@ -1063,6 +1066,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
            pw.println("  mDataConnectionLinkProperties=" + mDataConnectionLinkProperties);
            pw.println("  mDataConnectionNetworkCapabilities=" +
                    mDataConnectionNetworkCapabilities);
            pw.println("  mDefaultSubId=" + mDefaultSubId);
            pw.println("  mCellLocation=" + mCellLocation);
            pw.println("  mCellInfo=" + mCellInfo);
            pw.println("  mDcRtInfo=" + mDcRtInfo);
+7 −0
Original line number Diff line number Diff line
@@ -105,4 +105,11 @@ public class SubInfoRecord implements Parcelable {
        return 0;
    }

    public String toString() {
        return "{mSubId=" + mSubId + ", mIccId=" + mIccId + " mSlotId=" + mSlotId
                + " mDisplayName=" + mDisplayName + " mNameSource=" + mNameSource
                + " mColor=" + mColor + " mNumber=" + mNumber
                + " mDispalyNumberFormat=" + mDispalyNumberFormat + " mDataRoaming=" + mDataRoaming
                + " mSimIconRes=" + mSimIconRes + "}";
    }
}
+7 −3
Original line number Diff line number Diff line
@@ -697,12 +697,16 @@ public class SubscriptionManager implements BaseColumns {
    public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) {
        long [] subId = SubscriptionManager.getSubId(phoneId);
        if ((subId != null) && (subId.length >= 1)) {
            if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
            intent.putExtra(PhoneConstants.SLOT_KEY, phoneId); //FIXME: RENAME TO PHONE_ID_KEY ??
            intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId[0]);
            putPhoneIdAndSubIdExtra(intent, phoneId, subId[0]);
        } else {
            logd("putPhoneIdAndSubIdExtra: no valid subs");
        }
    }

    public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId, long subId) {
        if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
        intent.putExtra(PhoneConstants.SLOT_KEY, phoneId); //FIXME: RENAME TO PHONE_ID_KEY ??
        intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
    }
}