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

Commit 72777cdd authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5652689 from 32e4fa43 to qt-c2f2-release

Change-Id: I512d71371ad53f179713e410f5f68f3ca8e1048d
parents 5bd68c83 32e4fa43
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -4008,6 +4008,29 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
            String gid2, String pnn, String spn, String carrierPrivilegeRules, String apn) {
    }

    /**
     * Check if the device can only make the emergency call. The device is emergency call only if
     * none of the phone is in service, and one of them has the capability to make the emergency
     * call.
     *
     * @return {@code True} if the device is emergency call only, otherwise return {@code False}.
     */
    public static boolean isEmergencyCallOnly() {
        boolean isEmergencyCallOnly = false;
        for (Phone phone : PhoneFactory.getPhones()) {
            if (phone != null) {
                ServiceState ss = phone.getServiceStateTracker().getServiceState();
                // One of the phone is in service, hence the device is not emergency call only.
                if (ss.getState() == ServiceState.STATE_IN_SERVICE
                        || ss.getDataRegState() == ServiceState.STATE_IN_SERVICE) {
                    return false;
                }
                isEmergencyCallOnly |= ss.isEmergencyOnly();
            }
        }
        return isEmergencyCallOnly;
    }

    /**
     * Get data connection tracker based on the transport type
     *
+2 −0
Original line number Diff line number Diff line
@@ -5261,6 +5261,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
                return "GET_CURRENT_CALLS";
            case RIL_REQUEST_DIAL:
                return "DIAL";
            case RIL_REQUEST_EMERGENCY_DIAL:
                return "EMERGENCY_DIAL";
            case RIL_REQUEST_GET_IMSI:
                return "GET_IMSI";
            case RIL_REQUEST_HANGUP:
+7 −7
Original line number Diff line number Diff line
@@ -2628,7 +2628,7 @@ public class ServiceStateTracker extends Handler {
                final boolean forceDisplayNoService = mPhone.getContext().getResources().getBoolean(
                        com.android.internal.R.bool.config_display_no_service_when_sim_unready)
                        && !mIsSimReady;
                if (mEmergencyOnly && !forceDisplayNoService) {
                if (!forceDisplayNoService && Phone.isEmergencyCallOnly()) {
                    // No service but emergency call allowed
                    plmn = Resources.getSystem().
                            getText(com.android.internal.R.string.emergency_calls_only).toString();
@@ -3413,10 +3413,10 @@ public class ServiceStateTracker extends Handler {
    }

    private String getOperatorNameFromEri() {
        String eriText = null;
        if (mPhone.isPhoneTypeCdma()) {
            if ((mCi.getRadioState() == TelephonyManager.RADIO_POWER_ON)
                    && (!mIsSubscriptionFromRuim)) {
                String eriText;
                // Now the Phone sees the new ServiceState so it can get the new ERI text
                if (mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) {
                    eriText = mPhone.getCdmaEriText();
@@ -3426,7 +3426,6 @@ public class ServiceStateTracker extends Handler {
                    eriText = mPhone.getContext().getText(
                            com.android.internal.R.string.roamingTextSearching).toString();
                }
                return eriText;
            }
        } else if (mPhone.isPhoneTypeCdmaLte()) {
            boolean hasBrandOverride = mUiccController.getUiccCard(getPhoneId()) != null &&
@@ -3437,7 +3436,7 @@ public class ServiceStateTracker extends Handler {
                    || mPhone.getContext().getResources().getBoolean(com.android.internal.R
                    .bool.config_LTE_eri_for_network_name))) {
                // Only when CDMA is in service, ERI will take effect
                String eriText = mSS.getOperatorAlpha();
                eriText = mSS.getOperatorAlpha();
                // Now the Phone sees the new ServiceState so it can get the new ERI text
                if (mSS.getVoiceRegState() == ServiceState.STATE_IN_SERVICE) {
                    eriText = mPhone.getCdmaEriText();
@@ -3454,7 +3453,6 @@ public class ServiceStateTracker extends Handler {
                    eriText = mPhone.getContext()
                            .getText(com.android.internal.R.string.roamingTextSearching).toString();
                }
                return eriText;
            }

            if (mUiccApplcation != null && mUiccApplcation.getState() == AppState.APPSTATE_READY &&
@@ -3470,11 +3468,11 @@ public class ServiceStateTracker extends Handler {
                if (showSpn && (iconIndex == EriInfo.ROAMING_INDICATOR_OFF)
                        && isInHomeSidNid(mSS.getCdmaSystemId(), mSS.getCdmaNetworkId())
                        && mIccRecords != null) {
                    return getServiceProviderName();
                    eriText = getServiceProviderName();
                }
            }
        }
        return null;
        return eriText;
    }

    /**
@@ -4766,6 +4764,8 @@ public class ServiceStateTracker extends Handler {
    public void requestAllCellInfo(WorkSource workSource, Message rspMsg) {
        if (VDBG) log("SST.requestAllCellInfo(): E");
        if (mCi.getRilVersion() < 8) {
            AsyncResult.forMessage(rspMsg);
            rspMsg.sendToTarget();
            if (DBG) log("SST.requestAllCellInfo(): not implemented");
            return;
        }
+62 −15
Original line number Diff line number Diff line
@@ -151,6 +151,18 @@ public class SubscriptionController extends ISub.Stub {
    private int[] colorArr;
    private long mLastISubServiceRegTime;

    // The properties that should be shared and synced across grouped subscriptions.
    private static final Set<String> GROUP_SHARING_PROPERTIES = new HashSet<>(Arrays.asList(
            SubscriptionManager.ENHANCED_4G_MODE_ENABLED,
            SubscriptionManager.VT_IMS_ENABLED,
            SubscriptionManager.WFC_IMS_ENABLED,
            SubscriptionManager.WFC_IMS_MODE,
            SubscriptionManager.WFC_IMS_ROAMING_MODE,
            SubscriptionManager.WFC_IMS_ROAMING_ENABLED,
            SubscriptionManager.DATA_ROAMING,
            SubscriptionManager.DISPLAY_NAME,
            SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES));

    public static SubscriptionController init(Phone phone) {
        synchronized (SubscriptionController.class) {
            if (sInstance == null) {
@@ -1598,8 +1610,7 @@ public class SubscriptionController extends ISub.Stub {
                            mContext, 0 /* requestCode */, new Intent(), 0 /* flags */));
            }

            int result = mContext.getContentResolver().update(
                    SubscriptionManager.getUriForSubscriptionId(subId), value, null, null);
            int result = updateDatabase(value, subId, true);

            // Refresh the Cache of Active Subscription Info List
            refreshCachedActiveSubscriptionInfoList();
