[go: up one dir, main page]

CN109284142A - File preloading method and device, electronic equipment and computer readable storage medium - Google Patents

File preloading method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN109284142A
CN109284142A CN201810928017.1A CN201810928017A CN109284142A CN 109284142 A CN109284142 A CN 109284142A CN 201810928017 A CN201810928017 A CN 201810928017A CN 109284142 A CN109284142 A CN 109284142A
Authority
CN
China
Prior art keywords
file
application
application program
memory
program
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.)
Pending
Application number
CN201810928017.1A
Other languages
Chinese (zh)
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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201810928017.1A priority Critical patent/CN109284142A/en
Publication of CN109284142A publication Critical patent/CN109284142A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application relates to the technical field of terminals and discloses a file preloading method, a file preloading device, electronic equipment and a computer readable storage medium. The file preloading method comprises the following steps: when an opening instruction of an application program is detected, searching a file corresponding to the application program according to a corresponding relation between a pre-stored file and the application program; the file is used in the running process of the application program; and loading the searched corresponding file into a memory, and directly reading the file loaded in the memory in the running process of the application program. The method and the device can improve the smoothness of the operation of the application program.

Description

文件预加载方法、装置、电子设备及计算机可读存储介质File preloading method, apparatus, electronic device, and computer-readable storage medium

技术领域technical field

本申请实施方式涉及终端技术领域,特别涉及文件预加载方法、装置、电子设备及计算机可读存储介质。The embodiments of the present application relate to the field of terminal technologies, and in particular, to a file preloading method, apparatus, electronic device, and computer-readable storage medium.

背景技术Background technique

随着手机、平板电脑等终端的普及,终端上APP(application,应用程序)的种类也越来越多。应用程序在运行时,需要从外存中加载一定量的数据文件或者配置文件至系统内存中,然后再从内存中读取上述加载的文件进行运行。With the popularization of terminals such as mobile phones and tablet computers, there are more and more types of APPs (applications) on the terminals. When the application is running, it needs to load a certain amount of data files or configuration files from the external memory into the system memory, and then read the above loaded files from the memory to run.

发明内容SUMMARY OF THE INVENTION

本申请实施方式的目的在于提供一种文件预加载方法、装置、电子设备及计算机可读存储介质,可以提升应用程序运行的流畅度。The purpose of the embodiments of the present application is to provide a file preloading method, apparatus, electronic device, and computer-readable storage medium, which can improve the smoothness of running an application program.

本申请的实施方式提供了一种文件预加载方法,包括:在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件;其中,所述文件为所述应用程序运行过程中使用到的文件;将查找出的所述对应的文件加载至内存中,并在应用程序的运行过程中直接读取加载在所述内存中的文件。An embodiment of the present application provides a file preloading method, including: when an application program opening instruction is detected, searching for a file corresponding to the application program according to a pre-stored correspondence between the file and the application program; wherein, The file is a file used in the running process of the application program; the corresponding file found out is loaded into the memory, and the file loaded in the memory is directly read during the running process of the application program.

本申请的实施方式还提供了一种文件预加载装置,包括:查找模块,用于在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件;其中,所述文件为所述应用程序运行过程中使用到的文件;预加载模块,用于将所述查找模块查找出的所述对应的文件加载至内存中;运行模块,用于在运行应用程序的过程中直接读取加载在所述内存中的文件。Embodiments of the present application further provide a file preloading device, including: a search module, configured to search for the application program according to the pre-stored correspondence between the file and the application program when an application program opening instruction is detected A corresponding file; wherein, the file is a file used in the running process of the application; a preload module is used to load the corresponding file found by the search module into the memory; an operation module is used to load In the process of running the application program, the file loaded in the memory is directly read.

本申请的实施方式还提供了一种电子设备,包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上述文件预加载方法。Embodiments of the present application also provide an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by at least one processor. A processor executes to enable at least one processor to execute the above-described file preloading method.

本申请的实施方式还提供了一种计算机可读存储介质,存储有计算机程序,该计算机程序被处理器执行时实现上述文件预加载方法。Embodiments of the present application further provide a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned file preloading method is implemented.

本申请实施方式通过在检测到有应用程序被打开时,根据被打开应用程序和预先存储的文件和应用程序的对应关系,查找出与被打开的应用程序对应的文件,将查找出的文件加载至内存中。也就是说,在应用程序启动时,将该应用程序在运行过程中需使用到的文件加载至内存,并在被打开的应用程序的运行过程中直接读取加载在所述内存中的文件,可以提升应用程序运行的流畅度。In the embodiment of the present application, when it is detected that an application program is opened, according to the corresponding relationship between the opened application program and the pre-stored file and the application program, the file corresponding to the opened application program is found, and the found file is loaded. into memory. That is to say, when the application program starts, the files that the application program needs to use during the running process are loaded into the memory, and the files loaded in the memory are directly read during the running process of the opened application program, It can improve the smoothness of application running.

附图说明Description of drawings

一个或多个实施方式通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施方式的限定。One or more embodiments are exemplified by the pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments.

图1是本申请第一实施方式中文件预加载方法的流程图;FIG. 1 is a flowchart of a file preloading method in the first embodiment of the present application;

图2是本申请第一实施方式中安卓系统构架图;Fig. 2 is the Android system framework diagram in the first embodiment of the present application;

图3是本申请第二实施方式中文件预加载方法的流程图;3 is a flowchart of a file preloading method in the second embodiment of the present application;

图4是本申请第二实施方式中安卓系统构架图、内存和外存的结构框架图;FIG. 4 is an Android system architecture diagram, a structural framework diagram of a memory and an external memory in the second embodiment of the present application;

图5是本申请第三实施方式中文件预加载方法的流程图;5 is a flowchart of a file preloading method in a third embodiment of the present application;

图6是本申请第四实施方式中文件预加载装置的结构框图;6 is a structural block diagram of a file preloading apparatus in a fourth embodiment of the present application;

图7是本申请第五实施方式中文件预加载装置的结构框图;7 is a structural block diagram of a file preloading apparatus in a fifth embodiment of the present application;

图8是本申请第六实施方式中文件预加载装置的结构框图;8 is a structural block diagram of a file preloading apparatus in a sixth embodiment of the present application;

图9是本申请第七实施方式中提供的电子设备的结构示意图。FIG. 9 is a schematic structural diagram of an electronic device provided in a seventh embodiment of the present application.

具体实施方式Detailed ways

为使本申请实施方式的目的、技术方案和优点更加清楚,下面将结合附图对本申请的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本申请各实施方式中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。In order to make the objectives, technical solutions and advantages of the embodiments of the present application more clear, each embodiment of the present application will be described in detail below with reference to the accompanying drawings. However, those of ordinary skill in the art can understand that, in the various embodiments of the present application, many technical details are provided for readers to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can be realized.

本申请的第一实施方式涉及一种文件预加载方法。本申请实施方式可以但不限于基于电子设备进行实施,电子设备可以为手机、电脑、平板电脑、智能电视等终端。应用程序在运行时,需要读取数据文件和/或配置文件进行运行。本实施方式的文件包括数据文件和/或配置文件。其中,数据文件中可以但不限于包括应用数据。The first embodiment of the present application relates to a file preloading method. The embodiments of the present application may be implemented based on, but not limited to, electronic devices, and the electronic devices may be terminals such as mobile phones, computers, tablet computers, and smart TVs. When the application is running, it needs to read the data file and/or the configuration file to run. The files of this embodiment include data files and/or configuration files. Wherein, the data file may include, but is not limited to, application data.

下面对本实施方式的文件预加载方法的实现细节进行具体的说明,以下内容仅为方便理解提供的实现细节,并非限定为实施本方案的必须。The implementation details of the file preloading method of this embodiment will be specifically described below. The following content is only provided for the convenience of understanding, and is not limited to the implementation of this solution.

如图1所示,文件预加载方法包括:As shown in Figure 1, the file preloading method includes:

步骤101,预先在数据库中存储文件和应用程序的对应关系。其中,与应用程序对应的文件,为该应用程序运行过程中需使用到的文件。例如,一个应用程序运行过程中会使用到数据文件或者配置文件。数据文件可以是图像、文本、音频、视频等各种文件;配置文件可以是程序项目、屏幕颜色、网络连接、打印机连接、鼠标设置及窗口的大小和位置等各种文件。终端设备可以从网络侧的服务器获取到文件和应用程序的对应关系,并存储到本地的数据库中。而且,在实际应用中,还可以与网络侧的服务器进行同步,以更新保存的文件和应用程序的对应关系。Step 101: Store the correspondence between the file and the application in the database in advance. The file corresponding to the application is a file that needs to be used during the running of the application. For example, a data file or configuration file is used during the operation of an application. Data files can be various files such as images, text, audio, video, etc.; configuration files can be various files such as program items, screen colors, network connections, printer connections, mouse settings, and window size and position. The terminal device can obtain the corresponding relationship between the file and the application program from the server on the network side, and store it in the local database. Moreover, in practical application, it can also be synchronized with the server on the network side to update the correspondence between the saved file and the application program.

在本实施方式中,可以在数据库中存储文件的指示信息和应用程序包名的对应关系,作为存储文件和应用程序的对应关系。其中,文件的指示信息可以包括文件的路径和文件的名称。由于数据库中的信息可以存储在外存中,因此数据库中的信息并不会因为终端的掉电/重启而丢失,使得文件和应用程序的对应关系,可以稳定的保存在终端内。In this embodiment, the corresponding relationship between the indication information of the file and the package name of the application program may be stored in the database as the corresponding relationship between the stored file and the application program. Wherein, the indication information of the file may include the path of the file and the name of the file. Since the information in the database can be stored in the external memory, the information in the database will not be lost due to the power failure/restart of the terminal, so that the corresponding relationship between files and applications can be stably stored in the terminal.

