Rename SmsAppService to CarrierMessagingClientService

Also rename the permission and the intent action.

Change-Id: I366a136556a42db1eb657dfb8e797ec22b67a5ba
Fix: 123661399
Test: atest CtsAppBindingHostTestCases
This commit is contained in:
Makoto Onuki
2019-02-01 16:04:16 -08:00
parent 6f6ab37890
commit 05d64cbc41
8 changed files with 47 additions and 42 deletions

View File

@@ -77,7 +77,6 @@ java_defaults {
"core/java/android/app/ISearchManager.aidl",
"core/java/android/app/ISearchManagerCallback.aidl",
"core/java/android/app/IServiceConnection.aidl",
"core/java/android/app/ISmsAppService.aidl",
"core/java/android/app/IStopUserCallback.aidl",
"core/java/android/app/job/IJobCallback.aidl",
"core/java/android/app/job/IJobScheduler.aidl",
@@ -289,6 +288,7 @@ java_defaults {
"core/java/android/service/carrier/ICarrierService.aidl",
"core/java/android/service/carrier/ICarrierMessagingCallback.aidl",
"core/java/android/service/carrier/ICarrierMessagingService.aidl",
"core/java/android/service/carrier/ICarrierMessagingClientService.aidl",
"core/java/android/service/contentsuggestions/IContentSuggestionsService.aidl",
"core/java/android/service/euicc/IDeleteSubscriptionCallback.aidl",
"core/java/android/service/euicc/IDownloadSubscriptionCallback.aidl",

View File

@@ -26,6 +26,7 @@ package android {
field public static final String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
field public static final String BIND_AUTOFILL_SERVICE = "android.permission.BIND_AUTOFILL_SERVICE";
field public static final String BIND_CALL_REDIRECTION_SERVICE = "android.permission.BIND_CALL_REDIRECTION_SERVICE";
field public static final String BIND_CARRIER_MESSAGING_CLIENT_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE";
field @Deprecated public static final String BIND_CARRIER_MESSAGING_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_SERVICE";
field public static final String BIND_CARRIER_SERVICES = "android.permission.BIND_CARRIER_SERVICES";
field public static final String BIND_CHOOSER_TARGET_SERVICE = "android.permission.BIND_CHOOSER_TARGET_SERVICE";
@@ -41,7 +42,6 @@ package android {
field public static final String BIND_QUICK_SETTINGS_TILE = "android.permission.BIND_QUICK_SETTINGS_TILE";
field public static final String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS";
field public static final String BIND_SCREENING_SERVICE = "android.permission.BIND_SCREENING_SERVICE";
field public static final String BIND_SMS_APP_SERVICE = "android.permission.BIND_SMS_APP_SERVICE";
field public static final String BIND_TELECOM_CONNECTION_SERVICE = "android.permission.BIND_TELECOM_CONNECTION_SERVICE";
field public static final String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE";
field public static final String BIND_TV_INPUT = "android.permission.BIND_TV_INPUT";
@@ -6208,11 +6208,6 @@ package android.app {
method public void onSharedElementsReady();
}
public class SmsAppService extends android.app.Service {
ctor public SmsAppService();
method public final android.os.IBinder onBind(android.content.Intent);
}
public class StatusBarManager {
}
@@ -41291,6 +41286,11 @@ package android.service.carrier {
field public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR;
}
public class CarrierMessagingClientService extends android.app.Service {
ctor public CarrierMessagingClientService();
method public final android.os.IBinder onBind(android.content.Intent);
}
public abstract class CarrierMessagingService extends android.app.Service {
ctor public CarrierMessagingService();
method @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent);
@@ -45093,13 +45093,13 @@ package android.telephony {
method @Deprecated public void setVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void switchMultiSimConfig(int);
method public boolean updateAvailableNetworks(java.util.List<android.telephony.AvailableNetworkInfo>);
field public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE = "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
field public static final String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL";
field public static final String ACTION_NETWORK_COUNTRY_CHANGED = "android.telephony.action.NETWORK_COUNTRY_CHANGED";
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE";
field public static final String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
field public static final String ACTION_SECRET_CODE = "android.telephony.action.SECRET_CODE";
field public static final String ACTION_SHOW_VOICEMAIL_NOTIFICATION = "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION";
field public static final String ACTION_SMS_APP_SERVICE = "android.telephony.action.SMS_APP_SERVICE";
field public static final String ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED";
field public static final String ACTION_SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_PRECISE_CARRIER_IDENTITY_CHANGED";
field public static final int APPTYPE_CSIM = 4; // 0x4

View File

@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.app;
package android.service.carrier;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.os.IBinder;
@@ -24,10 +25,11 @@ import android.os.IBinder;
* it so that the process is always running, which allows the app to have a persistent connection
* to the server.
*
* <p>The service must have an {@link android.telephony.TelephonyManager#ACTION_SMS_APP_SERVICE}
* <p>The service must have an
* {@link android.telephony.TelephonyManager#ACTION_CARRIER_MESSAGING_CLIENT_SERVICE}
* action in the intent handler, and be protected with
* {@link android.Manifest.permission#BIND_SMS_APP_SERVICE}. However the service does not have to
* be exported.
* {@link android.Manifest.permission#BIND_CARRIER_MESSAGING_CLIENT_SERVICE}.
* However the service does not have to be exported.
*
* <p>The service must be associated with a non-main process, meaning it must have an
* {@code android:process} tag in its manifest entry.
@@ -45,27 +47,27 @@ import android.os.IBinder;
*
* <p>Example: First, define a subclass in the application:
* <pre>
* public class MySmsAppService extends SmsAppService {
* public class MyCarrierMessagingClientService extends CarrierMessagingClientService {
* }
* </pre>
* Then, declare it in its {@code AndroidManifest.xml}:
* <pre>
* &lt;service
* android:name=".MySmsAppService"
* android:name=".MyCarrierMessagingClientService"
* android:exported="false"
* android:process=":persistent"
* android:permission="android.permission.BIND_SMS_APP_SERVICE"&gt;
* android:permission="android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE"&gt;
* &lt;intent-filter&gt;
* &lt;action android:name="android.telephony.action.SMS_APP_SERVICE" /&gt;
* &lt;action android:name="android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE" /&gt;
* &lt;/intent-filter&gt;
* &lt;/service&gt;
* </pre>
*/
public class SmsAppService extends Service {
private final ISmsAppService mImpl;
public class CarrierMessagingClientService extends Service {
private final ICarrierMessagingClientServiceImpl mImpl;
public SmsAppService() {
mImpl = new ISmsAppServiceImpl();
public CarrierMessagingClientService() {
mImpl = new ICarrierMessagingClientServiceImpl();
}
@Override
@@ -73,6 +75,6 @@ public class SmsAppService extends Service {
return mImpl.asBinder();
}
private class ISmsAppServiceImpl extends ISmsAppService.Stub {
private class ICarrierMessagingClientServiceImpl extends ICarrierMessagingClientService.Stub {
}
}

View File

@@ -14,10 +14,10 @@
* limitations under the License.
*/
package android.app;
package android.service.carrier;
/**
* @hide
*/
interface ISmsAppService {
interface ICarrierMessagingClientService {
}

View File

@@ -4410,8 +4410,8 @@
<permission android:name="android.permission.MONITOR_DEFAULT_SMS_PACKAGE"
android:protectionLevel="signature" />
<!-- A subclass of {@link android.app.SmsAppService} must be protected with this permission. -->
<permission android:name="android.permission.BIND_SMS_APP_SERVICE"
<!-- A subclass of {@link android.service.carrier.CarrierMessagingClientService} must be protected with this permission. -->
<permission android:name="android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE"
android:protectionLevel="signature" />
<!-- @hide Permission that allows configuring appops.

View File

@@ -47,7 +47,7 @@ import com.android.internal.util.DumpUtils;
import com.android.server.SystemService;
import com.android.server.am.PersistentConnection;
import com.android.server.appbinding.finders.AppServiceFinder;
import com.android.server.appbinding.finders.SmsAppServiceFinder;
import com.android.server.appbinding.finders.CarrierMessagingClientServiceFinder;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -147,7 +147,7 @@ public class AppBindingService extends Binder {
mIPackageManager = injector.getIPackageManager();
mHandler = BackgroundThread.getHandler();
mApps.add(new SmsAppServiceFinder(context, this::onAppChanged, mHandler));
mApps.add(new CarrierMessagingClientServiceFinder(context, this::onAppChanged, mHandler));
// Initialize with the default value to make it non-null.
mConstants = AppBindingConstants.initializeFromString("");

View File

@@ -19,8 +19,6 @@ package com.android.server.appbinding.finders;
import static android.provider.Telephony.Sms.Intents.ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL;
import android.Manifest.permission;
import android.app.ISmsAppService;
import android.app.SmsAppService;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -30,6 +28,8 @@ import android.content.pm.ServiceInfo;
import android.os.Handler;
import android.os.IBinder;
import android.os.UserHandle;
import android.service.carrier.CarrierMessagingClientService;
import android.service.carrier.ICarrierMessagingClientService;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Slog;
@@ -41,10 +41,11 @@ import com.android.server.appbinding.AppBindingConstants;
import java.util.function.BiConsumer;
/**
* Find the SmsAppService service within the default SMS app.
* Find the CarrierMessagingClientService service within the default SMS app.
*/
public class SmsAppServiceFinder extends AppServiceFinder<SmsAppService, ISmsAppService> {
public SmsAppServiceFinder(Context context,
public class CarrierMessagingClientServiceFinder
extends AppServiceFinder<CarrierMessagingClientService, ICarrierMessagingClientService> {
public CarrierMessagingClientServiceFinder(Context context,
BiConsumer<AppServiceFinder, Integer> listener,
Handler callbackHandler) {
super(context, listener, callbackHandler);
@@ -62,23 +63,23 @@ public class SmsAppServiceFinder extends AppServiceFinder<SmsAppService, ISmsApp
}
@Override
protected Class<SmsAppService> getServiceClass() {
return SmsAppService.class;
protected Class<CarrierMessagingClientService> getServiceClass() {
return CarrierMessagingClientService.class;
}
@Override
public ISmsAppService asInterface(IBinder obj) {
return ISmsAppService.Stub.asInterface(obj);
public ICarrierMessagingClientService asInterface(IBinder obj) {
return ICarrierMessagingClientService.Stub.asInterface(obj);
}
@Override
protected String getServiceAction() {
return TelephonyManager.ACTION_SMS_APP_SERVICE;
return TelephonyManager.ACTION_CARRIER_MESSAGING_CLIENT_SERVICE;
}
@Override
protected String getServicePermission() {
return permission.BIND_SMS_APP_SERVICE;
return permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE;
}
@Override
@@ -121,7 +122,7 @@ public class SmsAppServiceFinder extends AppServiceFinder<SmsAppService, ISmsApp
@Override
public void onReceive(Context context, Intent intent) {
if (ACTION_DEFAULT_SMS_PACKAGE_CHANGED_INTERNAL.equals(intent.getAction())) {
mListener.accept(SmsAppServiceFinder.this, getSendingUserId());
mListener.accept(CarrierMessagingClientServiceFinder.this, getSendingUserId());
}
}
};

View File

@@ -1327,13 +1327,15 @@ public class TelephonyManager {
"android.intent.action.DATA_STALL_DETECTED";
/**
* A service action that identifies a {@link android.app.SmsAppService} subclass in the
* A service action that identifies
* a {@link android.service.carrier.CarrierMessagingClientService} subclass in the
* AndroidManifest.xml.
*
* <p>See {@link android.app.SmsAppService} for the details.
* <p>See {@link android.service.carrier.CarrierMessagingClientService} for the details.
*/
@SdkConstant(SdkConstantType.SERVICE_ACTION)
public static final String ACTION_SMS_APP_SERVICE = "android.telephony.action.SMS_APP_SERVICE";
public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE =
"android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
/**
* An int extra used with {@link #ACTION_DATA_STALL_DETECTED} to indicate the