@@ -1713,7 +1724,7 @@ public class SubscriptionController extends ISub.Stub {
            value.put(SubscriptionManager.DATA_ROAMING, roaming);
            if (DBG) logd("[setDataRoaming]- roaming:" + roaming + " set");

            int result = databaseUpdateHelper(value, subId, true);
            int result = updateDatabase(value, subId, true);

            // Refresh the Cache of Active Subscription Info List
            refreshCachedActiveSubscriptionInfoList();
@@ -1726,18 +1737,54 @@ public class SubscriptionController extends ISub.Stub {
        }
    }


    public void syncGroupedSetting(int refSubId) {
        // Currently it only syncs allow MMS. Sync other settings as well if needed.
        String dataEnabledOverrideRules = getSubscriptionProperty(
                refSubId, SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES);
        logd("syncGroupedSetting");
        try (Cursor cursor = mContext.getContentResolver().query(
                SubscriptionManager.CONTENT_URI, null,
                SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=?",
                new String[] {String.valueOf(refSubId)}, null)) {
            if (cursor == null || !cursor.moveToFirst()) {
                logd("[syncGroupedSetting] failed. Can't find refSubId " + refSubId);
                return;
            }

        ContentValues value = new ContentValues(1);
        value.put(SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES, dataEnabledOverrideRules);
        databaseUpdateHelper(value, refSubId, true);
            ContentValues values = new ContentValues(GROUP_SHARING_PROPERTIES.size());
            for (String propKey : GROUP_SHARING_PROPERTIES) {
                copyDataFromCursorToContentValue(propKey, cursor, values);
            }
            updateDatabase(values, refSubId, true);
        }
    }

    private int databaseUpdateHelper(ContentValues value, int subId, boolean updateEntireGroup) {
    private void copyDataFromCursorToContentValue(String propKey, Cursor cursor,
            ContentValues values) {
        int columnIndex = cursor.getColumnIndex(propKey);
        if (columnIndex == -1) {
            logd("[copyDataFromCursorToContentValue] can't find column " + propKey);
            return;
        }

        switch (propKey) {
            case SubscriptionManager.ENHANCED_4G_MODE_ENABLED:
            case SubscriptionManager.VT_IMS_ENABLED:
            case SubscriptionManager.WFC_IMS_ENABLED:
            case SubscriptionManager.WFC_IMS_MODE:
            case SubscriptionManager.WFC_IMS_ROAMING_MODE:
            case SubscriptionManager.WFC_IMS_ROAMING_ENABLED:
            case SubscriptionManager.DATA_ROAMING:
                values.put(propKey, cursor.getInt(columnIndex));
                break;
            case SubscriptionManager.DISPLAY_NAME:
            case SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES:
                values.put(propKey, cursor.getString(columnIndex));
                break;
            default:
                loge("[copyDataFromCursorToContentValue] invalid propKey " + propKey);
        }
    }

    // TODO: replace all updates with this helper method.
    private int updateDatabase(ContentValues value, int subId, boolean updateEntireGroup) {
        List<SubscriptionInfo> infoList = getSubscriptionsInGroup(getGroupUuid(subId),
                mContext.getOpPackageName());
        if (!updateEntireGroup || infoList == null || infoList.size() == 0) {
@@ -2561,9 +2608,10 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    private static int setSubscriptionPropertyIntoContentResolver(
    private int setSubscriptionPropertyIntoContentResolver(
            int subId, String propKey, String propValue, ContentResolver resolver) {
        ContentValues value = new ContentValues();
        boolean updateEntireGroup = GROUP_SHARING_PROPERTIES.contains(propKey);
        switch (propKey) {
            case SubscriptionManager.CB_EXTREME_THREAT_ALERT:
            case SubscriptionManager.CB_SEVERE_THREAT_ALERT:
@@ -2591,8 +2639,7 @@ public class SubscriptionController extends ISub.Stub {
                break;
        }

        return resolver.update(SubscriptionManager.getUriForSubscriptionId(subId),
                value, null, null);
        return updateDatabase(value, subId, updateEntireGroup);
    }

    /**
@@ -3697,7 +3744,7 @@ public class SubscriptionController extends ISub.Stub {
        ContentValues value = new ContentValues(1);
        value.put(SubscriptionManager.DATA_ENABLED_OVERRIDE_RULES, rules);

        boolean result = databaseUpdateHelper(value, subId, true) > 0;
        boolean result = updateDatabase(value, subId, true) > 0;

        if (result) {
            // Refresh the Cache of Active Subscription Info List
+3 −2
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.util.LocalLog;
import android.util.SparseArray;

import com.android.internal.telephony.GsmCdmaPhone;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.cdnr.EfData.EFSource;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
import com.android.internal.telephony.uicc.IccRecords;
@@ -380,8 +381,8 @@ public class CarrierDisplayNameResolver {
                com.android.internal.R.bool.config_display_no_service_when_sim_unready)
                && !isSimReady;
        ServiceState ss = getServiceState();
        if (ss.getVoiceRegState() == ServiceState.STATE_POWER_OFF || !ss.isEmergencyOnly()
                || forceDisplayNoService) {
        if (ss.getVoiceRegState() == ServiceState.STATE_POWER_OFF
                || forceDisplayNoService || !Phone.isEmergencyCallOnly()) {
            plmn = mContext.getResources().getString(
                    com.android.internal.R.string.lockscreen_carrier_default);
        } else {
Loading