需要说明的是,本实施方式对如何“在数据库中存储文件的指示信息和应用程序包名的对应关系”不做限制。在本实施方式中,可以以表格存储的方式在数据库中存储文件的指示信息和应用程序包名的对应关系。It should be noted that this embodiment does not limit how to "store the corresponding relationship between the instruction information of the file and the application package name in the database". In this embodiment, the corresponding relationship between the indication information of the file and the application package name may be stored in the database in the form of table storage.

需要说明的是,每个应用程序运行时,可能使用多个文件。即一个应用程序可以对应多个文件。此外,不同的应用程序也可能使用相同的文件。即一个文件可以对应多个不同的应用程序。It should be noted that each application may use multiple files when running. That is, an application can correspond to multiple files. Also, different applications may use the same files. That is, a file can correspond to multiple different applications.

在一些实施方式中,数据库中可以存储多个应用程序及应用程序运行时使用到的文件的对应关系。如表1所示,包名为A的应用程序对应的文件名称为文件1,文件1的文件路径为路径1;该包名为A的应用程序对应的文件名称还有文件2,文件2的文件路径为路径2等。其中,表1仅作为举例,对数据库中存储的应用程序的类型和个数不做限制,对每个应用程序运行时对应的文件个数不做限制。此外,通过表1可知,本实施方式中不同的应用程序在运行时,可能使用相同的文件;即同一个文件可能对应多个不同的应用程序。In some embodiments, the database may store the correspondence between multiple application programs and files used when the application programs run. As shown in Table 1, the file name corresponding to the application with the package name A is file 1, and the file path of file 1 is path 1; the file name corresponding to the application program with the package name A is file 2, and the The file path is path 2 and so on. Among them, Table 1 is only used as an example, and there are no restrictions on the type and number of application programs stored in the database, and there is no limit on the number of files corresponding to each application program running. In addition, it can be seen from Table 1 that different application programs in this embodiment may use the same file when running; that is, the same file may correspond to multiple different application programs.

表1Table 1

本实施方式的数据库不限于以表格存储的方式存储文件的指示信息和应用程序包名的对应关系,还可以根据实际设计的需求以其他的方式存储文件的指示信息和应用程序包名的对应关系。本实施方式对此不做限制。The database of this embodiment is not limited to storing the correspondence between the file indication information and the application package name in the form of table storage, and can also store the correspondence between the file indication information and the application package name in other ways according to actual design requirements. . This embodiment does not limit this.

步骤102,判断是否检测到应用程序的开启指令。如果是,则进入步骤103;否则,返回步骤102。Step 102, it is judged whether an opening instruction of an application program is detected. If yes, go to step 103; otherwise, go back to step 102.

如图2所示,以安卓系统为例进行说明,其中,安卓系统包括:应用层21(applications层)、框架层22(framework层)、系统类库层23(libc层)、系统内核层24(linuxkernel层)。As shown in FIG. 2 , the Android system is taken as an example for description, wherein the Android system includes: an application layer 21 (applications layer), a framework layer 22 (framework layer), a system class library layer 23 (libc layer), and a system kernel layer 24 (linuxkernel layer).

应用层21(applications层),包括运行于安卓虚拟机上的应用程序,如浏览器、联系人、日历以及其他应用程序。用户可以对应用层21中的应用程序进行操作。The application layer 21 (applications layer) includes applications running on the Android virtual machine, such as browsers, contacts, calendars and other applications. The user can operate the application program in the application layer 21 .

框架层22(framework层),指的是安卓应用开发的核心,提供了开发所必须的各种基础API框架。如框架层22具有包名记录、应用管理、后台管理等各种服务功能。The framework layer 22 (framework layer) refers to the core of Android application development, and provides various basic API frameworks necessary for development. For example, the framework layer 22 has various service functions such as package name recording, application management, and background management.

系统类库层23(libraries层),为了支持上层应用,安卓系统通过本层中的一些C/C++库来支持我们所使用的各个模块或组件。系统类库层23包括函数库和安卓执行环境。函数库包括web、open、sql等其他函数,安卓执行环境如dv虚拟机、java函数库等环境。System class library layer 23 (libraries layer), in order to support upper-layer applications, Android system supports each module or component we use through some C/C++ libraries in this layer. The system class library layer 23 includes a function library and an Android execution environment. The function library includes other functions such as web, open, sql, etc., and the Android execution environment such as dv virtual machine, java function library and other environments.

系统内核层24(linux kernel层),主要实现文件系统,内存管理,进程调度,进程间通信,电源管理及驱动等功能。如实现显示驱动、相机驱动、WiFi驱动等其他功能。系统内核层24与安卓构架以外的硬件进行通信。The system kernel layer 24 (linux kernel layer) mainly implements functions such as file system, memory management, process scheduling, inter-process communication, power management and driver. Such as realizing display driver, camera driver, WiFi driver and other functions. The system kernel layer 24 communicates with hardware outside the Android framework.

当用户需要打开应用层21中的某个应用程序时,用户会对该应用程序进行一个用于打开程序的特定操作。以打开程序的特定操作为点击操作为例,当框架层22检测到用户对桌面中的某个应用程序的图标的点击操作时,即视为检测到了该应用程序的开启指令,从而触发应用程序的开启,并进入步骤103。When the user needs to open an application in the application layer 21, the user will perform a specific operation for opening the application. Taking the specific operation of opening a program as a click operation as an example, when the framework layer 22 detects a user's click operation on the icon of an application program in the desktop, it is deemed to have detected the opening instruction of the application program, thereby triggering the application program is turned on, and go to step 103.

步骤103,根据开启指令开启的应用程序和数据库中储存的对应关系,查找与该应用程序对应的文件,并将查找到的文件加载至内存中。Step 103: Search for a file corresponding to the application program according to the corresponding relationship between the application program opened by the opening instruction and the database, and load the found file into the memory.

在本实施方式中,当有应用程序被打开且显示至终端界面时(即开启了某个应用程序),框架层22的应用管理服务功能就可以记载哪个应用程序被打开了,并且可以将应用程序的包名等信息通过该层的本地的守护进程发送到该层具有后台管理服务的服务单元,并可以通过包名记录功能记录有关该应用程序的包名。即当有应用程序被打开且显示至终端界面时,可以在安卓系统的框架层22中记录该应用程序的包名。In this embodiment, when an application is opened and displayed on the terminal interface (that is, a certain application is opened), the application management service function of the framework layer 22 can record which application is opened, and can store the application The information such as the package name of the program is sent to the service unit with the background management service in the layer through the local daemon process of the layer, and the package name of the application program can be recorded through the package name recording function. That is, when an application is opened and displayed on the terminal interface, the package name of the application can be recorded in the framework layer 22 of the Android system.

由于数据库中预先存储有文件的指示信息和应用程序包名的对应关系,因此,可以根据应用程序的包名从数据库中查找与应用程序对应的文件指示信息,并根据查找到的文件指示信息,从存储文件的外存中获取到文件,并将获取到的文件加载至内存中。Since the corresponding relationship between the file indication information and the application package name is pre-stored in the database, the file indication information corresponding to the application can be searched from the database according to the application package name, and according to the found file indication information, Obtain the file from the external memory where the file is stored, and load the obtained file into the memory.

其中,文件指示信息包括文件的名称和文件的路径。即根据查找到的文件的名称和文件的路径,获取到应用程序运行时可能会使用到的文件,并将获取到的文件加载至内存中。The file indication information includes the name of the file and the path of the file. That is, according to the name of the found file and the path of the file, the file that may be used when the application is running is obtained, and the obtained file is loaded into the memory.

步骤104,在被打开的应用程序运行的过程中直接读取加载在内存中的文件。由于在应用程序启动时,已将运行过程中可能会使用到的文件加载至内存中,因此,在应用程序运行的过程中如需使用某个文件,即可直接读取已加载在内存中的文件,提升了应用程序运行的流畅度。而且,即使出现了在应用程序运行的过程中,未能在内存中读取到所需文件的特殊情况(如应用程序有升级,而终端设备保存的仍是升级前的应用程序与文件的对应关系),也可以再从外存中获取到所需的文件,并加载到内存中,以保证应用程序的顺利运行。而且,还可以在出现该特殊情况时,将该文件的指示信息补充至保存的文件与应用程序的对应关系中,从而实现文件与应用程序的对应关系的自动更新。In step 104, the file loaded in the memory is directly read during the running process of the opened application. Since the files that may be used during the running process are loaded into the memory when the application starts, if you need to use a certain file during the running of the application, you can directly read the files loaded in the memory. file, which improves the smoothness of the application. Moreover, even if there is a special situation in which the required file cannot be read in the memory during the running of the application (for example, the application has been upgraded, and the terminal device still stores the correspondence between the application and the file before the upgrade) relationship), you can also get the required files from the external memory and load them into the memory to ensure the smooth running of the application. Moreover, when this special situation occurs, the indication information of the file can be supplemented into the stored correspondence between the file and the application, so as to realize the automatic update of the correspondence between the file and the application.

在实际应用中,还可以在应用程序关闭时,释放加载到内存中的文件;或者,在卸载或删除应用程序时,将加载到内存中的文件删除,例如,当应用程序卸载或删除时,可以根据应用程序的包名从数据库中获取与应用程序对应的文件的名称,根据文件的名称将加载到内存中的文件删除。而且,在完成应用程序的卸载或删除后,还可以在保存的对应关系中,删除卸载的应用程序与文件的对应关系,使得保存的对应关系内的应用程序,均为终端设备有可能开启的应用程序。In practical applications, the files loaded into the memory can also be released when the application is closed; or, when the application is uninstalled or deleted, the files loaded into the memory can be deleted, for example, when the application is uninstalled or deleted, The name of the file corresponding to the application can be obtained from the database according to the package name of the application, and the file loaded into the memory can be deleted according to the name of the file. Moreover, after the uninstallation or deletion of the application program is completed, the corresponding relationship between the uninstalled application program and the file can also be deleted in the saved corresponding relationship, so that the application programs in the saved corresponding relationship are all likely to be opened by the terminal device. application.

