From a4a4c8aea7f7a16717eb758d17e3899911813008 Mon Sep 17 00:00:00 2001 From: Jeff Davidson Date: Thu, 15 Mar 2018 17:10:58 -0700 Subject: [PATCH] Expose remaining READ_PHONE_STATE and SEND_SMS APIs to carrier apps. Bug: 70177947 Bug: 70041899 Test: Flash / boot; TreeHugger; Unit/CTS tests in topic Change-Id: I4061becb1d7ceaa58d84e4e3568c1b6e63cfc8d1 --- telephony/java/android/telephony/SmsManager.java | 12 +++++++----- .../java/android/telephony/TelephonyManager.java | 8 +++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index 8a3f138cae1db..38bc64036de02 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -17,6 +17,7 @@ package android.telephony; import android.annotation.RequiresPermission; +import android.annotation.SuppressAutoDoc; import android.annotation.SystemApi; import android.app.ActivityThread; import android.app.PendingIntent; @@ -343,15 +344,16 @@ public final class SmsManager { * applications. Intended for internal carrier use only. *

* - *

Requires Permission: - * {@link android.Manifest.permission#SEND_SMS} and - * {@link android.Manifest.permission#MODIFY_PHONE_STATE} or the calling app has carrier - * privileges. - *

+ *

Requires Permission: Both {@link android.Manifest.permission#SEND_SMS} and + * {@link android.Manifest.permission#MODIFY_PHONE_STATE}, or that the calling app has carrier + * privileges (see {@link TelephonyManager#hasCarrierPrivileges}), or that the calling app is + * the default IMS app (see + * {@link CarrierConfigManager#KEY_CONFIG_IMS_PACKAGE_OVERRIDE_STRING}). * * @see #sendTextMessage(String, String, String, PendingIntent, PendingIntent) */ @SystemApi + @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(allOf = { android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.SEND_SMS diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 4a0027b7fd776..4296645c54b86 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1776,11 +1776,17 @@ public class TelephonyManager { * invalid subscription ID is pinned to the TelephonyManager, the returned config will contain * default values. * + *

This method may take several seconds to complete, so it should only be called from a + * worker thread. + * + *

Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} + * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). + * * @see CarrierConfigManager#getConfigForSubId(int) * @see #createForSubscriptionId(int) * @see #createForPhoneAccountHandle(PhoneAccountHandle) */ - // TODO(b/73136824, b/70041899): Permit carrier-privileged callers as well. + @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public PersistableBundle getCarrierConfig() {