Data processing method, device, electronic device and storage medium

By using initialization code templates and plug-in files in the application development environment to automatically generate initialization code, the repetitive work of writing initialization and merging properties for each component is solved, reducing the amount of code development and labor costs.

CN114115862BActive Publication Date: 2025-09-26WUBA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111427879.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-26
Publication Date
2025-09-26
Estimated Expiration
2041-11-26

AI Technical Summary

Technical Problem

During application development, writing code to initialize and merge properties for each class to be initialized in each Library component results in a large amount of code development and high labor costs.

Method used

By setting the initialization code template in the auxiliary plug-in and adding the class name of the class to be initialized in the component's plug-in file, the initialization code is generated and stored in the component's sub-manifest file, reducing the need to repeatedly write initialization and property merging code.

Benefits of technology

It reduces the amount of code development, reduces labor costs, and improves development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114115862B_ABST
    Figure CN114115862B_ABST
Patent Text Reader

Abstract

The present application shows a data processing method, device, electronic device and storage medium. Through the present application, when it is necessary to set the initialized properties and the properties for merging into the ContentProvider class for the classes to be initialized in each component in the application in the development environment of the application, it is not necessary to write the code for the initialized properties for the classes to be initialized in each component in the development environment of the application, and it is not necessary to write the code for merging into the ContentProvider class for the classes to be initialized in each component in the application. Instead, it is only necessary to set an initialization code template in the development environment and set the class name of the class to be initialized in the component, thereby reducing the amount of code development and thus reducing labor costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, electronic device, and storage medium. Background Art

[0002] When a user is using an application on a mobile phone, the application may sometimes be switched to the background of the mobile phone's operating system. In this case, the operating system may recycle the application's thread, that is, close the application's thread to save the mobile phone's system resources. Later, when the user switches the application to the foreground of the operating system, the operating system will start the thread for the application to start the application. When the application is started, the operating system will initialize the classes to be initialized in each Library component in the application and display the page that was displayed when it was last running in the background.

[0003] Among them, in order to initialize the classes to be initialized in each Library component in the application when the application is started, when developing the source code of the application, in one way, the codes of the classes to be initialized in each Library component can be written into the onCreate method in the ContentProvider class respectively.

[0004] In this way, after the computer program code is compiled to obtain an application, during the process of starting the application, in order to initialize the classes to be initialized in each Library component in the application, a ContentProvider class can be created, and the ContentProvider class can be used to process the classes to be initialized in each Library component respectively, thereby completing the initialization of the classes to be initialized in each Library component respectively.

[0005] However, because the ContentProvider class is required to initialize the classes to be initialized in each component, the application development environment requires not only code to initialize the properties of each class to be initialized in each component, but also code to merge the properties of each class to be initialized in each component of the application into the ContentProvider class. This results in a large amount of code development and high labor costs. Summary of the Invention

[0006] The present application provides a data processing method, device, electronic device, and storage medium.

[0007] In a first aspect, the present application provides a data processing method, which is applied to an electronic device, wherein the electronic device runs an application development environment, wherein the development environment includes at least one content provider class, an auxiliary plug-in, and at least one component of the application, each component including at least one class to be initialized; the method comprises:

[0008] Obtain an initialization code template set in the auxiliary plug-in; the initialization code template includes a first code segment and a second code segment; the first code segment includes at least the class name of the ContentProvider class and a preset merge tag for indicating that the class name is merged into the ContentProvider class; the second code segment includes at least a class name addition bit and a preset initialization tag for indicating that the class corresponding to the class name added to the class name addition bit needs to be initialized;

[0009] For any one of the at least one component, obtaining, from a plug-in file corresponding to the auxiliary plug-in in the component, a class name of a class to be initialized in the component;

[0010] The class name of the class to be initialized in the component is added to the class name addition position in the initialization code template to obtain the initialization code of the class to be initialized in the component; the initialization code includes a first code segment and a second code segment; the first code segment in the initialization code includes at least the class name of the ContentProvider class and a preset merge tag for indicating that the class to be initialized is merged into the ContentProvider class according to the class name of the ContentProvider class; the second code segment in the initialization code includes at least the class name of the class to be initialized and a preset initialization tag for indicating that the class corresponding to the class name of the class to be initialized needs to be initialized;

[0011] The initialization code of the class to be initialized in the component is stored in the sub-manifest file of the class to be initialized in the component.

[0012] In an optional implementation, the method further includes:

[0013] Creating an auxiliary plug-in in the development environment, and setting the initialization code template in the auxiliary plug-in;

[0014] as well as,

[0015] For any one of the at least one component, a plug-in file corresponding to the auxiliary plug-in is created in the component, and a class name of a class to be initialized in the component is set in the plug-in file.

[0016] In an optional implementation, the method further includes:

[0017] When the executable file of the application is generated according to the source code of the application developed in the development environment, the auxiliary plug-in is deleted or the initialization code template is deleted in the auxiliary plug-in.

[0018] In an optional implementation, the method further includes:

