Merge "EMBMS - Add TestApi and provide service override"
am: 1fab41e771
Change-Id: I5c44393e98c432b3c7a28c7b5b1906aa80f62372
This commit is contained in:
@@ -40042,6 +40042,7 @@ package android.telephony {
|
||||
field public static final java.lang.String EXTRA_MBMS_DOWNLOAD_REQUEST = "android.telephony.extra.MBMS_DOWNLOAD_REQUEST";
|
||||
field public static final java.lang.String EXTRA_MBMS_DOWNLOAD_RESULT = "android.telephony.extra.MBMS_DOWNLOAD_RESULT";
|
||||
field public static final java.lang.String EXTRA_MBMS_FILE_INFO = "android.telephony.extra.MBMS_FILE_INFO";
|
||||
field public static final java.lang.String MBMS_DOWNLOAD_SERVICE_OVERRIDE_METADATA = "mbms-download-service-override";
|
||||
field public static final int RESULT_CANCELLED = 2; // 0x2
|
||||
field public static final int RESULT_DOWNLOAD_FAILURE = 6; // 0x6
|
||||
field public static final int RESULT_EXPIRED = 3; // 0x3
|
||||
@@ -40063,6 +40064,7 @@ package android.telephony {
|
||||
method public static android.telephony.MbmsStreamingSession create(android.content.Context, android.telephony.mbms.MbmsStreamingSessionCallback, android.os.Handler);
|
||||
method public void requestUpdateStreamingServices(java.util.List<java.lang.String>);
|
||||
method public android.telephony.mbms.StreamingService startStreaming(android.telephony.mbms.StreamingServiceInfo, android.telephony.mbms.StreamingServiceCallback, android.os.Handler);
|
||||
field public static final java.lang.String MBMS_STREAMING_SERVICE_OVERRIDE_METADATA = "mbms-streaming-service-override";
|
||||
}
|
||||
|
||||
public class NeighboringCellInfo implements android.os.Parcelable {
|
||||
@@ -40838,6 +40840,7 @@ package android.telephony.mbms {
|
||||
}
|
||||
|
||||
public final class StreamingServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
|
||||
ctor public StreamingServiceInfo(java.util.Map<java.util.Locale, java.lang.String>, java.lang.String, java.util.List<java.util.Locale>, java.lang.String, java.util.Date, java.util.Date);
|
||||
method public int describeContents();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.telephony.mbms.StreamingServiceInfo> CREATOR;
|
||||
@@ -40845,6 +40848,21 @@ package android.telephony.mbms {
|
||||
|
||||
}
|
||||
|
||||
package android.telephony.mbms.vendor {
|
||||
|
||||
public class MbmsStreamingServiceBase extends android.os.Binder {
|
||||
ctor public MbmsStreamingServiceBase();
|
||||
method public void dispose(int) throws android.os.RemoteException;
|
||||
method public android.net.Uri getPlaybackUri(int, java.lang.String) throws android.os.RemoteException;
|
||||
method public int initialize(android.telephony.mbms.MbmsStreamingSessionCallback, int) throws android.os.RemoteException;
|
||||
method public void onAppCallbackDied(int, int);
|
||||
method public int requestUpdateStreamingServices(int, java.util.List<java.lang.String>) throws android.os.RemoteException;
|
||||
method public int startStreaming(int, java.lang.String, android.telephony.mbms.StreamingServiceCallback) throws android.os.RemoteException;
|
||||
method public void stopStreaming(int, java.lang.String) throws android.os.RemoteException;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package android.test {
|
||||
|
||||
public abstract deprecated class ActivityInstrumentationTestCase<T extends android.app.Activity> extends android.test.ActivityTestCase {
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SdkConstant;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -73,6 +74,14 @@ public class MbmsDownloadSession implements AutoCloseable {
|
||||
public static final String MBMS_DOWNLOAD_SERVICE_ACTION =
|
||||
"android.telephony.action.EmbmsDownload";
|
||||
|
||||
/**
|
||||
* Metadata key that specifies the component name of the service to bind to for file-download.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public static final String MBMS_DOWNLOAD_SERVICE_OVERRIDE_METADATA =
|
||||
"mbms-download-service-override";
|
||||
|
||||
/**
|
||||
* Integer extra that Android will attach to the intent supplied via
|
||||
* {@link android.telephony.mbms.DownloadRequest.Builder#setAppIntent(Intent)}
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SdkConstant;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.ServiceConnection;
|
||||
@@ -62,6 +63,14 @@ public class MbmsStreamingSession implements AutoCloseable {
|
||||
public static final String MBMS_STREAMING_SERVICE_ACTION =
|
||||
"android.telephony.action.EmbmsStreaming";
|
||||
|
||||
/**
|
||||
* Metadata key that specifies the component name of the service to bind to for file-download.
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public static final String MBMS_STREAMING_SERVICE_OVERRIDE_METADATA =
|
||||
"mbms-streaming-service-override";
|
||||
|
||||
private static AtomicBoolean sIsInitialized = new AtomicBoolean(false);
|
||||
|
||||
private AtomicReference<IMbmsStreamingService> mService = new AtomicReference<>(null);
|
||||
|
||||
@@ -22,6 +22,8 @@ import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.*;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.telephony.MbmsDownloadSession;
|
||||
import android.telephony.MbmsStreamingSession;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
@@ -48,24 +50,64 @@ public class MbmsUtils {
|
||||
return new ComponentName(ci.packageName, ci.name);
|
||||
}
|
||||
|
||||
private static ComponentName getOverrideServiceName(Context context, String serviceAction) {
|
||||
String metaDataKey = null;
|
||||
switch (serviceAction) {
|
||||
case MbmsDownloadSession.MBMS_DOWNLOAD_SERVICE_ACTION:
|
||||
metaDataKey = MbmsDownloadSession.MBMS_DOWNLOAD_SERVICE_OVERRIDE_METADATA;
|
||||
break;
|
||||
case MbmsStreamingSession.MBMS_STREAMING_SERVICE_ACTION:
|
||||
metaDataKey = MbmsStreamingSession.MBMS_STREAMING_SERVICE_OVERRIDE_METADATA;
|
||||
break;
|
||||
}
|
||||
if (metaDataKey == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ApplicationInfo appInfo;
|
||||
try {
|
||||
appInfo = context.getPackageManager()
|
||||
.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
if (appInfo.metaData == null) {
|
||||
return null;
|
||||
}
|
||||
String serviceComponent = appInfo.metaData.getString(metaDataKey);
|
||||
if (serviceComponent == null) {
|
||||
return null;
|
||||
}
|
||||
return ComponentName.unflattenFromString(serviceComponent);
|
||||
}
|
||||
|
||||
public static ServiceInfo getMiddlewareServiceInfo(Context context, String serviceAction) {
|
||||
// Query for the proper service
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
Intent queryIntent = new Intent();
|
||||
queryIntent.setAction(serviceAction);
|
||||
List<ResolveInfo> downloadServices = packageManager.queryIntentServices(queryIntent,
|
||||
PackageManager.MATCH_SYSTEM_ONLY);
|
||||
|
||||
if (downloadServices == null || downloadServices.size() == 0) {
|
||||
Log.w(LOG_TAG, "No download services found, cannot get service info");
|
||||
ComponentName overrideService = getOverrideServiceName(context, serviceAction);
|
||||
List<ResolveInfo> services;
|
||||
if (overrideService == null) {
|
||||
services = packageManager.queryIntentServices(queryIntent,
|
||||
PackageManager.MATCH_SYSTEM_ONLY);
|
||||
} else {
|
||||
queryIntent.setComponent(overrideService);
|
||||
services = packageManager.queryIntentServices(queryIntent,
|
||||
PackageManager.MATCH_ALL);
|
||||
}
|
||||
|
||||
if (services == null || services.size() == 0) {
|
||||
Log.w(LOG_TAG, "No MBMS services found, cannot get service info");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (downloadServices.size() > 1) {
|
||||
Log.w(LOG_TAG, "More than one download service found, cannot get unique service");
|
||||
if (services.size() > 1) {
|
||||
Log.w(LOG_TAG, "More than one MBMS service found, cannot get unique service");
|
||||
return null;
|
||||
}
|
||||
return downloadServices.get(0).serviceInfo;
|
||||
return services.get(0).serviceInfo;
|
||||
}
|
||||
|
||||
public static int startBinding(Context context, String serviceAction,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.telephony.mbms;
|
||||
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -41,6 +42,7 @@ public final class StreamingServiceInfo extends ServiceInfo implements Parcelabl
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public StreamingServiceInfo(Map<Locale, String> names, String className,
|
||||
List<Locale> locales, String serviceId, Date start, Date end) {
|
||||
super(names, className, locales, serviceId, start, end);
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.telephony.mbms.vendor;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
@@ -38,6 +39,7 @@ import java.util.List;
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@TestApi
|
||||
public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
|
||||
/**
|
||||
* Initialize streaming service for this app and subId, registering the listener.
|
||||
|
||||
Reference in New Issue
Block a user