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

Commit 807a7a28 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6329815 from 6509969e to rvc-release

Change-Id: I3c8f8b7b8e3bac9b1042f49f70e0c727198fb064
parents 2870e4b6 6509969e
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -185,6 +185,10 @@ public abstract class Connection {
    protected int mCnapNamePresentation  = PhoneConstants.PRESENTATION_ALLOWED;
    @UnsupportedAppUsage
    protected String mAddress;     // MAY BE NULL!!!
    // The VERSTAT number verification status; defaults to not verified.
    protected @android.telecom.Connection.VerificationStatus int mNumberVerificationStatus =
            android.telecom.Connection.VERIFICATION_STATUS_NOT_VERIFIED;

    @UnsupportedAppUsage
    protected String mDialString;          // outgoing calls only
    protected String[] mParticipantsToDial;// outgoing calls only
@@ -1405,4 +1409,20 @@ public abstract class Connection {
    public int getAudioCodec() {
        return mAudioCodec;
    }

    /**
     * @return The number verification status; only applicable for IMS calls.
     */
    public @android.telecom.Connection.VerificationStatus int getNumberVerificationStatus() {
        return mNumberVerificationStatus;
    }

    /**
     * Sets the number verification status.
     * @param verificationStatus The new verification status
     */
    public void setNumberVerificationStatus(
            @android.telecom.Connection.VerificationStatus int verificationStatus) {
        mNumberVerificationStatus = verificationStatus;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ import android.hardware.radio.V1_0.SsInfoData;
import android.hardware.radio.V1_0.StkCcUnsolSsResult;
import android.hardware.radio.V1_0.SuppSvcNotification;
import android.hardware.radio.V1_2.CellConnectionStatus;
import android.hardware.radio.V1_4.IRadioIndication;
import android.hardware.radio.V1_5.IRadioIndication;
import android.os.AsyncResult;
import android.sysprop.TelephonyProperties;
import android.telephony.Annotation.RadioPowerState;
@@ -1022,7 +1022,7 @@ public class RadioIndication extends IRadioIndication.Stub {
     */
    public void barringInfoChanged(int indicationType,
            android.hardware.radio.V1_5.CellIdentity cellIdentity,
            List<android.hardware.radio.V1_5.BarringInfo> barringInfos) {
            ArrayList<android.hardware.radio.V1_5.BarringInfo> barringInfos) {
        mRil.processIndication(indicationType);

        CellIdentity ci = CellIdentity.create(cellIdentity);
+50 −4
Original line number Diff line number Diff line
@@ -219,6 +219,9 @@ public class SubscriptionController extends ISub.Stub {
        // clear SLOT_INDEX for all subs
        clearSlotIndexForSubInfoRecords();

        // Cache Setting values
        cacheSettingValues();

        if (DBG) logdl("[SubscriptionController] init by Context");
    }

@@ -254,6 +257,26 @@ public class SubscriptionController extends ISub.Stub {
        mContext.getContentResolver().update(SubscriptionManager.CONTENT_URI, value, null, null);
    }

    /**
     * Cache the Settings values by reading these values from Setting from disk to prevent disk I/O
     * access during the API calling. This is based on an assumption that the Settings system will
     * itself cache this value after the first read and thus only the first read after boot will
     * access the disk.
     */
    private void cacheSettingValues() {
        Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION,
                        SubscriptionManager.INVALID_SUBSCRIPTION_ID);

        Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.MULTI_SIM_VOICE_CALL_SUBSCRIPTION,
                        SubscriptionManager.INVALID_SUBSCRIPTION_ID);

        Settings.Global.getInt(mContext.getContentResolver(),
                Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION,
                        SubscriptionManager.INVALID_SUBSCRIPTION_ID);
    }

    @UnsupportedAppUsage
    protected void enforceModifyPhoneState(String message) {
        mContext.enforceCallingOrSelfPermission(
@@ -283,6 +306,20 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    /**
     * Returns whether the {@code callingPackage} has access to the phone number on the specified
     * {@code subId} using the provided {@code message} in any resulting SecurityException.
     */
    private boolean hasPhoneNumberAccess(int subId, String callingPackage, String callingFeatureId,
            String message) {
        try {
            return TelephonyPermissions.checkCallingOrSelfReadPhoneNumber(mContext, subId,
                    callingPackage, callingFeatureId, message);
        } catch (SecurityException e) {
            return false;
        }
    }

    /**
     * Broadcast when SubscriptionInfo has changed
     * FIXME: Hopefully removed if the API council accepts SubscriptionInfoListener
@@ -3746,12 +3783,21 @@ public class SubscriptionController extends ISub.Stub {
    private SubscriptionInfo conditionallyRemoveIdentifiers(SubscriptionInfo subInfo,
            String callingPackage, String callingFeatureId, String message) {
        SubscriptionInfo result = subInfo;
        if (!hasSubscriberIdentifierAccess(subInfo.getSubscriptionId(), callingPackage,
                callingFeatureId, message)) {
        int subId = subInfo.getSubscriptionId();
        boolean hasIdentifierAccess = hasSubscriberIdentifierAccess(subId, callingPackage,
                callingFeatureId, message);
        boolean hasPhoneNumberAccess = hasPhoneNumberAccess(subId, callingPackage, callingFeatureId,
                message);
        if (!hasIdentifierAccess || !hasPhoneNumberAccess) {
            result = new SubscriptionInfo(subInfo);
            if (!hasIdentifierAccess) {
                result.clearIccId();
                result.clearCardString();
            }
            if (!hasPhoneNumberAccess) {
                result.clearNumber();
            }
        }
        return result;
    }

+53 −7
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.Message;
import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -405,6 +406,8 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
    // Persistent Logging
    private final LocalLog mEventLog = new LocalLog(50);

    private boolean mBootCompletedHandlerRan = false;

    // Synchronize all events on a handler to ensure that the cache includes the most recent
    // version of the installed ImsServices.
    private Handler mHandler = new Handler(Looper.getMainLooper(), (msg) -> {
@@ -420,9 +423,12 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
                break;
            }
            case HANDLER_BOOT_COMPLETE: {
                if (!mBootCompletedHandlerRan) {
                    mBootCompletedHandlerRan = true;
                    mEventLog.log("handling BOOT_COMPLETE");
                    // Re-evaluate bound services for all slots after requerying packagemanager
                    maybeAddedImsService(null /*packageName*/);
                }
                break;
            }
            case HANDLER_CONFIG_CHANGED: {
@@ -539,8 +545,17 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
        mReceiverContext.registerReceiver(mAppChangedReceiver, appChangedFilter);
        mReceiverContext.registerReceiver(mConfigChangedReceiver, new IntentFilter(
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));

        UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
        if (userManager.isUserUnlocked()) {
            mHandler.obtainMessage(HANDLER_BOOT_COMPLETE, null).sendToTarget();
        } else {
            mReceiverContext.registerReceiver(mBootCompleted, new IntentFilter(
                    Intent.ACTION_BOOT_COMPLETED));
            if (userManager.isUserUnlocked()) {
                mHandler.obtainMessage(HANDLER_BOOT_COMPLETE, null).sendToTarget();
            }
        }
    }

    @VisibleForTesting
@@ -1179,6 +1194,8 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal

    // Called from handler ONLY.
    private void carrierConfigChanged(int slotId) {
        updateBoundDeviceServices();

        if (slotId <= SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
            // not specified, update carrier override cache and possibly rebind on all slots.
            for (int i = 0; i < mNumSlots; i++) {
@@ -1188,11 +1205,28 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
        updateBoundServices(slotId, getImsPackageOverrideConfig(slotId));
    }

    private void updateBoundDeviceServices() {
        Log.d(TAG, "updateBoundDeviceServices: called");
        ArrayMap<String, ImsServiceInfo> featureDynamicImsPackages = new ArrayMap<>();
        for (int f = ImsFeature.FEATURE_EMERGENCY_MMTEL; f < ImsFeature.FEATURE_MAX; f++) {
            String packageName = getDeviceConfiguration(f);
            ImsServiceInfo serviceInfo = getImsServiceInfoFromCache(packageName);
            if (serviceInfo != null && !serviceInfo.featureFromMetadata
                    && !featureDynamicImsPackages.containsKey(packageName)) {
                featureDynamicImsPackages.put(packageName, serviceInfo);

                Log.d(TAG, "updateBoundDeviceServices: Schedule query for package=" + packageName);
                scheduleQueryForFeatures(featureDynamicImsPackages.get(packageName));
            }
        }
    }

    private void updateBoundServices(int slotId, Map<Integer, String> featureMap) {
        if (slotId <= SubscriptionManager.INVALID_SIM_SLOT_INDEX || slotId >= mNumSlots) {
            return;
        }
        boolean hasConfigChanged = false;
        boolean didQuerySchedule = false;
        for (int f = ImsFeature.FEATURE_EMERGENCY_MMTEL; f < ImsFeature.FEATURE_MAX; f++) {
            String overridePackageName = getOverridePackageName(slotId, f);
            String oldPackageName = getCarrierConfiguredPackageName(slotId, f);
@@ -1207,20 +1241,28 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
                        ImsFeature.FEATURE_LOG_MAP.getOrDefault(f, "invalid"), slotId));
                newPackageName = overridePackageName;
            }
            mEventLog.log("updateBoundServices - carrier package changed: "
                    + oldPackageName + " -> " + newPackageName + " on slot " + slotId);

            setCarrierConfiguredPackageName(newPackageName, slotId, f);
            // Carrier config may have not changed, but we still want to kick off a recalculation
            // in case there has been a change to the supported device features.
            ImsServiceInfo info = getImsServiceInfoFromCache(newPackageName);
            mEventLog.log("updateBoundServices - carrier package changed: "
                    + oldPackageName + " -> " + newPackageName + " on slot " + slotId
                    + ", hasConfigChanged=" + hasConfigChanged);
            if (info == null || info.featureFromMetadata) {
                hasConfigChanged = true;
            } else {
                // Config will change when this query completes
                scheduleQueryForFeatures(info);
                didQuerySchedule = true;
            }
        }
        if (hasConfigChanged) calculateFeatureConfigurationChange();

        if (hasConfigChanged && didQuerySchedule) {
            mEventLog.log("[warning] updateBoundServices - both hasConfigChange and query "
                    + "scheduled on slot " + slotId);
        }
    }

    private @NonNull Map<Integer, String> getImsPackageOverrideConfig(int slotId) {
@@ -1384,6 +1426,10 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
        service.replaceFeatures(features);
        // Wait until all queries have completed before changing the configuration to reduce churn.
        if (!mFeatureQueryManager.isQueryInProgress()) {
            if (mHandler.hasMessages(HANDLER_DYNAMIC_FEATURE_CHANGE)) {
                mEventLog.log("[warning] dynamicQueryComplete - HANDLER_DYNAMIC_FEATURE_CHANGE "
                        + "pending with calculateFeatureConfigurationChange()");
            }
            calculateFeatureConfigurationChange();
        }
    }
+22 −0
Original line number Diff line number Diff line
@@ -195,6 +195,8 @@ public class ImsPhoneConnection extends Connection implements
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_OIR));
            mCnapNamePresentation = ImsCallProfile.OIRToPresentation(
                    imsCall.getCallProfile().getCallExtraInt(ImsCallProfile.EXTRA_CNAP));
            setNumberVerificationStatus(toTelecomVerificationStatus(
                    imsCall.getCallProfile().getCallerNumberVerificationStatus()));
            updateMediaCapabilities(imsCall);
        } else {
            mNumberPresentation = PhoneConstants.PRESENTATION_UNKNOWN;
@@ -1493,4 +1495,24 @@ public class ImsPhoneConnection extends Connection implements
                + "; updating local video availability.");
        updateMediaCapabilities(getImsCall());
    }

    /**
     * Converts an {@link ImsCallProfile} verification status to a
     * {@link android.telecom.Connection} verification status.
     * @param verificationStatus The {@link ImsCallProfile} verification status.
     * @return The telecom verification status.
     */
    public static @android.telecom.Connection.VerificationStatus int toTelecomVerificationStatus(
            @ImsCallProfile.VerificationStatus int verificationStatus) {
        switch (verificationStatus) {
            case ImsCallProfile.VERIFICATION_STATUS_PASSED:
                return android.telecom.Connection.VERIFICATION_STATUS_PASSED;
            case ImsCallProfile.VERIFICATION_STATUS_FAILED:
                return android.telecom.Connection.VERIFICATION_STATUS_FAILED;
            case ImsCallProfile.VERIFICATION_STATUS_NOT_VERIFIED:
                // fall through on purpose
            default:
                return android.telecom.Connection.VERIFICATION_STATUS_NOT_VERIFIED;
        }
    }
}
Loading