本实施方式中,在应用程序启动时,将该应用程序在运行过程中需使用到的文件加载至内存,而非在应用程序的运行过程中需要使用哪个文件,再去获取该文件,并将获取的文件加载至内存。相对于在应用程序的运行过程中需要哪个文件时,再从外存中获取所需要的文件并加载的方案,由于应用程序在运行过程可以直接从内存中读取所需的文件,而不需要在运行过程中进行文件加载,从而可以提升应用程序运行的流畅度,有助于匹配用户需求。In this implementation manner, when the application program starts, the file that the application program needs to use during the running process is loaded into the memory, rather than which file needs to be used during the running process of the application program, and then the file is acquired, and the The acquired file is loaded into memory. Compared with the scheme of obtaining the required file from the external memory and loading it when the file is needed during the running process of the application, the application can directly read the required file from the memory during the running process, without the need for Loading files during operation can improve the smoothness of application operation and help to match user needs.

而且,由于应用程序边运行边加载的方案,还会导致应用程序运行时所需要的相关文件在外存上的分布很分散,导致文件加载进一步变慢,应用程序运行更加不流畅;因此,本实施方式还可避免应用程序运行时所需要的相关文件在外存上的分布分散的情况,从而有助于进一步提升应用程序运行的流畅度。Moreover, due to the solution of loading the application while running, the related files required by the application running will be scattered in the external memory, which will further slow down the loading of the file and make the application run more unsmoothly; therefore, this implementation The method can also avoid the scattered distribution of related files required by the application program in the external memory, thereby helping to further improve the smoothness of the application program operation.

虽然本实施方式中终端设备本地保存有文件和应用程序的对应关系,但在实际应用中,也可以在检测到应用程序的开启指令时,从存储有文件和应用程序的对应关系的服务器中实时获取或直接查询,即文件和应用程序的对应关系预先存储在网络侧,根据网络侧存储的对应关系,查找与被打开的应用程序对应的文件,并进行预加载,在此不再赘述。Although the terminal device locally stores the corresponding relationship between the file and the application program in this embodiment, in practical applications, when detecting the opening instruction of the application program, the corresponding relationship between the file and the application program can be stored in real time from the server that stores the corresponding relationship between the file and the application program. Obtaining or direct query means that the correspondence between files and applications is pre-stored on the network side, and according to the correspondence stored on the network side, the files corresponding to the opened application are searched and preloaded, which will not be repeated here.

本申请的第二实施方式涉及一种文件预加载方法。在本申请第二实施方式中,通过在应用程序首次运行时,记录应用程序包名及所述应用程序调用的文件的指示信息作为应用程序和文件的对应关系,并存储至数据库中,提供了一种有效可行的将文件指示信息和包名的对应关系写入数据库的一种具体实现方式,为后续应用程序运行时需要加载相关文件指示信息提供了有效可行的实现方案。The second embodiment of the present application relates to a file preloading method. In the second embodiment of the present application, when the application program runs for the first time, the application package name and the indication information of the file called by the application program are recorded as the corresponding relationship between the application program and the file, and stored in the database to provide An effective and feasible specific implementation method for writing the corresponding relationship between the file indication information and the package name into the database provides an effective and feasible implementation scheme for the subsequent application program running that needs to load the relevant file indication information.

如图3所示,本实施方式的文件预加载方法包括:As shown in FIG. 3, the file preloading method of this embodiment includes:

步骤301,判断是否检测到应用程序的首次开启指令。如果是,则进入步骤302;否则返回步骤301。由于当框架层22检测到用户对桌面中的某个应用程序的图标进行了用于打开该应用程序的特定操作(如点击操作),就会触发该应用程序的开启。因此,在本步骤中,如果检测到用户对桌面中的某个应用程序的图标首次进行了用于打开该应用程序的特定操作,则判定检测到了应用程序的首次开启指令,打开该应用程序且将该应用程序显示至终端界面,进入步骤302。Step 301, it is judged whether an instruction to start an application program for the first time is detected. If yes, go to step 302; otherwise, go back to step 301. Because when the framework layer 22 detects that the user performs a specific operation (such as a click operation) on the icon of an application program on the desktop for opening the application program, it will trigger the opening of the application program. Therefore, in this step, if it is detected that the user performs a specific operation for opening the application on the icon of an application on the desktop for the first time, it is determined that the first opening instruction of the application is detected, and the application is opened and The application is displayed on the terminal interface, and the process proceeds to step 302 .

步骤302,将应用程序的包名记录至缓冲中。具体地说,可以利用框架层22中增加的包名记录的功能模块(如图2所示),来记录终端前景应用的包名,在一个应用程序被首次打开且显示至终端界面时(即在首次启动应用程序时),框架层22的包名记录的功能模块将应用程序的包名记录至buffer(缓冲)中。前景应用包名记录的功能模块通过系统内核层24的I/O接口将应用程序的包名记录至buffer(缓冲)中,如图4所示。缓冲(图中标注251表示的区域)为在内存25中开辟的一块地址空间,即缓冲(Buffer)就是在内存中预留指定大小的存储空间用来作为数据的临时存储区,使用缓冲有两个好处:1、减少实际物理读写次数;2、缓冲的位置在创建时就被分配好了,这块内存区域一直被重用,可以减少动态分配和回收存储空间的次数。Step 302, record the package name of the application into the buffer. Specifically, the package name recording function module added in the framework layer 22 (as shown in FIG. 2 ) can be used to record the package name of the terminal foreground application. When an application program is opened for the first time and displayed on the terminal interface (ie, When the application is started for the first time), the function module of the package name recording of the framework layer 22 records the package name of the application in the buffer (buffer). The function module for recording the package name of the foreground application records the package name of the application into the buffer through the I/O interface of the system kernel layer 24, as shown in FIG. 4 . The buffer (the area marked by 251 in the figure) is an address space opened up in the memory 25, that is, the buffer (Buffer) is to reserve a storage space of a specified size in the memory as a temporary storage area for data. There are two ways to use the buffer. Advantages: 1. Reduce the number of actual physical reads and writes; 2. The buffer location is allocated when it is created, and this memory area is always reused, which can reduce the number of dynamic allocation and reclamation of storage space.

步骤303,在检测到有文件被打开操作时,获取缓冲中的应用程序的包名。Step 303, when it is detected that a file is opened, the package name of the application program in the buffer is obtained.

其中,框架层22可以预留一个与系统类库层23中的open函数通信的函数接口,用来调用open函数运行的数据。open函数一般用来打开或者创建一个文件,可以根据参数来定制需要的文件的属性和用户权限等各种参数。在open函数中第一个参数是指向想要打开的文件路径名或者文件名。本实施方式中通过重载open函数,可以从open函数的运行数据中获取被打开的文件的名称和路径。另外,本实施方式中的系统类库层23是相对于应用层21而言的,实际上这个系统类库层23指的是安卓框架内的库(library),libc是库中的一个函数库,open函数在libc函数库内,libc函数库通常存储于外存中。框架层22通过系统内核层24中的I/O接口从缓冲中获取应用程序的包名。Among them, the framework layer 22 may reserve a function interface that communicates with the open function in the system class library layer 23, and is used to call the data run by the open function. The open function is generally used to open or create a file, and various parameters such as attributes and user permissions of the required file can be customized according to the parameters. The first parameter in the open function is the pathname or filename of the file you want to open. In this embodiment, by overloading the open function, the name and path of the opened file can be obtained from the running data of the open function. In addition, the system class library layer 23 in this embodiment is relative to the application layer 21. In fact, the system class library layer 23 refers to the library in the Android framework, and libc is a function library in the library. , the open function is in the libc function library, which is usually stored in external memory. The framework layer 22 obtains the package name of the application program from the buffer through the I/O interface in the system kernel layer 24 .

步骤304,通过记录进程将被打开操作的文件的指示信息,作为缓冲中的应用程序的包名所对应的文件的指示信息,写入数据库中,以在数据库中存储应用程序包名与文件的指示信息的对应关系。In step 304, the instruction information of the file to be opened by the recording process is written into the database as the instruction information of the file corresponding to the package name of the application program in the buffer, so as to store the instruction information of the application program package name and the file in the database. Correspondence of information.

具体地说,框架层22中的记录进程将被打开的文件指示信息以及获取的包名的对应关系通过系统内核层24中的I/O接口写入数据库。通过记录进程将被打开的文件指示信息以及包名的对应关系写入数据库,便于实现。进一步,由记录进程中的记录线程进行记录,由于记录线程所占用的系统资源较少,因此可以使得以较少的系统资源,实现对应关系的写入。Specifically, the recording process in the framework layer 22 writes the opened file indication information and the corresponding relationship between the acquired package names into the database through the I/O interface in the system kernel layer 24 . By recording the process, the opened file indication information and the corresponding relationship of the package name are written into the database, which is convenient for implementation. Further, the recording is performed by the recording thread in the recording process. Since the recording thread occupies less system resources, the writing of the corresponding relationship can be realized with less system resources.

其中,文件的指示信息至少包括文件的路径和文件的名称。数据库(如图中标注261所表示的区域)为外存26中建立的一块用于存储文件指示信息和包名对应关系的区域。通过上述方式将文件指示信息和包名的对应关系写入数据库,从而提供了一种有效可行的将文件指示信息和包名的对应关系写入数据库的一种具体实现方式,为后续应用程序运行时需要加载相关文件指示信息提供了有效可行的实现方案。Wherein, the indication information of the file includes at least the path of the file and the name of the file. The database (the area indicated by the mark 261 in the figure) is an area established in the external memory 26 for storing the corresponding relationship between the file indication information and the package name. In the above manner, the correspondence between the file indication information and the package name is written into the database, thereby providing an effective and feasible specific implementation method for writing the correspondence between the file indication information and the package name into the database, which is useful for subsequent application programs to run. When the relevant file instructions need to be loaded, an effective and feasible implementation scheme is provided.

本实施方式可以但不限于以表格的形式在数据库中存储文件的指示信息和应用程序包名的对应关系,还可以根据实际设计的需求以其他的方式存储文件的指示信息和应用程序包名的对应关系。每个应用程序的运行过程中,可能使用到一个文件,也可能使用到多个文件。This embodiment may, but is not limited to, store the corresponding relationship between the file instruction information and the application package name in the database in the form of a table, and may also store the file instruction information and the application package name in other ways according to actual design requirements. Correspondence. During the running process of each application, one file may be used, or multiple files may be used.

步骤305,判断当前被打开的应用程序是否为预设的目标优化程序。如果是,则进入步骤306;否则,返回步骤305。Step 305: Determine whether the currently opened application program is a preset target optimization program. If yes, go to step 306; otherwise, go back to step 305.

在本实施方式中,当前有应用程序被打开时,获取被打开的应用程序的包名,并根据获取的所述包名判断当前被打开的应用程序是否为预设的目标优化程序。并且本步骤的检测过程具体为:框架层22通过系统内核层24中的I/O接口与缓冲进行通信,获取所述缓冲中的应用程序的包名,并根据获取的包名判断当前被打开的应用程序是否是预设的目标优化程序。需要说明的是,实际设计过程中,不限于通过上述方式判断当前被打开的应用程序是否是目标优化程序,本实施方式对此不做限制,以上仅仅作为举例。In this implementation manner, when an application program is currently opened, the package name of the opened application program is obtained, and whether the currently opened application program is a preset target optimization program is determined according to the obtained package name. And the detection process of this step is specifically: the framework layer 22 communicates with the buffer through the I/O interface in the system kernel layer 24, obtains the package name of the application program in the buffer, and judges that it is currently opened according to the obtained package name. Whether the application is the default target optimizer. It should be noted that, in the actual design process, it is not limited to determine whether the currently opened application program is the target optimization program by the above method, which is not limited in this embodiment, and the above is only an example.

目标优化程序可以是一个应用程序,也可以是多个应用程序。目标优化程序可以由用户自行设置,也可以由终端的系统默认设置。例如,可以在终端内设置一个白名单,白名单内的应用程序均为目标优化程序。或者,也可以通过设置一个应用程序的类别,来设置目标优化程序,如设置的类别为游戏类,则只要应用程序的类别为游戏类,该应用程序即为目标优化程序。The target optimizer can be a single application or multiple applications. The target optimizer can be set by the user or by the system default of the terminal. For example, a whitelist can be set in the terminal, and the applications in the whitelist are all target optimizers. Alternatively, the target optimizer may also be set by setting the category of an application. For example, if the set category is game, as long as the category of the application is game, the application is the target optimizer.

另外,值得一提的是,在实际应用中,存储的对应关系中的应用程序,可以均为目标优化程序,即在步骤304之前,可以增加一个判断步骤,判断缓冲中的应用程序的包名是否为目标优化程序的包名,如果是目标优化程序的包名,则再执行步骤304,通过记录进程将被打开操作的文件的指示信息,作为缓冲中的应用程序的包名所对应的文件的指示信息,写入数据库中;如果缓冲中的应用程序的包名,不是目标优化程序的包名,则不进行记录。通过这种设计,可以使用户或系统自定义需要优化的目标优化程序,仅对需要优化的目标优化程序进行文件预加载,而且,可以减少数据库中储存文件和应用程序的对应关系所需的空间,也进一步提高了查找优化应用程序对应文件的效率。In addition, it is worth mentioning that, in practical applications, the application programs in the stored correspondence may all be target optimization programs, that is, before step 304, a judgment step may be added to judge the package name of the application program in the buffer. Whether it is the package name of the target optimizer, if it is the package name of the target optimizer, then perform step 304 again, by recording the instruction information of the file that the process will be opened for operation, as the file corresponding to the package name of the application in the buffer. The instruction information is written into the database; if the package name of the application in the buffer is not the package name of the target optimizer, it will not be recorded. Through this design, the user or the system can customize the target optimization program that needs to be optimized, and only preload the file for the target optimization program that needs to be optimized. Moreover, it can reduce the space required for storing the corresponding relationship between files and applications in the database. , which further improves the efficiency of finding files corresponding to optimized applications.

步骤306,根据被打开的应用程序和数据库中储存的对应关系,查找出与被打开的应用程序对应的文件,并将查找出的文件加载至内存中。Step 306 , according to the opened application program and the corresponding relationship stored in the database, find out the file corresponding to the opened application program, and load the found file into the memory.

具体地说,根据应用程序的包名从数据库中存储的“文件指示信息和包名的对应关系”中查找该应用程序运行时可能会使用到的文件所对应的文件的名称和该应用程序对应的文件的路径,根据文件的名称和路径获取到文件,并将获取的文件加载至内存,具体的可以将上述文件加载至图中标注252所表示的区域。Specifically, according to the package name of the application, the name of the file corresponding to the file that may be used when the application is running is searched from the "correspondence between the file indication information and the package name" stored in the database. The name of the file corresponds to the application. The path of the file, obtain the file according to the name and path of the file, and load the obtained file into the memory. Specifically, the above file can be loaded into the area indicated by the mark 252 in the figure.

在实际的应用中,还可以预先设定文件的优先级,具体的,可以根据文件的使用次数、文件的大小或文件的使用频率预先设定文件的优先级。在将上述文件加载至内存中时,根据内存的占用率、文件的大小以及文件的优先级先加载优先级比较高的文件。具体地说,在将查找出的文件加载至内存中时,首先对内存的占用率和各文件的大小进行查看,如果内存的占用率较大(现有的内存可利用空间较小),可以选择优先级较高的文件加载至内存中。或者,当查找出的文件需要占用的内存空间大于现有的内存可利用空间,即现有的内存可利用空间不足以存储上述查找到的所有文件时,可以先加载优先级较高的文件。In practical applications, the priority of the file may also be preset. Specifically, the priority of the file may be preset according to the number of times of use of the file, the size of the file, or the frequency of use of the file. When the above-mentioned files are loaded into the memory, the files with higher priority are loaded first according to the occupancy rate of the memory, the size of the files, and the priority of the files. Specifically, when loading the found files into the memory, first check the memory occupancy rate and the size of each file. Select a higher priority file to load into memory. Alternatively, when the memory space that the found file needs to occupy is greater than the available memory space available, that is, when the available memory space is insufficient to store all the files found above, the file with a higher priority may be loaded first.

举例而言,以下仅作为举例,不对本实施方式做进一步限制,根据上述查找的文件指示信息确定的文件为P、L、M、N,而这些文件的大小之和为W1,现有的内存可利用空间为W2。如果W1大于W2,则现有的内存可利用空间不足以存储上述查找到的所有文件。此时,需要先加载优先级较高的文件(如文件P、L、M)至内存中。当然,作为另外一种实现,也可以预设一个内存占用率门限,若当前的内存的占用率大于设置的内存占用率门限,则选择优先级较高的文件加载至内存中。For example, the following is only an example, and does not further limit this embodiment. The files determined according to the file indication information searched above are P, L, M, and N, and the sum of the sizes of these files is W1, and the existing memory Available space is W2. If W1 is greater than W2, the existing memory available space is not enough to store all the files found above. At this time, the files with higher priority (such as files P, L, M) need to be loaded into the memory first. Of course, as another implementation, a memory occupancy rate threshold may also be preset. If the current memory occupancy rate is greater than the set memory occupancy rate threshold, a file with a higher priority is selected to be loaded into the memory.

举例而言,以应用程序为QQ为例对文件优先级的设定进行详细的说明,但并非将对文件优先级的设定方式进行进一步限定,仅作为举例说明:For example, the setting of the file priority is described in detail by taking the application as QQ as an example, but it is not intended to further limit the setting method of the file priority, but only as an example:

比如,第一次QQ运行的过程中使用到的文件为F1、F2、F3、F4、F5等,第二次QQ的运行过程中使用到的文件为F1、F2、F3、F6、F7等,第三次QQ的运行过程中使用到的文件为F1、F2、F3、F8、F9等,预设次数为3。文件F1、F2、F3的使用次数达到预设次数3,可以判定文件F1、F2、F3为应用程序运行时经常使用的文件,故确定文件F1、F2、F3为优先级较高的文件。文件F4、F5、F6、F7、F8、F9的使用次数小于预设次数3,可以判定文件F4、F5、F6、F7、F8、F9不是应用程序运行时经常使用的文件,故确定文件F4、F5、F6、F7、F8、F9为优先级较低的文件。在现有的内存可利用空间不足以完成QQ运行过程中所需文件的全部加载,或者,当前的内存的占用率大于设置的内存占用率门限时,可选择仅加载F1、F2、F3。For example, the files used in the first QQ operation are F1, F2, F3, F4, F5, etc., and the files used in the second QQ operation are F1, F2, F3, F6, F7, etc. The files used in the third QQ running process are F1, F2, F3, F8, F9, etc., and the preset number of times is 3. When the usage times of the files F1, F2, and F3 reaches the preset number of 3, it can be determined that the files F1, F2, and F3 are frequently used when the application is running. Therefore, the files F1, F2, and F3 are determined to be files with higher priority. If the usage times of files F4, F5, F6, F7, F8, and F9 is less than the preset number of 3, it can be determined that the files F4, F5, F6, F7, F8, and F9 are not frequently used files when the application is running. F5, F6, F7, F8, F9 are files with lower priority. When the available memory space is not enough to load all required files during QQ running, or when the current memory usage is greater than the set memory usage threshold, you can choose to load only F1, F2, and F3.