[0019] When the initialization code template needs to be upgraded, a new version of the auxiliary plug-in is obtained, wherein the new version of the auxiliary plug-in has a new version of the initialization code template;

[0020] Replace the existing auxiliary plug-in in the development environment with the new version of the auxiliary plug-in.

[0021] In an optional implementation, the method further includes:

[0022] When generating an executable file of the application according to the source code of the application developed in the development environment, searching for initialization code having the preset initialization tag in the sub-manifest file of each class in the source code;

[0023] Obtain the class name of the class to be initialized recorded in the second code segment of the initialization code containing the preset initialization tag, and obtain the class name of the ContentProvider class and the preset merge tag recorded in the first code segment of the initialization code containing the preset initialization tag;

[0024] Generating a tag set in the ContentProvider class in the executable file;

[0025] According to the class name of the ContentProvider class and the preset merge tag, the acquired class names of the classes to be initialized are added to the tag set.

[0026] In a second aspect, the present application provides a data processing device, which is applied to an electronic device, wherein the electronic device runs an application development environment, wherein the development environment includes at least one content provider ContentProvider class, an auxiliary plug-in, and at least one component of the application, each component including at least one class to be initialized; the device includes:

[0027] A first acquisition module is configured to acquire an initialization code template set in the auxiliary plug-in; the initialization code template includes a first code segment and a second code segment; the first code segment includes at least the class name of the ContentProvider class and a preset merge tag for indicating that the class name is to be merged into the ContentProvider class; the second code segment includes at least a class name addition position and a preset initialization tag for indicating that the class corresponding to the class name added to the class name addition position needs to be initialized;

[0028] A second acquisition module is configured to acquire, for any one of the at least one component, a class name of a class to be initialized in the component from a plug-in file corresponding to the auxiliary plug-in in the component;

[0029] A first adding module is configured to add the class name of the to-be-initialized class in the component to the class name adding position in the initialization code template to obtain the initialization code of the to-be-initialized class in the component; the initialization code includes a first code segment and a second code segment; the first code segment in the initialization code includes at least the class name of the ContentProvider class and a preset merge tag for indicating a merge into the ContentProvider class according to the class name of the ContentProvider class; the second code segment in the initialization code includes at least the class name of the to-be-initialized class and a preset initialization tag for indicating that the class corresponding to the class name of the to-be-initialized class needs to be initialized;

[0030] The storage module is used to store the initialization code of the class to be initialized in the component in the sub-list file of the class to be initialized in the component.

[0031] In an optional implementation, the apparatus further includes:

[0032] A first setting module is used to create an auxiliary plug-in in the development environment and set the initialization code template in the auxiliary plug-in;

[0033] as well as,

[0034] The second setting module is used to create a plug-in file corresponding to the auxiliary plug-in in any one of the at least one component, and set the class name of the class to be initialized in the component in the plug-in file.

[0035] In an optional implementation, the apparatus further includes:

[0036] The deletion module is used to delete the auxiliary plug-in or delete the initialization code template in the auxiliary plug-in when the executable file of the application is generated according to the source code of the application developed in the development environment.

[0037] In an optional implementation, the apparatus further includes:

[0038] A third acquisition module is used to acquire a new version of the auxiliary plug-in when the initialization code template needs to be upgraded, wherein the new version of the auxiliary plug-in has a new version of the initialization code template;

[0039] The replacement module is used to replace the existing auxiliary plug-in in the development environment with a new version of the auxiliary plug-in.

[0040] In an optional implementation, the apparatus further includes:

[0041] a search module for, when generating an executable file of the application according to the source code of the application developed in the development environment, searching for initialization code having the preset initialization tag in the sub-manifest files in each class in the source code;

[0042] A fourth acquisition module is used to obtain the class name of the to-be-initialized class recorded in the second code segment of the initialization code in which the preset initialization tag exists, and to obtain the class name of the ContentProvider class and the preset merge tag recorded in the first code segment of the initialization code in which the preset initialization tag exists;

[0043] A generation module, configured to generate a tag set in the ContentProvider class in the executable file;

[0044] The second adding module is used to add the acquired class names of the to-be-initialized classes to the tag set according to the class name of the ContentProvider class and the preset merge tag.

[0045] In a third aspect, the present application provides an electronic device, comprising:

[0046] processor;

[0047] a memory for storing processor-executable instructions;

[0048] Wherein, the processor is configured to execute the data processing method as described in the first aspect.

[0049] In a fourth aspect, the present application illustrates a non-temporary computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the data processing method as described in the first aspect.

[0050] In a fifth aspect, the present application illustrates a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to perform the data processing method as described in the first aspect.

[0051] The technical solution provided by this application may have the following beneficial effects:

[0052] In this application, an initialization code template set in an auxiliary plug-in is obtained. For any one of at least one component, the class name of the class to be initialized in the component is obtained from the plug-in file corresponding to the auxiliary plug-in in the component. The class name of the class to be initialized in the component is added to the class name addition field in the initialization code template to obtain the initialization code for the class to be initialized in the component. The initialization code for the class to be initialized in the sub-manifest file of the class to be initialized in the component is stored.

