Files
frameworks_base/mms/java/android/telephony/MmsManager.java
Taesu Lee 44fb1904e3 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>
2020-01-06 15:09:48 -08:00

101 lines
3.8 KiB
Java

/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.telephony;
import android.app.ActivityThread;
import android.app.PendingIntent;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import com.android.internal.telephony.IMms;
/**
* Manages MMS operations such as sending multimedia messages.
* Get this object by calling the static method {@link #getInstance()}.
* @hide
*/
public class MmsManager {
private static final String TAG = "MmsManager";
/** Singleton object constructed during class initialization. */
private static final MmsManager sInstance = new MmsManager();
/**
* Get the MmsManager singleton instance.
*
* @return the {@link MmsManager} singleton instance.
*/
public static MmsManager getInstance() {
return sInstance;
}
/**
* Send an MMS message
*
* @param subId the subscription id
* @param contentUri the content Uri from which the message pdu will be read
* @param locationUrl the optional location url where message should be sent to
* @param configOverrides the carrier-specific messaging configuration values to override for
* sending the message.
* @param sentIntent if not NULL this <code>PendingIntent</code> is broadcast when the message
* is successfully sent, or failed
*/
public void sendMultimediaMessage(int subId, Uri contentUri, String locationUrl,
Bundle configOverrides, PendingIntent sentIntent) {
try {
final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
if (iMms == null) {
return;
}
iMms.sendMessage(subId, ActivityThread.currentPackageName(), contentUri,
locationUrl, configOverrides, sentIntent);
} catch (RemoteException e) {
// Ignore it
}
}
/**
* Download an MMS message from carrier by a given location URL
*
* @param subId the subscription id
* @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
* from the MMS WAP push notification
* @param contentUri the content uri to which the downloaded pdu will be written
* @param configOverrides the carrier-specific messaging configuration values to override for
* downloading the message.
* @param downloadedIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is downloaded, or the download is failed
* @throws IllegalArgumentException if locationUrl or contentUri is empty
*/
public void downloadMultimediaMessage(int subId, String locationUrl, Uri contentUri,
Bundle configOverrides, PendingIntent downloadedIntent) {
try {
final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
if (iMms == null) {
return;
}
iMms.downloadMessage(subId, ActivityThread.currentPackageName(),
locationUrl, contentUri, configOverrides, downloadedIntent);
} catch (RemoteException e) {
// Ignore it
}
}
}