步骤307,在被打开的应用程序运行的过程中直接读取加载在内存中的文件。具体的,应用程序可以通过系统内核层24中的I/O接口直接读取记载在内存中的文件开始运行。In step 307, the file loaded in the memory is directly read during the running process of the opened application. Specifically, the application program can directly read the file recorded in the memory through the I/O interface in the system kernel layer 24 to start running.

本实施方式中,应用程序在启动时,可以直接从数据库中获取相对应的文件指示信息,根据文件指示信息将应用程序运行时需要的文件加载至内存中,并在被打开的应用程序的运行过程中直接读取加载在所述内存中的文件,而非在应用程序的运行过程中需要使用哪个文件,再去将该文件加载至内存。相对于应用程序边运行边加载文件至内存的方案,本方案消耗的时间更短,可以提升应用程序运行的流畅度,有助于匹配用户需求。并且应用程序边运行边加载文件至内存的方案,还会导致应用程序运行时所需要的相关文件在外存上的分布很分散,导致文件加载进一步变慢,应用程序运行更加不流畅;但是本方案在应用程序启动时,就将需使用到的文件加载至内存,使应用程序在运行过程可以直接从内存中读取所需的文件,而不需要在运行过程中进行文件加载,避免了应用程序运行时所需要的相关文件在外存上的分布分散的情况,从而有助于进一步提升应用程序运行的流畅度。In this embodiment, when the application is started, it can directly obtain the corresponding file indication information from the database, load the file required by the application when the application is running into the memory according to the file indication information, and execute the opened application when the application is running. During the process, the file loaded in the memory is directly read, rather than which file needs to be used during the running process of the application, and then the file is loaded into the memory. Compared with the scheme of loading files into memory while the application is running, this scheme consumes less time, which can improve the smoothness of the running of the application and help to match user needs. In addition, the solution of loading files into memory while the application is running will also lead to the scattered distribution of related files required by the application in the external memory, which will further slow down the loading of files and make the application run more unsmoothly; but this solution When the application starts, the files to be used are loaded into the memory, so that the application can directly read the required files from the memory during the running process, without the need to load the files during the running process, avoiding the application process. The distribution of related files required at runtime in external memory is scattered, which helps to further improve the smoothness of application running.

本申请的第三实施方式涉及一种文件预加载方法。第三实施方式在第一实施方式的基础上加以改进,主要改进之处在于:在本实施方式中,在查找与开启的应用程序对应的文件之前,先判断当前内存的占用率。如果当前的内存的占用率大于或等于预设的占用率门限,则不进行文件的预加载,如果判定当前的内存的占用率小于预设的占用率门限,则再查找出与被打开的应用程序对应的文件,并将查找出的文件加载至内存中。The third embodiment of the present application relates to a file preloading method. The third embodiment is improved on the basis of the first embodiment, and the main improvement lies in that: in this embodiment, before searching for the file corresponding to the opened application program, the current memory occupancy rate is determined first. If the current occupancy rate of the memory is greater than or equal to the preset occupancy rate threshold, the file will not be preloaded. If it is determined that the current memory occupancy rate is less than the preset occupancy rate threshold, then find out and open the application. The file corresponding to the program is loaded into the memory.

具体流程如图5所示,步骤501中,预先在数据库中存储文件和应用程序的对应关系。本步骤与步骤101类似,在此不再赘述。The specific process is shown in FIG. 5 . In step 501 , the corresponding relationship between the file and the application program is stored in the database in advance. This step is similar to step 101 and will not be repeated here.

步骤502中,判断是否检测到应用程序的开启指令。如果是,则进入步骤503;否则,返回步骤502。本步骤与步骤102类似,在此不再赘述。In step 502, it is determined whether an application startup instruction is detected. If yes, go to step 503; otherwise, go back to step 502. This step is similar to step 102 and will not be repeated here.

步骤503中,判断当前内存的占用率是否小于预设的占用率门限。其中,占用率门限可根据经验值设定。如果判定小于预设的占用率门限,则进入步骤504,若判定大于或等于预设的占用率门限,则进入步骤506,在应用程序的运行过程中,从外存中获取所需的文件并加载至内存。In step 503, it is determined whether the current occupancy rate of the memory is less than a preset occupancy rate threshold. Wherein, the occupancy rate threshold can be set according to an empirical value. If it is determined that it is less than the preset occupancy rate threshold, then go to step 504; if it is determined that it is greater than or equal to the preset occupancy rate threshold, then enter step 506, during the running process of the application program, obtain the required file from the external memory and loaded into memory.

在步骤504中,根据开启指令开启的应用程序和数据库中储存的对应关系,查找与该应用程序对应的文件,并将查找到的文件加载至内存中,并进入步骤505,在被打开的应用程序运行的过程中直接读取加载在内存中的文件。步骤504与步骤505分别与步骤103和步骤104类似,在此不再赘述。In step 504, according to the corresponding relationship between the application program opened by the opening instruction and the corresponding relationship stored in the database, the file corresponding to the application program is searched, and the found file is loaded into the memory, and the process goes to step 505, in the opened application program When the program is running, the file loaded in the memory is directly read. Step 504 and step 505 are respectively similar to step 103 and step 104, and are not repeated here.

步骤506,在应用程序的运行过程中,从外存中获取所需的文件并加载至内存。Step 506, during the running process of the application, obtain the required files from the external memory and load them into the internal memory.

在本实施方式中,根据当前的内存占用率对文件的加载方式进行了区分,针对当前的内存占用率尚未超出预设的占用率门限这一情况,在应用程序启动时,将该应用程序在运行过程中需使用到的文件加载至内存,并在被打开的应用程序的运行过程中直接读取加载在所述内存中的文件,可以提升应用程序运行的流畅度;针对当前的内存占用率已超出预设的占用率门限这一情况,采用在应用程序的运行过程中,需要使用哪个文件,再从外存中获取该文件并加载至内存的方式,可以有效减轻当前的内存资源的使用负担。In this implementation manner, the file loading method is distinguished according to the current memory occupancy rate. In view of the situation that the current memory occupancy rate has not exceeded the preset occupancy rate threshold, when the application program starts, the application program is stored in the The files that need to be used during the running process are loaded into the memory, and the files loaded in the memory can be directly read during the running process of the opened application, which can improve the smoothness of the running of the application; according to the current memory occupancy rate When the preset occupancy threshold has been exceeded, which file needs to be used during the running process of the application, the file is obtained from the external memory and loaded into the memory, which can effectively reduce the use of the current memory resources. burden.

本申请第四实施方式涉及了一种文件预加载装置。如图6所示,文件预加载装置包括:查找模块42,用于在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件。其中,所述文件为所述应用程序运行过程中使用到的文件。在具体实现时,可以通过预设模块41来实现文件和应用程序的对应关系的预先存储。文件和应用程序的对应关系的预先存储方式包括:在应用程序首次运行时,记录应用程序包名及所述应用程序调用的文件的指示信息作为应用程序和文件的对应关系,并存储至数据库中;或者,从网络侧获取文件和应用程序的对应关系,并存储至数据库中。The fourth embodiment of the present application relates to a file preloading device. As shown in FIG. 6 , the file preloading apparatus includes: a search module 42, configured to search for a file corresponding to the application program according to the pre-stored correspondence between the file and the application program when an application program opening instruction is detected. Wherein, the file is a file used in the running process of the application program. During specific implementation, the pre-storage of the corresponding relationship between the file and the application program can be realized by the preset module 41 . The pre-storage mode of the corresponding relationship of the file and the application program includes: when the application program runs for the first time, record the instruction information of the application program package name and the file called by the application program as the corresponding relationship between the application program and the file, and store in the database. ; Or, obtain the corresponding relationship between the file and the application program from the network side, and store it in the database.

预加载模块43,用于将所述查找模块查找出的所述对应的文件加载至内存中。The preloading module 43 is configured to load the corresponding file found by the searching module into the memory.

运行模块44,用于在运行应用程序的过程中直接读取加载在所述内存中的文件。The running module 44 is used to directly read the file loaded in the memory during the running of the application program.

本实施方式中,应用程序在启动时,可以直接从数据库中获取相对应的文件指示信息,文件的指示信息至少包括文件的路径和所述文件的名称。根据文件指示信息将应用程序运行时需要的文件加载至内存中,并在被打开的应用程序的运行过程中直接读取加载在所述内存中的文件,而非在应用程序的运行过程中需要使用哪个文件,再去将该文件加载至内存。相对于应用程序边运行边加载文件至内存的方案,本方案消耗的时间更短,可以提升应用程序运行的流畅度,有助于匹配用户需求。并且应用程序边运行边加载文件至内存的方案,还会导致应用程序运行时所需要的相关文件在外存上的分布很分散,导致文件加载进一步变慢,应用程序运行更加不流畅;但是本方案在应用程序启动时,就将需使用到的文件加载至内存,使应用程序在运行过程可以直接从内存中读取所需的文件,而不需要在运行过程中进行文件加载,避免了应用程序运行时所需要的相关文件在外存上的分布分散的情况,从而有助于进一步提升应用程序运行的流畅度。In this implementation manner, when the application program is started, the corresponding file indication information can be directly obtained from the database, and the file indication information includes at least the path of the file and the name of the file. Load the files required by the application program into the memory according to the file instruction information, and directly read the files loaded in the memory during the operation process of the opened application program, instead of requiring the application program during the operation process. Which file to use, and then load the file into memory. Compared with the scheme of loading files into memory while the application is running, this scheme consumes less time, which can improve the smoothness of the running of the application and help to match user needs. In addition, the solution of loading files into memory while the application is running will also lead to the scattered distribution of related files required by the application in the external memory, which will further slow down the loading of files and make the application run more unsmoothly; but this solution When the application starts, the files to be used are loaded into the memory, so that the application can directly read the required files from the memory during the running process, without the need to load the files during the running process, avoiding the application process. The distribution of related files required at runtime in external memory is scattered, which helps to further improve the smoothness of application running.

