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

Commit 44fb1904 authored by Taesu Lee's avatar Taesu Lee Committed by Sarah Chin
Browse files

SMS service loads MMS config directly instead



getCarrierConfigValues() is removed from MmsManager and SMS service
loads Carrier configuration values directly since MmsService could
return null or cached config instead if an app requests the config by
receiving ACTION_CARRIER_CONFIG_CHANGED before the config is loaded
newly in MmsService by ACTION_CARRIER_CONFIG_CHANGED.

Bug: 145768042
Test: manual

Change-Id: Idc21015cab2902bd0f67e2131ea89b04c4fc4f5e
Signed-off-by: default avatarTaesu Lee <taesu82.lee@samsung.com>
parent 52060dca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -45655,7 +45655,7 @@ package android.telephony {
    method @Nullable public String createAppSpecificSmsTokenWithPackageInfo(@Nullable String, @NonNull android.app.PendingIntent);
    method public java.util.ArrayList<java.lang.String> divideMessage(String);
    method public void downloadMultimediaMessage(android.content.Context, String, android.net.Uri, android.os.Bundle, android.app.PendingIntent);
    method public android.os.Bundle getCarrierConfigValues();
    method @Nullable public android.os.Bundle getCarrierConfigValues();
    method public static android.telephony.SmsManager getDefault();
    method public static int getDefaultSmsSubscriptionId();
    method public static android.telephony.SmsManager getSmsManagerForSubscriptionId(int);
+0 −18
Original line number Diff line number Diff line
@@ -97,22 +97,4 @@ public class MmsManager {
            // Ignore it
        }
    }

    /**
     * Get carrier-dependent configuration values.
     *
     * @param subId the subscription id
     * @return bundle key/values pairs of configuration values
     */
    public Bundle getCarrierConfigValues(int subId) {
        try {
            IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
            if (iMms != null) {
                return iMms.getCarrierConfigValues(subId);
            }
        } catch (RemoteException ex) {
            // ignore it
        }
        return null;
    }
}
+0 −7
Original line number Diff line number Diff line
@@ -59,13 +59,6 @@ interface IMms {
            in Uri contentUri, in Bundle configOverrides,
            in PendingIntent downloadedIntent);

    /**
     * Get carrier-dependent configuration values.
     *
     * @param subId the SIM id
     */
    Bundle getCarrierConfigValues(int subId);

    /**
     * Import a text message into system's SMS store
     *
+0 −11
Original line number Diff line number Diff line
@@ -139,11 +139,6 @@ public class MmsServiceBroker extends SystemService {
            returnPendingIntentWithError(downloadedIntent);
        }

        @Override
        public Bundle getCarrierConfigValues(int subId) throws RemoteException {
            return null;
        }

        @Override
        public Uri importTextMessage(String callingPkg, String address, int type, String text,
                long timestampMillis, boolean seen, boolean read) throws RemoteException {
@@ -372,12 +367,6 @@ public class MmsServiceBroker extends SystemService {
                    configOverrides, downloadedIntent);
        }

        @Override
        public Bundle getCarrierConfigValues(int subId) throws RemoteException {
            Slog.d(TAG, "getCarrierConfigValues() by " + getCallingPackageName());
            return getServiceGuarded().getCarrierConfigValues(subId);
        }

        @Override
        public Uri importTextMessage(String callingPkg, String address, int type, String text,
                long timestampMillis, boolean seen, boolean read) throws RemoteException {
+19 −10
Original line number Diff line number Diff line
@@ -2504,22 +2504,31 @@ public final class SmsManager {
    public static final String MESSAGE_STATUS_READ = "read";

    /**
     * Get carrier-dependent configuration values.
     * Get carrier-dependent MMS configuration values.
     *
     * <p class="note"><strong>Note:</strong> This method is intended for internal use by carrier
     * applications or the Telephony framework and will never trigger an SMS disambiguation
     * dialog. If this method is called on a device that has multiple active subscriptions, this
     * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
     * default subscription is defined, the subscription ID associated with this message will be
     * INVALID, which will result in the operation being completed on the subscription associated
     * with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the
     * operation is performed on the correct subscription.
     * applications or the Telephony framework and will never trigger an SMS disambiguation dialog.
     * If this method is called on a device that has multiple active subscriptions, this {@link
     * SmsManager} instance has been created with {@link #getDefault()}, and no user-defined default
     * subscription is defined, the subscription ID associated with this message will be INVALID,
     * which will result in the operation being completed on the subscription associated with
     * logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the operation is
     * performed on the correct subscription.
     * </p>
     *
     * @return bundle key/values pairs of configuration values
     * @return the bundle key/values pairs that contains MMS configuration values
     */
    @Nullable
    public Bundle getCarrierConfigValues() {
        return MmsManager.getInstance().getCarrierConfigValues(getSubscriptionId());
        try {
            ISms iSms = getISmsService();
            if (iSms != null) {
                return iSms.getCarrierConfigValuesForSubscriber(getSubscriptionId());
            }
        } catch (RemoteException ex) {
            // ignore it
        }
        return null;
    }

    /**
Loading