Data processing method and device, electronic equipment and vehicle
By monitoring component-triggered operations and generating encapsulated commands in the in-vehicle infotainment system, and utilizing a unified scheduler and single-threaded processing, the problems of update chaos and logical redundancy caused by the large number of Widget components are solved, thereby improving data processing efficiency and system performance.
Patent Information
- Application Number
- CN202511153735.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-18
- Publication Date
- 2025-11-21
AI Technical Summary
In in-vehicle infotainment systems, the large number of widget components and their independent processing logic can lead to chaotic updates, redundant logic, and thread contention and update chaos when multiple widgets process commands concurrently.
By monitoring component-triggered operations, the target command is encapsulated and processed using the encapsulation component to generate the encapsulated command. The encapsulated command is then dispatched to the target processing module through a unified scheduler. Single-threaded serial command dispatch is used to avoid thread contention and concurrency conflicts. Enqueue instructions are used to add commands to the waiting queue to smooth the request rate. Non-real-time commands are loaded asynchronously.
It implements a unified protocol encapsulation and scheduling for Widget components, reducing logical redundancy, improving data processing efficiency, extending device battery life, and optimizing system performance and user experience.
Smart Images

Figure CN120994422A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of data processing, and particularly relates to a data processing method and device, electronic equipment and vehicle. BACKGROUND
[0002] Currently, developers generally create interactive mini-card applications through Android native components Widget to display real-time information and provide shortcut operations.
[0003] In a vehicle infotainment system, Widget components are usually updated through broadcasting, Intent, etc., but due to the large number of Widget components, there are problems of update confusion and redundant update logic. SUMMARY
[0004] Therefore, the present disclosure aims to provide a data processing method and device, electronic equipment and vehicle to solve the problems of update confusion and redundant update logic due to the large number of Widget components.
[0005] To achieve the above purpose, a first aspect of the present disclosure provides a data processing method, which comprises: monitoring a component triggering operation for a target component, determining a target command corresponding to the target component; performing encapsulation processing on the target command through an encapsulation component to obtain an encapsulation command, and forwarding the encapsulation command to a unified dispatcher; determining a command type corresponding to the encapsulation command by using the unified dispatcher, and dispatching the encapsulation command to a target processing module according to the command type; performing analysis on the encapsulation command by using the target processing module, and executing a function corresponding to the encapsulation command.
[0006] Specifically, the encapsulation processing on the target command through the encapsulation component comprises: generating a target broadcast containing the target command according to the target command; determining that a component broadcast receiver receives the target broadcast, and performing analysis on the target broadcast by using the encapsulation component to obtain the target command; performing encapsulation processing on the target command through the encapsulation component to obtain an encapsulation command.
[0007] Through the above scheme, after monitoring the component triggering operation of the user for the target component, a target broadcast is generated, and the broadcast is sent only when the component triggering operation of the user is monitored, thereby avoiding continuous running of a background service for listening, reducing the start-up time and memory occupation of the application, and prolonging the battery life of the device.
[0008] Specifically, the forwarding the encapsulation command to the unified dispatcher comprises: The encapsulation component calls an enqueue instruction, uses the enqueue instruction to add the encapsulation command to a pending queue, and forwards the encapsulation command to a component scheduling module; In response to the component scheduling module receiving the encapsulation command, the encapsulation command is forwarded to the unified dispatcher.
[0009] Through the above scheme, the encapsulation command is added to the pending queue by using the enqueue instruction, which avoids the system from being overwhelmed by excessive requests under high load. The pending queue can be used as a buffer to smooth the arrival rate of requests, so that the system can process requests more evenly. At the same time, the enqueue method can dynamically adjust the number of concurrent threads according to the length of the pending queue, thereby optimizing performance.
[0010] Specifically, the number of encapsulation commands is multiple, and the forwarding the encapsulation command to the unified dispatcher in response to the component scheduling module receiving the encapsulation command comprises: In response to the component scheduling module receiving the encapsulation command, the receiving time corresponding to each encapsulation command is determined; The component scheduling module sequentially forwards each encapsulation command to the unified dispatcher according to the receiving time corresponding to each encapsulation command.
[0011] Specifically, the component scheduling module sequentially forwards each encapsulation command to the unified dispatcher according to the receiving time corresponding to each encapsulation command, comprising: The component scheduling module selects the encapsulation command with the earliest receiving time as the target encapsulation command according to the receiving time corresponding to each encapsulation command, and forwards the target encapsulation command to the unified dispatcher; In response to the component scheduling module receiving the dispatch completion instruction sent by the unified dispatcher, a new target encapsulation command is determined from the other encapsulation commands except the target encapsulation command according to the receiving time corresponding to each other encapsulation command, and is forwarded to the unified dispatcher until all encapsulation commands are forwarded to the unified dispatcher.
[0012] Through the above scheme, the component scheduling module uses single-thread serial dispatching command to avoid thread contention problems, avoid concurrent problems in a multi-thread environment, avoid thread contention and update confusion problems when multiple widgets concurrently process commands, and prevent concurrent conflicts. At the same time, only one thread is used, reducing the overhead of thread switching.
[0013] Specifically, the encapsulation command is parsed by the target processing module, and the function corresponding to the encapsulation command is executed, comprising: The target processing module is used for analyzing the encapsulation command, and determining an operation type corresponding to the encapsulation command; In response to the operation type being interface updating, the target processing module is used for sending an interface updating instruction to a component management module; The component management module receives the interface updating instruction, and calls a remote view class to refresh the interface.
[0014] Specifically, the target processing module is used for analyzing the encapsulation command, and executing a function corresponding to the encapsulation command, and the function includes: The target processing module is used for analyzing the encapsulation command, and determining a time limit type corresponding to the encapsulation command; In response to the time limit type being instant, the function corresponding to the encapsulation command is executed; or In response to the time limit type being non-instant, state information is returned, and data is loaded asynchronously until the data is loaded completely, and the function corresponding to the encapsulation command is executed.
[0015] According to the above scheme, the function execution mode corresponding to the encapsulation command is determined according to the time limit type of the encapsulation command, when the target command corresponding to the encapsulation command is a non-instant command, the data is loaded asynchronously, the data is loaded from the background without blocking the main thread, the burden of the main thread is reduced, and the overall performance of the application is improved. At the same time, when the data loading starts, a loading prompt can be displayed to inform the user that the data is being loaded. After the loading is completed, the UI is updated immediately to provide instant feedback. At the same time, the user can continue to use other functions of the application without waiting for the data to be loaded completely, and the usability of the application is improved.
[0016] Based on the same inventive concept, a second aspect of the present disclosure provides a data processing apparatus, including: A monitoring module is configured to monitor a component triggering operation to a target component, and determine a target command corresponding to the target component; An encapsulation module is configured to encapsulate the target command by an encapsulation component, obtain an encapsulation command, and forward the encapsulation command to a unified dispatcher; A dispatching module is configured to determine a command type corresponding to the encapsulation command by the unified dispatcher, and dispatch the encapsulation command to a target processing module according to the command type; An execution module is configured to analyze the encapsulation command by the target processing module, and execute a function corresponding to the encapsulation command.
[0017] Based on the same inventive concept, a third aspect of the present disclosure provides an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable by the processor, wherein the processor implements the data processing method as described above when executing the computer program.
[0018] Based on the same inventive concept, a fourth aspect of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the data processing method as described above.
[0019] Based on the same inventive concept, a fifth aspect of the present disclosure provides a vehicle comprising the data processing apparatus of the second aspect, the electronic device of the third aspect, or the storage medium of the fourth aspect.
[0020] As can be seen from the above, the present disclosure provides a data processing method, apparatus, electronic device, and vehicle. When a component triggering operation for a target component is monitored, it indicates that a user clicks the target component. A target command corresponding to the target component is determined, the target command being a command corresponding to the target component, and different target components corresponding to different target commands. The target command is encapsulated by an encapsulation component to obtain an encapsulation command, and the obtained encapsulation command is forwarded to a unified dispatcher. The unified dispatcher determines a command type corresponding to the encapsulation command, and dispatches the encapsulation command to a target processing module according to the command type. The encapsulation command is analyzed by the target processing module, and a function corresponding to the encapsulation command is executed. The target command is uniformly encapsulated by the unified encapsulation component, and is uniformly dispatched by the unified dispatcher, avoiding logical redundancy caused by independent processing of different components when encapsulating instructions and data, realizing unified protocol encapsulation and unified dispatching, and improving data processing efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the present disclosure or the related art, the drawings needed to be used in the embodiments or the related art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative effort.
[0022] Figure 1 Flowchart of the data processing method of the embodiment of the present disclosure; Figure 2 Flowchart of the data processing method of another embodiment of the present disclosure; Figure 3 Structure block diagram of the data processing apparatus of the embodiment of the present disclosure; Figure 4A structural schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] In order to make the objects, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below with reference to specific embodiments and drawings.
[0024] It should be noted that, unless otherwise defined, technical terms or scientific terms used in the embodiments of the present disclosure should be understood as their common meanings to those skilled in the art to which the present disclosure pertains. The terms "first", "second" and similar terms used in the embodiments of the present disclosure do not denote any order, quantity or importance, but are only used to distinguish different components. The terms "include", "contain" and similar terms mean that the elements or objects before the terms encompass the elements or objects listed after the terms and their equivalents, and do not exclude other elements or objects. The terms "connect" or "connected" and similar terms do not mean physical or mechanical connection, but can include electrical connection, whether direct or indirect. The terms "upper", "lower", "left", "right" and the like are only used to indicate relative positional relationships, and when the absolute positions of the described objects are changed, the relative positional relationships can also be changed accordingly.
[0025] The terms involved in the present disclosure are explained as follows: Android: Android is a free and open-source mobile operating system based on the Linux kernel (without GNU components).
[0026] Widget: Widget is a reusable data block, which is a small piece of code that can be executed on any Hyper Text Markup Language (HTML) based Internet (Web) page. Users can achieve personalized web pages or applications by assembling widgets. The forms of widgets can be videos, maps, news, small games, etc. Widgets can add some dynamic content to an HTML-based Web page. Widgets can also be click counters or real-time stock information, etc. Usually, the functions of a widget are realized by third-party provided code, and web developers only need to embed these code blocks into their own pages.
[0027] UI update: UI update (User Interface Update, UI) refers to modifying or refreshing the elements of the user interface to reflect the current state of the application or respond to user operations.
[0028] FIFO: FIFO is the abbreviation of First In First Out, FIFO (First In First Out) is a data processing principle, which means that the first data is processed or output first.
[0029] With the rapid development of the field of vehicle technology, vehicles have become an important means of transportation in people's daily life. Currently, developers generally create interactive mini-card applications through Android native components Widget to display real-time information and provide quick operations.
[0030] Widget is a small piece of code that can be executed on any Hyper Text Markup Language (HTML) based Internet (Web) page. The manifestation of Widget can be video, map, news, game, etc. It can add some dynamic content to a HTML based Web page. Widget can also be a click counter or real-time stock information, etc. Usually, the function of a Widget is realized by third-party provided code, and the Web developer only needs to embed these code blocks into their own pages.
[0031] In the vehicle infotainment system, Widget components are usually updated by broadcast, Intent, etc. However, since each Widget component independently processes its own instructions and data encapsulation, there are problems of instruction processing sharing and logical redundancy. At the same time, the Widget state change processing depends on external business code, lacks centralized scheduling, and when multiple Widgets process commands concurrently, thread contention and update confusion problems are prone to occur.
[0032] For example, when a user clicks to trigger a jump or page refresh, if each component maintains its own logic, it is easy to produce UI asynchronization, jump failure and other problems under the condition of high concurrency in the vehicle.
[0033] That is, due to the large number of Widget components and the independent processing of each Widget component, there is a problem of redundant update logic. Therefore, the embodiment proposes a data processing method, as shown in Figure 1 The method comprises the following steps: Step 101, a component triggering operation for a target component is monitored, and a target command corresponding to the target component is determined.
[0034] In particular implementation, the target component is monitored in real time, and a component trigger operation for the target component is monitored, indicating that the user needs to update the target component, and a target command corresponding to the component trigger operation is determined. The target command is a command corresponding to the target component, indicating which component trigger operation is triggered by the user.
[0035] In this embodiment, the target command is WidgetData data, which can include configuration data, state data, metadata, or interaction data of the target component, and the configuration information is used to define the behavior, appearance, and function of the target component.
[0036] In this embodiment, the component trigger operation for the target component is the operation behavior of the user on the target component, which can include a click operation on the target component, a long press operation on the target component, or a sliding operation on the target component.
[0037] For example, for the Widget component on the current display interface, the Widget component can be clicked to jump to another interface. The Widget component can also be long-pressed to edit the Widget component. Or the Widget component can be slid to refresh the interface.
[0038] For example, the target component is a recommended Widget component. When the user clicks the recommended Widget component, the component trigger operation of the target component is monitored, and the target command corresponding to the component trigger operation is determined, that is, the WidgetData data corresponding to the recommended Widget component is obtained. According to the WidgetData data, it can be known that the user clicks the recommended Widget component.
[0039] In step 102, the target command is encapsulated by an encapsulation component to obtain an encapsulation command, and the encapsulation command is forwarded to a unified dispatcher.
[0040] In particular implementation, the target command is encapsulated by an encapsulation component to obtain an encapsulation command, and the encapsulation command is forwarded to a unified dispatcher.
[0041] After the encapsulation command is obtained by encapsulating the target command by using the TransferKit component, the encapsulation command is forwarded to the unified dispatcher for subsequent unified dispatching of the target command by using the unified dispatcher.
[0042] In step 103, the encapsulation command is dispatched to a target processing module according to the command type determined by using the unified dispatcher.
[0043] In implementation, when the unified dispatcher receives the encapsulation command, the command type corresponding to the encapsulation command is determined, wherein the command type corresponds to the encapsulation command, the encapsulation command is obtained by encapsulating the target command, and the target command is a command corresponding to a target component. Therefore, it can be known that the command type corresponds to the target component.
[0044] The encapsulation command is dispatched according to the command type, and the encapsulation command is dispatched to a target processing module. The target processing module is a Repo module, which is a specific business processing module, and can perform data refreshing, jumping, updating and other operations according to the command type.
[0045] In the embodiment, the target processing module corresponds to the command type, and it is known from the foregoing that the command type corresponds to the target component, that is, the target processing module corresponds to the target component. Different target processing modules correspond to different target components.
[0046] In the embodiment, the command type corresponds to a component triggered by a user. For example, when the user clicks the recommended Widget component, the command type is a recommended command. Then, the target processing module is determined according to the command type, and the target processing module is a recommended processing module.
[0047] In step 104, the encapsulation command is parsed by the target processing module, and the function corresponding to the encapsulation command is executed.
[0048] In implementation, the encapsulation command is parsed by the target processing module to determine the specific target operation corresponding to the encapsulation command, that is, the specific operation mode of the target component, such as page jumping, interface updating, data pulling and the like. After the specific target operation corresponding to the encapsulation command is determined, the target operation is executed, that is, the function corresponding to the encapsulation command is executed.
[0049] By the above scheme, the component triggering operation for the target component is monitored, at this time it is indicated that the user clicks the target component. The target command corresponding to the target component is determined, the target command is the command corresponding to the target component, and different target components correspond to different target commands. The target command is encapsulated by the encapsulation component to obtain an encapsulation command, and the obtained encapsulation command is forwarded to the unified dispatcher. The command type corresponding to the encapsulation command is determined by the unified dispatcher, and the encapsulation command is dispatched to the target processing module according to the command type. The encapsulation command is analyzed by the target processing module, and the function corresponding to the encapsulation command is executed. The target command is uniformly encapsulated by the unified encapsulation component, and is uniformly dispatched by the unified dispatcher, avoiding the logical redundancy caused by independent processing of instructions and data encapsulation of different components, realizing unified protocol encapsulation and unified scheduling, and improving the data processing efficiency.
[0050] In some embodiments, after monitoring the user's component triggering operation for the target component, broadcast data containing the target command can be generated, and then after the component broadcast receiver receives the broadcast data, the encapsulation component is called, and the target command is encapsulated by the encapsulation component, that is, in step 102, the target command is encapsulated by the encapsulation component to obtain an encapsulation command, which specifically includes: Step 1021, generating a target broadcast containing the target command according to the target command; Step 1022, determining that the component broadcast receiver receives the target broadcast, and analyzing the target broadcast by the encapsulation component to obtain the target command; Step 1023, encapsulating the target command by the encapsulation component to obtain an encapsulation command.
[0051] In specific implementation, after monitoring the user's component triggering operation for the target component, the target broadcast containing the target command is generated according to the target command, and the target broadcast is a PendingIntent broadcast. In Android development, PendingIntent is a special Intent used to execute a certain operation at a specific time point or event trigger. PendingIntent can be used to start Activity, Service or generate and send broadcast.
[0052] Next, the generation process of the PendingIntent broadcast is specifically described: An Intent object is created to specify the operation to be performed, i.e. the sending broadcast operation. A PendingIntent object is created using the PendingIntent.getBroadcast() method. The PendingIntent object is passed to the Widget component, which triggers and generates a PendingIntent broadcast containing the target command corresponding to the target component when monitoring the component trigger operation of the user for the target component.
[0053] The target broadcast is received by using the component broadcast receiver, which is AppWidgetProvider in this embodiment. The component broadcast receiver listens to the lifecycle event and the click broadcast, i.e. the PendingIntent broadcast, and encapsulates the target command in the PendingIntent broadcast into a standard instruction by using the encapsulation component.
[0054] When the target broadcast is received, the target broadcast is parsed and processed by using the encapsulation component, i.e. the target broadcast is parsed and processed by using the TransferKit component, to obtain the target command contained in the target broadcast.
[0055] The target command is encapsulated and processed by using the encapsulation component to obtain the encapsulation command. The encapsulation command is obtained by using the encapsulation and processing of the TransferKit component.
[0056] Through the above scheme, the PendingIntent broadcast is generated after monitoring the component trigger operation of the user for the target component, and the broadcast is sent only when the component trigger operation of the user is monitored, thereby avoiding continuous running of the background service for listening, reducing the start-up time and memory occupation of the application, and prolonging the battery life of the device.
[0057] In some embodiments, before the encapsulation command is forwarded to the unified dispatcher by using the encapsulation component, the encapsulation command needs to be queued and processed, i.e. the encapsulation command is added to the processing queue, i.e. the step 102 of forwarding the encapsulation command to the unified dispatcher specifically includes: Step 102A, the encapsulation component calls the enqueue instruction, and the encapsulation command is added to the processing queue by using the enqueue instruction, and the encapsulation command is forwarded to the component scheduling module; Step 102B, in response to the component scheduling module receiving the encapsulation command, the encapsulation command is forwarded to the unified dispatcher.
[0058] In practice, an encapsulation component invokes an enqueue instruction, which adds the encapsulated command to a queue for processing. The enqueue instruction is the `enqueueRequest()` method, which adds a request to a queue for subsequent processing. A queue is a first-in, first-out (FIFO) data structure; newly added requests wait for previous requests to be processed before being processed.
[0059] In this embodiment, the `enqueueRequest()` method is used to add the encapsulation command to the processing queue, that is, to add the encapsulation command to the end of the processing queue, and then forwards the encapsulation command to the component scheduling module, waiting for the component scheduling module to allocate resources for execution. In this embodiment, the component scheduling module is the `WidgetDispatcherHelper` module.
[0060] In this embodiment, the enqueueRequest() method is an asynchronous processing method. It can return immediately after adding the encapsulation command to the queue without waiting for the encapsulation command to be processed, thus avoiding the blocking of the encapsulation component and improving the system's response speed.
[0061] In response to the component scheduling module receiving the encapsulation command, the encapsulation command is forwarded to the unified scheduler so that the unified scheduler can subsequently allocate the encapsulation command to the target processing module. Then, the target processing module parses the encapsulation command and executes the function corresponding to the encapsulation command.
[0062] The above scheme utilizes enqueue instructions to add the encapsulated commands to a processing queue, preventing the system from being overwhelmed by excessive requests under high load. The processing queue acts as a buffer, smoothing the arrival rate of requests and allowing the system to process requests more evenly. Furthermore, the enqueue method allows for dynamic adjustment of the concurrency based on the length of the processing queue, thereby optimizing performance.
[0063] In some embodiments, the component scheduling module adopts single-threaded asynchronous scheduling. When there are multiple encapsulation commands, the component scheduling module can forward the encapsulation commands to the unified scheduler sequentially according to the reception time corresponding to each encapsulation command. That is, step 102B specifically includes: Step 102B1: In response to the component scheduling module receiving the encapsulation command, determine the receiving time corresponding to each encapsulation command; Step 102B2: The component scheduling module forwards each encapsulation command to the unified scheduler in sequence according to the receiving time corresponding to each encapsulation command.
[0064] In practice, the component scheduling module is the WidgetDispatcherHelper module. The component scheduling module adopts single-threaded Executor asynchronous scheduling, that is, it uses a single-threaded thread pool to execute tasks asynchronously, ensuring that all tasks are executed sequentially in the same thread.
[0065] When the component scheduling module receives multiple encapsulation commands, it determines the receiving time corresponding to each encapsulation command. The receiving time is the time when the component scheduling module receives the encapsulation command.
[0066] The component scheduling module iterates through the reception times corresponding to all encapsulation commands, compares the reception times of all encapsulation commands, and sorts them in ascending order to obtain the target order. It can be understood that, in this embodiment, the ascending order means determining the current time, calculating the difference between the current time and the reception time, and the smaller the difference, the later the corresponding order. That is, the earlier the reception time, the larger the corresponding difference, and the earlier the order during sorting.
[0067] Each encapsulation command is forwarded to the unified scheduler in the order of the target, i.e., the encapsulation commands that appear earlier in the order are forwarded to the unified scheduler first, followed by the encapsulation commands that appear later in the order. The unified scheduler is WidgetCommandDispatcher.
[0068] For example, if the component scheduling module receives encapsulation command A, encapsulation command B, and encapsulation command C, and the order in which the component scheduling module receives the encapsulation commands is encapsulation command C, encapsulation command A, and encapsulation command B, then when the component scheduling module forwards the encapsulation commands to the unified scheduler, the order will be encapsulation command C, encapsulation command A, and encapsulation command B.
[0069] Specifically, the process of forwarding each of the encapsulated commands to the unified scheduler sequentially according to the target order includes: Step A: The component scheduling module selects the earliest received encapsulation command as the target encapsulation command based on the received time corresponding to each encapsulation command, and forwards the target encapsulation command to the unified scheduler. Step B: In response to the component scheduling module receiving the dispatch completion instruction sent by the unified scheduler, a new target encapsulation command is determined from the other encapsulation commands besides the target encapsulation command, based on the reception time corresponding to each other encapsulation command, and forwarded to the unified scheduler, until all encapsulation commands are forwarded to the unified scheduler.
[0070] In practice, the component scheduling module selects the earliest received encapsulation command as the target encapsulation command based on the received time of each encapsulation command. That is, the earliest encapsulation command in the target order obtained by sorting by received time is taken as the target encapsulation command, and the target encapsulation command is forwarded to the unified scheduler.
[0071] After receiving the target encapsulation command, the unified scheduler determines the target processing module based on the command type corresponding to the target encapsulation command, and then dispatches the target encapsulation command to the target processing module for parsing and execution of the corresponding function. Simultaneously, after dispatching the target encapsulation command to the target processing module, the unified scheduler returns a dispatch completion instruction.
[0072] When the component scheduling module receives a dispatch completion instruction from the unified scheduler, it indicates that the unified scheduler has completed the dispatch of the target encapsulation command. At this time, the component scheduling module selects a new target encapsulation command from all received encapsulation commands and other encapsulation commands except the target encapsulation command, based on the reception time of each encapsulation command, and forwards the new target encapsulation command to the unified scheduler.
[0073] Repeat the above selection and forwarding operation for new target encapsulation commands until all encapsulation commands are forwarded to the unified scheduler.
[0074] Based on the above example, the component scheduling module receives encapsulation commands A, B, and C in the order they are received: C, A, and B. Therefore, when forwarding the encapsulation commands to the unified scheduler, the component scheduling module first forwards encapsulation command C. After receiving the dispatch completion instruction from the unified scheduler, it then forwards encapsulation command A. Finally, after receiving the dispatch completion instruction from the unified scheduler, it forwards encapsulation command B.
[0075] Through the above scheme, the component scheduling module adopts a single-threaded serial command dispatching approach, avoiding thread contention issues and concurrency problems in a multi-threaded environment. This prevents thread contention and update chaos that can occur when multiple widgets process commands concurrently, thus preventing concurrency conflicts. Furthermore, using only one thread reduces the overhead of thread switching.
[0076] In some embodiments, when the function corresponding to the encapsulation command is an interface update, this function can be completed by refreshing the remote view class through the component management module. That is, in step 104, the target processing module parses the encapsulation command and executes the function corresponding to the encapsulation command, specifically including: Step 1041: The target processing module parses the encapsulation command to determine the operation type corresponding to the encapsulation command; Step 1042: In response to the operation type being interface update, an interface update instruction is sent from the target processing module to the component management module. Step 1043: The component management module receives the interface update instruction and calls the remote view class to refresh the interface.
[0077] In practice, the encapsulation command is parsed by the target processing module to determine the operation type corresponding to the encapsulation command. The operation type represents the operation required to implement the function corresponding to the encapsulation command. For example, the operation type includes interface update, page redirection, and data retrieval. Interface update, specifically, refers to modifying or refreshing elements of the user interface to reflect the current state of the application or respond to user actions.
[0078] When the operation type is interface update, the target processing module sends an interface update instruction to the component management module. After the component management module receives the interface update instruction, it calls the remote view class to refresh the interface.
[0079] Specifically, the component management module is the AppWidgetManager module, and the remote view class is the RemoteView class. When the interface needs to be updated, AppWidgetManager calls the onUpdate method of AppWidgetProvider.
[0080] In the onUpdate method, the view of the Widget is updated through the RemoteViews object, and the AppWidgetManager.updateAppWidget method is called to apply the updated RemoteViews to the Widget, thereby updating the interface.
[0081] In some embodiments, a launch page redirect can be initiated using a utility class. The specific process involves creating an Intent in the onUpdate method of AppWidgetProvider, specifying the target page to redirect to (usually an Activity of the application). The PendingIntent.getActivity method is then used to convert the Intent into a PendingIntent.
[0082] A PendingIntent is a special Intent that can be executed in other applications or system components. This PendingIntent is set to a button on a Widget by calling the RemoteViews.setOnClickPendingIntent method. When the user clicks the button on the Widget, the system triggers the previously set PendingIntent. The PendingIntent launches the target Activity, thus enabling navigation from the Widget to the application page.
[0083] In some embodiments, the target command can be specifically divided into immediate commands and non-immediate commands according to timeliness requirements. The function corresponding to the target command can be executed in different ways according to specific timeliness requirements. That is, in step 104, the target processing module parses the encapsulated command and executes the function corresponding to the encapsulated command, specifically including: Step 104A: The target processing module parses the encapsulation command to determine the timeliness type corresponding to the encapsulation command; Step 104B: In response to the timeliness type being immediate, execute the function corresponding to the encapsulated command; or, Step 104C: In response to the fact that the timeliness type is non-instantaneous, return status information and perform asynchronous data loading until the data loading is complete, and execute the function corresponding to the encapsulated command.
[0084] In practice, the target processing module parses the encapsulation command to determine the timeliness type corresponding to the encapsulation command, wherein the timeliness type indicates the urgency of the target command corresponding to the encapsulation command.
[0085] In this embodiment, specifically, the timeliness type includes immediate and non-immediate types. That is, the immediate type corresponds to immediate commands, and the non-immediate type corresponds to non-immediate commands. For example, immediate commands include click commands, jump commands, etc., and non-immediate commands include content loading commands, etc.
[0086] When the time-sensitive type is determined to be immediate, that is, the target command corresponding to the encapsulated command is an immediate command, the function corresponding to the encapsulated command should be executed immediately.
[0087] When the time-sensitivity type is determined to be non-real-time, meaning the target command corresponding to the encapsulated command is also non-real-time, the target processing module parses the encapsulated command. After confirming that the target command is indeed non-real-time, it first returns status information. This status information informs the target processing module that the encapsulated command has been received. Specifically, at the start of data loading, a loading indicator is displayed via RemoteViews, and data is loaded asynchronously in a background thread. After data loading is complete, the loading indicator is hidden. Then, the system switches to the main thread, uses RemoteViews to set the Widget's view content, and updates the Widget using the AppWidgetManager.updateAppWidget method.
[0088] In this embodiment, the loading prompt can be a ProgressBar or a loading animation. The ProgressBar is a UI component in Android used to display a progress bar to the user, indicating that an operation is in progress (such as loading data, performing tasks, etc.). It is usually used to provide visual feedback, informing the user that the application is processing a time-consuming task and that the user needs to wait.
[0089] In this embodiment, if an error message is captured in the background thread when loading data, the error message is passed to the main thread and the error message is displayed through the Widget.
[0090] The above solution determines the corresponding function execution method based on the timeliness type of the encapsulated command. When the target command corresponding to the encapsulated command is not an immediate command, asynchronous data loading is used. This loads data from the background without blocking the main thread (UI thread), reducing the burden on the main thread and improving the overall performance of the application. Simultaneously, a loading indicator can be displayed when data loading begins, informing the user that data is loading. Once loading is complete, the UI is updated immediately, providing instant feedback. Furthermore, users do not need to wait for data loading to complete before continuing to use other functions of the application, improving usability.
[0091] Based on the same inventive concept, another embodiment of this disclosure provides a data processing method, such as... Figure 2 As shown, it specifically includes: Step 201: The user clicks on the Widget component and confirms the target command.
[0092] In practice, the target component is monitored in real time. Upon detecting a component-triggered operation targeting the target component, it indicates that the user needs to update the target component. The target command corresponding to the component-triggered operation is then determined. This target command is the command corresponding to the target component, indicating which specific component the user triggered the operation on. In this embodiment, the target command is the WidgetData.
[0093] Step 202: Send a PendingIntent broadcast containing the target command.
[0094] In specific implementation, after monitoring the user's component trigger operation on the target component, a PendingIntent is triggered according to the target command to generate a target broadcast containing the target command, wherein the target broadcast is a PendingIntent broadcast.
[0095] Step 203: AppWidgetProvider receives the PendingIntent broadcast.
[0096] In specific implementation, the target broadcast is received by a component broadcast receiver. In this embodiment, the component broadcast receiver is AppWidgetProvider. The component broadcast receiver listens for lifecycle events and click broadcasts, i.e. PendingIntent broadcasts, and uses a wrapper component to encapsulate the target command in the PendingIntent broadcast into a standard instruction.
[0097] Step 204: TransferKit parses the PendingIntent broadcast, obtains the target command, and encapsulates the target command into a wrapped command.
[0098] In practice, upon receiving a target broadcast, the encapsulation component is used to parse and process the target broadcast, that is, the TransferKit component is used to parse and process the target broadcast to obtain the target command contained in the target broadcast.
[0099] The target command is encapsulated using a wrapper component to obtain the wrapped command. Specifically, the TransferKit component is used for wrapping to obtain the wrapped command.
[0100] Step 205: Call enqueueRequest() to add the encapsulated command to the pending queue.
[0101] In practice, an encapsulation component invokes an enqueue instruction, which adds the encapsulated command to a queue for processing. The enqueue instruction is the `enqueueRequest()` method, which adds a request to a queue for subsequent processing. A queue is a first-in, first-out (FIFO) data structure; newly added requests wait for previous requests to be processed before being processed.
[0102] In this embodiment, the enqueueRequest() method is used to add the encapsulation command to the queue to be processed, that is, to add the encapsulation command to the end of the queue to be processed, and then forward the encapsulation command to the component scheduling module to wait for the component scheduling module to allocate resources for execution.
[0103] Step 206: WidgetDispatcherHelper performs single-threaded scheduling on the encapsulated command and forwards it to WidgetCommandDispatcher.
[0104] In practice, the component scheduling module is the WidgetDispatcherHelper module. The component scheduling module adopts single-threaded Executor asynchronous scheduling, that is, it uses a single-threaded thread pool to execute tasks asynchronously, ensuring that all tasks are executed sequentially in the same thread.
[0105] Based on the reception time corresponding to each encapsulation command, each encapsulation command is forwarded sequentially to the unified scheduler. The unified scheduler is WidgetCommandDispatcher.
[0106] Step 207: WidgetCommandDispatcher identifies the encapsulated command.
[0107] Step 208: WidgetCommandDispatcher determines and dispatches the request to the corresponding Repo module.
[0108] In practice, after receiving the target encapsulation command, the unified scheduler determines the target processing module based on the command type corresponding to the target encapsulation command. This target processing module is the Repo module. The target encapsulation command is then dispatched to the target processing module for parsing and execution of the corresponding function.
[0109] Step 209: The Repo module executes business logic such as UI updates.
[0110] In practice, the encapsulation command is parsed and processed by the target processing module to determine the specific target operation corresponding to the encapsulation command, that is, the specific operation method for the target component, such as page redirection, interface update, data retrieval, etc. After determining the specific target operation corresponding to the encapsulation command, the target operation is executed, that is, the function corresponding to the encapsulation command is executed.
[0111] Through the above scheme, all widgets dispatch commands through a unified scheduler, WidgetCommandDispatcher, avoiding coupling and confusion. Simultaneously, a unified encapsulation component, TransferKit, is used for encapsulation, supporting structured command encapsulation for multiple widget types. Furthermore, the component scheduling module employs a single-threaded Executor for asynchronous scheduling, meaning that all system commands are executed serially to prevent concurrency conflicts. When a new widget is added, it only needs to implement the corresponding Repo and register its type for seamless integration. This provides strong scalability while reducing a large amount of repetitive code (such as Intent parsing and data updates) by moving it to a common class, lowering maintenance costs and reducing code redundancy. Finally, this data processing method is adapted to the in-vehicle environment. By building a unified command scheduling mechanism through WidgetCommandDispatcher and TransferKit, it achieves unified encapsulation and dispatch of target commands, ensuring consistent data distribution, behavior response, and state update for in-vehicle widgets, thus solving data consistency issues under multi-screen control.
[0112] It should be noted that the method of this disclosure embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this disclosure embodiment, and the multiple devices will interact with each other to complete the method described.
[0113] It should be noted that the above description describes some embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0114] Based on the same inventive concept, corresponding to any of the above-described embodiments, this disclosure also provides a data processing apparatus.
[0115] refer to Figure 3 ,Figure 3 The data processing apparatus of the embodiment includes: The monitoring module 301 is configured to detect a component trigger operation targeting a target component and determine the target command corresponding to the target component; The encapsulation module 302 is configured to encapsulate the target command through the encapsulation component to obtain the encapsulated command, and forward the encapsulated command to the unified scheduler; The dispatch module 303 is configured to use a unified scheduler to determine the command type corresponding to the encapsulated command, and dispatch the encapsulated command to the target processing module according to the command type. The execution module 304 is configured to parse the encapsulation command through the target processing module and execute the function corresponding to the encapsulation command.
[0116] In some embodiments, the packaging module 302 specifically includes: The broadcast generation unit is configured to generate a target broadcast containing the target command based on the target command; The parsing unit is configured to determine that the component broadcast receiver has received the target broadcast, and to parse the target broadcast using the encapsulation component to obtain the target command; The encapsulation unit is configured to encapsulate the target command through the encapsulation component to obtain the encapsulated command.
[0117] In some embodiments, the packaging module 302 specifically includes: The enqueue unit is configured to call an enqueue instruction through the encapsulation component, use the enqueue instruction to add the encapsulation command to the queue to be processed, and forward the encapsulation command to the component scheduling module; The forwarding unit is configured to forward the encapsulation command to the unified scheduler in response to the component scheduling module receiving the encapsulation command.
[0118] In some embodiments, the number of encapsulation commands is multiple, and the forwarding unit specifically includes: The receiving time determination subunit is configured to determine the receiving time corresponding to each of the encapsulation commands in response to the component scheduling module receiving the encapsulation commands. The forwarding subunit is configured to forward each encapsulation command to the unified scheduler in sequence according to the receiving time corresponding to each encapsulation command by the component scheduling module.
[0119] In some embodiments, the forwarding subunit is specifically configured as follows: The component scheduling module selects the earliest received encapsulation command as the target encapsulation command based on the received time of each encapsulation command, and forwards the target encapsulation command to the unified scheduler. In response to the component scheduling module receiving the dispatch completion instruction sent by the unified scheduler, it determines a new target encapsulation command from the encapsulation commands other than the target encapsulation command, based on the reception time of each other encapsulation command, and forwards it to the unified scheduler until all encapsulation commands are forwarded to the unified scheduler.
[0120] In some embodiments, the execution module 304 specifically includes: The operation type determination unit is configured to parse the encapsulation command through the target processing module to determine the operation type corresponding to the encapsulation command; The instruction sending unit is configured to send an interface update instruction to the component management module through the target processing module in response to the operation type being interface update. The refresh unit is configured so that when the component management module receives the interface update instruction, it calls the remote view class to refresh the interface.
[0121] In some embodiments, the execution module 304 specifically includes: The timeliness type determination unit is configured to parse the encapsulation command through the target processing module and determine the timeliness type corresponding to the encapsulation command; The first execution unit is configured to execute the function corresponding to the encapsulated command in response to the timeliness type being immediate; or... The second execution unit is configured to respond to the timeliness type being non-instantaneous, return status information, and perform asynchronous data loading until the data loading is complete, and then execute the function corresponding to the encapsulated command.
[0122] For ease of description, the above apparatus is described in terms of its functions, divided into various modules. Of course, in implementing this disclosure, the functions of each module can be implemented in one or more software and / or hardware.
[0123] The apparatus of the above embodiments is used to implement the corresponding data processing method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0124] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data processing method described in any of the above embodiments.
[0125] Figure 4This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.
[0126] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0127] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0128] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0129] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0130] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0131] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0132] The electronic devices described above are used to implement the corresponding data processing methods in any of the foregoing embodiments and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0133] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this disclosure also provides a non-transitory computer-readable storage medium that stores computer instructions for causing the computer to perform the data processing method as described in any of the above embodiments.
[0134] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0135] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the data processing method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0136] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides a vehicle, including the data processing device in the above embodiments, the electronic device in the above embodiments, and the computer-readable storage medium in the above embodiments, wherein the vehicle device implements the data processing method described in any of the above embodiments.
[0137] The vehicles described in the above embodiments are used to implement the data processing method described in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0138] It is understood that before using the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner, and user authorization will be obtained.
[0139] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations of this disclosed technical solution.
[0140] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0141] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0142] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this disclosure (including the claims) is limited to these examples; within the framework of this disclosure, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this disclosure as described above, which are not provided in detail for the sake of brevity.
[0143] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this disclosure, the provided drawings may or may not show well-known power / ground connections to integrated circuit (IC) chips and other components. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this disclosure, and this also takes into account the fact that the details of implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this disclosure will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this disclosure, it will be apparent to those skilled in the art that the embodiments of this disclosure can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0144] Although this disclosure has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0145] This disclosure is intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A data processing method, characterized in that, include: Detecting a component-triggered operation targeting a target component, and determining the target command corresponding to the target component; The target command is encapsulated by the encapsulation component to obtain the encapsulated command, and the encapsulated command is forwarded to the unified scheduler. The unified scheduler determines the command type corresponding to the encapsulation command, and dispatches the encapsulation command to the target processing module according to the command type. The target processing module parses the encapsulation command and executes the function corresponding to the encapsulation command.
2. The method according to claim 1, characterized in that, The process of encapsulating the target command through an encapsulation component to obtain an encapsulated command includes: Generate a target broadcast containing the target command based on the target command; Once the component broadcast receiver receives the target broadcast, the encapsulation component is used to parse the target broadcast to obtain the target command; The target command is encapsulated using an encapsulation component to obtain an encapsulated command.
3. The method according to claim 1, characterized in that, The step of forwarding the encapsulated command to the unified scheduler includes: The encapsulated component calls an enqueue instruction, which is used to add the encapsulated command to the queue to be processed, and then forwards the encapsulated command to the component scheduling module. In response to the component scheduling module receiving the encapsulation command, the encapsulation command is forwarded to the unified scheduler.
4. The method according to claim 3, characterized in that, The number of encapsulation commands is multiple; The step of forwarding the encapsulation command to the unified scheduler in response to the component scheduling module receiving the encapsulation command includes: In response to the component scheduling module receiving the encapsulation command, the receiving time corresponding to each encapsulation command is determined; The component scheduling module forwards each encapsulation command to the unified scheduler in sequence according to the receiving time corresponding to each encapsulation command.
5. The method according to claim 4, characterized in that, The component scheduling module forwards each encapsulation command to the unified scheduler sequentially according to the reception time corresponding to each encapsulation command, including: The component scheduling module selects the earliest received encapsulation command as the target encapsulation command based on the received time of each encapsulation command, and forwards the target encapsulation command to the unified scheduler. In response to the component scheduling module receiving the dispatch completion instruction sent by the unified scheduler, it determines a new target encapsulation command from the encapsulation commands other than the target encapsulation command, based on the reception time of each other encapsulation command, and forwards it to the unified scheduler until all encapsulation commands are forwarded to the unified scheduler.
6. The method according to claim 1, characterized in that, The step of parsing the encapsulation command through the target processing module and executing the function corresponding to the encapsulation command includes: The target processing module parses the encapsulation command to determine the operation type corresponding to the encapsulation command; In response to the operation type being interface update, an interface update instruction is sent to the component management module through the target processing module; Upon receiving the interface update instruction, the component management module calls the remote view class to refresh the interface.
7. The method according to claim 1, characterized in that, The step of parsing the encapsulation command through the target processing module and executing the function corresponding to the encapsulation command includes: The target processing module parses the encapsulation command to determine the timeliness type corresponding to the encapsulation command; In response to the timeliness type being immediate, execute the function corresponding to the encapsulated command; or, In response to the fact that the time-sensitive type is non-instantaneous, status information is returned, and data is loaded asynchronously until the data loading is complete, at which point the function corresponding to the encapsulated command is executed.
8. A data processing apparatus, characterized in that, include: The monitoring module is configured to detect component-triggered operations targeting a target component and determine the target command corresponding to the target component; The encapsulation module is configured to encapsulate the target command through an encapsulation component to obtain an encapsulated command, and then forward the encapsulated command to the unified scheduler. The dispatch module is configured to use a unified scheduler to determine the command type corresponding to the encapsulated command, and dispatch the encapsulated command to the target processing module according to the command type. The execution module is configured to parse the encapsulation command through the target processing module and execute the function corresponding to the encapsulation command.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1 to 7.
10. A vehicle, characterized in that, The vehicle includes the electronic equipment as described in claim 9.