[0053] Through this application, when it is necessary to set initialization properties and properties for merging into the ContentProvider class for each to-be-initialized class in each component of the application in the application development environment, it is not necessary to write code for initialization properties for each to-be-initialized class in the application development environment, nor is it necessary to write code for merging properties into the ContentProvider class for each to-be-initialized class in the application development environment. Instead, it is possible to simply set an initialization code template in the development environment and set the class name of the to-be-initialized class in the component, thereby reducing the amount of code development and thus reducing labor costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 It is a flowchart of the steps of a data processing method of the present application.

[0055] Figure 2 It is a flowchart of the steps of a data processing method of the present application.

[0056] Figure 3 This is a structural block diagram of a data processing device of the present application.

[0057] Figure 4 This is a block diagram of an electronic device of the present application.

[0058] Figure 5 This is a block diagram of an electronic device of the present application. DETAILED DESCRIPTION

[0059] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0060] Reference Figure 1 , showing a step flow chart of a data processing method of the present application, which is applied to an electronic device, wherein the electronic device runs a development environment of an application, the development environment includes a ContentProvider (content provider) class, an auxiliary plug-in and at least one component of the application, and each component includes at least one class to be initialized.

[0061] In this application, a developer can start a development environment in an electronic device and develop source code of an application in the development environment.

[0062] In one embodiment, a developer has developed a portion of source code of an application in a development environment. The developed source code includes at least one component. Each component includes at least one class to be initialized. The components may include Library components, etc.

[0063] In this application, different classes developed for the application have different functions. Some classes in the components need to be initialized in the executable file during the startup of the application's executable file. Some classes in the components do not need to be initialized in the executable file during the startup of the application's executable file, but will only be enabled or called under specific needs, business or scenarios later.

[0064] Therefore, you need to set in the development environment which classes in the component need to be initialized during the startup of the executable file and how to initialize them.

[0065] Among them, as for the initialization method, the class can be initialized with the help of the ContentProvider class.

[0066] In one example, during the development phase, a developer may input a creation request for creating a ContentProvider class in the application's development environment. The electronic device may receive the creation request and then create the ContentProvider class in the application's development environment according to the creation request.

[0067] In one embodiment of the present application, some classes in the components in the application need to be initialized in the executable file during the startup of the application's executable file. Therefore, it is necessary to set in the application's development environment which classes in the components need to be initialized during the startup of the application's executable file.

[0068] The classes to be initialized may include classes in the Library component in the application, etc.

[0069] In order to set which classes in the components need to be initialized during the startup of the application's executable file in the application's development environment, you can set initialization properties for the classes to be initialized in each component in the application in the development environment.

[0070] In order to set the initialized properties for the classes to be initialized in each component of the application in the development environment, at least the following two aspects of work need to be prepared in this application.

[0071] On the one hand, auxiliary plug-ins are created in the development environment. Auxiliary plug-ins include gradle plug-ins, etc.

[0072] For example, a developer may input a creation request for creating an auxiliary plug-in in the development environment of the application program, and the electronic device may receive the creation request and then create the auxiliary plug-in in the development environment of the application program according to the creation request.

[0073] Additionally, you can set initialization code templates in auxiliary plugins.

[0074] For example, a developer may input a setting request for setting the second code segment in the initialization code template in the auxiliary plug-in in the development environment of the application. The electronic device may receive the setting request and then set the second code segment in the initialization code template in the auxiliary plug-in according to the setting request.

[0075] The second code segment includes at least a class name adding position and a preset initialization tag for indicating that the class corresponding to the class name added to the class name adding position needs to be initialized.

[0076] The class name addition bit is used to add the class name of the class that needs to be initialized.

[0077] The class name adding bit and the preset initialization tag may reflect properties of the class corresponding to the class name added to the class name adding bit that need to be initialized during the startup of the executable file of the application.

[0078] On the other hand, in the present application, for any one of at least one component, when the component includes a class to be initialized, a plug-in file corresponding to the auxiliary plug-in, such as a build.gradle file, may be created in the component.

[0079] For example, a developer may input a creation request for creating a plug-in file corresponding to the auxiliary plug-in in the component in the development environment of the application. The electronic device may receive the creation request and then create the plug-in file corresponding to the auxiliary plug-in in the component according to the creation request.

[0080] In addition, the developer can input a setting request in the development environment of the application to set the class name of the class to be initialized in the component in the plug-in file corresponding to the auxiliary plug-in in the component. The electronic device can receive the setting request and then set the class name of the class to be initialized in the component in the plug-in file corresponding to the auxiliary plug-in in the component according to the setting request.

[0081] The same is true for each of the other components in the at least one component.

[0082] In this application, since it is necessary to use the ContentProvider class to initialize the classes to be initialized in each component in the executable file of the application, the ContentProvider class and the classes to be initialized in each component in the executable file of the application are independent of each other.

[0083] Therefore, it is necessary to merge the class names of the classes to be initialized in each component into the ContentProvider class so that the ContentProvider class can initialize the classes to be initialized in each component in the executable file of the application according to the class names of the classes to be initialized in each component.

