Merge "Revert "Make MmsManager public"" am: 393af8c53c am: 685a0ab43b

Change-Id: I64d9e9a55f8124bdfe8bcd7aba8e8f74a42b0051
This commit is contained in:
Automerger Merge Worker
2020-01-10 23:01:18 +00:00
4 changed files with 25 additions and 50 deletions

View File

@@ -9848,7 +9848,6 @@ package android.content {
field public static final String MEDIA_ROUTER_SERVICE = "media_router"; field public static final String MEDIA_ROUTER_SERVICE = "media_router";
field public static final String MEDIA_SESSION_SERVICE = "media_session"; field public static final String MEDIA_SESSION_SERVICE = "media_session";
field public static final String MIDI_SERVICE = "midi"; field public static final String MIDI_SERVICE = "midi";
field public static final String MMS_SERVICE = "mms";
field public static final int MODE_APPEND = 32768; // 0x8000 field public static final int MODE_APPEND = 32768; // 0x8000
field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8 field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8
field @Deprecated public static final int MODE_MULTI_PROCESS = 4; // 0x4 field @Deprecated public static final int MODE_MULTI_PROCESS = 4; // 0x4
@@ -44906,11 +44905,6 @@ package android.telephony {
method @Nullable public android.telephony.mbms.StreamingService startStreaming(android.telephony.mbms.StreamingServiceInfo, @NonNull java.util.concurrent.Executor, android.telephony.mbms.StreamingServiceCallback); method @Nullable public android.telephony.mbms.StreamingService startStreaming(android.telephony.mbms.StreamingServiceInfo, @NonNull java.util.concurrent.Executor, android.telephony.mbms.StreamingServiceCallback);
} }
public final class MmsManager {
method public void downloadMultimediaMessage(int, @NonNull String, @NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent);
method public void sendMultimediaMessage(int, @NonNull android.net.Uri, @Nullable String, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent);
}
@Deprecated public class NeighboringCellInfo implements android.os.Parcelable { @Deprecated public class NeighboringCellInfo implements android.os.Parcelable {
ctor @Deprecated public NeighboringCellInfo(); ctor @Deprecated public NeighboringCellInfo();
ctor @Deprecated public NeighboringCellInfo(int, int); ctor @Deprecated public NeighboringCellInfo(int, int);
@@ -45146,8 +45140,8 @@ package android.telephony {
method public String createAppSpecificSmsToken(android.app.PendingIntent); method public String createAppSpecificSmsToken(android.app.PendingIntent);
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 @Deprecated 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 @NonNull 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);
@@ -45156,7 +45150,7 @@ package android.telephony {
method public int getSubscriptionId(); method public int getSubscriptionId();
method public void injectSmsPdu(byte[], String, android.app.PendingIntent); method public void injectSmsPdu(byte[], String, android.app.PendingIntent);
method public void sendDataMessage(String, String, short, byte[], android.app.PendingIntent, android.app.PendingIntent); method public void sendDataMessage(String, String, short, byte[], android.app.PendingIntent, android.app.PendingIntent);
method @Deprecated public void sendMultimediaMessage(android.content.Context, android.net.Uri, String, android.os.Bundle, android.app.PendingIntent); method public void sendMultimediaMessage(android.content.Context, android.net.Uri, String, android.os.Bundle, android.app.PendingIntent);
method public void sendMultipartTextMessage(String, String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>); method public void sendMultipartTextMessage(String, String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
method public void sendTextMessage(String, String, String, android.app.PendingIntent, android.app.PendingIntent); method public void sendTextMessage(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.SEND_SMS}) public void sendTextMessageWithoutPersisting(String, String, String, android.app.PendingIntent, android.app.PendingIntent); method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.SEND_SMS}) public void sendTextMessageWithoutPersisting(String, String, String, android.app.PendingIntent, android.app.PendingIntent);

View File

@@ -3318,7 +3318,6 @@ public abstract class Context {
TELEPHONY_SUBSCRIPTION_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE,
CARRIER_CONFIG_SERVICE, CARRIER_CONFIG_SERVICE,
EUICC_SERVICE, EUICC_SERVICE,
MMS_SERVICE,
TELECOM_SERVICE, TELECOM_SERVICE,
CLIPBOARD_SERVICE, CLIPBOARD_SERVICE,
INPUT_METHOD_SERVICE, INPUT_METHOD_SERVICE,
@@ -3514,8 +3513,6 @@ public abstract class Context {
* @see android.telephony.CarrierConfigManager * @see android.telephony.CarrierConfigManager
* @see #EUICC_SERVICE * @see #EUICC_SERVICE
* @see android.telephony.euicc.EuiccManager * @see android.telephony.euicc.EuiccManager
* @see #MMS_SERVICE
* @see android.telephony.MmsManager
* @see #INPUT_METHOD_SERVICE * @see #INPUT_METHOD_SERVICE
* @see android.view.inputmethod.InputMethodManager * @see android.view.inputmethod.InputMethodManager
* @see #UI_MODE_SERVICE * @see #UI_MODE_SERVICE
@@ -4153,15 +4150,6 @@ public abstract class Context {
@SystemApi @SystemApi
public static final String EUICC_CARD_SERVICE = "euicc_card"; public static final String EUICC_CARD_SERVICE = "euicc_card";
/**
* Use with {@link #getSystemService(String)} to retrieve a
* {@link android.telephony.MmsManager} to send/receive MMS messages.
*
* @see #getSystemService(String)
* @see android.telephony.MmsManager
*/
public static final String MMS_SERVICE = "mms";
/** /**
* Use with {@link #getSystemService(String)} to retrieve a * Use with {@link #getSystemService(String)} to retrieve a
* {@link android.content.ClipboardManager} for accessing and modifying * {@link android.content.ClipboardManager} for accessing and modifying

View File

@@ -16,11 +16,8 @@
package android.telephony; package android.telephony;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityThread; import android.app.ActivityThread;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException; import android.os.RemoteException;
@@ -30,16 +27,22 @@ import com.android.internal.telephony.IMms;
/** /**
* Manages MMS operations such as sending multimedia messages. * Manages MMS operations such as sending multimedia messages.
* Get this object by calling the static method {@link #getInstance()}.
* @hide
*/ */
public final class MmsManager { public class MmsManager {
private static final String TAG = "MmsManager"; private static final String TAG = "MmsManager";
private final Context mContext;
/** Singleton object constructed during class initialization. */
private static final MmsManager sInstance = new MmsManager();
/** /**
* @hide * Get the MmsManager singleton instance.
*
* @return the {@link MmsManager} singleton instance.
*/ */
public MmsManager(@NonNull Context context) { public static MmsManager getInstance() {
mContext = context; return sInstance;
} }
/** /**
@@ -53,9 +56,8 @@ public final class MmsManager {
* @param sentIntent if not NULL this <code>PendingIntent</code> is broadcast when the message * @param sentIntent if not NULL this <code>PendingIntent</code> is broadcast when the message
* is successfully sent, or failed * is successfully sent, or failed
*/ */
public void sendMultimediaMessage(int subId, @NonNull Uri contentUri, public void sendMultimediaMessage(int subId, Uri contentUri, String locationUrl,
@Nullable String locationUrl, @Nullable Bundle configOverrides, Bundle configOverrides, PendingIntent sentIntent) {
@Nullable PendingIntent sentIntent) {
try { try {
final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms")); final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
if (iMms == null) { if (iMms == null) {
@@ -82,9 +84,8 @@ public final class MmsManager {
* broadcast when the message is downloaded, or the download is failed * broadcast when the message is downloaded, or the download is failed
* @throws IllegalArgumentException if locationUrl or contentUri is empty * @throws IllegalArgumentException if locationUrl or contentUri is empty
*/ */
public void downloadMultimediaMessage(int subId, @NonNull String locationUrl, public void downloadMultimediaMessage(int subId, String locationUrl, Uri contentUri,
@NonNull Uri contentUri, @Nullable Bundle configOverrides, Bundle configOverrides, PendingIntent downloadedIntent) {
@Nullable PendingIntent downloadedIntent) {
try { try {
final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms")); final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
if (iMms == null) { if (iMms == null) {

View File

@@ -2348,18 +2348,14 @@ public final class SmsManager {
* @param sentIntent if not NULL this <code>PendingIntent</code> is * @param sentIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is successfully sent, or failed * broadcast when the message is successfully sent, or failed
* @throws IllegalArgumentException if contentUri is empty * @throws IllegalArgumentException if contentUri is empty
* @deprecated use {@link MmsManager#sendMultimediaMessage} instead.
*/ */
public void sendMultimediaMessage(Context context, Uri contentUri, String locationUrl, public void sendMultimediaMessage(Context context, Uri contentUri, String locationUrl,
Bundle configOverrides, PendingIntent sentIntent) { Bundle configOverrides, PendingIntent sentIntent) {
if (contentUri == null) { if (contentUri == null) {
throw new IllegalArgumentException("Uri contentUri null"); throw new IllegalArgumentException("Uri contentUri null");
} }
MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE); MmsManager.getInstance().sendMultimediaMessage(getSubscriptionId(), contentUri,
if (m != null) { locationUrl, configOverrides, sentIntent);
m.sendMultimediaMessage(getSubscriptionId(), contentUri, locationUrl, configOverrides,
sentIntent);
}
} }
/** /**
@@ -2383,7 +2379,6 @@ public final class SmsManager {
* @param downloadedIntent if not NULL this <code>PendingIntent</code> is * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
* broadcast when the message is downloaded, or the download is failed * broadcast when the message is downloaded, or the download is failed
* @throws IllegalArgumentException if locationUrl or contentUri is empty * @throws IllegalArgumentException if locationUrl or contentUri is empty
* @deprecated use {@link MmsManager#downloadMultimediaMessage} instead.
*/ */
public void downloadMultimediaMessage(Context context, String locationUrl, Uri contentUri, public void downloadMultimediaMessage(Context context, String locationUrl, Uri contentUri,
Bundle configOverrides, PendingIntent downloadedIntent) { Bundle configOverrides, PendingIntent downloadedIntent) {
@@ -2393,11 +2388,8 @@ public final class SmsManager {
if (contentUri == null) { if (contentUri == null) {
throw new IllegalArgumentException("Uri contentUri null"); throw new IllegalArgumentException("Uri contentUri null");
} }
MmsManager m = (MmsManager) context.getSystemService(Context.MMS_SERVICE); MmsManager.getInstance().downloadMultimediaMessage(getSubscriptionId(), locationUrl,
if (m != null) { contentUri, configOverrides, downloadedIntent);
m.downloadMultimediaMessage(getSubscriptionId(), locationUrl, contentUri,
configOverrides, downloadedIntent);
}
} }
// MMS send/download failure result codes // MMS send/download failure result codes
@@ -2439,9 +2431,9 @@ public final class SmsManager {
* </p> * </p>
* *
* @return the bundle key/values pairs that contains MMS configuration values * @return the bundle key/values pairs that contains MMS configuration values
* or an empty bundle if they cannot be found.
*/ */
@NonNull public Bundle getCarrierConfigValues() { @Nullable
public Bundle getCarrierConfigValues() {
try { try {
ISms iSms = getISmsService(); ISms iSms = getISmsService();
if (iSms != null) { if (iSms != null) {
@@ -2450,7 +2442,7 @@ public final class SmsManager {
} catch (RemoteException ex) { } catch (RemoteException ex) {
// ignore it // ignore it
} }
return new Bundle(); return null;
} }
/** /**