Mode switching method, device, apparatus and medium for application

CN116339810BActive Publication Date: 2026-10-09GREAT WALL MOTOR CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310317149.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-28
Publication Date
2026-10-09
Estimated Expiration
2043-03-28

AI Technical Summary

Technical Problem

[0004]有鉴于此,本申请的目的在于提出一种应用的模式切换方法、装置、设备及介质,以解决背景技术中提及的APP的模式切换效果不佳的问题

Benefits of technology

[0035] As can be seen from the above, the mode switching method, apparatus, device, and medium provided in this application obtain a data set by splitting the installation file, and determine the data object according to the layout file identifier in the data set. When a mode switching instruction is triggered, the mode switching program corresponding to the data object is called back according to the callback mechanism configured in the layout file, thereby completing the mode switching function of the target application. Throughout the process, the mode switching program is parsed and compiled using open-source tool plugins, which reduces the development workload of developers. Compared with restarting the view components of the layout file to switch modes, the callback action using the callback mechanism can avoid problems such as page flickering and loss of browsing history caused by page restart, making the mode switching smoother.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116339810B_ABST
    Figure CN116339810B_ABST
Patent Text Reader

Abstract

The application provides an application mode switching method, device, equipment and medium, and belongs to the technical field of application configuration. The method comprises the following steps: in response to an installation instruction of a target application program, generating an installation file of the target application program, wherein the target application program comprises at least one mode switching program; performing splitting processing on the installation file to obtain multiple sets of data collections, wherein the data collections comprise layout file identifiers and data objects, and the layout file identifiers and the data objects correspond to each other in a one-to-one manner; determining the data objects corresponding to the layout file identifiers in a data base class according to the layout file identifiers; and in response to receiving a mode switching instruction, calling the mode switching program corresponding to the data object according to a callback mechanism configured by the layout file to execute the mode switching program and complete mode switching of the target application program. The mode switching method provided by the application does not need to restart the current page, avoids the flickering problem caused by page restart, and can reduce the development workload.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of application configuration technology, and in particular to an application mode switching method, apparatus, device and medium. Background Technology

[0002] Most current terminal operating systems support switching between day and night modes. When the system switches between different modes, the application (APP) often needs to switch between day and night modes simultaneously.

[0003] In existing technologies, switching modes in an app generally requires restarting the current page to change the corresponding parts in the new mode. However, restarting the page can easily cause issues such as page flickering and loss of list browsing history. In addition, in some mode switching configuration methods, developers need to manually reset the daytime or nighttime mode resources for each component, which is labor-intensive and prone to errors, making it difficult to quickly and conveniently implement mode switching in an app. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide an application mode switching method, apparatus, device and medium to solve the problem of poor mode switching effect of APP mentioned in the background art.

[0005] To achieve the above objectives, this application provides an application mode switching method comprising:

[0006] In response to the installation instructions of the target application, an installation file for the target application is generated, wherein the target application includes at least one mode switching program, which is generated by parsing and compiling an open-source tool plugin;

[0007] The installation file is split to obtain multiple sets of data, each set of data including a layout file identifier and a data object, with the layout file identifier and the data object corresponding one-to-one.

[0008] The data object corresponding to the layout file identifier in the data base class is determined based on the layout file identifier;

[0009] In response to receiving a mode switching instruction, the mode switching program corresponding to the data object is called back according to the callback mechanism configured in the layout file, so as to execute the mode switching program to complete the mode switching of the target application.

[0010] Further, the step of generating the installation file of the target application in response to the installation instruction of the target application includes, prior to:

[0011] Receive applications to be processed;

[0012] At least one layout file in the application to be processed is parsed using an open-source tool plugin to obtain a parsing result corresponding to each layout file;

[0013] At least one of the parsing results is compiled and processed using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result;

[0014] The target application is obtained by combining at least one of the mode switching programs with the application to be processed.

