Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c81cba4e authored by Hall Liu's avatar Hall Liu
Browse files

Make MBMS group call API changes

Change the API to respond to API council comments
See bug for details

Bug: 117145859
Test: CTS
Change-Id: I4342e6e95da57fbcd550c571357ff7bc1923b70a
parent c02d53b0
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -42453,9 +42453,9 @@ package android.telephony {
  public class MbmsGroupCallSession implements java.lang.AutoCloseable {
    method public void close();
    method public static android.telephony.MbmsGroupCallSession create(android.content.Context, java.util.concurrent.Executor, int, android.telephony.mbms.MbmsGroupCallSessionCallback);
    method public static android.telephony.MbmsGroupCallSession create(android.content.Context, int, java.util.concurrent.Executor, android.telephony.mbms.MbmsGroupCallSessionCallback);
    method public static android.telephony.MbmsGroupCallSession create(android.content.Context, java.util.concurrent.Executor, android.telephony.mbms.MbmsGroupCallSessionCallback);
    method public android.telephony.mbms.GroupCall startGroupCall(java.util.concurrent.Executor, long, int[], int[], android.telephony.mbms.GroupCallCallback);
    method public android.telephony.mbms.GroupCall startGroupCall(long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, java.util.concurrent.Executor, android.telephony.mbms.GroupCallCallback);
  }
  public class MbmsStreamingSession implements java.lang.AutoCloseable {
@@ -43447,7 +43447,7 @@ package android.telephony.mbms {
  public class GroupCall implements java.lang.AutoCloseable {
    method public void close();
    method public long getTmgi();
    method public void updateGroupCall(int[], int[]);
    method public void updateGroupCall(java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
    field public static final int REASON_BY_USER_REQUEST = 1; // 0x1
    field public static final int REASON_FREQUENCY_CONFLICT = 3; // 0x3
    field public static final int REASON_LEFT_MBMS_BROADCAST_AREA = 6; // 0x6
@@ -43459,11 +43459,10 @@ package android.telephony.mbms {
    field public static final int STATE_STOPPED = 1; // 0x1
  }
  public class GroupCallCallback {
    ctor public GroupCallCallback();
    method public void onBroadcastSignalStrengthUpdated(int);
    method public void onError(int, java.lang.String);
    method public void onGroupCallStateChanged(int, int);
  public abstract interface GroupCallCallback {
    method public abstract void onBroadcastSignalStrengthUpdated(int);
    method public abstract void onError(int, java.lang.String);
    method public abstract void onGroupCallStateChanged(int, int);
    field public static final int SIGNAL_STRENGTH_UNAVAILABLE = -1; // 0xffffffff
  }
@@ -43503,6 +43502,11 @@ package android.telephony.mbms {
    field public static final int ERROR_UNABLE_TO_READ_SIM = 206; // 0xce
  }
  public static class MbmsErrors.GroupCallErrors {
    field public static final int ERROR_DUPLICATE_START_GROUP_CALL = 502; // 0x1f6
    field public static final int ERROR_UNABLE_TO_START_SERVICE = 501; // 0x1f5
  }
  public static class MbmsErrors.InitializationErrors {
    field public static final int ERROR_APP_PERMISSIONS_NOT_GRANTED = 102; // 0x66
    field public static final int ERROR_DUPLICATE_INITIALIZE = 101; // 0x65
@@ -43515,12 +43519,11 @@ package android.telephony.mbms {
    field public static final int ERROR_UNABLE_TO_START_SERVICE = 302; // 0x12e
  }
  public class MbmsGroupCallSessionCallback {
    ctor public MbmsGroupCallSessionCallback();
    method public void onAvailableSaisUpdated(java.util.List<java.lang.Integer>, java.util.List<java.util.List<java.lang.Integer>>);
    method public void onError(int, java.lang.String);
    method public void onMiddlewareReady();
    method public void onServiceInterfaceAvailable(java.lang.String, int);
  public abstract interface MbmsGroupCallSessionCallback {
    method public abstract void onAvailableSaisUpdated(java.util.List<java.lang.Integer>, java.util.List<java.util.List<java.lang.Integer>>);
    method public abstract void onError(int, java.lang.String);
    method public abstract void onMiddlewareReady();
    method public abstract void onServiceInterfaceAvailable(java.lang.String, int);
  }
  public class MbmsStreamingSessionCallback {
+2 −2
Original line number Diff line number Diff line
@@ -6549,9 +6549,9 @@ package android.telephony.mbms.vendor {
    method public int initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
    method public void onAppCallbackDied(int, int);
    method public android.os.IBinder onBind(android.content.Intent);
    method public int startGroupCall(int, long, int[], int[], android.telephony.mbms.GroupCallCallback);
    method public int startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback);
    method public void stopGroupCall(int, long);
    method public void updateGroupCall(int, long, int[], int[]);
    method public void updateGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
  }

  public class MbmsStreamingServiceBase extends android.os.Binder {
+2 −2
Original line number Diff line number Diff line
@@ -1050,9 +1050,9 @@ package android.telephony.mbms.vendor {
    method public int initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
    method public void onAppCallbackDied(int, int);
    method public android.os.IBinder onBind(android.content.Intent);
    method public int startGroupCall(int, long, int[], int[], android.telephony.mbms.GroupCallCallback);
    method public int startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback);
    method public void stopGroupCall(int, long);
    method public void updateGroupCall(int, long, int[], int[]);
    method public void updateGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
  }

  public class MbmsStreamingServiceBase extends android.os.Binder {
+13 −11
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.telephony.mbms.vendor.IMbmsGroupCallService;
import android.util.ArraySet;
import android.util.Log;

import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -107,14 +108,14 @@ public class MbmsGroupCallSession implements AutoCloseable {
     * {@link MbmsGroupCallSession} that you received before calling this method again.
     *
     * @param context The {@link Context} to use.
     * @param executor The executor on which you wish to execute callbacks.
     * @param subscriptionId The subscription ID to use.
     * @param executor The executor on which you wish to execute callbacks.
     * @param callback A callback object on which you wish to receive results of asynchronous
     *                 operations.
     * @return An instance of {@link MbmsGroupCallSession}, or null if an error occurred.
     */
    public static @Nullable MbmsGroupCallSession create(@NonNull Context context,
            @NonNull Executor executor, int subscriptionId,
            int subscriptionId, @NonNull Executor executor,
            final @NonNull MbmsGroupCallSessionCallback callback) {
        if (!sIsInitialized.compareAndSet(false, true)) {
            throw new IllegalStateException("Cannot create two instances of MbmsGroupCallSession");
@@ -138,11 +139,11 @@ public class MbmsGroupCallSession implements AutoCloseable {

    /**
     * Create a new {@link MbmsGroupCallSession} using the system default data subscription ID.
     * See {@link #create(Context, Executor, int, MbmsGroupCallSessionCallback)}.
     * See {@link #create(Context, int, Executor, MbmsGroupCallSessionCallback)}.
     */
    public static MbmsGroupCallSession create(@NonNull Context context,
            @NonNull Executor executor, @NonNull MbmsGroupCallSessionCallback callback) {
        return create(context, executor, SubscriptionManager.getDefaultSubscriptionId(), callback);
        return create(context, SubscriptionManager.getDefaultSubscriptionId(), executor, callback);
    }

    /**
@@ -153,7 +154,7 @@ public class MbmsGroupCallSession implements AutoCloseable {
     * instance of {@link MbmsGroupCallSessionCallback}, but callbacks that have already been
     * enqueued will still be delivered.
     *
     * It is safe to call {@link #create(Context, Executor, int, MbmsGroupCallSessionCallback)} to
     * It is safe to call {@link #create(Context, int, Executor, MbmsGroupCallSessionCallback)} to
     * obtain another instance of {@link MbmsGroupCallSession} immediately after this method
     * returns.
     *
@@ -189,18 +190,19 @@ public class MbmsGroupCallSession implements AutoCloseable {
     * Asynchronous errors through the callback include any of the errors in
     * {@link MbmsErrors.GeneralErrors}.
     *
     * @param executor The executor on which you wish to execute callbacks for this stream.
     * @param tmgi The TMGI, an identifier for the group call you want to join.
     * @param saiArray An array of SAIs for the group call that should be negotiated separately with
     * @param saiList A list of SAIs for the group call that should be negotiated separately with
     *                the carrier.
     * @param frequencyArray An array of frequencies for the group call that should be negotiated
     * @param frequencyList A lost of frequencies for the group call that should be negotiated
     *                separately with the carrier.
     * @param executor The executor on which you wish to execute callbacks for this stream.
     * @param callback The callback that you want to receive information about the call on.
     * @return An instance of {@link GroupCall} through which the call can be controlled.
     *         May be {@code null} if an error occurred.
     */
    public @Nullable GroupCall startGroupCall(@NonNull Executor executor, long tmgi, int[] saiArray,
            int[] frequencyArray, @NonNull GroupCallCallback callback) {
    public @Nullable GroupCall startGroupCall(long tmgi, @NonNull List<Integer> saiList,
            @NonNull List<Integer> frequencyList, @NonNull Executor executor,
            @NonNull GroupCallCallback callback) {
        IMbmsGroupCallService groupCallService = mService.get();
        if (groupCallService == null) {
            throw new IllegalStateException("Middleware not yet bound");
@@ -215,7 +217,7 @@ public class MbmsGroupCallSession implements AutoCloseable {

        try {
            int returnCode = groupCallService.startGroupCall(
                    mSubscriptionId, tmgi, saiArray, frequencyArray, serviceCallback);
                    mSubscriptionId, tmgi, saiList, frequencyList, serviceCallback);
            if (returnCode == MbmsErrors.UNKNOWN) {
                // Unbind and throw an obvious error
                close();
+25 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telephony.mbms;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.RemoteException;
import android.telephony.MbmsGroupCallSession;
import android.telephony.mbms.vendor.IMbmsGroupCallService;
@@ -24,6 +25,7 @@ import android.util.Log;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;

/**
 * Class used to represent a single MBMS group call. After a call has been started with
@@ -41,8 +43,26 @@ public class GroupCall implements AutoCloseable {
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = { "STATE_" }, value = {STATE_STOPPED, STATE_STARTED, STATE_STALLED})
    public @interface GroupCallState {}

    /**
     * Indicates that the group call is in a stopped state
     *
     * This can be reported after network action or after calling {@link #close}.
     */
    public static final int STATE_STOPPED = 1;

    /**
     * Indicates that the group call is started.
     *
     * Data can be transmitted and received in this state.
     */
    public static final int STATE_STARTED = 2;

    /**
     * Indicates that the group call is stalled.
     *
     * This may be due to a network issue or the device being temporarily out of range.
     */
    public static final int STATE_STALLED = 3;

    /**
@@ -122,16 +142,17 @@ public class GroupCall implements AutoCloseable {
     * Send an update to the middleware when the SAI (Service Area Identifier) list and frequency
     * information of the group call has * changed. Callers must obtain this information from the
     * wireless carrier independently.
     * @param saiArray New array of SAIs that the call is available on.
     * @param frequencyArray New array of frequencies that the call is available on.
     * @param saiList New list of SAIs that the call is available on.
     * @param frequencyList New list of frequencies that the call is available on.
     */
    public void updateGroupCall(int[] saiArray, int[] frequencyArray) {
    public void updateGroupCall(@NonNull List<Integer> saiList,
            @NonNull List<Integer> frequencyList) {
        if (mService == null) {
            throw new IllegalStateException("No group call service attached");
        }

        try {
            mService.updateGroupCall(mSubscriptionId, mTmgi, saiArray, frequencyArray);
            mService.updateGroupCall(mSubscriptionId, mTmgi, saiList, frequencyList);
        } catch (RemoteException e) {
            Log.w(LOG_TAG, "Remote process died");
            mService = null;
Loading