[0084] In order to merge the class names of the classes to be initialized in each component into the ContentProvider class, in this application, it is also necessary to set properties for merging into the ContentProvider class for the classes to be initialized in each component in the application in the application's development environment.

[0085] In this application, the auxiliary plug-in can be used to set properties for merging into the ContentProvider class for each class to be initialized in each component in the application in the development environment of the application.

[0086] For example, a developer may input a setting request for setting the first code segment in the initialization code template in the auxiliary plug-in in the development environment of the application. The electronic device may receive the setting request and then set the first code segment in the initialization code template in the auxiliary plug-in according to the setting request.

[0087] Thus, the initialization code template in this application includes a first code segment and a second code segment.

[0088] The first code segment includes at least the class name of the ContentProvider class and a preset merge tag for instructing to merge into the ContentProvider class according to the class name of the ContentProvider class.

[0089] The class name of the ContentProvider class and the preset merge tag may reflect the properties used to be merged into the ContentProvider class.

[0090] So, see Figure 1 In the application development environment, the specific process of setting the initialization properties for the classes to be initialized in each component in the application and the properties for merging into the ContentProvider class may include:

[0091] In step S101, an initialization code template set in the auxiliary plug-in is obtained.

[0092] The initialization code template includes a first code segment and a second code segment.

[0093] The first code segment includes at least the class name of the ContentProvider class and a preset merge tag for instructing to merge into the ContentProvider class according to the class name of the ContentProvider class.

[0094] The second code segment includes at least a class name adding position and a preset initialization tag for indicating that the class corresponding to the class name added to the class name adding position needs to be initialized.

[0095] In step S102, for any one component of the at least one component, the class name of the class to be initialized in the component is obtained from a plug-in file corresponding to the auxiliary plug-in in the component.

[0096] In this application, for any one of the at least one components, the process of steps S102 to S104 can be executed to set the initialized properties for the class to be initialized in the component and the properties to be merged into the ContentProvider class. The same is true for each of the other components in the at least one component.

[0097] For any one of at least one component, the component has a plug-in file corresponding to an auxiliary plug-in. Since the plug-in file in the component is the plug-in file corresponding to the auxiliary plug-in, that is, the plug-in file in the component is associated with the auxiliary plug-in, and the auxiliary plug-in has an initialization code template, and since the initialization code template includes a second code segment, the second code segment includes at least a class name addition bit and a preset initialization tag for indicating that the class corresponding to the class name added to the class name addition bit needs to be initialized. The class name addition bit and the preset initialization tag can reflect the properties of the class corresponding to the class name added to the class name addition bit that need to be initialized during the startup of the executable file of the application.

[0098] This often indicates that the class corresponding to the class name in the component is a class to be initialized, that is, the class corresponding to the class name in the component needs to be initialized in the executable file during the startup of the application's executable file.

[0099] Thus, in order to set the initialized properties and the properties for merging into the ContentProvider class for the class to be initialized in the component, the class name of the class to be initialized in the component can be obtained from the plug-in file corresponding to the auxiliary plug-in in the component, and then step S103 is executed.

[0100] In step S103, the class name of the class to be initialized in the component is added to the class name adding position in the initialization code template to obtain the initialization code of the class to be initialized in the component.

[0101] The initialization code includes a first code segment and a second code segment.

[0102] The first code segment in the initialization code includes at least the class name of the ContentProvider class and a preset merge tag for instructing to merge into the ContentProvider class according to the class name of the ContentProvider class.

[0103] The second code segment in the initialization code includes at least the class name of the class to be initialized and a preset initialization tag for indicating that the class corresponding to the class name of the class to be initialized needs to be initialized.

[0104] Through this application, the following association relationship can be established: "auxiliary plug-in" - "initialization code template" - "plug-in file corresponding to the auxiliary plug-in" - "class name of the class to be initialized in the component".

[0105] In this way, through the auxiliary plug-in and the plug-in file corresponding to the auxiliary plug-in, the initialization code template can be associated with the class name of the class to be initialized in the component, that is, the electronic device can know that the class name of the class to be initialized in the component needs to be added to the class name addition position in the second code segment in the initialization code template.

[0106] In this way, the electronic device can add the class name of the class to be initialized in the component to the class name adding position in the second code segment in the initialization code template to obtain the initialization code of the class to be initialized in the component.

[0107] The initialization code of the class to be initialized in the component can reflect the initialized properties of the class to be initialized in the component and the properties for merging into the ContentProvider class. This achieves the purpose of setting the initialized properties and the properties for merging into the ContentProvider class for the class to be initialized in the component in the application in the application development environment.

[0108] In step S104, the initialization code of the class to be initialized in the component is stored in the sub-manifest file of the class to be initialized in the component.

[0109] In this application, an initialization code template set in an auxiliary plug-in is obtained. For any one of at least one component, the class name of the class to be initialized in the component is obtained from the plug-in file corresponding to the auxiliary plug-in in the component. The class name of the class to be initialized in the component is added to the class name addition field in the initialization code template to obtain the initialization code for the class to be initialized in the component. The initialization code for the class to be initialized in the sub-manifest file of the class to be initialized in the component is stored.

