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

Commit 63490381 authored by Pranav Madapurmath's avatar Pranav Madapurmath
Browse files

Resolve API feedback TelecomManager#isInSelfManagedCall

As part of the mainline work, feedback has given to change the
hasCrossUserAccess param to better match the description. The
INTERACT_ACROSS_USERS permission has also been made an optional
parameter which is enforced when the user handle passed in doesn't match
the calling user or when the detectForAllUsers parameter is set to true.

Bug: 323958718
Bug: 311773409
Test: atest SelfManagedConnectionServiceTest
Change-Id: I96c04249e6320bde355a1efeddf0374048b84198
parent 6892184b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13841,7 +13841,7 @@ package android.telecom {
    method @Deprecated public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsForPackage();
    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(String);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall();
    method @FlaggedApi("com.android.server.telecom.flags.telecom_resolve_hidden_dependencies") @RequiresPermission(allOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.INTERACT_ACROSS_USERS}) public boolean isInSelfManagedCall(@NonNull String, @NonNull android.os.UserHandle, boolean);
    method @FlaggedApi("com.android.server.telecom.flags.telecom_resolve_hidden_dependencies") @RequiresPermission(allOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.INTERACT_ACROSS_USERS}, conditional=true) public boolean isInSelfManagedCall(@NonNull String, @NonNull android.os.UserHandle, boolean);
    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle);
    field public static final String ACTION_CURRENT_TTY_MODE_CHANGED = "android.telecom.action.CURRENT_TTY_MODE_CHANGED";
+9 −7
Original line number Diff line number Diff line
@@ -2753,23 +2753,25 @@ public class TelecomManager {
     *
     * @param packageName the package name of the app to check calls for.
     * @param userHandle the user handle on which to check for calls.
     * @param hasCrossUserAccess indicates if calls should be detected across all users.
     * @param detectForAllUsers indicates if calls should be detected across all users. If it is
     *                          set to {@code true}, and the caller has the ability to interact
     *                          across users, the userHandle parameter is disregarded.
     * @return {@code true} if there are ongoing calls, {@code false} otherwise.
     * @throws SecurityException if detectForAllUsers is true or userHandle is not the calling user
     * and the caller does not grant the ability to interact across users.
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES)
    @RequiresPermission(allOf = {
            android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
            Manifest.permission.INTERACT_ACROSS_USERS
    })
    @RequiresPermission(allOf = {Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
            Manifest.permission.INTERACT_ACROSS_USERS}, conditional = true)
    public boolean isInSelfManagedCall(@NonNull String packageName,
            @NonNull UserHandle userHandle, boolean hasCrossUserAccess) {
            @NonNull UserHandle userHandle, boolean detectForAllUsers) {
        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                return service.isInSelfManagedCall(packageName, userHandle,
                        mContext.getOpPackageName(), hasCrossUserAccess);
                        mContext.getOpPackageName(), detectForAllUsers);
            } catch (RemoteException e) {
                Log.e(TAG, "RemoteException isInSelfManagedCall: " + e);
                e.rethrowFromSystemServer();
+1 −1
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ interface ITelecomService {
     * @see TelecomServiceImpl#isInSelfManagedCall
     */
    boolean isInSelfManagedCall(String packageName, in UserHandle userHandle,
        String callingPackage, boolean hasCrossUserAccess);
        String callingPackage, boolean detectForAllUsers);

    /**
     * @see TelecomServiceImpl#addCall