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

Commit 9364b9e9 authored by Thomas Stuart's avatar Thomas Stuart Committed by Android (Google) Code Review
Browse files

Merge "add @TestApi hasForegroundServiceDelegation in TelecomManager" into main

parents 2c3dcb27 a04c86a6
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -3415,6 +3415,10 @@ package android.telecom {
    method public void onBindClient(@Nullable android.content.Intent);
    method public void onBindClient(@Nullable android.content.Intent);
  }
  }


  public class TelecomManager {
    method @FlaggedApi("com.android.server.telecom.flags.voip_call_monitor_refactor") public boolean hasForegroundServiceDelegation(@Nullable android.telecom.PhoneAccountHandle);
  }

}
}


package android.telephony {
package android.telephony {
+29 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@ import android.annotation.SuppressAutoDoc;
import android.annotation.SuppressLint;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.compat.annotation.ChangeId;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
@@ -1885,6 +1886,34 @@ public class TelecomManager {
        return null;
        return null;
    }
    }


    /**
     * This test API determines the foreground service delegation state for a VoIP app that adds
     * calls via {@link TelecomManager#addCall(CallAttributes, Executor, OutcomeReceiver,
     * CallControlCallback, CallEventCallback)}.  Foreground Service Delegation allows applications
     * to operate in the background  starting in Android 14 and is granted by Telecom via a request
     * to the ActivityManager.
     *
     * @param handle of the voip app that is being checked
     * @return true if the app has foreground service delegation. Otherwise, false.
     *
     * @hide
     */
    @FlaggedApi(Flags.FLAG_VOIP_CALL_MONITOR_REFACTOR)
    @TestApi
    public boolean hasForegroundServiceDelegation(@Nullable PhoneAccountHandle handle) {
        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                return service.hasForegroundServiceDelegation(handle, mContext.getOpPackageName());
            } catch (RemoteException e) {
                Log.e(TAG,
                        "RemoteException calling ITelecomService#hasForegroundServiceDelegation.",
                        e);
            }
        }
        return false;
    }

    /**
    /**
     * Return the line 1 phone number for given phone account.
     * Return the line 1 phone number for given phone account.
     *
     *
+6 −0
Original line number Original line Diff line number Diff line
@@ -409,4 +409,10 @@ interface ITelecomService {
     */
     */
    void addCall(in CallAttributes callAttributes, in ICallEventCallback callback, String callId,
    void addCall(in CallAttributes callAttributes, in ICallEventCallback callback, String callId,
        String callingPackage);
        String callingPackage);

    /**
     * @see TelecomServiceImpl#hasForegroundServiceDelegation
     */
    boolean hasForegroundServiceDelegation(in PhoneAccountHandle phoneAccountHandle,
                                                       String callingPackage);
}
}