[0110] Through this application, when it is necessary to set initialization properties and properties for merging into the ContentProvider class for each to-be-initialized class in each component of the application in the application development environment, it is not necessary to write code for initialization properties for each to-be-initialized class in the application development environment, nor is it necessary to write code for merging properties into the ContentProvider class for each to-be-initialized class in the application development environment. Instead, it is possible to simply set an initialization code template in the development environment and set the class name of the to-be-initialized class in the component, thereby reducing the amount of code development and thus reducing labor costs.

[0111] In another embodiment of the present application, after the initialization code of the class to be initialized in each component is stored in the sub-manifest file of the class to be initialized in each component, the developer can continue to write the source code of other functions of the application in the development environment.

[0112] After the developer has written the source code of the application in the development environment, the developer can compile the source code of the application developed in the development environment to obtain the executable file of the application. Figure 2 The specific process is as follows:

[0113] In step S201 , when an executable file of an application is generated according to the source code of the application developed in the development environment, the sub-manifest files in each class in the source code are searched for initialization codes with preset initialization tags.

[0114] The source code for an application developed in a development environment includes at least a ContentProvider class, auxiliary plug-ins, and at least one component of the application. Each component includes at least one class to be initialized, and the auxiliary plug-in includes an initialization code template. Each component includes a plug-in file corresponding to the auxiliary plug-in, which includes the class name of the component's class to be initialized. Of course, it may also include code for other application features, such as other classes that do not need to be initialized during the startup of the application's executable file, which will not be discussed in detail here.

[0115] In the present application, after the developer has completed writing the source code of the application in the development environment, the developer can input a compilation request for compiling the source code of the application developed in the development environment in the electronic device. The electronic device can receive the compilation request and compile the source code of the application developed in the development environment according to the compilation request to obtain the executable file of the application.

[0116] The sub-manifest file of the class to be initialized in the development environment contains the initialization code of the class to be initialized, which may reflect the initialized properties and the properties used to be merged into the ContentProvider class.

[0117] The initialization code of the class to be initialized includes: a first code segment and a second code segment.

[0118] The first code segment includes at least the class name of the ContentProvider class and a preset merge tag for instructing to merge into the ContentProvider class according to the class name of the ContentProvider class.

[0119] The second code segment includes at least the class name of the class to be initialized and a preset initialization tag for indicating that the class corresponding to the class name of the class to be initialized needs to be initialized.

[0120] In this way, when an electronic device compiles the source code of an application developed in a development environment, it can search for the class to be initialized in the source code, for example, by searching the sub-manifest files in each class in the source code to see whether there is initialization code with a preset initialization tag.

[0121] For example, for any class in each component of an application, if there is initialization code with a preset initialization tag in the sub-manifest file of the class, the class is often a class to be initialized. If there is no initialization code with a preset initialization tag in the sub-manifest file of the class, the class is often not a class to be initialized. The same is true for every other class in each component of the application.

[0122] Therefore, in this step, the electronic device can search the sub-manifest files in each class in the source code of the application developed in the development environment for the initialization code with the preset initialization tag, and then execute step S202.

[0123] In step S202, the class name of the class to be initialized recorded in the second code segment of the initialization code with the preset initialization tag is obtained, and the class name of the ContentProvider class and the preset merge tag recorded in the first code segment of the initialization code with the preset initialization tag are obtained.

[0124] In this application, for any class to be initialized in each component in the application, the class name of the ContentProvider class and the preset merge tag recorded in the first code segment of the initialization code in the sub-manifest file of the class to be initialized can be obtained, and the class name of the class to be initialized in the second code segment can be obtained.

[0125] Repeat the above steps for each other class to be initialized in each component in the application.

[0126] In step S203, a tag set is generated in the ContentProvider class in the executable file.

[0127] In step S204, based on the class name of the ContentProvider class and the preset merge tag, the acquired class names of the classes to be initialized are added to the tag set.

[0128] In this application, for any class to be initialized in each component in the application, according to the class name of the ContentProvider class recorded in the first code segment of the initialization code in the sub-manifest file of the class to be initialized and the preset merge tag, it can be known that the class name of the class to be initialized needs to be merged into the ContentProvider class corresponding to the class name of the ContentProvider class. In this way, the tag set in the ContentProvider class can be searched according to the class name of the ContentProvider class, and then the class name of the class to be initialized can be added to the tag set according to the preset merge tag.

[0129] Repeat the above steps for each other class to be initialized in each component in the application.

[0130] In this way, the tag set of the ContentProvider class contains the class names of the classes to be initialized in each component of the application. When the executable file of the application is launched later and the classes to be initialized in the executable file need to be initialized, the tag set of the ContentProvider class in the executable file can be obtained, and the class names of the classes to be initialized in each component in the tag set of the ContentProvider class can be obtained. Based on the class names of the classes to be initialized in each component in the tag set, the classes to be initialized in each component in the executable file are obtained respectively. In the executable file, the classes to be initialized in each component obtained based on the ContentProvider class are initialized. In this way, the task of initializing each class to be initialized in the components in the executable file based on the ContentProvider class is achieved.