[0015] Furthermore, the target application includes an execution task control, which is associated with an open-source tool plugin and is a functional control pre-defined for the generation of the mode switching program;

[0016] The step of parsing at least one layout file in the application to be processed using an open-source tool plugin to obtain a parsing result corresponding to each layout file includes:

[0017] In response to the trigger operation of the task control, at least one layout file in the application to be processed is parsed through an open-source tool plugin to obtain a parsing result corresponding to each layout file.

[0018] Furthermore, the step of parsing at least one layout file in the application to be processed using an open-source tool plugin includes:

[0019] The open-source tool plugin is used to traverse all layout files, which include a first layout file that does not require mode switching and a second layout file that requires mode switching.

[0020] An ignore configuration is added to the first layout file using an open-source tool plugin. The ignore configuration is used to skip the parsing step of the first layout file.

[0021] The second layout file is parsed using an open-source tool plugin.

[0022] Furthermore, the step of compiling at least one of the parsing results using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result includes:

[0023] The parsing result is compiled to obtain member variables and member methods, wherein the member variables are the target view components in the parsing result, and the member methods are the mode switching logic corresponding to the view components;

[0024] Establish associations between member variables and member methods in each of the parsing results, and use the associated member variables and member methods as a mode switching procedure.

[0025] Furthermore, the installation file is split to obtain multiple data sets, including:

[0026] The mode switching program in the installation file is split into multiple data sets by performing a map-based splitting process. Each data set includes key-value pairs with the layout file identifier as the key and the data object as the value.

[0027] Furthermore, the mode switching procedure includes a procedure for switching the application to be processed from daytime mode to nighttime mode, or a procedure for switching the application to be processed from nighttime mode to daytime mode.

[0028] Based on the same inventive concept, this application also provides an application mode switching device, comprising:

[0029] A generation module is configured to generate an installation file for a target application in response to an installation instruction for the target application, wherein the target application includes at least one mode switching program.

[0030] The splitting module is configured to split the installation file to obtain multiple sets of data, each set of data including a layout file identifier and a data object, wherein the layout file identifier and the data object correspond one-to-one.

[0031] The first processing module is configured to determine the data object corresponding to the layout file identifier in the data base class based on the layout file identifier;

[0032] The second processing module is configured to, in response to receiving a mode switching instruction, call back the mode switching program corresponding to the data object according to the callback mechanism configured in the layout file, so as to execute the mode switching program to complete the mode switching of the target application.

[0033] Based on the same inventive concept, this application 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 mode switching method of the application as described in any of the above claims, or the mode switching method of the application as described in any of the above claims.

[0034] Based on the same inventive concept, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the mode switching method of the application as described in any of the above claims, or the mode switching method of the application as described in any of the above claims.

[0035] As can be seen from the above, the mode switching method, apparatus, device, and medium provided in this application obtain a data set by splitting the installation file, and determine the data object according to the layout file identifier in the data set. When a mode switching instruction is triggered, the mode switching program corresponding to the data object is called back according to the callback mechanism configured in the layout file, thereby completing the mode switching function of the target application. Throughout the process, the mode switching program is parsed and compiled using open-source tool plugins, which reduces the development workload of developers. Compared with restarting the view components of the layout file to switch modes, the callback action using the callback mechanism can avoid problems such as page flickering and loss of browsing history caused by page restart, making the mode switching smoother. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1 This is a schematic diagram illustrating the steps of the mode switching method applied in the embodiments of this application;

[0038] Figure 2 This is a schematic diagram illustrating the steps of the mode switching method for an application according to an embodiment of this application;

[0039] Figure 3 A schematic diagram illustrating the process principle of mode switching for applications in this application embodiment;

[0040] Figure 4 This is a block diagram of the mode switching device according to an embodiment of this application;

[0041] Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.

[0043] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0044] First, for ease of understanding, some technical terms used in this article are explained below:

