Automobile video screen projection method, system and equipment based on Android window copying
By using Android window copying technology to create off-screen windows and SurfaceControl mirrors, the problem of high coupling between the initiating and receiving ends in car video projection is solved. This achieves low resource consumption, low latency, and high stability video projection effects, suitable for video content synchronization and independent control across multiple screens in a car cabin.
Patent Information
- Application Number
- CN202511528912.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2026-02-06
AI Technical Summary
Existing car video projection technologies suffer from high coupling between the initiating and receiving ends, poor stability, high resource consumption, high latency, and video quality degradation, failing to meet users' needs for projection stability, flexibility, and resource efficiency.
The method adopts Android window copying, which decouples the initiating end and the receiving end by creating an off-screen window and a SurfaceControl mirror. It utilizes the mirroring and binding mechanism of the SurfaceControl object to achieve unencoded sharing and synchronous display of video content.
It enables independent operation of the initiating and receiving ends, reduces resource consumption and latency, maintains the original video quality, and improves the stability and flexibility of screen projection, making it suitable for synchronizing video content in multi-screen car cabins.
Smart Images

Figure CN121478211A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive electronics and multimedia transmission technology, and in particular to a method, system and device for automotive video projection based on Android window copying. Background Technology
[0002] With the rapid development of automotive intelligence and in-cabin entertainment, users' demand for sharing video content between multiple screens in the car is increasing. Automotive video projection technology has become one of the key functions for improving the in-cabin user experience. Currently, the mainstream automotive video projection technologies on the market mainly rely on three types of solutions, but all of them have significant shortcomings and cannot meet users' needs for projection stability, flexibility, and resource efficiency.
[0003] The first type is a screen mirroring solution based on streaming media transmission. This solution encodes the video content of the initiating device into streaming media data, which is then transmitted to the receiving device via a network (such as WiFi or Bluetooth). The receiving device then decodes and plays the video content. However, this solution has extremely high network bandwidth requirements. In the complex electromagnetic environment of a car or in scenarios with unstable network signals, problems such as video stuttering and interruptions are prone to occur. At the same time, the encoding and decoding process of streaming media introduces significant delays, making it unsuitable for video mirroring scenarios with high real-time requirements.
[0004] The second type is screen mirroring-based projection solutions. This solution directly mirrors the entire screen of the initiating device to the receiving device, achieving synchronized display of screen content. Although its latency is lower than streaming media transmission solutions, all screen operations on the initiating device are synchronized to the receiving device, resulting in redundant content displayed on the receiving end. More importantly, this solution is heavily dependent on the operating status of the initiating device. Once the initiating device exits the video playback interface, switches applications, or goes into sleep mode, video playback on the receiving end will be immediately interrupted, resulting in extremely poor stability.
[0005] The third type is screen mirroring solutions based on video recording. This solution captures video areas on the screen in real time using the screen recording function of the initiating device, encodes the captured images into a video file, and then transmits it to the receiving end for playback. While this solution can selectively capture video content and avoid redundant transmission of non-video areas, the screen recording process consumes a significant amount of CPU and GPU resources on the initiating device, leading to decreased performance and increased power consumption. Furthermore, the complete recording-encoding-transmission-decoding chain generates cumulative latency, and the video quality is often compressed during encoding to balance transmission efficiency, resulting in decreased image clarity at the receiving end, especially in high-resolution video scenarios such as 4K, where the quality degradation is even more pronounced.
[0006] The three types of solutions mentioned above share common core drawbacks: First, the initiating and receiving ends are highly coupled, making independent operation impossible; any state change at the initiating end directly affects playback at the receiving end. Second, resource utilization is low; the bandwidth consumption of streaming media transmission, the full data transmission of screen mirroring, and the hardware resource consumption of screen recording solutions all fail to meet the design requirements of automotive electronic systems for low power consumption and high efficiency. These shortcomings severely restrict the application experience of automotive video projection technology, necessitating a projection solution that can decouple the initiating and receiving ends, consume low resources, and achieve high stability. Summary of the Invention
[0007] To overcome the problems in the prior art, this invention provides a method, system, and device for car video projection based on Android window copying. Based on the SurfaceControl mechanism of the Android system, the invention achieves decoupling between the initiating end and the receiving end through the creation of an off-screen window, mirroring and rebinding of SurfaceControl, thus overcoming the defects in existing car video projection technologies such as poor stability, high coupling between the initiating end and the receiving end, high resource consumption, high latency, and video quality degradation.
[0008] To achieve the aforementioned objectives, the present invention adopts the following technical solution:
[0009] In a first aspect, the present invention provides a method for projecting car videos based on Android window copying, the method comprising:
[0010] Create an off-screen window and load the video rendering view, and obtain the SurfaceControl object corresponding to the off-screen window;
[0011] Create a mirrored SurfaceControl object using the SurfaceControl object of the off-screen window as the source;
[0012] A SurfaceView component is created in the receiving device, the SurfaceControl object corresponding to the SurfaceView is obtained, and the parent of the mirrored SurfaceControl object is bound to the SurfaceControl object of the receiving SurfaceView to realize video projection display.
[0013] Preferably, creating an off-screen window and loading a video rendering view includes: creating an off-screen window in the Android initiating device, the off-screen window serving as a background rendering carrier for video content; adding a rendering view of the video player to the off-screen window, so that the rendering output of the video player directly points to the off-screen window, the rendering view being associated with the playback control logic of the video player for real-time rendering of video frame data.
[0014] Preferably, obtaining the SurfaceControl object of the off-screen window includes: accessing the ViewRootImpl instance corresponding to the top-level layout of the rendering view through reflection, obtaining the mSurfaceControl member variable of the ViewRootImpl instance, and using it as the SurfaceControl object of the off-screen window.
[0015] Preferably, the step of creating a mirrored SurfaceControl object using the SurfaceControl object of the off-screen window as the source object includes: when creating the mirrored SurfaceControl object, setting the resolution and pixel format of the mirrored content to be consistent with the rendering content of the off-screen window corresponding to the source SurfaceControl object; the mirrored SurfaceControl object and the source SurfaceControl object sharing the same video rendering data; and when the rendering content of the off-screen window corresponding to the source SurfaceControl object changes, the content of the mirrored SurfaceControl object is updated synchronously.
[0016] When creating multiple mirrored SurfaceControl objects, they are respectively bound to multiple receiving devices in the car cabin, enabling simultaneous video projection from a single initiator to multiple receiving devices.
[0017] Preferably, the step of creating a SurfaceView component in the receiving device, obtaining the SurfaceControl object corresponding to the SurfaceView, and binding the parent of the mirrored SurfaceControl object to the SurfaceControl object of the receiving SurfaceView to realize video projection display includes: creating a SurfaceView component for displaying projection content in the receiving device, wherein the SurfaceView component has an independent Surface rendering buffer;
[0018] By calling the reparent method of the SurfaceControl.Transaction class in the Android system, the parent of the created mirrored SurfaceControl object is bound to the position and scaling parameters of the SurfaceControl object corresponding to the SurfaceView component on the receiving end. After the binding is completed, the rendered content of the mirrored SurfaceControl object is directly output to the SurfaceView component on the receiving end, so that the projected content is displayed in the SurfaceView component on the receiving end.
[0019] The receiving device includes at least one of the following: a passenger-side screen and a rear-seat screen in a car;
[0020] The size of the SurfaceView component is matched to the screen resolution of the car's receiver device.
[0021] Preferably, the method further includes synchronization control between the initiating end and the receiving end, which includes: when the initiating end performs video switching and progress adjustment operations, updating the video data of the rendered view in the off-screen window, and the update is passed to the mirror SurfaceControl object through the SurfaceControl synchronization mechanism so that the content displayed on the receiving end changes synchronously.
[0022] Preferably, the method further includes independent control of the receiving end, which includes: the receiving end adjusting the visibility and scaling parameters of the mirrored SurfaceControl object through SurfaceControl.Transaction to realize the display / hide and full-screen / window mode switching operations of the screen-projected content, and the operation does not affect the video playback status of the initiating end.
[0023] Secondly, the present invention provides a car video projection device based on Android window copying, including an initiating device and at least one receiving device; the initiating device is an in-vehicle host running an Android system, used to create an off-screen window, obtain a SurfaceControl object, and create a mirrored SurfaceControl object; the receiving device is a passenger-side screen or rear-seat screen of the car, used to create a SurfaceView component and bind the mirrored SurfaceControl object; the initiating device and the receiving device communicate through the in-vehicle internal bus to pass the handle of the mirrored SurfaceControl object.
[0024] Thirdly, the present invention provides a car video projection system based on Android window copying, the system comprising:
[0025] The acquisition module is used to create an off-screen window and load the video rendering view, and to acquire the SurfaceControl object corresponding to the off-screen window.
[0026] A building module is used to create a mirrored SurfaceControl object from the SurfaceControl object of the off-screen window;
[0027] The screen projection module is used to create a SurfaceView component in the receiving device, obtain the SurfaceControl object corresponding to the SurfaceView, and bind the parent of the mirrored SurfaceControl object to the SurfaceControl object of the receiving SurfaceView to realize video projection display.
[0028] Fourthly, the present invention provides an electronic device, the electronic device comprising:
[0029] At least one processor; and
[0030] A memory communicatively connected to the at least one processor; wherein,
[0031] The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the method described in any one of the first aspects.
[0032] Compared with the closest existing technology, the present invention has the following advantages:
[0033] This invention proposes a method, system, and device for car video projection based on Android window copying. By using an off-screen window and a SurfaceControl mirroring mechanism, the receiving end directly binds to the mirrored SurfaceControl object, without relying on the application lifecycle of the initiating end. Even if the initiating end exits the video playback application, switches to the background, or the device goes to sleep, the receiving end can still continuously obtain the rendering data of the mirrored SurfaceControl object, avoiding projection interruption and effectively improving stability compared to existing solutions.
[0034] In this invention, the initiating end can independently perform operations such as video switching, progress adjustment, and application switching. The operation commands only apply to the rendering view of the window outside the screen and are automatically synchronized to the receiving end through the SurfaceControl synchronization mechanism, without requiring any additional operation from the receiving end. At the same time, the receiving end can independently control the display status of the projected content, such as switching between full-screen / window mode and adjusting brightness, realizing bidirectional independent control between the initiating end and the receiving end.
[0035] This solution utilizes the native SurfaceControl mirroring mechanism of the Android system, eliminating the need for encoding, decoding, or streaming video content. It achieves content synchronization solely through the sharing and binding of the Surface buffer, effectively reducing CPU resource usage compared to screen recording solutions and reducing network bandwidth usage by 100% compared to streaming media solutions. This meets the design requirements of low power consumption and high efficiency for automotive electronic systems.
[0036] In this invention, the process of binding the SurfaceControl image and the reparent is a low-level operation of the Android system, with a latency controlled within 10ms, which is far lower than the 100ms-500ms latency of existing solutions. At the same time, since no encoding or compression is required, the video content retains its original image quality without any loss of clarity, making it especially suitable for high-resolution video projection scenarios such as 4K and 8K. Attached Figure Description
[0037] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.
[0038] Figure 1 This is a flowchart of a car video projection method based on Android window copying provided by the present invention;
[0039] Figure 2 This is a schematic diagram illustrating the binding of the SurfaceControl image and the receiving end provided by this invention;
[0040] Figure 3 This is a schematic diagram of the structure of a car video projection system based on Android window copying provided by the present invention;
[0041] Figure 4 This is an internal structural diagram of the electronic device provided by the present invention. Detailed Implementation
[0042] The embodiments of the technical solution of the present invention will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of the present invention and are therefore merely examples, and should not be construed as limiting the scope of protection of the present invention.
[0043] It should be noted that, unless otherwise stated, the technical or scientific terms used in this application should have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0044] This invention provides a method, system, and device for video projection into a car based on Android window copying; it is particularly suitable for scenarios involving the synchronization and independent control of video content between multiple screens in a car cabin, and can be applied to multi-screen interactive systems such as the driver's screen, passenger's screen, and rear entertainment screen. It aims to solve the following technical problems:
[0045] Question 1: In the existing solution, when the initiating end exits playback, switches applications, or the device state changes, the video playback on the receiving end is interrupted due to stability issues.
[0046] Question 2: The initiator and receiver cannot operate independently, and the receiver must rely entirely on the initiator's state for flexibility.
[0047] Question 3: High bandwidth usage and high hardware resource consumption during streaming media transmission, screen mirroring, or screen recording;
[0048] Question 4: High latency and video quality loss caused by encoding, transmission, and decoding links.
[0049] Example 1: Please refer to Figure 1 Embodiment 1 of the present invention provides a method for casting car videos based on Android window copying, the method specifically includes the following steps:
[0050] S101 Creates an off-screen window and loads the video rendering view, and obtains the SurfaceControl object corresponding to the off-screen window;
[0051] S102 uses the SurfaceControl object of the off-screen window as the source to create a mirrored SurfaceControl object;
[0052] S103 creates a SurfaceView component in the receiving device and obtains the SurfaceControl object corresponding to the SurfaceView; binds the parent of the mirrored SurfaceControl object to the SurfaceControl object of the receiving SurfaceView to realize video projection display.
[0053] In the above embodiments, the mirrorSurface method of SurfaceControl is used to create a mirror SurfaceControl synchronized with the source window, thereby realizing unencoded sharing of video content and solving the problems of encoding delay and quality loss in existing solutions.
[0054] This invention creates an off-screen window independent of the foreground application as a background carrier for video rendering, so that the video rendering process is not affected by the lifecycle of the initiating application, thus solving the stability problem of playback interruption on the receiving end caused by the operation of the initiating end.
[0055] By using the reparent method of SurfaceControl.Transaction, the mirrored SurfaceControl is bound to the SurfaceControl of the receiving SurfaceView, thereby decoupling the initiating end and the receiving end, supporting independent operation of both parties, and solving the flexibility deficiency of the existing solution;
[0056] This invention creates multiple mirrored SurfaceControl objects and binds them to different receiving ends, enabling simultaneous screen projection from a single initiating end to multiple receiving ends. Each receiving end can independently control its display status, thus expanding the applicability of screen projection scenarios.
[0057] In the above embodiments, step S102, which involves creating an off-screen window and loading the video rendering view, and obtaining the SurfaceControl object corresponding to the off-screen window, specifically includes:
[0058] An off-screen window is created on the Android initiating device, which serves as the background rendering carrier for the video content. The rendering view of the video player is added to the off-screen window, so that the rendering output of the video player directly points to the off-screen window. The rendering view is associated with the playback control logic of the video player and is used to render video frame data in real time.
[0059] In the above embodiments, step S101, obtaining the SurfaceControl object of the off-screen window, includes: accessing the ViewRootImpl instance corresponding to the top-level layout of the rendering view through reflection mechanism, obtaining the mSurfaceControl member variable of the ViewRootImpl instance, and using it as the SurfaceControl object of the off-screen window.
[0060] In the above embodiments, step S102, which uses the SurfaceControl object of the off-screen window as the source object, to create a mirror SurfaceControl object includes: when creating the mirror SurfaceControl object, setting the resolution and pixel format of the mirror content to be consistent with the rendering content of the off-screen window corresponding to the source SurfaceControl object; the mirror SurfaceControl object and the source SurfaceControl object share the same video rendering data; when the rendering content of the off-screen window corresponding to the source SurfaceControl object changes, the content of the mirror SurfaceControl object is updated synchronously.
[0061] When creating multiple mirrored SurfaceControl objects, they are respectively bound to multiple receiving devices in the car cabin, enabling simultaneous video projection from a single initiator to multiple receiving devices.
[0062] In the above embodiments, step S103, which involves creating a SurfaceView component in the receiving device, obtaining the SurfaceControl object corresponding to the SurfaceView, and binding the parent of the mirrored SurfaceControl object to the SurfaceControl object of the receiving SurfaceView, includes: creating a SurfaceView component in the receiving device for displaying the projected content, wherein the SurfaceView component has an independent Surface rendering buffer;
[0063] By calling the reparent method of the SurfaceControl.Transaction class in the Android system, the parent of the created mirrored SurfaceControl object is bound to the position and scaling parameters of the SurfaceControl object corresponding to the SurfaceView component on the receiving end. After the binding is completed, the rendered content of the mirrored SurfaceControl object is directly output to the SurfaceView component on the receiving end, so that the projected content is displayed in the SurfaceView component on the receiving end.
[0064] The receiving device includes at least one of the following: a passenger-side screen and a rear-seat screen in a car;
[0065] The size of the SurfaceView component is matched to the screen resolution of the car's receiver device.
[0066] In one embodiment, in addition to the steps S101-S103 described above, the method proposed in this embodiment also includes synchronization control between the initiating end and the receiving end, which includes: when the initiating end performs video switching and progress adjustment operations, updating the video data of the rendered view in the off-screen window, and the update is passed to the mirror SurfaceControl object through the SurfaceControl synchronization mechanism so that the content displayed on the receiving end changes synchronously.
[0067] It also includes independent control on the receiving end: the receiving end can adjust the visibility and scaling parameters of the mirrored SurfaceControl object through SurfaceControl.Transaction to realize the display / hide and full-screen / window mode switching operations of the screen-projected content, and the operation does not affect the video playback status of the initiating end.
[0068] Through the above embodiments, the following effects are achieved in a multi-screen scenario within a car cockpit:
[0069] Stability verification: When the initiating device exits the video app, switches to the navigation app, or goes to sleep, video playback on the passenger screen and the rear screen continues without interruption; after 4 hours of continuous screen mirroring, no issues such as lag or image distortion occurred.
[0070] Delay verification: The time difference between the operation at the initiating end and the display at the receiving end was captured using a high-speed camera. The average delay was measured to be 8.3ms, which is much lower than the lowest delay of existing solutions.
[0071] Resource consumption verification: By using the adb command of the Android system to check the CPU and memory usage, when the screen is cast from the initiating end, the CPU usage is 5%-8%, the memory usage increases by 50-80MB, and the resource consumption is significantly reduced.
[0072] Image quality verification: When casting 4K resolution video, the image clarity and color reproduction of the receiving end are detected by image quality analysis software. The difference rate between the receiving end and the original image of the sending end is less than 1%, with no obvious quality loss.
[0073] Example 2: To make the technical solution of the present invention clearer, the following provides a specific embodiment of the present invention in the context of a multi-screen projection scenario in a car cabin. This embodiment uses the car's in-vehicle host as the initiator (equipped with Android 12 or above system), and the passenger screen and the rear dual screens as the receiving end, and details the implementation process of the present invention.
[0074] (a) Prerequisites for the Implementation Example
[0075] Hardware environment: The initiator (vehicle host) has at least 2GB of RAM and a GPU that supports OpenGL ES 3.2 or higher; the receiver (passenger screen, rear screen) has an independent display controller and supports communication with the initiator via an internal bus (such as LVDS, MIPI);
[0076] Software environment: Both the initiating and receiving ends are equipped with Android 12 or above, supporting the mirrorSurface and reparent methods of SurfaceControl; the initiating end is pre-installed with a video playback application (such as an in-vehicle video APP), and the receiving end is pre-installed with a screen mirroring service, which is used to create a SurfaceView and bind the mirror SurfaceControl.
[0077] (II) Specific Implementation Steps
[0078] 1. The initiating end creates an off-screen window and loads the rendered view.
[0079] When the video playback app on the vehicle-mounted unit (initiator) starts, it calls the WindowManager class of the Android system to create an off-screen window. By setting the type parameter of WindowManager.LayoutParams to TYPE_APPLICATION_OVERLAY and the flags parameter to FLAG_NOT_TOUCHABLE | FLAG_NOT_FOCUSABLE | FLAG_HIDE_NAVIGATION, the window is not displayed on the physical screen of the vehicle-mounted unit and does not respond to touch and focus events.
[0080] Create a rendering view for the video player (such as SurfaceView or TextureView), and set the size of the rendering view to match the video resolution (such as 1920×1080); call the addView method of WindowManager to add the rendering view to the off-screen window created in step 1, and complete the binding between the rendering view and the off-screen window;
[0081] The video playback app initializes the player kernel (such as ExoPlayer), sets the player's output Surface to the rendering view's Surface, and enables the video frames decoded by the player to be directly rendered to an off-screen window.
[0082] 2. The initiating end obtains the SurfaceControl object of the off-screen window.
[0083] The video playback app uses reflection to call the getParent() method of the rendering view to obtain the ViewRootImpl instance corresponding to its top-level layout. Since the Android system does not directly provide a public access interface for ViewRootImpl, it is necessary to access the mParent member variable of the View class through reflection and trace upwards layer by layer to ViewRootImpl.
[0084] Reflection is used to obtain the mSurfaceControl member variable of the ViewRootImpl instance, which is the SurfaceControl object corresponding to the off-screen window; the validity of the object is verified by the getHandle() method of SurfaceControl to ensure that it has been successfully associated with the Surface buffer of the off-screen window.
[0085] 3. The initiating end creates a mirrored SurfaceControl object.
[0086] The video playback app calls the SurfaceControl.mirrorSurface() method, passing in the source SurfaceControl object obtained in step 2, to create two mirrored SurfaceControl objects (corresponding to the passenger screen and the rear screen respectively); the parameters of this method are set as follows: mirrorSource = source SurfaceControl, width = 1920, height = 1080, format = PixelFormat.RGBA_8888, to ensure that the resolution and pixel format of the mirrored content are consistent with the source content;
[0087] Call the setVisibility method of the SurfaceControl.Transaction class to set the initial state of the two mirrored SurfaceControl objects to "VISIBLE", and commit the transaction through the apply() method to complete the creation and state initialization of the mirrored SurfaceControl.
[0088] 4. Bind the mirror SurfaceControl object to the receiving end.
[0089] The screen mirroring service between the passenger screen and the rear screen establishes communication with the initiator through the vehicle's internal bus (such as MIPI) and receives the mirrored SurfaceControl object handle sent by the initiator (obtained through SurfaceControl.getHandle()).
[0090] The screen mirroring service for the passenger side screen creates a SurfaceView component, sets the size of the SurfaceView to the physical resolution of the passenger side screen (e.g., 1280×720), and calls the SurfaceView.getHolder().addCallback() method to listen for the Surface creation event; after the Surface is created, it obtains the SurfaceControl object corresponding to the SurfaceView (accessing the mSurfaceControl member variable of the SurfaceView through reflection).
[0091] The screen mirroring receiving service for the passenger screen creates a SurfaceControl.Transaction instance, calls the reparent() method to set the parent of the mirrored SurfaceControl object to the SurfaceControl object of the SurfaceView, and sets the position and scaling parameters of the mirrored SurfaceControl object (e.g., scaling to 1280×720 and centering it); calls the apply() method of Transaction to commit the transaction, completing the binding between the mirrored SurfaceControl and the passenger screen SurfaceView. At this point, the passenger screen begins to display the mirrored video.
[0092] The screen mirroring receiving service for the rear screen repeats steps 2 and 3 above, binding another mirrored SurfaceControl object to achieve screen mirroring display for the rear screen.
[0093] 5. Synchronization control and independent operation of the initiating and receiving ends
[0094] Synchronization control at the initiator: When the user performs the "switch video" operation in the video playback APP of the in-vehicle host (initiator), the APP updates the video source of the player, and the decoding frame of the new video is synchronously rendered to the off-screen window through the rendering view; after the source SurfaceControl object detects the change in the content of the Surface buffer, it automatically synchronizes to the two mirror SurfaceControl objects, and the SurfaceView of the passenger screen and the rear screen displays the new video content in real time. The entire synchronization process has a delay of less than 10ms.
[0095] Independent operation on the initiating end: When the user switches to the navigation application on the initiating end (the video playback app is sent to the background), the off-screen window continues to run (by setting the window's persistent property to true), and the player continues to render video frames to the off-screen window; since the receiving end is bound to the mirrored SurfaceControl object, it is not affected by the application switching on the initiating end, and the video playback on the passenger screen and the rear screen is not interrupted;
[0096] Independent operation on the receiving end: When the user performs the "full-screen display" operation on the passenger screen, the passenger screen's projection receiving service creates a new SurfaceControl.Transaction, adjusts the scaling parameters of the mirrored SurfaceControl object to the full-screen size, and commits the transaction. After that, the passenger screen achieves full-screen display. This operation does not affect the projection status of the initiating end and the rear screen. When the user performs the "pause projection" operation on the rear screen, the rear screen's projection receiving service calls the Transaction's setVisibility method to set the mirrored SurfaceControl object to "invisible" (INVISIBLE). The rear screen stops displaying the projection content, and the projection of the initiating end and the passenger screen is not affected.
[0097] (III) Verification of the effects of the embodiments
[0098] Through the above embodiments, the following effects are achieved in a multi-screen scenario within a car cockpit:
[0099] Stability verification: When the initiating device exits the video app, switches to the navigation app, or goes to sleep, video playback on the passenger screen and the rear screen continues without interruption; after 4 hours of continuous screen mirroring, no issues such as lag or image distortion occurred.
[0100] Delay verification: The time difference between the operation at the initiating end and the display at the receiving end was captured by a high-speed camera. The average delay was measured to be 8.3ms, which is much lower than the minimum delay of 100ms of the existing solution.
[0101] Resource consumption verification: By checking CPU and memory usage using the adb command of the Android system, the CPU usage of the initiating end is 5%-8% (40%-50% for screen recording), and the memory usage increases by 50-80MB (200-300MB for streaming media), indicating a significant reduction in resource consumption;
[0102] Image quality verification: When casting 4K resolution video, the image clarity and color reproduction of the receiving end are detected by image quality analysis software. The difference rate between the receiving end and the original image of the sending end is less than 1%, with no obvious quality loss.
[0103] Example 3: Example 3 of the present invention provides a car video projection device based on Android window copying, including an initiating device and at least one receiving device; the initiating device is an in-vehicle host running the Android system, used to create an off-screen window, obtain a SurfaceControl object, and create a mirrored SurfaceControl object; the receiving device is the passenger-side screen or rear-seat screen of the car, used to create a SurfaceView component and bind the mirrored SurfaceControl object; as shown Figure 2The diagram shows the binding of a SurfaceControl image to a receiving device. The initiating device and the receiving device communicate via the vehicle's internal bus, transferring the handle to the SurfaceControl image object. Figure 2 The left side shows the generation relationship between the source SurfaceControl and the mirror SurfaceControl at the initiating end, and marks the calling parameters of the mirrorSurface method; Figure 2 The right side shows the binding process between the receiving SurfaceView and its mirrored SurfaceControl, annotating the parameter settings of the reparent method (parent SurfaceControl, position, scaling parameters), demonstrating the technical details of cross-platform binding.
[0104] Example 4: Based on the same inventive concept as Example 1, Example 4 of this application also provides an Android window copying-based car video projection system for implementing the above-described Android window copying-based car video projection method. The solution provided by this system is similar to the implementation scheme described in the above-described examples. Therefore, the specific limitations of one or more Android window copying-based car video projection system embodiments provided below can be found in the limitations of the Android window copying-based car video projection method described above, and will not be repeated here.
[0105] In one embodiment, Embodiment 3 of the present invention provides a car video projection system based on Android window copying, the system as follows: Figure 3 As shown, it includes: an acquisition module 210, a construction module 220, and a projection display module 230, wherein:
[0106] The acquisition module 210 is used to create an off-screen window and load a video rendering view, and to acquire the SurfaceControl object corresponding to the off-screen window.
[0107] Module 220 is used to create a mirrored SurfaceControl object from the SurfaceControl object of the off-screen window.
[0108] The screen projection module 230 is used to create a SurfaceView component in the receiving device, obtain the SurfaceControl object corresponding to the SurfaceView, and bind the parent of the mirrored SurfaceControl object to the SurfaceControl object of the receiving SurfaceView to realize video projection display.
[0109] In one embodiment, an electronic device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown. The electronic device includes a processor, memory, communication interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements the car video projection method based on Android window copying as described in any of steps S101 to S103. The display screen can be a liquid crystal display (LCD) or an e-ink display. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.
[0110] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0111] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0112] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0113] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0114] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0115] The above are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of the claims of the present invention pending approval.
Claims
1. A method for projecting car video based on Android window copying, characterized in that, The method includes: Create an off-screen window and load the video rendering view, and obtain the SurfaceControl object corresponding to the off-screen window; Create a mirrored SurfaceControl object using the SurfaceControl object of the off-screen window as the source; A SurfaceView component is created in the receiving device, the SurfaceControl object corresponding to the SurfaceView is obtained, and the parent of the mirrored SurfaceControl object is bound to the SurfaceControl object of the receiving SurfaceView to realize video projection display.
2. The method according to claim 1, characterized in that, The process of creating an off-screen window and loading a video rendering view includes: creating an off-screen window in the Android initiating device, the off-screen window serving as a background rendering carrier for video content; adding a rendering view of the video player to the off-screen window, so that the rendering output of the video player directly points to the off-screen window, the rendering view being associated with the playback control logic of the video player for real-time rendering of video frame data.
3. The method according to claim 1, characterized in that, The step of obtaining the SurfaceControl object of the off-screen window includes: accessing the ViewRootImpl instance corresponding to the top-level layout of the rendering view through reflection, obtaining the mSurfaceControl member variable of the ViewRootImpl instance, and using it as the SurfaceControl object of the off-screen window.
4. The method according to claim 1, characterized in that, The process of creating a mirrored SurfaceControl object using the SurfaceControl object of the off-screen window as the source object includes: when creating the mirrored SurfaceControl object, setting the resolution and pixel format of the mirrored content to be consistent with the rendering content of the off-screen window corresponding to the source SurfaceControl object; the mirrored SurfaceControl object and the source SurfaceControl object sharing the same video rendering data; and when the rendering content of the off-screen window corresponding to the source SurfaceControl object changes, the content of the mirrored SurfaceControl object is updated synchronously. When creating multiple mirrored SurfaceControl objects, they are respectively bound to multiple receiving devices in the car cabin, enabling simultaneous video projection from a single initiator to multiple receiving devices.
5. The method according to claim 1, characterized in that, The step of creating a SurfaceView component in the receiving device, obtaining the SurfaceControl object corresponding to the SurfaceView, and binding the parent of the mirrored SurfaceControl object to the SurfaceControl object of the receiving SurfaceView to realize video projection display includes: creating a SurfaceView component for displaying projection content in the receiving device, wherein the SurfaceView component has an independent Surface rendering buffer; By calling the reparent method of the SurfaceControl.Transaction class in the Android system, the parent of the created mirrored SurfaceControl object is bound to the position and scaling parameters of the SurfaceControl object corresponding to the SurfaceView component on the receiving end. After the binding is completed, the rendered content of the mirrored SurfaceControl object is directly output to the SurfaceView component on the receiving end, so that the projected content is displayed in the SurfaceView component on the receiving end. The receiving device includes at least one of the following: a passenger-side screen and a rear-seat screen in a car; The size of the SurfaceView component is matched to the screen resolution of the car's receiver device.
6. The method according to claim 1, characterized in that, The method also includes synchronization control between the initiating end and the receiving end, which includes: when the initiating end performs video switching and progress adjustment operations, updating the video data of the rendered view in the off-screen window, and the update is passed to the mirror SurfaceControl object through the SurfaceControl synchronization mechanism so that the content displayed on the receiving end changes synchronously.
7. The method according to claim 1, characterized in that, The method also includes independent control of the receiving end, which includes: the receiving end adjusting the visibility and scaling parameters of the mirrored SurfaceControl object through SurfaceControl.Transaction to realize the display / hide and full-screen / window mode switching operations of the screen projection content, and the operation does not affect the video playback status of the initiating end.
8. A car video projection device based on Android window copying, characterized in that, It includes an initiating device and at least one receiving device; the initiating device is an in-vehicle host running the Android system, used to create an off-screen window, obtain a SurfaceControl object, and create a mirrored SurfaceControl object; the receiving device is the passenger-side screen or rear screen of the car, used to create a SurfaceView component and bind the mirrored SurfaceControl object; the initiating device and the receiving device communicate through the in-vehicle internal bus to pass the handle of the mirrored SurfaceControl object.
9. A car video projection system based on Android window copying, characterized in that, The system includes: The acquisition module is used to create an off-screen window and load the video rendering view, and to acquire the SurfaceControl object corresponding to the off-screen window. A building module is used to create a mirrored SurfaceControl object from the SurfaceControl object of the off-screen window; The screen projection module is used to create a SurfaceView component in the receiving device, obtain the SurfaceControl object corresponding to the SurfaceView, and bind the parent of the mirrored SurfaceControl object to the SurfaceControl object of the receiving SurfaceView to realize video projection display.
10. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