[0131] In another embodiment of the present application, when an executable file of an application is generated based on the source code of an application developed in the development environment of the application, since the executable file has been obtained, the initialization code template set in the development environment of the application often no longer has any effect. In this way, in order to save storage space, at least the auxiliary plug-in can be deleted or the initialization code template can be deleted in the auxiliary plug-in.

[0132] In another embodiment of the present application, sometimes the initialization code template may need to be upgraded according to actual needs. For example, the relevant information of the initialized properties needs to be changed. In this way, the code in the initialization code template may be modified.

[0133] If the initialization code template needs to be upgraded, a new version of the auxiliary plug-in can be obtained. The new version of the auxiliary plug-in includes the new version of the initialization code template. The new version of the auxiliary plug-in can be entered or downloaded by the user on the electronic device. The new version of the auxiliary plug-in is then used to replace the existing auxiliary plug-in in the development environment.

[0134] This enables the update of auxiliary plug-ins and then the update of initialization code templates, avoiding a large amount of manual modification, thereby improving efficiency and reducing labor costs.

[0135] In another embodiment of the present application, an electronic device runs an application development environment, the development environment including at least two ContentProvider classes, an auxiliary plug-in, and at least one component of the application, each component including at least one class to be initialized; the auxiliary plug-in includes at least two initialization code templates. Different ContentProvider classes correspond to different initialization code templates.

[0136] For any initialization code template set in the auxiliary plug-in; the initialization code template includes a first code segment and a second code segment; the first code segment includes at least the class name of the ContentProvider class corresponding to the initialization code template in at least two ContentProvider classes and a preset merge tag for indicating that the class name of the ContentProvider class corresponding to the initialization code template is merged into the ContentProvider class corresponding to the initialization code template; the second code segment includes at least a class name addition bit and a preset initialization tag for indicating that the class corresponding to the class name added to the class name addition bit needs to be initialized; the same applies to each other initialization code template set in the auxiliary plug-in.

[0137] The class name of the ContentProvider class in the first code segment in different initialization code templates is different.

[0138] For any component, in the plug-in file corresponding to the auxiliary plug-in in the component, obtain the class name of the class to be initialized in the component. The same is done for each other component. In this way, a total of multiple class names of initialization classes are obtained.

[0139] Class names of multiple initialization classes are divided into two or more class name sets. Each class name set includes two or more class names, and class names in different class name sets do not overlap.

[0140] Different class name sets correspond to different ContentProvider classes, and different class name sets correspond to different initialization code templates.

[0141] For any one of the two or more class name sets, the ContentProvider class corresponding to the class name set and the initialization code template corresponding to the class name set may be determined.

[0142] For any class name of a class to be initialized in the class name set, add the class name of the class to be initialized in the class name addition position in the initialization code template to obtain the initialization code of the class to be initialized; the initialization code of the class to be initialized includes a first code segment and a second code segment; the first code segment in the initialization code includes at least the class name of the ContentProvider class corresponding to the class name set and a preset merge tag for indicating that the class name of the ContentProvider class corresponding to the class name set is merged into the ContentProvider class corresponding to the class name set; the second code segment in the initialization code includes at least the class name of the class to be initialized and a preset initialization tag for indicating that the class corresponding to the class name of the class to be initialized needs to be initialized; then the initialization code of the class to be initialized is stored in the sub-manifest file of the class to be initialized. The above operation is also performed for each other class name of the class to be initialized in the class name set.

[0143] For each of the other class name sets in the two or more class name sets, perform the above operation similarly.

[0144] It should be noted that for the method embodiments, for simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions involved are not necessarily required by this application.

[0145] Reference Figure 3 , shows a structural block diagram of a data processing device of the present application, which is applied to an electronic device, wherein the electronic device runs an application development environment, wherein the development environment includes at least one content provider ContentProvider class, an auxiliary plug-in, and at least one component of the application, each component including at least one class to be initialized; the device includes:

[0146] A first acquisition module 11 is configured to acquire an initialization code template set in the auxiliary plug-in; the initialization code template includes a first code segment and a second code segment; the first code segment includes at least the class name of the ContentProvider class and a preset merge tag for indicating that the class name is to be merged into the ContentProvider class; the second code segment includes at least a class name addition position and a preset initialization tag for indicating that the class corresponding to the class name added to the class name addition position needs to be initialized;

[0147] A second obtaining module 12 is configured to obtain, for any one of the at least one component, a class name of a class to be initialized in the component from a plug-in file corresponding to the auxiliary plug-in in the component;

