CN115543342A - Method for replacing start page during compiling, electronic equipment and storage medium - Google Patents

Method for replacing start page during compiling, electronic equipment and storage medium Download PDF

Info

Publication number
CN115543342A
CN115543342A CN202211495763.9A CN202211495763A CN115543342A CN 115543342 A CN115543342 A CN 115543342A CN 202211495763 A CN202211495763 A CN 202211495763A CN 115543342 A CN115543342 A CN 115543342A
Authority
CN
China
Prior art keywords
page
replaced
information
replacing
class 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.)
Granted
Application number
CN202211495763.9A
Other languages
Chinese (zh)
Other versions
CN115543342B (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.)
Tianjin Hualai Technology Co Ltd
Original Assignee
Tianjin Hualai Technology 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 Tianjin Hualai Technology Co Ltd filed Critical Tianjin Hualai Technology Co Ltd
Priority to CN202211495763.9A priority Critical patent/CN115543342B/en
Publication of CN115543342A publication Critical patent/CN115543342A/en
Application granted granted Critical
Publication of CN115543342B publication Critical patent/CN115543342B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Abstract

The invention relates to the technical field of computer digital processing based on an Android development language, in particular to a method for replacing a start page during compiling, electronic equipment and a storage medium. When the App is started, the inserted replacement code is preferentially executed, the class information of the page C to be replaced is given to the intermediate copy information of the page B to be replaced, and when the logic of the page B to be replaced of the starting page is executed, the class information of the page B to be replaced is already replaced by the intermediate copy information during compilation, so that the information of the page C to be replaced when the starting information is read by the system, the purpose of replacing the starting page is achieved, implicit code calling is completed, the purpose of effectively avoiding code intrusion and reducing coupling is achieved.

Description