[0045] Android is a free and open-source operating system based on Linux, primarily used in mobile devices such as smartphones, tablets, and in-vehicle systems. It is led and developed by Google and the Open Handset Alliance.

[0046] APP: refers to an application installed on the Android operating system or other operating systems.

[0047] Gradle: Highly modular build logic that is easy to reuse and share with others. For example, the Android build process is based on build logic introduced by the Android Gradle Plugin.

[0048] View: Used to display images and text within an application; some can respond to clicks, swipes, and other actions.

[0049] Activity: A window class in the Android system used to display Views.

[0050] onConfigurationChange: A method that can notify an Activity of configuration changes.

[0051] Android systems generally support switching between day and night modes, and many Android applications also support this switching. Switching between day and night modes provides a better user experience. Currently, Android systems typically implement day and night mode switching in two ways:

[0052] Option 1: Integrate a native switching scheme within the Android system. Pre-set corresponding day and night resources within the application. When the system switches between day and night modes, it will restart the current activity to reload the corresponding day or night resources to display the corresponding day or night mode interface.

[0053] This solution requires less development work and is relatively stable and less prone to crashes because it uses a solution native to the Android system. However, the current activity needs to be restarted, which can cause a series of problems such as page flickering and loss of list browsing history.

[0054] Option 2: When the terminal receives a notification from the system to switch between day and night modes, the developers should reset the corresponding resources for each view on the page that needs to switch between day and night modes in the onConfigurationChange callback method.

[0055] This solution can basically achieve the switching between day and night modes in the page flow without restarting the interface, and can avoid page flickering issues to a certain extent; however, since developers need to manually reset the corresponding resources of each view component, the development workload is large and it is very easy to make mistakes.

[0056] In view of the above problems, one or more embodiments of this application provide an application mode switching method, and the embodiments of this application are described in detail below with reference to the accompanying drawings.

[0057] The application mode switching method provided in this application, such as Figure 1 As shown, it includes:

[0058] S101, in response to the installation instruction of the target application, generate the installation file of the target application, wherein the installation file includes at least one mode switching program, which is generated by parsing and compiling an open source tool plugin.

[0059] S102, the installation file is split to obtain multiple sets of data, each set including a layout file identifier and a data object, with the layout file identifier corresponding one-to-one with the data object.

[0060] S103, determine the data object corresponding to the layout file identifier in the data base class based on the layout file identifier.

[0061] S104, in response to receiving the mode switching instruction, the mode switching program corresponding to the data object is called back according to the callback mechanism configured in the layout file, so as to execute the mode switching program to complete the mode switching of the target application.

[0062] As described above, the mode switching method provided in this application splits the installation file to obtain a data set, identifies data objects based on layout file identifiers within the data set, and, when a mode switching instruction is triggered, calls back the mode switching program corresponding to the data object according to the callback mechanism configured in the layout file, thereby completing the mode switching function of the target application. Throughout the process, using open-source tool plugins to parse and compile the mode switching program reduces the workload for developers. Compared to restarting view components in the layout file, using callback mechanisms for mode switching avoids issues such as page flickering and loss of browsing history caused by page restarts, resulting in a smoother mode switching experience.

[0063] In some embodiments, such as Figure 2 As shown, before step S101, the following steps are included:

[0064] Step S001: Receive the application to be processed.

[0065] In step S001, the application to be processed refers to the APP on the terminal device (such as mobile phone, tablet computer, etc.) held by the user later, or it can be the APP on the vehicle's central control system or vehicle computer. In some embodiments, the application to be processed refers to the APP running on the Android ecosystem.

[0066] Step S002: In response to the triggering operation of the execution task control, at least one layout file in the application to be processed is parsed through the open source tool plugin to obtain the parsing result corresponding to each layout file. The execution task control is a functional control associated with the open source tool plugin that is pre-set for the generation of the mode switching program.

