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

Commit a32790b7 authored by Calvin On's avatar Calvin On
Browse files

Add a new Flagged API isInExternalCall

API-Coverage-Bug: 436902650
Flag: com.android.server.telecom.flags.is_in_external_call
Bug: 405460896
Bug: 435261628
Change-Id: I7853584bad5cd4b7759201429723e2a1e13200fd
parent 608bfda6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -45072,6 +45072,7 @@ package android.telecom {
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
    method public boolean hasManageOngoingCallsPermission();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInCall();
    method @FlaggedApi("com.android.server.telecom.flags.is_in_external_call") @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInExternalCall();
    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInManagedCall();
    method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
    method public boolean isOutgoingCallPermitted(android.telecom.PhoneAccountHandle);
+22 −0
Original line number Diff line number Diff line
@@ -2059,6 +2059,28 @@ public class TelecomManager {
        return false;
    }

    /**
     * Returns whether there is an ongoing phone call (can be in dialing, ringing, active or holding
     * states) that is an external call.
     *
     * @return {@code true} if there is an ongoing call that is external, {@code false} otherwise.
     */
    @FlaggedApi(Flags.FLAG_IS_IN_EXTERNAL_CALL)
    @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
    public boolean isInExternalCall() {
        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                return service.isInExternalCall(mContext.getOpPackageName(),
                        mContext.getAttributionTag());
            } catch (RemoteException e) {
                Log.e(TAG, "RemoteException calling isInCall().", e);
              e.rethrowFromSystemServer();
            }
        }
        return false;
    }

    /**
     * Returns whether the caller has {@link android.Manifest.permission#MANAGE_ONGOING_CALLS}
     * permission. The permission can be obtained by associating with a physical wearable device
+5 −0
Original line number Diff line number Diff line
@@ -205,6 +205,11 @@ interface ITelecomService {
     */
    boolean isInManagedCall(String callingPackage, String callingFeatureId);

    /**
     * @see TelecomServiceImpl#isInExternalCall
     */
    boolean isInExternalCall(String callingPackage, String callingFeatureId);

    /**
     * @see TelecomServiceImpl#isRinging
     */