Method, electronic device and storage medium for replacing boot page during compiling
Technical Field
The invention relates to the technical field of computer digital processing based on an Android development language, in particular to a method for replacing a start page during compiling, electronic equipment and a storage medium.
Background
Android is a mobile operating system based on Linux kernels and open source codes of other open source software, android development uses Java language, and the structure of a plurality of modules presented by the existing Android system, for example, as shown in fig. 1, the existing jump from a page to a page B is realized by writing the existing jump from a language into one module, and when module extension development is performed, when the logic that the page a jumps to the page B in the original module does not meet the requirement of jumping to a page C, a jump method needs to be added or modified in the original module, so that other codes or designs of the original module need to be correspondingly changed to meet the new jump requirement. Such codes are intrusive and highly coupled.
In summary, how to effectively avoid the intrusiveness of the code and reduce the coupling is a technical problem that needs to be solved by those skilled in the art.
Disclosure of Invention
The present invention has been made to solve at least one of the technical problems occurring in the related art. Therefore, the invention provides a method for replacing the starting page during compiling, which can effectively avoid the intrusiveness of the code and reduce the coupling.
The invention provides a method for replacing a starting page during compiling, which comprises the following steps in an Android language:
s1, adding annotations to the class of a page to be replaced in an extension module during encoding, wherein the annotations comprise class information of the page to be replaced and class information of a page to be replaced;
s2, inserting intermediate copy information into the replaced page in the original module during compiling;
s3, during compilation, scanning the positions of all the class information calling the replaced page in the original module, and replacing the class information calling instruction of the replaced page with an instruction calling the intermediate copy information of the replaced page;
s4, during compiling, scanning the annotation added in the step S1 in the original module through a compiler, acquiring the class information of the page to be replaced contained in the annotation, and storing the class information;
s5, during compiling, inserting a replacement code at the starting position of the App in the original module, and assigning the class information of the page to be replaced, which is stored in the step S4, to the intermediate copy information of the page to be replaced.
The intermediate copy information provided by the present invention copies the class information of the replaced page.
The annotations provided according to the present invention are meta-information appended to the code for compilation and runtime parsing and use.
According to the steps S2, S3 and S5 provided by the invention, the original module is inserted through the ASM frame.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor executes the computer program to realize the steps of the method for replacing the starting page during compiling.
The invention also provides a storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the above method of replacing a start-up page at compile time.
One or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:
when the App is started, the replacement code inserted in the step S5 is preferentially executed, the type information of the page to be replaced is given to the self-defined attribute of the replaced page, and when the logic of the replaced page is started, the type information of the replaced page is replaced by the inserted self-defined attribute in the step S3, so that the information of the page to be replaced is read by the system when the information is started.
The method has no invasion to the original code, dynamically supports the expansion module, does not refer and modify, and has no influence on the original logic.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of a prior art page replacement;
FIG. 2 is a schematic diagram of page replacement of the present invention, wherein the direction of the arrow indicates the direction of page jump, the solid line indicates the presence of a display calling code, and the dotted line indicates an implicit calling code;
fig. 3 is a schematic structural diagram of an electronic device provided in the present invention.
Reference numerals:
810. a processor; 820. a communication interface; 830. a memory (memory); 840. a communication bus.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
In the description of the embodiments of the present invention, it should be noted that the terms "center", "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience in describing the embodiments of the present invention and simplifying the description, but do not indicate or imply that the referred devices or elements must have a specific orientation, be constructed in a specific orientation, and be operated, and thus, should not be construed as limiting the embodiments of the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the embodiments of the present invention, it should be noted that, unless explicitly stated or limited otherwise, the terms "connected" and "connected" are to be interpreted broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; may be directly connected or indirectly connected through an intermediate. Specific meanings of the above terms in the embodiments of the present invention can be understood in specific cases by those of ordinary skill in the art.
In embodiments of the invention, unless expressly stated or limited otherwise, a first feature may be "on" or "under" a second feature such that the first and second features are in direct contact, or the first and second features are in indirect contact via an intermediary. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description of the present specification, reference to the description of "one embodiment," "some embodiments," "an example," "a specific example," or "some examples" or the like means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Moreover, various embodiments or examples and features of various embodiments or examples described in this specification can be combined and combined by one skilled in the art without being mutually inconsistent.
The following describes a method, an electronic device, and a storage medium for replacing a start page at compile time according to the present invention with reference to fig. 2.
The invention provides a method for replacing a starting page during compiling, which can effectively avoid the intrusiveness of codes and reduce the coupling.
The invention provides a method for replacing a starting page during compiling, which comprises the following steps in an Android language:
s1, during coding, a developer adds a specified annotation to a class of a C page to be replaced in an extension module, wherein the annotation contains information of a replaced page and a replaced page (the annotation can be a self-defined annotation, and only needs to be the same annotation as the annotation during instrumentation).
And S2, inserting intermediate copy information into the replaced B page in the original module during compiling, wherein the type of the intermediate copy information is the class information of the replaced B page, the intermediate copy information needs to be used when the page is started, and the intermediate copy information contains information such as the full class name of the class information of the replaced B page.
And S3, during compilation, scanning all places calling the attribute of the replaced B page class information, and replacing the class information instruction calling the replaced B page with an instruction calling intermediate copy information of the replaced B page.
S4, during compiling, scanning the annotation added in the step one through a compiler, acquiring the replacement information contained in the annotation, and storing the replacement information.
And S5, during compiling, inserting a replacement code at the starting position of the App, and assigning the class information of the page C to be replaced to the intermediate copy information of the page B to be replaced.
When App is started, the replacement code inserted in S5 is preferentially executed, the class information of the page C to be replaced is given to the intermediate copy information of the page B to be replaced, and when the logic of the page B to be replaced of the starting page is executed, the class information of the page B to be replaced is already replaced by the intermediate copy information in step S3 during the compiling period, so that the information of the page C to be replaced when the starting information is read by the system, the purpose of replacing the starting page is achieved, and the implicit code calling is completed.
The annotation in this example is some meta-information attached to the code for compiling and runtime parsing and use, and functions of explanation and configuration. The annotation does not affect the actual logic of the code and only serves an ancillary role.
The ASM framework in this example is a Java class information handling framework. It can modify existing classes in binary form or dynamically generate classes. The ASM can either directly generate the binary class file or dynamically change the class behavior before the class is loaded into the Java virtual machine. After the ASM reads information from the class file, the ASM can change class behaviors, analyze class information and even generate a new class according to user requirements. And S2, S3, and S5, pile inserting is carried out on the original module through the ASM frame. Instrumentation is the addition, modification, or deletion of binary code instructions.
In this example, the class information is a binary file containing the execution program, consisting of a sequence of op code/data pairs, which is a type of intermediate code.
When the App is started, the replacement code inserted in the step S5 is preferentially executed, the type information of the page to be replaced is given to the self-defined attribute of the replaced page, and when the logic of the replaced page is started, the type information of the replaced page is replaced by the inserted self-defined attribute in the step S3, so that the information of the page to be replaced is read by the system when the information is started.
The method has no invasion to the original code, dynamically supports the expansion module, does not refer and modify, and has no influence on the original logic.
Fig. 3 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 3: a processor (processor) 810, a communication Interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication Interface 820 and the memory 830 communicate with each other via the communication bus 840. The processor 810 may call logic instructions in the memory 830 to perform a method of replacing a launch page at compile time.
In addition, the logic instructions in the memory 830 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the above-provided method of replacing a launch-on page at compile time.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on the understanding, the above technical solutions substantially or otherwise contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (6)

