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: Taesu Lee <taesu82.lee@samsung.com>
This commit is contained in:
Taesu Lee
2019-11-15 16:16:08 +09:00
committed by Sarah Chin
parent 52060dca88
commit 44fb1904e3
7 changed files with 48 additions and 62 deletions

View File

@@ -45655,7 +45655,7 @@ package android.telephony {
method @Nullable public String createAppSpecificSmsTokenWithPackageInfo(@Nullable String, @NonNull android.app.PendingIntent); method @Nullable public String createAppSpecificSmsTokenWithPackageInfo(@Nullable String, @NonNull android.app.PendingIntent);
method public java.util.ArrayList<java.lang.String> divideMessage(String); 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 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 android.telephony.SmsManager getDefault();
method public static int getDefaultSmsSubscriptionId(); method public static int getDefaultSmsSubscriptionId();
method public static android.telephony.SmsManager getSmsManagerForSubscriptionId(int); method public static android.telephony.SmsManager getSmsManagerForSubscriptionId(int);

View File

@@ -97,22 +97,4 @@ public class MmsManager {
// Ignore it // 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;
}
} }

View File

@@ -59,13 +59,6 @@ interface IMms {
in Uri contentUri, in Bundle configOverrides, in Uri contentUri, in Bundle configOverrides,
in PendingIntent downloadedIntent); 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 * Import a text message into system's SMS store
* *

View File

@@ -139,11 +139,6 @@ public class MmsServiceBroker extends SystemService {
returnPendingIntentWithError(downloadedIntent); returnPendingIntentWithError(downloadedIntent);
} }
@Override
public Bundle getCarrierConfigValues(int subId) throws RemoteException {
return null;
}
@Override @Override
public Uri importTextMessage(String callingPkg, String address, int type, String text, public Uri importTextMessage(String callingPkg, String address, int type, String text,
long timestampMillis, boolean seen, boolean read) throws RemoteException { long timestampMillis, boolean seen, boolean read) throws RemoteException {
@@ -372,12 +367,6 @@ public class MmsServiceBroker extends SystemService {
configOverrides, downloadedIntent); configOverrides, downloadedIntent);
} }
@Override
public Bundle getCarrierConfigValues(int subId) throws RemoteException {
Slog.d(TAG, "getCarrierConfigValues() by " + getCallingPackageName());
return getServiceGuarded().getCarrierConfigValues(subId);
}
@Override @Override
public Uri importTextMessage(String callingPkg, String address, int type, String text, public Uri importTextMessage(String callingPkg, String address, int type, String text,
long timestampMillis, boolean seen, boolean read) throws RemoteException { long timestampMillis, boolean seen, boolean read) throws RemoteException {

View File

@@ -2504,22 +2504,31 @@ public final class SmsManager {
public static final String MESSAGE_STATUS_READ = "read"; 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 * <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 * applications or the Telephony framework and will never trigger an SMS disambiguation dialog.
* dialog. If this method is called on a device that has multiple active subscriptions, this * If this method is called on a device that has multiple active subscriptions, this {@link
* {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined * SmsManager} instance has been created with {@link #getDefault()}, and no user-defined default
* default subscription is defined, the subscription ID associated with this message will be * subscription is defined, the subscription ID associated with this message will be INVALID,
* INVALID, which will result in the operation being completed on the subscription associated * which will result in the operation being completed on the subscription associated with
* with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the * logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the operation is
* operation is performed on the correct subscription. * performed on the correct subscription.
* </p> * </p>
* *
* @return bundle key/values pairs of configuration values * @return the bundle key/values pairs that contains MMS configuration values
*/ */
@Nullable
public Bundle getCarrierConfigValues() { 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;
} }
/** /**

View File

@@ -1,18 +1,18 @@
/* /*
** Copyright 2007, The Android Open Source Project * Copyright 2007, The Android Open Source Project
** *
** Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
** You may obtain a copy of the License at * You may obtain a copy of the License at
** *
** http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
** *
** Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
** limitations under the License. * limitations under the License.
*/ */
package com.android.internal.telephony; package com.android.internal.telephony;
@@ -22,7 +22,7 @@ import android.os.Bundle;
import com.android.internal.telephony.SmsRawData; import com.android.internal.telephony.SmsRawData;
/** /**
* Interface for applications to access the ICC phone book. * Service interface to handle SMS API requests
* *
* See also SmsManager.java. * See also SmsManager.java.
*/ */
@@ -541,6 +541,13 @@ interface ISms {
String scAddress, in List<PendingIntent> sentIntents, String scAddress, in List<PendingIntent> sentIntents,
in List<PendingIntent> deliveryIntents); in List<PendingIntent> deliveryIntents);
/**
* Get carrier-dependent configuration values.
*
* @param subId the subscription Id
*/
Bundle getCarrierConfigValuesForSubscriber(int subId);
/** /**
* Create an app-only incoming SMS request for the calling package. * Create an app-only incoming SMS request for the calling package.
* *

View File

@@ -18,6 +18,7 @@ package com.android.internal.telephony;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle;
import java.util.List; import java.util.List;
@@ -184,6 +185,11 @@ public class ISmsImplBase extends ISms.Stub {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public Bundle getCarrierConfigValuesForSubscriber(int subId) {
throw new UnsupportedOperationException();
}
@Override @Override
public String createAppSpecificSmsToken(int subId, String callingPkg, PendingIntent intent) { public String createAppSpecificSmsToken(int subId, String callingPkg, PendingIntent intent) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();