From 08a244cee8ff946233b0719540573c36249dc505 Mon Sep 17 00:00:00 2001 From: Zach Johnson Date: Fri, 19 Jun 2015 18:12:27 -0700 Subject: [PATCH] Update CarrierService long lived binding API Should take a metadata approach instead of a separate intent. b/21080696 Change-Id: Ib6e2ec0d3258e419aa14ae9e598a8147505feb84 --- api/current.txt | 3 +-- api/system-current.txt | 3 +-- .../service/carrier/CarrierService.java | 20 +++++++------------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/api/current.txt b/api/current.txt index 2058ac9369c7a..f47e4c3885a21 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28600,8 +28600,7 @@ package android.service.carrier { method public final void notifyCarrierNetworkChange(boolean); method public android.os.IBinder onBind(android.content.Intent); method public abstract android.os.PersistableBundle onLoadConfig(android.service.carrier.CarrierIdentifier); - field public static final java.lang.String BIND_SERVICE_INTERFACE = "android.service.carrier.BindService"; - field public static final java.lang.String CONFIG_SERVICE_INTERFACE = "android.service.carrier.ConfigService"; + field public static final java.lang.String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService"; } public final class MessagePdu implements android.os.Parcelable { diff --git a/api/system-current.txt b/api/system-current.txt index df18ce45c6e75..3e01cd77d0d5d 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30648,8 +30648,7 @@ package android.service.carrier { method public final void notifyCarrierNetworkChange(boolean); method public android.os.IBinder onBind(android.content.Intent); method public abstract android.os.PersistableBundle onLoadConfig(android.service.carrier.CarrierIdentifier); - field public static final java.lang.String BIND_SERVICE_INTERFACE = "android.service.carrier.BindService"; - field public static final java.lang.String CONFIG_SERVICE_INTERFACE = "android.service.carrier.ConfigService"; + field public static final java.lang.String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService"; } public final class MessagePdu implements android.os.Parcelable { diff --git a/core/java/android/service/carrier/CarrierService.java b/core/java/android/service/carrier/CarrierService.java index 225e70d5fc773..455e1b25df18e 100644 --- a/core/java/android/service/carrier/CarrierService.java +++ b/core/java/android/service/carrier/CarrierService.java @@ -29,8 +29,8 @@ import com.android.internal.telephony.ITelephonyRegistry; *

* To extend this class, you must declare the service in your manifest file to require the * {@link android.Manifest.permission#BIND_CARRIER_SERVICES} permission and include an intent - * filter with the {@link #CONFIG_SERVICE_INTERFACE} action if the service exposes carrier config - * and the {@link #BIND_SERVICE_INTERFACE} action if the service should have a long-lived binding. + * filter with the {@link #CARRIER_SERVICE_INTERFACE}. If the service should have a long-lived + * binding, set android.service.carrier.LONG_LIVED_BINDING to true in the service's metadata. * For example: *

* @@ -39,16 +39,16 @@ import com.android.internal.telephony.ITelephonyRegistry; * android:label="@string/service_name" * android:permission="android.permission.BIND_CARRIER_SERVICES"> * - * - * + * * + * * * } */ public abstract class CarrierService extends Service { - public static final String CONFIG_SERVICE_INTERFACE = "android.service.carrier.ConfigService"; - public static final String BIND_SERVICE_INTERFACE = "android.service.carrier.BindService"; + public static final String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService"; private static ITelephonyRegistry sRegistry; @@ -127,13 +127,7 @@ public abstract class CarrierService extends Service { @Override @CallSuper public IBinder onBind(Intent intent) { - switch (intent.getAction()) { - case CONFIG_SERVICE_INTERFACE: - case BIND_SERVICE_INTERFACE: - return mStubWrapper; - default: - return null; - } + return mStubWrapper; } /**