summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hall Liu <hallliu@google.com> 2021-01-15 01:30:30 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-01-15 01:30:30 +0000
commit09bc345bf1e9a31b6f98ba0fc8a7f8de8d7cbf1b (patch)
tree1809e153f001c2f917f4d172d92adbc4a051cb1f
parent0caface09a39b6926ca6aa4f95aabe83e3b8f73d (diff)
parent2a9bf57176e9818badf4e7d0b521c4c6fe4120e3 (diff)
Merge "Add content type to the picture upload method"
-rw-r--r--core/api/current.txt5
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java28
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl2
3 files changed, 26 insertions, 9 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 9a3d2d90dcf6..8a522d14da9f 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -41859,8 +41859,8 @@ package android.telephony {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void switchMultiSimConfig(int);
method public void unregisterPhoneStateListener(@NonNull android.telephony.PhoneStateListener);
method public void updateAvailableNetworks(@NonNull java.util.List<android.telephony.AvailableNetworkInfo>, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
- method public void uploadCallComposerPicture(@NonNull java.nio.file.Path, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.ParcelUuid,android.telephony.TelephonyManager.CallComposerException>);
- method public void uploadCallComposerPicture(@NonNull java.io.InputStream, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.ParcelUuid,android.telephony.TelephonyManager.CallComposerException>);
+ method public void uploadCallComposerPicture(@NonNull java.nio.file.Path, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.ParcelUuid,android.telephony.TelephonyManager.CallComposerException>);
+ method public void uploadCallComposerPicture(@NonNull java.io.InputStream, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.ParcelUuid,android.telephony.TelephonyManager.CallComposerException>);
field public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE = "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
field public static final String ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE = "android.telephony.action.CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE";
field public static final String ACTION_CARRIER_SIGNAL_PCO_VALUE = "android.telephony.action.CARRIER_SIGNAL_PCO_VALUE";
@@ -42011,6 +42011,7 @@ package android.telephony {
field public static final int ERROR_FILE_TOO_LARGE = 2; // 0x2
field public static final int ERROR_INPUT_CLOSED = 4; // 0x4
field public static final int ERROR_IO_EXCEPTION = 5; // 0x5
+ field public static final int ERROR_NETWORK_UNAVAILABLE = 6; // 0x6
field public static final int ERROR_REMOTE_END_CLOSED = 1; // 0x1
field public static final int ERROR_UNKNOWN = 0; // 0x0
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index bfd37cd60806..27025759a317 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -564,9 +564,10 @@ public class TelephonyManager {
/**
* Indicates the maximum size of the call composure picture.
*
- * Pictures sent via {@link #uploadCallComposerPicture(InputStream, Executor, OutcomeReceiver)}
- * or {@link #uploadCallComposerPicture(Path, Executor, OutcomeReceiver)} must not exceed this
- * size, or an error will be returned via the callback in those methods.
+ * Pictures sent via
+ * {@link #uploadCallComposerPicture(InputStream, String, Executor, OutcomeReceiver)}
+ * or {@link #uploadCallComposerPicture(Path, String, Executor, OutcomeReceiver)} must not
+ * exceed this size, or an error will be returned via the callback in those methods.
*
* @return Maximum file size in bytes.
*/
@@ -4310,6 +4311,15 @@ public class TelephonyManager {
*/
public static final int ERROR_IO_EXCEPTION = 5;
+ /**
+ * Indicates that the device is currently not connected to a network that's capable of
+ * reaching a carrier's RCS servers.
+ *
+ * Clients should prompt the user to remedy the issue by moving to an area with better
+ * signal, by connecting to a different network, or to retry at another time.
+ */
+ public static final int ERROR_NETWORK_UNAVAILABLE = 6;
+
/** @hide */
@IntDef(prefix = {"ERROR_"}, value = {
ERROR_UNKNOWN,
@@ -4318,7 +4328,9 @@ public class TelephonyManager {
ERROR_AUTHENTICATION_FAILED,
ERROR_INPUT_CLOSED,
ERROR_IO_EXCEPTION,
+ ERROR_NETWORK_UNAVAILABLE,
})
+
@Retention(RetentionPolicy.SOURCE)
public @interface CallComposerError {}
@@ -4355,14 +4367,16 @@ public class TelephonyManager {
/**
* Uploads a picture to the carrier network for use with call composer.
*
- * @see #uploadCallComposerPicture(InputStream, Executor, OutcomeReceiver)
+ * @see #uploadCallComposerPicture(InputStream, String, Executor, OutcomeReceiver)
* @param pictureToUpload Path to a local file containing the picture to upload.
+ * @param contentType The MIME type of the picture you're uploading (e.g. image/jpeg)
* @param executor The {@link Executor} on which the {@code pictureToUpload} file will be read
* from disk, as well as on which {@code callback} will be called.
* @param callback A callback called when the upload operation terminates, either in success
* or in error.
*/
public void uploadCallComposerPicture(@NonNull Path pictureToUpload,
+ @NonNull String contentType,
@CallbackExecutor @NonNull Executor executor,
@NonNull OutcomeReceiver<ParcelUuid, CallComposerException> callback) {
Objects.requireNonNull(pictureToUpload);
@@ -4390,7 +4404,7 @@ public class TelephonyManager {
}
InputStream fileStream = Files.newInputStream(pictureToUpload);
try {
- uploadCallComposerPicture(fileStream, executor,
+ uploadCallComposerPicture(fileStream, contentType, executor,
new OutcomeReceiver<ParcelUuid, CallComposerException>() {
@Override
public void onResult(ParcelUuid result) {
@@ -4455,12 +4469,14 @@ public class TelephonyManager {
* of {@link #getMaximumCallComposerPictureSize()}, the upload will be
* aborted and the callback will be called with an exception containing
* {@link CallComposerException#ERROR_FILE_TOO_LARGE}.
+ * @param contentType The MIME type of the picture you're uploading (e.g. image/jpeg)
* @param executor The {@link Executor} on which the {@code pictureToUpload} stream will be
* read, as well as on which the callback will be called.
* @param callback A callback called when the upload operation terminates, either in success
* or in error.
*/
public void uploadCallComposerPicture(@NonNull InputStream pictureToUpload,
+ @NonNull String contentType,
@CallbackExecutor @NonNull Executor executor,
@NonNull OutcomeReceiver<ParcelUuid, CallComposerException> callback) {
Objects.requireNonNull(pictureToUpload);
@@ -4488,7 +4504,7 @@ public class TelephonyManager {
try {
telephony.uploadCallComposerPicture(getSubId(), mContext.getOpPackageName(),
- readFd, new ResultReceiver(null) {
+ contentType, readFd, new ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle result) {
if (resultCode != CallComposerException.SUCCESS) {
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index 83fb38be820d..46c9dde6023e 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1262,7 +1262,7 @@ interface ITelephony {
int getRadioAccessFamily(in int phoneId, String callingPackage);
void uploadCallComposerPicture(int subscriptionId, String callingPackage,
- in ParcelFileDescriptor fd, in ResultReceiver callback);
+ String contentType, in ParcelFileDescriptor fd, in ResultReceiver callback);
/**
* Enables or disables video calling.