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

Commit 94d34925 authored by Shuo Qian's avatar Shuo Qian Committed by Automerger Merge Worker
Browse files

Merge "Introduce hasCompanionInCallServiceAccess API" am: 83cc1b62 am: 8a37624f

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1495021

Change-Id: I493dfbde9d9c21df783a4f2efcb7710281530e54
parents f1f33268 8a37624f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -46299,6 +46299,7 @@ package android.telecom {
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
    method public boolean hasCompanionInCallServiceAccess();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInCall();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInManagedCall();
    method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
+1 −0
Original line number Diff line number Diff line
@@ -44467,6 +44467,7 @@ package android.telecom {
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
    method public boolean hasCompanionInCallServiceAccess();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInCall();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInManagedCall();
    method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
+29 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
@@ -1588,6 +1589,30 @@ public class TelecomManager {
        return false;
    }

    /**
     * Returns whether the caller has {@link InCallService} access for companion apps.
     *
     * A companion app is an app associated with a physical wearable device via the
     * {@link android.companion.CompanionDeviceManager} API.
     *
     * @return {@code true} if the caller has {@link InCallService} access for
     *      companion app; {@code false} otherwise.
     */
    public boolean hasCompanionInCallServiceAccess() {
        try {
            if (isServiceConnected()) {
                return getTelecomService().hasCompanionInCallServiceAccess(
                        mContext.getOpPackageName());
            }
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException calling hasCompanionInCallServiceAccess().", e);
            if (!isSystemProcess()) {
                e.rethrowAsRuntimeException();
            }
        }
        return false;
    }

    /**
     * Returns whether there is an ongoing call originating from a managed
     * {@link ConnectionService}.  An ongoing call can be in dialing, ringing, active or holding
@@ -2384,6 +2409,10 @@ public class TelecomManager {
        }
    }

    private boolean isSystemProcess() {
        return Process.myUid() == Process.SYSTEM_UID;
    }

    private ITelecomService getTelecomService() {
        if (mTelecomServiceOverride != null) {
            return mTelecomServiceOverride;
+5 −0
Original line number Diff line number Diff line
@@ -178,6 +178,11 @@ interface ITelecomService {
     */
    boolean isInCall(String callingPackage, String callingFeatureId);

    /**
     * @see TelecomServiceImpl#hasCompanionInCallServiceAccess
     */
    boolean hasCompanionInCallServiceAccess(String callingPackage);

    /**
     * @see TelecomServiceImpl#isInManagedCall
     */