[0067] In step S002 above, the open-source tool plugin can use the Gradle plugin. Since the Gradle plugin has reusable logic, the operation of parsing the layout file using the Gradle plugin can be provided to multiple similar projects using the same logic, reducing the overhead of repeatedly maintaining similar logic. In addition, since the Gradle plugin can build configurations, it can also build ignored configurations, thereby skipping layout files that do not require mode switching, effectively reducing the development workload of developers.

[0068] When using the Gradle plugin as the open-source tool plugin in this application, the execution task control can employ Gradle scripts based on the Gradle plugin settings, such as Gradle tasks. A Gradle task serves as the execution unit of the Gradle plugin, and the Gradle plugin completes specific tasks through multiple Gradle tasks. Here, a Gradle task is a functional unit pre-defined for the generation of the mode-switching program.

[0069] Step S003: Compile at least one of the parsing results using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result.

[0070] In the above steps, existing open-source code generation tools can be used to compile the parsed results. For example, Java code generation tools (such as JavaPoet library, rideer, telosys, picocog, etc.) can be used to generate code for the parsed results. Here, the code includes the relevant logic and objects for switching between day mode and night mode. The code generated by compiling the parsed results in this embodiment will not be described in detail.

[0071] Step S004: Combine at least one of the mode switching programs with the application to be processed to obtain the target application.

[0072] In step S004, after each layout file generates a mode switching program, the generated mode switching program is combined with the application to be processed to obtain the target application, which includes a mode switching program capable of switching between daytime and nighttime modes.

[0073] As can be seen from the above description, the entire process can be completed by using open-source tool plugins to parse and process the layout files, and then compiling the parsed results. This avoids the need for developers to manually set different modes of resources for each view component, thereby minimizing the workload of developers and reducing labor and time costs.

[0074] In some embodiments, in step S002, the Gradle plugin automatically scans the layout files in the application to be processed. In the parsing results obtained after parsing the layout files, it identifies the view components that need to switch between day and night modes. The identified view components are then processed for subsequent compilation.

[0075] It should be noted that the aforementioned mode switching procedure includes procedures for switching the application to be processed from daytime mode to nighttime mode, or procedures for switching the application to be processed from nighttime mode to daytime mode. In some embodiments, corresponding to the terminal device, the terminal device may be in daytime mode by default, and switch to nighttime mode when the user clicks or triggers a certain function button. This function button may be labeled as "nighttime mode," "dark mode," or "dark color mode," etc., and this embodiment does not make an absolute limitation on this.

[0076] In the above embodiments, the application to be processed generally consists of multiple layout files, each layout file containing multiple Android system view components (View). The view components can be images (imageView), text (Text), buttons (Button), etc. The mode switching program corresponding to the view component after compilation is the program that switches the above view component from day mode to night mode or from night mode to day mode.

[0077] In some embodiments, in step S002, parsing at least one layout file in the application to be processed using an open-source tool plugin includes:

[0078] S0021, Use an open-source tool plugin to traverse all layout files, which include a first layout file that does not require mode switching and a second layout file that requires mode switching;

[0079] S0022, Use an open-source tool plugin to add an ignore configuration to the first layout file, the ignore configuration is used to skip the parsing step of the normal layout file;

[0080] S0023, use an open-source tool plugin to parse the second layout file.

[0081] In the above steps, since the application to be processed includes multiple layout files, and in real-world application scenarios, there may be layout files that do not require switching between day and night modes. For example, in a chat application, developers might want the layout file corresponding to the chat box to remain unchanged regardless of whether day or night mode is switched. In this scenario, an ignore configuration can be added to the layout file. When the open-source tool plugin executes its actions, it can skip the scanning, parsing, and subsequent compilation processes of the layout file based on the ignore configuration. Here, each first layout file that does not require mode switching has a corresponding ignore configuration added, while second layout files without an ignore configuration are parsed and subsequently compiled by default.