[0148] A first adding module 13 is configured to add the class name of the to-be-initialized class in the component to the class name adding position in the initialization code template to obtain the initialization code of the to-be-initialized class in the component; the initialization code includes a first code segment and a second code segment; the first code segment in the initialization code includes at least the class name of the ContentProvider class and a preset merge tag for indicating a merge into the ContentProvider class according to the class name of the ContentProvider class; the second code segment in the initialization code includes at least the class name of the to-be-initialized class and a preset initialization tag for indicating that the class corresponding to the class name of the to-be-initialized class needs to be initialized;

[0149] The storage module 14 is configured to store the initialization code of the class to be initialized in the component in the sub-list file of the class to be initialized in the component.

[0150] In an optional implementation, the apparatus further includes:

[0151] A first setting module is used to create an auxiliary plug-in in the development environment and set the initialization code template in the auxiliary plug-in;

[0152] as well as,

[0153] The second setting module is used to create a plug-in file corresponding to the auxiliary plug-in in any one of the at least one component, and set the class name of the class to be initialized in the component in the plug-in file.

[0154] In an optional implementation, the apparatus further includes:

[0155] The deletion module is used to delete the auxiliary plug-in or delete the initialization code template in the auxiliary plug-in when the executable file of the application is generated according to the source code of the application developed in the development environment.

[0156] In an optional implementation, the apparatus further includes:

[0157] A third acquisition module is used to acquire a new version of the auxiliary plug-in when the initialization code template needs to be upgraded, wherein the new version of the auxiliary plug-in has a new version of the initialization code template;

[0158] The replacement module is used to replace the existing auxiliary plug-in in the development environment with a new version of the auxiliary plug-in.

[0159] In an optional implementation, the apparatus further includes:

[0160] a search module for, when generating an executable file of the application according to the source code of the application developed in the development environment, searching for initialization code having the preset initialization tag in the sub-manifest files in each class in the source code;

[0161] A fourth acquisition module is used to obtain the class name of the to-be-initialized class recorded in the second code segment of the initialization code in which the preset initialization tag exists, and to obtain the class name of the ContentProvider class and the preset merge tag recorded in the first code segment of the initialization code in which the preset initialization tag exists;

[0162] A generation module, configured to generate a tag set in the ContentProvider class in the executable file;

[0163] The second adding module is used to add the acquired class names of the to-be-initialized classes to the tag set according to the class name of the ContentProvider class and the preset merge tag.

[0164] In this application, an initialization code template set in an auxiliary plug-in is obtained. For any one of at least one component, the class name of the class to be initialized in the component is obtained from the plug-in file corresponding to the auxiliary plug-in in the component. The class name of the class to be initialized in the component is added to the class name addition field in the initialization code template to obtain the initialization code for the class to be initialized in the component. The initialization code for the class to be initialized in the sub-manifest file of the class to be initialized in the component is stored.

[0165] Through this application, when it is necessary to set initialization properties and properties for merging into the ContentProvider class for each to-be-initialized class in each component of the application in the application development environment, it is not necessary to write code for initialization properties for each to-be-initialized class in the application development environment, nor is it necessary to write code for merging properties into the ContentProvider class for each to-be-initialized class in the application development environment. Instead, it is possible to simply set an initialization code template in the development environment and set the class name of the to-be-initialized class in the component, thereby reducing the amount of code development and thus reducing labor costs.

[0166] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0167] Figure 4 8 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0168] Reference Figure 4 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0169] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 802 may include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.

[0170] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, images, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0171] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0172] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0173] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0174] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.

[0175] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor assembly 814 can also detect changes in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and temperature changes of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0176] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0177] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0178] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0179] Figure 51 is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 can be provided as a server.

[0180] Reference Figure 5 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above-described method.

[0181] The electronic device 1900 may further include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0182] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0183] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0184] The present application is described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.

[0185] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0186] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0187] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.

[0188] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

[0189] The above is a detailed introduction to a data processing method, device, electronic device and storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present application.

Claims

1. A data processing method, characterized in that: Applied to an electronic device, the electronic device running an application development environment, the development environment including at least one content provider ContentProvider class, an auxiliary plug-in, and at least one component of the application, each component including at least one class to be initialized; the method comprising: Obtain an initialization code template set in the auxiliary plug-in; the initialization code template includes a first code segment and a second code segment; the first code segment includes at least the class name of the ContentProvider class and a preset merge tag for indicating that the class name is merged into the ContentProvider class; the second code segment includes at least a class name addition bit and a preset initialization tag for indicating that the class corresponding to the class name added to the class name addition bit needs to be initialized; For any one of the at least one component, obtaining, from a plug-in file corresponding to the auxiliary plug-in in the component, a class name of a class to be initialized in the component; The class name of the class to be initialized in the component is added to the class name adding position in the initialization code template to obtain the initialization code of the class to be initialized in the component, so as to associate the initialization code template with the class name of the class to be initialized in the component through the auxiliary plug-in and the plug-in file corresponding to the auxiliary plug-in; the initialization code includes a first code segment and a second code segment; the first code segment in the initialization code includes at least the class name of the ContentProvider class and a preset merge tag for indicating that the class to be initialized is merged into the ContentProvider class according to the class name of the ContentProvider class; the second code segment in the initialization code includes at least the class name of the class to be initialized and a preset initialization tag for indicating that the class corresponding to the class name of the class to be initialized needs to be initialized; The initialization code of the class to be initialized in the component is stored in the sub-manifest file of the class to be initialized in the component.

