Method and device for sharing application interface, electronic equipment and storage medium
By automatically adjusting the display mode in the vehicle and using the position parameters of the cloned layer controller and view components, the application interface sharing between multiple screens of the vehicle is realized, solving the operational inconvenience caused by user manual switching of the display mode, and improving user experience and sharing efficiency.
Patent Information
- Application Number
- CN202510309169.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-07-04
AI Technical Summary
When sharing the application interface between multiple display screens in a vehicle, the prior art requires users to manually switch the display mode, resulting in inconvenient operation and degraded user experience.
Provided is a method to achieve synchronous display by obtaining the display mode of the target application and automatically adjusting to the full screen mode in non-full screen mode, and then sharing the application interface from the first display screen to the second display screen, using the positional parameters of the cloned layer controller and view components to achieve precise interaction in response to touch screen events.
The user does not need to manually switch the display mode, which improves the efficiency and user experience of screen sharing, avoids incomplete interface and pulling deformation, and enhances the smoothness and consistency of multi-screen collaborative operation.
Smart Images

Figure CN120255833A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a method, apparatus, electronic device, and storage medium for sharing application interfaces in the field of computer technology. Background Art
[0002] Currently, with the continuous improvement and enhancement of vehicle functions and in-vehicle devices, in addition to the central control screen installed at the driver's position, the display screens in the vehicle also include a co-driver screen, a rear-seat screen, a ceiling screen, etc.
[0003] In a possible implementation, when multiple display screens are installed in a vehicle, a user can share the screen content based on the multiple display screens. For example, when multiple users in the vehicle want to watch a movie, a video playback software can be opened on one of the display screens to display the movie interface on that display screen, and the movie interface can be shared to other display screens in the vehicle, so that the same movie interface is displayed on all the display screens.
[0004] Based on this, how to achieve the sharing of application interfaces of multiple display screens in a vehicle has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a method, apparatus, electronic device, and storage medium for sharing application interfaces. This method can provide a user with a solution for intelligently sharing application interfaces in a non-full-screen mode, enabling screen sharing to be completed without the user manually switching the display mode, thereby improving the user's sharing experience.
[0006] In a first aspect, a method for sharing an application interface is provided. The method includes: in response to a screen sharing operation on a target application, obtaining the display mode of the application interface of the target application, where the screen sharing operation is used to share the application interface on a first display screen to a second display screen; in the case where the display mode is a non-full-screen mode, adjusting the display mode of the application interface to a full-screen mode; and sharing the application interface from the first display screen to the second display screen.
[0007] In the above technical solution, when interaction is required between multiple display screens, the present application proposes a method for sharing an application interface. When receiving a screen sharing operation, this method first determines whether the application interface of the current target application is in a full-screen display state or a non-full-screen display state. When the application interface is in a non-full-screen display state, the application interface is adjusted to the full-screen display state and then switched from the first display screen to the second display screen. The above process can intelligently switch to the full-screen display state first when the application interface is in a non-full-screen display state when sharing the application interface is required. The process of switching the application interface from non-full screen to full screen does not require manual intervention by the user, greatly avoiding the inconvenience caused when the user is inconvenient to operate, improving the sharing efficiency, and enhancing the user experience. In addition, before sharing, the application interface is first adjusted to the full-screen mode, avoiding the situation where the shared interface is incomplete when displayed on the second display screen, bringing a better visual experience to the user, and avoiding problems such as stretching and deformation of the application interface during non-full-screen sharing.
[0008] In combination with the first aspect, in some possible implementation manners, adjusting the display mode of the application interface to the full-screen mode includes: obtaining the first screen size of the first display screen and the original display size of the application interface; determining the size change amount of the application interface according to the first screen size and the original display size; and adjusting the display mode of the application interface to the full-screen mode according to the size change amount.
[0009] In combination with the first aspect and the above implementation manners, in some possible implementation manners, adjusting the display size of the application interface to the full-screen mode according to the size change amount includes: determining the adjustment rate of the application interface according to the size change amount and a preset adjustment duration; and adjusting the display mode of the application interface to the full-screen mode according to the adjustment rate.
[0010] In the above technical solution, when adjusting the application interface from the non-full-screen mode to the full-screen mode, first determining the adjustment rate according to the size change amount and the preset adjustment duration, and then adjusting according to the adjustment rate can ensure that the application interface can switch from the non-full-screen mode to the full-screen mode at an appropriate speed, avoiding the problem of poor visual effects of the user caused by too fast adjustment speed, and making the whole adjustment process smooth and fluent.
[0011] Combined with the first aspect and the above implementation manners, in some possible implementation manners, sharing the application interface from the first display screen to the second display screen includes: obtaining a second screen size of the second display screen and original layer controllers of at least one layer in the application interface on the first display screen; cloning the original layer controllers of the at least one layer to obtain cloned layer controllers of the at least one layer; determining position parameters of at least one view component according to the second screen size, where the position parameters are used to represent a display area of the view component on the second display screen, and the at least one view component is a view component corresponding to the at least one layer; and displaying views corresponding to the at least one layer on the second display screen according to the cloned layer controllers of the at least one layer and the position parameters of the at least one view component.
[0012] Combined with the first aspect and the above implementation manners, in some possible implementation manners, displaying views corresponding to the at least one layer on the second display screen according to the cloned layer controllers of the at least one layer and the position parameters of the at least one view component includes: creating the at least one view component according to the cloned layer controllers of the at least one layer; adding the at least one view component to the second display screen based on the position parameters of the at least one view component; associating the cloned layer controllers of the at least one layer with the at least one view component, so that views corresponding to the at least one layer on the second display screen are synchronized with views corresponding to the at least one layer on the first display screen; and for any one layer in the at least one layer, rendering in a view component corresponding to the layer according to attribute parameters of the layer, so that the view component displays a view corresponding to the layer, where the attribute parameters are used to represent a display state of the layer.
[0013] Combined with the first aspect and the above implementation manners, in some possible implementation manners, after sharing the application interface from the first display screen to the second display screen, the method further includes: in response to a touch screen event on the second display screen, obtaining event parameters of the touch screen event, where the event parameters are used to represent a position where the touch screen event occurs on the second display screen; obtaining a position offset of the second display screen relative to the first display screen; determining a target view corresponding to the touch screen event from views corresponding to at least one layer of the first display screen according to the event parameters and the position offset; updating the target view according to a type of the touch screen event; and updating the target view on the second display screen through the cloned layer controllers of the at least one layer based on the updated target view.
[0014] In the above technical solution, by responding to the touch screen event on the second display screen and obtaining the event parameters, the operation position information of the user on the second display screen can be accurately captured. Combining the position offset of the second display screen relative to the first display screen, the target view corresponding to the touch screen event is determined from the views corresponding to at least one layer of the first display screen, and the specific view corresponding to the user operation can be accurately identified, so as to achieve a more accurate interaction response and improve the user experience. For example, in a multi-screen collaborative operation scenario, the click operation of the user on the second display screen can accurately correspond to the corresponding view on the first display screen, avoiding misoperations and chaos, and ensuring targeted updates of the view during the interaction between the user and the interface. Further, based on the updated target view, the target view on the second display screen is updated through the clone layer controllers of at least one layer, ensuring the consistency of the target views on the first display screen and the second display screen, enhancing the interaction function between multiple screens, and making the multi-screen collaborative operation more smooth and natural.
[0015] Combining the first aspect and the above implementation manner, in some possible implementation manners, the event parameter includes the original event coordinates, and determining the target view corresponding to the touch screen event from multiple views of the first display screen according to the event parameter and the position offset includes: converting the touch screen event from the second display screen to the first display screen according to the original event coordinates and the position offset to obtain the target event coordinates corresponding to the touch screen event under the first display screen; determining the target view according to the target event coordinates.
[0016] In a second aspect, a device for sharing an application interface is provided. The device includes: a display mode acquisition module, configured to acquire the display mode of the application interface of a target application in response to a screen sharing operation of the target application, where the screen sharing operation is used to share the application interface on a first display screen to a second display screen; a display mode switching module, configured to adjust the display mode of the application interface to a full-screen mode when the display mode is a non-full-screen mode; and an interface sharing module, configured to share the application interface from the first display screen to the second display screen.
[0017] Combining the second aspect, in some possible implementation manners, the display mode switching module is specifically configured to: acquire the first screen size of the first display screen and the original display size of the application interface; determine the size change amount of the application interface according to the first screen size and the original display size; and adjust the display mode of the application interface to a full-screen mode according to the size change amount.
[0018] Combined with the second aspect and the above implementation manners, in some possible implementation manners, the display mode switching module is further configured to: determine an adjustment rate of the application interface according to the size change amount and a preset adjustment duration; and adjust the display mode of the application interface to a full-screen mode according to the adjustment rate.
[0019] Combined with the second aspect and the above implementation manners, in some possible implementation manners, the interface sharing module is specifically configured to: obtain a second screen size of the second display screen and original layer controllers of at least one layer in the application interface on the first display screen; clone the original layer controllers of the at least one layer to obtain cloned layer controllers of the at least one layer; determine position parameters of at least one view component according to the second screen size, where the position parameters are used to represent a display area of the view component on the second display screen, and the at least one view component is a view component corresponding to the at least one layer; and display a plurality of views corresponding to the at least one layer on the second display screen according to the cloned layer controllers of the at least one layer and the position parameters of the at least one view component.
[0020] Combined with the second aspect and the above implementation manners, in some possible implementation manners, the interface sharing module is further configured to: create the at least one view component according to the cloned layer controllers of the at least one layer; add the at least one view component to the second display screen based on the position parameters of the at least one view component; associate the cloned layer controllers of the at least one layer with the at least one view component, so that views corresponding to the at least one layer on the second display screen are synchronized with views corresponding to the at least one layer on the first display screen; and for any one of the at least one layer, perform rendering in a view component corresponding to the layer according to an attribute parameter of the layer, so that the view component displays the view corresponding to the layer, where the attribute parameter is used to represent a display state of the layer.
[0021] Combined with the second aspect and the above implementation manners, in some possible implementation manners, after sharing the application interface from the first display screen to the second display screen, the apparatus further includes: a view update module, configured to, in response to a touch screen event on the second display screen, obtain an event parameter of the touch screen event, where the event parameter is used to represent a position where the touch screen event occurs on the second display screen; obtain a position offset of the second display screen relative to the first display screen; determine a target view corresponding to the touch screen event from views corresponding to at least one layer of the first display screen according to the event parameter and the position offset; update the target view according to a type of the touch screen event; and update the target view on the second display screen through the cloned layer controllers of the at least one layer based on the updated target view.
[0022] Combined with the second aspect and the above implementation manners, in some possible implementation manners, the event parameter includes the original event coordinates, and the view update module is further configured to: convert the touch event from the second display screen to the first display screen according to the original event coordinates and the position offset to obtain target event coordinates corresponding to the touch event under the first display screen; and determine the target view according to the target event coordinates.
[0023] In a third aspect, an electronic device is provided, including a memory and a processor. The memory is used for storing executable program code, and the processor is used for calling and running the executable program code from the memory, so that the electronic device executes the method in the first aspect or any one of the possible implementation manners of the first aspect.
[0024] In a fourth aspect, a computer program product is provided, including: computer program code, when the computer program code runs on a computer, enabling the computer to execute the method in the first aspect or any one of the possible implementation manners of the first aspect.
[0025] In a fifth aspect, a computer-readable storage medium is provided, storing computer program code, when the computer program code runs on a computer, enabling the computer to execute the method in the first aspect or any one of the possible implementation manners of the first aspect. Description of the Drawings
[0026] Figure 1 FIG. is a schematic diagram of a screen sharing scenario provided by an embodiment of the present application;
[0027] Figure 2 FIG. is a schematic flowchart of a method for sharing an application interface provided by an embodiment of the present application;
[0028] Figure 3 FIG. is a schematic diagram of a scenario for switching a display mode provided by an embodiment of the present application;
[0029] Figure 4 FIG. is a schematic flowchart of another method for sharing an application interface provided by an embodiment of the present application;
[0030] Figure 5 FIG. is a schematic structural diagram of a device for sharing an application interface provided by an embodiment of the present application;
[0031] Figure 6 FIG. is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed Embodiments
[0032] The technical solutions in the present application will be clearly and elaborately described below in conjunction with the accompanying drawings. Among them, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may mean A or B. The "and / or" in the text is merely a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.
[0033] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features.
[0034] Before introducing the solutions of the embodiments of the present application, the professional terms that may be involved in the embodiments of the present application will be explained first.
[0035] Application window sharing: It refers to sharing the window content of a specific application program with other users on a computer or a mobile device.
[0036] Layer Controller: A tool or interface for managing and operating layers. It allows users to create, delete, hide, lock, adjust the order, and apply effects to layers, and can provide various operations on layers, such as adding, deleting, copying, merging, etc.
[0037] Layer: An independent display element that constitutes the user interface (UI), that is, a component in the UI interface of the Android system. Each layer can contain images, text, and other content.
[0038] View: One of the most basic building blocks in the Android system UI framework, representing a rectangular area on the screen and can be used for drawing and event handling.
[0039] After introducing the professional terms that may be involved in the embodiments of the present application, the application scenarios of the embodiments of the present application will be introduced below.
[0040] Figure 1 It is a schematic diagram of a screen sharing scenario provided by the embodiments of the present application.
[0041] Exemplarily, as Figure 1 shown, a plurality of display screens are installed in the vehicle, namely display screen 1 and display screen 2. Display screen 1 can specifically be the central control screen in the vehicle; display screen 2 can specifically be the co-pilot screen in the vehicle.
[0042] Based on multiple displays installed in a vehicle, during the use of the multiple displays by a user, the user can control the multiple displays to achieve screen sharing.
[0043] Exemplarily, if the user opens a video software on Display 1, the current video interface is displayed in the display area of Display 1. As Figure 1 shown, in this scenario, in order for multiple users in the vehicle to view the same video interface on the display closest to each of them, the user can synchronously share the video interface on Display 1 to Display 2. As a result, the same video interface is also displayed in the display area of Display 2, thus achieving screen sharing between multiple displays.
[0044] In a possible implementation manner, when the video interface displayed on the original display (for example, Display 1) is not full screen, in the related art when implementing the above application interface sharing on the screen, first the user needs to manually adjust the display mode of the application interface on the screen from the non-full-screen mode to the full-screen mode, and then initiate screen sharing.
[0045] Problems that may exist in the above screen sharing method may include: when the user is inconvenient to manually operate the screen, the above screen sharing process will increase the sharing difficulty and the user's operation difficulty, affecting the user's sharing experience.
[0046] Based on the above problems, the embodiments of the present application provide a method for sharing a screen, which can provide a user with a solution for intelligently sharing an application interface in a non-full-screen mode, and can complete screen sharing without the user manually switching the display mode, improving the user's sharing experience.
[0047] The following introduces a method for sharing a screen provided by the embodiments of the present application.
[0048] Figure 2 is a schematic flowchart of a method for sharing an application interface provided by the embodiments of the present application. It should be understood that the application scenario of this 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 this method as a multi-screen sharing scenario in a vehicle as an example, when the application scenario of this method is a multi-screen sharing scenario in a vehicle, the execution subject of this method can specifically be any electronic control unit (Electronic Control Unit, ECU, also referred to as a controller) in the vehicle. The following takes the multimedia controller as the execution subject of this method to introduce in detail a method for sharing an application interface provided by the embodiments of the present application.
[0049] Exemplarily, as Figure 2 shown, this method 200 includes the following steps 201-step 203.
[0050] 201. In response to a screen sharing operation on a target application, obtain a display mode of the application interface of the target application. The screen sharing operation is used to share the application interface on the first display screen to the second display screen.
[0051] It should be understood that currently, due to the continuous improvement of vehicle entertainment functions, multiple display screens are installed in the vehicle. For example, a central control screen at the driver's seat, a co-driver screen at the co-driver's seat, a rear row screen at the rear row position, a ceiling-mounted screen on the ceiling, etc. When there are multiple users in the vehicle, in order to bring a better entertainment experience to the users. Users can achieve screen sharing through multiple display screens, such as watching movies, playing games, singing, etc.
[0052] When a user realizes screen sharing through multiple display screens, the user can first configure any one of the multiple display screens and open the application that needs to run (i.e., the target application). The currently initially configured display screen is the first display screen. The multimedia controller, in response to the user's configuration operation, controls the first display screen to display the application interface of the target application in the display area.
[0053] The multimedia controller can also obtain the screen identifier of the current first display screen. The screen identifier is the display identity document (Display Identity Document, Display id) of the display screen.
[0054] Exemplarily, for the screen identifier of each display screen, a technician can pre-set a unique screen identifier for the multiple display screens in the vehicle. The multimedia controller, in response to the current screen sharing operation, can determine the display screen where the current screen sharing operation is located and correspondingly obtain the Display id of this display screen, that is, obtain the Display id of the first display screen.
[0055] Further, the user can configure the second display screen to be shared through a screen sharing operation (such as a click operation, a voice command, etc.) on the application interface of the target application. The multimedia controller receives this screen sharing operation and starts to execute the method flow of the embodiment of the present application.
[0056] After configuring the second display screen to be shared, the multimedia controller can also obtain the Display id of the current second display screen to be shared.
[0057] Optionally, the number of second display screens corresponding to the screen sharing operation can be one or multiple, and the embodiment of the present application does not limit this. In the following introduction of the embodiment of the present application, it is exemplified that the number of second display screens is 1.
[0058] It should be understood that the core of the solution in the embodiments of the present application is that when screen sharing, if the application interface on the first display screen is in a non-full-screen display state, the application interface can be shared from the first display screen to the second display screen without manual operation by the user. Therefore, after receiving the screen sharing operation, the multimedia controller needs to first obtain the display mode of the application interface of the current target application.
[0059] Optionally, the display mode includes a full-screen mode and a non-full-screen mode.
[0060] Exemplarily, in the Android system, the multimedia controller can obtain the current system UI visibility state through the method getWindow().getDecorView().getSystemUiVisibility(), and determine whether the current application interface is in a non-full-screen display based on the returned result. Specifically, by checking whether the returned result contains a specific flag bit SYSTEM_UI_FLAG_FULLSCREEN. If the returned result contains the above flag bit, it indicates that the display mode of the application interface is the full-screen mode. If the returned result does not contain the above flag bit, it indicates that the display mode of the application interface is the non-full-screen mode.
[0061] Another exemplarily, the multimedia controller can also use the isInMultiWindowMode() method of the Activity class to check whether the current activity is in the split-screen mode. If the returned value is false, it indicates that the application interface is in the full-screen mode.
[0062] Another exemplarily, in the full-screen mode, the display size of the application interface is the same as the screen size. The multimedia controller can also compare the display size of the application interface with the screen size. When the display size of the application interface is smaller than the screen size, it indicates that the display mode of the application interface is the non-full-screen mode; when the display size of the application interface is equal to the screen size, it indicates that the display mode of the application interface is the full-screen mode.
[0063] Thus, through the above process, the multimedia controller can obtain the display mode of the application interface of the target application.
[0064] 202. In the case where the display mode is the non-full-screen mode, adjust the display mode of the application interface to the full-screen mode.
[0065] When the application interface of the target application is in the full-screen mode, the multimedia controller can directly share the application interface from the first display screen to the second display screen. The specific sharing process will be introduced below.
[0066] When the application interface of the target application is in a non-full-screen mode, based on the method provided in the embodiments of the present application, the multimedia controller needs to first automatically adjust the display mode of the application interface from the non-full-screen mode to the full-screen mode, and then implement the sharing process.
[0067] Specifically, when the embodiments of the present application adjust the display mode of the application interface from the non-full-screen mode to the full-screen mode, the display Bounds of the window where the application interface is located can be modified to achieve the effect of changing the window size, thereby realizing the switching of the application interface from the non-full-screen mode to the full-screen mode.
[0068] In the Android system, the display Bounds of a window refers to a rectangular area used to define the position and size of the window on the screen, usually represented by a Rect object, which contains four coordinate values of left, top, right, and bottom. Among them, the coordinate values of the left and top determine the position of the upper left corner of the window on the screen, and the coordinate values of the right and bottom determine the position of the lower right corner of the window. The position of the upper left corner and the lower right corner of the window determine the width and height of the window.
[0069] The process of realizing the display mode switching by modifying the Bounds of the window where the application interface is located is as follows:
[0070] In a possible implementation manner, adjusting the display mode of the application interface to the full-screen mode includes:
[0071] Obtain the first screen size of the first display screen and the original display size of the application interface;
[0072] Determine the size change amount of the application interface according to the first screen size and the original display size;
[0073] Adjust the display mode of the application interface to the full-screen mode according to the size change amount.
[0074] It should be understood that when the embodiments of the present application adjust the application interface from the non-full-screen mode to the full-screen mode, if it is an instantaneous switch, it may cause the application interface on the display screen to mutate, bringing a bad experience to the user. To avoid the above problems, during the switching process, the embodiments of the present application can provide a way of animated switching to enable the smooth switching of the display mode.
[0075] Specifically, during the process of switching the display mode, first the multimedia controller obtains the WindowManager. The WindowManager is used to manage the attributes and states of the window. Based on the WindowManager, the LayoutParams of the current window are obtained. The LayoutParams contains information such as the position and size of the window.
[0076] Furthermore, the multimedia controller can calculate the starting Bounds and the target Bounds. Among them, the starting Bounds is the original display size of the current application interface, and the target Bounds is the first screen size of the first display screen.
[0077] Exemplarily, after the multimedia controller responds to the screen sharing operation and obtains the Display id of the first display screen, the screen size of each display screen is fixed. Technicians can pre - establish a mapping relationship between the Display id of each display screen and the screen size, and store this mapping relationship in the multimedia controller. Therefore, based on the Display id of the first display screen and the above - mentioned mapping relationship, the multimedia controller can obtain the first screen size of the first display screen.
[0078] Regarding the original display size of the current application interface, before adjustment, the size in the LayoutParams of the display Bounds of the current window is the original display size of the application interface.
[0079] After setting the starting Bounds and the target Bounds, the multimedia controller can calculate the size change amount of the application interface based on the original display size and the first screen size.
[0080] Furthermore, the multimedia controller can set a switching animation according to the size change amount, so that the application interface gradually switches from the non - full - screen mode to the full - screen mode.
[0081] In a possible implementation manner, adjusting the display size of the application interface to the full - screen mode according to the size change amount includes:
[0082] Determining the adjustment rate of the application interface according to the size change amount and the preset adjustment duration;
[0083] Adjusting the display mode of the application interface to the full - screen mode according to the adjustment rate.
[0084] Among them, the size change amount includes the change amounts of the display size of the application interface on the four boundaries.
[0085] Specifically, in the embodiments of the present application, a preset adjustment duration can be set during the process of switching the display mode. Based on the calculated size change amount, the multimedia controller can create an animation using ValueAnimator according to the preset adjustment duration, and gradually update the LayoutParamas of the window through the addUpdateListener of this animation, achieving the effect of gradually adjusting the display mode of the application interface from the non-full-screen mode to the full-screen mode. In the above process, based on the preset adjustment duration, it can be monitored through AnimatorUpdateListener to obtain the current value when each frame of the animation is updated, and update the application interface according to this value.
[0086] Figure 3 It is a schematic diagram of a scenario for switching the display mode provided by the embodiments of the present application.
[0087] Exemplarily, as Figure 3 shown, based on the animation-based method provided by the embodiments of the present application, when switching the application interface from the non-full-screen mode to the full-screen mode, the change process of the application interface in the first display screen can be Figure 3 from (a) to (b) to (c) in, that is, the size of the application interface gradually increases until the size of the application interface is equal to the first screen size of the first display screen, and the animation switching process ends.
[0088] In the above technical solution, when adjusting the application interface from the non-full-screen mode to the full-screen mode, first determine the adjustment rate according to the size change amount and the preset adjustment duration, and then make the adjustment according to the adjustment rate, which can ensure that the application interface can switch from the non-full-screen mode to the full-screen mode at an appropriate speed, avoiding the problem of poor visual effects for users caused by too fast adjustment speed, and making the entire adjustment process smooth and fluent.
[0089] 203. Share the application interface from the first display screen to the second display screen.
[0090] Through the above step 202, when the embodiments of the present application need to share the screen, if the application interface in the first display screen is in the non-full-screen mode, first automatically switch the display mode of the application interface from the non-full-screen mode to the full-screen mode.
[0091] After switching the display mode of the application interface to the full-screen mode, the multimedia controller can implement the application interface sharing process.
[0092] Specifically, in the embodiments of the present application, the sharing process of the application interface can be implemented by cloning the layer controller.
[0093] In a possible implementation manner, sharing the application interface from the first display screen to the second display screen includes:
[0094] Obtain the second screen size of the second display screen, and the original layer controllers of at least one layer in the application interface on the first display screen;
[0095] Clone the original layer controllers of at least one layer to obtain the cloned layer controllers of at least one layer;
[0096] Determine the position parameters of at least one view component according to the second screen size, where the position parameters are used to represent the display area of the view component on the second display screen, and the at least one view component is the view component corresponding to at least one layer;
[0097] Display the views corresponding to at least one layer on the second display screen according to the cloned layer controllers of at least one layer and the position parameters of at least one view component.
[0098] It should be understood that when the multimedia controller in the embodiment of the present application implements screen sharing, it copies (or clones) the layer controller of the first display screen, so that the second display screen and the first display screen share a graphics buffer, so as to achieve the effect that the second display screen and the first display screen display the same data. Therefore, when implementing screen sharing, first, the multimedia controller can obtain the original layer controllers of at least one layer in the current application interface of the first display screen. The original layer controllers of at least one layer are used to manage at least one layer, and at least one layer is used to display the views corresponding to at least one layer.
[0099] Exemplarily, when obtaining the original layer controllers of at least one layer of the first display screen, it involves interacting with the Window Manager Service (WMS) and the Surface Flinger. Specifically, the multimedia controller first obtains the WMS, then further obtains the window token (Token) of the first display screen, and through the window Token of the first display screen, obtains all the original layer controllers of the first display screen, and thus can obtain the original layer controllers of at least one layer.
[0100] In addition to obtaining the original layer controllers of at least one layer of the first display screen, in order to facilitate the views to achieve the best display effect on the second display screen, the multimedia controller also needs to obtain the second screen size of the second display screen.
[0101] Exemplarily, after the multimedia controller obtains the Display id of the second display screen in response to the screen sharing operation, based on the Display id of the second display screen and the above mapping relationship, the multimedia controller can obtain the second screen size of the second display screen.
[0102] Thus, through the above process, the multimedia controller can obtain the information required by the cloned layer controller.
[0103] After obtaining the multiple original layer controllers of the first display screen, the multimedia controller can clone the original layer controllers of at least one layer and implement screen sharing based on the cloned layer controllers.
[0104] During the cloning process, the number of cloning times is related to the number of second display screens. In the embodiments of the present application, it is exemplified that the number of second display screens is 1. Therefore, by cloning the original layer controllers of at least one layer once, at least one layer of cloned layer controllers can be obtained.
[0105] Specifically, the multimedia controller can call SurfaceControl.Builder in the Android system to create a new SurfaceControl instance and reference the same underlying Surface object. By performing the above operations on each original layer controller, at least one layer of cloned layer controllers can be obtained.
[0106] It should be understood that in the embodiments of the present application, the reason for implementing screen sharing by cloning the layer controller is that: the cloned 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 attributes 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, in fact, the same image (or view) is shared among multiple display screens, thereby realizing the sharing of the screen view.
[0107] It should also be understood that in combination with the above description, the result of screen sharing is that the second display screen displays the same content as the first display screen. However, during the sharing process, since the screen sizes of different display screens may vary. Even for the same view, the display sizes on different display screens may also be different. Therefore, when displaying the view of the layer corresponding to the original layer controller on the second display screen based on the cloned layer controller, the second screen size of the second display screen also needs to be considered.
[0108] In the clone layer controller based on the second screen size of the second display screen, when displaying the views corresponding to at least one layer on the second display screen, since the layer controller itself does not directly handle the layout or display position of the views, but operates on the layer at the system level. Therefore, in order to ensure that the views corresponding to at least one layer associated with the original layer controller of at least one layer can be displayed on the second display screen, the multimedia controller can first create corresponding SurfaceViews for each clone layer controller to obtain at least one view component. SurfaceView is a view component in the Android system, which is used to display the views of the layers associated with the layer controller on the second display screen.
[0109] It should be understood that when adding a view component to the second display screen, in fact, the view component is added to the window, and the window is the top-level container in the Android system. In order to ensure that at least one SurfaceView can be correctly added to the window of the second display screen, the multimedia controller needs to determine the position parameters of at least one SurfaceView (or window) through the WindowManager according to the second screen size of the second display screen, so as to directly add at least one SurfaceView to the window. The position parameters are used to represent the display area of the SurfaceView on the second display screen, which is used to ensure that the size of the SurfaceView matches the size of the second display screen, and the views can be displayed on the second display screen according to the positions of the views in the first display screen.
[0110] Optionally, the position parameters of the window include width, length, position, window type, window flags, token, display id, pixel format, etc.
[0111] Exemplarily, when the multimedia controller determines the position parameters of the window, it can be implemented through the class - LayoutParams used to define the position parameters (also known as "layout parameters") in the Android system.
[0112] Among them, for the width and length in the position parameters, since the clone layer controller corresponding to each view component is fixed, and each clone layer controller corresponds to an original layer controller. In order to make the views on the first display screen consistent with those on the second display screen. Figure 1 When the multimedia controller configures the position parameters of a view component each time, it can obtain the size of the original layer controller corresponding to it, and set the width in the position 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.
[0113] The position x and y define the coordinates of the upper left corner of the SurfaceView.
[0114] The type of the window is generally set to TYPE_APPLICATION, which is used to indicate that this is an application window.
[0115] The flags of the window are generally set to FLAG_NOT_FOCUSABLE, indicating that the window will not obtain focus, and FLAG_LAYOUT_NO_LIMITS, indicating that the window is allowed to exceed the display boundary.
[0116] The pixel format is generally set to PixelFormat.TRANSLUCENT, indicating translucency.
[0117] The token can be set to null or an appropriate token, which is used to identify the application or activity to which the window belongs.
[0118] The displayId indicates which display the window is to be added to. Here, it is the displayId of the second display.
[0119] Thus, by configuring the position parameters of each view component according to the above process, the position parameters of each view component can be obtained.
[0120] Furthermore, the multimedia controller can display multiple views corresponding to at least one layer on the second display according to the clone layer controller of at least one layer and the position parameters of at least one view component.
[0121] It should be understood that the configuration of the above position parameters only determines the size and position of the view component, and at least one view component has not been obtained. Therefore, after the configuration of the position parameters is completed, the multimedia controller can create at least one view component based on the position parameters of at least one view component and the clone layer controller of at least one layer, and display the views corresponding to at least one layer.
[0122] In a possible implementation, displaying multiple views corresponding to at least one layer on the second display according to the clone layer controller of at least one layer and the position parameters of at least one view component includes:
[0123] Create at least one view component according to the clone layer controller of at least one layer;
[0124] Add at least one view component to the second display based on the position parameters of at least one view component;
[0125] Associate the clone layer controller of at least one layer with at least one view component so that the view corresponding to at least one layer on the second display screen is synchronized with the view corresponding to at least one layer on the first display screen;
[0126] For any one of the at least one layer, render in the view component corresponding to the layer according to the attribute parameters of the layer, so that the view component displays the view corresponding to the layer, and the attribute parameters are used to represent the display state of the layer.
[0127] Specifically, after determining the position parameters of at least one view component, the multimedia controller can create a corresponding SurfaceView for each clone layer controller. Further, the multimedia controller can add each SurfaceView to the second display screen using the WindowManager based on the position parameters of each SurfaceView.
[0128] After adding at least one view component to the second display screen, further, the multimedia controller can connect each clone layer controller to the Surface of its corresponding SurfaceView through the SurfaceHolder. Among them, the above management of each view component and its corresponding clone layer controller means establishing a mapping relationship between the view component and the clone layer controller after creating the view component, so that the view component can obtain the layer information managed by the corresponding clone layer controller, enabling the view component to display the view corresponding to it, so as to achieve the effect of corresponding one-to-one with the view content on the first display screen.
[0129] After establishing the mapping relationship between the clone layer controller and the view component, for each layer, the multimedia controller can obtain its attribute parameters from the clone layer controller. The attribute parameters are used to represent the display state of the layer.
[0130] Optionally, the attribute parameters include but are not limited to geometric attribute parameters, visual attribute parameters, and style attribute parameters. Among them, the geometric attribute parameters include the position and size of the layer, the visual attribute parameters include the color and transparency of the layer, and the style attribute parameters include the border style and shadow effect of the layer.
[0131] After obtaining the attribute parameters of each layer, the multimedia controller can draw the geometric shape of the layer, such as a rectangle, a circle, etc. in the view component based on the drawing tools in the Android system, and set the transparency of the view component according to the transparency parameter. If there are image or texture parameters, load and draw the corresponding image or texture into the view component, and draw the border of the layer according to the border style parameter. Add a shadow effect to the layer according to the shadow attribute parameter.
[0132] Thus, through the above process, the complete process of sharing the application interface from the first display screen to the second display screen can be achieved.
[0133] Furthermore, after realizing screen sharing of multiple display screens, the embodiments of the present application also provide a solution for synchronously updating the view content of multiple shared display screens.
[0134] In a possible implementation manner, after sharing the application interface from the first display screen to the second display screen, the method further includes:
[0135] In response to a touch event on the second display screen, obtain event parameters of the touch event, where the event parameters are used to represent the position where the touch event occurs on the second display screen;
[0136] Obtain the position offset of the second display screen relative to the first display screen;
[0137] Determine a target view corresponding to the touch event from the views corresponding to at least one layer of the first display screen according to the event parameters and the position offset;
[0138] Update the target view according to the type of the touch event;
[0139] Based on the updated target view, update the target view on the second display screen through the clone layer controller of at least one layer.
[0140] After the views of the first display screen and the second display screen are shared, if the user performs a touch operation on the second display screen, a corresponding touch event is generated. When the multimedia controller processes the touch event, it can forward the touch event to the corresponding view in the first display screen so that the corresponding view can respond to the touch event for updating, achieving the effect of real-time view update.
[0141] Exemplarily, for the capture of the touch event, the multimedia controller can be implemented by setting a touch listener for the SurfaceView. During the process of the second display screen displaying the view, if the user performs a click operation on the second display screen, the multimedia controller can monitor the operation through the touch listener and generate a corresponding touch event.
[0142] Since the touch event occurs on the second display screen, the multimedia controller needs to forward the touch event to the first display screen. Due to the difference in the positions of the first display screen and the second display screen, the multimedia controller needs to first obtain the event parameters of the touch event on the second display screen. The event parameters are used to represent the position where the touch event occurs on the second display screen.
[0143] Optionally, the event parameters include the original event coordinates of the touch event on the second display screen, including the original x coordinate and the original y coordinate of the touch event.
[0144] Exemplarily, for the position offset, the multimedia controller can 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 second display screen relative to the first display screen according to the upper left corner coordinates of the second display screen and the upper left corner coordinates of the first display screen.
[0145] Exemplarily, the coordinates of the upper left corner of the second display are marked as "(x1, y1)", and the coordinates of the upper left corner of the first display are marked as "(x2, y2)", then the position offset of the second display relative to the first display is offset x = x2-x1, and offset y = y2-y1.
[0146] It should be understood that the above calculation of the position offset between the second display screen and the first display screen is based on the global coordinate system. The local coordinate system is only applicable to a single display screen such as the first display screen or the second display screen, and cannot realize cross-screen processing of events. Therefore, when converting the touch screen event from the second display screen to the first 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 second display screen in the global coordinate system, rather than the coordinates in the local coordinate system.
[0147] 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.
[0148] It should be understood that, in general, the application interface of the current display screen includes more than one view. When the multimedia controller converts the touch screen event from the second display screen to the first display screen, it is also necessary to determine which view of the multiple views of the first display screen the current touch screen event specifically corresponds to, so as to ensure the accurate update of the display screen of the first display screen.
[0149] 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.
[0150] In a possible implementation, determining a target view corresponding to the touch screen event from multiple views of the first display screen according to the event parameter and the position offset includes:
[0151] Convert the touch screen event from the second display screen to the first 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 first display screen;
[0152] Determine the target view according to the target event coordinates.
[0153] Specifically, when determining the target view, since each layer or view corresponds to a display range on the display interface, which is known, the display range can be quantitatively represented by coordinates. Therefore, the multimedia controller can determine the target view from the views corresponding to at least one layer based on the coordinate ranges of at least one layer or the views corresponding to at least one layer.
[0154] Since layers are all composed of views. Therefore, the multimedia controller needs to first determine the layer corresponding to the touch screen event, and then determine the target view from the views of the layer corresponding to the touch screen event.
[0155] When obtaining the coordinate range of the layer, it can be mainly obtained through the following several methods: The first is to obtain the left boundary of the layer through the getLeft() method; obtain the upper boundary of the layer through the getTop() method; obtain the right boundary of the layer through the getRight() method; and obtain the lower boundary of the layer through the getBottom() method. Thus, the coordinate range corresponding to the layer can be obtained; the second is to obtain the coordinate range corresponding to the layer from the position parameters of the view component based on the created view component. Obtain the position parameters of each SurfaceView through the getLayoutParams() method, and obtain the coordinate range of the layer from them; the third is to manage the boundary information of each layer through a map in advance, and thus obtain the coordinate range corresponding to each layer.
[0156] After obtaining the coordinate ranges of at least one layer, the multimedia controller can determine which coordinate range of which layer the current target event coordinates are specifically located in, and determine the layer as the target layer.
[0157] When determining the target view corresponding to the target layer, a layer may correspond to one view or multiple views. When determining the target view from at least one view of the target layer, technicians can configure the corresponding relationship between each layer controller and the corresponding view, and the boundary information of each view when creating and adding multiple SurfaceViews as described above, 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.
[0158] When the target layer consists of only one view, if the multimedia controller determines that the target event coordinate already belongs to the coordinate range of the target layer, the target event coordinate must also belong to the coordinate range of the target view. Therefore, in this case, this view corresponding to the target layer is the target view.
[0159] When the target layer consists of multiple views, the multimedia controller also needs to match the target event coordinate with the boundary information of at least one view to determine which view's coordinate range the target event coordinate is located in, so as to determine the view whose coordinate range includes the target event coordinate as the target view.
[0160] When the multimedia controller forwards the touch event to the target view, the view system of the Android system will call the dispatchTouchEvent method to handle the touch event.
[0161] Specifically, during the process of handling the touch event, the view system can first determine the event type of the touch event and determine the corresponding callback handling method in combination with the event type.
[0162] Exemplarily, the multimedia controller can determine the specific type of the touch event through the getAction() method of MotionEvent.
[0163] Different event types correspond to different callback handling methods. For example, when the event type of the touch event is a touch event, the view system will handle these events through the onTouchEvent method. Specifically, the event types of the touch event include click, slide, or long press, etc. The callback handling method corresponding to the click event (Click) is OnClickListener; the callback handling method corresponding to the long click event (Long Click) is OnLongClickListener. When the event type of the touch event is a key event, if the touch event is a key down (Key Down), the corresponding callback handling method is onKeyDown; if the touch event is a key up (Key Up), the corresponding callback handling method is onKeyUp.
[0164] After the event handling 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.).
[0165] After the multimedia controller completes the update process of the target view on the first display screen, it is also necessary to further synchronously update the target view on the second display screen. During the synchronous update process, the multimedia controller can update the target view on the second display screen based on the cloned layer controllers of at least one layer.
[0166] Specifically, after the target view of the first display screen is updated, the multimedia controller can record the current status of the target view update, call the updateSharedScreens method, traverse all the cloned layer controllers, and update the corresponding target views.
[0167] In the above technical solution, by responding to the touch screen event on the second display screen and obtaining the event parameters, the operation position information of the user on the second display screen can be accurately captured. Combining the position offset of the second display screen relative to the first display screen, the target view corresponding to the touch screen event is determined from the views corresponding to at least one layer of the first display screen, which can accurately identify the specific view corresponding to the user operation, thereby achieving a more accurate interaction response and improving the user experience. For example, in a multi-screen collaborative operation scenario, the click operation of the user on the second display screen can accurately correspond to the corresponding view on the first display screen, avoiding misoperations and chaos, and ensuring the targeted update of the view during the user-interface interaction process. Further, based on the updated target view, the target view on the second display screen is updated through the cloned layer controllers of at least one layer, ensuring the consistency of the target views on the first display screen and the second display screen, enhancing the interaction function between multiple screens, and making the multi-screen collaborative operation more fluent and natural.
[0168] In summary, when interaction is required between multiple display screens, the present application proposes a method for sharing an application interface. When receiving a screen sharing operation, this method can first determine whether the application interface of the current target application is in a full-screen display state or a non-full-screen display state. When the application interface is in a non-full-screen display state, the application interface is adjusted to the full-screen display state and then switched from the first display screen to the second display screen. The above process can intelligently switch to the full-screen display state first if the application interface is in a non-full-screen display state when sharing the application interface is required. The process of switching the application interface from non-full screen to full screen does not require manual intervention by the user, greatly avoiding the inconvenience caused when the user is inconvenient to operate, improving the sharing efficiency, and enhancing the user experience. In addition, before sharing, the application interface is first adjusted to the full-screen mode, avoiding the situation of incomplete interface display on the second display screen, bringing a better visual experience to the user, and avoiding problems such as stretching and deformation of the application interface during non-full-screen sharing.
[0169] Next, Figure 4 the overall process of the embodiments of the present application will be introduced.
[0170] Figure 4 It is a schematic flowchart of another method for sharing an application interface provided by an embodiment of the present application.
[0171] Exemplarily, as Figure 4 shown, the method 400 includes the following steps 401-step 416:
[0172] 401. In response to a screen sharing operation on a target application, obtain the display mode of the application interface of the target application. The screen sharing operation is used to share the application interface on the first display screen to the second display screen.
[0173] 402. Determine whether the display mode is a non-full screen mode.
[0174] When the display mode is a non-full screen mode, execute step 403;
[0175] When the display mode is a full screen mode, directly implement the sharing process of the application interface.
[0176] 403. Obtain the first screen size of the first display screen and the original display size of the application interface.
[0177] 404. Determine the size change amount of the application interface according to the first screen size and the original display size.
[0178] 405. Adjust the display mode of the application interface to a full screen mode according to the size change amount.
[0179] 406. Obtain the second screen size of the second display screen and the original layer controllers of at least one layer in the application interface on the first display screen.
[0180] 407. Clone the original layer controllers of at least one layer to obtain the cloned layer controllers of at least one layer.
[0181] 408. Determine the position parameters of at least one view component according to the second screen size. The position parameters are used to represent the display area of the view component on the second display screen. The at least one view component is the view component corresponding to at least one layer.
[0182] 409. Create at least one view component according to the cloned layer controllers of at least one layer.
[0183] 410. Add at least one view component to the second display screen based on the position parameters of at least one view component.
[0184] 411. Associate the clone layer controller of at least one layer with at least one view component, so that the views corresponding to at least one layer on the second display screen are synchronized with the views corresponding to at least one layer on the first display screen.
[0185] 412. For any one of at least one layer, render in the view component corresponding to the layer according to the attribute parameters of the layer, so that the view component displays the view corresponding to the layer, and the attribute parameters are used to represent the display state of the layer.
[0186] 413. In response to a touch screen event on the second display screen, obtain the event parameters of the touch screen event, and the event parameters are used to represent the position where the touch screen event occurs on the second display screen.
[0187] 414. Obtain the position offset of the second display screen relative to the first display screen.
[0188] 415. Determine the target view corresponding to the touch screen event from the views corresponding to at least one layer of the first display screen according to the event parameters and the position offset.
[0189] 416. Update the target view according to the type of the touch screen event.
[0190] 417. Based on the updated target view, update the target view on the second display screen through the clone layer controller of at least one layer.
[0191] Steps 401 - 417 in the above method 400 have the same inventive concept as steps 201 - 203 in method 200. For specific details, refer to the introduction in method 200 and will not be elaborated here.
[0192] Figure 5 It is a schematic structural diagram of a screen sharing device provided by an embodiment of the present application.
[0193] Exemplarily, as Figure 5 shown, the device 500 includes:
[0194] A display mode acquisition module 501, configured to acquire the display mode of the application interface of the target application in response to a screen sharing operation on the target application, and the screen sharing operation is used to share the application interface on the first display screen to the second display screen;
[0195] A display mode switching module 502, configured to adjust the display mode of the application interface to the full - screen mode when the display mode is a non - full - screen mode;
[0196] An interface sharing module 503, configured to share the application interface from the first display screen to the second display screen.
[0197] In a possible implementation manner, the display mode switching module 502 is specifically configured to: obtain the first screen size of the first display screen and the original display size of the application interface; determine the size change amount of the application interface according to the first screen size and the original display size; and adjust the display mode of the application interface to the full-screen mode according to the size change amount.
[0198] In a possible implementation manner, the display mode switching module 502 is further configured to: determine the adjustment rate of the application interface according to the size change amount and a preset adjustment duration; and adjust the display mode of the application interface to the full-screen mode according to the adjustment rate.
[0199] In a possible implementation manner, the interface sharing module 503 is specifically configured to: obtain the second screen size of the second display screen and the original layer controllers of at least one layer in the application interface on the first display screen; clone the original layer controllers of the at least one layer to obtain the cloned layer controllers of the at least one layer; determine the position parameters of at least one view component according to the second screen size, where the position parameters are used to represent the display area of the view component in the second display screen, and the at least one view component is the view component corresponding to the at least one layer; and display the views corresponding to the at least one layer on the second display screen according to the cloned layer controllers of the at least one layer and the position parameters of the at least one view component.
[0200] In a possible implementation manner, the interface sharing module 503 is further configured to: create the at least one view component according to the cloned layer controllers of the at least one layer; add the at least one view component to the second display screen based on the position parameters of the at least one view component; associate the cloned layer controllers of the at least one layer with the at least one view component, so that the views corresponding to the at least one layer on the second display screen are synchronized with the views corresponding to the at least one layer on the first display screen; and for any one of the at least one layer, perform rendering in the view component corresponding to the layer according to the attribute parameters of the layer, so that the view component displays the view corresponding to the layer, where the attribute parameters are used to represent the display state of the layer.
[0201] Optionally, after sharing the application interface from the first display screen to the second display screen, the device further includes: a view update module, configured to, in response to a touch event on the second display screen, obtain event parameters of the touch event, where the event parameters are used to represent the position where the touch event occurs on the second display screen; obtain a position offset of the second display screen relative to the first display screen; determine, according to the event parameters and the position offset, a target view corresponding to the touch event from views corresponding to at least one layer of the first display screen; update the target view according to the type of the touch event; and update the target view on the second display screen through a clone layer controller of the at least one layer based on the updated target view.
[0202] In a possible implementation manner, the according to the event parameters includes original event coordinates, and the view update module is further configured to: convert the touch event from the second display screen to the first display screen according to the original event coordinates and the position offset to obtain target event coordinates corresponding to the touch event under the first display screen; and determine the target view according to the target event coordinates.
[0203] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
[0204] Exemplarily, as Figure 6 shown, the electronic device 600 includes: a memory 601 and a processor 602. Among them, an executable program code 6011 is stored in the memory 601, and the processor 602 is configured to call and execute the executable program code 6011 to execute a method for sharing an application interface.
[0205] In this embodiment, the electronic device can be divided into functional modules according to the above method example. For example, it can correspond to each functional module, 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 illustrative, and is only a logical function division. There may be other division methods in actual implementation.
[0206] In the case of dividing each functional module according to each function, the electronic device may include: a display mode acquisition module, a display mode switching module, an interface sharing module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be cited in the function description of the corresponding functional module, and will not be repeated here.
[0207] The electronic device provided by this embodiment is used to execute the above method for sharing an application interface, and thus can achieve the same effect as the above implementation method.
[0208] In the case of adopting an integrated unit, the electronic device may include a processing module and a storage module. Among them, the processing module may be used to control and manage the operations of the electronic device. The storage module may be used to support the electronic device to execute relevant program codes and data, etc.
[0209] Among them, the processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules, and circuits shown in combination with the disclosure of this application. The processor may also be a combination that implements computing functions, such as including 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.
[0210] This embodiment also provides a computer-readable storage medium, in which computer program codes are stored. When the computer program codes run on a computer, the computer is caused to execute the above-mentioned related method steps to implement a method for sharing an application interface in the above embodiment.
[0211] This embodiment also provides a computer program product. When the computer program product runs on a computer, the computer is caused to execute the above-mentioned related steps to implement a method for sharing an application interface in the above embodiment.
[0212] In addition, the electronic device provided in the embodiment of this application may specifically be a chip, a component, or a module. The electronic device may include a processor and a memory connected thereto; among them, the memory is used to store instructions. When the electronic device runs, the processor may call and execute the instructions to cause the chip to execute a method for sharing an application interface in the above embodiment.
[0213] Among them, the electronic device, computer-readable storage medium, computer program product, or chip provided in this embodiment is all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved by them may refer to the beneficial effects in the corresponding method provided above, and will not be elaborated here.
[0214] Through the description of the above embodiments, those skilled in the art can understand that for the convenience and conciseness of description, only the above division of each functional module is used as an example. In actual applications, the above functions may be allocated to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0215] 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 merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, 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 displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of devices or units can be in electrical, mechanical or other forms.
[0216] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present application can easily think of changes or substitutions, which should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for sharing an application interface, characterized in that, The method includes: In response to a screen sharing operation on a target application, obtaining a display mode of the application interface of the target application, where the screen sharing operation is used to share the application interface on a first display screen to a second display screen; When the display mode is a non-full screen mode, adjusting the display mode of the application interface to a full screen mode; Sharing the application interface from the first display screen to the second display screen.
2. The method according to claim 1, wherein The adjusting the display mode of the application interface to a full screen mode includes: Obtaining a first screen size of the first display screen and an original display size of the application interface; Determining a size change amount of the application interface according to the first screen size and the original display size; Adjusting the display mode of the application interface to a full screen mode according to the size change amount.
3. The method according to claim 2, characterized in that, The adjusting the display size of the application interface to a full screen mode according to the size change amount includes: Determining an adjustment rate of the application interface according to the size change amount and a preset adjustment duration; Adjusting the display mode of the application interface to a full screen mode according to the adjustment rate.
4. The method according to claim 1, wherein The sharing the application interface from the first display screen to the second display screen includes: Obtaining a second screen size of the second display screen and an original layer controller of at least one layer in the application interface on the first display screen; Cloning the original layer controller of the at least one layer to obtain a cloned layer controller of the at least one layer; Determining position parameters of at least one view component according to the second screen size, where the position parameters are used to represent a display area of the view component on the second display screen, and the at least one view component is a view component corresponding to the at least one layer; Displaying views corresponding to the at least one layer on the second display screen according to the cloned layer controller of the at least one layer and the position parameters of the at least one view component.
5. The method according to claim 4, wherein The displaying views corresponding to the at least one layer on the second display screen according to the cloned layer controller of the at least one layer and the position parameters of the at least one view component includes: Creating the at least one view component according to the cloned layer controller of the at least one layer; Adding the at least one view component to the second display screen based on the position parameters of the at least one view component; Associating the cloned layer controller of the at least one layer with the at least one view component, so that views corresponding to the at least one layer on the second display screen are synchronized with views corresponding to the at least one layer on the first display screen; For any one of the at least one layer, rendering in a view component corresponding to the layer according to an attribute parameter of the layer, so that the view component displays a view corresponding to the layer, where the attribute parameter is used to represent a display state of the layer.
6. The method according to claim 1, wherein After the sharing the application interface from the first display screen to the second display screen, the method further includes: In response to a touch event on the second display screen, obtain event parameters of the touch event, where the event parameters are used to represent the position where the touch event occurs on the second display screen; Obtain the position offset of the second display screen relative to the first display screen; According to the event parameters and the position offset, determine a target view corresponding to the touch event from the views corresponding to at least one layer of the first display screen; Update the target view according to the type of the touch event; Based on the updated target view, update the target view on the second display screen through the clone layer controller of the at least one layer.
7. The method according to claim 6, characterized in that, The according to the event parameters includes original event coordinates, and the determining, from multiple views of the first display screen, a target view corresponding to the touch event according to the event parameters and the position offset includes: According to the original event coordinates and the position offset, convert the touch event from the second display screen to the first display screen to obtain target event coordinates corresponding to the touch event under the first display screen; Determine the target view according to the target event coordinates.
8. A device for sharing an application interface, characterized in that The device includes: A display mode acquisition module, configured to, in response to a screen sharing operation on a target application, acquire a display mode of an application interface of the target application, where the screen sharing operation is used to share the application interface on the first display screen to the second display screen; A display mode switching module, configured to, when the display mode is a non-full screen mode, adjust the display mode of the application interface to a full screen mode; An interface sharing module, configured to share the application interface from the first display screen to the second display screen.
9. An electronic device, characterized in that, The electronic device includes: A memory, configured to store executable program code; 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.