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

Commit e429ec01 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Merge "Add new TelecomManager method to check if a self-mgd app is in a call." into tm-dev

parents 80dbdd63 27bf4346
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2600,6 +2600,33 @@ public class TelecomManager {
        return false;
    }

    /**
     * Determines whether there are any ongoing {@link PhoneAccount#CAPABILITY_SELF_MANAGED}
     * calls for a given {@code packageName} and {@code userHandle}.
     *
     * @param packageName the package name of the app to check calls for.
     * @param userHandle the user handle on which to check for calls.
     * @return {@code true} if there are ongoing calls, {@code false} otherwise.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public boolean isInSelfManagedCall(@NonNull String packageName,
            @NonNull UserHandle userHandle) {
        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                return service.isInSelfManagedCall(packageName, userHandle,
                        mContext.getOpPackageName());
            } catch (RemoteException e) {
                Log.e(TAG, "RemoteException isInSelfManagedCall: " + e);
                e.rethrowFromSystemServer();
                return false;
            }
        } else {
            throw new IllegalStateException("Telecom service is not present");
        }
    }

    /**
     * Handles {@link Intent#ACTION_CALL} intents trampolined from UserCallActivity.
     * @param intent The {@link Intent#ACTION_CALL} intent to handle.
+7 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.telecom.TelecomAnalytics;
import android.telecom.PhoneAccountHandle;
import android.net.Uri;
import android.os.Bundle;
import android.os.UserHandle;
import android.telecom.PhoneAccount;

/**
@@ -374,4 +375,10 @@ interface ITelecomService {
     * @see TelecomServiceImpl#setTestCallDiagnosticService
     */
    void setTestCallDiagnosticService(in String packageName);

    /**
     * @see TelecomServiceImpl#isInSelfManagedCall
     */
    boolean isInSelfManagedCall(String packageName, in UserHandle userHandle,
        String callingPackage);
}