本发明第五实施方式涉及一种文件预加载装置。如图7所示,包括:查找模块42,用于在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件。其中,所述文件为所述应用程序运行过程中使用到的文件。在具体实现时,可以通过预设模块41来实现文件和应用程序的对应关系的预先存储。预加载模块43,用于将所述查找模块查找出的所述对应的文件加载至内存中。运行模块44,用于在运行应用程序的过程中直接读取加载在所述内存中的文件。The fifth embodiment of the present invention relates to a file preloading device. As shown in FIG. 7 , a search module 42 is included, configured to search for a file corresponding to the application program according to the pre-stored correspondence between the file and the application program when an application program opening instruction is detected. Wherein, the file is a file used in the running process of the application program. During specific implementation, the pre-storage of the corresponding relationship between the file and the application program can be realized by the preset module 41 . The preloading module 43 is configured to load the corresponding file found by the searching module into the memory. The running module 44 is used to directly read the file loaded in the memory during the running of the application program.

其中,预设模块41包括:记录子模块411,用于在首次启动应用程序时,将所述应用程序的包名记录至缓冲中。获取子模块412,用于在检测到有文件被打开操作时,获取所述缓冲中的应用程序的包名。写入子模块413,用于将所述被打开操作的文件的指示信息,作为所述缓冲中的应用程序的包名所对应的文件的指示信息,写入数据库中。其中,写入子模块413,具体用于通过记录进程将所述被打开操作的文件的指示信息,作为所述缓冲中的应用程序的包名所对应的文件的指示信息,写入数据库中。Wherein, the preset module 41 includes: a recording sub-module 411 for recording the package name of the application into the buffer when the application is started for the first time. The obtaining sub-module 412 is configured to obtain the package name of the application program in the buffer when it is detected that a file is opened. The writing sub-module 413 is configured to write the indication information of the opened file into the database as the indication information of the file corresponding to the package name of the application program in the buffer. The writing sub-module 413 is specifically configured to write the indication information of the opened file into the database as the indication information of the file corresponding to the package name of the application program in the buffer through the recording process.

在具体实现时,预设模块41写入数据库的对应关系中的应用程序可以均为目标优化程序。查找模块42在查找与应用程序对应的文件之前,可以先判断当前检测到的开启指令开启的应用程序是否为预设的目标优化程序,若开启指令开启的应用程序为目标优化程序,则再根据应用程序和所述对应关系,查找与被打开的应用程序对应的文件。例如,可以通过获取当前检测到的开启指令开启的应用程序的包名,根据包名判断开启指令开启的应用程序是否为预设的目标优化程序的方式,判断当前检测到的开启指令开启的应用程序是否为预设的目标优化程序。In specific implementation, the application programs written in the corresponding relationship of the database by the preset module 41 may all be target optimization programs. Before searching for the file corresponding to the application program, the search module 42 can first determine whether the application program opened by the currently detected opening instruction is the preset target optimization program, and if the application program opened by the opening instruction is the target optimization program, then according to The application program and the corresponding relationship are searched for the file corresponding to the opened application program. For example, by obtaining the package name of the application program opened by the currently detected opening instruction, and judging whether the application program opened by the opening instruction is the preset target optimization program according to the package name, the application opened by the currently detected opening instruction can be determined. Whether the program is a preset target optimization program.

本申请第六实施方式涉及一种文件预加载装置。如图8所示,包括:查找模块42,用于在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件。其中,所述文件为所述应用程序运行过程中使用到的文件。在具体实现时,可以通过预设模块41来实现文件和应用程序的对应关系的预先存储。预加载模块43,用于将所述查找模块查找出的所述对应的文件加载至内存中。运行模块44,用于在运行应用程序的过程中直接读取加载在所述内存中的文件。The sixth embodiment of the present application relates to a file preloading device. As shown in FIG. 8 , a search module 42 is included, configured to search for a file corresponding to the application program according to the pre-stored correspondence between the file and the application program when an application program opening instruction is detected. Wherein, the file is a file used in the running process of the application program. During specific implementation, the pre-storage of the corresponding relationship between the file and the application program can be realized by the preset module 41 . The preloading module 43 is configured to load the corresponding file found by the searching module into the memory. The running module 44 is used to directly read the file loaded in the memory during the running of the application program.

本实施方式的文件预加载装置还包括:判断模块46,用于在查找与所述应用程序对应的文件之前,判断当前内存的占用率。查找模块42,具体用于在判断模块46判定当前的内存的占用率小于预设的占用率门限时,再查找与被打开的应用程序对应的文件。The file preloading apparatus in this embodiment further includes: a judgment module 46, configured to judge the current memory occupancy rate before searching for the file corresponding to the application program. The search module 42 is specifically configured to search for the file corresponding to the opened application program when the judgment module 46 judges that the current occupancy rate of the memory is less than the preset occupancy rate threshold.

本申请第七实施方式涉及一种电子设备。电子设备包括至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行第一或第二实施方式中的文件预加载方法。其中,存储器和处理器采用总线方式连接,总线可以包括任意数量的互联的总线和桥,总线将一个或多个处理器和存储器的各种电路连接在一起。总线还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路连接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。A seventh embodiment of the present application relates to an electronic device. The electronic device includes at least one processor; and, a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being processed by the at least one processor The processor executes the file preloading method in the first or second embodiment. The memory and the processor are connected by a bus, and the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors and various circuits of the memory. The bus may also connect together various other circuits, such as peripherals, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein.

总线接口在总线和收发机之间提供接口。收发机可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器处理的数据通过天线在无线介质上进行传输,进一步,天线还接收数据并将数据传送给处理器等。处理器负责管理总线和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器可以被用于存储处理器在执行操作时所使用的数据。The bus interface provides the interface between the bus and the transceiver. A transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing a means for communicating with various other devices over a transmission medium. The data processed by the processor is transmitted on the wireless medium through the antenna, and further, the antenna also receives the data and transmits the data to the processor and so on. The processor manages the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. Instead, memory may be used to store data used by the processor in performing operations.

如图9所示,该电子设备可以包括:存储器601、中央处理器CPU 602(CentralProcessing Unit,简称处理器)、所述存储器601,用于存储可执行程序代码;所述处理器602通过读取所述存储器601中存储的可执行程序代码来运行与所述可执行程序代码对应的程序,以用于执行:As shown in FIG. 9, the electronic device may include: a memory 601, a central processing unit CPU 602 (Central Processing Unit, processor for short), the memory 601 for storing executable program codes; the processor 602 reads The executable program code stored in the memory 601 runs a program corresponding to the executable program code for executing:

在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件;其中,所述文件为所述应用程序运行过程中使用到的文件;将查找出的所述对应的文件加载至内存中,并在所述应用程序的运行过程中直接读取加载在所述内存中的文件。When detecting the opening instruction of the application, search for a file corresponding to the application according to the correspondence between the pre-stored file and the application; wherein, the file is the file used in the running process of the application; Loading the found corresponding file into the memory, and directly reading the file loaded in the memory during the running process of the application program.

所述电子设备还包括:外设接口603、射频RF电路605、音频电路606、扬声器611、电源管理芯片608、输入/输出(I/O)子系统609、触摸屏612、其他输入/控制设备610以及外部端口604,这些部件通过一个或多个通信总线或信号线607来通信。The electronic device further includes: peripheral interface 603 , radio frequency RF circuit 605 , audio circuit 606 , speaker 611 , power management chip 608 , input/output (I/O) subsystem 609 , touch screen 612 , and other input/control devices 610 As well as external ports 604 , these components communicate via one or more communication buses or signal lines 607 .

应该理解的是,图示电子设备600仅仅是电子设备的一个范例,并且电子设备600可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。下面就本实施例提供的电子设备进行详细的描述,该电子设备以手机为例。It should be understood that the illustrated electronic device 600 is only an example of an electronic device, and that the electronic device 600 may have more or fewer components than those shown in the figures, two or more components may be combined, Or can have different component configurations. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits. The electronic device provided in this embodiment is described in detail below, and the electronic device takes a mobile phone as an example.

存储器601,所述存储器601可以被CPU 602、外设接口603等访问,所述存储器601可以包括高速随机存取存储器,还可以包括非易失性存储器,例如一个或多个磁盘存储器件、闪存器件、或其他易失性固态存储器件。在本实施方式中,存储器601包括内存6011和外存6012;其中,外存6012用于存储文件以及文件和应用程序的对应关系(即数据库位于外存6012内);内存6011中开辟有一块地址空间作为buffer(缓冲),该缓冲区域用于记录打开的应用程序的包名。在查找与打开的应用程序对应的文件时,根据缓冲区域中记录的包名,以及数据库中存储的对应关系,从外存6012中查找出与该应用程序对应的文件,并将查找出的对应的文件加载至内存6011中。Memory 601, which can be accessed by CPU 602, peripheral interface 603, etc., which can include high-speed random access memory, and can also include non-volatile memory, such as one or more disk storage devices, flash memory devices, or other volatile solid-state storage devices. In this embodiment, the memory 601 includes a memory 6011 and an external memory 6012; wherein, the external memory 6012 is used to store files and the corresponding relationship between files and applications (that is, the database is located in the external memory 6012); an address is opened in the memory 6011 The space is used as a buffer, and the buffer area is used to record the package name of the open application. When searching for the file corresponding to the opened application, according to the package name recorded in the buffer area and the corresponding relationship stored in the database, the file corresponding to the application is found from the external memory 6012, and the corresponding The file is loaded into the memory 6011.

