Screen sharing method and device, electronic equipment and storage medium
By cloning the layer controller between multiple display screens in the vehicle, low-latency content sharing and resource sharing are achieved, solving the problems of high resource occupation and high development difficulty in the existing technology, and improving the number of display screens Content consistency and interaction fluency.
Patent Information
- Application Number
- CN202411386448.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2024-12-31
AI Technical Summary
When screen sharing between multiple display screens in a vehicle, the existing technology has problems such as high resource utilization, difficult development and maintenance, and inability to mirror the entire screen content.
Implement content sharing by cloning the layer controller, avoiding repeated creation of view hierarchy, sharing the underlying resources of the original layer controller, reducing memory usage, and displaying the original view on the display to be shared, considering the screen size to achieve the maximum Good visual effect.
It realizes low-latency content sharing between multiple displays, reduces system memory and CPU resource consumption, simplifies code management and maintenance, improves interaction fluency, and ensures content consistency on all displays.
Smart Images

Figure CN119225676A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a method, device, electronic device and storage medium for screen sharing in the field of computer technology. Background Art
[0002] At present, with the continuous improvement and improvement of vehicle functions and vehicle equipment, the display screens in the vehicle include not only the central control screen installed in the driver's seat, but also the co-pilot screen, rear screen and ceiling screen.
[0003] In one possible implementation, when multiple display screens are installed in a vehicle, users can share screen content based on the multiple display screens. For example, when multiple users in the vehicle need to watch a movie, they can configure the movie on one of the display screens to display the movie content, and then share the movie content with other display screens in the vehicle so that all the display screens display the same movie screen.
[0004] Based on this, how to achieve screen sharing of multiple display screens in the car has become an urgent problem that needs to be solved. Summary of the invention
[0005] The present application provides a screen sharing method, device, electronic device and storage medium. The method can realize content sharing by cloning layer controllers, avoid repeated creation of view hierarchical structures, reduce memory usage of resources, and enhance user experience.
[0006] In a first aspect, a screen sharing method is provided, the method comprising: in response to a screen sharing operation on a target display screen, obtaining multiple original layer controllers of the target display screen and screen parameters of a display screen to be shared corresponding to the screen sharing operation, the screen parameters being used to represent a size, a position and an identifier of the display screen to be shared; according to the display screen to be shared, cloning the multiple original layer controllers to obtain multiple cloned layer controllers corresponding to the display screen to be shared; and displaying multiple views of multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers.
[0007] In the above technical solution, when multiple display screens of a vehicle need to realize screen sharing, the present application proposes a method of screen sharing, which clones the layer controller of the original display screen (target display screen) and displays the content of the original display screen on other display screens that need to be shared through the cloned layer controller. Among them, content sharing is realized by cloning the layer controller, which avoids the repeated creation of the view hierarchy. The cloned layer controller can share some underlying resources of the original layer controller, reducing the memory usage of resources. In addition, the cloned layer controller can reuse the original code logic and simplify the management and maintenance of the code. Since the cloned layer controller is created based on the existing layer controller, low-latency updates can also be achieved to improve the smoothness of the interaction. Finally, based on the cloned layer controller, the view of the original display screen is displayed on the display screen to be shared, and the screen size of the display screen to be shared is also taken into consideration to ensure that the display screen to be shared displays the original view. When the best visual effect is achieved.
[0008] In combination with the first aspect, in some possible implementations, based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, multiple views of the multiple layers corresponding to the multiple original layer controllers are displayed on the display screen to be shared, including: determining the layout parameters of the multiple view components corresponding to the multiple cloned layer controllers according to the screen parameters of the display screen to be shared, and the layout parameters are used to represent the position and size of the view components when displayed on the display screen to be shared; and displaying the multiple views on the display screen to be shared according to the layout parameters of the multiple view components and the multiple cloned layer controllers.
[0009] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the multiple views are displayed on the display screen to be shared according to the layout parameters of the multiple view components and the multiple cloned layer controllers, including: creating the multiple view components according to the multiple cloned layer controllers; adding the multiple view components to the display screen to be shared based on the layout parameters of the multiple view components; and associating the multiple cloned layer controllers with the multiple view components so that the display screen to be shared displays the multiple views.
[0010] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, after displaying multiple views of multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, the method also includes: in response to a touch screen event on the display screen to be shared, obtaining event parameters of the touch screen event, the event parameters being used to indicate the location where the touch screen event occurs on the display screen to be shared; determining a target view corresponding to the touch screen event from the multiple views of the target display screen according to the event parameters and the screen parameters; distributing the touch screen event to the target view so that the target view updates the target view based on the touch screen event; and updating the target view on the display screen to be shared through the multiple cloned layer controllers based on the updated target view.
[0011] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the event parameters include original event coordinates, the screen parameters include a position offset of the display screen to be shared relative to the target display screen, and the target view corresponding to the touch screen event is determined from the multiple views of the target display screen based on the event parameters and the screen parameters, including: converting the touch screen event from the display screen to be shared to the target display screen based on the original event coordinates and the position offset, to obtain the target event coordinates corresponding to the touch screen event under the target display screen; and determining the target view based on the target event coordinates.
[0012] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, before determining the target view according to the target event coordinates, the method also includes: obtaining coordinate intervals of multiple layers of the target display screen; and determining the target view according to the target event coordinates includes: determining a first coordinate interval in which the target event coordinates are located according to the coordinate intervals of the multiple layers; determining the target layer to be the layer corresponding to the first coordinate interval; when the number of views corresponding to the target layer is one, determining the target view to be the view corresponding to the target layer; when the number of views of the target layer is multiple, obtaining the coordinate intervals of multiple views corresponding to the target layer; determining a second coordinate interval in which the target event coordinates are located according to the coordinate intervals of the multiple views; and determining the target view to be the view corresponding to the second coordinate interval.
[0013] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the target view is based on the touch screen event, and the step of updating the target view includes: obtaining the event type of the touch screen event, where the event type is used to represent the operation corresponding to the touch screen event; according to the event type, updating the target callback processing method corresponding to the touch screen event; based on the target callback processing method, processing the touch screen event and updating the target view.
[0014] In a second aspect, a screen sharing device is provided, which includes: a parameter acquisition module, used to respond to a screen sharing operation on a target display screen, obtain multiple original layer controllers of the target display screen, and screen parameters of the display screen to be shared corresponding to the screen sharing operation, wherein the screen parameters are used to represent the size, position and identification of the display screen to be shared; a layer cloning module, used to clone the multiple original layer controllers according to the display screen to be shared, and obtain multiple cloned layer controllers corresponding to the display screen to be shared; and a view display module, used to display multiple views of multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers.
[0015] In combination with the second aspect, in some possible implementations, the view display module is specifically used to: determine the layout parameters of the multiple view components corresponding to the multiple cloned layer controllers according to the screen parameters of the display screen to be shared, and the layout parameters are used to represent the position and size of the view components when displayed on the display screen to be shared; display the multiple views on the display screen to be shared according to the layout parameters of the multiple view components and the multiple cloned layer controllers.
[0016] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the view display module is also used to: create the multiple view components based on the multiple cloned layer controllers; add the multiple view components to the display screen to be shared based on the layout parameters of the multiple view components; and associate the multiple cloned layer controllers with the multiple view components so that the display screen to be shared displays the multiple views.
[0017] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, after displaying multiple views of multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, the device also includes: a view update module, used to respond to a touch screen event on the display screen to be shared, obtain event parameters of the touch screen event, and the event parameters are used to indicate the location where the touch screen event occurs on the display screen to be shared; determine a target view corresponding to the touch screen event from the multiple views of the target display screen according to the event parameters and the screen parameters; distribute the touch screen event to the target view so that the target view updates the target view based on the touch screen event; and update the target view on the display screen to be shared through the multiple cloned layer controllers based on the updated target view.
[0018] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the event parameters include original event coordinates, the screen parameters include a position offset of the display screen to be shared relative to the target display screen, and the view update module is further used to: convert the touch screen event from the display screen to be shared to the target display screen according to the original event coordinates and the position offset, and obtain the target event coordinates corresponding to the touch screen event under the target display screen; and determine the target view according to the target event coordinates.
[0019] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, before determining the target view according to the target event coordinates, the view update module is also used to: obtain the coordinate intervals of multiple layers of the target display screen; and, based on the coordinate intervals of the multiple layers, determine the first coordinate interval in which the target event coordinates are located; determine the target layer to be the layer corresponding to the first coordinate interval; when the number of views corresponding to the target layer is one, determine the target view to be the view corresponding to the target layer; when the number of views of the target layer is multiple, obtain the coordinate intervals of multiple views corresponding to the target layer; based on the coordinate intervals of the multiple views, determine the second coordinate interval in which the target event coordinates are located; and determine the target view to be the view corresponding to the second coordinate interval.
[0020] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the view update module is also used to: obtain the event type of the touch screen event, where the event type is used to represent the operation corresponding to the touch screen event; according to the event type, update the target callback processing method corresponding to the touch screen event; based on the target callback processing method, process the touch screen event and update the target view.
[0021] In a third aspect, an electronic device is provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, so that the electronic device executes the method in the first aspect or any possible implementation of the first aspect.
[0022] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0023] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a schematic diagram of a scenario of in-car screen sharing provided by an embodiment of the present application;
[0025] Figure 2 is a schematic flow chart of a screen sharing method provided in an embodiment of the present application;
[0026] Figure 3 is a schematic flow chart of another screen sharing method provided in an embodiment of the present application;
[0027] Figure 4 is a structural schematic diagram of a screen sharing device provided in an embodiment of the present application;
[0028] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0030] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0031] Before introducing the method of the embodiment of the present application, the professional terms that may be involved in the embodiment of the present application are first explained.
[0032] SurfaceControl: A class used to manage and control the display surface (Surface) in the Android system. It provides low-level access and control to the Surface, allowing users to control, configure, and manage display content. Layer controllers are typically used for advanced graphics operations and multi-screen display scenarios.
[0033] Currently, the common functions of layer controllers are as follows:
[0034] (1) Create and manage Surface:
[0035] SurfaceControl can create new Surfaces that can be used to display content. Users can use SurfaceControl to set the size, position, transparency and other properties of the Surface.
[0036] (2) Graphics synthesis:
[0037] SurfaceControl allows users to combine multiple Surfaces into a final display output. Users can set the stacking order of each Surface and the blending mode between them (such as opaque, translucent, etc.).
[0038] (3) Performance optimization:
[0039] By using SurfaceControl, users can achieve efficient graphics processing and rendering because it interacts directly with the hardware-accelerated graphics system. For example, in multi-screen or split-screen applications, SurfaceControl can help reduce unnecessary redrawing and memory copies and improve performance.
[0040] (4)Multi-screen display:
[0041] In a multi-screen display scenario, SurfaceControl can display different Surfaces on different screens. Users can create cloned SurfaceControls to synchronize content on different screens.
[0042] After introducing the professional terms of the embodiments of the present application, the application scenarios of the embodiments of the present application are introduced below.
[0043] Figure 1 This is a schematic diagram of an in-car screen sharing scenario provided in an embodiment of the present application.
[0044] For example, Figure 1 As shown, a plurality of display screens are installed in the vehicle, namely display screen 1, display screen 2 and display screen 3. Display screen 1 may be a central control screen in the vehicle; display screen 2 may be a co-pilot screen in the vehicle; and display screen 3 may be a rear screen in the vehicle.
[0045] Based on the multiple display screens installed in the vehicle, users can control multiple display screens to achieve screen sharing when using multiple display screens.
[0046] In a possible implementation, if a user opens the game software on the display screen 1, the display area of the display screen 1 displays the current game interface, such as Figure 1In this scenario, in order to allow multiple users in the car to play the same game on their respective screens, the user can synchronously share the game interface on display screen 1 with display screen 2 and display screen 3. As a result, the display areas of display screen 2 and display screen 3 also display the same game interface, thereby achieving screen sharing between multiple display screens.
[0047] At present, there are mainly the following ways to achieve screen sharing of multiple displays:
[0048] Method 1: Multiple application openings
[0049] When implementing screen sharing of multiple displays based on the multi-opening mode of applications, the specific process is: create multiple identical application instances in the Android operating system, and start an independent application instance on each display. Each application instance runs the same code and renders the same data. In other words, these application instances share the same data source (such as a video stream). For example, a video player application needs to ensure that all application instances play the same video stream at the same time, so as to achieve the effect of screen sharing of multiple displays.
[0050] When a user operates on any display screen (such as pause, fast forward, etc.), the application instance corresponding to the display screen receives data update, and other application instances are also updated synchronously.
[0051] The problem with the above screen sharing method is that each application instance on the display screen will occupy additional memory and central processing unit (CPU) resources, which may cause system performance to degrade, especially when multiple displays are running at the same time. In addition, developers need to implement the multi-screen sharing function for each application separately, which increases the workload of development and maintenance. If new applications need to be added to support multi-screen sharing, developers need to implement the sharing function for each new application separately, which reduces the flexibility of the system.
[0052] Based on the above problems, an embodiment of the present application provides a screen sharing method, which clones the layer controller without having to implement the sharing function for each application separately, so that all display screens share a graphics buffer, reducing the consumption of system memory and CPU resources.
[0053] Method 2: Virtual screen flow method
[0054] When implementing screen sharing of multiple displays based on the virtual screen stream method, the specific process is as follows: a virtual screen device (virtual screen) is created in the Android operating system, and all the content that needs to be shared in the application is rendered on the virtual screen. When the system monitors the data stream on the virtual screen for changes, it captures new frame data and copies the frame data on the virtual screen to the graphics buffer of other physical displays, so that each physical display can render these frame data on the screen.
[0055] The problem with the above screen sharing method is that each time a new shared screen is added, there will be an extra copy and rendering of the data stream, which will increase the use of memory and CPU. In addition, since the virtual screen streaming method is designed for a certain application and is used to render the content of a certain application, in other words, this virtual screen only captures the output of the current application, not the screen content of the entire system. Therefore, the virtual screen method cannot achieve the mirroring of the entire screen content.
[0056] Based on the above problems, a screen sharing method provided in an embodiment of the present application can access and control the graphic content of the entire display screen by cloning the layer controller, thereby realizing the mirroring of the entire display screen content without being limited to the content of a specific application, thereby ensuring that the content on all display screens has a high degree of consistency.
[0057] After introducing the application scenarios of the embodiments of the present application, the methods of the embodiments of the present application are introduced below.
[0058] Figure 2 It is a schematic flow chart of a screen sharing method provided in an embodiment of the present application. It should be understood that the application scenario of the method can be a multi-screen sharing scenario in a vehicle, and can also be applicable to any multi-screen sharing scenario. Taking the application scenario of the method as an example of a multi-screen sharing scenario in a vehicle, when the application scenario of the method is a multi-screen sharing scenario in a vehicle, the execution subject of the method can specifically be any electronic control unit (Electronic Control Unit, ECU, also called a controller) in the vehicle. The following takes the execution subject of the method as an example of a multimedia controller to introduce in detail a screen sharing method provided in an embodiment of the present application.
[0059] For example, Figure 2 As shown, the method 200 includes:
[0060] 201 , in response to a screen sharing operation on a target display screen, obtain a plurality of original layer controllers of the target display screen and screen parameters of the display screen to be shared corresponding to the screen sharing operation, where the screen parameters are used to indicate the size, position and identification of the display screen to be shared.
[0061] It should be understood that, based on the continuous improvement of vehicle entertainment functions, multiple display screens are installed in vehicles. For example, the central control screen at the main driver's seat, the co-pilot screen at the co-pilot seat, the rear screen at the rear seat, the ceiling screen, etc. When there are multiple users in the car, in order to provide users with a better entertainment experience. Users can share screens through multiple display screens, such as watching movies, playing games, singing, etc.
[0062] When a user realizes screen sharing through multiple display screens, he can first configure any one of the multiple display screens and open the application to be run. The display screen currently initially configured is the target display screen. In response to the user's configuration operation, the multimedia controller controls the target display screen to display the running interface of the application in the display area.
[0063] Furthermore, the user can configure the display screen to be shared through screen sharing operations (such as click operations, voice commands, etc.) in the application running interface. The multimedia controller receives the screen sharing operation and starts to execute the method flow of the embodiment of the present application.
[0064] Optionally, the number of display screens to be shared corresponding to the screen sharing operation may be one or more, which is not limited in the present embodiment. In the following description of the present embodiment, the number of display screens to be shared is 1 as an example.
[0065] It should be understood that when the multimedia controller in the embodiment of the present application realizes screen sharing, the core point is to copy (or clone) the layer controller of the target display screen so that the display screen to be shared and the target display screen share a graphics buffer area, thereby achieving the effect that the display screen to be shared and the target display screen display the same data. Therefore, when realizing screen sharing, the multimedia controller can first obtain multiple original layer controllers corresponding to the current display content of the target display screen.
[0066] Exemplarily, when acquiring multiple original layer controllers of the target display screen, it involves interacting with the Window Manager Service (WMS) and the Surface Flinger. Specifically, the multimedia controller first acquires the WMS, and then further acquires the window token of the target display screen, and acquires all the original layer controllers of the target display screen through the window token of the target display screen.
[0067] In addition to obtaining multiple original layer controllers of the target display, in order to facilitate the view to achieve the best display effect on the display to be shared, the multimedia controller also needs to obtain the screen parameters of the display to be shared. The screen parameters are used to indicate the size, position and identification of the display to be shared.
[0068] Optionally, the screen parameters include screen ID, screen size, and position offset between the display screen to be shared and the target display screen. The screen ID is the display identity document (Display ID) of the display screen. The position offset between the display screen to be shared and the target display screen is used to indicate the relative position relationship between the display screen to be shared and the target display screen.
[0069] For example, for the screen identification, the technician may set unique screen identifications for multiple display screens in the vehicle in advance. After the user selects the display screen to be shared, the multimedia controller may obtain the screen identification of the display screen to be shared.
[0070] The multimedia controller may obtain the screen size of the display screen to be shared and the position offset of the display screen to be shared relative to the target display screen through the screen identifier of the display screen.
[0071] Specifically, the multimedia controller may first obtain the Display Manager, and obtain the Display objects of all display screens through the Display Manager. Further, the multimedia controller traverses all Display objects, and obtains the screen size (including length and width) of each display screen according to the Displayid.
[0072] In addition, the multimedia controller can also obtain the upper left corner coordinates of each display screen according to the Display ID. The upper left corner coordinates are the coordinates of each display screen in the global coordinate system. Further, the multimedia controller can obtain the position offset of the display screen to be shared relative to the target display screen according to the upper left corner coordinates of the display screen to be shared and the upper left corner coordinates of the target display screen.
[0073] Exemplarily, the coordinates of the upper left corner of the display screen to be shared are marked as "(x1, y1)", and the coordinates of the upper left corner of the target display screen are marked as "(x2, y2)", then the position offset of the display screen to be shared relative to the target display screen is offset x = x2-x1, and offset y = y2-y1.
[0074] Thus, through the above process, the multimedia controller can obtain the information required by the clone layer controller.
[0075] 202 : According to the display screen to be shared, clone multiple original layer controllers to obtain multiple cloned layer controllers corresponding to the display screen to be shared.
[0076] After obtaining multiple original layer controllers of the target display screen, the multimedia controller can clone the multiple original layer controllers and implement screen sharing based on the cloned multiple layer controllers.
[0077] In the cloning process, the number of clones is related to the number of display screens to be shared. In the embodiment of the present application, the number of display screens to be shared is taken as one for example, therefore, by cloning multiple original layer controllers once, multiple clone layer controllers corresponding to the multiple original layer controllers can be obtained.
[0078] Specifically, the multimedia controller can call SurfaceControl.Builder in the Android system to create a new SurfaceControl instance, referencing the same underlying Surface object. By applying the above operation to each original layer controller, multiple cloned layer controllers can be obtained.
[0079] 203 : Based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, multiple views of the multiple layers corresponding to the multiple original layer controllers are displayed on the display screen to be shared.
[0080] It should be understood that the reason why screen sharing is achieved by cloning the layer controller in the embodiment of the present application is that cloning the layer controller is essentially a copy of the layer control object. The cloned layer controller allows users to independently manage and control the position, size and other properties of the layer on different screens, but does not directly contain the content of the layer, but references the same underlying graphics buffer as the original layer controller. The actual image data is stored in the graphics buffer. When cloning the layer controller, the same image (or view) is actually shared among multiple display screens, thereby achieving screen view sharing.
[0081] It should also be understood that, in combination with the above description, the result of screen sharing is that the display screen to be shared and the target display screen display the same content. However, during the sharing process, the screen sizes of different display screens may be different. Even for the same view, the display size on different display screens may be different. Therefore, when displaying the view of the corresponding layer of the original layer controller on the display screen to be shared based on the cloned layer controller, the screen parameters of the display screen to be shared also need to be considered.
[0082] In a possible implementation, based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, multiple views of multiple layers corresponding to the multiple original layer controllers are displayed on the display screen to be shared, including:
[0083] Determine layout parameters of multiple view components corresponding to multiple clone layer controllers according to screen parameters of the display screen to be shared, where the layout parameters are used to represent the position and size of the view components when displayed on the display screen to be shared;
[0084] According to the layout parameters of the multiple view components and the multiple cloned layer controllers, the multiple views are displayed on the display screen to be shared.
[0085] Specifically, when multiple views managed by multiple original layer controllers are displayed on the display screen to be shared based on the screen parameters of the display screen to be shared and multiple cloned layer controllers, the layer controller itself does not directly handle the layout or display position of the view, but operates the layer at the system level. Therefore, in order to ensure that multiple views of multiple layers associated with multiple original layer controllers can be displayed on the display screen to be shared, the multimedia controller can first create a corresponding SurfaceView for each cloned layer controller. SurfaceView is a view component in the Android system, which is used to display the view of the layer associated with the layer controller on the display screen to be shared.
[0086] It should be understood that when adding a view component to the display screen to be shared, the view component is actually added to the window, which is the top-level container in the Android system. In order to ensure that multiple SurfaceViews can be correctly added to the window of the screen to be shared, the multimedia controller needs to determine the layout parameters of multiple SurfaceViews (or windows) through WindowManager according to the screen parameters of the display screen to be shared, so as to add multiple SurfaceViews directly to the window. The layout parameters are used to indicate the position and size of the SurfaceView when it is displayed on the display screen to be shared, and to ensure that the size of the SurfaceView matches the size of the display screen to be shared.
[0087] Optionally, the window layout parameters include width, length, position, window type, window flag, token, display id and pixel format, etc.
[0088] Exemplarily, when the multimedia controller determines the layout parameters of the window, it can be implemented through the class LayoutParams used to define layout parameters in the Android system.
[0089] For the width and length in the layout parameters, each view component corresponds to a cloned layer controller, and each cloned layer controller corresponds to an original layer controller. Figure 1Each time the multimedia controller configures the layout parameters of a view component, it can obtain the size of the corresponding original layer controller and set the width in the layout parameters to be equal to the width of the corresponding original layer controller; the height is set to be equal to the height of the corresponding original layer controller. The width and height define the size of the SurfaceView.
[0090] The x and y positions define the coordinates of the top left corner of the SurfaceView.
[0091] The window type is generally set to TYPE_APPLICATION to indicate that this is an application window.
[0092] The window flags are generally set to FLAG_NOT_FOCUSABLE, which means that the window will not get the focus, and FLAG_LAYOUT_NO_LIMITS, which allows the window to extend beyond the boundaries of the display.
[0093] The pixel format is generally set to PixelFormat.TRANSLUCENT, which means translucent.
[0094] token can be set to null or an appropriate token identifying the application or activity to which the window belongs.
[0095] displayId indicates the display screen to which the window is to be added. Here, it is the displayId of the display screen to be shared.
[0096] Thus, by configuring the layout parameters of each view component according to the above process, the layout parameters of each view component can be obtained.
[0097] The configuration of the above layout parameters only determines the size and position of the view component, and does not obtain multiple view components corresponding to multiple clone layer controllers. Therefore, after the configuration of the layout parameters is completed, the multimedia controller can create multiple view components corresponding to multiple clone layer controllers based on the layout parameters of multiple view components and multiple clone layer controllers, and display the views of the layers corresponding to multiple original layer controllers.
[0098] In a possible implementation, multiple views are displayed on a display screen to be shared according to multiple view component layout parameters and multiple clone layer controllers, including:
[0099] Create multiple view components based on multiple cloned layer controllers;
[0100] Based on the layout parameters of the multiple view components, adding the multiple view components to the display screen to be shared;
[0101] Associate multiple clone layer controllers with multiple view components to enable the shared display to display multiple views.
[0102] Specifically, after determining the layout parameters of the multiple view components, the multimedia controller can create a corresponding SurfaceView for each cloned layer controller. Further, the multimedia controller can use WindowManager to add each SurfaceView to the display screen to be shared based on the layout parameters of each SurfaceView.
[0103] After adding multiple view components to the display screen to be shared, the multimedia controller can further connect each cloned layer controller to the Surface of its corresponding SurfaceView through SurfaceHolder, so that the SurfaceView corresponding to the cloned layer controller can display the contents in the underlying graphics buffer, that is, the view of the layer corresponding to the cloned layer controller (or the original layer controller corresponding to the cloned layer controller), so that the view content displayed on the display screen to be shared is consistent with the view content displayed on the target display screen, thereby achieving the effect of screen sharing.
[0104] Therefore, a screen sharing method provided by an embodiment of the present application proposes a screen sharing method when multiple display screens of a vehicle need to realize screen sharing. The method clones the layer controller of the original display screen (target display screen), and displays the content of the original display screen on other display screens that need to be shared through the cloned layer controller. Among them, content sharing is realized by cloning the layer controller, which avoids the repeated creation of the view hierarchy. The cloned layer controller can share some underlying resources of the original layer controller, reducing the memory usage of resources. In addition, the cloned layer controller can reuse the original code logic and simplify the management and maintenance of the code. Since the cloned layer controller is created based on the existing layer controller, low-latency updates can also be achieved to improve the smoothness of the interaction. Finally, based on the cloned layer controller, the view of the original display screen is displayed on the display screen to be shared, and the screen size of the display screen to be shared is also taken into consideration to ensure that the display screen to be shared displays the original view. When the best visual effect is achieved.
[0105] Furthermore, after screen sharing of multiple display screens is achieved, the embodiment of the present application also provides a solution for synchronously updating the view contents of multiple shared display screens.
[0106] In a possible implementation, based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, after displaying the views of the multiple layers corresponding to the multiple original layer controllers on the display screen to be shared, the method further includes:
[0107] In response to a touch screen event on the display screen to be shared, acquiring an event parameter of the touch screen event, where the event parameter is used to indicate a position where the touch screen event occurs on the display screen to be shared;
[0108] Determine, according to the event parameters and the screen parameters, a target view corresponding to the touch screen event from multiple views of the target display screen;
[0109] Distribute the touch screen event to the target view, so that the target view updates the target view based on the touch screen event;
[0110] Based on the updated target view, the target view on the to-be-shared display is updated through multiple cloned layer controllers.
[0111] After the view of the target display screen is shared with the view of the display screen to be shared, if the user performs a touch screen operation on the display screen to be shared, a corresponding touch screen event is generated. When processing the touch screen event, the multimedia controller can forward the touch screen event to the corresponding view in the target display screen, so that the corresponding view can respond to the touch screen event and be updated, thereby achieving the effect of real-time view update.
[0112] For example, the multimedia controller can capture touch screen events by setting a touch listener for SurfaceView. When the shared display screen displays a view, if the user clicks the shared display screen, the multimedia controller can listen to the operation through the touch listener and generate a corresponding touch screen event.
[0113] Since the touch screen event occurs on the display screen to be shared, the multimedia controller needs to forward the touch screen event to the target display screen. Due to the difference in the position of the target display screen and the display screen to be shared, the multimedia controller needs to first obtain the event parameters of the touch screen event on the display screen to be shared. The event parameters are used to indicate the position where the touch screen occurs on the display screen to be shared.
[0114] Optionally, the event parameters include original event coordinates of the touch screen event on the display screen to be shared, including an original x coordinate and an original y coordinate of the touch screen event.
[0115] It should be understood that the calculation of the position offset between the display screen to be shared and the target display screen is based on the global coordinate system. The local coordinate system is only applicable to a single display screen such as the display screen to be shared or the target display screen, and cannot realize cross-screen processing of events. Therefore, when converting the touch screen event from the display screen to be shared to the target display screen, the original event coordinates obtained are also the original coordinates of the touch screen event in the global coordinate system, that is, the coordinates of the touch screen event in the display screen to be shared in the global coordinate system, rather than the coordinates in the local coordinate system.
[0116] Exemplarily, the multimedia controller can obtain the original event coordinates of the touch screen event through the MotionEvent object. Specifically, the multimedia controller can use MotionEvent.getRawX() to obtain the x coordinate of the original event coordinates, and use MotionEvent.getRawY() to obtain the y coordinate of the original event coordinates.
[0117] It should be understood that, in general, the screen in the display interface of the current display screen includes more than one view. When the multimedia controller converts the touch screen event from the to-be-shared display screen to the target display screen, it is also necessary to determine which view of the multiple views of the target display screen the current touch screen event specifically corresponds to, so as to ensure accurate update of the display screen of the target display screen.
[0118] Therefore, after obtaining the event parameters (original event coordinates), the multimedia controller can determine the corresponding target view based on the original event coordinates and the screen parameters.
[0119] In a possible implementation, the screen parameters include a position offset of the display screen to be shared relative to the target display screen, and according to the event parameters and the screen parameters, a target view corresponding to the touch screen event is determined from multiple views of the target display screen, including:
[0120] According to the original event coordinates and the position offset, the touch screen event is converted from the to-be-shared display screen to the target display screen, and the corresponding target event coordinates between the touch screens under the target display screen are obtained;
[0121] Determine the target view based on the target event coordinates.
[0122] For example, assuming that the original event coordinates are (x a ,y a ), when converting the touch screen event from the to-be-shared display to the target display, the coordinate system is still the global coordinate system.
[0123] The specific conversion process can be achieved by the position offset of the display screen to be shared relative to the target display screen. The x coordinate of the target event coordinate is marked as “x b ”,x b =x a +offset x; Similarly, mark the y coordinate of the target event coordinate as "y b ”,y b =y a +offset y.
[0124] After obtaining the target event coordinates of the touch screen event on the target display screen, the multimedia controller may further determine the target view corresponding to the touch screen event from the multiple views of the target display screen.
[0125] Specifically, when determining the target view, since each layer or view has a corresponding display range in the display interface, which is known, and the display range can be quantitatively represented by coordinates, the multimedia controller can determine the target view from multiple views based on the coordinate ranges of multiple layers or multiple views.
[0126] In a possible implementation, before determining the target view according to the target event coordinates, the method further includes:
[0127] Get the coordinate intervals corresponding to multiple layers of the target display screen;
[0128] And, according to the target event coordinates, determining the target view, including:
[0129] According to the coordinate intervals corresponding to the multiple layers, the target coordinate interval of the target event coordinates is determined;
[0130] Determine that the target layer is a layer corresponding to the target coordinate interval among multiple layers;
[0131] When the number of views corresponding to the target layer is one, determining the target view to be the view corresponding to the target layer;
[0132] When there are multiple views of the target layer, the coordinate intervals of the multiple views corresponding to the target layer are obtained; according to the coordinate intervals of the multiple views, a second coordinate interval where the target event coordinates are located is determined; and the target view is determined to be the view corresponding to the second coordinate interval.
[0133] Specifically, when determining the target view, since layers are composed of views, the multimedia controller needs to first determine the layer corresponding to the touch screen event, and then determine the target view from the view of the layer corresponding to the touch screen event.
[0134] When obtaining the coordinate interval of a layer, it can be obtained mainly through the following methods: the first is to obtain the left boundary of the layer through the getLeft() method; the upper boundary of the layer through the getTop() method; the right boundary of the layer through the getRight() method; and the lower boundary of the layer through the getBottom() method. In this way, the coordinate interval corresponding to the layer can be obtained; the second is to obtain the coordinate interval corresponding to the layer from the layout parameters of the view component based on the created view component. The layout parameters of each SurfaceView are obtained through the getLayoutParams() method, and the coordinate interval of the layer is obtained from it; the third is to manage the boundary information of each layer through a map in advance, thereby obtaining the coordinate interval corresponding to each layer.
[0135] After obtaining the coordinate intervals of multiple layers, the multimedia controller can determine the coordinate interval of the layer in which the current target event coordinates are located, and determine the layer as the target layer.
[0136] When determining the target view corresponding to the target layer, one layer may correspond to one view or multiple views. When determining the target view from at least one view of the target layer, the technician can configure the correspondence between each layer controller and the corresponding view, as well as the boundary information of each view when creating and adding multiple SurfaceViews, to obtain multiple sets of mapping relationships. Then, after obtaining the target layer, the multimedia controller can obtain the boundary information of at least one view corresponding to the target layer according to the mapping relationship corresponding to the target layer.
[0137] When the target layer consists of only one view, when the multimedia controller determines that the target event coordinates already belong to the coordinate interval of the target layer, the target event coordinates must also belong to the coordinate interval of the target view. Therefore, in this case, the view corresponding to the target layer is the target view.
[0138] When the target layer is composed of multiple views, the multimedia controller also needs to match the target event coordinates with the boundary information of at least one view, determine the view whose coordinate range the target event coordinates are located in, and thus determine the view whose coordinate range includes the target event coordinates as the target view.
[0139] After determining the target view, the multimedia controller may distribute the touch screen event to the target view so as to update the target view displayed on the target display screen.
[0140] In a possible implementation, the target view is updated based on a touch screen event, and the step of updating the target view includes:
[0141] Get the event type of the touch screen event. The event type is used to indicate the operation corresponding to the touch screen event.
[0142] According to the event type, update the target callback processing method corresponding to the touch screen event;
[0143] Based on the target callback processing method, handle the touch screen event to update the target view.
[0144] When the multimedia controller forwards the touch screen event to the target view, the view system of the Android system calls the dispatchTouchEvent method to handle the touch screen event.
[0145] Specifically, in the process of processing a touch screen event, the view system may first determine the event type of the touch screen event, and determine the corresponding callback processing method based on the event type.
[0146] Exemplarily, the multimedia controller may determine the specific type of the touch screen event through the getAction() method of MotionEvent.
[0147] Different event types correspond to different callback processing methods. For example, when the event type of the touch screen event is a touch event, the view system will handle these events through the onTouchEvent method. Specifically, the event types of touch events include click, slide, or long press. The callback processing method corresponding to the click event (Click) is OnClickListener; the callback processing method corresponding to the long press event (Long Click) is OnLongClickListener. When the event type of the touch screen event is a key event, if the touch screen event is a key press (Key Down), the corresponding callback processing method is onKeyDown; if the touch screen event is a key release (Key Up), the corresponding callback processing method is onKeyUp.
[0148] When the event processing is completed, the target view needs to be automatically updated. Specifically, when updating the target view, the target view can directly modify the properties of the target view (such as color, position, text, etc.) and call invalidate() to trigger redrawing; or, the target view completes the update by changing the view state (such as selected state, enabled state, etc.).
[0149] After the multimedia controller completes the update process of the target view on the target display screen, it is necessary to further synchronize the target view on the shared display screen. During the synchronized update process, the multimedia controller can update the target view on the shared display screen based on multiple cloned layer controllers.
[0150] Specifically, after the target view of the target display screen is updated, the multimedia controller may record the current target view update status, call the updateSharedScreens method, traverse all cloned layer controllers, and update the corresponding target view.
[0151] In order to understand the solution of the embodiment of the present application in detail, Figure 3 The entire solution process of the embodiment of the present application is introduced.
[0152] Figure 3 It is a schematic flowchart of another screen sharing method provided in an embodiment of the present application.
[0153] For example, Figure 3 As shown, the method 300 includes:
[0154] 301 , in response to a screen sharing operation on a target display screen, obtaining a plurality of original layer controllers of the target display screen and screen parameters of the display screen to be shared corresponding to the screen sharing operation.
[0155] 302 , according to the display screen to be shared, clone multiple original layer controllers to obtain multiple cloned layer controllers corresponding to the display screen to be shared.
[0156] 303 : Determine layout parameters of multiple view components corresponding to multiple clone layer controllers according to screen parameters of the display screen to be shared.
[0157] 304. Create multiple view components based on multiple cloned layer controllers.
[0158] 305 , based on the layout parameters of the multiple view components, add the multiple view components to the display screen to be shared.
[0159] 306 , associating multiple cloned layer controllers with multiple view components, so that the display screen to be shared displays multiple views.
[0160] 307 : In response to a touch screen event on the display screen to be shared, obtain event parameters of the touch screen event.
[0161] 308 : Determine a target view corresponding to the touch screen event from multiple views of the target display screen according to the event parameters and the screen parameters.
[0162] 309 , distribute the touch screen event to the target view, so that the target view updates the target view based on the touch screen event.
[0163] 310 , based on the updated target view, update the target view on the to-be-shared display screen through multiple cloned layer controllers.
[0164] 301-310 in the above method 300 and 201-203 in the method 200 have the same inventive concept, and the details can be found in the introduction of the method 200, which will not be repeated here.
[0165] Figure 4 It is a structural diagram of a screen sharing device provided in an embodiment of the present application.
[0166] For example, Figure 4 As shown, the device 400 includes:
[0167] The parameter acquisition module 401 is used to respond to the screen sharing operation on the target display screen, and acquire multiple original layer controllers of the target display screen and the screen parameters of the display screen to be shared corresponding to the screen sharing operation, wherein the screen parameters are used to represent the size, position and identification of the display screen to be shared;
[0168] The layer cloning module 402 is used to clone the multiple original layer controllers according to the display screen to be shared, so as to obtain multiple cloned layer controllers corresponding to the display screen to be shared;
[0169] The view display module 403 is used to display multiple views of the multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers.
[0170] In one possible implementation, the view display module 403 is specifically used to: determine the layout parameters of the multiple view components corresponding to the multiple cloned layer controllers according to the screen parameters of the display screen to be shared, and the layout parameters are used to represent the position and size of the view components when displayed on the display screen to be shared; and display the multiple views on the display screen to be shared according to the layout parameters of the multiple view components and the multiple cloned layer controllers.
[0171] In one possible implementation, the view display module 403 is also used to: create the multiple view components based on the multiple cloned layer controllers; add the multiple view components to the display screen to be shared based on the layout parameters of the multiple view components; and associate the multiple cloned layer controllers with the multiple view components so that the display screen to be shared displays the multiple views.
[0172] Optionally, after displaying multiple views of multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, the device also includes: a view update module, used to respond to a touch screen event on the display screen to be shared, obtain event parameters of the touch screen event, and the event parameters are used to indicate the location where the touch screen event occurs on the display screen to be shared; determine a target view corresponding to the touch screen event from the multiple views of the target display screen according to the event parameters and the screen parameters; distribute the touch screen event to the target view so that the target view updates the target view based on the touch screen event; and update the target view on the display screen to be shared through the multiple cloned layer controllers based on the updated target view.
[0173] In one possible implementation, the event parameters include original event coordinates, the screen parameters include a position offset of the display screen to be shared relative to the target display screen, and the view update module is further used to: convert the touch screen event from the display screen to be shared to the target display screen according to the original event coordinates and the position offset, and obtain the target event coordinates corresponding to the touch screen event under the target display screen; and determine the target view according to the target event coordinates.
[0174] In a possible implementation, before determining the target view according to the target event coordinates, the view update module is further used to: obtain the coordinate intervals of multiple layers of the target display screen; and, based on the coordinate intervals of the multiple layers, determine the first coordinate interval in which the target event coordinates are located; determine the target layer to be the layer corresponding to the first coordinate interval; when the number of views corresponding to the target layer is one, determine the target view to be the view corresponding to the target layer; when the number of views of the target layer is multiple, obtain the coordinate intervals of multiple views corresponding to the target layer; based on the coordinate intervals of the multiple views, determine the second coordinate interval in which the target event coordinates are located; and determine the target view to be the view corresponding to the second coordinate interval.
[0175] In one possible implementation, the view update module is also used to: obtain the event type of the touch screen event, where the event type is used to represent the operation corresponding to the touch screen event; update the target callback processing method corresponding to the touch screen event according to the event type; and process the touch screen event and update the target view based on the target callback processing method.
[0176] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0177] For example, Figure 5 As shown, the electronic device 500 includes: a memory 501 and a processor 502, wherein the memory 501 stores an executable program code 5011, and the processor 502 is used to call and execute the executable program code 5011 to perform a screen sharing method.
[0178] In this embodiment, the electronic device can be divided into functional modules according to the above method example. For example, each functional module can be corresponded to, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0179] In the case of dividing each functional module according to each function, the electronic device may include: a parameter acquisition module, a layer cloning module, a view display module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0180] The electronic device provided in this embodiment is used to execute the above-mentioned screen sharing method, and thus can achieve the same effect as the above-mentioned implementation method.
[0181] In the case of an integrated unit, the electronic device may include a processing module and a storage module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device in executing related program codes and data.
[0182] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits shown in conjunction with the disclosure of the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.
[0183] This embodiment further provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed on a computer, the computer executes the above-mentioned related method steps to implement a screen sharing method in the above-mentioned embodiment.
[0184] This embodiment also provides a computer program product. When the computer program product runs on a computer, the computer is enabled to execute the above-mentioned related steps to implement a screen sharing method in the above-mentioned embodiment.
[0185] In addition, the electronic device provided in the embodiments of the present application may specifically be a chip, a component or a module, and the electronic device may include a connected processor and a memory; wherein the memory is used to store instructions, and when the electronic device is running, the processor may call and execute the instructions so that the chip executes a screen sharing method in the above-mentioned embodiments.
[0186] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.
[0187] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0188] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0189] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A screen sharing method, characterized in that: The method comprises: In response to a screen sharing operation on a target display screen, a plurality of original layer controllers of the target display screen and screen parameters of the display screen to be shared corresponding to the screen sharing operation are acquired, wherein the screen parameters are used to represent the size, position and identification of the display screen to be shared; According to the display screen to be shared, the multiple original layer controllers are cloned to obtain multiple cloned layer controllers corresponding to the display screen to be shared; Based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, multiple views of the multiple layers corresponding to the multiple original layer controllers are displayed on the display screen to be shared.
2. The method according to claim 1, characterized in that The method of displaying, on the display screen to be shared, a plurality of views of the plurality of layers corresponding to the plurality of original layer controllers based on the screen parameters of the display screen to be shared and the plurality of cloned layer controllers, comprises: Determine, according to the screen parameters of the display screen to be shared, layout parameters of multiple view components corresponding to the multiple clone layer controllers, wherein the layout parameters are used to represent the position and size of the view components when displayed on the display screen to be shared; The multiple views are displayed on the display screen to be shared according to the layout parameters of the multiple view components and the multiple cloned layer controllers.
3. The method according to claim 2, characterized in that The step of displaying the multiple views on the to-be-shared display screen according to the layout parameters of the multiple view components and the multiple cloned layer controllers includes: Creating the multiple view components according to the multiple cloned layer controllers; Based on the layout parameters of the multiple view components, adding the multiple view components to the display screen to be shared; The multiple cloned layer controllers are associated with the multiple view components so that the display screen to be shared displays the multiple views.
4. The method according to claim 1, characterized in that After displaying multiple views of multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers, the method further includes: In response to a touch screen event on the display screen to be shared, acquiring an event parameter of the touch screen event, where the event parameter is used to indicate a position where the touch screen event occurs on the display screen to be shared; Determining, according to the event parameter and the screen parameter, a target view corresponding to the touch screen event from the multiple views of the target display screen; Distributing the touch screen event to the target view, so that the target view updates the target view based on the touch screen event; Based on the updated target view, the target view on the to-be-shared display screen is updated through the multiple cloned layer controllers.
5. The method according to claim 4, characterized in that The event parameters include original event coordinates, the screen parameters include a position offset of the display screen to be shared relative to the target display screen, and determining a target view corresponding to the touch screen event from the multiple views of the target display screen according to the event parameters and the screen parameters includes: According to the original event coordinates and the position offset, the touch screen event is converted from the to-be-shared display screen to the target display screen, and target event coordinates corresponding to the touch screen event under the target display screen are obtained; The target view is determined according to the target event coordinates.
6. The method according to claim 5, characterized in that Before determining the target view according to the target event coordinates, the method further includes: Obtaining coordinate intervals of multiple layers of the target display screen; And, determining the target view according to the target event coordinates includes: Determine, according to the coordinate intervals of the multiple layers, a first coordinate interval in which the coordinates of the target event are located; Determine that the target layer is the layer corresponding to the first coordinate interval; When the number of views corresponding to the target layer is one, determining that the target view is the view corresponding to the target layer; In the case that there are multiple views of the target layer, the coordinate intervals of the multiple views corresponding to the target layer are obtained; based on the coordinate intervals of the multiple views, a second coordinate interval in which the target event coordinates are located is determined; and the target view is determined to be the view corresponding to the second coordinate interval.
7. The method according to claim 4, characterized in that The step of updating the target view based on the touch screen event includes: Acquire the event type of the touch screen event, where the event type is used to indicate the operation corresponding to the touch screen event; According to the event type, updating the target callback processing method corresponding to the touch screen event; Based on the target callback processing method, the touch screen event is processed and the target view is updated.
8. A screen sharing device, characterized in that: The device comprises: a parameter acquisition module, configured to, in response to a screen sharing operation on a target display screen, acquire a plurality of original layer controllers of the target display screen and screen parameters of the display screen to be shared corresponding to the screen sharing operation, wherein the screen parameters are used to represent the size, position and identification of the display screen to be shared; A layer cloning module, used for cloning the multiple original layer controllers according to the display screen to be shared, to obtain multiple cloned layer controllers corresponding to the display screen to be shared; A view display module is used to display multiple views of multiple layers corresponding to the multiple original layer controllers on the display screen to be shared based on the screen parameters of the display screen to be shared and the multiple cloned layer controllers.
9. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory, so that the electronic device executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Method for sharing application interface, electronic device, and storage medium
WO2026194776A1
