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

Commit 0cf7921d authored by Joe Antonetti's avatar Joe Antonetti
Browse files

[Handoff][5/N] Clear Calling Identity when Requesting Handoff

`TaskContinuityManager` needs permissions that the caller may not have when requesting Handoff, so clear the calling identity during a Handoff request.

Test: Validated manually. CTS tests in the future will fully test this
Bug: 400970610
Flag: android.companion.enable_task_continuity
Change-Id: I7e42ab88999e5fc2745724f997c77c265395d4a2
parent e90c2705
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.companion.datatransfer.continuity.ITaskContinuityManager;
import android.companion.datatransfer.continuity.IRemoteTaskListener;
import android.companion.datatransfer.continuity.RemoteTask;
import android.content.Context;
import android.os.Binder;
import android.util.Slog;

import com.android.server.companion.datatransfer.continuity.handoff.InboundHandoffRequestController;
@@ -105,10 +106,15 @@ public final class TaskContinuityManagerService extends SystemService {
            int associationId,
            int remoteTaskId,
            @NonNull IHandoffRequestCallback callback) {
            final long ident = Binder.clearCallingIdentity();
            try {
                mOutboundHandoffRequestController.requestHandoff(
                    associationId,
                    remoteTaskId,
                    callback);
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }