Loading core/java/android/companion/virtual/computercontrol/ComputerControlSession.java +25 −9 Original line number Diff line number Diff line Loading @@ -122,15 +122,6 @@ public final class ComputerControlSession implements AutoCloseable { @Nullable private ImageReader mImageReader; /** Perform provided action on the trusted virtual display. */ public void performAction(@Action int actionCode) { try { mSession.performAction(actionCode); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ public ComputerControlSession(int displayId, @NonNull IVirtualDisplayCallback displayToken, @NonNull IComputerControlSession session) { Loading Loading @@ -174,6 +165,22 @@ public final class ComputerControlSession implements AutoCloseable { } } /** * Hand over full control of the automation session to the user. * * <p>All of the applications currently automated in the session are moved from the session's * display to the user's default display. No further automation is possible on these tasks, * although the session remains active and new applications may be launched via * {@link #launchApplication(String)}</p> */ public void handOverApplications() { try { mSession.handOverApplications(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Screenshot the current display content. * Loading Loading @@ -291,6 +298,15 @@ public final class ComputerControlSession implements AutoCloseable { } } /** Perform provided action on the trusted virtual display. */ public void performAction(@Action int actionCode) { try { mSession.performAction(actionCode); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Injects a touch event into the trusted virtual display. */ public void sendTouchEvent(@NonNull VirtualTouchEvent event) { try { Loading core/java/android/companion/virtual/computercontrol/IComputerControlSession.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ interface IComputerControlSession { /** Launches an application on the trusted virtual display. */ void launchApplication(in String packageName); /** Hand over full control of the automation session to the user. */ void handOverApplications(); /* Injects a tap event into the trusted virtual display. */ void tap(int x, int y); Loading libs/computercontrol/src/com/android/extensions/computercontrol/ComputerControlSession.java +12 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,18 @@ public final class ComputerControlSession implements AutoCloseable { mAccessibilityProxy.resetStabilityState(); } /** * Hand over full control of the automation session to the user. * * <p>All of the applications currently automated in the session are moved from the session's * display to the user's default display. No further automation is possible on these tasks, * although the session remains active and new applications may be launched via * {@link #launchApplication(String)}</p> */ public void handOverApplications() { mSession.handOverApplications(); } /** * Screenshot the current display content. * Loading services/companion/java/com/android/server/companion/virtual/computercontrol/ComputerControlSessionImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import com.android.internal.inputmethod.InputConnectionCommandHeader; import com.android.server.LocalServices; import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.pm.UserManagerInternal; import com.android.server.wm.ActivityTaskManagerInternal; import com.android.server.wm.WindowManagerInternal; import java.util.ArrayList; Loading Loading @@ -337,6 +338,12 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub notifyApplicationLaunchToStabilityCalculator(); } @Override public void handOverApplications() { Binder.withCleanCallingIdentity( () -> mInjector.moveAllTasks(mVirtualDisplayId, mMainDisplayId)); } @Override public void tap(@IntRange(from = 0) int x, @IntRange(from = 0) int y) throws RemoteException { cancelOngoingTouchGestures(); Loading Loading @@ -696,6 +703,7 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub private final WindowManagerInternal mWindowManagerInternal; private final InputMethodManagerInternal mInputMethodManagerInternal; private final UserManagerInternal mUserManagerInternal; private final ActivityTaskManagerInternal mActivityTaskManagerInternal; Injector(Context context) { mContext = context; Loading @@ -704,6 +712,8 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub mInputMethodManagerInternal = LocalServices.getService( InputMethodManagerInternal.class); mUserManagerInternal = LocalServices.getService(UserManagerInternal.class); mActivityTaskManagerInternal = LocalServices.getService( ActivityTaskManagerInternal.class); } public String getPermissionControllerPackageName() { Loading Loading @@ -758,5 +768,9 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub return mInputMethodManagerInternal.getComputerControlInputConnection( mUserManagerInternal.getUserAssignedToDisplay(displayId), displayId); } public void moveAllTasks(int fromDisplayId, int toDisplayId) { mActivityTaskManagerInternal.moveAllTasks(fromDisplayId, toDisplayId); } } } services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +3 −0 Original line number Diff line number Diff line Loading @@ -844,4 +844,7 @@ public abstract class ActivityTaskManagerInternal implements ActiveUids.Observer /** Unregisters a listener for handoff enablement changes. */ public abstract void unregisterHandoffEnablementListener( @NonNull HandoffEnablementListener listener); /** Moves all tasks from the source display to the destination display. */ public abstract void moveAllTasks(int fromDisplayId, int toDisplayId); } Loading
core/java/android/companion/virtual/computercontrol/ComputerControlSession.java +25 −9 Original line number Diff line number Diff line Loading @@ -122,15 +122,6 @@ public final class ComputerControlSession implements AutoCloseable { @Nullable private ImageReader mImageReader; /** Perform provided action on the trusted virtual display. */ public void performAction(@Action int actionCode) { try { mSession.performAction(actionCode); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** @hide */ public ComputerControlSession(int displayId, @NonNull IVirtualDisplayCallback displayToken, @NonNull IComputerControlSession session) { Loading Loading @@ -174,6 +165,22 @@ public final class ComputerControlSession implements AutoCloseable { } } /** * Hand over full control of the automation session to the user. * * <p>All of the applications currently automated in the session are moved from the session's * display to the user's default display. No further automation is possible on these tasks, * although the session remains active and new applications may be launched via * {@link #launchApplication(String)}</p> */ public void handOverApplications() { try { mSession.handOverApplications(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Screenshot the current display content. * Loading Loading @@ -291,6 +298,15 @@ public final class ComputerControlSession implements AutoCloseable { } } /** Perform provided action on the trusted virtual display. */ public void performAction(@Action int actionCode) { try { mSession.performAction(actionCode); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** Injects a touch event into the trusted virtual display. */ public void sendTouchEvent(@NonNull VirtualTouchEvent event) { try { Loading
core/java/android/companion/virtual/computercontrol/IComputerControlSession.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ interface IComputerControlSession { /** Launches an application on the trusted virtual display. */ void launchApplication(in String packageName); /** Hand over full control of the automation session to the user. */ void handOverApplications(); /* Injects a tap event into the trusted virtual display. */ void tap(int x, int y); Loading
libs/computercontrol/src/com/android/extensions/computercontrol/ComputerControlSession.java +12 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,18 @@ public final class ComputerControlSession implements AutoCloseable { mAccessibilityProxy.resetStabilityState(); } /** * Hand over full control of the automation session to the user. * * <p>All of the applications currently automated in the session are moved from the session's * display to the user's default display. No further automation is possible on these tasks, * although the session remains active and new applications may be launched via * {@link #launchApplication(String)}</p> */ public void handOverApplications() { mSession.handOverApplications(); } /** * Screenshot the current display content. * Loading
services/companion/java/com/android/server/companion/virtual/computercontrol/ComputerControlSessionImpl.java +14 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import com.android.internal.inputmethod.InputConnectionCommandHeader; import com.android.server.LocalServices; import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.pm.UserManagerInternal; import com.android.server.wm.ActivityTaskManagerInternal; import com.android.server.wm.WindowManagerInternal; import java.util.ArrayList; Loading Loading @@ -337,6 +338,12 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub notifyApplicationLaunchToStabilityCalculator(); } @Override public void handOverApplications() { Binder.withCleanCallingIdentity( () -> mInjector.moveAllTasks(mVirtualDisplayId, mMainDisplayId)); } @Override public void tap(@IntRange(from = 0) int x, @IntRange(from = 0) int y) throws RemoteException { cancelOngoingTouchGestures(); Loading Loading @@ -696,6 +703,7 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub private final WindowManagerInternal mWindowManagerInternal; private final InputMethodManagerInternal mInputMethodManagerInternal; private final UserManagerInternal mUserManagerInternal; private final ActivityTaskManagerInternal mActivityTaskManagerInternal; Injector(Context context) { mContext = context; Loading @@ -704,6 +712,8 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub mInputMethodManagerInternal = LocalServices.getService( InputMethodManagerInternal.class); mUserManagerInternal = LocalServices.getService(UserManagerInternal.class); mActivityTaskManagerInternal = LocalServices.getService( ActivityTaskManagerInternal.class); } public String getPermissionControllerPackageName() { Loading Loading @@ -758,5 +768,9 @@ final class ComputerControlSessionImpl extends IComputerControlSession.Stub return mInputMethodManagerInternal.getComputerControlInputConnection( mUserManagerInternal.getUserAssignedToDisplay(displayId), displayId); } public void moveAllTasks(int fromDisplayId, int toDisplayId) { mActivityTaskManagerInternal.moveAllTasks(fromDisplayId, toDisplayId); } } }
services/core/java/com/android/server/wm/ActivityTaskManagerInternal.java +3 −0 Original line number Diff line number Diff line Loading @@ -844,4 +844,7 @@ public abstract class ActivityTaskManagerInternal implements ActiveUids.Observer /** Unregisters a listener for handoff enablement changes. */ public abstract void unregisterHandoffEnablementListener( @NonNull HandoffEnablementListener listener); /** Moves all tasks from the source display to the destination display. */ public abstract void moveAllTasks(int fromDisplayId, int toDisplayId); }