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

Commit 115c06ee authored by Tyler Gunn's avatar Tyler Gunn
Browse files

API review cleanups.

- Modify the video call permission check to use the API version of the
caller to determine whether to use the API26
SESSION_EVENT_CAMERA_PERMISSION_ERROR event.  If the caller is using an
older API, use the more generic SESSION_EVENT_CAMERA_FAILURE.
- Update the sample Self Managed calling app to use the incoming call UX
guidance specified in the Javadocs.
- Fix bug in InCallController which could cause InCallService to see
self-managed connections.

Test: Manual
Bug: 35767096
Bug: 35767711
Change-Id: I3e5e2b84eb026eec37f884029bb77d446a04e255
parent 37e782b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:name=".testapps.IncomingSelfManagedCallActivity" />

        <receiver android:name=".components.PrimaryCallReceiver"
                android:exported="true"
+3 −1
Original line number Diff line number Diff line
@@ -923,7 +923,9 @@ public class ConnectionServiceWrapper extends ServiceBinder {
                            Log.piiHandle(call.getHandle()));
                    try {
                        logOutgoing("createConnectionFailed %s", callId);
                        mServiceInterface.createConnectionFailed(callId,
                        mServiceInterface.createConnectionFailed(
                                call.getConnectionManagerPhoneAccount(),
                                callId,
                                new ConnectionRequest(
                                        call.getTargetPhoneAccount(),
                                        call.getHandle(),
+4 −0
Original line number Diff line number Diff line
@@ -687,6 +687,10 @@ public final class InCallController extends CallsManagerListenerBase {
                    continue;
                }

                if (call.isSelfManaged() && !info.isSelfManagedCallsSupported()) {
                    continue;
                }

                // Only send the RTT call if it's a UI in-call service
                boolean includeRttCall = info.equals(mInCallServiceConnection.getInfo());

+18 −6
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.AppOpsManager;
import android.content.Context;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
@@ -303,10 +304,12 @@ public class VideoProviderProxy extends Connection.VideoProvider {
     * @param callingPackage The package calling in.
     * @param callingUid The UID of the caller.
     * @param callingPid The PID of the caller.
     * @param targetSdkVersion The target SDK version of the calling InCallService where the camera
     *      request originated.
     */
    @Override
    public void onSetCamera(String cameraId, String callingPackage, int callingUid,
            int callingPid) {
            int callingPid, int targetSdkVersion) {
        synchronized (mLock) {
            logFromInCall("setCamera: " + cameraId + " callingPackage=" + callingPackage +
                    "; callingUid=" + callingUid);
@@ -316,15 +319,24 @@ public class VideoProviderProxy extends Connection.VideoProvider {
                    // Calling app is not permitted to use the camera.  Ignore the request and send
                    // back a call session event indicating the error.
                    Log.i(this, "onSetCamera: camera permission denied; package=%d, uid=%d, "
                            + "pid=%d",
                            callingPackage, callingUid, callingPid);
                            + "pid=%d, targetSdkVersion=%d",
                            callingPackage, callingUid, callingPid, targetSdkVersion);

                    // API 26 introduces a new camera permission error we can use here since the
                    // caller supports that API version.
                    if (targetSdkVersion > Build.VERSION_CODES.N_MR1) {
                        VideoProviderProxy.this.handleCallSessionEvent(
                                Connection.VideoProvider.SESSION_EVENT_CAMERA_PERMISSION_ERROR);
                    } else {
                        VideoProviderProxy.this.handleCallSessionEvent(
                                Connection.VideoProvider.SESSION_EVENT_CAMERA_FAILURE);
                    }
                    return;
                }
            }
            try {
                mConectionServiceVideoProvider.setCamera(cameraId, callingPackage);
                mConectionServiceVideoProvider.setCamera(cameraId, callingPackage,
                        targetSdkVersion);
            } catch (RemoteException e) {
                VideoProviderProxy.this.handleCallSessionEvent(
                        Connection.VideoProvider.SESSION_EVENT_CAMERA_FAILURE);
+12 −0
Original line number Diff line number Diff line
@@ -173,6 +173,14 @@
          </intent-filter>
        </activity>

        <activity android:name="com.android.server.telecom.testapps.IncomingSelfManagedCallActivity"
                  android:label="@string/selfManagedCallingActivityLabel"
                  android:process="com.android.server.telecom.testapps.SelfMangingCallingApp">
          <intent-filter>
              <action android:name="android.intent.action.MAIN" />
          </intent-filter>
        </activity>

        <service android:name="com.android.server.telecom.testapps.SelfManagedConnectionService"
                 android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
                 android:process="com.android.server.telecom.testapps.SelfMangingCallingApp">
@@ -180,5 +188,9 @@
              <action android:name="android.telecom.ConnectionService" />
          </intent-filter>
        </service>

        <receiver android:exported="false"
            android:process="com.android.server.telecom.testapps.SelfMangingCallingApp"
            android:name="com.android.server.telecom.testapps.SelfManagedCallNotificationReceiver" />
    </application>
</manifest>
Loading