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

Commit 8f8615f1 authored by Pranav Madapurmath's avatar Pranav Madapurmath Committed by Android (Google) Code Review
Browse files

Merge "Formalize TelecomManager#isInSelfManagedCall" into main

parents 367353b7 f6e8b18f
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -13732,6 +13732,7 @@ package android.telecom {
    method @Deprecated public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsForPackage();
    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(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 @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 @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
    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);
    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";
    field public static final String ACTION_CURRENT_TTY_MODE_CHANGED = "android.telecom.action.CURRENT_TTY_MODE_CHANGED";
+2 −2
Original line number Original line Diff line number Diff line
@@ -7955,8 +7955,8 @@ public class NotificationManagerService extends SystemService {
                    && mTelecomManager != null) {
                    && mTelecomManager != null) {
                try {
                try {
                    return mTelecomManager.isInManagedCall()
                    return mTelecomManager.isInManagedCall()
                            || mTelecomManager.isInSelfManagedCall(
                            || mTelecomManager.isInSelfManagedCall(pkg,
                            pkg, UserHandle.getUserHandleForUid(uid));
                            UserHandle.getUserHandleForUid(uid), /* hasCrossUserAccess */ true);
                } catch (IllegalStateException ise) {
                } catch (IllegalStateException ise) {
                    // Telecom is not ready (this is likely early boot), so there are no calls.
                    // Telecom is not ready (this is likely early boot), so there are no calls.
                    return false;
                    return false;
+2 −2
Original line number Original line Diff line number Diff line
@@ -11686,7 +11686,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        // style + self managed call - bypasses block
        // style + self managed call - bypasses block
        when(mTelecomManager.isInSelfManagedCall(
        when(mTelecomManager.isInSelfManagedCall(
                r.getSbn().getPackageName(), r.getUser())).thenReturn(true);
                r.getSbn().getPackageName(), r.getUser(), true)).thenReturn(true);
        assertThat(mService.checkDisqualifyingFeatures(r.getUserId(), r.getUid(),
        assertThat(mService.checkDisqualifyingFeatures(r.getUserId(), r.getUid(),
                r.getSbn().getId(), r.getSbn().getTag(), r, false, false)).isTrue();
                r.getSbn().getId(), r.getSbn().getTag(), r, false, false)).isTrue();
@@ -11769,7 +11769,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        // style + self managed call - bypasses block
        // style + self managed call - bypasses block
        mService.clearNotifications();
        mService.clearNotifications();
        reset(mUsageStats);
        reset(mUsageStats);
        when(mTelecomManager.isInSelfManagedCall(r.getSbn().getPackageName(), r.getUser()))
        when(mTelecomManager.isInSelfManagedCall(r.getSbn().getPackageName(), r.getUser(), true))
                .thenReturn(true);
                .thenReturn(true);
        mService.addEnqueuedNotification(r);
        mService.addEnqueuedNotification(r);
+9 −3
Original line number Original line Diff line number Diff line
@@ -2752,17 +2752,23 @@ public class TelecomManager {
     *
     *
     * @param packageName the package name of the app to check calls for.
     * @param packageName the package name of the app to check calls for.
     * @param userHandle the user handle on which to check for calls.
     * @param userHandle the user handle on which to check for calls.
     * @param hasCrossUserAccess indicates if calls should be detected across all users.
     * @return {@code true} if there are ongoing calls, {@code false} otherwise.
     * @return {@code true} if there are ongoing calls, {@code false} otherwise.
     * @hide
     * @hide
     */
     */
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    @SystemApi
    @FlaggedApi(Flags.FLAG_TELECOM_RESOLVE_HIDDEN_DEPENDENCIES)
    @RequiresPermission(allOf = {
            android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
            Manifest.permission.INTERACT_ACROSS_USERS
    })
    public boolean isInSelfManagedCall(@NonNull String packageName,
    public boolean isInSelfManagedCall(@NonNull String packageName,
            @NonNull UserHandle userHandle) {
            @NonNull UserHandle userHandle, boolean hasCrossUserAccess) {
        ITelecomService service = getTelecomService();
        ITelecomService service = getTelecomService();
        if (service != null) {
        if (service != null) {
            try {
            try {
                return service.isInSelfManagedCall(packageName, userHandle,
                return service.isInSelfManagedCall(packageName, userHandle,
                        mContext.getOpPackageName());
                        mContext.getOpPackageName(), hasCrossUserAccess);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.e(TAG, "RemoteException isInSelfManagedCall: " + e);
                Log.e(TAG, "RemoteException isInSelfManagedCall: " + e);
                e.rethrowFromSystemServer();
                e.rethrowFromSystemServer();
+1 −1
Original line number Original line Diff line number Diff line
@@ -395,7 +395,7 @@ interface ITelecomService {
     * @see TelecomServiceImpl#isInSelfManagedCall
     * @see TelecomServiceImpl#isInSelfManagedCall
     */
     */
    boolean isInSelfManagedCall(String packageName, in UserHandle userHandle,
    boolean isInSelfManagedCall(String packageName, in UserHandle userHandle,
        String callingPackage);
        String callingPackage, boolean hasCrossUserAccess);


    /**
    /**
     * @see TelecomServiceImpl#addCall
     * @see TelecomServiceImpl#addCall