[0082] In some embodiments, in step S003, the process of compiling at least one of the parsing results using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result includes:

[0083] S0031, The parsing result is compiled to obtain member variables and member methods, wherein the member variables are the target view components in the parsing result, and the member methods are the mode switching logic corresponding to the view components.

[0084] S0032, establish association relationships between member variables and member methods in each of the parsing results, and use the associated member variables and member methods as a mode switching procedure.

[0085] In step S0031 above, for each layout file that is scanned and parsed, a corresponding file with the .java suffix is ​​generated. The generated Java code is in the Java file with the .java suffix. These Java files are compiled by Javac (Java compiler) along with the other Java source code of the application to be processed. The Java file includes member variables and member methods as described above, and there is a one-to-one mapping relationship between member variables and member methods.

[0086] In some embodiments, in step S102, the splitting of the installation file to obtain multiple sets of data includes:

[0087] S1021, the mode switching program in the installation file is processed by Map to obtain multiple sets of data, wherein each set of data includes key-value pairs with layout file identifier as key and data object as value.

[0088] In step S1021 above, when the mode switching program is processed into a Map, the Map is a collection, a container that stores elements according to a key. In the Map, the key can be an object of any type, there cannot be duplicate keys, and each key has a corresponding value. Corresponding to step S501 of this application, the layout file identifier in the mode switching program is used as the key, and the data object is used as the value to form an independent key-value pair. Here, the layout file identifier is the layout file ID used for differentiation, and the data object is the object class in Java corresponding to the layout file ID.

[0089] In some embodiments, other methods can be used to establish the mapping relationship between layout file IDs and data objects, such as using table correspondence or stack association to establish the mapping relationship between layout file IDs and data objects.

[0090] In step S103 above, the data base class refers to the parent class of all classes in the Java file. In the dataset class, the Java object class corresponding to the layout file can be determined by the layout file ID, which facilitates the subsequent callback mechanism to call the mode switching program corresponding to the Java object class for mode switching.

[0091] In some embodiments, in step S104 above, for example, the callback mechanism for layout file configuration refers to the Activity's onConfigurationChanged(Configuration newConfig) method, which is a callback-based event handling method that is automatically triggered when system settings change.

[0092] It should be noted that the mode switching method provided in this application is implemented based on the user's terminal device or vehicle device. The terminal device or vehicle device is generally equipped with corresponding "dark mode" or "night mode" function buttons. When the user clicks to trigger the corresponding function button, the user's terminal device or vehicle device executes the mode switching method as described in this application.

[0093] In summary, such as Figure 3 As shown, the mode switching program provided in this application, when applied, pre-writes a Gradle script control, Gradle Task. During processing, the Gradle Task is triggered to execute the Gradle plugin. The Gradle plugin scans and obtains all layout files in the application source code, parses the layout files that require mode switching, and then uses a code generation tool (such as the JavaPoet library) to generate the code for switching between day and night modes in the layout files, thereby generating the mode switching program. After the mode switching program is compiled and combined into the target application, when the terminal device receives the installation instruction of the target application, it generates the installation file of the target application and performs Map processing on the mode switching program to obtain multiple sets of data. Based on the key-value pairs in the data sets, it determines the data object corresponding to the layout file identifier in the data base class. When the user needs to switch from day mode to night mode, or from night mode to day mode, the terminal device receives the mode switching instruction and, according to the callback mechanism configured in the layout file, calls back the mode switching program corresponding to the data object to execute the mode switching program, thereby completing the mode switching work for the target application for the corresponding user.

[0094] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in 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 in this embodiment, and the multiple devices will interact with each other to complete the method described.

[0095] It should be noted that the above description describes some embodiments of this application. 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.

[0096] Based on the same inventive concept, such as Figure 4 As shown, this application also provides an application mode switching device, including:

[0097] The first generation module 41 is configured to generate an installation file for the target application in response to an installation instruction for the target application, wherein the target application includes at least one mode switching program.

