CN108804181B - Control content obtaining method and device and storage medium - Google Patents

Control content obtaining method and device and storage medium Download PDF

Info

Publication number
CN108804181B
CN108804181B CN201810520111.3A CN201810520111A CN108804181B CN 108804181 B CN108804181 B CN 108804181B CN 201810520111 A CN201810520111 A CN 201810520111A CN 108804181 B CN108804181 B CN 108804181B
Authority
CN
China
Prior art keywords
field
extraction rule
application program
control content
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810520111.3A
Other languages
Chinese (zh)
Other versions
CN108804181A (en
Inventor
常群
张鹏
张艺弘
朱英涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201810520111.3A priority Critical patent/CN108804181B/en
Publication of CN108804181A publication Critical patent/CN108804181A/en
Application granted granted Critical
Publication of CN108804181B publication Critical patent/CN108804181B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The present disclosure provides a control content obtaining method, device and storage medium, relating to the field of computer programs, wherein the method is applied to a terminal installed with an operating system and an application program, and comprises the following steps: acquiring an extraction rule corresponding to the first version information, wherein the extraction rule is used for extracting control content of a target control in an application program; when second version information of the application program in the terminal is different from the first version information, determining a prediction extraction rule of the control content according to the extraction rule; and extracting the control content of the target control according to the prediction extraction rule. The method and the device can solve the problem that the control content of the target control cannot be smoothly extracted according to the historical extraction rule when the target control in the application program is updated; the effects of generating the prediction extraction rule based on the history extraction rule and effectively extracting the control content of the target control according to the prediction extraction rule are achieved.

Description

Control content obtaining method and device and storage medium
Technical Field
The present disclosure relates to the field of computer programs, and in particular, to a method and an apparatus for acquiring control content, and a storage medium.
Background
In the running process of the application program, the operating system sometimes needs to acquire content information of a certain control in the user interface. Since applications are updated frequently, there is a need for a policy that can accurately capture content information in a control, including but not limited to text and/or pictures.
In the related technology, for most of the controls conforming to the android programming specification, an operating system obtains the control content in the controls according to a preset function interface; however, for the custom control, it is difficult for the operating system to acquire the control content in the control.
Disclosure of Invention
The disclosure provides a control content obtaining method, a control content obtaining device and a storage medium, which can solve the problem that control content in a control is difficult to obtain in a user-defined control. The technical scheme is as follows:
according to a first aspect of the present disclosure, a method for acquiring control content is provided, the method including:
acquiring an extraction rule corresponding to the first version information, wherein the extraction rule is used for extracting control content of a target control in an application program;
when second version information of the application program in the terminal is different from the first version information, determining a prediction extraction rule of the control content according to the extraction rule;
and extracting the control content of the target control according to the prediction extraction rule.
In an optional embodiment, the determining a predicted extraction rule of the control content according to the extraction rule includes:
acquiring the field name and the field type of the characteristic field from the extraction rule;
and determining the prediction extraction rule according to the field name and the field type.
In an optional embodiment, the extracting the control content of the target control according to the prediction extraction rule includes:
determining whether a field conforming to the field name and the field type exists in the target control;
when a field that conforms to the field name and the field type exists, extracting a field value of the field as the control content.
In an optional embodiment, the determining a predicted extraction rule of the control content according to the extraction rule includes:
acquiring a field type and a field index of the characteristic field, wherein the field index is used for indicating an arrangement position of the characteristic field in a subfield of a control class name of the target control;
and determining the prediction extraction rule according to the field type and the field index.
In an optional embodiment, the extracting the control content of the target control according to the prediction extraction rule includes:
determining whether a field conforming to the field type and the field index exists in the target control;
when a field conforming to the field type and the field index exists, extracting a field value of the field as the control content.
In an optional embodiment, the method further comprises:
and when the application program is started and the second version information is different from the first version information, sending an acquisition request to a server, wherein the acquisition request is used for acquiring the extraction rule corresponding to the second version information.
In an optional embodiment, the method further comprises:
sending an acquisition request to a server after a timer expires, wherein the acquisition request is used for acquiring an extraction rule corresponding to the second version information, and the timer is set according to a periodic interval;
reducing the periodic interval by a preset time length to obtain an updated periodic interval;
resetting the timer according to the updated periodic interval.
In an optional embodiment, the obtaining the updated periodic interval after reducing the periodic interval by the preset time length includes:
after the period interval is reduced by a preset time length, detecting whether the reduced period interval is smaller than a minimum threshold value;
determining the reduced periodic interval as the updated periodic interval when the reduced periodic interval is not less than the minimum threshold.
In an optional embodiment, the obtaining the updated periodic interval after reducing the periodic interval by the preset time length includes:
after the period interval is reduced by a preset time length, detecting whether the reduced period interval is smaller than a minimum threshold value;
determining the minimum threshold as the updated periodic interval when the reduced periodic interval is less than the minimum threshold.
According to a second aspect of the present disclosure, there is provided a control content acquiring apparatus, the apparatus including:
the acquisition module is configured to acquire an extraction rule corresponding to the first version information, and the extraction rule is used for extracting control content of a target control in an application program;
a determining module configured to determine a predicted extraction rule of the control content according to the extraction rule when second version information of the application program in the terminal is different from the first version information;
and the extraction module is configured to extract the control content of the target control according to the prediction extraction rule.
In an optional embodiment, the determining module includes:
a first obtaining submodule configured to obtain a field name and a field type of a feature field from the extraction rule;
a first determination submodule configured to determine the prediction extraction rule according to the field name and the field type.
In an optional embodiment, the extraction module includes:
a second determination submodule configured to determine whether a field conforming to the field name and the field type exists in the target control;
a first extraction sub-module configured to, when there is a field that conforms to the field name and the field type, extract a field value of the field as the control content.
In an optional embodiment, the determining module includes:
the first obtaining sub-module is configured to obtain a field type and a field index of the characteristic field, where the field index is used to indicate an arrangement position of the characteristic field in a sub-field of a control class name of the target control;
the first determination submodule is configured to determine the prediction extraction rule according to the field type and the field index.
In an optional embodiment, the extraction module includes:
the second determination submodule is configured to determine whether a field conforming to the field type and the field index exists in the target control;
the first extraction sub-module is configured to, when a field conforming to the field type and the field index exists, extract a field value of the field as the control content.
In an optional embodiment, the apparatus further comprises:
the sending module is configured to send an obtaining request to a server when the application program is started and the second version information is different from the first version information, wherein the obtaining request is used for obtaining the extraction rule corresponding to the second version information.
In an optional embodiment, the apparatus further comprises:
the sending module is configured to send an acquisition request to a server after a timer expires, where the acquisition request is used to acquire an extraction rule corresponding to the second version information, and the timer is set according to a periodic interval;
the timing module is configured to reduce the periodic interval by a preset time length to obtain an updated periodic interval; resetting the timer according to the updated periodic interval.
In an optional embodiment, the timing module includes:
the detection submodule is configured to reduce the period interval by a preset time length and then detect whether the reduced period interval is smaller than a minimum threshold value;
a timing sub-module configured to determine the reduced periodic interval as the updated periodic interval when the reduced periodic interval is not less than the minimum threshold.
In an optional embodiment, the timing module includes:
the detection submodule is configured to detect whether the reduced periodic interval is smaller than a minimum threshold value after the periodic interval is reduced by a preset time length;
the timing sub-module is configured to determine the minimum threshold as the updated periodic interval when the reduced periodic interval is less than the minimum threshold.
According to a third aspect of the present disclosure, there is provided a mobile terminal comprising: a processor and a memory;
the memory has stored therein at least one instruction that is loaded and executed by the processor to implement the control content acquisition method of the first aspect.
According to a fourth aspect of the present disclosure, there is provided a computer-readable storage medium having at least one instruction stored therein, the at least one instruction being loaded and executed by a processor to implement the control content obtaining method according to the first aspect.
The beneficial effects that this disclosed embodiment can reach include at least:
when the second version information of the application program in the terminal is different from the first version information, determining a prediction extraction rule of the control content according to the extraction rule of the first version information, and extracting the control content of the target control according to the prediction extraction rule, so that the prediction extraction rule can be generated based on the historical extraction rule after the application program is updated, and the control content of the target control can be effectively extracted according to the prediction extraction rule; the method can solve the problem that the control content of the target control cannot be smoothly extracted according to the historical extraction rule when the target control in the application program is updated.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a flow chart of an information display method provided by an exemplary embodiment;
FIG. 2 is a flowchart of a control content obtaining method according to an exemplary embodiment of the present disclosure;
FIG. 3 is a flowchart of a control content acquisition method provided by another exemplary embodiment of the present disclosure;
FIG. 4 is a flowchart of a control content acquisition method provided by another exemplary embodiment of the present disclosure;
FIG. 5 is a flowchart of a control content acquisition method provided by another exemplary embodiment of the present disclosure;
FIG. 6 is a flowchart of a control content acquisition method provided by another exemplary embodiment of the present disclosure;
FIG. 7 is a flowchart of a control content acquisition method provided by another exemplary embodiment of the present disclosure;
FIG. 8 is a flowchart of a control content acquisition method provided by another exemplary embodiment of the present disclosure;
FIG. 9 is a flowchart of a control content acquisition method provided by another exemplary embodiment of the present disclosure;
FIG. 10 is a diagram of a widget content obtaining device according to an exemplary embodiment of the present disclosure;
fig. 11 is a block diagram of a widget content obtaining apparatus according to an exemplary embodiment of the present disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
The embodiments of the present application relate to several technical noun profiles:
reflection: in the running state, for any one class, all the properties and methods of the class can be known; any method and property can be called for any object. The present disclosure uses the function of judging the member variables and methods of any one class at run-time in the reflection mechanism.
Obfuscation: in the Android development field, before application release, code needs to be obfuscated, so that a field with high sequence and high readability is converted into a field with low sequence and poor readability after compiling. The main purpose of the obfuscation process is decompilation. The same field may be confused into two disparate strings in two different versions of an application.
The operating system may need to determine the control content of a target control in an application in some scenarios. For example, the operating system provides a quick search function, which is simply referred to as a pass gate function, and the quick search function is used for displaying search result information related to text content in an application program in a superimposed manner at the bottom of a screen by the operating system when the text content is pressed for a long time.
In order to better understand the technical solution of the present disclosure, the fast search function in the related art will be further described below with reference to fig. 1.
Fig. 1 is a flowchart of an information display method provided by an exemplary embodiment. The present embodiment exemplifies that the information display method is applied to a terminal in which an operating system and at least one application program are installed. The method includes, but is not limited to, the steps of:
in step 101, displaying a user interface of an application program, wherein the user interface comprises at least one UI control;
the application program installed in the terminal comprises: native applications provided by the operating system, and/or third party applications installed by the user themselves. In this embodiment, the application refers to any application installed in the operating system or an application belonging to a preset list, where the preset list stores context information that meets the capture condition and/or context information that does not meet the capture condition.
For an application, multiple user interfaces are typically included. The user interface of the application program running in the foreground in the terminal can be preferentially displayed in the display screen of the terminal.
The user interface comprises at least one UI control, and each UI control is a component of the user interface, or each UI control can be regarded as one UI control. UI controls include, but are not limited to: at least one of a text control, a text editing control, an image control, a dialog control, and a button control.
In step 102, receiving a selection operation on a user interface;
the selection operation includes, but is not limited to: at least one of a long press operation, a pressure touch operation, a multi-click operation, a floating touch operation, a double-finger touch operation, and a finger joint double-click operation. The disclosed embodiments are illustrated with the selection operation being a long press operation.
The long-press operation is an operation that the duration of pressing the touch screen exceeds a first duration; the pressure touch operation is an operation that the pressing pressure exceeds a preset pressure value; the multi-click operation is an operation in which the number of clicks exceeds a predetermined number within a predetermined time; the suspension touch operation is an operation with the time length of suspending above the touch screen exceeding a second time length; the double-finger touch operation is an operation that a user clicks a touch screen simultaneously by using double fingers; the finger joint double-click operation is an operation in which the user taps the touch screen using a finger joint.
In step 103, a target control in the at least one UI control is selected according to the selection operation.
The target control is one (without excluding the possibility of two or more) of at least one UI control, which typically includes text and/or pictures therein. The target control has content information, and when the target control comprises text, the content information is characters; when the target control comprises a picture, the content information is picture data or characters in the picture.
In step 104, search result information is displayed by the operating system in an overlapping manner on the local area of the user interface, wherein the search result information is corresponding to the target control.
And the operating system extracts the content information in the target control according to the configuration information and searches locally or on the network according to the content information to obtain search result information. The configuration information stores the extraction rule of the target control. Optionally, the extraction rule includes: and the corresponding relation between the control class name of the target control and the extraction rule of the target control. When the extraction rule is characterized by the feature field and the type of the feature field, the extraction rule comprises: and the corresponding relation among the control class name, the characteristic field and the type of the characteristic field of the target control.
The terminal displays the search result information in a local area of the user interface in an overlapping mode through the operating system, the number of the search result information is n, at least two pieces of search result information are different, and n is a positive integer. Alternatively, n ≧ 2.
Optionally, the search result information includes: at least one of person name information, place name information, encyclopedia introduction information, navigation information, travel information, user comment information, shopping information, and website information.
Optionally, the search result information is from at least two different websites.
Optionally, the local area is any one of a bottom area, a top area, a left border area, a right border area, and adjacent areas of the target control, and the operation coordinate of the selection operation is adjacent to the adjacent areas. The local area is a portion of the entire display area of the display screen, typically an area of the entire display area that does not obscure the target control. Alternatively, if the display screen includes a primary screen and a secondary screen, the local area is the area where the secondary screen is located.
Illustratively, when the local area is a bottom area of the display screen, the coverage of the local area on the user interface, particularly the coverage of the target control, can be reduced as much as possible. Meanwhile, compared with the scheme that the local area is the top area, the search result information is displayed in the bottom area, and the situation that the user confuses the search result information with the conventionally displayed notification message in the top area of the display screen can be avoided.
When the local area is the area adjacent to the target control, the user can conveniently match and read the search result information with the target control, and the user is not required to switch the visual focus back and forth.
When the local area is an area adjacent to the selection operation position, the user can conveniently perform the next operation on the search result information, for example, after the selection operation, the user can perform sliding switching between different search result information by adopting a sliding operation nearby.
Taking the local area as the bottom area as an example, as can be known from fig. 2, an object control 22 in which a user is interested exists in the user interface 21, the object control 22 includes text or pictures, when the user presses the object control 22 for a long time, the terminal displays n pieces of search result information 23 in the bottom area, and the bottom area is an area adjacent to the bottom edge of the display area. Since the search result information 23 may be plural and limited by the size of the display area, the terminal may display only a part of the search result information 23, for example, only the search result information 1 and the search result information 2.
Optionally, the n pieces of search result information are search result information obtained by searching data of at least two different websites by the server, so that the high-quality content between the different websites is presented in series in a local area of the application program by the operating system, and the search result information includes: at least one of textual introduction information, a local application portal, and a web services portal. The method comprises the following steps:
when the content information in the target control includes a movie title, the search result information includes, but is not limited to: at least one of introduction information of the film and television works, grading information of the film and television works, author information of the film and television works, a subscription entry of the film and television works in a local application program or a network service, a sharing entry of the film and television works in the local application program or the network service, a collection entry of the film and television works in the local application program and a ticket purchasing entry of the film and television works in the network service;
when the content information in the target control includes a literary work name, the search result information includes, but is not limited to: the system comprises at least one of introduction information of the literary works, scoring information of the literary works, author information of the literary works, a subscription entry of the literary works in the local application program, a sharing entry of the literary works in the local application program, a collection entry of the literary works in the local application program, an experience reading entry of the literary works on the network service, and a purchase entry of the literary works on the network service.
When the content information in the target control includes persona information, the search result information includes, but is not limited to: the encyclopedia introduction information of the character, a social network service homepage of the character on a network service, the latest news dynamics of the character on the network service, a dynamic subscription entrance of the character on the network service, a sharing entrance of the character on a local application program or the network service, and a collection entrance of the character on the local application program or the network service.
When the content information in the target control includes location information, the search result information includes, but is not limited to: the location information comprises at least one of introduction information of the location, navigation information of the location on a local application program or a network service, map preview information of the location on the local application program or the network service, a taxi taking entrance taking the location as a destination, a sharing entrance of the location on the local application program or the network service, and a collection entrance of the location on the local application program or the network service.
When the content information in the target control includes merchant information, the search result information includes, but is not limited to: the business information comprises at least one of introduction information of the business, a social network service homepage of the business on a network service, latest news dynamics of the business on the network service, a preferential subscription entrance of the business on the network service, contact information of the business, navigation information of the business on a local application program or the network service, map preview information of the business on the local application program or the network service, a taxi taking entrance with the business as a destination, a sharing entrance of the business on the local application program or the network service, and a collection entrance of the business on the local application program or the network service.
When the content information in the target control includes merchandise information, the search result information includes, but is not limited to: the commodity information comprises at least one of introduction information of the commodity, a purchase entry of the commodity on a network service, price information of the commodity in at least one shopping channel, a preferential subscription entry of the commodity on the network service, a price reduction reminding entry of the commodity on the network service, a historical price trend viewing entry of the commodity on a local application program or the network service, a sharing entry of the commodity on the local application program or the network service, and a collection entry of the commodity on the local application program or the network service.
In the implementation process of the shortcut search function (pass gate function), the operating system needs to accurately capture content information in a triggered target control (also called UI control) on an application. Optionally, the operating system stores first configuration information, where the first configuration information includes an extraction rule for extracting a target control in the application program, and after the target control is triggered by long-time pressing, the operating system may extract content information in the target control according to the extraction rule.
However, the application program is updated continuously, and the updated application program is likely to be unable to extract the control content using the extraction rule in the first configuration information. To this end, the present disclosure is provided with the following embodiments.
Fig. 3 is a flowchart of a control content obtaining method according to an exemplary embodiment of the present disclosure. The embodiment is exemplified by applying the method to a terminal in which an operating system and at least one application program are installed. The operating system may be an Android (Android) system. The method comprises the following steps:
in step 301, an extraction rule corresponding to the first version information is obtained, where the extraction rule is used to extract a control content of a target control in an application.
The application program installed in the terminal comprises: native applications provided by the operating system, and/or third party applications installed by the user themselves. In this embodiment, the application refers to any application installed in the operating system or an application belonging to a preset list.
An application typically includes a plurality of controls. The target control is a control triggered by a triggering operation of the user, such as a control selected by a long press operation of the user. The target control in the application program can be a system control and/or a custom control, and the control content includes but is not limited to text and/or pictures.
The operating system obtains an extraction rule corresponding to first version information of the application program, wherein the first version information comprises a package name and a version number of the application program and a control class name of a target control. The extraction rule of the first version information is an extraction rule already stored in the operating system. Optionally, the extraction rule of the first version information is an extraction rule that the operating system downloaded last time.
In step 302, when the second version information of the application program in the terminal is different from the first version information, the predicted extraction rule of the control content is determined according to the extraction rule.
The operating system compares the first version information and the second version information of the application program through inquiry. And if the first version information is inconsistent with the second version information, the updating of the application program is indicated. When the application program is updated, the control content of the target control may not be successfully extracted by the stored extraction rule of the first version information.
When the first version information is inconsistent with the second version information, the operating system judges whether fields with the same field name and field type exist in the target control or not according to the field name and field type of the characteristic field in the extraction rule; if the first version information exists, the extraction rule of the first version information is still effective, and the operating system extracts the control content of the target control in the application program according to the extraction rule of the first version information; if the first version information does not exist, the extraction rule of the first version information is invalid, the operating system generates a prediction extraction rule according to the extraction rule, and extracts the control content of the target control in the application program according to the prediction extraction rule.
Optionally, the extraction rule includes a correspondence between a control class name of the target control, a field name of the characteristic field, and a field type of the characteristic field. And for the extraction rule corresponding to the control class name of the target control, the extraction rule is a rule for acquiring a corresponding field value in an application program according to the field name and the field type of the characteristic field, and the extracted field value is the control content of the target control.
Optionally, the prediction extraction rule is a rule generated according to the extraction rule and used for performing prediction extraction on the updated control content of the target control.
In step 303, the control content of the target control is extracted according to the prediction extraction rule.
And the operating system finds a corresponding field value in the target control of the application program according to the prediction extraction rule, wherein the field value is the control content of the target control.
In summary, according to the control content obtaining method provided by the present disclosure, when the second version information of the application program in the terminal is different from the first version information, the predicted extraction rule of the control content is determined according to the extraction rule of the first version information, and the control content of the target control is extracted according to the predicted extraction rule, so that the predicted extraction rule is generated based on the historical extraction rule after the application program is updated, and the control content of the target control is effectively extracted according to the predicted extraction rule; the method can solve the problem that the control content of the target control cannot be smoothly extracted according to the historical extraction rule when the target control in the application program is updated.
In an alternative embodiment based on fig. 3, there are at least two different ways of generating the above-mentioned prediction extraction rules. Fig. 4 is an explanatory view of a process of normal extraction using an extraction rule, fig. 5 is an explanatory view of a first generation manner, fig. 6 is an explanatory view of a second generation manner, and fig. 7 is an explanatory view of an embodiment in which both generation manners in fig. 5 and 6 are combined.
Fig. 4 is a flowchart of a control content obtaining method according to another exemplary embodiment of the present disclosure. The present embodiment is exemplified by an information display method applied to a terminal in which an operating system and at least one application program are installed. The method includes, but is not limited to, the steps of:
in step 401, the operating system receives a trigger operation on an application program interface.
When a user uses the terminal, the user interface of the application program can be displayed in the display screen of the terminal no matter the native application program provided by the operating system is used or the third-party application program installed by the user.
For an application, multiple user interfaces are typically included. The user interface of the application program running in the foreground in the terminal can be preferentially displayed in the display screen of the terminal. That is, the user interface in this step refers to the user interface of the application running in the foreground. Meanwhile, the embodiment of the present application is not limited to a specific type of the application program, and the application program may be any type of application program.
Taking the trigger operation as a long press operation (long click operation) as an example, the user can long press on the content of interest. The content is control content of a target control in an application. And the operating system receives a long-time pressing operation triggered by a user through the touch screen. The long press operation is used for triggering the extraction operation of the control content by the operating system on the user interface.
The target control in the application program can be a system control and/or a custom control, and the control content includes but is not limited to text and/or pictures.
In step 402, the operating system obtains an extraction rule corresponding to the first version information according to the trigger operation.
The operating system obtains an extraction rule corresponding to first version information of the application program, wherein the first version information comprises a package name and a version number of the application program and a control class name of a target control. The extraction rule of the first version information is an extraction rule already stored in the operating system. Optionally, the extraction rule of the first version information is an extraction rule that the operating system downloaded last time. Optionally, the extraction rule of the first version information includes a correspondence between control class names of the plurality of controls and the extraction rule.
The extraction rule is used for extracting the control content of the target control in the application program.
Optionally, the operating system determines the control class name of the target control according to the trigger operation, and queries an extraction rule corresponding to the control class name of the target control in a plurality of sets of extraction rules corresponding to the first version information. The extraction rule includes: the corresponding relation among the control class name, the field name of the characteristic field and the field type of the characteristic field.
In step 403, the operating system compares the first version information with the second version information to obtain a complete correspondence.
The second version information includes a current version number of an application program installed in the operating system.
And the operating system obtains that the second version information of the current application program is completely consistent with the first version information of the extraction rule by contrasting the version numbers, and the extraction rule stored in the operating system is suitable for extracting the control content of the current application program.
In step 404, the operating system obtains the field name and field type of the feature field according to the extraction rule.
Optionally, the extraction rule of the target control includes: and the corresponding relation among the control class name of the target control, the field name of the characteristic field and the field type of the characteristic field.
The operating system obtains the field name and the field type of the feature field from the extraction rule. The feature field is a field for extracting the control content of the target control from the application.
Optionally, the characteristic field includes n levels of sub-fields, each level of sub-field corresponding to a respective field type. Optionally, the feature field format is as follows:
Viewclassname:MemberPath:MemberTypePath。
wherein, the Viewclassname represents the name of the application view control class;
the MemberPath indicates a sub-field of the view control as a special field, and the sub-field may be composed of a plurality of levels of sub-fields;
the MemberTypePath indicates the type of the sub-field in the membertpath.
In one illustrative example, the feature fields of the target control are as follows:
com, test, plug, mytextview, mSetting/ybn, com, ximi, MySetting/String, wherein the characteristic field indicates that the control class name of the target control is com, ximi, test, plug, mytextview, the control class has the member variable corresponding to the mSetting, and the type of the mSetting is com, ximi, MySetting; second, there is a member variable named ybn in the mstating, and the type of ybn is String. Where mSetting is the first level subfield and ybn is the second level subfield.
In step 405, the operating system initiates a reflection call to the application program for obtaining control content of a target control in the application program, the reflection call including a field name and a field type of the feature field.
The operating system makes transmission calls to the application program, and reflection calls are a kind of information acquisition technology in Java programming. The reflection call carries parameters that include: the field name and field type of the feature field.
In step 406, the application receives the reflected call.
And the application program receives the reflection call of the operating system and acquires the field name and the field type carried in the reflection call.
In step 407, the application program obtains the corresponding field value according to the field name and the field type of the feature field.
For the ith level subfield in the n level subfields, a member variable corresponding to the ith level subfield exists in the control class name of the application program, the type of the member variable accords with the field type corresponding to the ith level subfield, i is a positive integer with the initial value of 1, and the field value corresponding to the member variable is the control content of the target control.
Optionally, the nth level subfield is used to indicate a member variable of the textual content of the target control and/or the nth level subfield includes a member variable used to indicate the image content of the target control.
In step 408, the application sends the resulting field value to the operating system.
In step 409, the operating system receives a field value, which is the control content of the target control.
In summary, according to the control content obtaining method provided by the embodiment of the present disclosure, when the first version information is the same as the second version information, the operating system extracts the control content according to the extraction rule in the first configuration information, and can effectively extract the control content in the target control.
Fig. 5 is a flowchart of a control content obtaining method according to another exemplary embodiment of the present disclosure. The present embodiment is exemplified by an information display method applied to a terminal in which an operating system and at least one application program are installed. The terminal has an operating system and at least one application installed therein. The method comprises the following steps:
in step 501, the operating system receives a trigger operation on an application program interface.
The technical details of this step can be referred to the description of step 401.
In step 502, the operating system obtains an extraction rule corresponding to the first version information according to the trigger operation.
The technical details of this step can be referred to the description of step 402.
In step 503, the operating system compares the first version information with the second version information to obtain inconsistency.
The second version information includes a current version number of an application program installed in the operating system.
And the operating system obtains that the second version information of the current application program is inconsistent with the first version information of the extraction rule by comparing the version numbers, and the application program is indicated to be updated, and the extraction rule stored in the operating system may not be suitable for the control content extraction of the current application program.
Optionally, the application program includes a plurality of function modules, and one or more of the function modules may be updated by the application program each time the version is updated. If the functional module corresponding to the target control is updated in the updating process, the extraction rule is invalid because the field corresponding to the target control is confused into other names; if the functional module corresponding to the target control is not updated in the updating process, the field corresponding to the target control is kept unchanged, and the extraction rule is still valid.
In step 504, the operating system obtains the field name and field type of the feature field according to the extraction rule.
Optionally, the extraction rule of the target control includes: and the corresponding relation among the control class name of the target control, the field name of the characteristic field and the field type of the characteristic field.
The operating system obtains the field name and the field type of the feature field from the extraction rule. The feature field is a field for extracting the control content of the target control from the application.
In step 505, the operating system initiates a reflection call to the application program to obtain control content of a target control in the application program, the reflection call including a field name and a field type of a feature field.
In step 506, the application receives the reflected call.
In step 507, the application program obtains a corresponding field value according to the field name and the field type of the feature field.
For the ith level subfield in the n level subfields, a member variable corresponding to the ith level subfield exists in the control class name of the application program, the type of the member variable accords with the field type corresponding to the ith level subfield, i is a positive integer with the initial value of 1, and the field value corresponding to the member variable is the control content of the target control.
In step 509, the application feeds back the resulting field value to the operating system.
When the application program obtains the corresponding field value, the field value is fed back to the operating system; and when the application program cannot acquire the corresponding field value, feeding back an empty message or an error message to the operating system.
In step 510, the operating system receives a field value, which is the control content of the target control.
To sum up, according to the control content obtaining method provided by the embodiment of the present disclosure, when the first version information is different from the second version information, the operating system assumes that the field in the target control is not changed, then generates the prediction extraction rule according to the extraction rule in the first configuration information, extracts the control content of the target control according to the prediction extraction rule, and can effectively extract the control content in the target control by using the historical extraction rule in a scenario where the application is updated.
Fig. 6 is a flowchart of a control content obtaining method according to another exemplary embodiment of the present disclosure. The present embodiment is exemplified by an information display method applied to a terminal in which an operating system and at least one application program are installed. The method comprises the following steps:
in step 601, the operating system receives a trigger operation on an application program interface.
The technical details of this step can be referred to the description of step 401.
In step 602, the operating system obtains an extraction rule corresponding to the first version information.
The technical details of this step can be referred to the description of step 402.
In step 603, the operating system compares the first version information with the second version information to obtain inconsistency.
The second version information includes a current version number of an application program installed in the operating system.
And the operating system obtains that the second version information of the current application program is inconsistent with the first version information of the extraction rule by comparing the version numbers, and the application program is indicated to be updated, and the extraction rule stored in the operating system may not be suitable for the control content extraction of the current application program.
Optionally, the application program includes a plurality of function modules, and one or more of the function modules may be updated by the application program each time the version is updated. If the functional module corresponding to the target control is updated in the updating process, the extraction rule is invalid because the field corresponding to the target control is confused into other names; if the functional module corresponding to the target control is not updated in the updating process, the field corresponding to the target control is kept unchanged, and the extraction rule is still valid; or, if the field name and the field index of the functional module corresponding to the target control in the updating process are not changed, the extraction rule still has reference value.
In step 604, the operating system obtains the field name and the field index of the feature field according to the extraction rule.
Optionally, the extraction rule of the target control includes: and the corresponding relation among the control class name of the target control, the field name of the characteristic field and the field type of the characteristic field.
The operating system obtains the field name and the field type of the characteristic field from the extraction rule, and obtains the characteristic index of the characteristic field according to the field name of the characteristic field. The field index is used to indicate the arrangement position of the feature field in the sub-field of the control class name of the target control.
Optionally, the characteristic field includes n levels of sub-fields, each level of sub-field corresponding to a respective field type and alignment position.
In step 605, the operating system initiates a reflection call to the application program for obtaining the control content of the target control, the reflection call including the field name and the field index of the feature field.
The reflection call is used to obtain field values in the application that have the same field name and the same field index.
In step 606, the application receives the reflected call.
In step 607, the application program obtains the corresponding field value according to the field name and the field index of the feature field.
And the application program obtains the arrangement position of the characteristic field in the subfield of the control class name of the target control according to the field index, and obtains the field value corresponding to the member variable in the position.
In step 608, the application feeds back the resulting field value to the operating system.
In step 609, the operating system receives a field value, which is the control content of the target control.
In summary, according to the control content obtaining method provided by the present disclosure, when the first version information is different from the second version information, the operating system assumes that the field name and the field index of the feature field in the target control are not changed, but that other field names and field indexes of non-feature fields may be changed, then generates the prediction extraction rule according to the extraction rule in the first configuration information, extracts the control content of the target control according to the prediction extraction rule, and can effectively extract the control content in the target control by using the historical extraction rule in a scenario where the application is updated.
Fig. 7 is a flowchart of a control content obtaining method according to another exemplary embodiment of the present disclosure. The present embodiment is exemplified by an information display method applied to a terminal in which an operating system and at least one application program are installed. The method comprises the following steps:
in step 701, the operating system receives a trigger operation on an application program interface.
The technical details of this step can be referred to the description of step 401.
In step 702, the operating system obtains an extraction rule corresponding to the first version information.
The technical details of this step can be referred to the description of step 402.
In step 703, the operating system compares the first version information with the second version information to obtain inconsistency.
The second version information includes a current version number of an application program installed in the operating system.
And the operating system obtains that the second version information of the current application program is inconsistent with the first version information of the extraction rule by comparing the version numbers, and the application program is indicated to be updated, and the extraction rule stored in the operating system may not be suitable for the control content extraction of the current application program.
Optionally, the application program includes a plurality of function modules, and one or more of the function modules may be updated by the application program each time the version is updated. If the functional module corresponding to the target control is updated in the updating process, the extraction rule is invalid because the field corresponding to the target control is confused into other names; if the functional module corresponding to the target control is not updated in the updating process, the field corresponding to the target control is kept unchanged, and the extraction rule is still valid; or, if the field name and the field index of the functional module corresponding to the target control in the updating process are not changed, the extraction rule still has reference value.
In step 704, the operating system obtains the field name and field type of the feature field according to the extraction rule.
Optionally, the extraction rule of the target control includes: and the corresponding relation among the control class name of the target control, the field name of the characteristic field and the field type of the characteristic field.
The operating system obtains the field name and the field type of the feature field from the extraction rule. The feature field is a field for extracting the control content of the target control from the application.
In step 705, the operating system initiates a reflection call to the application program to obtain control content of a target control in the application program, the reflection call including a field name and a field type of the feature field.
In step 706, the application receives the reflected call.
In step 707, the application program obtains a corresponding field value according to the field name and the field type of the feature field.
And the application program acquires the corresponding field value according to the field name and the field type of the characteristic field.
For an ith level subfield in the n level subfields, detecting whether a member variable corresponding to the ith level subfield exists in a control class name of an application program, wherein the type of the member variable accords with a field type corresponding to the ith level subfield, and i is a positive integer with an initial value of 1; and when the member variable does not exist or exists but conforms to the field type, determining that the same field as the characteristic field does not exist in the application program.
In step 708, the application sends feedback information to the operating system that no field values exist.
Because the application program update will re-confuse the program code, and the same field may be confused into two incompletely identical character strings in two different versions of the application program, the field type of the feature field in the second version information corresponding to the first version information may be changed, and the field name and the field type of the feature field in the extraction rule obtained according to the first version information cannot obtain the corresponding field value.
In step 709, the operating system obtains the field name and the field index of the feature field according to the extraction rule.
The operating system obtains the field name and the field type of the characteristic field from the extraction rule, and obtains the characteristic index of the characteristic field according to the field name of the characteristic field. The field index is used to indicate the arrangement position of the feature field in the sub-field of the control class name of the target control.
Optionally, the characteristic field includes n levels of sub-fields, each level of sub-field corresponding to a respective field type and alignment position.
In step 710, the operating system initiates a reflection call to the application program for obtaining the control content of the target control, the reflection call including the field name and the field index of the feature field.
The reflection call is used to obtain field values in the application that have the same field name and the same field index.
In step 711, the application receives the reflected call.
In step 712, the application program obtains the corresponding field value according to the field name and the field index of the feature field.
And the application program obtains the arrangement position of the characteristic field in the subfield of the control class name of the target control according to the field index, and obtains the field value corresponding to the member variable in the position.
In step 713, the application feeds back the resulting field value to the operating system.
In step 714, the operating system receives a field value, which is the control content of the target control.
In summary, according to the control content obtaining method provided by the present disclosure, when the first version information is different from the second version information and the field type of the feature field in the target control changes, the operating system assumes that the field name and the field index of the feature field in the target control do not change, but that other field names and field indexes of non-feature fields may change, then generates the prediction extraction rule according to the extraction rule in the first configuration information, extracts the control content of the target control according to the prediction extraction rule, and can effectively extract the control content in the target control by using the historical extraction rule in a scenario where the application is updated.
In an alternative embodiment based on fig. 3 to 7, the operating system needs to obtain configuration information from the server in time, where the configuration information includes the extraction rule corresponding to the latest version. The way for the operating system to obtain the configuration information from the server includes, but is not limited to, the following two ways:
firstly, when the version of an application program is updated, acquiring an extraction rule of the latest version from a server;
secondly, acquiring the extraction rule of the latest version from the server every preset time.
For the first obtaining manner, taking the example that the operating system obtains the first configuration information, the method further includes the following steps, as shown in fig. 8:
in step 801, the operating system receives a start signal for an application.
The application program installed in the terminal comprises: native applications provided by the operating system, and/or third party applications installed by the user themselves. In this embodiment, the application refers to any application installed in the operating system or an application belonging to a preset list.
When an application opens a user interface (e.g., a shortcut icon of the application is clicked), the lifecycle function activity on create corresponding to the application is called. And the operating system receives the starting signal on the application program by using the lifecycle function of the application program to be called as the starting signal of the application program. Meanwhile, the operating system receives second version information sent by the application program, wherein the second version information comprises a package name corresponding to the application program installed in the operating system, and a version name and a version code of the corresponding application program.
In step 802, the operating system checks whether the last update time is greater than a preset time.
And when the latest updating time is less than or equal to the preset time of the system, terminating the updating request flow of the operating system. The latest update time is an update time of the configuration information of the first version information.
When the last update time is longer than the preset time of the system, step 803 is entered.
In step 803, the operating system obtains the first version information.
And the operating system finds the corresponding first version information in the global configuration information according to the package name corresponding to the application program.
The first version information includes a configuration version number configversion name and a configuration version code corresponding to the application program when the operating system updates the configuration information last time.
In step 804, it is determined whether the first version information and the second version information are consistent.
And judging whether the first version information is consistent with the second version information number according to the configuration version number configversion name and configversion code in the first version information and the application version number version name and version code in the second version information.
When the configuration version number configversion name in the first version information is consistent with the application version number version name in the second version information, and the configuration version number configversion code in the first version information is consistent with the application version number version code in the second version information, the first version information is consistent with the second version information, which indicates that the application program is not updated, and then the request updating process of the operating system is terminated;
when the configuration version number configversion name in the first version information is not consistent with the application version number version name in the second version information, and/or the configuration version number configversion code in the first version information is not consistent with the application version number version code in the second version information, the first version information is not consistent with the second version information, which indicates that the application program is updated, the process proceeds to step 705.
In step 805, the operating system sends an update request to the server, where the update request carries the second version information.
And the operating system sends an update request carrying the packet name corresponding to the application program and the corresponding application version number version name and version code to the server through a wired network or a wireless network.
Optionally, the server includes configuration information corresponding to each version of the application program, where the configuration information includes an extraction rule of the target control.
In step 806, the server receives the update request.
The server receives an update request carrying the packet name corresponding to the application program and the corresponding application version number version name and version code from the server through a wired network or a wireless network.
In step 807, the server obtains corresponding configuration information according to the second version information.
And the server searches corresponding configuration information in a database according to the package name corresponding to the application program and the corresponding application version number version name and version code.
When the corresponding configuration information does not exist in the database, the server sends feedback information to the operating system, wherein the feedback information comprises identification information marked with the existence of the feedback information;
when the corresponding configuration information exists in the database, the server sends feedback information to the operating system, wherein the feedback information comprises the corresponding configuration information.
In step 808, the server sends feedback information to the operating system.
When the corresponding configuration information does not exist in the database, the server sends feedback information to the operating system through a wired network or a wireless network, wherein the feedback information comprises identification information marked with the existence of the feedback information;
when the corresponding configuration information exists in the database, the server sends feedback information to the operating system through a wired network or a wireless network, wherein the feedback information comprises the corresponding configuration information.
In step 809, the operating system receives feedback information.
When the feedback information includes identification information marked as being absent, the request update flow of the operating system is terminated.
When the feedback information includes corresponding configuration information, step 810 is entered.
In step 810, the operating system updates the corresponding configuration information to the system service.
The operating system updates the corresponding configuration information to the system service, and sets last update time as the current time.
Optionally, the system service refers to a service that needs to acquire control content in the target control.
In summary, the control content obtaining method provided in this embodiment updates the configuration information through the operating system after the application program is started, sends the update request to the server according to the judgment of whether the first version information is consistent with the second version information, and can update the configuration information in the system service in time.
For the second obtaining method, the example that the operating system obtains the latest i + k-th configuration information is taken as an example to illustrate. When the ith configuration information is the first configuration information, the ith + k configuration information may be the second configuration information. The method further comprises the following steps, as shown in fig. 9:
in step 901, the operating system receives a start signal for a system service.
The system service is a service which needs to acquire the control content of the target control in the operating system. For example, the system service is a system service that provides a shortcut search function (a transfer gate function) in an operating system.
In step 902, the operating system sends a global update request to the server, where the update request carries the package name and version information of the application installed in the system.
The operating system sends a global update request to the server through a wired network or a wireless network, wherein the global update request carries a package name corresponding to an application program installed by the system and corresponding application version numbers version name and version code.
The server comprises configuration information corresponding to each version of application program.
In step 903, the server receives an update request.
The server receives a package name carrying a corresponding application program installed by the system and an update request of a corresponding application version number version name and version code from the server through a wired network or a wireless network.
In step 904, the server obtains the ith configuration information, i being a positive integer.
And the server searches the ith configuration information in the database according to the package name corresponding to the application program and the corresponding application version number version name and version code.
When the ith configuration information does not exist in the database, the server sends feedback information to the operating system, wherein the feedback information is identification information marked to be absent;
and when the ith configuration information exists in the database, the server sends feedback information to the operating system, wherein the feedback information is the ith configuration information.
In step 905, the server sends feedback information to the operating system.
When the ith configuration information does not exist in the database, the server sends feedback information to the operating system through a wired network or a wireless network, wherein the feedback information is identification information marked to be absent;
and when the ith configuration information exists in the database, the server sends feedback information to the operating system through a wired network or a wireless network, wherein the feedback information is the ith configuration information.
The wired network may be a metropolitan area network, a local area network, a fiber network, etc., and the wireless network may be a mobile communication network or a wireless fidelity network.
In step 906, the operating system receives feedback information.
When the feedback information is the ith configuration information, step 907 is entered;
when the feedback information is identification information marked as being absent, step 908 is entered.
In step 907, the operating system updates the ith configuration information into the system service.
The operating system updates the ith configuration information to the system service, and sets last update time as the current time.
In step 908, the operating system sets a timer.
The operating system sets a timer. Alternatively, the timer is a timer set according to a static periodic interval, or the timer is a timer set according to a dynamic periodic interval. When the period interval is a dynamic period interval, the timer is dynamically set according to three parameters of the initial time length, the preset time length and the minimum threshold value.
The timer is used for informing the operating system of requesting to update the configuration information at regular time.
Illustratively, when the processes shown in steps 901 to 907 are finished, the period interval at which the update period set by the timer is set is the initial duration.
In step 909, after the timer expires, the operating system sends a global update request to the server, where the global update request carries the packet name corresponding to the application installed in the system, the corresponding application version number version name and version code, and the last update time.
In step 910, the server receives an update request.
In step 911, the server searches for the i + k-th configuration information having an update time of the configuration information later than the latest update time, where k is a positive integer.
According to the package name corresponding to the application program installed in the operating system and the corresponding application version number version name and version code, comparing the last update time with the update time of all configuration information in the database, and searching the i + k configuration information of which all update times are later than the last update time, wherein k is a positive integer.
If the i + k configuration information of which the updating time is later than the last updating time does not exist, sending the feedback information carrying the nonexistent identification information to the operating system;
if the i + k configuration information of which the updating time is later than the last updating time exists, sending all the i + k configuration information of which the updating time is later than the last updating time as feedback information to the operating system.
In step 912, the server sends feedback information to the operating system.
In step 913, the operating system receives the feedback information.
If the feedback information is the identification information without mark, terminating the updating, and entering step 915;
if the feedback information is the i + k th configuration information of which all update times are later than the last update time, step 914 is entered.
In step 914, the operating system updates the i + k-th configuration information into the system service.
The operating system updates the i + k configuration information of which the update time is later than the last update time to the system service, and simultaneously sets the last update time as the current time.
In step 915, the timer is reset based on the periodic interval, the preset duration, and the minimum threshold.
If the feedback information is identification information with no mark, the latest used periodic interval is reduced by a preset time length to obtain an updated periodic interval; the timer is reset according to the updated periodic interval.
Optionally, after the period interval is reduced by the preset duration, the operating system further detects whether the reduced period interval is smaller than a minimum threshold, and if not, resets the timer according to the updated period interval; if the minimum threshold is smaller than the minimum threshold, the minimum threshold is determined as the updated periodic interval, and then the timer is reset according to the updated periodic interval.
Illustratively, the initial duration of the set periodic interval is 24 hours, the preset duration is 4 hours, and the minimum threshold is 12 hours. After the system service is started, the periodic interval is set to be 24 hours of the initial duration. After a system request is updated once, if the feedback information is identification information with no mark, the cycle interval is reset to be the latest cycle interval and is reduced by a preset time length, the cycle interval after the request is updated is 20 hours, the cycle interval is greater than the minimum threshold value for 12 hours, and the timer is reset at the cycle interval of 20 hours.
And in the same way, after the period interval is reduced by the preset time length, the period interval is 8 hours, the period interval is smaller than the minimum threshold value for 12 hours, and the timer is reset by taking the minimum threshold value for 12 hours as the period interval.
If the feedback information is the configuration information of all update times later than the last update time, the set period interval will be the initial time.
Illustratively, the initial time period is set to 24 hours, the preset time period is set to 4 hours, and the minimum threshold value is set to 12 hours. After a system requests updating, if the feedback information is the configuration information of all the updating time later than last update time, setting a period interval as an initial time length of 24 hours, and setting a timer at the period interval of 24 hours.
After step 915 is performed, the process returns to step 909.
In summary, according to the control content obtaining method provided in this embodiment, after receiving the start signal of the system service, the operating system sends the global update request to the server through the timer, so as to ensure that the configuration information in the system service can be updated in time.
Meanwhile, according to the control content obtaining method provided by the embodiment, when the obtaining of the configuration information fails, the period interval corresponding to the timer is continuously reduced, so that the timeliness of obtaining the latest configuration information can be ensured.
In addition, in the control content obtaining method provided in this embodiment, a minimum threshold is given to a period interval corresponding to the timer, so that the frequency of requesting update by the system is limited, and the operating pressure of the server when a plurality of terminals simultaneously perform request update is reduced.
Fig. 10 is a schematic diagram of a control content acquiring apparatus according to an exemplary embodiment of the present disclosure. The accessory mounting apparatus may be implemented as all or part of an electronic device by software, hardware, or a combination of both. The device includes:
an obtaining module 1001 configured to obtain an extraction rule corresponding to the first version information, where the extraction rule is used to extract a control content of a target control in an application;
a determining module 1002 configured to determine a predicted extraction rule of the control content according to the extraction rule when second version information of the application program in the terminal is different from the first version information;
an extracting module 1003 configured to extract the control content of the target control according to the prediction extraction rule.
In an optional embodiment, the determining module 1002 includes:
a first obtaining submodule configured to obtain a field name and a field type of a feature field from the extraction rule;
a first determination submodule configured to determine the prediction extraction rule according to the field name and the field type.
In an optional embodiment, the extracting module 1003 includes:
a second determination submodule configured to determine whether a field conforming to the field name and the field type exists in the target control;
a first extraction sub-module configured to, when there is a field that conforms to the field name and the field type, extract a field value of the field as the control content.
In an optional embodiment, the determining module 1002 includes:
the first obtaining sub-module is configured to obtain a field type and a field index of the characteristic field, where the field index is used to indicate an arrangement position of the characteristic field in a sub-field of a control class name of the target control;
the first determination submodule is configured to determine the prediction extraction rule according to the field type and the field index.
In an optional embodiment, the extracting module 1003 includes:
the second determination submodule is configured to determine whether a field conforming to the field type and the field index exists in the target control;
the first extraction sub-module is configured to, when a field conforming to the field type and the field index exists, extract a field value of the field as the control content.
In an optional embodiment, the apparatus further comprises:
the sending module is configured to send an obtaining request to a server when the application program is started and the second version information is different from the first version information, wherein the obtaining request is used for obtaining the extraction rule corresponding to the second version information.
In an optional embodiment, the apparatus further comprises:
the sending module is configured to send an acquisition request to a server after a timer expires, where the acquisition request is used to acquire an extraction rule corresponding to the second version information, and the timer is set according to a periodic interval;
the timing module is configured to reduce the periodic interval by a preset time length to obtain an updated periodic interval; resetting the timer according to the updated periodic interval.
In an optional embodiment, the timing module includes:
the detection submodule is configured to reduce the period interval by a preset time length and then detect whether the reduced period interval is smaller than a minimum threshold value;
a timing sub-module configured to determine the reduced periodic interval as the updated periodic interval when the reduced periodic interval is not less than the minimum threshold.
In an optional embodiment, the timing module includes:
the detection submodule is configured to detect whether the reduced periodic interval is smaller than a minimum threshold value after the periodic interval is reduced by a preset time length;
the timing sub-module is configured to determine the minimum threshold as the updated periodic interval when the reduced periodic interval is less than the minimum threshold.
In summary, according to the control content obtaining apparatus provided by the present disclosure, when the second version information of the application program in the terminal is different from the first version information, the predicted extraction rule of the control content is determined according to the extraction rule of the first version information, and the control content of the target control is extracted according to the predicted extraction rule, so that the predicted extraction rule is generated based on the historical extraction rule after the application program is updated, and the control content of the target control is effectively extracted according to the predicted extraction rule; the method can solve the problem that the control content of the target control cannot be smoothly extracted according to the historical extraction rule when the target control in the application program is updated.
FIG. 11 is a block diagram illustrating a widget content obtaining apparatus according to an example embodiment. For example, the apparatus 1100 may be a smartphone, a tablet computer, an e-book reader, a laptop portable computer, a desktop computer, and the like.
Referring to fig. 11, apparatus 1100 may include one or more of the following components: processing component 1102, memory 1104, power component 1106, multimedia component 1108, audio component 1110, input/output (I/O) interface(s) 1112, sensor component 1114, and communications component 1116.
The processing component 1102 generally controls the overall operation of the device 1100, such as operations associated with display, data communication, and recording operations. The processing components 1102 may include one or more processors 1118 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 1102 may include one or more modules that facilitate interaction between the processing component 1102 and other components. For example, the processing component 1102 may include a multimedia module to facilitate interaction between the multimedia component 1108 and the processing component 1102.
The memory 1104 is configured to store various types of data to support operations at the apparatus 1100. Examples of such data include instructions for any application or method operating on device 1100, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1104 may be implemented by any type or combination of volatile or non-volatile memory devices 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 or optical disks.
A power component 1106 provides power to the various components of the device 1100. The power components 1106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 1100.
The multimedia component 1108 includes a screen that provides an output interface between the device 1100 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 may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1108 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 1100 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 1110 is configured to output and/or input audio signals. For example, the audio component 1110 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 1100 is in operating modes, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 1104 or transmitted via the communication component 1116. In some embodiments, the audio assembly 1110 further includes a speaker for outputting audio signals.
The I/O interface 1112 provides an interface between the processing component 1102 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1114 includes one or more sensors for providing various aspects of state assessment for the apparatus 1100. For example, the sensor assembly 1114 may detect an open/closed state of the apparatus 1100, the relative positioning of components, such as a display and keypad of the apparatus 1100, the sensor assembly 1114 may also detect a change in position of the apparatus 1100 or a component of the apparatus 1100, the presence or absence of user contact with the apparatus 1100, orientation or acceleration/deceleration of the apparatus 1100, and a change in temperature of the apparatus 1100. The sensor assembly 1114 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1114 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 1114 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 1116 is configured to facilitate wired or wireless communication between the apparatus 1100 and other devices. The apparatus 1100 may access a wireless network based on a communication standard, such as Wi-Fi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1116 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1116 also includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 1100 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, micro-controllers, microprocessors or other electronic components for performing the above-described control content acquisition methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 1104 comprising instructions, executable by the processor 1118 of the apparatus 1100 to perform the control content acquisition method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The present application further provides a computer-readable storage medium, where at least one instruction, one program, one code set, or one instruction set is stored in the computer-readable storage medium, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the control content obtaining method provided in the foregoing method embodiment.
The application also provides a computer program product, which when running on an electronic device, causes the electronic device to execute the control content obtaining method described in the above method embodiments.
Those skilled in the art can implement the translation information display method by understanding the steps of the above-described embodiments and by using hardware devices. The present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (20)

1. A control content acquisition method is characterized by comprising the following steps:
acquiring an extraction rule corresponding to the first version information, wherein the extraction rule is used for extracting control content of a target control in an application program;
when second version information of the application program in the terminal is different from the first version information, determining a prediction extraction rule of the control content according to the extraction rule;
extracting the control content of the target control according to the prediction extraction rule;
the method comprises the steps that search result information is displayed in a superposition mode on a local area of a user interface through an operating system, the search result information is obtained through local search according to control content, and the search result information comprises a local application program inlet; and/or;
the search result information is obtained by searching on the network according to the control content, and the search result information comprises at least one of text introduction information and a network service entrance.
2. The method of claim 1, wherein determining the predictive extraction rule for the widget content according to the extraction rule comprises:
acquiring the field name and the field type of the characteristic field from the extraction rule;
and determining the prediction extraction rule according to the field name and the field type.
3. The method of claim 2, wherein extracting the control content of the target control according to the prediction extraction rule comprises:
determining whether a field conforming to the field name and the field type exists in the target control;
when a field that conforms to the field name and the field type exists, extracting a field value of the field as the control content.
4. The method of claim 1, wherein determining the predictive extraction rule for the widget content according to the extraction rule comprises:
acquiring a field type and a field index of a characteristic field, wherein the field index is used for indicating the arrangement position of the characteristic field in a subfield of a control class name of the target control;
and determining the prediction extraction rule according to the field type and the field index.
5. The method of claim 4, wherein extracting the control content of the target control according to the prediction extraction rule comprises:
determining whether a field conforming to the field type and the field index exists in the target control;
when a field conforming to the field type and the field index exists, extracting a field value of the field as the control content.
6. The method of any of claims 1 to 5, further comprising:
and when the application program is started and the second version information is different from the first version information, sending an acquisition request to a server, wherein the acquisition request is used for acquiring the extraction rule corresponding to the second version information.
7. The method of any of claims 1 to 5, further comprising:
sending an acquisition request to a server after a timer expires, wherein the acquisition request is used for acquiring an extraction rule corresponding to the second version information, and the timer is set according to a periodic interval;
reducing the periodic interval by a preset time length to obtain an updated periodic interval;
resetting the timer according to the updated periodic interval.
8. The method of claim 7, wherein the reducing the periodic interval by a preset duration to obtain an updated periodic interval comprises:
after the period interval is reduced by a preset time length, detecting whether the reduced period interval is smaller than a minimum threshold value;
determining the reduced periodic interval as the updated periodic interval when the reduced periodic interval is not less than the minimum threshold.
9. The method of claim 7, wherein the reducing the periodic interval by a preset duration to obtain an updated periodic interval comprises:
after the period interval is reduced by a preset time length, detecting whether the reduced period interval is smaller than a minimum threshold value;
determining the minimum threshold as the updated periodic interval when the reduced periodic interval is less than the minimum threshold.
10. An apparatus for acquiring control content, the apparatus comprising:
the acquisition module is configured to acquire an extraction rule corresponding to the first version information, and the extraction rule is used for extracting control content of a target control in an application program;
a determining module configured to determine a predicted extraction rule of the control content according to the extraction rule when second version information of the application program in the terminal is different from the first version information;
an extraction module configured to extract control content of the target control according to the prediction extraction rule;
the module is used for displaying search result information in a superposition mode on a local area of a user interface through an operating system, the search result information is obtained by searching locally according to the control content, and the search result information comprises a local application program inlet; and/or; the search result information is obtained by searching on the network according to the control content, and the search result information comprises at least one of text introduction information and a network service entrance.
11. The apparatus of claim 10, wherein the determining module comprises:
a first obtaining submodule configured to obtain a field name and a field type of a feature field from the extraction rule;
a first determination submodule configured to determine the prediction extraction rule according to the field name and the field type.
12. The apparatus of claim 11, wherein the extraction module comprises:
a second determination submodule configured to determine whether a field conforming to the field name and the field type exists in the target control;
a first extraction sub-module configured to, when there is a field that conforms to the field name and the field type, extract a field value of the field as the control content.
13. The apparatus of claim 10, wherein the determining module comprises:
a first obtaining sub-module configured to obtain a field type and a field index of a characteristic field, where the field index is used to indicate an arrangement position of the characteristic field in a sub-field of a control class name of the target control;
a first determination submodule configured to determine the prediction extraction rule from the field type and the field index.
14. The apparatus of claim 13, wherein the extraction module comprises:
a second determination submodule configured to determine whether a field conforming to the field type and the field index exists in the target control;
a first extraction sub-module configured to extract a field value of a field as the control content when the field conforming to the field type and the field index exists.
15. The apparatus of any one of claims 10 to 14, further comprising:
the sending module is configured to send an obtaining request to a server when the application program is started and the second version information is different from the first version information, wherein the obtaining request is used for obtaining the extraction rule corresponding to the second version information.
16. The apparatus of any one of claims 10 to 14, further comprising:
a sending module configured to send an acquisition request to a server when a timer expires, where the acquisition request is used to acquire an extraction rule corresponding to the second version information, and the timer is set according to a periodic interval;
the timing module is configured to reduce the periodic interval by a preset time length to obtain an updated periodic interval; resetting the timer according to the updated periodic interval.
17. The apparatus of claim 16, wherein the timing module comprises:
the detection submodule is configured to reduce the period interval by a preset time length and then detect whether the reduced period interval is smaller than a minimum threshold value;
a timing sub-module configured to determine the reduced periodic interval as the updated periodic interval when the reduced periodic interval is not less than the minimum threshold.
18. The apparatus of claim 16, wherein the timing module comprises:
the detection submodule is configured to reduce the period interval by a preset time length and then detect whether the reduced period interval is smaller than a minimum threshold value;
a timing sub-module configured to determine the minimum threshold as the updated periodic interval when the reduced periodic interval is less than the minimum threshold.
19. A mobile terminal, characterized in that the mobile terminal comprises: a processor and a memory;
the memory has stored therein at least one instruction that is loaded and executed by the processor to implement the widget content obtaining method according to any of claims 1 to 9.
20. A computer-readable storage medium having stored therein at least one instruction which, when loaded and executed by a processor, implements the control content acquisition method of any of claims 1 to 9.
CN201810520111.3A 2018-05-28 2018-05-28 Control content obtaining method and device and storage medium Active CN108804181B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810520111.3A CN108804181B (en) 2018-05-28 2018-05-28 Control content obtaining method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810520111.3A CN108804181B (en) 2018-05-28 2018-05-28 Control content obtaining method and device and storage medium

Publications (2)

Publication Number Publication Date
CN108804181A CN108804181A (en) 2018-11-13
CN108804181B true CN108804181B (en) 2021-09-28

Family

ID=64090503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810520111.3A Active CN108804181B (en) 2018-05-28 2018-05-28 Control content obtaining method and device and storage medium

Country Status (1)

Country Link
CN (1) CN108804181B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110046171B (en) * 2019-04-29 2020-08-14 北京字节跳动网络技术有限公司 System, method and apparatus for obtaining information

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104657377A (en) * 2013-11-20 2015-05-27 阿里巴巴集团控股有限公司 Multi-channel webpage control positioning method and device
CN104699488A (en) * 2015-03-31 2015-06-10 北京奇虎科技有限公司 Method, equipment and system for acquiring APP (application) interface control data dynamically
CN105224462A (en) * 2015-10-27 2016-01-06 小米科技有限责任公司 The recognition methods of control element and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064922A (en) * 2012-12-21 2013-04-24 广东欧珀移动通信有限公司 Method for starting web searching in mobile phone

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104657377A (en) * 2013-11-20 2015-05-27 阿里巴巴集团控股有限公司 Multi-channel webpage control positioning method and device
CN104699488A (en) * 2015-03-31 2015-06-10 北京奇虎科技有限公司 Method, equipment and system for acquiring APP (application) interface control data dynamically
CN105224462A (en) * 2015-10-27 2016-01-06 小米科技有限责任公司 The recognition methods of control element and device

Also Published As

Publication number Publication date
CN108804181A (en) 2018-11-13

Similar Documents

Publication Publication Date Title
CN107153541B (en) Browsing interaction processing method and device
US10372469B2 (en) Method and device for displaying information
CN109032606B (en) Native application compiling method and device and terminal
US11704001B2 (en) Method and device for displaying web page content
CN111339744B (en) Ticket information display method, device and storage medium
EP3239836B1 (en) Information displaying method and apparatus, computer program and recording medium
CN108733397B (en) Update state determination method, apparatus, and storage medium
CN108764003B (en) Picture identification method and device
EP3260998A1 (en) Method and device for setting profile picture
CN106547547B (en) data acquisition method and device
CN117390330A (en) Webpage access method and device
US20170316011A1 (en) Method and apparatus for searching resource
CN107402767B (en) Method and device for displaying push message
EP3770763B1 (en) Method and device for presenting information on a terminal
CN108280342B (en) Application synchronization method and device for application synchronization
CN105976201B (en) Purchasing behavior monitoring method and device for e-commerce system
US11210449B2 (en) Page display method and device and storage medium
CN107179837B (en) Input method and device
CN107360322B (en) Information prompting method and device
CN108804181B (en) Control content obtaining method and device and storage medium
CN109842688B (en) Content recommendation method and device, electronic equipment and storage medium
CN112667852B (en) Video-based searching method and device, electronic equipment and storage medium
CN110147426B (en) Method for determining classification label of query text and related device
CN112102009A (en) Advertisement display method, device, equipment and storage medium
CN110020244B (en) Method and device for correcting website information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant