Loading core/api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3648,6 +3648,7 @@ package android.companion.virtual.camera { } public interface VirtualCameraCallback { method @FlaggedApi("android.companion.virtualdevice.flags.virtual_camera_on_open") public default void onOpenCamera(); method public default void onProcessCaptureRequest(int, long); method public void onStreamClosed(int); method public void onStreamConfigured(int, @NonNull android.view.Surface, @IntRange(from=1) int, @IntRange(from=1) int, int); core/java/android/companion/virtual/camera/IVirtualCameraCallback.aidl +14 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,20 @@ import android.view.Surface; */ interface IVirtualCameraCallback { /** * Called when the client application calls * {@link android.hardware.camera2.CameraManager#openCamera}. This is the earliest signal that * this camera will be used. At this point, no stream is opened yet, nor any configuration took * place. The owner of the virtual camera can use this as signal to prepare the camera and * reduce latency for when * {@link android.hardware.camera2.CameraDevice#createCaptureSession(SessionConfiguration)} is * called and before * {@link * android.hardware.camera2.CameraCaptureSession.StateCallback#onConfigured(CameraCaptureSession)} * is called. */ oneway void onOpenCamera(); /** * Called when one of the requested stream has been configured by the virtual camera service and * is ready to receive data onto its {@link Surface} Loading core/java/android/companion/virtual/camera/VirtualCameraCallback.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,14 @@ package android.companion.virtual.camera; import android.annotation.FlaggedApi; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.SystemApi; import android.companion.virtualdevice.flags.Flags; import android.graphics.ImageFormat; import android.hardware.camera2.CameraCaptureSession; import android.hardware.camera2.params.SessionConfiguration; import android.view.Surface; import java.util.concurrent.Executor; Loading @@ -34,9 +38,27 @@ import java.util.concurrent.Executor; @SystemApi public interface VirtualCameraCallback { /** * Called when the client application calls * {@link android.hardware.camera2.CameraManager#openCamera}. This is the earliest signal that * this camera will be used. At this point, no stream is opened yet, nor any configuration took * place. The owner of the virtual camera can use this as signal to prepare the camera and * reduce latency for when * {@link android.hardware.camera2.CameraDevice#createCaptureSession(SessionConfiguration)} is * called and before * {@link CameraCaptureSession.StateCallback#onConfigured(CameraCaptureSession)} * is called. */ @FlaggedApi(Flags.FLAG_VIRTUAL_CAMERA_ON_OPEN) default void onOpenCamera() { } /** * Called when one of the requested stream has been configured by the virtual camera service and * is ready to receive data onto its {@link Surface} * <p> * This corresponds to the client calling * {@link android.hardware.camera2.CameraDevice#createCaptureSession(SessionConfiguration)} * * @param streamId The id of the configured stream * @param surface The surface to write data into for this stream Loading core/java/android/companion/virtual/camera/VirtualCameraConfig.java +6 −0 Original line number Diff line number Diff line Loading @@ -351,6 +351,12 @@ public final class VirtualCameraConfig implements Parcelable { mExecutor = executor; } public void onOpenCamera() { if (Flags.virtualCameraOnOpen()) { mExecutor.execute(mCallback::onOpenCamera); } } @Override public void onStreamConfigured(int streamId, Surface surface, int width, int height, int format) { Loading core/java/android/companion/virtual/flags/flags.aconfig +10 −1 Original line number Diff line number Diff line Loading @@ -197,3 +197,12 @@ flag { description: "Enable VDM access for computer control" bug: "410570802" } flag { name: "virtual_camera_on_open" namespace: "virtual_devices" description: "Callback called when the virtual camera device is requested to be opened" bug: "409241122" is_exported: true } Loading
core/api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3648,6 +3648,7 @@ package android.companion.virtual.camera { } public interface VirtualCameraCallback { method @FlaggedApi("android.companion.virtualdevice.flags.virtual_camera_on_open") public default void onOpenCamera(); method public default void onProcessCaptureRequest(int, long); method public void onStreamClosed(int); method public void onStreamConfigured(int, @NonNull android.view.Surface, @IntRange(from=1) int, @IntRange(from=1) int, int);
core/java/android/companion/virtual/camera/IVirtualCameraCallback.aidl +14 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,20 @@ import android.view.Surface; */ interface IVirtualCameraCallback { /** * Called when the client application calls * {@link android.hardware.camera2.CameraManager#openCamera}. This is the earliest signal that * this camera will be used. At this point, no stream is opened yet, nor any configuration took * place. The owner of the virtual camera can use this as signal to prepare the camera and * reduce latency for when * {@link android.hardware.camera2.CameraDevice#createCaptureSession(SessionConfiguration)} is * called and before * {@link * android.hardware.camera2.CameraCaptureSession.StateCallback#onConfigured(CameraCaptureSession)} * is called. */ oneway void onOpenCamera(); /** * Called when one of the requested stream has been configured by the virtual camera service and * is ready to receive data onto its {@link Surface} Loading
core/java/android/companion/virtual/camera/VirtualCameraCallback.java +22 −0 Original line number Diff line number Diff line Loading @@ -16,10 +16,14 @@ package android.companion.virtual.camera; import android.annotation.FlaggedApi; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.SystemApi; import android.companion.virtualdevice.flags.Flags; import android.graphics.ImageFormat; import android.hardware.camera2.CameraCaptureSession; import android.hardware.camera2.params.SessionConfiguration; import android.view.Surface; import java.util.concurrent.Executor; Loading @@ -34,9 +38,27 @@ import java.util.concurrent.Executor; @SystemApi public interface VirtualCameraCallback { /** * Called when the client application calls * {@link android.hardware.camera2.CameraManager#openCamera}. This is the earliest signal that * this camera will be used. At this point, no stream is opened yet, nor any configuration took * place. The owner of the virtual camera can use this as signal to prepare the camera and * reduce latency for when * {@link android.hardware.camera2.CameraDevice#createCaptureSession(SessionConfiguration)} is * called and before * {@link CameraCaptureSession.StateCallback#onConfigured(CameraCaptureSession)} * is called. */ @FlaggedApi(Flags.FLAG_VIRTUAL_CAMERA_ON_OPEN) default void onOpenCamera() { } /** * Called when one of the requested stream has been configured by the virtual camera service and * is ready to receive data onto its {@link Surface} * <p> * This corresponds to the client calling * {@link android.hardware.camera2.CameraDevice#createCaptureSession(SessionConfiguration)} * * @param streamId The id of the configured stream * @param surface The surface to write data into for this stream Loading
core/java/android/companion/virtual/camera/VirtualCameraConfig.java +6 −0 Original line number Diff line number Diff line Loading @@ -351,6 +351,12 @@ public final class VirtualCameraConfig implements Parcelable { mExecutor = executor; } public void onOpenCamera() { if (Flags.virtualCameraOnOpen()) { mExecutor.execute(mCallback::onOpenCamera); } } @Override public void onStreamConfigured(int streamId, Surface surface, int width, int height, int format) { Loading
core/java/android/companion/virtual/flags/flags.aconfig +10 −1 Original line number Diff line number Diff line Loading @@ -197,3 +197,12 @@ flag { description: "Enable VDM access for computer control" bug: "410570802" } flag { name: "virtual_camera_on_open" namespace: "virtual_devices" description: "Callback called when the virtual camera device is requested to be opened" bug: "409241122" is_exported: true }