[0098] The splitting module 42 is configured to split the installation file to obtain multiple sets of data, wherein the data sets include layout file identifiers and data objects, and the layout file identifiers correspond one-to-one with the data objects.

[0099] The first processing module 43 is configured to determine the data object corresponding to the layout file identifier in the data base class based on the layout file identifier;

[0100] The second processing module 44 is configured to, in response to receiving a mode switching instruction, call back the mode switching program corresponding to the data object according to the callback mechanism configured in the layout file, so as to execute the mode switching program to complete the mode switching of the target application.

[0101] In some embodiments, the mode switching device further includes:

[0102] The receiving module is configured to receive applications to be processed.

[0103] The parsing module is configured to parse at least one layout file in the application to be processed through an open-source tool plugin to obtain a parsing result corresponding to each layout file;

[0104] The compilation module is configured to compile at least one of the parsing results using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result;

[0105] The second generation module is configured to combine at least one of the mode switching programs with the application to be processed to obtain a target application.

[0106] In some embodiments, the parsing module includes:

[0107] The traversal unit is configured to traverse all layout files using an open-source tool plugin, the layout files including a first layout file that does not require mode switching and a second layout file that requires mode switching.

[0108] A configuration unit is built and configured to add an ignore configuration to the first layout file using an open-source tool plugin. The ignore configuration is used to perform the step of skipping the parsing of the normal layout file.

[0109] The parsing unit is configured to parse the second layout file using an open-source tool plugin.

[0110] In some embodiments, the compilation module includes:

[0111] The compilation unit is configured to compile the parsing result to obtain member variables and member methods, wherein the member variables are the target view components in the parsing result, and the member methods are the mode switching logic corresponding to the view components;

[0112] The mapping unit is configured to establish an association between the member variables and member methods in each of the parsing results, and the associated member variables and member methods serve as a mode switching procedure.

[0113] In some embodiments, the splitting module 42 includes a Map processing unit configured to perform Map splitting processing on the mode switching program in the installation file to obtain multiple sets of data, wherein each set of data includes key-value pairs with layout file identifier as the key and data object as the value.

[0114] In addition, in the mode switching device of this application, the mode switching program includes a program for switching the application to be processed from daytime mode to nighttime mode, or a program for switching the application to be processed from nighttime mode to daytime mode.

[0115] For ease of description, the above apparatus is described in terms of its functions, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware components. The apparatus of the above embodiments is used to implement the mode switching method of the corresponding application in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0116] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application 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 mode switching method of the application described in any of the above embodiments.

[0117] Figure 5 This embodiment illustrates a more specific hardware structure of an electronic device, which 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.

[0118] 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.

[0119] 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.

[0120] The input / output interface 1030 is used to connect input / output modules to enable information input and output. Input / output modules can be configured as components within the device. Figure 5 (Not shown in the image) It can also be connected to external devices to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0121] Communication interface 1040 is used to connect to the communication module ( Figure 5 (Not shown in the image) to enable communication and interaction 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.).

[0122] 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.

[0123] 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.

[0124] The electronic devices described above are used to implement the mode switching method of the corresponding application in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0125] Based on the same inventive concept, corresponding to any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the mode switching method of the application as described in any of the above claims.

[0126] 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.

[0127] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the mode switching method of the application as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0128] 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 application (including the claims) is limited to these examples; within the framework of this application, 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 application as described above, which are not provided in the details for the sake of brevity.

[0129] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application 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 application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0130] Although this application 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.

[0131] The embodiments of this application are 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 the embodiments of this application should be included within the protection scope of this application.

Claims

