Merge "getStreamingServices for embms"
This commit is contained in:
@@ -22,7 +22,6 @@ import android.content.Intent;
|
|||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.os.DeadObjectException;
|
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.telephony.mbms.IMbmsStreamingManagerCallback;
|
import android.telephony.mbms.IMbmsStreamingManagerCallback;
|
||||||
@@ -96,15 +95,15 @@ public class MbmsStreamingManager {
|
|||||||
/**
|
/**
|
||||||
* Create a new MbmsStreamingManager using the given subscription ID.
|
* Create a new MbmsStreamingManager using the given subscription ID.
|
||||||
*
|
*
|
||||||
* Note that this call will bind a remote service and that may take a bit. This
|
* Note that this call will bind a remote service. You may not call this method on your app's
|
||||||
* may throw an {@link MbmsException}, indicating errors that may happen during
|
* main thread. This may throw an {@link MbmsException}, indicating errors that may happen
|
||||||
* the initialization or binding process.
|
* during the initialization or binding process.
|
||||||
*
|
*
|
||||||
* @param context
|
* @param context The {@link Context} to use.
|
||||||
* @param listener
|
* @param listener A callback object on which you wish to receive results of asynchronous
|
||||||
* @param streamingAppName
|
* operations.
|
||||||
* @param subscriptionId
|
* @param streamingAppName The name of the streaming app, as specified by the carrier.
|
||||||
* @return
|
* @param subscriptionId The subscription ID to use.
|
||||||
*/
|
*/
|
||||||
public static MbmsStreamingManager create(Context context,
|
public static MbmsStreamingManager create(Context context,
|
||||||
IMbmsStreamingManagerCallback listener, String streamingAppName, int subscriptionId)
|
IMbmsStreamingManagerCallback listener, String streamingAppName, int subscriptionId)
|
||||||
@@ -117,9 +116,7 @@ public class MbmsStreamingManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new MbmsStreamingManager using the system default data subscription ID.
|
* Create a new MbmsStreamingManager using the system default data subscription ID.
|
||||||
*
|
* See {@link #create(Context, IMbmsStreamingManagerCallback, String, int)}.
|
||||||
* Note that this call will bind a remote service and that may take a bit. This
|
|
||||||
* may throw an IllegalArgumentException or RemoteException.
|
|
||||||
*/
|
*/
|
||||||
public static MbmsStreamingManager create(Context context,
|
public static MbmsStreamingManager create(Context context,
|
||||||
IMbmsStreamingManagerCallback listener, String streamingAppName)
|
IMbmsStreamingManagerCallback listener, String streamingAppName)
|
||||||
@@ -156,19 +153,29 @@ public class MbmsStreamingManager {
|
|||||||
*
|
*
|
||||||
* Multiple calls replace the list of serviceClasses of interest.
|
* Multiple calls replace the list of serviceClasses of interest.
|
||||||
*
|
*
|
||||||
* May throw an IllegalArgumentException or RemoteException.
|
* This may throw an {@link MbmsException} containing one of the following errors:
|
||||||
|
* {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND}
|
||||||
|
* {@link MbmsException#ERROR_NOT_YET_INITIALIZED}
|
||||||
|
* {@link MbmsException#ERROR_CONCURRENT_SERVICE_LIMIT_REACHED}
|
||||||
*
|
*
|
||||||
* Synchronous responses include
|
* Asynchronous error codes via the {@link IMbmsStreamingManagerCallback#error(int, String)}
|
||||||
* <li>SUCCESS</li>
|
* callback can include any of the errors except:
|
||||||
* <li>ERROR_MSDC_CONCURRENT_SERVICE_LIMIT_REACHED</li>
|
* {@link MbmsException#ERROR_UNABLE_TO_START_SERVICE}
|
||||||
*
|
* {@link MbmsException#ERROR_INVALID_SERVICE_ID}
|
||||||
* Asynchronous errors through the listener include any of the errors except
|
* {@link MbmsException#ERROR_END_OF_SESSION}
|
||||||
* <li>ERROR_MSDC_UNABLE_TO_)START_SERVICE</li>
|
|
||||||
* <li>ERROR_MSDC_INVALID_SERVICE_ID</li>
|
|
||||||
* <li>ERROR_MSDC_END_OF_SESSION</li>
|
|
||||||
*/
|
*/
|
||||||
public int getStreamingServices(List<String> classList) {
|
public void getStreamingServices(List<String> classList) throws MbmsException {
|
||||||
return 0;
|
if (mService == null) {
|
||||||
|
throw new MbmsException(MbmsException.ERROR_MIDDLEWARE_NOT_BOUND);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
int returnCode = mService.getStreamingServices(mAppName, mSubscriptionId, classList);
|
||||||
|
if (returnCode != MbmsException.SUCCESS) {
|
||||||
|
throw new MbmsException(returnCode);
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -262,7 +269,7 @@ public class MbmsStreamingManager {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
mService = null;
|
mService = null;
|
||||||
Log.e(LOG_TAG, "Service died before initialization");
|
Log.e(LOG_TAG, "Service died before initialization");
|
||||||
throw new MbmsException(MbmsException.ERROR_INITIALIZATION_REMOTE_EXCEPTION);
|
throw new MbmsException(MbmsException.ERROR_UNKNOWN_REMOTE_EXCEPTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,21 @@
|
|||||||
|
|
||||||
package android.telephony.mbms;
|
package android.telephony.mbms;
|
||||||
|
|
||||||
import android.os.RemoteException;
|
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public class MbmsException extends RemoteException {
|
public class MbmsException extends Exception {
|
||||||
public static final int SUCCESS = 0;
|
public static final int SUCCESS = 0;
|
||||||
public static final int ERROR_NO_SERVICE_INSTALLED = 1;
|
public static final int ERROR_NO_SERVICE_INSTALLED = 1;
|
||||||
public static final int ERROR_MULTIPLE_SERVICES_INSTALLED = 2;
|
public static final int ERROR_MULTIPLE_SERVICES_INSTALLED = 2;
|
||||||
public static final int ERROR_BIND_TIMEOUT_OR_FAILURE = 3;
|
public static final int ERROR_BIND_TIMEOUT_OR_FAILURE = 3;
|
||||||
public static final int ERROR_INITIALIZATION_REMOTE_EXCEPTION = 4;
|
public static final int ERROR_UNKNOWN_REMOTE_EXCEPTION = 4;
|
||||||
public static final int ERROR_ALREADY_INITIALIZED = 5;
|
public static final int ERROR_ALREADY_INITIALIZED = 5;
|
||||||
|
public static final int ERROR_CONCURRENT_SERVICE_LIMIT_REACHED = 6;
|
||||||
|
public static final int ERROR_MIDDLEWARE_NOT_BOUND = 7;
|
||||||
|
public static final int ERROR_UNABLE_TO_START_SERVICE = 8;
|
||||||
|
public static final int ERROR_INVALID_SERVICE_ID = 9;
|
||||||
|
public static final int ERROR_END_OF_SESSION = 10;
|
||||||
|
public static final int ERROR_NOT_YET_INITIALIZED = 11;
|
||||||
|
public static final int ERROR_APP_PERMISSIONS_NOT_GRANTED = 12;
|
||||||
|
|
||||||
private final int mErrorCode;
|
private final int mErrorCode;
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ public class ServiceInfo implements Parcelable {
|
|||||||
sessionEndTime = (java.util.Date) in.readSerializable();
|
sessionEndTime = (java.util.Date) in.readSerializable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
Set<Locale> keySet = names.keySet();
|
Set<Locale> keySet = names.keySet();
|
||||||
dest.writeInt(keySet.size());
|
dest.writeInt(keySet.size());
|
||||||
@@ -128,7 +129,33 @@ public class ServiceInfo implements Parcelable {
|
|||||||
dest.writeSerializable(sessionEndTime);
|
dest.writeSerializable(sessionEndTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Locale, String> getNames() {
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Locale getLocale() {
|
||||||
|
return locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServiceId() {
|
||||||
|
return serviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSessionStartTime() {
|
||||||
|
return sessionStartTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSessionEndTime() {
|
||||||
|
return sessionEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,22 +29,8 @@ import android.telephony.SignalStrength;
|
|||||||
*/
|
*/
|
||||||
interface IMbmsStreamingService
|
interface IMbmsStreamingService
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Initialize streaming service
|
|
||||||
* Registers this listener, subId with this appName
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int initialize(IMbmsStreamingManagerCallback listener, String appName, int subId);
|
int initialize(IMbmsStreamingManagerCallback listener, String appName, int subId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* - Registers serviceClasses of interest with the uid/appName/subId key.
|
|
||||||
* - Starts asynch fetching data on streaming services of matching classes to be reported
|
|
||||||
* later by callback.
|
|
||||||
*
|
|
||||||
* Note that subsequent calls with the same callback, appName, subId and uid will replace
|
|
||||||
* the service class list.
|
|
||||||
*/
|
|
||||||
int getStreamingServices(String appName, int subId, in List<String> serviceClasses);
|
int getStreamingServices(String appName, int subId, in List<String> serviceClasses);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import android.net.Uri;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.telephony.mbms.IMbmsStreamingManagerCallback;
|
import android.telephony.mbms.IMbmsStreamingManagerCallback;
|
||||||
import android.telephony.mbms.IStreamingServiceCallback;
|
import android.telephony.mbms.IStreamingServiceCallback;
|
||||||
import android.telephony.mbms.StreamingService;
|
import android.telephony.mbms.MbmsException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -29,16 +29,42 @@ import java.util.List;
|
|||||||
* TODO: future systemapi
|
* TODO: future systemapi
|
||||||
*/
|
*/
|
||||||
public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
|
public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
|
||||||
|
/**
|
||||||
|
* Initialize streaming service for this app and subId, registering the listener.
|
||||||
|
*
|
||||||
|
* @param listener The callback to use to communicate with the app.
|
||||||
|
* @param appName The app name as negotiated with the wireless carrier.
|
||||||
|
* @param subscriptionId The subscription ID to use.
|
||||||
|
* @return {@link MbmsException#SUCCESS}, {@link MbmsException#ERROR_ALREADY_INITIALIZED}, or
|
||||||
|
* {@link MbmsException#ERROR_APP_PERMISSIONS_NOT_GRANTED}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int initialize(IMbmsStreamingManagerCallback listener, String appName, int subId)
|
public int initialize(IMbmsStreamingManagerCallback listener, String appName,
|
||||||
throws RemoteException {
|
int subscriptionId) throws RemoteException {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers serviceClasses of interest with the appName/subId key.
|
||||||
|
* Starts async fetching data on streaming services of matching classes to be reported
|
||||||
|
* later via {@link IMbmsStreamingManagerCallback#streamingServicesUpdated(List)}
|
||||||
|
*
|
||||||
|
* Note that subsequent calls with the same uid, appName and subId will replace
|
||||||
|
* the service class list.
|
||||||
|
*
|
||||||
|
* @param appName The app name as negotiated with the wireless carrier.
|
||||||
|
* @param subscriptionId The subscription id to use.
|
||||||
|
* @param serviceClasses The service classes that the app wishes to get info on. The strings
|
||||||
|
* may contain arbitrary data as negotiated between the app and the
|
||||||
|
* carrier.
|
||||||
|
* @return One of {@link MbmsException#SUCCESS},
|
||||||
|
* {@link MbmsException#ERROR_MIDDLEWARE_NOT_BOUND},
|
||||||
|
* {@link MbmsException#ERROR_NOT_YET_INITIALIZED}, or
|
||||||
|
* {@link MbmsException#ERROR_CONCURRENT_SERVICE_LIMIT_REACHED}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getStreamingServices(String appName, int subId, List<String> serviceClasses)
|
public int getStreamingServices(String appName, int subscriptionId,
|
||||||
throws RemoteException {
|
List<String> serviceClasses) throws RemoteException {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user