View transfer method, apparatus and system, and computer-readable storage medium
Patent Information
- Application Number
- PCT/CN2024/144660
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-03
- Filing Date
- 2024-12-31
- Publication Date
- 2025-10-09
Smart Images

Figure CN2024144660_09102025_PF_FP_ABST
Abstract
Description
View transmission method, device, system and computer-readable storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 3, 2024, with application number 202410417192.X and application name “View Transmission Method, Device, System and Computer-Readable Storage Medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of view processing technology, and in particular to a view transmission method, device, system, and computer-readable storage medium. Background Art
[0003] The software development kit (SDK) provided by the Android system includes a view class called RemoteViews that supports cross-process transmission. This class has the function of transmitting the view of the view provider to the view displayer for display. This function is typically used in the scenario of displaying in the notification bar. This scenario is called cross-process view transmission.
[0004] However, the Android system's native view class that supports cross-process transmission, RemoteViews, only supports generating views based on basic controls. Even when generating custom views, basic controls are required as support. It does not support transmitting custom views, or the generated custom views are highly complex, resulting in low transmission efficiency of custom views. Therefore, how to improve the transmission efficiency of custom views in the Android system is an urgent problem that needs to be solved. Technical Solutions
[0005] Embodiments of the present application provide a view transmission method, device, system, and computer-readable storage medium, which can improve the transmission efficiency of custom views in an Android system.
[0006] In a first aspect, an embodiment of the present application provides a view transmission method, the method comprising:
[0007] Get the custom view parameters created by the view provider based on the custom view interface in the pre-created cross-process transfer view class;
[0008] Generate a custom view file according to the custom view parameters and a preset custom view template;
[0009] The custom view file is transmitted to the view display party through the binder transmission mechanism.
[0010] In a second aspect, an embodiment of the present application provides a view transmission device.
[0011] An acquiring unit, configured to acquire custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transfer view class;
[0012] A generating unit, configured to generate a custom view file according to the custom view parameters and a preset custom view template;
[0013] The transmission unit is used to transmit the custom view file to the view display party through the binder transmission mechanism.
[0014] In a third aspect, an embodiment of the present application further provides a view transmission system, including a memory storing a computer program; a processor loading the computer program from the memory to execute the steps of any one of the view transmission methods provided in the embodiments of the present application.
[0015] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded by a processor to execute the steps of any view transmission method provided in the embodiment of the present application.
[0016] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which implements the steps of any view transmission method provided in the embodiment of the present application when executed by a processor.
[0017] Using the solution of the embodiment of the application, a view provider obtains custom view parameters created based on a custom view interface in a pre-created cross-process transfer view class; generates a custom view file based on the custom view parameters and a preset custom view template; and transmits the custom view file to the view displayer via a binder transmission mechanism. Custom view parameters created using the custom view interface in the pre-created cross-process transfer view class eliminate the need to generate a custom view based on basic controls, thereby reducing the complexity of the custom view and improving the transmission efficiency of the custom view. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0019] FIG1 is a schematic flow chart of a first embodiment of a view transmission method provided in an embodiment of the present application;
[0020] FIG2 is a schematic flow chart of a second embodiment of a view transmission method provided in an embodiment of the present application;
[0021] FIG3 is a schematic structural diagram of a view transmission device provided in an embodiment of the present application;
[0022] FIG4 is a schematic structural diagram of a view transmission system provided in an embodiment of the present application.
[0023] Implementation Methods of the Application
[0024] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0025] Embodiments of the present application provide a view transmission method, apparatus, system, and computer-readable storage medium.
[0026] Specifically, this embodiment will be described from the perspective of a view transmission system. The view transmission system may be integrated into a view transmission device, that is, the view transmission method of the embodiment of the present application may be executed by the view transmission system.
[0027] The view transmission method provided in the embodiment of the present application can be applied to devices using the Android system, such as mobile terminals and PC terminals.
[0028] The following detailed description is provided in conjunction with the accompanying drawings. This embodiment uses a view transmission system as an example. It should be noted that the order in which the following embodiments are described does not limit the preferred order of the embodiments. Although the flowcharts illustrate a logical order, in some cases, the steps shown or described may be performed in a different order than that shown in the accompanying drawings.
[0029] Please refer to FIG1 , which shows a first embodiment of a view transmission method provided by the present application.
[0030] Preferably, this view transmission process can be applied to notification bar display scenarios, such as displaying the view corresponding to a Weibo notification message in the notification bar.
[0031] Specifically, the specific process of the first embodiment of the present application includes the contents of step 101 to step 103, and each step is described in detail below:
[0032] Step 101: Obtain custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class.
[0033] In this embodiment, in devices using the Android system, such as mobile terminals and PC terminals, there are a view transmission system and multiple processes / applications. When process / application A needs to display the corresponding view in process / application B, process / application A is the view provider and process / application B is the view displayer.
[0034] In this embodiment, the cross-process transmission view class (RemoteViews) pre-created by the view transmission system can provide an external interface, which not only includes the event interface and data interface of the basic control, but also includes the custom event data interface and custom business data interface of the supported custom views.
[0035] In this step, the view transmission system first obtains the custom view parameters created by the view provider based on the custom view interface in the pre-created cross-process transmission view class.
[0036] Specifically, the custom view interface includes a custom event data interface and a custom business data interface, and the custom view parameters include custom event data created by the view provider based on the custom event data interface and custom business data created by the view provider based on the custom business data interface. Custom event data generally refers to events triggered when a user interacts with a view, such as click events, long press events, sliding events, etc. Custom business data refers to data related to a view, which is used to describe or control the state or behavior of the view. For example, for a list item view, custom business data can be the title, content, image and other information of the list item. For a button view, custom business data can be the button's text, icon, click status, etc.
[0037] It can be understood that the pre-created cross-process transmission view class includes a custom event data interface and a custom business data interface. Relevant users can create custom event data for the view provider based on the custom event data interface, and create custom business data for the view provider based on the custom business data interface; since the pre-created cross-process transmission view class provides a custom event data interface and a custom business data interface, you can selectively not use basic controls when creating custom view parameters, so as to avoid the increased complexity of custom view parameters caused by the use of basic controls.
[0038] For example, the view transmission system includes a custom RemoteViews SDK toolkit, which provides external interfaces, including event interfaces and data interfaces for basic controls, as well as custom event data interfaces and custom business data interfaces for supported custom Views. Relevant developers and users can create custom event data for view providers based on the custom event data interface, and create custom business data for view providers based on the custom business data interface.
[0039] Step 102: Generate a custom view file according to the custom view parameters and a preset custom view template.
[0040] In this step, the view transmission system obtains the custom view parameters of the view provider and generates a custom view file according to the custom view parameters and a preset custom view template.
[0041] Among them, the preset custom view template is generated in the cross-process transmission view class created in advance in this application.
[0042] The custom view file includes all necessary data corresponding to the custom view that the view provider needs to display, and the subsequent view displayer needs to generate and display the custom view according to the custom view file.
[0043] Exemplarily, after the view transmission system receives information from relevant developers and relevant users that they can create custom event data for the view provider based on the custom event data interface, it is necessary to bind the custom event data and custom business data to each corresponding custom sub-view in the custom view template to obtain a custom view file, which is a UI XML view description file of the instantiated serialized object.
[0044] Optionally, the specific step of “generating a custom view file according to the custom view parameters and a preset custom view template” in this embodiment may include the contents of steps 1021 to 1023:
[0045] Step 1021: for each custom subview in the preset custom view template, obtain corresponding target custom event data from the custom event data, and obtain target custom business data from the custom business data;
[0046] In this step, the view transmission system generates a preset custom view template in a pre-created cross-process transmission view class through the view provider, wherein the custom view template includes at least one custom sub-view, which is a component of the custom view finally displayed; the custom view interface includes a custom event data interface and a custom business data interface, and the custom view parameters include the custom event data created by the view provider based on the custom event data interface and the custom business data created by the view provider based on the custom business data interface; for each custom sub-view in the preset custom view template, the view transmission system obtains the corresponding target custom event data in the custom event data and obtains the target custom business data in the custom business data.
[0047] It can be understood that the custom event data and custom business data corresponding to each custom sub-view are usually different. The custom event data of the view provider obtained by the view transmission system includes the custom event data of each custom sub-view of the custom view, and the custom business data of the view provider obtained by the view transmission system includes the custom business data of each custom sub-view of the custom view.
[0048] Step 1022: Bind the target custom event data and the target custom business data and save them in the custom sub-view to generate a custom sub-view file set;
[0049] In this step, the view transmission system binds the target custom event data and the target custom business data and saves them in the custom sub-view to generate a custom sub-view file set; specifically, the view transmission system needs to bind the target custom event data and the target custom business data of each custom sub-view in the custom view template (UI XML view description file), and for the basic properties of each custom sub-view, such as width and height, since they have been set in the custom view template, there is no need to bind them separately.
[0050] Step 1023: Generate a custom view file based on the custom sub-view file set and the preset custom view template.
[0051] In this step, the view transmission system generates a custom view file based on the custom sub-view file set and the preset custom view template. It will be appreciated that the view transmission system binds the target custom event data and target custom business data for each custom sub-view to obtain the custom sub-view file set, the custom sub-view file set, and the preset custom view template to generate the custom view file.
[0052] Specifically, process / application A implements the code writing and completion event binding of the custom view that needs to be displayed in application / process B through the custom view interface provided by the pre-created cross-process transmission view class (RemoteViews) within the SDK provided in this embodiment, and obtains a custom view file. The code writing and completion event binding of the custom view do not require the implementation of basic controls supported by RemoteViews, which greatly reduces the complexity of the custom view file.
[0053] Step 103: Transmit the custom view file to the view display party through the binder transmission mechanism.
[0054] In this step, after obtaining the custom view file, the view transmission system transmits the custom view file to the view display through the binder transmission mechanism. Specifically, the view transmission system transmits the custom view file to the view display through the view provider calling notifyToDispay and using the system-level binder mechanism (binder transmission mechanism).
[0055] Specifically, when the custom view file is transmitted to the B process / application through the system layer binder mechanism (binder transmission mechanism), the transmission efficiency is greatly improved; after the B application / process receives the custom view file, it parses the custom view file and renders the view, binds events and binds data through rules, and then generates and displays the custom view.
[0056] For example, the view delivery system notifies the binder delivery mechanism to deliver the custom view file to the view displayer by calling notifyToDispay on the view provider. The notifyToDispay function is a fictitious function name intended to notify the code of the operation of delivering the custom view file to the displayer.
[0057] In summary, the view transmission system of this embodiment obtains custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class; generates a custom view file based on the custom view parameters and a preset custom view template; and transmits the custom view file to the view display through a binder transmission mechanism. The custom view parameters created through the custom view interface in the pre-created cross-process transmission view class do not require the generation of custom view parameters based on basic controls, thereby reducing the complexity of the custom view parameters. The reduced complexity of the custom view parameters can further reduce the complexity of the custom view file generated based on the custom view parameters and the preset custom view template. When the custom view file is transmitted to the view display through the binder transmission mechanism, the reduced complexity of the custom view file can improve the transmission efficiency of the custom view.
[0058] Based on the embodiment of FIG1 , please refer to FIG2 , which provides a second embodiment of the view transmission method of the present application.
[0059] Specifically, the specific process of the second embodiment of the present application includes the contents of step 201 to step 205, and each step is described in detail below:
[0060] Step 201 : Obtain custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transmission view class.
[0061] This step can be understood by referring to the content of step 101 in the embodiment of FIG1 , and will not be described in detail here.
[0062] Step 202: Generate a custom view file according to the custom view parameters and a preset custom view template.
[0063] This step can be understood by referring to the content of step 102 in the embodiment of FIG1 , and will not be described in detail here.
[0064] Step 203: Transmit the custom view file to the view display party through the binder transmission mechanism.
[0065] This step can be understood by referring to the content of step 103 in the embodiment of FIG1 , and will not be described in detail here.
[0066] Step 204: Create a context object of the view provider, and obtain a custom view interface based on the context object and the custom view file;
[0067] In this step, the view transmission system creates a context object of the view provider, and renders, adjusts, and strongly converts the custom view file based on the context object to obtain a custom view interface.
[0068] Among them, the context object is a common concept in software development. It provides an interface for accessing application resources and performing specific operations. In different programming environments and frameworks, the context object may have different meanings and functions. In Android development, the context object is an important concept. It represents the current application state and environment and provides methods to access system services, resources, and application components. In Android, all Activities, Services, BroadcastReceivers, and ContentProviders are subclasses of Context and can all be used as context objects. The context object has the following important functions in Android development:
[0069] Access resources: The context object allows access to the application's resources, such as strings, images, layouts, etc. By calling methods of the context object, you can get the resources associated with the application.
[0070] Start components: The context object provides methods for starting other components, such as starting a new activity, starting a service, or sending a broadcast. Through the context object, you can start and manage various components in the application.
[0071] Accessing system services: The context object allows access to various services provided by the Android system, such as the notification manager, sensor services, location services, etc. Through the context object, you can get instances of these system services.
[0072] Get application information: The context object provides methods for obtaining information such as the application package name, version number, and application context. Through the context object, you can obtain relevant information about the application.
[0073] Specifically, the step of "creating the context object of the view provider" includes the contents of steps 2041 to 2048:
[0074] Step 2041: Verify whether the view provider has system permissions.
[0075] In this step, the view transmission system verifies whether the view provider has system authority. Specifically, the view transmission system may obtain the authority parameter of the view provider and verify whether the view provider has system authority based on the authority parameter.
[0076] Step 2042: If it is determined that the view provider has system permissions, obtain the application name and first flag parameter of the view provider, and generate a context object of the view provider according to the application name and the first flag parameter;
[0077] In this step, if the view transmission system determines that the view provider has system permissions, it obtains the application name and the first flag parameter of the view provider, and generates the context object of the view provider based on the application name and the first flag parameter. Specifically, for applications with system permissions, the context object of the view provider can be generated through the Context.createApplicationContext(mApplication,Context.CONTEXT_RESTRICT ED) interface, where mApplication is the application name of the view provider, and mApplication usually refers to the Application object of the current application. The Application class is a global singleton class that is created and initialized when the application starts and can be used to initialize application-level resources and configuration information; Context.CONTEXT_RESTRICTED is the first flag parameter, and Context.CONTEXT_RESTRICTED is a parameter constant, which indicates that the acquisition is limited to the current application context object. If this parameter is used to obtain the context object, the returned context object will not be able to access system-level resources, such as system services and resources of other applications.
[0078] Step 2043: If it is determined that the view provider does not have system permissions, obtain the application package name and the second flag parameter of the view provider, and generate a context object of the view provider according to the application package name and the second flag parameter.
[0079] In this step, if the view transmission system determines that the view provider does not have system permissions, it obtains the view provider's application package name and the second flag parameter, and generates a view provider context object based on the application package name and the second flag parameter. Specifically, for applications without system permissions, the view provider context object is generated through Context.createPackageContext(String packageName, int flag), where String packageName is the application package name. In Android, each application must have a unique package name to identify the application and distinguish it from other applications; int flag is the second flag parameter, an integer type parameter, which is used in Android development to specify some flags or options. It can be used to control the behavior of the method to meet specific requirements.
[0080] Specifically, based on the context object and the custom view file, a custom view interface is obtained, including:
[0081] Step 2044: Determine the view resource identifier corresponding to each custom sub-view file in the custom view file based on the context object;
[0082] Step 2045: Obtain the corresponding view resource based on the view resource identifier and perform rendering to obtain a custom view object.
[0083] In steps 2044 and 2045, the view transmission system determines the view resource identifier corresponding to each custom sub-view file in the custom view file based on the context object, obtains the corresponding view resource based on the view resource identifier, and renders it, obtaining the custom sub-view object corresponding to each custom sub-view file. Furthermore, the view transmission system generates a custom view object based on all the custom sub-view objects. Specifically, the view transmission system calls the LayoutInflater.inflate interface to render each custom sub-view file in the custom view file to obtain the custom view object.
[0084] Step 2046: Process the custom view object to generate a custom base view;
[0085] In this step, the view transmission system processes the custom view object and generates a custom base view. Specifically, the view transmission system uses a custom LayoutInflater and overrides onCreateView(String name,AttributeSet attrs) through the view display to process the custom view object and generate a custom base view. Among them, onCreateView(String name,AttributeSet attrs) is one of the methods used to create a custom view. This method is usually used for the construction and initialization process of a custom view and is often used in the code of a custom view. This method is usually called in the constructor of a custom view to parse the attributes in the XML layout file (custom view file) and initialize the view. LayoutInflater is a class in Android used to load XML layout files and instantiate corresponding view objects. It allows developers to convert an XML layout file into its corresponding view object.
[0086] Furthermore, step 2046 includes:
[0087] Step 20461: Obtain the custom view name and custom view class package name of the custom view object, and concatenate the custom view name and the custom view class package name to obtain a custom view class name;
[0088] In this step, the view transmission system obtains the custom view name and custom view class package name of the custom view object, and concatenates the custom view name and custom view class package name to obtain the custom view class name; specifically, the view transmission system uses a custom LayoutInflater and overrides onCreateView(String name,AttributeSet attrs) to process the custom view object, intercepts onCreateView, obtains the passed in name parameter (custom view name), and the class package name of the supported custom view, and performs secondary concatenation, such as com.tcl.remoteViews.${name}, where name is the name value returned by the onCreateView method; the obtained custom view name and custom view class package name are concatenated to obtain the complete custom view class name.
[0089] Step 20462: Based on the custom view class name and the preset loader, load the custom view class, and generate a custom base view based on the custom view class.
[0090] In this step, the view transmission system loads the custom view class based on the custom view class name and the preset loader, and generates a custom base view based on the custom view class. Specifically, the view transmission system obtains the corresponding custom view class package in the custom view object according to the custom view class name, and based on the classLoader class loader of the classLoader constructed in advance in the view display, loads the resources provided by the view provider in the custom view class package to generate a custom view class. ClassLoader is used to load bytecode files and generate corresponding class objects. In Android, class loaders are also widely used to load various resources in applications, such as layout files, pictures, and audio, etc. Class loaders are used to load various resources and plug-ins to achieve functions such as dynamic loading and updating.
[0091] Step 2047: adjusting the customized base view based on the basic attribute parameters in the customized view object to obtain a customized reference view;
[0092] In this step, the view transmission system adjusts the custom base view based on the basic attribute parameters in the custom view object to obtain the custom view. Specifically, in the aforementioned steps, the view transmission system uses a custom LayoutInflater and overrides onCreateView(String name, AttributeSet attrs) to process the custom view object. The view transmission system intercepts onCreateView and obtains AttributeSet attrs, which are the basic attribute parameters in the custom view object. Based on these basic attribute parameters, the custom base view is adjusted to obtain the custom reference view.
[0093] Step 2048: Perform a strong conversion process on the customized reference view to obtain a target view interface.
[0094] In this step, the view transmission system performs a strong conversion on the custom reference view to the target view interface. A feasible specific implementation step for strong conversion of the custom reference view to the target view interface is as follows: setting data binding logic and event binding logic in the custom reference view, and performing a strong conversion on the custom reference view according to the set target interface type to obtain the target view interface.
[0095] Step 205: Generate and display a custom view based on the custom view interface and the custom view file by the view displaying party.
[0096] In this step, the view transmission system generates and displays the custom view through the view display based on the custom view interface and the custom view file.
[0097] Specifically, step 205 includes:
[0098] Step 2051: Obtain the custom event data set and the custom business data set in the custom view file through the view display party;
[0099] Step 2052: Bind the custom event data set and the custom business data set to the custom view interface through the view display party to generate and display a custom view.
[0100] In step 2051 to step 2052, the view transmission system obtains the custom event data set and the custom business data set in the custom view file through the view display party; binds the custom event data set and the custom business data set to the custom view interface, and generates and displays the custom view.
[0101] The view transmission system of this embodiment creates custom view parameters through a custom view interface in a pre-created cross-process transmission view class, eliminating the need to generate custom view parameters based on basic controls, thereby reducing the complexity of the custom view parameters. This reduced complexity of the custom view parameters can further reduce the complexity of the custom view file generated based on the custom view parameters and a preset custom view template. When the custom view file is transmitted to the view display via the binder transmission mechanism, the reduced complexity of the custom view file improves the transmission efficiency of the custom view. Furthermore, after the custom view file is transmitted to the view display via the binder transmission mechanism, a context object for the view provider is created, and a custom view interface is obtained based on the context object and the custom view file. The view display generates and displays the custom view based on the target view interface and the custom view file. This avoids the view display having to serialize and deserialize the custom view file before generating the custom view and then displaying the custom view. This reduces the serialization and deserialization steps, shortens the time it takes for the view display to convert the custom view file into a custom view, and thereby improves the display efficiency of the custom view.
[0102] This embodiment further provides a view transmission device, which can be integrated into a device using an Android system, such as a mobile terminal or a PC terminal. As shown in FIG3 , the view transmission device may include:
[0103] An acquiring unit 1001 is configured to acquire custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transfer view class;
[0104] A generating unit 1002 is configured to generate a custom view file according to the custom view parameters and a preset custom view template;
[0105] The transmission unit 1003 is configured to transmit the custom view file to the view display party through a binder transmission mechanism.
[0106] In an optional example, the generation unit is further configured to:
[0107] For each custom subview in the preset custom view template, obtain corresponding target custom event data from the custom event data, and obtain target custom business data from the custom business data;
[0108] Binding the target custom event data and the target custom business data and saving them in the custom sub-view to generate a custom sub-view file set;
[0109] A custom view file is generated based on the custom sub-view file set and a preset custom view template.
[0110] In an optional example, the view transmission device further includes:
[0111] a creating unit, configured to create a context object of the view provider and obtain a target view interface based on the context object and the custom view file;
[0112] A creating unit is configured to generate and display a custom view based on the target view interface and the custom view file through the view display.
[0113] In an optional example, create a unit that is also used to:
[0114] Verify whether the view provider has system permissions;
[0115] If it is determined that the view provider has system authority, obtaining an application name and a first flag parameter of the view provider, and generating a context object of the view provider according to the application name and the first flag parameter;
[0116] If it is determined that the view provider does not have the system permission, the application package name and the second flag parameter of the view provider are obtained, and a context object of the view provider is generated according to the application package name and the second flag parameter.
[0117] In an optional example, create a unit that is also used to:
[0118] Determining, based on the context object, a view resource identifier corresponding to each custom sub-view file in the custom view file;
[0119] Obtain the corresponding view resource based on the view resource identifier for rendering to obtain a custom view object;
[0120] Processing the custom view object to generate a custom base view;
[0121] Adjusting the customized base view based on basic attribute parameters in the customized view object to obtain a customized reference view;
[0122] A strong conversion process is performed on the custom reference view to obtain a target view interface.
[0123] In an optional example, create a unit that is also used to:
[0124] Obtaining a custom view name and a custom view class package name of the custom view object, and concatenating the custom view name and the custom view class package name to obtain a custom view class name;
[0125] Based on the custom view class name and the preset loader, the custom view class is loaded, and a custom base view is generated based on the custom view class.
[0126] In an optional example, the display unit is further configured to:
[0127] Obtaining, through the view display party, a custom event data set and a custom business data set in the custom view file;
[0128] The custom event data set and the custom business data set are bound to the custom view interface by the view display party to generate and display a custom view.
[0129] By adopting the solution of this embodiment, the custom view parameters created by the custom view interface in the pre-created cross-process transmission view class do not need to generate custom views based on basic controls, thereby reducing the complexity of custom views and improving the transmission efficiency of custom views; by creating a target view interface, combining the custom view file to generate and display the custom view, serialization and deserialization of the custom view are avoided, thereby improving the efficiency of displaying custom views.
[0130] Accordingly, an embodiment of the present application also provides a view transmission system, as shown in FIG4 , which is a schematic structural diagram of the view transmission system provided in an embodiment of the present application. The view transmission system 1100 includes a processor 1101 having one or more processing cores, a memory 1102 having one or more computer-readable storage media, and a computer program stored in the memory 1102 and executable on the processor. The processor 1101 is electrically connected to the memory 1102. Those skilled in the art will appreciate that the view transmission system structure shown in the figure does not limit the view transmission system, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0131] Processor 1101 is the control center of view transmission system 1100. It connects various components of view transmission system 1100 using various interfaces and lines. By running or loading software programs and / or units stored in memory 1102 and accessing data stored in memory 1102, it executes various functions of view transmission system 1100 and processes data, thereby monitoring the entire view transmission system 1100. Processor 1101 can be a CPU, a graphics processor (GPU), a network processor (NP), etc., and can implement or execute the various methods, steps, and logic blocks disclosed in the embodiments of this application.
[0132] In the embodiment of the present application, the processor 1101 in the view transmission system 1100 loads instructions corresponding to one or more application processes into the memory 1102 according to the following steps, and the processor 1101 runs the application stored in the memory 1102 to implement various functions, such as:
[0133] Get the custom view parameters created by the view provider based on the custom view interface in the pre-created cross-process transfer view class;
[0134] Generate a custom view file according to the custom view parameters and a preset custom view template;
[0135] The custom view file is transmitted to the view display party through the binder transmission mechanism.
[0136] In an optional example, it also includes:
[0137] The custom view interface includes a custom event data interface and a custom business data interface, the custom view parameters include custom event data created by the view provider based on the custom event data interface and custom business data created by the view provider based on the custom business data interface, and generating a custom view file according to the custom view parameters and a preset custom view template includes:
[0138] For each custom subview in the preset custom view template, obtain corresponding target custom event data from the custom event data, and obtain target custom business data from the custom business data;
[0139] Binding the target custom event data and the target custom business data and saving them in the custom sub-view to generate a custom sub-view file set;
[0140] A custom view file is generated based on the custom sub-view file set and a preset custom view template.
[0141] In an optional example, it also includes:
[0142] Creating a context object of the view provider, and obtaining a target view interface based on the context object and the custom view file;
[0143] The view display party generates and displays a custom view based on the target view interface and the custom view file.
[0144] In an optional example, it also includes:
[0145] Verify whether the view provider has system permissions;
[0146] If it is determined that the view provider has system authority, obtaining an application name and a first flag parameter of the view provider, and generating a context object of the view provider according to the application name and the first flag parameter;
[0147] If it is determined that the view provider does not have the system permission, the application package name and the second flag parameter of the view provider are obtained, and a context object of the view provider is generated according to the application package name and the second flag parameter.
[0148] In an optional example, it also includes:
[0149] Determining, based on the context object, a view resource identifier corresponding to each custom sub-view file in the custom view file;
[0150] Obtain the corresponding view resource based on the view resource identifier for rendering to obtain a custom view object;
[0151] Processing the custom view object to generate a custom base view;
[0152] Adjusting the customized base view based on basic attribute parameters in the customized view object to obtain a customized reference view;
[0153] A strong conversion process is performed on the custom reference view to obtain a target view interface.
[0154] In an optional example, it also includes:
[0155] Obtaining a custom view name and a custom view class package name of the custom view object, and concatenating the custom view name and the custom view class package name to obtain a custom view class name;
[0156] Based on the custom view class name and the preset loader, the custom view class is loaded, and a custom base view is generated based on the custom view class.
[0157] In an optional example, it also includes:
[0158] Obtaining, through the view display party, a custom event data set and a custom business data set in the custom view file;
[0159] The custom event data set and the custom business data set are bound to the custom view interface by the view display party to generate and display a custom view.
[0160] Therefore, the custom view parameters created by the custom view interface in the pre-created cross-process transmission view class do not need to generate custom views based on basic controls, thereby reducing the complexity of custom views and improving the transmission efficiency of custom views; by creating a target view interface, combining the custom view file to generate and display the custom view, serialization and deserialization of the custom view are avoided, thereby improving the efficiency of displaying custom views.
[0161] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0162] Optionally, as shown in FIG4 , the view transmission system 1100 further includes: a touch screen display 1103, a radio frequency circuit 1104, an audio circuit 1105, an input unit 1106, and a power supply 1107. The processor 1101 is electrically connected to the touch screen 1103, the radio frequency circuit 1104, the audio circuit 1105, the input unit 1106, and the power supply 1107. Those skilled in the art will appreciate that the view transmission system structure shown in FIG3 does not limit the view transmission system, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0163] The touch display screen 1103 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 1103 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user and various graphical user interfaces of the view transmission system, which can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. The touch panel can be used to collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1101, and can receive the command sent by the processor 1101 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 1101 to determine the type of touch event. Then the processor 1101 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 1103 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 1103 can also be used as part of the input unit 1106 to realize the input function.
[0164] The RF circuit 1104 may be used to transmit and receive RF signals, so as to establish wireless communication with a network device or other image transmission system through wireless communication, and to transmit and receive signals with the network device or other image transmission system.
[0165] Audio circuit 1105 can be used to provide an audio interface between the user and the video transmission system through a speaker and microphone. Audio circuit 1105 can convert received audio data into electrical signals and transmit them to the speaker, which then converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuit 1105 and converted into audio data. The audio data is then output to processor 1101 for processing, then sent via RF circuit 1104 to, for example, another video transmission system, or to memory 1102 for further processing. Audio circuit 1105 may also include an earphone jack to allow communication between external headphones and the video transmission system.
[0166] The input unit 1106 may be configured to receive input digital, character information, or user feature information (such as fingerprint, iris, or facial information), and to generate keyboard, mouse, joystick, optical, or trackball signal input related to user settings and function control.
[0167] Power supply 1107 is used to power various components of image transmission system 1100. Optionally, power supply 1107 can be logically connected to processor 1101 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. Power supply 1107 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0168] Although not shown in FIG. 4 , the view transmission system 1100 may further include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.
[0169] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0170] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0171] To this end, an embodiment of the present application provides a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the view transmission methods provided in the embodiments of the present application. The computer program can execute the following steps of the view transmission method:
[0172] Get the custom view parameters created by the view provider based on the custom view interface in the pre-created cross-process transfer view class;
[0173] Generate a custom view file according to the custom view parameters and a preset custom view template;
[0174] The custom view file is transmitted to the view display party through the binder transmission mechanism.
[0175] In an optional example, it also includes:
[0176] The custom view interface includes a custom event data interface and a custom business data interface, the custom view parameters include custom event data created by the view provider based on the custom event data interface and custom business data created by the view provider based on the custom business data interface, and generating a custom view file according to the custom view parameters and a preset custom view template includes:
[0177] For each custom subview in the preset custom view template, obtain corresponding target custom event data from the custom event data, and obtain target custom business data from the custom business data;
[0178] Binding the target custom event data and the target custom business data and saving them in the custom sub-view to generate a custom sub-view file set;
[0179] A custom view file is generated based on the custom sub-view file set and a preset custom view template.
[0180] In an optional example, it also includes:
[0181] Creating a context object of the view provider, and obtaining a target view interface based on the context object and the custom view file;
[0182] The view display party generates and displays a custom view based on the target view interface and the custom view file.
[0183] In an optional example, it also includes:
[0184] Verify whether the view provider has system permissions;
[0185] If it is determined that the view provider has system authority, obtaining an application name and a first flag parameter of the view provider, and generating a context object of the view provider according to the application name and the first flag parameter;
[0186] If it is determined that the view provider does not have the system permission, the application package name and the second flag parameter of the view provider are obtained, and a context object of the view provider is generated according to the application package name and the second flag parameter.
[0187] In an optional example, it also includes:
[0188] Determining, based on the context object, a view resource identifier corresponding to each custom sub-view file in the custom view file;
[0189] Obtain the corresponding view resource based on the view resource identifier for rendering to obtain a custom view object;
[0190] Processing the custom view object to generate a custom base view;
[0191] Adjusting the customized base view based on basic attribute parameters in the customized view object to obtain a customized reference view;
[0192] A strong conversion process is performed on the custom reference view to obtain a target view interface.
[0193] In an optional example, it also includes:
[0194] Obtaining a custom view name and a custom view class package name of the custom view object, and concatenating the custom view name and the custom view class package name to obtain a custom view class name;
[0195] Based on the custom view class name and the preset loader, the custom view class is loaded, and a custom base view is generated based on the custom view class.
[0196] In an optional example, it also includes:
[0197] Obtaining, through the view display party, a custom event data set and a custom business data set in the custom view file;
[0198] The custom event data set and the custom business data set are bound to the custom view interface by the view display party to generate and display a custom view.
[0199] Therefore, the custom view parameters created by the custom view interface in the pre-created cross-process transmission view class do not need to generate custom views based on basic controls, thereby reducing the complexity of custom views and improving the transmission efficiency of custom views; by creating a target view interface, combining the custom view file to generate and display the custom view, serialization and deserialization of the custom view are avoided, thereby improving the efficiency of displaying custom views.
[0200] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0201] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0202] Since the computer program stored in the computer-readable storage medium can execute any of the view transmission methods provided in the embodiments of the present application, the beneficial effects achievable by any of the view transmission methods provided in the embodiments of the present application can be achieved. For details, please refer to the previous embodiments and will not be repeated here.
[0203] According to one aspect of the present application, a computer program product or computer program is also provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a view transmission system reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the view transmission system to perform the methods provided in various optional implementations of the above embodiments.
[0204] In the above-described embodiments of the view transmission device, computer-readable storage medium, view transmission system, and computer program product, the descriptions of each embodiment have their respective focuses. For portions not described in detail in a particular embodiment, reference should be made to the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for ease and brevity of description, the specific operating processes and beneficial effects of the view transmission device, computer-readable storage medium, computer program product, view transmission system, and their corresponding units described above can be referenced to the description of the view transmission method in the above embodiments, and will not be further elaborated here.
[0205] The above describes in detail a view transmission method, device, system, computer-readable storage medium, and computer program product provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core ideas of the present application. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present application.
Claims
1. A view transmission method, wherein: The view transmission method includes: Get the custom view parameters created by the view provider based on the custom view interface in the pre-created cross-process transfer view class; Generate a custom view file according to the custom view parameters and a preset custom view template; The custom view file is transmitted to the view display party through the binder transmission mechanism.
2. The view transmission method according to claim 1, wherein: The custom view interface includes a custom event data interface and a custom business data interface, the custom view parameters include custom event data created by the view provider based on the custom event data interface and custom business data created by the view provider based on the custom business data interface, and generating a custom view file according to the custom view parameters and a preset custom view template includes: For each custom subview in the preset custom view template, obtain corresponding target custom event data from the custom event data, and obtain target custom business data from the custom business data; Binding the target custom event data and the target custom business data and saving them in the custom sub-view to generate a custom sub-view file set; A custom view file is generated based on the custom sub-view file set and a preset custom view template.
3. The view transmission method according to claim 1, wherein: After the custom view file is transmitted to the view display side through the binder transmission mechanism, the method includes: Creating a context object of the view provider, and obtaining a target view interface based on the context object and the custom view file; The view display party generates and displays a custom view based on the target view interface and the custom view file.
4. The view transmission method according to claim 3, wherein: The creating the context object of the view provider includes: Verify whether the view provider has system permissions; If it is determined that the view provider has system authority, obtaining an application name and a first flag parameter of the view provider, and generating a context object of the view provider according to the application name and the first flag parameter; If it is determined that the view provider does not have the system permission, the application package name and the second flag parameter of the view provider are obtained, and a context object of the view provider is generated according to the application package name and the second flag parameter.
5. The view transmission method according to claim 4, wherein: The verifying whether the view provider has system authority includes: Get the permission parameters of the view provider; Verify that the view provider has system permissions based on the permission parameters.
6. The view transmission method according to claim 3, wherein: The obtaining of a target view interface based on the context object and the custom view file includes: Determining, based on the context object, a view resource identifier corresponding to each custom sub-view file in the custom view file; Obtain the corresponding view resource based on the view resource identifier for rendering to obtain a custom view object; Processing the custom view object to generate a custom base view; Adjusting the customized base view based on basic attribute parameters in the customized view object to obtain a customized reference view; A strong conversion process is performed on the custom reference view to obtain a target view interface.
7. The view transmission method according to claim 6, wherein: The step of performing a strong conversion process on the customized reference view to obtain a target view interface includes: Set up data binding logic and event binding logic in the custom reference view; According to the set target interface type, the custom reference view is strongly converted to obtain the target view interface.
8. The view transmission method according to claim 6, wherein: The processing of the custom view object to generate a custom base view includes: Obtaining a custom view name and a custom view class package name of the custom view object, and concatenating the custom view name and the custom view class package name to obtain a custom view class name; Based on the custom view class name and the preset loader, the custom view class is loaded, and a custom base view is generated based on the custom view class.
9. The view transmission method according to claim 3, wherein: The generating and displaying the custom view based on the custom view interface and the custom view file by the view display means includes: Obtaining, through the view display party, a custom event data set and a custom business data set in the custom view file; The custom event data set and the custom business data set are bound to the custom view interface by the view display party to generate and display a custom view.
10. A view transmission device, wherein: The device comprises: An acquiring unit, configured to acquire custom view parameters created by a view provider based on a custom view interface in a pre-created cross-process transfer view class; A generating unit, configured to generate a custom view file according to the custom view parameters and a preset custom view template; The transmission unit is used to transmit the custom view file to the view display party through the binder transmission mechanism.
11. The view transmission device according to claim 10, wherein: The custom view interface in the generating unit includes a custom event data interface and a custom business data interface, and the custom view parameters include custom event data created by the view provider based on the custom event data interface and custom business data created by the view provider based on the custom business data interface; The generating unit further generates a custom view file according to the custom view parameters and a preset custom view template, including: For each custom subview in the preset custom view template, obtain corresponding target custom event data from the custom event data, and obtain target custom business data from the custom business data; Binding the target custom event data and the target custom business data and saving them in the custom sub-view to generate a custom sub-view file set; A custom view file is generated based on the custom sub-view file set and a preset custom view template.
12. The view transmission device according to claim 10, wherein: After the generating unit transmits the custom view file to the view display party through the binder transmission mechanism, the method includes: Creating a context object of the view provider, and obtaining a target view interface based on the context object and the custom view file; The view display party generates and displays a custom view based on the target view interface and the custom view file.
13. The view transmission device according to claim 12, wherein: The generating unit further creates a context object of the view provider, including: Verify whether the view provider has system permissions; If it is determined that the view provider has system authority, obtaining an application name and a first flag parameter of the view provider, and generating a context object of the view provider according to the application name and the first flag parameter; If it is determined that the view provider does not have the system permission, the application package name and the second flag parameter of the view provider are obtained, and a context object of the view provider is generated according to the application package name and the second flag parameter.
14. The view transmission device according to claim 13, wherein: The generating unit verifies whether the view provider has system authority, including: Get the permission parameters of the view provider; Verify that the view provider has system permissions based on the permission parameters.
15. The view transmission device according to claim 12, wherein: The generating unit obtains a target view interface based on the context object and the custom view file, including: Determining, based on the context object, a view resource identifier corresponding to each custom sub-view file in the custom view file; Obtain the corresponding view resource based on the view resource identifier for rendering to obtain a custom view object; Processing the custom view object to generate a custom base view; Adjusting the customized base view based on basic attribute parameters in the customized view object to obtain a customized reference view; A strong conversion process is performed on the custom reference view to obtain a target view interface.
16. The view transmission device according to claim 15, wherein: The generating unit performs a strong conversion process on the customized reference view to obtain a target view interface, including: Set up data binding logic and event binding logic in the custom reference view; According to the set target interface type, the custom reference view is strongly converted to obtain the target view interface.
17. The view transmission device according to claim 15, wherein: The generating unit processes the custom view object to generate a custom base view, including: Obtaining a custom view name and a custom view class package name of the custom view object, and concatenating the custom view name and the custom view class package name to obtain a custom view class name; Based on the custom view class name and the preset loader, the custom view class is loaded, and a custom base view is generated based on the custom view class.
18. The view transmission device according to claim 12, wherein: The generating unit generates and displays the custom view based on the custom view interface and the custom view file through the view display, including: Obtaining, through the view display party, a custom event data set and a custom business data set in the custom view file; The custom event data set and the custom business data set are bound to the custom view interface by the view display party to generate and display a custom view.
19. A view transmission system, wherein: The method comprises a processor and a memory, wherein the memory stores a computer program; the processor loads the computer program from the memory to execute the steps of the view transmission method according to any one of claims 1 to 9.
20. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps of the view transmission method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Editor generation method and processing method for processing game template data
CN112597266A
Cooperative control method and system between electronic equipments
CN113938743A
Cross-process video frame transmission method and device based on Android and medium
CN115734023A
View transmission method, device and system and computer readable storage medium
CN118277127A