1. A method for switching application modes, characterized in that, include: Receive an application to be processed, wherein the application to be processed is an application that can be set on a terminal device, a vehicle central control unit or an in-vehicle computer; At least one layout file in the application to be processed is parsed using an open-source tool plugin to obtain a parsing result corresponding to each layout file; At least one of the parsing results is compiled and processed using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result; At least one of the mode switching programs is combined with the application to be processed to obtain the target application; In response to the installation instructions of the target application, an installation file for the target application is generated, wherein the target application includes at least one mode switching program, which is generated by parsing and compiling an open-source tool plugin; The installation file is split to obtain multiple sets of data, each set of data including a layout file identifier and a data object, with the layout file identifier and the data object corresponding one-to-one. The data object corresponding to the layout file identifier in the data base class is determined based on the layout file identifier; In response to receiving a mode switching instruction, the mode switching program corresponding to the data object is called back according to the callback mechanism configured in the layout file, so as to execute the mode switching program to complete the mode switching of the target application.

2. The application mode switching method according to claim 1, characterized in that, The target application includes an execution task control, which is associated with an open-source tool plugin. The execution task control is a functional control that is pre-defined for the generation of the mode switching program. The step of parsing at least one layout file in the application to be processed using an open-source tool plugin to obtain a parsing result corresponding to each layout file includes: In response to the trigger operation of the task control, at least one layout file in the application to be processed is parsed through an open-source tool plugin to obtain a parsing result corresponding to each layout file.

3. The application mode switching method according to claim 1, characterized in that, The step of parsing at least one layout file in the application to be processed using an open-source tool plugin includes: The open-source tool plugin is used to traverse all layout files, which include a first layout file that does not require mode switching and a second layout file that requires mode switching. An ignore configuration is added to the first layout file using an open-source tool plugin. The ignore configuration is used to skip the parsing step of the first layout file. The second layout file is parsed using an open-source tool plugin.

4. The application mode switching method according to claim 1, characterized in that, The step of compiling and processing at least one of the parsing results using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result includes: The parsing result is compiled to obtain member variables and member methods, wherein the member variables are the target view components in the parsing result, and the member methods are the mode switching logic corresponding to the view components; Establish associations between member variables and member methods in each of the parsing results, and use the associated member variables and member methods as a mode switching procedure.

5. The application mode switching method according to claim 1, characterized in that, The installation file is split to obtain multiple data sets, including: The mode switching program in the installation file is split into multiple data sets by performing a map-based splitting process. Each data set includes key-value pairs with the layout file identifier as the key and the data object as the value.

6. The mode switching method for the application according to any one of claims 1 to 5, characterized in that, The mode switching procedure includes a procedure for switching the application to be processed from daytime mode to nighttime mode, or a procedure for switching the application to be processed from nighttime mode to daytime mode.

7. A mode switching device for an application, characterized in that, include: The receiving module is configured to receive an application to be processed, wherein the application to be processed is an application that can be set on a terminal device, a vehicle central control unit, or an in-vehicle computer. The parsing module is configured to parse at least one layout file in the application to be processed through an open-source tool plugin to obtain a parsing result corresponding to each layout file; The compilation module is configured to compile at least one of the parsing results using an open-source tool plugin to obtain a mode switching program corresponding to each parsing result; The second generation module is configured to combine at least one of the mode switching programs with the application to be processed to obtain a target application; A generation module is configured to generate an installation file for a target application in response to an installation instruction for the target application, wherein the target application includes at least one mode switching program. The splitting module is configured to split the installation file to obtain multiple sets of data, each set of data including a layout file identifier and a data object, wherein the layout file identifier and the data object correspond one-to-one. The first processing module is configured to determine the data object corresponding to the layout file identifier in the data base class based on the layout file identifier; The second processing module is configured to, in response to receiving a mode switching instruction, call back the mode switching program corresponding to the data object according to the callback mechanism configured in the layout file, so as to execute the mode switching program to complete the mode switching of the target application.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the mode switching method of the application as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to execute the mode switching method of the application as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Application program mode switching method and device, electronic equipment and storage medium

    CN115408051A