Android 13에서는 앱 스트리밍 기능을 통해 휴대전화에서 연결된 기기로 앱을 스트리밍하고 이러한 기기가 앱과 상호작용할 수 있습니다. 새로운 COMPANION_DEVICE_APP_STREAMING 역할을 사용하면 앱이 연결된 원격 기기의 프록시를 만들고 관리하여 로컬 기기에서 원격 기기로 앱을 스트리밍할 수 있습니다. COMPANION_DEVICE_APP_STREAMING 역할을 보유한 앱은 가상 디스플레이를 만들고 디스플레이에 앱을 실행한 다음 실행된 앱의 동영상을 다른 기기로 스트리밍할 권한을 얻을 수 있습니다. 역할 보유자 앱은 마치 기기가 주변기기로 연결된 것처럼 원격 기기에서 수신한 입력 및 마이크 이벤트를 로컬 기기로 다시 삽입할 수도 있습니다.
앱 스트리밍은 가상 디스플레이를 활용하여 작동합니다. 가상 기기 관리자는 표시되는 기본 디스플레이와 별도로 가상 디스플레이를 만듭니다. 사용자가 앱 스트리밍을 시작하는 데 동의하면 앱이 가상 디스플레이에서 실행되거나 가상 디스플레이로 전송됩니다. 가상 디스플레이의 콘텐츠는 동영상 스트림으로 전송되어 연결된 기기에 표시됩니다.
가상 기기 관리자에는 VirtualDevice 인스턴스를 생성, 등록, 관리할 수 있는 API가 포함되어 있습니다.
VirtualDevice 인스턴스는 연결된 기기 및 관련 기능의 프록시입니다. VirtualDevice 인스턴스를 사용하면 연결된 기기가 다음을 실행하여 기기로 들어오는 앱 스트림을 수신하고 표시하고 상호작용할 수 있습니다.
CDM은 연결 상태를 관리하고 앱 스트리밍을 사용하기 위해 충족해야 하는 역할 요구사항을 적용합니다.
다음 그림은 앱 스트리밍 중 로컬 기기와 원격 기기 간의 상호작용을 보여줍니다.
그림 1. 앱 스트리밍 중 로컬 기기와 원격 기기 간의 상호작용
호환 앱 스트리밍 역할 구현
OEM은 COMPANION_DEVICE_APP_STREAMING 역할을 가진 앱을 구현하여 기기에서 풍부하고 안전한 교차 기기 환경을 지원할 수 있습니다.
앱 스트리밍을 사용 설정할 수 있는 가상 기기를 만들려면 앱이 COMPANION_DEVICE_APP_STREAMING 역할의 보유자여야 합니다. 역할이 부여되면 앱은 앱이 가상 기기를 만들 수 있게 해주는 CREATE_VIRTUAL_DEVICE 권한을 수신합니다. 역할 보유자는 연결된 기기의 프록시 역할을 하는 VirtualDevice 인스턴스를 만들어 앱 스트리밍을 구현해야 합니다. VirtualDevice 클래스는 다른 기기로 스트리밍하는 데 적합한 가상 디스플레이의 합성된 표면을 추출할 수 있는 메서드를 제공합니다. VirtualDevice 클래스는 원격 기기에서 발생하는 입력 이벤트를 로컬 기기에 삽입하는 API도 제공합니다. 이를 통해 로컬 기기에서 실행 중인 앱이 마치 원격 기기에서 원래 실행되는 것처럼 표시됩니다.
CDM AssociationRequest 인스턴스를 만들어 COMPANION_DEVICE_APP_STREAMING 역할을 요청합니다. 역할이 부여되면 앱이 CREATE_VIRTUAL_DEVICE 권한을 수신합니다.
VirtualDeviceManager#create()를 호출하여 VirtualDevice 인스턴스를 만듭니다. VirtualDevice 인스턴스를 사용하면 앱이 가상 디스플레이와 가상 입력을 만들고 관리할 수 있습니다.
가상 디스플레이에서 대기 중인 알림 인텐트를 실행하고 이 디스플레이의 동영상 캡처를 만듭니다.
연결된 기기에 연결을 만들고 연결된 기기로 가상 디스플레이를 스트리밍합니다.
VirtualDevice API를 통해 연결된 기기에서 로컬 기기로 입력 이벤트를 다시 삽입합니다.
사용자가 원격 기기에서 스트리밍 앱을 닫으면 스트림을 종료하고 VirtualDevice 인스턴스를 제거합니다. 이 시점에서 이전의 스트리밍 앱은 로컬 기기의 백그라운드에서 실행되며 연결이 종료됩니다.
필요한 경우 앱 스트리밍을 다시 시작하려면 연결된 기기에서 더 많은 신호를 기다립니다.
앱은 원격 기기 연결, CDM에 연결 상태 보고 및 CDD에 설명된 보안 요구사항 적용을 담당합니다.
COMPANION_DEVICE_APP_STREAMING 역할 보유자 요구사항
CDM은 사용자가 앱을 스트리밍하는 앱을 기기와 연결할 때 COMPANION_DEVICE_APP_STREAMING 역할을 부여합니다. 이 역할은 기기 프로필과 연결되므로 이 프로필과 일치하고 Play 스토어에 추가할 수 있는 앱을 일부 제어할 수 있습니다. COMPANION_DEVICE_APP_STREAMING 역할 요구사항 목록은 Android 역할을 참고하세요. 자세한 내용은 Google 담당자에게 문의해 주시기 바랍니다.
COMPANION_DEVICE_APP_STREAMING 역할 보유자 기능
앱 스트리밍을 실행하기 위해 COMPANION_DEVICE_APP_STREAMING 역할은 역할 보유자 앱에 다음과 같은 기능과 동작이 있다고 가정합니다.
다른 기기에 관한 연결을 만들고 관리합니다.
다음과 같은 방법으로, 잠금 해제된 디스플레이를 포함하여 신뢰할 수 있는 가상 디스플레이를 만들고 관리합니다.
가상 디스플레이에서 활동을 시작합니다.
연결된 기기의 스트리밍된 앱에서 발생한 이벤트를 다시 로컬 기기에 삽입합니다. 예를 들어, 태블릿의 특정 좌표에서 발생한 터치 이벤트를 휴대전화의 동일한 좌표에서 재생하는 것입니다.
스트리밍된 앱에서 오디오 데이터를 캡처합니다.
스트리밍된 앱에서 마이크를 사용하는 동안 로컬 기기의 마이크 스트림을 연결된 기기의 마이크 스트림으로 교체합니다.
스트리밍된 앱이 카메라를 사용하는 동안 로컬 기기의 카메라 스트림을 연결된 기기의 카메라 스트림으로 교체합니다.
로컬 기기에서 연결된 기기로 알림을 관리 및 스트리밍하고 알림에 맞는 조치를 취합니다.
로컬 기기에서 사용할 수 있는 앱 목록과 같은 로컬 기기의 메타데이터를 연결된 기기로 스트리밍합니다.
기기 인증을 요청합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Companion app streaming\n\nIn Android 13, the app streaming feature lets phones\nstream their apps to connected devices, and lets those devices interact with the\napps. A new [`COMPANION_DEVICE_APP_STREAMING`](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Permission/PermissionController/res/xml/roles.xml;drc=7816a6a2bfed3e4727f6b6f767a3e0f825dce880;l=1070)\nrole lets an app create and manage proxies for connected remote devices to\nstream apps from the local device to the remote device. The app holding the\n`COMPANION_DEVICE_APP_STREAMING` role can obtain permissions to create a virtual\ndisplay, launch an app on it, and then stream a video of the launched app to\nanother device. The role holder app can also inject input and microphone events\nreceived from a remote device back into the local device, as if that device were\nconnected as a peripheral.\n\nArchitecture\n------------\n\nBeginning in Android 13, the new [Virtual Device\nManager](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/companion/virtual/VirtualDeviceManager.java)\nand the [Companion Device Manager\n(CDM)](https://developer.android.com/reference/android/companion/CompanionDeviceManager)\nform the key building blocks to support app streaming and interaction with\nremote, connected devices.\n\n### Virtual Device Manager\n\nApp streaming works by taking advantage of *virtual displays*. The Virtual\nDevice Manager creates a virtual display that's separate from the visible\nprimary display. When the user consents to start streaming an app, the app is\nlaunched on, or transferred to, the virtual display. The contents of the virtual\ndisplay are transferred in a video stream to the connected device to be\ndisplayed.\n\nThe Virtual Device Manager includes APIs that enable the creation, registration,\nand management of\n[`VirtualDevice`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/companion/virtual/VirtualDeviceManager.java;drc=725dad7d717fc641d3ee3adb782270b82ee92cd8;l=152) instances.\n\nA `VirtualDevice` instance is a proxy for the connected device and its\ncapabilities. A `VirtualDevice` instance enables a connected device to receive,\ndisplay and interact with an incoming app stream, by doing the following:\n\n- Creating a [`VirtualDisplay`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/hardware/display/VirtualDisplay.java) instance intended to be displayed on a connected device's display.\n- Injecting a remote audio stream, such as from the connected device's microphone, into the local device for playback.\n- Injecting remote input events, such as the from the connected device's keyboard, into the local device for playback.\n\n### Companion Device Manager\n\nThe CDM manages the connectivity state and enforces the role requirements that\nmust be met to enable app streaming.\n\nThe following figure illustrates the interactions between the local and remote\ndevice during app streaming:\n\n**Figure 1.** Interactions between the local and remote devices during app streaming\n\nImplementation of the companion app streaming role\n--------------------------------------------------\n\nOEMs can implement an app with the `COMPANION_DEVICE_APP_STREAMING` role to\nenable a rich and secure cross-device experience on their devices.\n| **Note:** Only preinstalled priv-apps are allowed to hold the `COMPANION_DEVICE_APP_STREAMING` role. OEMs must ensure that the app is submitted for review as part of the device verification process. Reach out to your Google point of contact for more information.\n\nTo create a virtual device to enable app streaming, an app must be a role holder\nof the `COMPANION_DEVICE_APP_STREAMING` role. When the role is granted, the app\nreceives the\n[`CREATE_VIRTUAL_DEVICE`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/res/AndroidManifest.xml;drc=14543d1ec72202422373622ee818fe7549be5c7a;l=6440) permission, which enables\nthe app to create a virtual device. Role\nholders are expected to implement app streaming by creating a `VirtualDevice`\ninstance that acts as a proxy for a connected device. The `VirtualDevice` class\nprovides methods that enable the extraction of a composited surface of a virtual\ndisplay, suitable for streaming to another device. The `VirtualDevice` class\nalso provides APIs for injecting input events that occur on a remote device into\nthe local device, enabling an app that's running on a local device to appear as\nif it's running natively on a remote device.\n\nFollow these steps to implement the companion app streaming role:\n\n1. Create an app that requests the\n [`REQUEST_COMPANION_PROFILE_APP_STREAMING`](https://developer.android.com/reference/android/Manifest.permission#REQUEST_COMPANION_PROFILE_APP_STREAMING)\n permission in the manifest.\n\n2. Prompt the user to grant the app permission to perform app streaming.\n\n3. Create a CDM\n [`AssociationRequest`](https://developer.android.com/reference/android/companion/CompanionDeviceManager#associate(android.companion.AssociationRequest,%20java.util.concurrent.Executor,%20android.companion.CompanionDeviceManager.Callback))\n instance to request a `COMPANION_DEVICE_APP_STREAMING` role. The app\n receives the `CREATE_VIRTUAL_DEVICE` permission when the role is granted.\n\n4. Call\n [`VirtualDeviceManager#create()`](https://cs.android.com/android/platform/superproject/+/android-latest-release:frameworks/base/core/java/android/companion/virtual/VirtualDeviceManager.java;drc=725dad7d717fc641d3ee3adb782270b82ee92cd8;l=67)\n to create a `VirtualDevice` instance. With a `VirtualDevice` instance, the\n app can create and manage virtual displays and virtual inputs.\n\n5. Launch the notification's pending intent on the virtual display and create a\n video capture of that display.\n\n6. Create a connection to the connected device and stream the virtual display\n over to the connected device.\n\n7. Inject back input events from the connected device into the local device\n through the `VirtualDevice` APIs.\n\n8. When the user closes the streaming app on the remote device, end the stream\n and tear down the `VirtualDevice` instance. At this point, the previously\n streaming app runs in the background on the local device and the connection\n is closed.\n\n9. If needed, await more signals from the connected device to restart the app\n streaming.\n\nThe app is responsible for connecting to the remote device, reporting the\nconnectivity state to CDM, and enforcing security requirements as described in\nthe [CDD](/docs/compatibility/13/android-13-cdd#316_companion_device_pairing).\n| **Note:** Google offers a closed-source implementation called Cross Device Service that enables app streaming from any Android phone running Android 13 or higher, to a Chromebook. OEMs can preload the Cross Device Service APK under the priv-app directory.\n\n### COMPANION_DEVICE_APP_STREAMING role holder requirements\n\nThe CDM grants the `COMPANION_DEVICE_APP_STREAMING` role when the user\nassociates an app streaming app with a device. This role is associated with a\ndevice profile so there's some control over which apps can be added to the Play\nStore that match this profile. See [Android\nroles](/docs/core/permissions/android-roles)\nfor a list of the `COMPANION_DEVICE_APP_STREAMING` role requirements. Reach out\nto your Google point of contact for more information.\n\n### COMPANION_DEVICE_APP_STREAMING role holder capabilities\n\nTo perform app streaming, the `COMPANION_DEVICE_APP_STREAMING` role assumes that\nthe role holder app has the following capabilities and behaviors:\n\n- Create and manage connections to other devices.\n- Create and manage trusted virtual displays, including unlocked displays, as follows:\n - Start activities on the virtual display.\n - Inject events that happen on a streamed app on a connected device back on the local device, such as playing a touch event on the tablet at the same coordinates on the phone.\n - Capture audio data from the streamed app.\n - Replace the local device's microphone stream with a connected device's microphone stream while a streamed app is using the microphone.\n - Replace the local device's camera stream with a connected device's camera stream while a streamed app is using the camera.\n- Manage and stream notifications from the local device to the connected device, and take actions on notifications.\n- Stream metadata from the local device, such as the list of apps available on the local device, to the connected device.\n- Request device verification."]]