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

Commit a33d1aed authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Merge "Modify RCS UCE APIs to use AIDL Interfaces." am: 4204a601 am: c64c204f

am: 7e3661be

Change-Id: Id3ed1606bed208b8da758c3f86eadf1ccf6563cf
parents 0ee63991 7e3661be
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -560,6 +560,7 @@ java_defaults {
        "telephony/java/android/telephony/ims/aidl/IImsServiceControllerListener.aidl",
        "telephony/java/android/telephony/ims/aidl/IImsSmsListener.aidl",
        "telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl",
        "telephony/java/android/telephony/ims/aidl/IRcsFeatureListener.aidl",
        "telephony/java/android/telephony/mbms/IMbmsDownloadSessionCallback.aidl",
        "telephony/java/android/telephony/mbms/IMbmsStreamingSessionCallback.aidl",
        "telephony/java/android/telephony/mbms/IMbmsGroupCallSessionCallback.aidl",
+3 −3
Original line number Diff line number Diff line
@@ -39,11 +39,11 @@ public final class ImsException extends Exception {
     */
    public static final int CODE_ERROR_UNSPECIFIED = 0;
    /**
     * The operation has failed because there is no {@link ImsService} available to service it. This
     * may be due to an {@link ImsService} crash or other illegal state.
     * The operation has failed because there is no remote process available to service it. This
     * may be due to a process crash or other illegal state.
     * <p>
     * This is a temporary error and the operation may be retried until the connection to the
     * {@link ImsService} is restored.
     * remote process is restored.
     */
    public static final int CODE_ERROR_SERVICE_UNAVAILABLE = 1;

+29 −1
Original line number Diff line number Diff line
@@ -16,10 +16,38 @@

package android.telephony.ims.aidl;

import android.net.Uri;
import android.telephony.ims.RcsContactUceCapability;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IRcsFeatureListener;
import android.telephony.ims.feature.CapabilityChangeRequest;

import java.util.List;

/**
 * See RcsFeature for more information.
 * {@hide}
 */
interface IImsRcsFeature {
    //Empty Default Implementation
    // Not oneway because we need to verify this completes before doing anything else.
    void setListener(IRcsFeatureListener listener);
    int queryCapabilityStatus();
    // Inherited from ImsFeature
    int getFeatureState();
    oneway void addCapabilityCallback(IImsCapabilityCallback c);
    oneway void removeCapabilityCallback(IImsCapabilityCallback c);
    oneway void changeCapabilitiesConfiguration(in CapabilityChangeRequest r,
            IImsCapabilityCallback c);
    oneway void queryCapabilityConfiguration(int capability, int radioTech,
            IImsCapabilityCallback c);
    // RcsPresenceExchangeImplBase specific api
    oneway void requestCapabilities(in List<Uri> uris, int operationToken);
    oneway void updateCapabilities(in RcsContactUceCapability capabilities, int operationToken);
    // RcsSipOptionsImplBase specific api
    oneway void sendCapabilityRequest(in Uri contactUri,
            in RcsContactUceCapability capabilities, int operationToken);
    oneway void respondToCapabilityRequest(in String contactUri,
            in RcsContactUceCapability ownCapabilities, int operationToken);
    oneway void respondToCapabilityRequestWithError(in Uri contactUri, int code, in String reason,
            int operationToken);
}
 No newline at end of file
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.ims.aidl;

import android.net.Uri;
import android.telephony.ims.RcsContactUceCapability;

import java.util.List;

/**
 * Listener interface for updates from the RcsFeature back to the framework.
 * {@hide}
 */
interface IRcsFeatureListener {
    //RcsCapabilityExchange specific
    oneway void onCommandUpdate(int commandCode, int operationToken);
    // RcsPresenceExchangeImplBase Specific
    oneway void onNetworkResponse(int code, in String reason, int operationToken);
    oneway void onCapabilityRequestResponsePresence(in List<RcsContactUceCapability> infos,
    int operationToken);
    oneway void onNotifyUpdateCapabilities();
    oneway void onUnpublish();
    // RcsSipOptionsImplBase specific
    oneway void onCapabilityRequestResponseOptions(int code, in String reason,
            in RcsContactUceCapability info, int operationToken);
    oneway void onRemoteCapabilityRequest(in Uri contactUri, in RcsContactUceCapability remoteInfo,
            int operationToken);
}
 No newline at end of file
+46 −71
Original line number Diff line number Diff line
@@ -33,12 +33,8 @@ import com.android.internal.annotations.VisibleForTesting;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;

/**
 * Base class for all IMS features that are supported by the framework. Use a concrete subclass
@@ -51,35 +47,6 @@ public abstract class ImsFeature {

    private static final String LOG_TAG = "ImsFeature";

    /**
     * Action to broadcast when ImsService is up.
     * Internal use only.
     * Only defined here separately for compatibility purposes with the old ImsService.
     *
     * @hide
     */
    public static final String ACTION_IMS_SERVICE_UP =
            "com.android.ims.IMS_SERVICE_UP";

    /**
     * Action to broadcast when ImsService is down.
     * Internal use only.
     * Only defined here separately for compatibility purposes with the old ImsService.
     *
     * @hide
     */
    public static final String ACTION_IMS_SERVICE_DOWN =
            "com.android.ims.IMS_SERVICE_DOWN";

    /**
     * Part of the ACTION_IMS_SERVICE_UP or _DOWN intents.
     * A long value; the phone ID corresponding to the IMS service coming up or down.
     * Only defined here separately for compatibility purposes with the old ImsService.
     *
     * @hide
     */
    public static final String EXTRA_PHONE_ID = "android:phone_id";

    /**
     * Invalid feature value
     * @hide
@@ -335,8 +302,8 @@ public abstract class ImsFeature {
    /** @hide */
    protected final Object mLock = new Object();

    private final Set<IImsFeatureStatusCallback> mStatusCallbacks =
            Collections.newSetFromMap(new WeakHashMap<>());
    private final RemoteCallbackList<IImsFeatureStatusCallback> mStatusCallbacks =
            new RemoteCallbackList<>();
    private @ImsState int mState = STATE_UNAVAILABLE;
    private int mSlotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
    private final RemoteCallbackList<IImsCapabilityCallback> mCapabilityCallbacks =
@@ -397,9 +364,7 @@ public abstract class ImsFeature {
            // If we have just connected, send queued status.
            c.notifyImsFeatureStatus(getFeatureState());
            // Add the callback if the callback completes successfully without a RemoteException.
            synchronized (mLock) {
                mStatusCallbacks.add(c);
            }
            mStatusCallbacks.register(c);
        } catch (RemoteException e) {
            Log.w(LOG_TAG, "Couldn't notify feature state: " + e.getMessage());
        }
@@ -411,29 +376,21 @@ public abstract class ImsFeature {
     */
    @VisibleForTesting
    public void removeImsFeatureStatusCallback(@NonNull IImsFeatureStatusCallback c) {
        synchronized (mLock) {
            mStatusCallbacks.remove(c);
        }
        mStatusCallbacks.unregister(c);
    }

    /**
     * Internal method called by ImsFeature when setFeatureState has changed.
     */
    private void notifyFeatureState(@ImsState int state) {
        synchronized (mLock) {
            for (Iterator<IImsFeatureStatusCallback> iter = mStatusCallbacks.iterator();
                    iter.hasNext(); ) {
                IImsFeatureStatusCallback callback = iter.next();
        mStatusCallbacks.broadcast((c) -> {
            try {
                    Log.i(LOG_TAG, "notifying ImsFeatureState=" + state);
                    callback.notifyImsFeatureStatus(state);
                c.notifyImsFeatureStatus(state);
            } catch (RemoteException e) {
                    // remove if the callback is no longer alive.
                    iter.remove();
                    Log.w(LOG_TAG, "Couldn't notify feature state: " + e.getMessage());
                }
            }
                Log.w(LOG_TAG, e + " notifyFeatureState() - Skipping "
                        + "callback.");
            }
        });
    }

    /**
@@ -452,10 +409,23 @@ public abstract class ImsFeature {
    /**
     * @hide
     */
    public final void removeCapabilityCallback(IImsCapabilityCallback c) {
    final void removeCapabilityCallback(IImsCapabilityCallback c) {
        mCapabilityCallbacks.unregister(c);
    }

    /**@hide*/
    final void queryCapabilityConfigurationInternal(int capability, int radioTech,
            IImsCapabilityCallback c) {
        boolean enabled = queryCapabilityConfiguration(capability, radioTech);
        try {
            if (c != null) {
                c.onQueryCapabilityConfiguration(capability, radioTech, enabled);
            }
        } catch (RemoteException e) {
            Log.e(LOG_TAG, "queryCapabilityConfigurationInternal called on dead binder!");
        }
    }

    /**
     * @return the cached capabilities status for this feature.
     * @hide
@@ -484,30 +454,35 @@ public abstract class ImsFeature {
    /**
     * Called by the ImsFeature when the capabilities status has changed.
     *
     * @param c A {@link Capabilities} containing the new Capabilities status.
     * @param caps the new {@link Capabilities} status of the {@link ImsFeature}.
     *
     * @hide
     */
    protected final void notifyCapabilitiesStatusChanged(Capabilities c) {
    protected final void notifyCapabilitiesStatusChanged(Capabilities caps) {
        synchronized (mLock) {
            mCapabilityStatus = c.copy();
            mCapabilityStatus = caps.copy();
        }
        int count = mCapabilityCallbacks.beginBroadcast();
        try {
            for (int i = 0; i < count; i++) {
        mCapabilityCallbacks.broadcast((callback) -> {
            try {
                    mCapabilityCallbacks.getBroadcastItem(i).onCapabilitiesStatusChanged(
                            c.mCapabilities);
                callback.onCapabilitiesStatusChanged(caps.mCapabilities);
            } catch (RemoteException e) {
                    Log.w(LOG_TAG, e + " " + "notifyCapabilitiesStatusChanged() - Skipping " +
                            "callback.");
                }
            }
        } finally {
            mCapabilityCallbacks.finishBroadcast();
                Log.w(LOG_TAG, e + " notifyCapabilitiesStatusChanged() - Skipping "
                        + "callback.");
            }
        });
    }

    /**
     * Provides the ImsFeature with the ability to return the framework Capability Configuration
     * for a provided Capability. If the framework calls {@link #changeEnabledCapabilities} and
     * includes a capability A to enable or disable, this method should return the correct enabled
     * status for capability A.
     * @param capability The capability that we are querying the configuration for.
     * @return true if the capability is enabled, false otherwise.
     * @hide
     */
    public abstract boolean queryCapabilityConfiguration(int capability, int radioTech);

    /**
     * Features should override this method to receive Capability preference change requests from
     * the framework using the provided {@link CapabilityChangeRequest}. If any of the capabilities
Loading