A method, device, equipment and medium for operating data in a plug-in
By encapsulating components in the plug-in and registering proxy components, the problem of being unable to operate data within the plug-in is solved, user experience and security are improved, and data manipulation and component usage within the plug-in are realized.
Patent Information
- Application Number
- CN202211586685.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-09
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2042-12-09
AI Technical Summary
In the existing technology, data cannot be operated within the plug-in, resulting in poor user experience and security issues, and the four major components of Android cannot be registered and used within the plug-in.
By encapsulating the component in the plug-in, after the application receives the usage request, it determines the component type and component to be used, obtains the keyword of the component, registers the proxy component based on the correspondence between the keyword and the proxy component, and calls the plug-in through the proxy component The component that performs the operation request.
It realizes the operation of data within the plug-in, improves the user experience, solves the risk of data leakage, and allows the use of the four major components of Android within the plug-in.
Smart Images

Figure CN116016676B
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent hardware technology, and in particular to a method, device, equipment and medium for operating data in a plug-in. Background Art
[0002] With the development of society, the division of labor in society is becoming more and more detailed. Many companies usually have outstanding advantages in one aspect and cannot manufacture all kinds of products. For example, for the product of automobiles, the strength of automobile companies lies in making cars, and software programs are not the advantages of automobile companies; for software players, video companies have outstanding advantages in this regard and have many customers. The current implementation scheme of the Internet of Vehicles SDK (Software Development Kit) is that the video company encapsulates the video middle platform SDK, provides an apk format plug-in and a jar format interface to the outside world, and realizes operations such as video playback and account login. That is, by installing the plug-in on the application of the car company's equipment, the car company's equipment can play the video provided by the video company through the plug-in. The current way to use the plug-in to call data in the external mode is: put the database on the car company's equipment side, and implement database operations such as logging in to the account and querying the playback record by calling the database on the car company's equipment. In this way, when the user logs in to the account, queries the playback record, etc., it will inevitably cause delays due to the influence of the network. In the case of poor network, the user experience is poor. In addition, since the database is placed on the car company's equipment side, the database is controlled by the car company, which is prone to security issues such as data leakage.
[0003] The four major components of Android can provide data services, broadcast services, interface services and background services. Encapsulating components in plug-ins, that is, storing data inside plug-ins, can effectively solve the above problems. However, there is no technical solution for encapsulating components in plug-ins in the prior art. In addition, it is well known that the four major components of Android need to be registered before they can be used. However, software application service companies only provide plug-ins and plug-in implementations. It is impossible to register components through plug-ins. Even if components are encapsulated in plug-ins, components in plug-ins cannot be used, resulting in the inability to operate data in plug-ins. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method, device, equipment and medium for operating data in a plug-in, so as to realize the operation of data in the plug-in. The specific technical solution is as follows:
[0005] In a first aspect of an embodiment of the present application, a method for operating data in a plug-in is first provided, which is applied to an electronic device of an Android system, wherein a plug-in is installed on an application of the electronic device, and the method comprises:
[0006] receiving a use request, and determining a component type to be used in the plug-in and a first component to be used based on the use request; wherein the plug-in encapsulates at least one type of component and at least one first component to be used;
[0007] After identifying the first component as an unregistered component, obtaining a keyword corresponding to the first component; wherein the keyword is a field representing a function implemented by the component;
[0008] Based on the correspondence between the keyword and the proxy component, determining a first proxy component corresponding to the first component, the first proxy component being registered through the application; wherein the keyword and the proxy component correspond through an index;
[0009] Based on the use request, obtaining a first operation request, wherein the first operation request carries an operation to be performed by the first component;
[0010] The first operation request is sent to the first proxy component, and the first proxy component calls the first component, so that the first component performs the operation corresponding to the first operation request in the plug-in.
[0011] Optionally, the step of determining the type of component to be used based on the use request includes:
[0012] If the usage request is to provide a data service, determining that the component type to be used is a content provider ContentProvider;
[0013] If the use request is to provide a broadcast service, determining that the component type to be used is a broadcast receiver BroadCastReceiver;
[0014] If the usage request is to provide a background service, determining that the type of the component to be used is a service;
[0015] If the use request is to provide an interface service, it is determined that the type of the component to be used is an activity.
[0016] Optionally, the step of determining the first component to be used based on the use request includes:
[0017] A keyword is determined according to the use request, and a first component to be used is determined according to a correspondence between the keyword and the component.
[0018] Optionally, the step of obtaining a first proxy component corresponding to the first component based on the correspondence between the keyword and the proxy component includes:
[0019] Get the index list of proxy components;
[0020] Obtaining a package name of the application, and mapping index information of the first proxy component from the index list according to the keyword corresponding to the first component and the package name of the application;
[0021] Determining, based on the index information of the first proxy component, a first proxy component corresponding to the first component;
[0022] The index information includes the package name of the application and the keyword corresponding to the proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component.
[0023] Optionally, the step of obtaining a first operation request based on the use request includes:
[0024] Extracting the required keywords of the use request;
[0025] Based on the mapping relationship between the requirement keyword and the operation request, a first operation request corresponding to the use request is determined.
[0026] When it is determined that the component type to be used is a content provider ContentProvider and the first component to be used is a first ContentProvider;
[0027] The first operation request is to add data, and the operation corresponding to the operation request is to add data to the first ContentProvider;
[0028] The first operation request is to delete data, and the operation corresponding to the operation request is to query data from the first ContentProvider;
[0029] The first operation request is to modify data, and the operation corresponding to the operation request is to modify data from the first ContentProvider;
[0030] The first operation request is to query data, and the operation corresponding to the operation request is to query data from the first Content Provider.
[0031] In a second aspect of the embodiment of the present application, a device for operating data in a plug-in is further provided, the device being applied to an electronic device of an Android system, wherein a plug-in is installed on an application of the electronic device, and the device comprises:
[0032] A first determination module is configured to receive a use request and determine a component type to be used in the plug-in and a first component to be used based on the use request; wherein the plug-in encapsulates at least one type of component and at least one first component to be used;
[0033] A first acquisition module, configured to acquire a keyword corresponding to the first component after identifying that the first component is an unregistered component; wherein the keyword is a field representing a function implemented by the component;
[0034] A second determination module is used to determine a first proxy component corresponding to the first component based on a correspondence between the keyword and the proxy component; wherein the first proxy component is registered through the application program, and the keyword and the proxy component correspond through an index;
[0035] A second acquisition module, configured to obtain a first operation request based on the use request, wherein the first operation request carries an operation to be performed by the first component;
[0036] The calling module is used to send the first operation request to the first proxy component; the first proxy component calls the first component so that the first component executes the operation corresponding to the first operation request in the plug-in.
[0037] Optionally, the first determining module is specifically configured to:
[0038] If the usage request is to provide a data service, determining that the component type to be used is a content provider ContentProvider;
[0039] If the use request is to provide a broadcast service, determining that the component type to be used is BroadCastReceiver;
[0040] If the usage request is to provide a background service, determining that the type of the component to be used is Service;
[0041] If the use request is to provide an interface service, it is determined that the type of component to be used is Activity.
[0042] Optionally, the first determining module is further used to:
[0043] A keyword is obtained from the use request, and a first component to be used is determined according to a correspondence between the keyword and the component.
[0044] Optionally, the second determining module is specifically configured to:
[0045] Get the index list of proxy components;
[0046] Obtaining a package name of the application, and mapping index information of the first proxy component from the index list according to the keyword corresponding to the first component and the package name of the application;
[0047] Determining, based on the index information of the first proxy component, a first proxy component corresponding to the first component;
[0048] The index information includes the package name of the application and the keyword corresponding to the proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component.
[0049] Optionally, the second acquisition module is specifically used to:
[0050] Extracting the required keywords of the use request;
[0051] Based on the mapping relationship between the requirement keyword and the operation request, a first operation request corresponding to the use request is determined.
[0052] Optionally, when it is determined that the type of the component to be used is a content provider ContentProvider and the first component to be used is a first ContentProvider;
[0053] The first operation request is to add data, and the operation corresponding to the operation request is to add data to the first ContentProvider;
[0054] The first operation request is to delete data, and the operation corresponding to the operation request is to query data from the first ContentProvider;
[0055] The first operation request is to modify data, and the operation corresponding to the operation request is to modify data from the first ContentProvider;
[0056] The first operation request is to query data, and the operation corresponding to the operation request is to query data from the first Content Provider.
[0057] In another aspect of the embodiments of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any of the above-mentioned methods for operating data in a plug-in is implemented.
[0058] In another aspect of the embodiments of the present application, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned methods for operating data in a plug-in.
[0059] In the technical solution provided by the embodiment of the present application, a component is encapsulated in the plug-in, and the application program is allowed to register the proxy component. After receiving the user's use request, the electronic device determines the component type to be used in the plug-in and the first component to be used based on the use request. After identifying that the first component is an unregistered component, the keyword corresponding to the first component is obtained, and then the first proxy component of the first component is determined based on the correspondence between the keyword and the proxy component. After obtaining the first operation request based on the use request, the first operation request is sent to the first proxy component, and then the first component in the plug-in is called by the first proxy component, so that the first component performs the operation corresponding to the first operation request in the plug-in. Because the first proxy component is registered, and the first component to be used in the plug-in is not registered, the application program can identify the first proxy component, but cannot identify the first component. Therefore, after obtaining the operation request based on the use request, the operation request is sent to the first proxy component, and then the first proxy component calls the operation request back to the first component, and the first component can perform the operation corresponding to the operation request in the plug-in, thereby completing the operation on the data in the plug-in. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0061] Figure 1 A first flow chart of a method for operating data in a plug-in provided in an embodiment of the present application;
[0062] Figure 2 A second flow chart of a method for operating data in a plug-in provided in an embodiment of the present application;
[0063] Figure 3 A signaling diagram of a method for operating data in a plug-in provided in an embodiment of the present application;
[0064] Figure 4 A schematic diagram of the structure of a device for operating data in a plug-in provided in an embodiment of the present application;
[0065] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0067] For ease of understanding, the following are some explanations of the terms used in this application:
[0068] A plugin is a program written in accordance with a certain standard application program interface. It can only run on the system platform specified by the program (it may support multiple platforms at the same time), and cannot run independently from the specified platform.
[0069] Software Development Kit (SDK): Usually a collection of development tools used by software engineers to build application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.
[0070] Android installation package (AndroidPackage, Apk): The project compiled by the Android SDK is packaged into an installation program file in the Apk format. The Apk file is actually in the zip format, but the suffix is changed to Apk. It can be installed by transferring the Apk file directly to the Android emulator or Android terminal for execution.
[0071] Host: Also known as the application (APP) host. To facilitate development and improve application publishing efficiency, plug-ins can be dynamically loaded based on the host.
[0072] Plugin: Also known as dynamic plugin or dynamic file, it refers to an independent file that contains a part of the executable code of the Android platform. It can be an Apk file, Dex file, Zip file, etc. Its operation requires the host to provide a set of operating mechanisms.
[0073] Component: Android applications are composed of some scattered and related components, which are bound together by a project. They are the cornerstone of Android applications. For example, the application in the embodiment of this application mainly takes the Android application as an example, and the component represents the four major components of the Android platform: activity, service, content provider and broadcast receiver. All components need to be registered before they can be used.
[0074] Among them, Activity is the window for Android programs to interact with users. It is the most basic building block of Android. It needs to maintain the status of each interface, do many persistent things, and properly manage the life cycle and some jump logic; Service serves the Activity in the background, encapsulates a complete functional logic implementation, accepts upper-level instructions, and completes related things; Content Provider is the access method for third-party application data provided by Android. Its main function is to serve as a platform, provide data sharing, and provide data addition, deletion, modification and query functions; Broadcast Receiver accepts one or more intents (Intent) as trigger events, receives related messages, does some simple processing, and converts them into a notification (Notification), unifying Android's event broadcast model.
[0075] In order to solve the technical problem that data cannot be operated in a plug-in, the present application provides a method, apparatus, device and medium for operating data in a plug-in, which can be applied to various electronic devices, such as mobile phones, tablets, vehicle-mounted terminals, etc. The operating system of the electronic device executing this solution is the Android system, and an application can be installed on the electronic device, and a plug-in provided by a software service company is installed in the application.
[0076] The following is a detailed description of a method for operating data in a plug-in provided in an embodiment of the present application. The method is applied to an electronic device of an Android system, and a plug-in is installed on an application of the electronic device, such as Figure 1 As shown, the method includes:
[0077] S11, receiving a use request, and determining a component type to be used in the plug-in and a first component to be used based on the use request, wherein the plug-in encapsulates at least one type of component and at least one first component to be used.
[0078] In the embodiment of the present application, the operating system of the electronic device is an Android system, and a plug-in provided by a software service company is installed on the application on the electronic device. When the application is running, the plug-in can be run at the same time to realize the function corresponding to the plug-in. The application running the plug-in can be understood as the host of the plug-in. The process of starting the application includes the process of initializing the application. During the initialization process, it can be determined whether the application has a plug-in installed, and it can be determined whether the plug-in is successfully running.
[0079] For example, when the electronic device is a vehicle-mounted terminal and the software service company is a video service company, a plug-in provided by the video service company is installed on the application of the vehicle-mounted terminal. When the user starts the application to run the application, the video plug-in installed in the application also runs at the same time. The user can play the video provided by the video service company through the plug-in.
[0080] In the embodiment of the present application, different types of components can be encapsulated in the plug-in, and multiple components of the same type can be encapsulated in the plug-in. For example, a plug-in can encapsulate 1 Activity type component, 1 Service type component, 2 BroadCastReceiver type components, and 3 ContentProvider type components. Of course, other types of components can also be encapsulated in the plug-in, and the present application does not specifically limit the type and number of components.
[0081] A use request is a request issued by a user for his or her needs. For example, a use request may include: logging in to an account, searching for playback records, etc. A user may send a use request to an electronic device. After the electronic device receives the use request, the plug-in installed on the application of the electronic device may also be informed of the use request. The plug-in may then determine the type of component to be used in the plug-in based on the use request, and determine the first component to be used.
[0082] In one embodiment, when the usage request is to provide data services, it can be determined that the component type to be used in the plug-in is ContentProvider.
[0083] Data service means sharing data or adding, deleting, modifying and checking data in the database. For example, if the plug-in is a video plug-in, when the request is to query the video playback record, the user's playback record is searched from the database storing the user's playback record. At this time, it can be determined that the user's request requires the provision of data service, and then the component type to be used in the plug-in is determined to be ContentProvider.
[0084] In one embodiment, when the usage request is to provide a broadcast service, it may be determined that the component type to be used in the plug-in is BroadCastReceiver.
[0085] Broadcast service is to globally monitor the broadcast information sent by the application or the system of the electronic device. The BroadCastReceiver component can receive broadcast information sent by the application or the system. Continuing with the above example, when the plug-in is a video plug-in, when the usage request is to collect videos, the application can send a broadcast message to the BroadCastReceiver component to synchronize the video collection status of the plug-in. At this time, it can be determined that the user's usage request requires the provision of broadcast services, and then determine that the component type to be used in the plug-in is BroadCastReceiver.
[0086] In one embodiment, when the usage request is to provide a background service, it can be determined that the component type to be used in the plug-in is Service.
[0087] Background services are used to complete user-specified operations in the background. Service components can handle network transactions, play music, etc. in the background. Continuing with the above example, when the plug-in is a video plug-in, when the usage request is to play a video in the background, the application can send a command to the Service component to play the video in the background, so that the plug-in can play the video in the background. At this time, it can be determined that the user's usage request requires the provision of background services, and then the component type to be used in the plug-in is determined to be Service.
[0088] In one embodiment, when the usage request is to provide an interface service, it can be determined that the component type to be used in the plug-in is Activity.
[0089] The interface service provides a visual page for users to operate, so as to realize the interaction between users and applications. Continuing with the above example, when the plug-in is a video plug-in, when the usage request is to fast-forward the video, the user can fast-forward the video based on the interface provided by the Activity component. At this time, it can be determined that the user's usage request requires the provision of an interface service, and then the component type to be used in the plug-in is determined to be Activity.
[0090] In one embodiment of the present application, after the plug-in determines the type of component to be used in the plug-in based on the use request, since the plug-in may contain multiple components of the same type, the plug-in further determines the first component to be used in the plug-in based on the use request.
[0091] In one embodiment, the above step S11 may include: determining a keyword according to the use request, and determining a first component to be used according to a correspondence between the keyword and the component.
[0092] In an embodiment of the present application, the electronic device can extract keywords from the use request. In one embodiment, all fields in the use request can be used as keywords. In one embodiment, a keyword thesaurus can be set in advance according to the use request that may appear, and after receiving the use request, the use request is identified, and the use request is fuzzy matched according to the keyword thesaurus, and then the keywords are determined. Components also have corresponding keywords. The keywords corresponding to the components are artificially set fields. Developers can pre-set keywords for components based on the functions implemented by the components. The keywords determined from the use request can indicate the user's requirements for the functions implemented by the plug-in, and the keywords corresponding to the components are fields that characterize the functions implemented by the components. The keywords determined from the use request correspond to the keywords corresponding to the components, that is, it can be understood that there is a corresponding relationship between the keywords determined from the use request and the components. The electronic device extracts keywords from the use request according to the use request, and then determines the first component to be used in the plug-in according to the corresponding relationship between the keywords and the components.
[0093] For example, based on the usage request, the plug-in has determined that the type of component to be used in the plug-in is ContentProvider. There are two ContentProviders encapsulated in the plug-in, namely ContentProvider1 and ContentProvider2. ContentProvider1 stores user account data, and its function is to add, delete, modify, and query the user account data it stores. The keyword set for ContentProvider1 is UserIDprovider (user account data provider). ContentProvider2 stores playback record data, and its function is to add, delete, modify, and query the playback record data it stores. The keyword set for ContentProvide2 is PlayRecordprovider (video playback record data provider). The keyword of ContentProvider can represent the data provided by this ContentProvider. When the usage request is to find video playback records, the keyword is determined to be Find Video Play Records based on the usage request. The keyword Find Video Play Records corresponds to the keyword PlayRecordprovider corresponding to ContentProvider2. Then, according to the correspondence between keywords and components, it is determined that the first component to be used in the plug-in is ContentProvider2.
[0094] Of course, when the type of the component to be used in the plug-in is other types, such as BroadCastReceiver, Service, Activity, this method can also be used to determine the first component to be used in the plug-in. Since the methods are basically similar, they will not be described in detail.
[0095] S12, after identifying the first component as an unregistered component, obtaining a keyword corresponding to the first component; wherein the keyword is a field representing a function implemented by the component.
[0096] In an embodiment of the present application, after determining the first component to be used in the plug-in, it will be identified whether the first component is registered. To register a component is to declare the component in the configuration file of the application, such as the AndroidManifest.xml file. If the component is not registered, the application cannot recognize and execute the component. If the declaration of the component can be found in the AndroidManifest.xml file, it can be determined that the component is registered, otherwise, it can be determined that the component is not registered. In addition, it should be noted that, generally speaking, components are registered through applications, and plug-ins cannot register their internal components, that is, components encapsulated in plug-ins are not registered, and components in plug-ins cannot be recognized and executed.
[0097] In an embodiment of the present application, the keyword corresponding to the component is a manually set field, and the developer can pre-set the keyword for the component based on the function implemented by the component. When the electronic device recognizes that the first component in the plug-in is not registered, the keyword corresponding to the first component is obtained. In one implementation method, the developer can store the component identifier and the keyword corresponding to the component in a database of the electronic device. After determining the first component to be used in the plug-in, the identifier of the first component can be determined, and then the keyword corresponding to the first component can be obtained from the database based on the identifier of the first component.
[0098] S13, based on the correspondence between the keyword and the proxy component, determining a first proxy component corresponding to the first component, wherein the first proxy component is registered through an application program, and the keyword and the proxy component correspond through an index.
[0099] In the embodiment of the present application, the proxy component is a component that has been registered by the application (host). The application can declare the proxy component in a configuration file such as the AndroidManifest.xml file when the plug-in starts running, or it can declare the proxy component in the AndroidManifest.xml file in advance.
[0100] When an application registers a proxy component, it declares the component in the AndroidManifest.xml file of the application. During the declaration process, the index of the proxy component is declared. The index is the unique identifier of the component, and the application can identify the proxy component through the index. The index consists of the package name of the application and the keyword corresponding to the proxy component. The first proxy component is a proxy component corresponding to the first component, and the function implemented by the first component to be used in the plug-in is the same as the function implemented by the first proxy component, that is, the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component. Through the index of the proxy component, the keyword corresponding to the component in the plug-in corresponds to the proxy component. Through the correspondence between the keyword of the component in the plug-in and the proxy component, the electronic device determines the first proxy component corresponding to the first component based on the keyword corresponding to the first component obtained.
[0101] For example, the keyword corresponding to the first component obtained by the electronic device is UseIDprovider. There are two proxy components in the application. The index of the first proxy component is qiyi.UseIDprovider, and the index of the second proxy component is qiyi.PlayRecordprovider. By querying the indexes of the two proxy components, it can be determined that the first proxy component of the first component is the first proxy component.
[0102] S14, based on the use request, obtaining a first operation request, wherein the first operation request carries an operation to be performed by the first component.
[0103] In the embodiment of the present application, the use request is a request issued by the user for his needs, and the component performs some underlying logical operations, such as adding, deleting, modifying and checking the database, and cannot directly execute the use request. Therefore, it is necessary to convert the use request into an operation request that the component can execute. The first operation request obtained based on the use request carries the operation to be executed by the component. After receiving the operation request, the component executes the operation corresponding to the operation request.
[0104] In one embodiment, the above step S14 may include:
[0105] S141, determining the required keywords of the usage request.
[0106] In an embodiment of the present application, the electronic device can determine the required keywords of the use request. In one implementation, all fields in the use request can be used as the required keywords. In one implementation, a keyword thesaurus can be set in advance according to the use request that may appear, and after receiving the use request, the use request is identified, and the use request is fuzzy matched according to the keyword thesaurus to determine the required keywords.
[0107] S142: Determine a first operation request corresponding to the use request based on the correspondence between the demand keyword and the operation request.
[0108] In the embodiment of the present application, a correspondence between a demand keyword and an operation request is pre-set. And in the subsequent execution process, the correspondence can be continuously improved and modified. After the electronic device determines the demand keyword of the use request, it determines the first operation request corresponding to the use request according to the correspondence between the demand keyword and the operation request.
[0109] S15, sending a first operation request to the first proxy component, and the first proxy component calls the first component, so that the first component performs the operation corresponding to the first operation request in the plug-in.
[0110] In the embodiment of the present application, after determining the first proxy component of the first component to be used in the plug-in, the electronic device sends an operation request to the first proxy component.
[0111] In the embodiment of the present application, the operation request is not sent directly to the first component in the plug-in because the first component in the plug-in is not registered, so the application cannot recognize the first component in the plug-in. Therefore, the electronic device needs to send an operation request to the first proxy component corresponding to the first component, and then the first proxy component can call back the operation instruction to the first component in the plug-in through the interface provided by the software service company, so that the first component executes the operation corresponding to the first operation request in the plug-in and completes the operation on the data in the plug-in.
[0112] In one embodiment, when the electronic device determines that the component type to be used in the plug-in is ContentProvider, and the first component to be used is the first ContentProvider, when the first operation request is to add data, the operation corresponding to the operation request is to add data to the first ContentProvider.
[0113] Take the use request for registering an account as an example. When the use request is to register an account, registering an account means adding new user data from the database that stores user account data. That is, the use request for registering an account is to provide data services to users. It can be determined that the component type to be used in the plug-in is ContentProvider. The keyword determined based on the use request for registering an account is account. Then, according to the correspondence between the keyword and the component, the first component to be used in the plug-in is determined to be the first Contentprovider that provides user account data. From the use request for registering an account, it is determined that the required keyword is registration. Then, according to the correspondence between the required keyword and the operation request, it is determined that the first operation request corresponding to the use request for registering an account is to add data. Then the operation corresponding to the operation request is to add data to the first ContentProvider, that is, to add the user's newly registered account data to the first ContentProvider to complete the registration of the account.
[0114] In one embodiment, when the electronic device determines that the component type to be used in the plug-in is ContentProvider, and the first component to be used is the first ContentProvider, when the first operation request is to delete data, the operation corresponding to the operation request is to delete data from the first ContentProvider.
[0115] Take the use request of logout as an example. When the use request is logout, logout means deleting the specified user data from the database that stores the user account data. That is, the logout request is to provide data services to the user. It can be determined that the component type to be used in the plug-in is ContentProvider. The keyword determined based on the logout request is account. Then, according to the correspondence between the keyword and the component, the first component to be used in the plug-in is determined to be the first Contentprovider that provides user account data. From the account registration request, the required keyword is determined to be logout. Then, according to the correspondence between the required keyword and the operation request, it is determined that the first operation request corresponding to the account registration request is to delete data. Then the operation corresponding to the operation request is to delete data from the first ContentProvider, that is, to delete the account data of the specified user from the first ContentProvider, and complete the logout.
[0116] In one embodiment, when the electronic device determines that the component type to be used in the plug-in is ContentProvider, and the first component to be used is the first ContentProvider, when the first operation request is to modify data, the operation corresponding to the operation request is to modify data in the first ContentProvider.
[0117] Take the use request of modifying the account password as an example for explanation. When the use request is to modify the account password, modifying the account password means modifying the specified user account data from the database that stores the user account data, that is, the use request of modifying the account password is to provide data services to the user. It can be determined that the component type to be used in the plug-in is ContentProvider, and the keyword determined based on the use request of modifying the account password is account. Then, according to the correspondence between the keyword and the component, the first component to be used in the plug-in is determined to be the first Contentprovider that provides user account data. From the use request of registering the account, the required keyword is determined to be modify, and then according to the correspondence between the required keyword and the operation request, it is determined that the first operation request corresponding to the use request of modifying the account password is to modify data. Then the operation corresponding to the operation request is to modify the data from the first ContentProvider, that is, to modify the user account data specified in the first ContentProvider to complete the modification of the account password.
[0118] In one embodiment, when the electronic device determines that the component type to be used in the plug-in is ContentProvider, and the first component to be used is the first ContentProvider, when the first operation request is to query data, the operation corresponding to the operation request is to query data from the first ContentProvider.
[0119] Take the use request of querying video play records as an example for explanation. When the use request is to query video play records, querying video play records means querying the specified video play records from the database that stores video play record data, that is, the use request of querying video play records is to provide data services to users. It can be determined that the component type to be used in the plug-in is ContentProvider, and the keyword determined based on the use request of querying video play records is play record, and then according to the correspondence between keywords and components, the first component to be used in the plug-in is determined to be the first Contentprovider that provides user play record data. From the use request of querying video play records, the required keyword is determined to be query, and then according to the correspondence between the required keyword and the operation request, it is determined that the first operation request corresponding to the use request of querying video play records is query data, then the operation corresponding to the operation request is to query data from the first ContentProvider, that is, to query the specified user video play record data from the first ContentProvider, and complete the query of video play records.
[0120] In the technical solution provided by the embodiment of the present application, a component is encapsulated in the plug-in, and the application program is allowed to register the proxy component. After receiving the user's use request, the electronic device determines the component type to be used in the plug-in and the first component to be used based on the use request. After identifying that the first component is an unregistered component, the keyword corresponding to the first component is obtained, and then the first proxy component of the first component is determined based on the correspondence between the keyword and the proxy component. After obtaining the first operation request based on the use request, the operation request is sent to the first proxy component, and then the first component in the plug-in is called by the first proxy component, so that the first component performs the operation corresponding to the first operation request in the plug-in. Because the first proxy component is registered, and the first component to be used in the plug-in is not registered, the application program can identify the first proxy component, but cannot identify the first component. Therefore, after obtaining the operation request based on the use request, the operation request is sent to the first proxy component, and then the first proxy component calls the operation request back to the first component, and the first component can perform the operation corresponding to the operation request in the plug-in, thereby completing the operation on the data in the plug-in.
[0121] based on Figure 1 The embodiment shown in the figure, the embodiment of the present invention also provides a method for operating the data in the plug-in, such as Figure 2 As shown, the method may include the following steps S21-S27, steps S21-S22 are the same as the above steps S11-S12, steps S26-S27 are the same as the above steps S14-S15, and steps S23-S25 are an implementable way of the above step S13.
[0122] S23, obtaining an index list of proxy components.
[0123] In the embodiment of the present application, the proxy component is registered through the application. When registering the proxy component, the component will be declared in the AndroidManifest.xml file of the application. During the declaration process, the index of the proxy component will be declared. The index is the unique identifier of the component, and the application can identify the component through the index. The index generally consists of the package name and keywords of the application. The application will declare multiple proxy components, put the indexes of multiple proxy components in a list to obtain the index list of the proxy components, and then the electronic device obtains the index list of the proxy components.
[0124] S24, obtaining the package name of the application, and mapping the index information of the first proxy component from the index list according to the keyword corresponding to the first component and the package name of the application.
[0125] S25, determining the first proxy component corresponding to the first component based on the index information of the first proxy component; wherein the index information includes the package name of the application and the keyword corresponding to the proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component.
[0126] In the embodiment of the present application, the package name of the application is the identifier of the application, and the package name of the application is unique. The application is installed on the electronic device, so the electronic device can obtain the package name of the application. Here, the obtained package name of the application is the package name of the application running the plug-in. The first component to be used in the plug-in has not been registered, so there is no declared index, but because the first component and the first proxy component implement the same function, the corresponding keywords of the two are the same, therefore, the electronic device maps the index information of the first proxy component from the index list of the proxy component according to the keyword corresponding to the first component and the package name of the application, and then determines the first proxy component according to the index information of the first proxy component.
[0127] For example, the keyword of the first component obtained by the electronic device is UseIDprovider, and there are two proxy components registered through the application. The index 1 of the first proxy component is qiyi.UseIDprovider, and the index 2 of the second proxy component is qiyi.PlayRecordprovider, where qiyi is the package name of the application, and UseIDprovider and PlayRecordprovider are both keywords corresponding to the proxy components. The index list of the proxy component consists of index 1 and index 2. After the electronic device obtains the package name qiyi of the application, it maps the first proxy component index information corresponding to the first component from the index list as index 1 according to the package name of the application and the keyword corresponding to the first component, and then determines the first proxy component according to index 1.
[0128] In the technical solution provided by the embodiment of the present application, a component is encapsulated in the plug-in, and the application program is allowed to register the proxy component. After receiving the user's use request, the electronic device determines the component type to be used in the plug-in and the first component to be used based on the use request. After identifying that the first component is an unregistered component, the keyword corresponding to the first component is obtained, and then the first proxy component of the first component is determined based on the correspondence between the keyword and the proxy component. After obtaining the first operation request based on the use request, the first operation request is sent to the first proxy component, and then the first component in the plug-in is called by the first proxy component, so that the first component performs the operation corresponding to the first operation request in the plug-in. Because the first proxy component is registered, and the first component to be used in the plug-in is not registered, the application program can identify the first proxy component, but cannot identify the first component. Therefore, after obtaining the operation request based on the use request, the operation request is sent to the first proxy component, and then the first proxy component calls the operation request back to the first component, and the first component can perform the operation corresponding to the operation request in the plug-in, thereby completing the operation on the data in the plug-in.
[0129] Combine the following Figure 3 A signaling diagram of a method for operating data in a plug-in is shown to illustrate the technical solution provided in an embodiment of the present application.
[0130] Step S31: The plug-in sends an operation request to the first proxy component.
[0131] In the embodiment of the present application, after the electronic device receives the use request, the plug-in installed in the application on the electronic device also obtains the use request, and the plug-in determines the component type to be used in the plug-in and the first component to be used based on the use request. After the plug-in determines the first component to be used, it obtains the keyword corresponding to the first component, and determines the first proxy component corresponding to the first component based on the correspondence between the keyword and the proxy component. The plug-in then obtains the operation request based on the use request and sends the operation request to the first proxy component.
[0132] Step S32: the first proxy component calls back the operation request to the first component in the plug-in based on the external interface.
[0133] In the embodiment of the present application, the external interface is provided by the service company, and the first proxy component calls back the operation request to the first component in the plug-in through the external interface.
[0134] Step S33: the first component in the plug-in executes the operation corresponding to the operation request in the plug-in.
[0135] In the embodiment of the present application, after the plug-in receives the operation request sent by the first proxy component, the first component in the plug-in can execute the operation corresponding to the first operation request to implement the operation on the data in the plug-in.
[0136] This process is the same as the method for operating the data in the plug-in in the above embodiment, so it will not be described in detail.
[0137] For ease of understanding, the method for operating data in a plug-in provided in an embodiment of the present application is described below in conjunction with a specific application scenario.
[0138] In the application scenario of Internet of Vehicles, various functions can be realized by installing plug-ins on the vehicle-mounted device. For example, you can install the plug-in provided by iQiyi on the vehicle-mounted device to play videos. The underlying layer of the plug-in uses many iQiyi basic databases, including the database for storing account data and the database for saving playback records. The ContentProvider type component is encapsulated inside the plug-in. Through ContentProvider, the data in these databases can be shared with the application, and database operations such as adding, deleting, modifying and querying the data in the database can be provided.
[0139] However, the plug-in cannot register the ContentProvider component, resulting in the inability to find the registered ContentProvider for database operations such as logging in to an account and querying playback records. Therefore, in the embodiment of the present application, the application (host) that installs the plug-in declares a proxy component in the configuration file AndroidManifest, and the index of this proxy component consists of the package name of the application and the keyword corresponding to the proxy component. After the vehicle-mounted device receives the user's use request, the plug-in can determine that the ContentProvider to be used in the plug-in is ContentProvider1 that provides playback record data based on the use request, and then determine the proxy component of ContentProvider1 based on the keyword of ContentProvider1 and the index of the proxy component. The database operations to be performed in the plug-in will be called back in the proxy ContentProvider, and the proxy ContentProvider will call back the specific implementation method in the plug-in through the interface provided by iQIYI. For example, a method for adding, deleting, modifying and checking a database, so as to achieve the purpose of using the database in the plug-in.
[0140] The application scenario of the method for operating the data in the plug-in provided in the embodiment of the present application is not limited to the application scenario of the Internet of Vehicles. As long as a software service company provides a plug-in to a third-party company, the method for operating the data in the plug-in provided in the embodiment of the present application can be used.
[0141] Based on the same inventive concept, according to a method for operating data in a plug-in provided in the above embodiment of the present application, correspondingly, an embodiment of the present application provides a method device for operating data in a plug-in, the device is applied to an electronic device of an Android system, and a plug-in is installed on an application of the electronic device, and its structural diagram is as shown in FIG. Figure 4 As shown, including:
[0142] A first determination module 41 is used to receive a use request, and determine the type of component to be used in the plug-in and the first component to be used based on the use request; wherein the plug-in encapsulates at least one type of component and at least one first component to be used;
[0143] A first acquisition module 42 is used to obtain a keyword corresponding to the first component after identifying that the first component is an unregistered component; wherein the keyword is a field representing a function implemented by the component;
[0144] A second determination module 43 is used to determine a first proxy component corresponding to the first component based on the correspondence between the keyword and the proxy component; wherein the first proxy component is registered through an application program, and the keyword and the proxy component correspond through an index;
[0145] A second acquisition module 44 is used to obtain a first operation request based on the use request, wherein the first operation request carries an operation to be performed by the first component;
[0146] The calling module 45 is used to send a first operation request to the first proxy component, and the first proxy component calls the first component so that the first component performs the operation corresponding to the first operation request in the plug-in.
[0147] Optionally, the first determining module 41 may be specifically configured to:
[0148] If the usage request is based on providing data services, it is determined that the component type to be used is a content provider ContentProvider;
[0149] If the usage request is to provide a broadcast service, the component type to be used is determined to be BroadCastReceiver;
[0150] If the usage request is to provide background services, the component type to be used is determined to be Service;
[0151] If the usage request is to provide an interface service, it is determined that the component type to be used is Activity.
[0152] Optionally, the first determining module 41 may also be used to:
[0153] A keyword is obtained from the use request, and a first component to be used is obtained according to a correspondence between the keyword and the component.
[0154] Optionally, the second determining module 43 may be specifically configured to:
[0155] Get the index list of proxy components;
[0156] Obtaining a package name of the application, and mapping index information of the first proxy component from the index list according to the keyword corresponding to the first component and the package name of the application;
[0157] Determining, based on the index information of the first proxy component, a first proxy component corresponding to the first component;
[0158] The index information includes the package name of the application and the keyword corresponding to the proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component.
[0159] Optionally, the second determining module 43 may be specifically configured to:
[0160] Get the index list of proxy components;
[0161] Obtaining a package name of the application, and mapping index information of the first proxy component from the index list according to the keyword corresponding to the first component and the package name of the application;
[0162] Determining, based on the index information of the first proxy component, a first proxy component corresponding to the first component;
[0163] The index information includes the package name of the application and the keyword corresponding to the proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component.
[0164] Optionally, the second acquisition module 44 is specifically configured to:
[0165] Extracting the required keywords of the use request;
[0166] Based on the mapping relationship between the requirement keyword and the operation request, a first operation request corresponding to the use request is determined.
[0167] Optionally, when it is determined that the type of the component to be used is a content provider ContentProvider and the first component to be used is a first ContentProvider;
[0168] The first operation request is to add data, and the operation corresponding to the operation request is to add data to the first ContentProvider;
[0169] The first operation request is to delete data, and the operation corresponding to the operation request is to query data from the first ContentProvider;
[0170] The first operation request is to modify data, and the operation corresponding to the operation request is to modify data from the first ContentProvider;
[0171] The first operation request is to query data, and the operation corresponding to the operation request is to query data from the first ContentProvider.
[0172] In the technical solution provided by the embodiment of the present application, a component is encapsulated in the plug-in, and the application program is allowed to register the proxy component. After receiving the user's use request, the electronic device determines the component type to be used in the plug-in and the first component to be used based on the use request. After identifying that the first component is an unregistered component, the keyword corresponding to the first component is obtained, and then the first proxy component of the first component is determined based on the correspondence between the keyword and the proxy component. After obtaining the first operation request based on the use request, the first operation request is sent to the first proxy component, and then the first component in the plug-in is called by the first proxy component, so that the first component performs the operation corresponding to the first operation request in the plug-in. Because the first proxy component is registered, and the first component to be used in the plug-in is not registered, the application program can identify the first proxy component, but cannot identify the first component. Therefore, after obtaining the operation request based on the use request, the operation request is sent to the first proxy component, and then the first proxy component calls the operation request back to the first component, and the first component can perform the operation corresponding to the operation request in the plug-in, thereby completing the operation on the data in the plug-in.
[0173] The present application also provides an electronic device, such as Figure 5 As shown, it includes a processor 51, a communication interface 52, a memory 53 and a communication bus 54, wherein the processor 51, the communication interface 52, and the memory 53 communicate with each other through the communication bus 54.
[0174] A memory 53, for storing computer programs;
[0175] The processor 51 is used to implement any of the above-mentioned methods for operating the data in the plug-in when executing the program stored in the memory 53.
[0176] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0177] The communication interface is used for communication between the above terminal and other devices.
[0178] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0179] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0180] In another embodiment provided by the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the method for operating data in a plug-in described in any of the above embodiments is implemented.
[0181] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the method for operating data in a plug-in as described in any of the above embodiments.
[0182] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0183] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0184] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, electronic device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are 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.
[0185] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for operating data in a plug-in, It is characterized in that An electronic device applied to an Android system, wherein a plug-in is installed on an application of the electronic device, and the plug-in is a plug-in provided by a software service company, and the method comprises: receiving a use request, and determining the type of component to be used in the plug-in and the first component to be used based on the use request; wherein the plug-in encapsulates at least one type of component and at least one first component to be used, and the use request is a request issued by a user according to his needs; After identifying the first component as an unregistered component, obtaining a keyword corresponding to the first component; wherein the keyword is a field representing a function implemented by the component; Based on the correspondence between the keyword and the proxy component, determine a first proxy component corresponding to the first component; wherein the first proxy component is registered through the application, the keyword and the proxy component correspond through an index, the function implemented by the first component is the same as the function implemented by the first proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component; Based on the use request, obtaining a first operation request, wherein the first operation request carries an operation to be performed by the first component; The first operation request is sent to the first proxy component, and the first proxy component calls the first component, so that the first component performs the operation corresponding to the first operation request in the plug-in.
2. The method according to claim 1, It is characterized in that The step of determining the type of component to be used based on the use request comprises: If the usage request is to provide a data service, determining that the component type to be used is a content provider ContentProvider; If the use request is to provide a broadcast service, determining that the component type to be used is a broadcast receiver BroadCastReceiver; If the usage request is to provide a background service, determining that the type of the component to be used is a service; If the use request is to provide an interface service, it is determined that the type of the component to be used is an activity.
3. The method according to claim 1, It is characterized in that The step of determining the first component to be used based on the use request comprises: A keyword is determined according to the use request, and a first component to be used is determined according to a correspondence between the keyword and the component.
4. The method according to claim 1, It is characterized in that The step of obtaining a first proxy component corresponding to the first component based on the correspondence between the keyword and the proxy component includes: Get the index list of proxy components; Obtaining a package name of the application, and mapping index information of the first proxy component from the index list according to the keyword corresponding to the first component and the package name of the application; Determining, based on the index information of the first proxy component, a first proxy component corresponding to the first component; The index information includes the package name of the application and the keyword corresponding to the proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component.
5. The method according to claim 1, It is characterized in that The step of obtaining a first operation request based on the use request includes: Determine the required keywords of the use request; Based on the correspondence between the requirement keyword and the operation request, a first operation request corresponding to the use request is determined.
6. The method according to claim 1, It is characterized in that When it is determined that the component type to be used is a content provider ContentProvider and the first component to be used is a first ContentProvider; The first operation request is to add data, and the operation corresponding to the operation request is to add data to the first ContentProvider; The first operation request is to delete data, and the operation corresponding to the operation request is to delete data from the first ContentProvider; The first operation request is to modify data, and the operation corresponding to the operation request is to modify data from the first ContentProvider; The first operation request is to query data, and the operation corresponding to the operation request is to query data from the first ContentProvider.
7. A device for operating data in a plug-in, It is characterized in that An electronic device applied to an Android system, wherein a plug-in is installed on an application of the electronic device, and the plug-in is a plug-in provided by a software service company, and the device comprises: A first determination module is used to receive a use request, and determine the type of component to be used in the plug-in and the first component to be used based on the use request; wherein the plug-in encapsulates at least one type of component and at least one first component to be used, and the use request is a request issued by a user according to his needs; A first acquisition module, configured to acquire a keyword corresponding to the first component after identifying that the first component is an unregistered component; wherein the keyword is a field representing a function implemented by the component; a second determination module, configured to determine a first proxy component corresponding to the first component based on a correspondence between the keyword and the proxy component; wherein the first proxy component is registered through the application, the keyword and the proxy component correspond through an index, the function implemented by the first component is the same as the function implemented by the first proxy component, and the keyword corresponding to the first component is the same as the keyword corresponding to the first proxy component; A second acquisition module, configured to obtain a first operation request based on the use request, wherein the first operation request carries an operation to be performed by the first component; The calling module is used to send the first operation request to the first proxy component, and the first proxy component calls the first component so that the first component performs the operation corresponding to the first operation request in the plug-in.
8. The device according to claim 7, It is characterized in that The first determining module is specifically configured to: If the usage request is to provide a data service, determining that the component type to be used is a content provider ContentProvider; If the use request is to provide a broadcast service, determining that the component type to be used is a BroadCastReceiver; If the usage request is to provide a background service, determining that the type of the component to be used is a service; If the use request is to provide an interface service, it is determined that the type of the component to be used is an activity.
9. An electronic device, It is characterized in that It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Interpolation method and system for Android application programs
CN108664265A
Component scheduling method and device, equipment and storage medium
CN110389791A