外设接口603,所述外设接口603可以将设备的输入和输出外设连接到CPU 502和存储器601。A peripheral interface 603 that can connect the input and output peripherals of the device to the CPU 502 and the memory 601 .

I/O子系统609,所述I/O子系统609可以将设备上的输入输出外设,例如触摸屏612和其他输入/控制设备610,连接到外设接口603。I/O子系统609可以包括显示控制器6091和用于控制其他输入/控制设备610的一个或多个输入控制器6092。其中,一个或多个输入控制器6092从其他输入/控制设备610接收电信号或者向其他输入/控制设备610发送电信号,其他输入/控制设备610可以包括物理按钮(按压按钮、摇臂按钮等)、拨号盘、滑动开关、操纵杆、点击滚轮。值得说明的是,输入控制器6092可以与以下任一个连接:键盘、红外端口、USB接口以及诸如鼠标的指示设备。I/O subsystem 609 , which can connect input and output peripherals on the device, such as touch screen 612 and other input/control devices 610 , to peripherals interface 603 . The I/O subsystem 609 may include a display controller 6091 and one or more input controllers 6092 for controlling other input/control devices 610 . Wherein, one or more input controllers 6092 receive electrical signals from or send electrical signals to other input/control devices 610, which may include physical buttons (push buttons, rocker buttons, etc. ), dial pad, slide switch, joystick, click wheel. Notably, the input controller 6092 can be connected to any of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.

触摸屏612,所述触摸屏612是用户终端与用户之间的输入接口和输出接口,将可视输出显示给用户,可视输出可以包括图形、文本、图标、视频等。The touch screen 612, which is an input interface and an output interface between the user terminal and the user, displays visual output to the user, and the visual output may include graphics, text, icons, videos, and the like.

I/O子系统609中的显示控制器6091从触摸屏612接收电信号或者向触摸屏612发送电信号。触摸屏612检测触摸屏上的接触,显示控制器6091将检测到的接触转换为与显示在触摸屏612上的用户界面对象的交互,即实现人机交互,显示在触摸屏612上的用户界面对象可以是运行游戏的图标、联网到相应网络的图标等。值得说明的是,设备还可以包括光鼠,光鼠是不显示可视输出的触摸敏感表面,或者是由触摸屏形成的触摸敏感表面的延伸。Display controller 6091 in I/O subsystem 609 receives electrical signals from touch screen 612 or sends electrical signals to touch screen 612 . The touch screen 612 detects the contact on the touch screen, and the display controller 6091 converts the detected contact into interaction with the user interface object displayed on the touch screen 612, that is, to realize human-computer interaction, and the user interface object displayed on the touch screen 612 can be run. Icons for games, icons for connecting to the corresponding network, etc. It is worth noting that the device may also include a light mouse, which is a touch-sensitive surface that does not display visual output, or an extension of the touch-sensitive surface formed by a touch screen.

RF电路605,主要用于建立手机与无线网络(即网络侧)的通信,实现手机与无线网络的数据接收和发送。例如收发短信息、电子邮件等。具体地,RF电路605接收并发送RF信号,RF信号也称为电磁信号,RF电路605将电信号转换为电磁信号或将电磁信号转换为电信号,并且通过该电磁信号与通信网络以及其他设备进行通信。RF电路605可以包括用于执行这些功能的已知电路,其包括但不限于天线系统、RF收发机、一个或多个放大器、调谐器、一个或多个振荡器、数字信号处理器、CODEC(COder-DECoder,编译码器)芯片组、用户标识模块(Subscriber Identity Module,SIM)等等。The RF circuit 605 is mainly used to establish the communication between the mobile phone and the wireless network (ie, the network side), and realize the data reception and transmission between the mobile phone and the wireless network. Such as sending and receiving text messages, e-mails, etc. Specifically, the RF circuit 605 receives and transmits RF signals, also known as electromagnetic signals, the RF circuit 605 converts electrical signals into electromagnetic signals or converts electromagnetic signals into electrical signals, and communicates with communication networks and other devices through the electromagnetic signals to communicate. RF circuitry 605 may include known circuitry for performing these functions including, but not limited to, antenna systems, RF transceivers, one or more amplifiers, tuners, one or more oscillators, digital signal processors, CODECs ( COder-DECoder, codec) chip set, subscriber identity module (Subscriber Identity Module, SIM) and so on.

音频电路606,主要用于从外设接口603接收音频数据,将该音频数据转换为电信号,并且将该电信号发送给扬声器611。The audio circuit 606 is mainly used for receiving audio data from the peripheral interface 603 , converting the audio data into an electrical signal, and sending the electrical signal to the speaker 611 .

扬声器611,用于将手机通过RF电路605从无线网络接收的语音信号,还原为声音并向用户播放该声音。The speaker 611 is used to restore the voice signal received by the mobile phone from the wireless network through the RF circuit 605 to sound and play the sound to the user.

电源管理芯片608,用于为CPU602、I/O子系统及外设接口603所连接的硬件进行供电及电源管理。The power management chip 608 is used for power supply and power management for the hardware connected to the CPU 602 , the I/O subsystem and the peripheral interface 603 .

本实施方式为与第一或第二实施方式相互对应的设备实施方式,因此本实施方式可与第一或第二实施方式互相配合实施。第一或第二实施方式中提到的相关技术细节在本实施方式中依然有效,在第一或第二实施方式中所能达到的技术效果在本实施方式中也同样可以实现,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第一或第二实施方式中。This embodiment is a device embodiment corresponding to the first or second embodiment, so this embodiment can be implemented in cooperation with the first or second embodiment. The relevant technical details mentioned in the first or second embodiment are still valid in this embodiment, and the technical effects that can be achieved in the first or second embodiment can also be achieved in this embodiment, in order to reduce repetition , which will not be repeated here. Correspondingly, the relevant technical details mentioned in this embodiment can also be applied to the first or second embodiment.

本实施方式中,应用程序在启动时,可以直接从数据库中获取相对应的文件指示信息,根据文件指示信息将应用程序运行时需要的文件加载至内存中,并在被打开的应用程序的运行过程中直接读取加载在所述内存中的文件,而非在应用程序的运行过程中需要使用哪个文件,再去将该文件加载至内存。相对于应用程序边运行边加载文件至内存的方案,本方案消耗的时间更短,可以提升应用程序运行的流畅度,有助于匹配用户需求。并且应用程序边运行边加载文件至内存的方案,还会导致应用程序运行时所需要的相关文件在外存上的分布很分散,导致文件加载进一步变慢,应用程序运行更加不流畅;但是本方案在应用程序启动时,就将需使用到的文件加载至内存,使应用程序在运行过程可以直接从内存中读取所需的文件,而不需要在运行过程中进行文件加载,避免了应用程序运行时所需要的相关文件在外存上的分布分散的情况,从而有助于进一步提升应用程序运行的流畅度。In this embodiment, when the application is started, it can directly obtain the corresponding file indication information from the database, load the file required by the application when the application is running into the memory according to the file indication information, and execute the opened application when the application is running. During the process, the file loaded in the memory is directly read, rather than which file needs to be used during the running process of the application, and then the file is loaded into the memory. Compared with the scheme of loading files into memory while the application is running, this scheme consumes less time, which can improve the smoothness of the running of the application and help to match user needs. In addition, the solution of loading files into memory while the application is running will also lead to the scattered distribution of related files required by the application in the external memory, which will further slow down the loading of files and make the application run more unsmoothly; but this solution When the application starts, the files to be used are loaded into the memory, so that the application can directly read the required files from the memory during the running process, without the need to load the files during the running process, avoiding the application process. The distribution of related files required at runtime in external memory is scattered, which helps to further improve the smoothness of application running.

本申请第八实施方式涉及一种计算机可读存储介质,存储有计算机程序。计算机程序被处理器执行时实现第一、第二或第三实施方式中的文件预加载方法。The eighth embodiment of the present application relates to a computer-readable storage medium storing a computer program. The computer program implements the file preloading method in the first, second or third embodiments when executed by the processor.