2. The method according to claim 1, characterized in that The method further comprises: Creating an auxiliary plug-in in the development environment, and setting the initialization code template in the auxiliary plug-in; as well as, For any one of the at least one component, a plug-in file corresponding to the auxiliary plug-in is created in the component, and a class name of a class to be initialized in the component is set in the plug-in file.

3. The method according to claim 1, characterized in that The method further comprises: When the executable file of the application is generated according to the source code of the application developed in the development environment, the auxiliary plug-in is deleted or the initialization code template is deleted in the auxiliary plug-in.

4. The method according to claim 1, wherein The method further comprises: When the initialization code template needs to be upgraded, a new version of the auxiliary plug-in is obtained, wherein the new version of the auxiliary plug-in has a new version of the initialization code template; Replace the existing auxiliary plug-in in the development environment with the new version of the auxiliary plug-in.

5. The method according to claim 1, wherein The method further comprises: When generating an executable file of the application according to the source code of the application developed in the development environment, searching for initialization code having the preset initialization tag in the sub-manifest file of each class in the source code; Obtain the class name of the class to be initialized recorded in the second code segment of the initialization code containing the preset initialization tag, and obtain the class name of the ContentProvider class and the preset merge tag recorded in the first code segment of the initialization code containing the preset initialization tag; Generating a tag set in the ContentProvider class in the executable file; According to the class name of the ContentProvider class and the preset merge tag, the acquired class names of the classes to be initialized are added to the tag set.

6. A data processing device, characterized in that: Applied to an electronic device, the electronic device running an application development environment, the development environment including at least one content provider ContentProvider class, an auxiliary plug-in, and at least one component of the application, each component including at least one class to be initialized; the apparatus comprising: A first acquisition module is configured to acquire an initialization code template set in the auxiliary plug-in; the initialization code template includes a first code segment and a second code segment; the first code segment includes at least the class name of the ContentProvider class and a preset merge tag for indicating that the class name is to be merged into the ContentProvider class; the second code segment includes at least a class name addition position and a preset initialization tag for indicating that the class corresponding to the class name added to the class name addition position needs to be initialized; A second acquisition module is configured to acquire, for any one of the at least one component, a class name of a class to be initialized in the component from a plug-in file corresponding to the auxiliary plug-in in the component; A first adding module is used to add the class name of the to-be-initialized class in the component to the class name adding position in the initialization code template to obtain the initialization code of the to-be-initialized class in the component; the initialization code includes a first code segment and a second code segment, so as to associate the initialization code template with the class name of the to-be-initialized class in the component through an auxiliary plug-in and a plug-in file corresponding to the auxiliary plug-in; the first code segment in the initialization code includes at least the class name of the ContentProvider class and a preset merge tag for indicating a merge into the ContentProvider class according to the class name of the ContentProvider class; the second code segment in the initialization code includes at least the class name of the to-be-initialized class and a preset initialization tag for indicating that the class corresponding to the class name of the to-be-initialized class needs to be initialized; The storage module is used to store the initialization code of the class to be initialized in the component in the sub-list file of the class to be initialized in the component.

7. The device according to claim 6, characterized in that The device further comprises: A first setting module is used to create an auxiliary plug-in in the development environment and set the initialization code template in the auxiliary plug-in; as well as, The second setting module is used to create a plug-in file corresponding to the auxiliary plug-in in any one of the at least one component, and set the class name of the class to be initialized in the component in the plug-in file.

8. The device according to claim 6, characterized in that The device further comprises: The deletion module is used to delete the auxiliary plug-in or delete the initialization code template in the auxiliary plug-in when the executable file of the application is generated according to the source code of the application developed in the development environment.

9. The device according to claim 6, characterized in that The device further comprises: A third acquisition module is used to acquire a new version of the auxiliary plug-in when the initialization code template needs to be upgraded, wherein the new version of the auxiliary plug-in has a new version of the initialization code template; The replacement module is used to replace the existing auxiliary plug-in in the development environment with a new version of the auxiliary plug-in.

10. The device according to claim 6, characterized in that The device further comprises: a search module for, when generating an executable file of the application according to the source code of the application developed in the development environment, searching for initialization code having the preset initialization tag in the sub-manifest files in each class in the source code; A fourth acquisition module is used to obtain the class name of the to-be-initialized class recorded in the second code segment of the initialization code in which the preset initialization tag exists, and to obtain the class name of the ContentProvider class and the preset merge tag recorded in the first code segment of the initialization code in which the preset initialization tag exists; A generation module, configured to generate a tag set in the ContentProvider class in the executable file; The second adding module is used to add the acquired class names of the to-be-initialized classes to the tag set according to the class name of the ContentProvider class and the preset merge tag.

11. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; The processor is configured to execute the data processing method according to any one of claims 1 to 5.

12. A non-transitory computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the data processing method according to any one of claims 1 to 5.