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

Commit 1b401d15 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Support for API cleanups.

New @SystemApis on Conference and PhoneAccount were missing the required
permissions annotations; add permission enforcement in Telecom.
Renames for various methods/properties in the API surface.

Test: Run Telecom and Telephony CTS tests.
Test: Run Telephony unit tests.
Test: Perform manual single-party-conference regression test to confirm
that conference behavior does not regress.
Bug: 148286830
Bug: 148284863
Bug: 148284843
Bug: 148287068
Bug: 148285484
Bug: 148285560
Change-Id: I1f446d81859fa109d74af3661a42a0bd224de5aa
Merged-In: I1f446d81859fa109d74af3661a42a0bd224de5aa
parent ecdc2ce0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -337,8 +337,8 @@ public final class CallLogManager extends CallsManagerListenerBase {
        int callFeatures = getCallFeatures(call.getVideoStateHistory(),
                call.getDisconnectCause().getCode() == DisconnectCause.CALL_PULLED,
                call.wasHighDefAudio(), call.wasWifi(),
                (call.getConnectionProperties() & Connection.PROPERTY_ASSISTED_DIALING_USED) ==
                        Connection.PROPERTY_ASSISTED_DIALING_USED,
                (call.getConnectionProperties() & Connection.PROPERTY_ASSISTED_DIALING) ==
                        Connection.PROPERTY_ASSISTED_DIALING,
                call.wasEverRttCall(),
                call.wasVolte());

+50 −0
Original line number Diff line number Diff line
@@ -16,9 +16,12 @@

package com.android.server.telecom;

import static android.Manifest.permission.MODIFY_PHONE_STATE;

import android.app.AppOpsManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
@@ -465,6 +468,32 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
        public void addConferenceCall(String callId, ParcelableConference parcelableConference,
                Session.Info sessionInfo) {
            Log.startSession(sessionInfo, LogUtils.Sessions.CSW_ADD_CONFERENCE_CALL);

            if (parcelableConference.getConnectElapsedTimeMillis() != 0
                    && mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE)
                            != PackageManager.PERMISSION_GRANTED) {
                Log.w(this, "addConferenceCall from caller without permission!");
                parcelableConference = new ParcelableConference(
                        parcelableConference.getPhoneAccount(),
                        parcelableConference.getState(),
                        parcelableConference.getConnectionCapabilities(),
                        parcelableConference.getConnectionProperties(),
                        parcelableConference.getConnectionIds(),
                        parcelableConference.getVideoProvider(),
                        parcelableConference.getVideoState(),
                        0 /* connectTimeMillis */,
                        0 /* connectElapsedRealTime */,
                        parcelableConference.getStatusHints(),
                        parcelableConference.getExtras(),
                        parcelableConference.getHandle(),
                        parcelableConference.getHandlePresentation(),
                        "" /* callerDisplayName */,
                        TelecomManager.PRESENTATION_UNKNOWN /* callerDisplayNamePresentation */,
                        parcelableConference.getDisconnectCause(),
                        parcelableConference.isRingbackRequested()
                        );
            }

            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
@@ -752,6 +781,13 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
        public void setAddress(String callId, Uri address, int presentation,
                Session.Info sessionInfo) {
            Log.startSession(sessionInfo, "CSW.sA");

            if (mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE)
                    != PackageManager.PERMISSION_GRANTED) {
                Log.w(this, "setAddress from caller without permission.");
                return;
            }

            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
@@ -836,6 +872,13 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                mAppOpsManager.checkPackage(Binder.getCallingUid(),
                        callingPhoneAccountHandle.getComponentName().getPackageName());
            }

            if (mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE)
                    != PackageManager.PERMISSION_GRANTED) {
                Log.w(this, "addExistingConnection from caller without permission!");
                return;
            }

            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
@@ -1038,6 +1081,13 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
        public void setConferenceState(String callId, boolean isConference,
                Session.Info sessionInfo) throws RemoteException {
            Log.startSession(sessionInfo, "CSW.sCS");

            if (mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE)
                    != PackageManager.PERMISSION_GRANTED) {
                Log.w(this, "setConferenceState from caller without permission.");
                return;
            }

            long token = Binder.clearCallingIdentity();
            try {
                synchronized (mLock) {
+2 −2
Original line number Diff line number Diff line
@@ -551,8 +551,8 @@ public class ParcelableCallUtils {
        Connection.PROPERTY_SELF_MANAGED,
        android.telecom.Call.Details.PROPERTY_SELF_MANAGED,

        Connection.PROPERTY_ASSISTED_DIALING_USED,
        android.telecom.Call.Details.PROPERTY_ASSISTED_DIALING_USED,
        Connection.PROPERTY_ASSISTED_DIALING,
        android.telecom.Call.Details.PROPERTY_ASSISTED_DIALING,

        Connection.PROPERTY_IS_RTT,
        android.telecom.Call.Details.PROPERTY_RTT,
+12 −0
Original line number Diff line number Diff line
@@ -490,6 +490,18 @@ public class TelecomServiceImpl {
                        if (callingUid != Process.SHELL_UID) {
                            enforceUserHandleMatchesCaller(account.getAccountHandle());
                        }

                        if (TextUtils.isEmpty(account.getGroupId())
                                && mContext.checkCallingOrSelfPermission(MODIFY_PHONE_STATE)
                                != PackageManager.PERMISSION_GRANTED) {
                            Log.w(this, "registerPhoneAccount - attempt to set a"
                                    + " group from a non-system caller.");
                            // Not permitted to set group, so null it out.
                            account = new PhoneAccount.Builder(account)
                                    .setGroupId(null)
                                    .build();
                        }

                        final long token = Binder.clearCallingIdentity();
                        try {
                            mPhoneAccountRegistrar.registerPhoneAccount(account);