即,本领域技术人员可以理解,实现上述实施方式方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施方式所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be implemented by instructing the relevant hardware through a program, and the program is stored in a storage medium and includes several instructions to make a device ( It may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, removable hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

本领域的普通技术人员可以理解,上述各实施方式是实现本申请的具体实施方式,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。Those of ordinary skill in the art can understand that the above-mentioned embodiments are specific embodiments for realizing the present application, and in practical applications, various changes in form and details can be made without departing from the spirit and the spirit of the present application. scope.

Claims (10)

1.一种文件预加载方法,其特征在于,包括:1. a file preloading method, is characterized in that, comprises: 在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件;其中,所述文件为所述应用程序运行过程中使用到的文件;When detecting the opening instruction of the application, search for a file corresponding to the application according to the correspondence between the pre-stored file and the application; wherein, the file is the file used in the running process of the application; 将查找出的所述对应的文件加载至内存中,并在所述应用程序的运行过程中直接读取加载在所述内存中的文件。Loading the found corresponding file into the memory, and directly reading the file loaded in the memory during the running process of the application program. 2.根据权利要求1所述的文件预加载方法,其特征在于,所述文件和应用程序的对应关系的预先存储方式包括:2. file preloading method according to claim 1, is characterized in that, the pre-storage mode of the correspondence of described file and application program comprises: 在应用程序首次运行时,记录应用程序包名及所述应用程序调用的文件的指示信息作为应用程序和文件的对应关系,并存储至数据库中;或者,When the application program runs for the first time, record the package name of the application program and the indication information of the file called by the application program as the corresponding relationship between the application program and the file, and store it in the database; or, 从网络侧获取文件和应用程序的对应关系,并存储至数据库中。Obtain the correspondence between files and applications from the network side, and store them in the database. 3.根据权利要求2所述的文件预加载方法,其特征在于,所述在应用程序首次运行时,记录应用程序包名及所述应用程序调用的文件的指示信息作为应用程序和文件的对应关系,包括:3. The file preloading method according to claim 2, characterized in that, when the application program runs for the first time, the instruction information of the application program package name and the file called by the application program is recorded as the correspondence between the application program and the file relationships, including: 在首次启动应用程序时,将所述应用程序的包名记录至缓冲中;When the application is started for the first time, the package name of the application is recorded in the buffer; 在检测到有文件被打开操作时,获取所述缓冲中的应用程序的包名;When detecting that a file is opened, obtain the package name of the application in the buffer; 将所述被打开操作的文件的指示信息,作为所述缓冲中的应用程序的包名所对应的文件的指示信息,写入数据库中。The indication information of the file to be opened is written into the database as the indication information of the file corresponding to the package name of the application program in the buffer. 4.根据权利要求3所述的文件预加载方法,其特征在于,所述文件的指示信息至少包括所述文件的路径和所述文件的名称。4 . The file preloading method according to claim 3 , wherein the indication information of the file includes at least a path of the file and a name of the file. 5 . 5.根据权利要求1所述的文件预加载方法,其特征在于,所述对应关系中的应用程序均为目标优化程序;在根据所述应用程序和所述对应关系,查找与所述应用程序对应的文件之前,所述文件预加载方法还包括:5. The file preloading method according to claim 1, wherein the application programs in the corresponding relationship are all target optimization programs; Before the corresponding file, the file preloading method further includes: 判断当前检测到的开启指令开启的应用程序是否为预设的目标优化程序;Determine whether the application program opened by the currently detected opening command is the preset target optimization program; 当所述开启指令开启的应用程序为所述目标优化程序时,根据所述应用程序和所述对应关系,查找与所述被打开的应用程序对应的文件。When the application program opened by the opening instruction is the target optimization program, a file corresponding to the opened application program is searched according to the application program and the corresponding relationship. 6.根据权利要求5所述的文件预加载方法,其特征在于,所述判断当前检测到的开启指令开启的应用程序是否为预设的目标优化程序,包括:6. The file preloading method according to claim 5, wherein the judging whether the application program opened by the currently detected opening instruction is a preset target optimization program, comprising: 获取当前检测到的开启指令开启的应用程序的包名;Get the package name of the application program opened by the currently detected open command; 根据获取的所述包名判断所述开启指令开启的应用程序是否为预设的目标优化程序。According to the obtained package name, it is determined whether the application program opened by the opening instruction is a preset target optimization program. 7.根据权利要求1所述的文件预加载方法,其特征在于,还包括:7. The file preloading method according to claim 1, further comprising: 在所述查找与所述应用程序对应的文件之前,判断当前内存的占用率;Before the searching for the file corresponding to the application, determine the occupancy rate of the current memory; 若当前的内存的占用率小于预设的占用率门限,则再执行所述查找与所述应用程序对应的文件。If the current occupancy rate of the memory is less than the preset occupancy rate threshold, the searching for the file corresponding to the application program is performed again. 8.一种文件预加载装置,其特征在于,包括:8. A file preloading device, comprising: 查找模块,用于在检测到应用程序的开启指令时,根据预先存储的文件和应用程序的对应关系,查找与所述应用程序对应的文件;其中,所述文件为所述应用程序运行过程中使用到的文件;The search module is used to search for the file corresponding to the application program according to the correspondence between the pre-stored file and the application program when detecting the opening instruction of the application program; wherein, the file is in the running process of the application program documents used; 预加载模块,用于将所述查找模块查找出的所述对应的文件加载至内存中;a preloading module for loading the corresponding file found by the search module into the memory; 运行模块,用于在运行应用程序的过程中直接读取加载在所述内存中的文件。The running module is used to directly read the file loaded in the memory during the running of the application program. 9.一种电子设备,其特征在于,包括:9. An electronic device, characterized in that, comprising: 至少一个处理器;以及,at least one processor; and, 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至7中任一项所述的文件预加载方法。The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the execution of any one of claims 1 to 7 The file preloading method described above. 10.一种计算机可读存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的文件预加载方法。10 . A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the file preloading method according to any one of claims 1 to 7 is implemented. 11 .
CN201810928017.1A 2018-08-15 2018-08-15 File preloading method and device, electronic equipment and computer readable storage medium Pending CN109284142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810928017.1A CN109284142A (en) 2018-08-15 2018-08-15 File preloading method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810928017.1A CN109284142A (en) 2018-08-15 2018-08-15 File preloading method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN109284142A true CN109284142A (en) 2019-01-29

Family

ID=65183545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810928017.1A Pending CN109284142A (en) 2018-08-15 2018-08-15 File preloading method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109284142A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321179A (en) * 2019-07-08 2019-10-11 深圳市迅雷网络技术有限公司 A kind of application program launching method, system, device and computer storage medium
CN110659081A (en) * 2019-09-10 2020-01-07 北京达佳互联信息技术有限公司 File processing method and device for program object and electronic equipment
CN112817648A (en) * 2019-10-31 2021-05-18 深圳市万普拉斯科技有限公司 Application program file preloading method and device and mobile terminal
CN113849245A (en) * 2021-09-23 2021-12-28 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN114077461A (en) * 2020-08-21 2022-02-22 北京小米移动软件有限公司 Application running method, device, device and storage medium
CN114461588A (en) * 2021-08-20 2022-05-10 荣耀终端有限公司 Method and electronic device for adjusting pre-reading window
CN116661882A (en) * 2022-11-22 2023-08-29 荣耀终端有限公司 Method for preloading applet, electronic device and storage medium
CN117112046A (en) * 2023-04-04 2023-11-24 荣耀终端有限公司 Application startup method and electronic device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070028224A1 (en) * 2005-07-28 2007-02-01 Lite-On Technology Corporation Program initiation methods and embedded systems utilizing the same
CN103677920A (en) * 2013-12-11 2014-03-26 清华大学 Critical application program identifying and starting accelerating method and system
CN108228876A (en) * 2018-01-19 2018-06-29 维沃移动通信有限公司 A kind of method and mobile terminal for reading file data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070028224A1 (en) * 2005-07-28 2007-02-01 Lite-On Technology Corporation Program initiation methods and embedded systems utilizing the same
CN103677920A (en) * 2013-12-11 2014-03-26 清华大学 Critical application program identifying and starting accelerating method and system
CN108228876A (en) * 2018-01-19 2018-06-29 维沃移动通信有限公司 A kind of method and mobile terminal for reading file data

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321179B (en) * 2019-07-08 2023-02-14 深圳市迅雷网络技术有限公司 Application program startup method, system, device and computer storage medium
CN110321179A (en) * 2019-07-08 2019-10-11 深圳市迅雷网络技术有限公司 A kind of application program launching method, system, device and computer storage medium
CN110659081A (en) * 2019-09-10 2020-01-07 北京达佳互联信息技术有限公司 File processing method and device for program object and electronic equipment
CN110659081B (en) * 2019-09-10 2022-12-27 北京达佳互联信息技术有限公司 File processing method and device for program object and electronic equipment
CN112817648A (en) * 2019-10-31 2021-05-18 深圳市万普拉斯科技有限公司 Application program file preloading method and device and mobile terminal
CN114077461A (en) * 2020-08-21 2022-02-22 北京小米移动软件有限公司 Application running method, device, device and storage medium
CN114461588A (en) * 2021-08-20 2022-05-10 荣耀终端有限公司 Method and electronic device for adjusting pre-reading window
CN113849245A (en) * 2021-09-23 2021-12-28 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN113849245B (en) * 2021-09-23 2023-09-12 武汉深之度科技有限公司 Application program running method, computing device and storage medium
CN116661882A (en) * 2022-11-22 2023-08-29 荣耀终端有限公司 Method for preloading applet, electronic device and storage medium
CN116661882B (en) * 2022-11-22 2024-04-16 荣耀终端有限公司 Method for preloading applet, electronic device and storage medium
CN117112046A (en) * 2023-04-04 2023-11-24 荣耀终端有限公司 Application startup method and electronic device
CN117112046B (en) * 2023-04-04 2024-05-10 荣耀终端有限公司 Application program starting method and electronic equipment

Similar Documents

Publication Publication Date Title
CN109284142A (en) File preloading method and device, electronic equipment and computer readable storage medium
US10922102B2 (en) Method of controlling applications in a terminal and terminal
US20210389973A1 (en) Electronic device and method for operating the same
US11249643B2 (en) Electronic device for displaying list of executable applications on split screen and operating method thereof
US9690621B2 (en) Multitasking method and electronic device therefor
CN106357921B (en) Application data sharing method and device and mobile terminal
CN106484547B (en) A management method, device and terminal for multi-opening applications
US10402222B2 (en) Task migration method and apparatus
CN104516760A (en) Operating system hot-switching method and device and mobile terminal
US20140067879A1 (en) Application management for a terminal
CN110865837B (en) Method and terminal for system upgrade
CN106528210A (en) Application program running method and device
CN108090345B (en) Linux system external command execution method and device
US11604656B2 (en) Method and apparatus for managing application
US20210026807A1 (en) Method for managing data associated with application and electronic device therefor
EP2869604B1 (en) Method, apparatus and device for processing a mobile terminal resource
CN109117153B (en) Application processing method, device, terminal and storage medium
CN112394906A (en) Method and equipment for switching application operation
CN106502732B (en) Application closing method and device and intelligent terminal
CN106936994B (en) A kind of control method of broadcast recipients, device and mobile terminal
CN106383672B (en) Data deleting method and device for multi-open application and mobile terminal
CN111435318A (en) Dex optimization method of application program and terminal
CN106650403B (en) Multi-open application permission management method and device and intelligent terminal
CN108132844B (en) Plug-in downloading method and device
CN108089897A (en) Application program starting management method and device, storage medium and mobile 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