CN112579072B - Browser packaging method and device, storage medium and terminal - Google Patents
Browser packaging method and device, storage medium and terminal Download PDFInfo
- Publication number
- CN112579072B CN112579072B CN202011556869.6A CN202011556869A CN112579072B CN 112579072 B CN112579072 B CN 112579072B CN 202011556869 A CN202011556869 A CN 202011556869A CN 112579072 B CN112579072 B CN 112579072B
- Authority
- CN
- China
- Prior art keywords
- browser
- file
- compressed
- package
- files
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/34—Graphical or visual programming
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/37—Compiler construction; Parser generation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本申请实施例公开了一种浏览器打包方法、装置、存储介质以及终端。所述方法包括:在浏览内核编译过程中,将生成的浏览器文件进行压缩,这些浏览器文件包括语言文件或资源文件或动态库文件,然后再将这些浏览器文件的压缩包打包至浏览器数据包中。通过本申请的方法,将浏览器中的各种浏览器文件进行压缩和打包处理,减小了浏览器数据包的容量。
The embodiment of the present application discloses a browser packaging method, device, storage medium and terminal. The method comprises: in the process of browser kernel compilation, compressing the generated browser files, which include language files or resource files or dynamic library files, and then packaging the compressed packages of these browser files into a browser data packet. Through the method of the present application, various browser files in the browser are compressed and packaged, thereby reducing the capacity of the browser data packet.
Description
技术领域Technical Field
本发明涉及计算机技术领域,尤其涉及一种浏览器打包方法、装置、存储介质以及终端。The present invention relates to the field of computer technology, and in particular to a browser packaging method, device, storage medium and terminal.
背景技术Background technique
影响浏览器的大小的文件大概可以分为三部分,一是java代码和引入的公共jar包,二是java或者C语言所使用的资源文件,三是动态库文件。现有技术中,浏览器瘦身都采用减少包内的资源文件,或采用服务器端动态拉取,或者去掉一些非必要的功能,通过裁剪功能进行减少浏览器数据包的大小,或者通过减少资源的单个大小容量进行瘦身。这样在保证浏览器功能的前提下减少的浏览器数据包的大小微乎其微,当浏览器数据包变大后,用户在升级或者使用的过程中都会有明显的速度影响。The files that affect the size of the browser can be roughly divided into three parts: the first is the Java code and the imported public jar package, the second is the resource files used by Java or C language, and the third is the dynamic library file. In the prior art, browser slimming is achieved by reducing the resource files in the package, or by dynamically pulling from the server, or removing some unnecessary functions, reducing the size of the browser data packet through the trimming function, or slimming down by reducing the single size capacity of the resource. In this way, the size of the browser data packet is reduced to a negligible amount while ensuring the browser function. When the browser data packet becomes larger, the user will have a significant speed impact during the upgrade or use process.
发明内容Summary of the invention
本申请实施例提供了一种浏览器打包方法、装置、计算机存储介质以及终端,旨在解决相关技术中如何减小浏览器数据包内存的技术问题。所述技术方案如下:The embodiments of the present application provide a browser packaging method, device, computer storage medium and terminal, aiming to solve the technical problem of how to reduce the memory of browser data packets in the related art. The technical solution is as follows:
第一方面,本申请实施例提供了一种浏览器打包方法,所述方法包括:In a first aspect, an embodiment of the present application provides a browser packaging method, the method comprising:
在浏览器内核编译过程中,对生成的浏览器文件进行压缩处理,生成所述浏览器文件对应的压缩包,所述浏览器文件包括第一语言文件或第一资源文件或第一动态库文件;During the browser kernel compilation process, the generated browser file is compressed to generate a compressed package corresponding to the browser file, wherein the browser file includes a first language file or a first resource file or a first dynamic library file;
将所述压缩包打包至浏览器数据包中。The compressed package is packaged into a browser data package.
第二方面,本申请实施例提供了一种浏览器打包装置,所述装置包括:In a second aspect, an embodiment of the present application provides a browser packaging device, the device comprising:
第一压缩模块,用于在浏览器内核编译过程中,对生成的浏览器文件进行压缩处理,生成所述浏览器文件对应的压缩包,所述浏览器文件包括第一语言文件或第一资源文件或第一动态库文件;A first compression module, used to compress the generated browser file during the browser kernel compilation process to generate a compressed package corresponding to the browser file, wherein the browser file includes a first language file or a first resource file or a first dynamic library file;
第二压缩模块,用于将所述压缩包打包至浏览器数据包中。The second compression module is used to pack the compressed package into a browser data package.
第三方面,本申请实施例提供了一种计算机存储介质,所述计算机存储介质有多条指令,所述指令适于由处理器加载并执行上述的方法步骤。In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium has a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
第四方面,本申请实施例提供了一种终端,可包括:存储器和处理器;其中,所述存储器存储有计算机程序,所述计算机程序适于由所述存储器加载并执行上述的方法步骤。In a fourth aspect, an embodiment of the present application provides a terminal, which may include: a memory and a processor; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the memory and executing the above-mentioned method steps.
本申请实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
本申请实施例的方案在执行时,在浏览内核编译过程中,将生成的浏览器文件进行压缩,这些浏览器文件包括第一语言文件或第一资源文件或第一动态库文件,然后再将这些浏览器文件的压缩包打包至浏览器数据包中。通过本申请的方法,将浏览器中的各种浏览器文件进行压缩和打包处理,减小了浏览器数据包的容量。When the solution of the embodiment of the present application is executed, during the browser kernel compilation process, the generated browser files are compressed, and these browser files include the first language file or the first resource file or the first dynamic library file, and then the compressed packages of these browser files are packaged into the browser data packet. Through the method of the present application, various browser files in the browser are compressed and packaged, reducing the capacity of the browser data packet.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
图1是本申请实施例提供的一种浏览器打包方法的流程示意图;FIG1 is a flow chart of a browser packaging method provided in an embodiment of the present application;
图2是本申请实施例提供的一种浏览器打包方法的流程示意图;FIG2 is a flow chart of a browser packaging method provided in an embodiment of the present application;
图3是本申请实施例提供的一种浏览器打包方法中浏览器数据包的结构示意图;FIG3 is a schematic diagram of the structure of a browser data packet in a browser packaging method provided in an embodiment of the present application;
图4是本申请实施例提供的一种浏览器打包方法中浏览器数据包的结构示意图;FIG4 is a schematic diagram of the structure of a browser data packet in a browser packaging method provided in an embodiment of the present application;
图5是本申请实施例提供的一种浏览器打包装置的结构示意图;FIG5 is a schematic diagram of the structure of a browser packaging device provided in an embodiment of the present application;
图6是本申请实施例提供的终端的结构方框图;FIG6 is a block diagram of a terminal provided in an embodiment of the present application;
图7是本申请实施例提供的操作系统和用户空间的结构示意图;7 is a schematic diagram of the structure of an operating system and a user space provided in an embodiment of the present application;
图8是图6中安卓操作系统的架构图。FIG8 is an architecture diagram of the Android operating system in FIG6 .
具体实施方式Detailed ways
为使得本申请实施例的发明目的、特征、优点能够更加的明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而非全部实施例。基于本申请中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, features, and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
下面结合具体的实施例对本申请进行说明。The present application is described below in conjunction with specific embodiments.
在下述方法实施例中,为了便于说明,仅以各步骤的执行主体为终端进行介绍说明。In the following method embodiments, for the sake of convenience, only the execution subject of each step is introduced and described as the terminal.
请参见图1,为本申请实施例提供的一种浏览器打包方法的流程示意图。如图1所示,本申请实施例的所述方法可以包括以下步骤:Please refer to Figure 1, which is a flowchart of a browser packaging method provided in an embodiment of the present application. As shown in Figure 1, the method in the embodiment of the present application may include the following steps:
S101,在浏览器内核编译过程中,对生成的浏览器文件进行压缩处理,生成浏览器文件对应的压缩包,浏览器文件包括第一语言文件或第一资源文件或第一动态库文件。S101, during the browser kernel compilation process, compressing the generated browser file to generate a compressed package corresponding to the browser file, where the browser file includes a first language file or a first resource file or a first dynamic library file.
其中,浏览器内核也叫渲染引擎,主要是将页面转变成可视化的图像结果。那么,浏览器的渲染引擎就是能够将HTML(Hyper Text Markup Language,超文本标记语言)/CSS(Cascading Style Sheets,层叠样式表)/JavaScript文本及其相应的资源文件转换成图像结果的模块。那么,浏览器内核编译过程,就是渲染引擎将相应的资源文件转换成图像结果的过程。在将资源文件转换成图像结果的过程中,最终影响到浏览器数据包大小的文件可以包括:Java代码文件(class*.dex文件)、Native代码文件(lib目录下的.so文件)和资源文件(assets目录、res目录以及resources.arsc索引表文件)。那么可以把这些文件分为三类,一是第一动态库文件,主要是Native代码文件,也就是lib目录下的.so文件;二是第一资源文件,主要包括assets目录下的文件、res目录下的文件以及resources.arsc索引表文件;三是第一语言文件,主要包括Java代码文件。那么可以将第一语言文件或第一资源文件或第一动态库文件分别进行加密压缩处理,得到加密压缩后的第一语言文件或加密压缩后的第一资源文件或加密压缩后的第一动态库文件。Among them, the browser kernel is also called the rendering engine, which mainly converts the page into a visual image result. Then, the browser rendering engine is a module that can convert HTML (Hyper Text Markup Language)/CSS (Cascading Style Sheets)/JavaScript text and its corresponding resource files into image results. Then, the browser kernel compilation process is the process of the rendering engine converting the corresponding resource files into image results. In the process of converting resource files into image results, the files that ultimately affect the size of the browser data packet may include: Java code files (class*.dex files), Native code files (.so files in the lib directory) and resource files (assets directory, res directory and resources.arsc index table file). Then these files can be divided into three categories: the first dynamic library file, mainly Native code files, that is, .so files in the lib directory; the second is the first resource file, mainly including files in the assets directory, files in the res directory and resources.arsc index table file; the third is the first language file, mainly including Java code files. Then the first language file or the first resource file or the first dynamic library file may be encrypted and compressed respectively to obtain an encrypted and compressed first language file or an encrypted and compressed first resource file or an encrypted and compressed first dynamic library file.
S102,将压缩包打包至浏览器数据包中。S102, packaging the compressed package into a browser data package.
其中,浏览器数据包是安卓系统中的apk(Android application package,Android应用程序包)文件,是Android操作系统使用的一种应用程序包文件格式,用于分发和安装移动应用及中间件。一个Android应用程序的代码想要在Android设备上运行,那么就必须先进行编译,然后被打包成为一个被Android系统所能识别的文件才可以被运行,而这种能被Android系统识别并运行的文件格式便是“apk”。The browser data packet is an apk (Android application package) file in the Android system, which is an application package file format used by the Android operating system for distributing and installing mobile applications and middleware. If an Android application code wants to run on an Android device, it must first be compiled and then packaged into a file that can be recognized by the Android system before it can be run. The file format that can be recognized and run by the Android system is "apk".
一个apk文件内包含AndroidManifest.xml、assets、class.dex、lib、res、resources.arsc、META-INF等文件。AndroidManifest.xml是Android项目的系统的清单文件,用来控制Android应用的名称、桌面图标、访问权限等全局属性。另外,安卓应用的四大组件Activity、Service、BroadcastReceiver和ContentProvider也需要在这个文件中声明和配置。assets目录是用来存放需要打包到Android应用程序的静态资源文件,例如图片资源文件、JSON配置文件、渠道配置文件、二进制数据文件、HTML5离线资源文件等。class.dex是应用程序的可执行文件,Android代码都打包在这种类型的文件中。lib目录下存放的是应用程序依赖的不用ABI类型的.so文件。res目录存放的都是应用程序的资源文件,包括图片资源、字符串资源、颜色资源和尺寸资源等。res和assets都是资源文件,但是不同的是,assets目录支持任意深度的子目录,同时该目录下面的文件不会生成资源ID。resources.arsc是资源索引表,用来描述具有ID值的资源的配置信息。META-INF目录下主要存放的是签名相关的信息,用于验证APK包的完整性以及保证系统的安全。An apk file contains files such as AndroidManifest.xml, assets, class.dex, lib, res, resources.arsc, and META-INF. AndroidManifest.xml is the system manifest file of the Android project, which is used to control global properties such as the name, desktop icon, and access rights of the Android application. In addition, the four major components of the Android application, Activity, Service, BroadcastReceiver, and ContentProvider, also need to be declared and configured in this file. The assets directory is used to store static resource files that need to be packaged into the Android application, such as image resource files, JSON configuration files, channel configuration files, binary data files, and HTML5 offline resource files. class.dex is the executable file of the application, and Android code is packaged in this type of file. The lib directory stores .so files of different ABI types that the application depends on. The res directory stores all the resource files of the application, including image resources, string resources, color resources, and size resources. res and assets are both resource files, but the difference is that the assets directory supports subdirectories of any depth, and the files under this directory will not generate resource IDs. resources.arsc is a resource index table that describes the configuration information of resources with ID values. The META-INF directory mainly stores signature-related information, which is used to verify the integrity of the APK package and ensure the security of the system.
根据一些实施例,基于S101中得到的加密压缩后的第一语言文件或加密压缩后的第一资源文件或加密压缩后的第一动态库文件,可以将这些浏览器文件的压缩包再打包至APK包中。According to some embodiments, based on the encrypted and compressed first language file or the encrypted and compressed first resource file or the encrypted and compressed first dynamic library file obtained in S101, the compressed packages of these browser files may be repackaged into an APK package.
本申请实施例的方案在执行时,在浏览内核编译过程中,将生成的浏览器文件进行压缩,这些浏览器文件包括第一语言文件或第一资源文件或第一动态库文件,然后再将这些浏览器文件的压缩包打包至浏览器数据包中。通过本申请的方法,将浏览器中的各种浏览器文件进行压缩和打包处理,减小了浏览器数据包的容量。When the solution of the embodiment of the present application is executed, during the browser kernel compilation process, the generated browser files are compressed, and these browser files include the first language file or the first resource file or the first dynamic library file, and then the compressed packages of these browser files are packaged into the browser data packet. Through the method of the present application, various browser files in the browser are compressed and packaged, reducing the capacity of the browser data packet.
请参见图2,为本申请实施例提供的一种浏览器打包方法的流程示意图。如图2所示,本申请实施例的所述方法可以包括以下步骤:Please refer to Figure 2, which is a flowchart of a browser packaging method provided in an embodiment of the present application. As shown in Figure 2, the method in the embodiment of the present application may include the following steps:
S201,在浏览器内核编译过程中,若所生成的浏览器文件的容量值大于或等于容量阈值,则将浏览器文件进行压缩处理,生成浏览器文件对应的压缩包。S201, during the browser kernel compilation process, if the capacity value of the generated browser file is greater than or equal to the capacity threshold, the browser file is compressed to generate a compressed package corresponding to the browser file.
其中,容量阈值是针对每种浏览器文件进行设定的容量阈值,浏览器文件主要包括三类,一是第一语言文件,二是第一资源文件,三是第一动态库文件。第一语言文件,主要是指Java文件,也就是class*.dex文件。那么,相应地,有class*.dex文件容量阈值。第一资源文件主要包括assets目录下的文件、res目录下的文件以及resources.arsc索引表文件。相应地,分别有assets目录的文件容量阈值、res目录的文件容量阈值以及resources.arsc索引表文件容量阈值。第一动态库文件主要指的是lib目录下的文件,相应地,有lib目录的文件容量阈值,lib目录的文件主要是.so文件。各种浏览器文件的容量阈值可根据实际应用进行设定,本申请实施例对此不作任何限制。Among them, the capacity threshold is the capacity threshold set for each browser file. The browser files mainly include three categories, one is the first language file, the second is the first resource file, and the third is the first dynamic library file. The first language file mainly refers to the Java file, that is, the class*.dex file. Then, accordingly, there is a class*.dex file capacity threshold. The first resource file mainly includes files under the assets directory, files under the res directory, and the resources.arsc index table file. Correspondingly, there are file capacity thresholds for the assets directory, file capacity thresholds for the res directory, and resources.arsc index table file capacity thresholds. The first dynamic library file mainly refers to the files under the lib directory, and accordingly, there is a file capacity threshold for the lib directory. The files in the lib directory are mainly .so files. The capacity thresholds of various browser files can be set according to actual applications, and the embodiments of the present application do not impose any restrictions on this.
对于生成的各种浏览器文件,如果第一语言文件的容量值大于或等于对应的容量阈值,或者第一资源文件的容量值大于或等于对应的容量阈值,或者第一动态库文件的容量值大于或等于对应的容量阈值,则将上述浏览器文件进行压缩处理,在压缩时还可以进行加密处理。第一资源文件中还包括各个类型的资源文件,分别检测各个类型的资源文件是否大于或等于对应的容量阈值,只压缩容量值大于或等于容量阈值的类型的资源文件,并且保存压缩后的资源文件的大小和名称。For various browser files generated, if the capacity value of the first language file is greater than or equal to the corresponding capacity threshold, or the capacity value of the first resource file is greater than or equal to the corresponding capacity threshold, or the capacity value of the first dynamic library file is greater than or equal to the corresponding capacity threshold, the above browser files are compressed, and encryption can also be performed during compression. The first resource file also includes resource files of various types, and each type of resource file is detected to see whether it is greater than or equal to the corresponding capacity threshold. Only resource files of the type whose capacity value is greater than or equal to the capacity threshold are compressed, and the size and name of the compressed resource file are saved.
S202,将压缩包打包至浏览器数据包中。S202, packaging the compressed package into a browser data package.
其中,浏览器数据包下有多个目录文件夹,可参见如图3所示的apk文件结构图,主要包括系统清单文件(AndroidManifest.xml)、静态资源文件目录(assets目录)、编译文件目录(lib目录)、资源文件目录(res目录)、签名文件目录(META-INF目录)、可执行文件(class.dex)和资源索引表文件(resources.arsc),上述各个目录文件中所存储的内容可参见图1中的步骤S102,在此不再赘述。Among them, there are multiple directory folders under the browser data packet, as shown in the apk file structure diagram in Figure 3, which mainly include the system manifest file (AndroidManifest.xml), static resource file directory (assets directory), compiled file directory (lib directory), resource file directory (res directory), signature file directory (META-INF directory), executable file (class.dex) and resource index table file (resources.arsc). The contents stored in the above directory files can be seen in step S102 in Figure 1, which will not be repeated here.
具体的,将压缩包打包至浏览器数据包中,此时是生成一个新的apk文件,新的apk文件可以命名为colorOS1101.apk,可参见如图4所示的colorOS1101.apk的文件结构图,包括系统清单文件压缩包(AndroidManifest.xml压缩包)、静态资源文件夹压缩包(assets目录文件夹压缩包)、编译文件夹压缩包(lib目录文件夹压缩包)、资源文件夹压缩包(res目录文件夹压缩包)、签名文件夹压缩包(META-INF目录文件夹压缩包)、可执行文件压缩包(class.dex压缩包)和资源索引表文件压缩包(resources.arsc压缩包)。Specifically, the compressed package is packaged into the browser data package. At this time, a new apk file is generated. The new apk file can be named colorOS1101.apk. Please refer to the file structure diagram of colorOS1101.apk shown in Figure 4, including the system manifest file compression package (AndroidManifest.xml compression package), static resource folder compression package (assets directory folder compression package), compilation folder compression package (lib directory folder compression package), resource folder compression package (res directory folder compression package), signature folder compression package (META-INF directory folder compression package), executable file compression package (class.dex compression package) and resource index table file compression package (resources.arsc compression package).
S203,在浏览器内核编译完成后,生成压缩包清单文件,压缩包清单文件包括压缩包的第一压缩信息。S203, after the browser kernel is compiled, a compressed package list file is generated, where the compressed package list file includes first compression information of the compressed package.
其中,第一压缩信息包括压缩后的第一语言文件的大小和名称、压缩后的第一资源文件的大小和名称、压缩后的第一动态库文件的大小和名称。压缩后的第一语言文件的大小和名称主要是class.dex文件压缩后的大小和名称。压缩后的第一资源文件的大小和名称主要包括:assets目录文件夹、res目录文件夹和resources.arsc文件,上述这些资源文件夹压缩后的大小和名称,压缩后的第一动态库文件的大小和名称,主要包括压缩后的lib目录文件夹的大小和名称。The first compression information includes the size and name of the compressed first language file, the size and name of the compressed first resource file, and the size and name of the compressed first dynamic library file. The size and name of the compressed first language file are mainly the size and name of the compressed class.dex file. The size and name of the compressed first resource file mainly include: assets directory folder, res directory folder and resources.arsc file. The compressed sizes and names of the above resource folders, and the size and name of the compressed first dynamic library file mainly include the size and name of the compressed lib directory folder.
S204,在浏览器启动过程中,获取浏览器安装目录下的已有浏览器文件的第二压缩信息,已有浏览器文件包括第二语言文件或第二资源文件或第二动态库文件。S204, during the browser startup process, obtaining second compression information of existing browser files in the browser installation directory, where the existing browser files include a second language file or a second resource file or a second dynamic library file.
S205,从压缩包清单文件中获取第一压缩信息,判断第一压缩信息和第二压缩信息是否相同。S205, obtaining the first compression information from the compression package list file, and determining whether the first compression information is the same as the second compression information.
其中,第二压缩信息包括压缩后第二语言文件的大小和名称、压缩后的第二资源文件的大小和名称、压缩后的第二动态库文件的大小和名称。第二语言文件指的是浏览器安装目录下已经存在的apk包中的Java代码文件。第二资源文件指的是浏览器安装目录下已经存在的apk包中的assets目录文件夹、res文件夹以及resources.arsc索引表文件。第二动态库文件指的是的浏览器安装目录下已经存在的apk包中lib目录文件夹。下面对步骤S204和S205进行具体说明。The second compression information includes the size and name of the compressed second language file, the size and name of the compressed second resource file, and the size and name of the compressed second dynamic library file. The second language file refers to the Java code file in the apk package that already exists in the browser installation directory. The second resource file refers to the assets directory folder, the res folder, and the resources.arsc index table file in the apk package that already exists in the browser installation directory. The second dynamic library file refers to the lib directory folder in the apk package that already exists in the browser installation directory. Steps S204 and S205 are described in detail below.
一般的,android应用的安装目录为/data/app,那么浏览器数据包,也就是apk文件存储在/data/app目录下。假如/data/app已经有个apk包,这个apk包叫做colorOS1011.apk,可以理解的是,这个apk包中文件结构和图4所示的apk包的文件结构是相同的。在浏览器启动过程中,先从/data/app目录下获取已有的colorOS1011.apk中的第二压缩信息,再从压缩包清单文件中获取colorOS1101.apk中的第一压缩信息,并比较第一压缩信息和第二压缩信息是否相同。这里的比对主要是比对第一压缩信息中的压缩后的第一语言文件的大小及名称和第二压缩信息中的第二语言文件的大小及名称,比对第一压缩信息中的压缩后的第一资源文件的大小及名称和第二压缩信息中的第二资源文件的大小及名称,以及比对第一压缩信息中的压缩后的第一动态库文件的大小及名称和第二动态库文件的大小及名称。Generally, the installation directory of the android application is /data/app, so the browser data package, that is, the apk file, is stored in the /data/app directory. If /data/app already has an apk package, this apk package is called colorOS1011.apk, it can be understood that the file structure in this apk package is the same as the file structure of the apk package shown in Figure 4. During the browser startup process, first obtain the second compressed information in the existing colorOS1011.apk from the /data/app directory, then obtain the first compressed information in colorOS1101.apk from the compressed package manifest file, and compare whether the first compressed information and the second compressed information are the same. The comparison here is mainly to compare the size and name of the compressed first language file in the first compressed information with the size and name of the second language file in the second compressed information, compare the size and name of the compressed first resource file in the first compressed information and the size and name of the second resource file in the second compressed information, and compare the size and name of the compressed first dynamic library file in the first compressed information and the size and name of the second dynamic library file.
S206,当第一压缩信息与第二压缩信息不同时,将浏览器数据包复制到浏览器安装目录下。S206: When the first compression information is different from the second compression information, copy the browser data packet to the browser installation directory.
S207,对浏览器数据包中的压缩包进行解压处理,判断解压是否成功。S207, decompressing the compressed package in the browser data package, and determining whether the decompression is successful.
S208,若解压成功,则采用浏览器文件替换已有浏览器文件。S208: If the decompression is successful, the browser file is used to replace the existing browser file.
下面对步骤S206-S208进行具体说明。Steps S206-S208 are described in detail below.
一般的,根据S205的比较结果,在第一压缩信息与第二压缩信息不同时,说明启动过程是安装了新的apk包启动的,则会将新的apk包colorOS1101.apk复制到/data/app下,然后校验apk的签名是否正确,检查apk的结构是否正常,进一步地,对apk包中的各压缩包进行解压处理。需要说明的是,由前述内容可以知道,在生成apk包的过程中是经过压缩和打包处理的,一是将各浏览器文件进行压缩得到各浏览器文件的压缩包,二是将各浏览器文件的压缩包打包至apk包中。相应地,解压过程也是先将apk包进行解压得到各浏览器文件的压缩包,再将各浏览器文件的压缩包进行解压缩处理得到各浏览器文件。另外,上述解压过程中如果涉及到加密操作,那么在进行解压时也会进行对应的解压操作。Generally, according to the comparison result of S205, when the first compression information is different from the second compression information, it means that the startup process is started by installing a new apk package, and the new apk package colorOS1101.apk will be copied to /data/app, and then the signature of the apk will be verified to be correct, and the structure of the apk will be checked to be normal. Further, each compressed package in the apk package will be decompressed. It should be noted that, from the above content, it can be known that in the process of generating the apk package, it is compressed and packaged. First, each browser file is compressed to obtain a compressed package of each browser file, and second, the compressed package of each browser file is packaged into the apk package. Correspondingly, the decompression process is also to first decompress the apk package to obtain the compressed package of each browser file, and then decompress the compressed package of each browser file to obtain each browser file. In addition, if the above decompression process involves encryption operation, then the corresponding decompression operation will also be performed during decompression.
其中,在将apk包解压得到各浏览器的压缩包的过程中,会校验apk中的dex文件,确定dex文件没有被损坏后,也就是解压成功,再把dex优化成odex,使得应用程序启动时间加快,同时在/data/data目录下建立与apk包名相同的文件夹,如果apk中有lib库,系统会判断这些so库的名字,查看是否以lib开头,是否以.so结尾,再根据CPU的架构解压对应的so库到/data/data/packagename/lib下。Among them, in the process of decompressing the apk package to obtain the compressed packages of each browser, the dex file in the apk will be checked. After confirming that the dex file is not damaged, that is, the decompression is successful, the dex will be optimized to odex, which will speed up the startup time of the application. At the same time, a folder with the same name as the apk package will be created in the /data/data directory. If there is a lib library in the apk, the system will determine the name of these so libraries to see whether it starts with lib and ends with .so, and then decompress the corresponding so library to /data/data/packagename/lib according to the CPU architecture.
S209,将第一压缩信息作为浏览器安装目录下已有浏览器文件的第二压缩信息。S209: Use the first compressed information as second compressed information of the existing browser file in the browser installation directory.
在获取到初始的各浏览器文件之后,相应地,将第二压缩信息替换为第一压缩信息,由于浏览器当前是安装新的apk包进行启动,启动过程中所使用的各浏览器文件和上一次使用的各浏览器文件是不同的,对应地,在这一次启动过程中所使用的各浏览器文件的对应的各压缩包的压缩信息和上一次所运行所使用的各浏览器文件对应的各压缩包的压缩信息也是不同的,那么需要将这一次启动所使用的第一压缩信息作为已有浏览器文件的第二压缩信息。After obtaining the initial browser files, the second compression information is replaced with the first compression information accordingly. Since the browser is currently installing a new apk package for startup, the browser files used in the startup process are different from the browser files used last time. Correspondingly, the compression information of the corresponding compressed packages of the browser files used in this startup process is different from the compression information of the corresponding compressed packages of the browser files used in the last run. Therefore, the first compression information used for this startup needs to be used as the second compression information of the existing browser file.
S210,若解压失败,则继续使用浏览器安装目录下的已有浏览器文件。S210: If the decompression fails, continue to use the existing browser files in the browser installation directory.
根据一些实施例,在将apk包进行解压缩得到各浏览器文件也可能出现解压失败的问题,可能是将apk包解压缩得到各浏览器文件的压缩包出现解压失败的情况,也可能是成功得到各浏览器文件的压缩包,将各浏览器文件的压缩包进行解压得到各浏览器文件时出现解压失败的情况。那么不管针对上述哪一种解压缩失败的情况,可以继续使用浏览器安装目录下的已有浏览器文件,也就是浏览器在上一次运行过程所使用的已有浏览器文件,也即上一次运行过程中所使用的的apk包中的浏览器文件。According to some embodiments, when decompressing the apk package to obtain the browser files, the decompression failure may occur. It may be that the compressed package of the browser files obtained by decompressing the apk package fails to be decompressed, or it may be that the compressed package of the browser files is successfully obtained, and the decompression failure occurs when the compressed package of the browser files is decompressed to obtain the browser files. Then, regardless of which of the above decompression failures occurs, the existing browser files in the browser installation directory can continue to be used, that is, the existing browser files used by the browser in the last running process, that is, the browser files in the apk package used in the last running process.
S211,当所有的压缩包解压完成后,启动内核加载程序,加载浏览器文件或已有浏览器文件,执行浏览器内核初始化操作。S211, when all compressed packages are decompressed, the kernel loader is started, the browser file or the existing browser file is loaded, and the browser kernel initialization operation is performed.
一般的,在各压缩包都解压成功之后,启动内核加载程序,加载各浏览器文件,基于各浏览器文件执行浏览器内核初始化操作。在各压缩包没有全部解压成功的情况下,包括部分解压成功部分解压失败或全部解压失败的情况下,加载已有浏览器文件,基于已有浏览器文件执行浏览器内核初始化操作。Generally, after all compressed packages are successfully decompressed, the kernel loader is started to load all browser files, and the browser kernel initialization operation is performed based on the browser files. In the case that all compressed packages are not successfully decompressed, including the case that some are successfully decompressed, some are failed to be decompressed, or all are failed to be decompressed, the existing browser files are loaded, and the browser kernel initialization operation is performed based on the existing browser files.
S212,当第一压缩信息与第二压缩信息相同时,启动内核加载程序,加载已有浏览器文件,执行浏览器内核初始化操作。S212: When the first compression information is identical to the second compression information, a kernel loader is started to load the existing browser file and perform a browser kernel initialization operation.
一般的,根据S205的比较结果,在第一压缩信息与第二压缩信息相同时,说明启动过程并没有安装新的apk包启动,是使用之前的apk包进行启动,也就是基于上一次运行所使用的apk包进行启动的。可以理解的是,本申请实施例的步骤是一个连续的过程,在每次安装了新的apk包之后,都会用新的apk包替换旧的apk包,在下一次的启动过程中,本次启动所使用的新的apk包就成为了已经存在的apk包。基于已经存在的apk进行启动,会校验apk的签名是否正确,检查apk的结构是否正常,进一步地,对apk包中的各压缩包进行解压处理。需要说明的是,在生成apk包的过程中是经过压缩和打包处理的,一是将各浏览器文件进行压缩得到各浏览器文件的压缩包,二是将各浏览器文件的压缩包打包至apk包中。相应地,解压过程也是先将apk包进行解压得到各浏览器文件的压缩包,再将各浏览器文件的压缩包进行解压缩处理得到各浏览器文件。另外,上述解压过程中如果涉及到加密操作,那么在进行解压时也会进行对应的解压操作。Generally, according to the comparison result of S205, when the first compressed information is the same as the second compressed information, it means that the startup process does not install a new apk package to start, but uses the previous apk package to start, that is, it is started based on the apk package used in the previous operation. It can be understood that the steps of the embodiment of the present application are a continuous process. After each new apk package is installed, the old apk package will be replaced by the new apk package. In the next startup process, the new apk package used in this startup becomes the existing apk package. When starting based on the existing apk, it will verify whether the signature of the apk is correct and whether the structure of the apk is normal. Further, the compressed packages in the apk package are decompressed. It should be noted that in the process of generating the apk package, it is compressed and packaged. First, each browser file is compressed to obtain the compressed package of each browser file, and second, the compressed package of each browser file is packaged into the apk package. Correspondingly, the decompression process is also to first decompress the apk package to obtain the compressed package of each browser file, and then decompress the compressed package of each browser file to obtain each browser file. In addition, if the above decompression process involves encryption operations, corresponding decompression operations will also be performed during decompression.
其中,在将apk包解压得到各浏览器的压缩包的过程中,会校验apk中的dex文件,确定dex文件没有被损坏后,也就是解压成功,再把dex优化成odex,使得应用程序启动时间加快,同时在/data/data目录下建立与apk包名相同的文件夹,如果apk中有lib库,系统会判断这些so库的名字,查看是否以lib开头,是否以.so结尾,再根据CPU的架构解压对应的so库到/data/data/packagename/lib下。Among them, in the process of decompressing the apk package to obtain the compressed packages of each browser, the dex file in the apk will be checked. After confirming that the dex file is not damaged, that is, the decompression is successful, the dex will be optimized to odex, which will speed up the startup time of the application. At the same time, a folder with the same name as the apk package will be created in the /data/data directory. If there is a lib library in the apk, the system will determine the name of these so libraries to see whether it starts with lib and ends with .so, and then decompress the corresponding so library to /data/data/packagename/lib according to the CPU architecture.
本申请实施例的方案在执行时,在浏览器内核编译过程中,首先判断所生成的浏览器文件的容量值是否大于或等于容量阈值,若是,则将浏览器文件进行压缩处理,生成浏览器文件对应的压缩包,将压缩包打包至浏览器数据包中。在浏览器内核编译完成后,生成压缩包清单文件,压缩包清单文件包括压缩包的第一压缩信息。进一步地,在浏览器启动过程中,获取浏览器安装目录下的已有浏览器文件的第二压缩信息,判断第一压缩信息和第二压缩信息是否相同。若二者不同,则基于上述新生成的浏览器数据包进行浏览器文件的更新,完成浏览器的启动过程;若二者相同,使用已有的浏览器数据包完成浏览器的启动过程。通过本申请的方法,在浏览器中的浏览器文件的容量值超过容量阈值时,才将各浏览器文件先进行压缩处理,能够保证在各浏览器文件容量过大时,并且在将各浏览器文件打包至apk包之前减小各浏览器文件的容量。进一步地,再将各浏览器文件的压缩包打包至apk包,更加减小了浏览器apk包的容量,那么进一步地可以提高浏览器的升级成功率,使得浏览器的升级成功率的提高更加明显。When the scheme of the embodiment of the present application is executed, during the browser kernel compilation process, it is first determined whether the capacity value of the generated browser file is greater than or equal to the capacity threshold. If so, the browser file is compressed, a compressed package corresponding to the browser file is generated, and the compressed package is packaged into the browser data package. After the browser kernel compilation is completed, a compressed package list file is generated, and the compressed package list file includes the first compression information of the compressed package. Further, during the browser startup process, the second compression information of the existing browser file in the browser installation directory is obtained, and it is determined whether the first compression information and the second compression information are the same. If the two are different, the browser file is updated based on the newly generated browser data package to complete the browser startup process; if the two are the same, the existing browser data package is used to complete the browser startup process. Through the method of the present application, when the capacity value of the browser file in the browser exceeds the capacity threshold, each browser file is first compressed, which can ensure that when the capacity of each browser file is too large, and before each browser file is packaged into the apk package, the capacity of each browser file is reduced. Furthermore, the compressed packages of the browser files are packaged into the apk package, which further reduces the capacity of the browser apk package, and thus the upgrade success rate of the browser can be further improved, making the improvement of the upgrade success rate of the browser more obvious.
请参见图5,为本申请实施例提供的一种浏览器打包装置的结构示意图。该浏览器打包装置500可以通过软件、硬件或者两者的结合实现成为服务器的全部或一部分。装置500包括:Please refer to FIG5, which is a schematic diagram of the structure of a browser packaging device provided in an embodiment of the present application. The browser packaging device 500 can be implemented as all or part of a server through software, hardware, or a combination of both. The device 500 includes:
第一压缩模块510,用于在浏览器内核编译过程中,对生成的浏览器文件进行压缩处理,生成所述浏览器文件对应的压缩包,所述浏览器文件包括第一语言文件或第一资源文件或第一动态库文件;The first compression module 510 is used to compress the generated browser file during the browser kernel compilation process to generate a compressed package corresponding to the browser file, wherein the browser file includes a first language file or a first resource file or a first dynamic library file;
第二压缩模块520,用于将所述压缩包打包至浏览器数据包中;A second compression module 520, used for packaging the compressed package into a browser data package;
可选地,装置500还包括:Optionally, the apparatus 500 further includes:
升级模块,用于在所述浏览器启动过程中,基于所述浏览器数据包对所述浏览器进行升级。An upgrade module is used to upgrade the browser based on the browser data packet during the browser startup process.
可选地,第一压缩模块510包括:Optionally, the first compression module 510 includes:
容量检测单元,用于判断所生成的浏览器文件的容量值是否大于或等于容量阈值;A capacity detection unit, used to determine whether the capacity value of the generated browser file is greater than or equal to a capacity threshold;
资源压缩单元,用于在浏览器文件的容量值是否大于或等于容量阈值时,则将所述浏览器文件进行压缩处理,生成所述浏览器文件对应的压缩包。The resource compression unit is used to compress the browser file and generate a compression package corresponding to the browser file when the capacity value of the browser file is greater than or equal to the capacity threshold.
可选地,装置500还包括:Optionally, the apparatus 500 further includes:
压缩包清单文件生成单元,用于在所述浏览器内核编译完成后,生成压缩包清单文件,所述压缩包清单文件包括所述压缩包的第一压缩信息;A compressed package manifest file generating unit, configured to generate a compressed package manifest file after the browser kernel is compiled, wherein the compressed package manifest file includes first compression information of the compressed package;
升级单元,用于在所述浏览器启动过程中,基于所述浏览器数据包以及所述压缩包清单文件对所述浏览器进行升级。An upgrading unit is used to upgrade the browser based on the browser data packet and the compressed package manifest file during the browser startup process.
可选地,升级单元包括:Optionally, the upgrade unit includes:
第一升级单元,用于获取所述浏览器安装目录下的已有浏览器文件的第二压缩信息,所述已有浏览器文件包括第二语言文件或第二资源文件或第二动态库文件;A first upgrading unit, configured to obtain second compressed information of existing browser files in the browser installation directory, wherein the existing browser files include a second language file or a second resource file or a second dynamic library file;
第二升级单元,用于从所述压缩包清单文件中获取所述第一压缩信息;A second upgrading unit, configured to obtain the first compression information from the compression package list file;
第三升级单元,用于当所述第一压缩信息与所述第二压缩信息不同时,将所述浏览器数据包复制到所述浏览器安装目录下;A third upgrading unit, configured to copy the browser data packet to the browser installation directory when the first compression information is different from the second compression information;
第四升级单元,用于对所述浏览器数据包中的所述压缩包进行解压处理,若解压成功,则采用所述浏览器文件替换所述已有浏览器文件。The fourth upgrading unit is used to decompress the compressed package in the browser data package, and if the decompression is successful, use the browser file to replace the existing browser file.
可选地,升级单元还包括:Optionally, the upgrading unit further includes:
第五单元,用于将所述第一压缩信息作为所述浏览器安装目录下已有浏览器文件的第二压缩信息。The fifth unit is used to use the first compressed information as the second compressed information of the existing browser file in the browser installation directory.
可选地,升级单元还包括:Optionally, the upgrading unit further includes:
第六单元,用于在解压失败时,继续使用所述浏览器安装目录下的所述已有浏览器文件。The sixth unit is used for continuing to use the existing browser file in the browser installation directory when the decompression fails.
可选地,升级单元还包括:Optionally, the upgrading unit further includes:
第七单元,用于在所有的所述压缩包解压完成后,启动内核加载程序,加载各所述浏览器文件和/或所述已有浏览器文件,执行浏览器内核初始化操作。The seventh unit is used to start the kernel loader after all the compressed packages are decompressed, load each of the browser files and/or the existing browser files, and perform the browser kernel initialization operation.
可选地,升级单元还包括:Optionally, the upgrading unit further includes:
第八单元,用于在所述第一压缩信息与所述第二压缩信息相同时,启动内核加载程序,加载所述已有浏览器文件,执行浏览器内核初始化操作。The eighth unit is used to start a kernel loader, load the existing browser file, and perform a browser kernel initialization operation when the first compression information is the same as the second compression information.
本申请实施例的方案在执行时,在浏览内核编译过程中,将生成的浏览器文件进行压缩,这些浏览器文件包括第一语言文件或第一资源文件或第一动态库文件,然后再将这些浏览器文件的压缩包打包至浏览器数据包中。通过本申请的方法,将浏览器中的各种浏览器文件进行压缩和打包处理,减小了浏览器数据包的容量。When the solution of the embodiment of the present application is executed, during the browser kernel compilation process, the generated browser files are compressed, and these browser files include the first language file or the first resource file or the first dynamic library file, and then the compressed packages of these browser files are packaged into the browser data packet. Through the method of the present application, various browser files in the browser are compressed and packaged, reducing the capacity of the browser data packet.
请参见图6,其示出了本申请一个示例性实施例提供的终端的结构方框图。本申请中的终端可以包括一个或多个如下部件:处理器610、存储器620、输入装置630、输出装置640和总线650。处理器610、存储器620、输入装置630和输出装置640之间可以通过总线650连接。Please refer to Figure 6, which shows a block diagram of a terminal provided by an exemplary embodiment of the present application. The terminal in the present application may include one or more of the following components: a processor 610, a memory 620, an input device 630, an output device 640, and a bus 650. The processor 610, the memory 620, the input device 630, and the output device 640 may be connected via a bus 650.
处理器610可以包括一个或者多个处理核心。处理器610利用各种接口和线路连接整个终端内的各个部分,通过运行或执行存储在存储器620内的指令、程序、代码集或指令集,以及调用存储在存储器620内的数据,执行终端的各种功能和处理数据。可选地,处理器610可以采用数字信号处理(digital signal processing,DSP)、现场可编程门阵列(field-programmable gate array,FPGA)、可编程逻辑阵列(programmable logicArray,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(centralprocessing unit,CPU)、图像处理器(graphics processing unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器610中,单独通过一块通信芯片进行实现。The processor 610 may include one or more processing cores. The processor 610 uses various interfaces and lines to connect various parts of the entire terminal, and executes various functions of the terminal and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 620, and calling data stored in the memory 620. Optionally, the processor 610 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 610, but may be implemented separately through a communication chip.
存储器620可以包括随机存储器(random Access Memory,RAM),也可以包括只读存储器(read-only memory,ROM)。可选地,该存储器620包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器620可用于存储指令、程序、代码、代码集或指令集。存储器620可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等,该操作系统可以是安卓(Android)系统(包括基于Android系统深度开发的系统)或其它系统。存储数据区还可以存储终端在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 620 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 620 includes a non-transitory computer-readable storage medium. The memory 620 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 620 may include a storage program area and a storage data area, wherein the storage program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The operating system may be an Android system (including a system deeply developed based on the Android system) or other systems. The storage data area may also store data (such as a phone book, audio and video data, chat record data) created by the terminal during use.
参见图7所示,存储器620可分为操作系统空间和用户空间,操作系统即运行于操作系统空间,原生及第三方应用程序即运行于用户空间。为了保证不同第三方应用程序均能够达到较好的运行效果,操作系统针对不同第三方应用程序为其分配相应的系统资源。然而,同一第三方应用程序中不同应用场景对系统资源的需求也存在差异,比如,在本地资源加载场景下,第三方应用程序对磁盘读取速度的要求较高;在动画渲染场景下,第三方应用程序则对GPU性能的要求较高。而操作系统与第三方应用程序之间相互独立,操作系统往往不能及时感知第三方应用程序当前的应用场景,导致操作系统无法根据第三方应用程序的具体应用场景进行针对性的系统资源适配。As shown in FIG. 7 , the memory 620 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, different application scenarios in the same third-party application also have different requirements for system resources. For example, in the local resource loading scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and the third-party application are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.
为了使操作系统能够区分第三方应用程序的具体应用场景,需要打通第三方应用程序与操作系统之间的数据通信,使得操作系统能够随时获取第三方应用程序当前的场景信息,进而基于当前场景进行针对性的系统资源适配。In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
以操作系统为Android系统为例,存储器620中存储的程序和数据如图8所示,存储器620中可存储有Linux内核层820、系统运行时库层840、应用框架层860和应用层880,其中,Linux内核层820、系统运行库层840和应用框架层860属于操作系统空间,应用层880属于用户空间。Linux内核层820为终端的各种硬件提供了底层的驱动,如显示驱动、音频驱动、摄像头驱动、蓝牙驱动、Wi-Fi驱动、电源管理等。系统运行库层840通过一些C/C++库来为Android系统提供了主要的特性支持。如SQLite库提供了数据库的支持,OpenGL/ES库提供了3D绘图的支持,Webkit库提供了浏览器内核的支持等。在系统运行时库层840中还提供有安卓运行时库(Android runtime),它主要提供了一些核心库,能够允许开发者使用Java语言来编写Android应用。应用框架层860提供了构建应用程序时可能用到的各种API,开发者也可以通过使用这些API来构建自己的应用程序,比如活动管理、窗口管理、视图管理、通知管理、内容提供者、包管理、通话管理、资源管理、定位管理。应用层880中运行有至少一个应用程序,这些应用程序可以是操作系统自带的原生应用程序,比如联系人程序、短信程序、时钟程序、相机应用等;也可以是第三方开发者所开发的第三方应用程序,比如游戏类应用程序、即时通信程序、相片美化程序、购物程序等。Taking the operating system as the Android system as an example, the programs and data stored in the memory 620 are shown in Figure 8. The memory 620 may store a Linux kernel layer 820, a system runtime library layer 840, an application framework layer 860, and an application layer 880, wherein the Linux kernel layer 820, the system runtime library layer 840, and the application framework layer 860 belong to the operating system space, and the application layer 880 belongs to the user space. The Linux kernel layer 820 provides underlying drivers for various hardware of the terminal, such as display drivers, audio drivers, camera drivers, Bluetooth drivers, Wi-Fi drivers, power management, etc. The system runtime library layer 840 provides the main feature support for the Android system through some C/C++ libraries. For example, the SQLite library provides database support, the OpenGL/ES library provides 3D drawing support, and the Webkit library provides browser kernel support, etc. The Android runtime library (Android runtime) is also provided in the system runtime library layer 840, which mainly provides some core libraries that allow developers to use the Java language to write Android applications. The application framework layer 860 provides various APIs that may be used when building applications. Developers can also use these APIs to build their own applications, such as activity management, window management, view management, notification management, content provider, package management, call management, resource management, and location management. At least one application runs in the application layer 880. These applications can be native applications that come with the operating system, such as contact applications, text messaging applications, clock applications, camera applications, etc.; they can also be third-party applications developed by third-party developers, such as game applications, instant messaging applications, photo beautification applications, shopping applications, etc.
其中,输入装置630用于接收输入的指令或数据,输入装置630包括但不限于键盘、鼠标、摄像头、麦克风或触控设备。输出装置640用于输出指令或数据,输出装置640包括但不限于显示设备和扬声器等。在一个示例中,输入装置630和输出装置640可以合设,输入装置630和输出装置640为触摸显示屏,该触摸显示屏用于接收用户使用手指、触摸笔等任何适合的物体在其上或附近的触摸操作,以及显示各个应用程序的用户界面。触摸显示屏通常设置在终端的前面板。触摸显示屏可被设计成为全面屏、曲面屏或异型屏。触摸显示屏还可被设计成为全面屏与曲面屏的结合,异型屏与曲面屏的结合,本申请实施例对此不加以限定。Among them, the input device 630 is used to receive input instructions or data, and the input device 630 includes but is not limited to a keyboard, a mouse, a camera, a microphone or a touch device. The output device 640 is used to output instructions or data, and the output device 640 includes but is not limited to a display device and a speaker. In one example, the input device 630 and the output device 640 can be combined, and the input device 630 and the output device 640 are a touch display screen, which is used to receive touch operations on or near it by a user using any suitable object such as a finger or a touch pen, and to display the user interface of each application. The touch display screen is usually set on the front panel of the terminal. The touch display screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.
除此之外,本领域技术人员可以理解,上述附图所示出的终端的结构并不构成对终端的限定,终端可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。比如,终端中还包括射频电路、输入单元、传感器、音频电路、无线保真(wirelessfidelity,WiFi)模块、电源、蓝牙模块等部件,在此不再赘述。In addition, those skilled in the art will appreciate that the structure of the terminal shown in the above drawings does not constitute a limitation on the terminal, and the terminal may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the terminal also includes a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, a Bluetooth module, and other components, which will not be described in detail here.
在本申请实施例中,各步骤的执行主体可以是上文介绍的终端。可选地,各步骤的执行主体为终端的操作系统。操作系统可以是安卓系统,或者其它操作系统,本申请实施例对此不作限定。In the embodiment of the present application, the execution subject of each step may be the terminal described above. Optionally, the execution subject of each step is the operating system of the terminal. The operating system may be an Android system, or other operating systems, which is not limited in the embodiment of the present application.
本申请实施例的终端,其上还可以安装有显示设备,显示设备可以是各种能实现显示功能的设备,例如:阴极射线管显示器(cathode ray tubedisplay,简称CR)、发光二极管显示器(light-emitting diode display,简称LED)、电子墨水屏、液晶显示屏(liquidcrystal display,简称LCD)、等离子显示面板(plasma display panel,简称PDP)等。用户可以利用终端601上的显示设备,来查看显示的文字、图像、视频等信息。所述终端可以是智能手机、平板电脑、游戏设备、AR(Augmented Reality,增强现实)设备、汽车、数据存储装置、音频播放装置、视频播放装置、笔记本、桌面计算设备、可穿戴设备诸如电子手表、电子眼镜、电子头盔、电子手链、电子项链、电子衣物等设备。The terminal of the embodiment of the present application may also be equipped with a display device, which may be any device capable of realizing a display function, such as a cathode ray tube display (CR), a light-emitting diode display (LED), an electronic ink screen, a liquid crystal display (LCD), a plasma display panel (PDP), etc. The user may use the display device on the terminal 601 to view displayed text, images, videos and other information. The terminal may be a smart phone, a tablet computer, a gaming device, an AR (Augmented Reality) device, a car, a data storage device, an audio playback device, a video playback device, a notebook, a desktop computing device, a wearable device such as an electronic watch, an electronic glasses, an electronic helmet, an electronic bracelet, an electronic necklace, electronic clothing and other devices.
在图6所示的终端中,处理器610可以用于调用存储器620中存储的应用程序,并具体执行本申请实施例的浏览器打包方法。In the terminal shown in FIG. 6 , the processor 610 may be used to call an application program stored in the memory 620 and specifically execute the browser packaging method of the embodiment of the present application.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本申请所必须的。It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
以上为对本申请所提供的一种浏览器打包方法、装置、存储介质以及终端的描述,对于本领域的技术人员,依据本申请实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。The above is a description of a browser packaging method, device, storage medium and terminal provided by the present application. For technicians in this field, according to the ideas of the embodiments of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present application.
本申请实施例还提供了一种计算机存储介质,所述计算机存储介质可以存储有多条指令,所述指令适于由处理器加载并执行如上述的方法步骤,具体执行过程可以参见图1和图2所示实施例的具体说明,在此不进行赘述。The embodiment of the present application also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded by a processor and executing the method steps as described above. The specific execution process can be found in the specific description of the embodiments shown in Figures 1 and 2, and will not be repeated here.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体或随机存储记忆体等。Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
以上所揭露的仅为本申请较佳实施例而已,当然不能以此来限定本申请之权利范围,因此依本申请权利要求所作的等同变化,仍属本申请所涵盖的范围。The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011556869.6A CN112579072B (en) | 2020-12-21 | 2020-12-21 | Browser packaging method and device, storage medium and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011556869.6A CN112579072B (en) | 2020-12-21 | 2020-12-21 | Browser packaging method and device, storage medium and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112579072A CN112579072A (en) | 2021-03-30 |
CN112579072B true CN112579072B (en) | 2024-07-02 |
Family
ID=75139925
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011556869.6A Active CN112579072B (en) | 2020-12-21 | 2020-12-21 | Browser packaging method and device, storage medium and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112579072B (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103955375A (en) * | 2014-05-21 | 2014-07-30 | 北京安兔兔科技有限公司 | Generation method for application installation file and starting method and device for application |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6473609B1 (en) * | 1995-12-11 | 2002-10-29 | Openwave Systems Inc. | Method and architecture for interactive two-way communication devices to interact with a network |
CN103699410B (en) * | 2013-12-20 | 2017-05-24 | 北京奇虎科技有限公司 | Method and device for updating application programs |
CN109522020A (en) * | 2018-09-29 | 2019-03-26 | 中国平安人寿保险股份有限公司 | Android system installation kit method for reducing body weight, device, terminal and storage medium |
-
2020
- 2020-12-21 CN CN202011556869.6A patent/CN112579072B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103955375A (en) * | 2014-05-21 | 2014-07-30 | 北京安兔兔科技有限公司 | Generation method for application installation file and starting method and device for application |
Also Published As
Publication number | Publication date |
---|---|
CN112579072A (en) | 2021-03-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108536524B (en) | Resource update method, device, terminal and storage medium | |
CN110049456B (en) | Method and device for displaying rich media on mobile terminal and mobile terminal | |
CN109471626B (en) | Page logic structure, page generation method, page data processing method and device | |
US20130067459A1 (en) | Order-Independent Deployment Collections with Dependency Package Identifiers | |
CN109933960B (en) | Service invocation control method, service invocation method, device and terminal | |
CN108647032A (en) | Using loading method and device, computer installation and computer readable storage medium | |
US10404568B2 (en) | Agent manager for distributed transaction monitoring system | |
CN113138768B (en) | Application package generation method, device, electronic device and readable storage medium | |
CN110489162B (en) | Method, device, medium and equipment for simplifying installation package SO (storage and retrieval) file | |
CN110928571A (en) | Business program development method and device | |
CN112506878B (en) | File processing method, device, storage medium and electronic device | |
EP3872630A2 (en) | Request processing method and apparatus, electronic device, and computer storage medium | |
WO2023066246A1 (en) | Method and system for installing application on cloudphone, and client cloudphone | |
CN108733370B (en) | Stylized display method, device, terminal and storage medium of native APP | |
CN114547604A (en) | Application detection method and device, storage medium and electronic equipment | |
CN113268221B (en) | File matching method, device, storage medium and computer equipment | |
CN112579072B (en) | Browser packaging method and device, storage medium and terminal | |
CN110780913A (en) | Cross-machine type differential upgrading method and system, storage medium and electronic equipment | |
CN112799687B (en) | Data processing method and device, storage medium and computer equipment | |
CN116301845A (en) | Form generation method and device and electronic equipment | |
CN113448585B (en) | Compiling method and device of thread pool, electronic equipment and storage medium | |
CN115509634A (en) | Input method configuration method, character input method, device and medium | |
CN112752163B (en) | Method, device and television set for configuring default language | |
CN114489697A (en) | Application program installation method and device | |
CN111008006A (en) | RFC file modification method and device, storage medium and terminal |
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 |