1. A method for replacing a start page during compiling is characterized by comprising the following steps in an Android language:
s1, during encoding, adding annotations to classes of pages to be replaced in an extension module, wherein the annotations contain class information of the pages to be replaced and class information of the replaced pages;
s2, inserting intermediate copy information into the replaced page in the original module during compiling;
s3, during compilation, scanning the positions of all the class information calling the replaced page in the original module, and replacing the class information calling instruction of the replaced page with an instruction calling the intermediate copy information of the replaced page;
s4, during compiling, scanning the annotation added in the step S1 in the original module through a compiler, acquiring the class information of the page to be replaced contained in the annotation, and storing the class information;
s5, during compiling, inserting a replacement code at the starting position of the App in the original module, and assigning the class information of the page to be replaced, which is stored in the step S4, to the intermediate copy information of the page to be replaced.
2. The method of replacing a startup page at compile time as recited in claim 1, wherein the intermediate copy information copies class information of the replaced page.
3. The method for replacing a launch page upon compilation of claim 1 wherein said annotations are meta-information appended to the code for compilation and runtime parsing and use.
4. The method for replacing a start-up page at compile time according to any one of claims 1 to 3, wherein the step S2, the step S3 and the step S5 are implemented by inserting the original module through an ASM framework.
5. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor when executing the computer program implements the steps of the method of replacing a boot page at compile time as claimed in any of claims 1 to 4.
6. A storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, performs the steps of the method of replacing a launch page at compile time as claimed in any one of claims 1 to 4.
CN202211495763.9A 2022-11-28 2022-11-28 Method, electronic device and storage medium for replacing boot page during compiling Active CN115543342B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211495763.9A CN115543342B (en) 2022-11-28 2022-11-28 Method, electronic device and storage medium for replacing boot page during compiling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211495763.9A CN115543342B (en) 2022-11-28 2022-11-28 Method, electronic device and storage medium for replacing boot page during compiling

Publications (2)

Publication Number Publication Date
CN115543342A true CN115543342A (en) 2022-12-30
CN115543342B CN115543342B (en) 2023-03-24

Family

ID=84721727

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211495763.9A Active CN115543342B (en) 2022-11-28 2022-11-28 Method, electronic device and storage medium for replacing boot page during compiling

Country Status (1)

Country Link
CN (1) CN115543342B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895581B1 (en) * 2000-03-30 2005-05-17 Microsoft Corporation Replaceable classes and virtual constructors for object-oriented programming languages
US20130019231A1 (en) * 2011-07-15 2013-01-17 Infineon Technologies Ag Distributed compiling process with instruction signature support
US20190310835A1 (en) * 2017-03-28 2019-10-10 Tencent Technology (Shenzhen) Company Limited Application development method, tool, and device, and storage medium
CN112817657A (en) * 2021-01-29 2021-05-18 北京奇艺世纪科技有限公司 Application program starting item loading method, device and system and storage medium
CN113391811A (en) * 2020-03-13 2021-09-14 北京字节跳动网络技术有限公司 Function compiling method and device, electronic equipment and computer readable storage medium
CN114385162A (en) * 2020-10-16 2022-04-22 腾讯科技(深圳)有限公司 Page editing method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895581B1 (en) * 2000-03-30 2005-05-17 Microsoft Corporation Replaceable classes and virtual constructors for object-oriented programming languages
US20130019231A1 (en) * 2011-07-15 2013-01-17 Infineon Technologies Ag Distributed compiling process with instruction signature support
US20190310835A1 (en) * 2017-03-28 2019-10-10 Tencent Technology (Shenzhen) Company Limited Application development method, tool, and device, and storage medium
CN113391811A (en) * 2020-03-13 2021-09-14 北京字节跳动网络技术有限公司 Function compiling method and device, electronic equipment and computer readable storage medium
CN114385162A (en) * 2020-10-16 2022-04-22 腾讯科技(深圳)有限公司 Page editing method, device, equipment and storage medium
CN112817657A (en) * 2021-01-29 2021-05-18 北京奇艺世纪科技有限公司 Application program starting item loading method, device and system and storage medium

Also Published As

Publication number Publication date
CN115543342B (en) 2023-03-24

Similar Documents

Publication Publication Date Title
KR102204115B1 (en) Patch upgrade-based file processing method and device, terminal, and storage medium
FI118311B (en) Procedure, data processing apparatus, computer software product and arrangements for processing electronic data
CN108647032B (en) Application loading method and device, computer device and computer readable storage medium
CN112612502A (en) Patch generation method, device, equipment and storage medium
CN110300082A (en) A kind of interface creation method, device and storage medium
CN108089873A (en) A kind of method and terminal of application component immediate updating
CN110908734A (en) Application combination method and device based on plug-in, terminal equipment and storage medium
CN111359219B (en) File processing method, device, equipment and storage medium of illusion engine
US20220137942A1 (en) Native emulation compatible application binary interface for supporting emulation of foreign code
CN115543342B (en) Method, electronic device and storage medium for replacing boot page during compiling
CN114721688A (en) SDK upgrading method and device and computer equipment
CN111078279A (en) Processing method, device and equipment of byte code file and storage medium
US20210232378A1 (en) Program calling, electronic device, and storage medium
CN113778391A (en) Page processing method, device and equipment for native application program
CN112612833A (en) Rule package updating method, device, equipment and storage medium
CN115220873A (en) Method for running Open Harmony application in Android system
CN112015497B (en) Skin changing method and device
CN114296764A (en) System upgrading method and device, storage medium and electronic equipment
CN113641389A (en) Software upgrading method, device and equipment based on OpenCPU
CN112596734A (en) Static library generation method and device
CN113467980A (en) Log output method, device and system and embedded equipment
CN111399842A (en) Code compiling method and device
CN112256324B (en) Method and device for processing files in android application program construction process
CN116776031B (en) Method and device for checking accessory content in open format document OFD
CN113672238B (en) Operation method, device and equipment based on real-time operating system modularized management

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
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Feng Xiao

Inventor after: Xi Jie

Inventor after: Liu Mingyu

Inventor after: Chen Baoxiang

Inventor after: Jia Fangrong

Inventor after: Li Mengyu

Inventor after: Han Peigang

Inventor after: Wang Hongkun

Inventor after: Zeng Cheng

Inventor after: Wen Liang

Inventor before: Feng Xiao

Inventor before: Xi Jie

Inventor before: Liu Mingyu

Inventor before: Chen Baoxiang

Inventor before: Jia Fangrong

Inventor before: Li Mengyu

Inventor before: Han Peigang

Inventor before: Wang Hongkun

Inventor before: Zeng Cheng

Inventor before: Wen Liang