WO2023245366A1 - 应用管理方法、装置、电子设备以及存储介质 - Google Patents

应用管理方法、装置、电子设备以及存储介质 Download PDF

Info

Publication number
WO2023245366A1
WO2023245366A1 PCT/CN2022/099930 CN2022099930W WO2023245366A1 WO 2023245366 A1 WO2023245366 A1 WO 2023245366A1 CN 2022099930 W CN2022099930 W CN 2022099930W WO 2023245366 A1 WO2023245366 A1 WO 2023245366A1
Authority
WO
WIPO (PCT)
Prior art keywords
configuration information
application instance
application
target process
instance
Prior art date
Application number
PCT/CN2022/099930
Other languages
English (en)
French (fr)
Inventor
周冰清
Original Assignee
北京小米移动软件有限公司
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 北京小米移动软件有限公司 filed Critical 北京小米移动软件有限公司
Priority to CN202280004237.XA priority Critical patent/CN117616390A/zh
Priority to PCT/CN2022/099930 priority patent/WO2023245366A1/zh
Publication of WO2023245366A1 publication Critical patent/WO2023245366A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • the present disclosure relates to the technical field of electronic equipment, and specifically relates to an application management method, device, electronic equipment and storage medium.
  • embodiments of the present disclosure provide an application management method, device, electronic device and storage medium.
  • embodiments of the present disclosure provide an application management method, applied to electronic devices, and the method includes:
  • the current first configuration information of the first application instance is obtained, and the first configuration information is cached in the current
  • the target processes running include:
  • the first configuration information is determined according to the global configuration information and the state parameters, and the first configuration information is cached in the target process.
  • the method described in the present disclosure further includes:
  • the target process is configured according to the first configuration information of the first application instance cached in the target process.
  • obtaining the second configuration information of the second application instance and initializing the configuration of the target process according to the second configuration information includes:
  • obtaining the second configuration information of the second application instance and initializing the configuration of the target process according to the second configuration information includes:
  • initializing the configuration of the target process according to the second configuration information to run the second application instance in the target process includes:
  • Configure the application environment of the target process according to the global configuration information configure the second application instance in the target process according to the status parameter, so as to run the second application instance in the target process.
  • both the first configuration information and the second configuration information include at least one of the following:
  • System capability interface information application timer information, application plug-in information, multi-language information, and localization setting information.
  • the electronic device includes a wearable device.
  • an application management device including:
  • the first acquisition module is configured to, in response to switching from the currently running first application instance to the second application instance, acquire the current first configuration information of the first application instance, and cache the first configuration information in the current In the running target process;
  • the second acquisition module is configured to acquire the second configuration information of the second application instance, and initialize the configuration of the target process according to the second configuration information, so as to run the second application instance in the target process.
  • the first acquisition module is configured to:
  • the first configuration information is determined according to the global configuration information and the state parameters, and the first configuration information is cached in the target process.
  • the device of the present disclosure further includes a configuration module configured to:
  • the target process is configured according to the first configuration information of the first application instance cached in the target process.
  • the second acquisition module is configured as:
  • the second acquisition module is configured as:
  • the second acquisition module is configured to:
  • Configure the application environment of the target process according to the global configuration information configure the second application instance in the target process according to the status parameter, so as to run the second application instance in the target process.
  • both the first configuration information and the second configuration information include at least one of the following:
  • System capability interface information application timer information, application plug-in information, multi-language information, and localization setting information.
  • the electronic device includes a wearable device.
  • an electronic device including:
  • a memory stores computer instructions for causing the processor to execute the method according to any implementation manner of the first aspect.
  • an embodiment of the present disclosure provides a storage medium that stores computer instructions, and the computer instructions are used to cause a computer to execute the method according to any embodiment of the first aspect.
  • the application management method of the embodiment of the present disclosure includes, in response to switching from the currently running first application instance to the second application instance, caching the first configuration information of the first application instance in the target process, and based on the second application instance's
  • the second configuration information performs initial configuration on the target process to run the second application instance in the target process.
  • there is no need to create a new process when switching applications and based on the configuration information cached when the application is switched to the background, when the application is switched to the foreground, there is no need to restart the application, and the application can be directly passed through
  • the cached configuration information enables the application to run, enables multiple applications to be kept alive in a single process at the same time, and improves application startup efficiency.
  • Figure 1 is a flowchart of an application management method according to some embodiments of the present disclosure.
  • FIG. 2 is a flowchart of an application management method according to some embodiments of the present disclosure.
  • FIG. 3 is a flowchart of an application management method in some embodiments of the present disclosure.
  • Figure 4 is a flowchart of an application management method according to some embodiments of the present disclosure.
  • Figure 5 is a structural block diagram of an application management device according to some embodiments of the present disclosure.
  • Figure 6 is a structural block diagram of an electronic device according to some embodiments of the present disclosure.
  • APP Application
  • the system creates an independent process for the application and allocates a certain amount of memory space to the process, and implements the functions of the application through the process.
  • devices such as smart watches and smart bracelets
  • their memory space is small and their hardware performance is limited, and often only one process can exist at the same time.
  • devices with poor memory space and hardware performance are defined as Lightweight device.
  • embodiments of the present disclosure provide an application management method, device, electronic device and storage medium, aiming to use a single process to achieve simultaneous keep-aliveness of multiple applications and improve multi-application switching without basically increasing memory consumption.
  • the efficiency is particularly beneficial for deployment on lightweight electronic devices with low memory.
  • an embodiment of the present disclosure provides an application management method, which can be applied to electronic devices.
  • the specific type of the electronic device can be any device type suitable for implementation, such as a smart phone, a tablet, a smart watch, a smart bracelet, etc.
  • the present disclosure does not limit this.
  • the embodiments of the disclosure are more effective for lightweight devices with poor memory and hardware performance. This is because devices such as smartphones and tablets have strong memory space and system performance. When multiple applications are running, a process can be created for each application to ensure that multiple applications can survive in the background. For devices such as smart watches and smart bracelets, the memory space is very limited, and often only one process or even one thread can exist at the same time. Therefore, the disclosed method can be used to achieve the simultaneous survival of multiple applications in a single process or single thread. The following description will be made in conjunction with the embodiments.
  • Process It is the basic unit of resource allocation and scheduling in the system.
  • the process is the container of threads.
  • the system will create a process for the application, allocate a certain amount of memory space to the process, and initialize the process according to the relevant configuration information of the application to implement the application. Correct operation of the program.
  • Thread It is the smallest unit that the system can perform operation scheduling. It is included in the process and is the actual operating unit in the process. That is, a process can include at least one thread, and each thread performs different tasks in parallel. For example, when an application is started, the application process can include multiple threads, each thread is responsible for performing different tasks, thereby realizing multiple functions of the application.
  • Instance In object-oriented programming, the process of creating an object using a class is usually called instantiation, and creating an object is an instance.
  • the applications themselves are lightweight applications and can only implement a relatively single function. Therefore, when the system runs the application, it can only run a single thread.
  • the application management method of the present disclosure includes:
  • an application instance refers to an instance of an application running in a process.
  • the system switches from a currently running application to another application, defines the currently running application as the first application instance, and defines the other application after switching as the second application instance.
  • the system When the system runs the first application instance, it will create a process for the first application instance and allocate memory to the process.
  • multiple application instances implement application switching in the same process, and the system process is defined as the target process.
  • the system when the system detects that the currently running first application instance is switched to the second application instance, it means that the first application instance needs to be switched to running in the background, and the second application instance remains running in the foreground.
  • the first configuration information of the first application instance at the current moment is obtained, and the first Configuration information is cached in the currently running target process.
  • the configuration information of an application instance refers to the relevant configuration information when running the application. It can be understood that when the application is started, the created process needs to be initialized according to the relevant configuration information declared by the application. Moreover, as the application runs, some status parameters in the configuration information will also change.
  • the status parameters may include scheduled task parameters, timer parameters, etc.
  • the relevant configuration information and status parameters of the first application instance at the current moment can be obtained, the first configuration information at the current moment can be obtained, and then the first application instance can be obtained.
  • Configuration information is cached in the memory of the currently running target process.
  • the target process is to run the second application instance normally and needs to reinitialize the configuration according to the second configuration information corresponding to the second application instance.
  • the configuration information of the current application instance will be cached. Therefore, in the embodiment of the present disclosure, the second application instance may be an application that has been opened before but was switched to the background, or it may be an application that is opened for the first time.
  • the second configuration information of the second application instance cached in the process memory can be directly read.
  • the program file (Application File) corresponding to the second application instance can be read to obtain the second configuration information declared in the program file. This will be described in the following embodiments of the present disclosure and will not be described in detail here.
  • the currently running target process is directly initialized and configured according to the second configuration information. That is, in the embodiment of the present disclosure, there is no need to end the currently running target process, but directly Configure the second application instance for the currently running target process, thereby running the second application instance in the target process.
  • the first application instance when switching from the first application instance to the second application instance in the target process, since the first configuration information of the first application instance is cached in the target process, when switching from the second application instance to the second application instance again, the first application instance can be initialized according to the first configuration information cached in the target process.
  • the application management method of the embodiment of the present disclosure further includes: in response to switching from the currently running second application instance to the first application instance, configuring the target according to the first configuration information of the first application instance cached in the target process. process.
  • the system when the system switches from the second application instance to the first application instance again, since the first configuration information when the first application instance enters the background has been cached in the process memory in S110, it can be directly accessed from Read the first configuration information of the first application instance in the memory, and then initialize the configuration of the target process according to the first configuration information, so that the first application instance can maintain the state when it enters the background and continue to run normally in the target process without restarting start up.
  • the first configuration information cached when the first application instance switches to background running includes global configuration information corresponding to the first application instance and status parameters corresponding to the moment when it enters the background.
  • the global configuration information refers to the relevant configuration information required for the operation declared by the first application instance
  • the status parameters refer to parameters that change with the operation of the first application instance, such as scheduled task progress, etc.
  • first application instance and the second application instance when they switch between front and back, they can run in the same target process, and both can survive in the same process at the same time, achieving Keep-alive of multiple applications in a single process.
  • the application management method of the present disclosure includes:
  • S220 Determine the first configuration information according to the global configuration information and status parameters, and cache the first configuration information in the target process.
  • the system when the system switches from a first application instance to a second application instance, the first application instance needs to be maintained in the background while the second application instance runs in the foreground.
  • the first configuration information includes global configuration information and status parameters.
  • Global configuration information refers to the global variable configuration declared by the first application instance, which may include, for example: system capability interface information, used to declare the API (Application Programming Interface, application program interface) required by the application instance; application timer information, Used to declare the timer required by the application instance; application plug-in information, used to declare plug-in related information required by the application instance; multi-language information, used to declare the language information corresponding to the application instance; and some localization setting information.
  • Status parameters refer to dynamic parameters corresponding to the first application instance, which may change with the operation of the first application instance, such as scheduled task parameters, timer parameters, etc.
  • the global configuration information and status parameters corresponding to the first application instance at the current moment can be cached in the memory of the target process.
  • the first application instance enters the background and runs. At this time, only the current first configuration information of the first application instance needs to be saved. There is no need to cache data other than the first configuration information, such as the display interface. Therefore, the first application When the instance is running in the background, the memory space occupied by the first configuration information is very small and will not affect the operation of the second application instance in the target process.
  • the first application instance After caching the first configuration information of the first application instance, the first application instance enters the background and is maintained. At this time, the second application instance can be configured into the target process and run in the foreground.
  • the second application instance is an application that has been cached in the target process before, that is, before running the first application instance, the second application instance has cached the corresponding second configuration information in the target process according to the foregoing process.
  • the target process it means that when the first application instance is running, the second application instance has maintained state in the background of the target process.
  • the second configuration information of the second application instance since the second configuration information of the second application instance has been cached in the memory, it is only necessary to directly read the second configuration information of the second application instance from the memory of the target process, and then configure the second application instance according to the second configuration information. After the target process is initialized and configured, the second application instance can be run in the target process.
  • the configuration information of the current application instance is cached, so that the current application instance is maintained in the background.
  • the application instance is switched back to the foreground again, it only needs to read the previously cached configuration information from the memory to initialize the configuration of the target process.
  • the second application instance is a newly opened application, that is, before running the first application instance, the second configuration information of the second application instance is not cached in the memory of the target process, the second application The instance is not an application held in the background.
  • the program file (Application File) of the second application instance needs to be read, and the program file declares the second configuration information required by the second application instance.
  • Configuration information By reading the program file of the second application instance, the second configuration information can be obtained, and then the target process is initialized and configured according to the second configuration information, so that the second application instance can be run in the target process.
  • the second configuration information may also include the aforementioned global configuration information and status parameters.
  • the global configuration information corresponding to the second application instance at the switching time and The current state parameters are cached in the target process's memory.
  • the configuration information of the background application is cached in the target process, so that when the background application switches to the foreground, the cached configuration information can be used to initialize the configuration in the current process, thereby realizing a single process and multiple processes. Keep alive while applying.
  • the application management method of this disclosure example includes a process of initializing the configuration of the target process according to the second configuration information, including:
  • S320 Configure the application environment of the target process according to the global configuration information, and configure the second application instance in the target process according to the status parameters to run the second application instance in the target process.
  • the second configuration information may include global configuration information and status parameters.
  • Global configuration information refers to the global variable configuration declared by the second application instance, which may include the aforementioned system capability interface information, application timer information, application plug-in information, multi-language information, localization setting information, etc.
  • Status parameters refer to some dynamic parameters corresponding to the second application instance, such as scheduled task parameters, timer parameters, etc. It can be understood that if the second application instance is an application that has been cached in the target process, the status parameter may be the parameter value corresponding to the last time the second application instance was switched to the background; if the second application instance is an application started for the first time, the status parameter Parameters can be initial default parameter values.
  • the target After obtaining the global configuration information and status parameters of the second configuration information, the target can be configured based on the system capability interface information, application timer information, application plug-in information, multi-language information and localization setting information declared by the global configuration information. Configure the application environment of the process.
  • the second application instance is configured in the target process according to the state parameter of the second application instance, so as to run the second application instance in the target process and switch it to the foreground.
  • the application management method of the present disclosure includes:
  • S410 Render the display interface corresponding to the application instance according to the configuration information of the application instance currently running in the target process.
  • a display device refers to a device used to display the interface of an electronic device, such as a display module of a smartphone, a display screen of a smart watch, etc.
  • the display device may be, for example, an LCD (Liquid Crystal Display) device, an OLED (Organic Light-Emitting Diode, organic light-emitting semiconductor) device, etc., which is not limited by the present disclosure.
  • the system switches from the second application instance to the first application instance
  • the first application instance has been cached in the memory of the target process and is switched to the background.
  • the first configuration information needs to be read, and the first configuration information of the cache needs to be read, and the target process is initialized and configured according to the first configuration information, so that the first application instance can run normally in the target process.
  • the visualization level it is necessary to re-render the display interface corresponding to the first application instance, that is, the display interface of the application program, according to the first configuration information, and output and display the display interface on the display device.
  • the display interface corresponding to the first application program can be displayed on the display device of the electronic device, and the user realizes the related information of the first application program through the display interface. operate.
  • the display interface can be rendered according to the above process, so that the display interface of the application instance is displayed on the display device.
  • the above output is displayed, which will not be described again in this disclosure.
  • the user first starts the first application instance, and the first application instance runs normally in the target process. Then switch from the first application instance to the second application instance. Based on the aforementioned management method, the first configuration information of the first application instance can be cached in the target process, the first application instance can be maintained in the background, and the second application instance can be configured Runs normally in the target process. Afterwards, switching from the second application instance to the third application instance, based on the aforementioned management method, the second configuration information of the second application instance can be cached in the target process, and the second application instance can also be entered into the background to maintain, and the third application instance The configuration runs normally in the target process. Then, the third application instance is switched back to the first application instance.
  • the third configuration information of the third application instance can be cached in the target process, the third application instance can be maintained in the background, and the cached information can be read.
  • the first configuration information configures the first application instance to run normally in the target process.
  • embodiments of the present disclosure provide an application management device, which can be applied to electronic devices.
  • the specific type of the electronic device can be any device type suitable for implementation, such as a smart phone, a tablet, a smart watch, a smart bracelet, etc.
  • the present disclosure does not limit this.
  • the application management device of the present disclosure includes:
  • the first acquisition module 10 is configured to, in response to switching from the currently running first application instance to the second application instance, acquire the current first configuration information of the first application instance, and cache the first configuration information in the currently running target. in progress;
  • the second acquisition module 20 is configured to acquire the second configuration information of the second application instance, and initialize the configuration of the target process according to the second configuration information, so as to run the second application instance in the target process.
  • the first acquisition module 10 is configured as:
  • the first configuration information is determined according to the global configuration information and the status parameters, and the first configuration information is cached in the target process.
  • the device of the present disclosure further includes a configuration module, and the configuration module is configured to:
  • the target process is configured according to the first configuration information of the first application instance cached in the target process.
  • the second acquisition module 20 is configured as:
  • the second acquisition module 20 is configured as:
  • the second configuration information cached in the target process is obtained, and the configuration of the target process is initialized according to the second configuration information.
  • the second acquisition module 20 is configured as:
  • the device of the present disclosure further includes a display module, and the display module is configured to:
  • a display interface is output on the display device of the electronic device.
  • both the first configuration information and the second configuration information include at least one of the following:
  • System capability interface information application timer information, application plug-in information, multi-language information, and localization setting information.
  • the electronic device includes a wearable device.
  • an electronic device including:
  • the memory stores computer instructions for causing the processor to execute the method according to any embodiment of the first aspect.
  • an embodiment of the present disclosure provides a storage medium storing computer instructions, and the computer instructions are used to cause a computer to execute the method according to any embodiment of the first aspect.
  • FIG. 6 shows a structural block diagram of an electronic device in some embodiments of the present disclosure. The relevant principles of electronic devices and storage media in some embodiments of the present disclosure will be described below in conjunction with FIG. 6 .
  • electronic device 1800 may include one or more of the following components: processing component 1802, memory 1804, power supply component 1806, multimedia component 1808, audio component 1810, input/output (I/O) interface 1812, sensor component 1816, and Communication component 1818.
  • Processing component 1802 generally controls the overall operations of electronic device 1800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • Processing component 1802 may include one or more processors 1820 to execute instructions.
  • processing component 1802 may include one or more modules that facilitate interaction between processing component 1802 and other components.
  • processing component 1802 may include a multimedia module to facilitate interaction between multimedia component 1808 and processing component 1802.
  • the processing component 1802 can read executable instructions from the memory to implement electronic device-related functions.
  • Memory 1804 is configured to store various types of data to support operations at electronic device 1800 . Examples of such data include instructions for any application or method operating on electronic device 1800, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 1804 may be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EEPROM), Programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EEPROM erasable programmable read-only memory
  • EPROM Programmable read-only memory
  • PROM programmable read-only memory
  • ROM read-only memory
  • magnetic memory flash memory, magnetic or optical disk.
  • Power supply component 1806 provides power to various components of electronic device 1800 .
  • Power supply components 1806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 1800 .
  • Multimedia component 1808 includes a display screen that provides an output interface between the electronic device 1800 and the user.
  • multimedia component 1808 includes a front-facing camera and/or a rear-facing camera.
  • the front camera and/or the rear camera may receive external multimedia data.
  • Each front-facing camera and rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
  • Audio component 1810 is configured to output and/or input audio signals.
  • audio component 1810 includes a microphone (MIC) configured to receive external audio signals when electronic device 1800 is in operating modes, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1804 or sent via communications component 1818 .
  • audio component 1810 includes a speaker for outputting audio signals.
  • the I/O interface 1812 provides an interface between the processing component 1802 and a peripheral interface module.
  • the peripheral interface module may be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: Home button, Volume buttons, Start button, and Lock button.
  • Sensor component 1816 includes one or more sensors for providing various aspects of status assessment for electronic device 1800 .
  • the sensor component 1816 can detect the open/closed state of the electronic device 1800, the relative positioning of components, such as the display and keypad of the electronic device 1800, the sensor component 1816 can detect the electronic device 1800 or a component of the electronic device 1800. changes in position, the presence or absence of user contact with the electronic device 1800 , the orientation or acceleration/deceleration of the electronic device 1800 and changes in the temperature of the electronic device 1800 .
  • Sensor component 1816 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 1816 may include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 1816 may include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 1818 is configured to facilitate wired or wireless communication between electronic device 1800 and other devices.
  • the electronic device 1800 may access a wireless network based on a communication standard, such as Wi-Fi, 2G, 3G, 4G, 5G or 6G, or a combination thereof.
  • communication component 1818 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.
  • the communications component 1818 includes a near field communications (NFC) module to facilitate short-range communications.
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • electronic device 1800 may be configured by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable Programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable Programmed gate array
  • controller microcontroller, microprocessor or other electronic component implementation.
  • embodiments of the present disclosure provide a chip, including one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send signals to the processor.
  • the signal includes a computer instruction stored in a memory; when the processor executes the computer instruction, the electronic device is caused to execute the method described in any implementation manner of the first aspect.
  • the chip provided by the present disclosure can be any chip type suitable for implementation, such as a CPU (central processing unit, central processing unit) chip, a GPU (graphics processing unit, graphics processor) chip, an SoC (system-level processor) Chip, System on Chip), etc., may also be an accelerator chip dedicated to artificial intelligence technology, such as an AI (Artificial Intelligence, artificial intelligence) accelerator, etc. This disclosure does not limit this.

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

本公开涉及电子设备技术领域,具体提供了一种应用管理方法、装置、电子设备以及存储介质。一种应用管理方法,包括:响应于由当前运行的第一应用实例切换至第二应用实例,将第一应用实例的第一配置信息缓存在当前运行的目标进程中;根据获取的第二应用实例的第二配置信息对目标进程初始化配置。本公开实施方式,实现单进程中多个应用的同时保活,提高应用启动效率。

Description

应用管理方法、装置、电子设备以及存储介质 技术领域
本公开涉及电子设备技术领域,具体涉及一种应用管理方法、装置、电子设备以及存储介质。
背景技术
随着电子设备的飞速发展,电子设备中的应用程序(APP,Application)也越来越多。相关技术中,电子设备由应用程序A切换至应用程序B时,为了使得应用程序A可以在后台存活,需要保留应用程序A的进程,同时为应用程序B创建一个新的进程。
但是,对于一些轻量级电子设备,如穿戴设备,受限于内存空间及***能力,往往无法同时运行多个进程。从而在由应用程序A切换至应用程序B时,需要结束应用程序A的进程,重新创建应用程序B的进程,导致用户重新切回应用程序A时,需要重新初始化应用,体验较差。
发明内容
为实现多应用切换的效率,本公开实施方式提供了一种应用管理方法、装置、电子设备以及存储介质。
第一方面,本公开实施方式提供了一种应用管理方法,应用于电子设备,所述方法包括:
响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例当前的第一配置信息,并将所述第一配置信息缓存在当前运行的目标进程中;
获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置,以在所述目标进程中运行所述第二应用实例。
在一些实施方式中,所述响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例当前的第一配置信息,并将所述第一 配置信息缓存在当前运行的目标进程中,包括:
响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例的全局配置信息以及当前的状态参数;
根据所述全局配置信息和所述状态参数确定所述第一配置信息,并将所述第一配置信息缓存在所述目标进程中。
在一些实施方式中,本公开所述的方法,还包括:
响应于由当前运行的第二应用实例切换至所述第一应用实例,根据所述目标进程中缓存的所述第一应用实例的第一配置信息,配置所述目标进程。
在一些实施方式中,所述获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置,包括:
响应于所述目标进程中未缓存所述第二应用实例的第二配置信息,读取所述第二应用实例的程序文件,得到所述第二应用实例第二配置信息;
根据所述第二配置信息对所述目标进程初始化配置。
在一些实施方式中,所述获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置,包括:
响应于所述目标进程中已缓存所述第二应用实例的第二配置信息,获取所述目标进程中缓存的所述第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置。
在一些实施方式中,根据所述第二配置信息对所述目标进程初始化配置,以在所述目标进程中运行所述第二应用实例,包括:
获取所述第二配置信息包括的全局配置信息和状态参数;
根据所述全局配置信息配置所述目标进程的应用环境,根据所述状态参数在所述目标进程中配置所述第二应用实例,以在所述目标进程中运行所述第二应用实例。
在一些实施方式中,所述第一配置信息和所述第二配置信息均包括以下中至少之一:
***能力接口信息、应用定时器信息、应用插件信息、多语言信息、本地化设置信息。
在一些实施方式中,所述电子设备包括可穿戴设备。
第二方面,本公开实施方式提供了一种应用管理装置,包括:
第一获取模块,被配置为响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例当前的第一配置信息,并将所述第一配置信息缓存在当前运行的目标进程中;
第二获取模块,被配置为获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置,以在所述目标进程中运行所述第二应用实例。
在一些实施方式中,所述第一获取模块被配置为:
响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例的全局配置信息以及当前的状态参数;
根据所述全局配置信息和所述状态参数确定所述第一配置信息,并将所述第一配置信息缓存在所述目标进程中。
在一些实施方式中,本公开的装置还包括配置模块,所述配置模块被配置为:
响应于由当前运行的第二应用实例切换至所述第一应用实例,根据所述目标进程中缓存的所述第一应用实例的第一配置信息,配置所述目标进程。
在一些实施方式中,所述第二获取模块,被配置为:
响应于所述目标进程中未缓存所述第二应用实例的第二配置信息,读取所述第二应用实例的程序文件,得到所述第二应用实例第二配置信息;
根据所述第二配置信息对所述目标进程初始化配置。
在一些实施方式中,所述第二获取模块,被配置为:
响应于所述目标进程中已缓存所述第二应用实例的第二配置信息,获取所述目标进程中缓存的所述第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置。
在一些实施方式中,所述第二获取模块被配置为:
获取所述第二配置信息包括的全局配置信息和状态参数;
根据所述全局配置信息配置所述目标进程的应用环境,根据所述状态参数在所述目标进程中配置所述第二应用实例,以在所述目标进程中运行所述第二应用实例。
在一些实施方式中,所述第一配置信息和所述第二配置信息均包括以下中至少之一:
***能力接口信息、应用定时器信息、应用插件信息、多语言信息、本地化设置信息。
在一些实施方式中,所述电子设备包括可穿戴设备。
第三方面,本公开实施方式提供了一种电子设备,包括:
处理器;和
存储器,存储有计算机指令,所述计算机指令用于使所述处理器执行根据第一方面任意实施方式所述的方法。
第四方面,本公开实施方式提供了一种存储介质,存储有计算机指令,所述计算机指令用于使计算机执行根据第一方面任意实施方式所述的方法。
本公开实施方式的应用管理方法,包括响应于由当前运行的第一应用实例切换至第二应用实例,将第一应用实例的第一配置信息缓存在目标进程中,并且根据第二应用实例的第二配置信息对目标进程进行初始化配置,以在目标进程中运行第二应用实例。本公开实施方式中,在应用切换时无需建立新的进程,而且可以基于应用程序切换至后台时缓存的配置信息,在该应用程序被切换至前台时,无需重新启动该应用程序,可以直接通过缓存的配置信息实现该应用程序的运行,实现单进程中多个应用的同时保活,提高应用启动效率。
附图说明
为了更清楚地说明本公开具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本公开的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是根据本公开一些实施方式中应用管理方法的流程图。
图2是根据本公开一些实施方式中应用管理方法的流程图。
图3是根据本公开一些实施方式中应用管理方法的流程图。
图4是根据本公开一些实施方式中应用管理方法的流程图。
图5是根据本公开一些实施方式中应用管理装置的结构框图。
图6是根据本公开一些实施方式中电子设备的结构框图。
具体实施方式
下面将结合附图对本公开的技术方案进行清楚、完整地描述,显然,所描述的实施方式是本公开一部分实施方式,而不是全部的实施方式。基于本公开中的实施方式,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施方式,都属于本公开保护的范围。此外,下面所描述的本公开不同实施方式中所涉及的技术特征只要彼此之间未构成冲突就可以相互结合。
随着电子设备的飞速发展,电子设备中的应用程序(APP,Application)也越来越多。相关技术中,电子设备在启动应用程序时,***会为该应用程序创建一个独立的进程,并为该进程分配一定的内存空间,通过该进程实现应用程序的功能。
对于智能手机、平板电脑等设备,其内存空间和硬件性能均较强,在同时开启多个应用程序时,***可以同时为每个应用程序创建独立的进程,在应用程序切换至后台运行时,由于***进程一直存在,从而可以保证应用程序在后台存活。
但是,对于智能手表、智能手环等设备而言,其内存空间较小且硬件性能受限,往往只能同时存在一个进程,本公开实施方式中,定义内存空间和硬件性能较差的设备为轻量级设备。
例如相关技术中,智能手表在开启应用程序A时,***为应用程序A创建单独的进程运行,当切换至应用程序B时,只能将应用程序A的进程结束,重新创建应用程序B的进程。而当用户再次切换至应用程序A时,由于应用程序A的进程已结束,***需要结束应用程序B的进程,再次重新创建应用程序A的进程,用户则需要重新等待应用程序A的启动。
由此可见,相关技术中,对于内存空间较小的轻量级电子设备,难以实现多应用的保活,导致设备的使用体验较差。
基于上述缺陷,本公开实施方式提供了一种应用管理方法、装置、电子设备以及存储介质,旨在基本不增加内存消耗的情况下,利用单进程实现多应用的同时保活,提高多应用切换的效率,尤其利于在低内存的轻量级电子设备上部署。
第一方面,本公开实施方式提供了一种应用管理方法,该方法可应用于电子设备。本公开实施方式中,对电子设备的具体类型不作限制,可以是任何适于实施的设备类型,例如智能手机、平板电脑、智能手表、智能手环等等,本公开对此不作限制。
但是,值得说明的是,虽然本公开实施方式中无需对电子设备的类型进行限制,但是本公开实施方式对于内存和硬件性能较差的轻量级设备效果更佳。这是由于,对于智能手机、平板电脑等设备来说,其内存空间和***性能较强,在多应用运行时,可为每个应用创建一个进程,从而保证多个应用均可以在后台存活。而对于智能手表、智能手环等设备来说,其内存空间十分受限,往往只能同时存在一个进程、甚至一个线程,因此利用本公开方法可以实现单进程或单线程的多应用同时存活,下文中结合实施方式进行说明。
首先,对本公开下文实施方式中出现的部分术语进行说明。
进程(Process):是***进行资源分配和调度的基本单元,进程是线程的容器。在电子设备***中,每个应用程序启动时,***会为该应用程序建立一个进程,并为该进程分配一定内存空间,根据该应用程序的相关配置信息对进程进行初始化配置,从而实现该应用程序的正确运行。
线程(Thread):是***能够进行运算调度的最小单元,其包含在进程之中,是进程中的实际运作单元。也即,一个进程中可以包括至少一个线程,每个线程并行执行不同的任务。例如某个应用程序启动时,该应用程序的进程中可以包括多个线程,每个线程负责执行不同的任务,从而实现应用程序的多种功能。
实例(Instance):在面向对象的编程中,通常把用类创建对象的过程称为实例化,创建对象即为实例。
可以理解,对于部分穿戴设备,其包括的应用程序本身为轻量化的应用,只能实现较为单一的功能,因此***在运行应用程序时,只能运行一个单独的线程,本公开实施方式中,即可将穿戴设备中运行的单独的线程理解为一 个进程。也即,本公开实施方式中的进程,可以是包括多个线程的进程,也可以是只包括一个线程的进程,本公开对此不作限制。
如图1所示,在一些实施方式中,本公开示例的应用管理方法,包括:
S110、响应于由当前运行的第一应用实例切换至第二应用实例,获取第一应用实例当前的第一配置信息,并将第一配置信息缓存在当前运行的目标进程中。
可以理解,应用实例是指进程中运行某个应用程序的实例。在本公开示例场景中,***由当前运行的某个应用程序切换至另一个应用程序,定义当前运行的应用程序为第一应用实例,定义切换后的另一个应用程序为第二应用实例。
***在运行第一应用实例时,会为第一应用实例建立一个进程,并为该进程分配内存。本公开实施方式中,多个应用实例均在同一个进程中实现应用切换,定义该***进程为目标进程。
在一些实施方式中,当***检测到当前运行的第一应用实例被切换至第二应用实例时,表示第一应用实例需要被切换至后台运行,第二应用实例保持前台运行。
在此情况下,本公开实施方式中,并非结束第一应用实例的进程,为第二应用实例重新建立新的进程,而是获取第一应用实例当前时刻的第一配置信息,并将第一配置信息缓存在当前运行的目标进程中。
应用实例的配置信息,是指运行应用程序时的相关配置信息,可以理解,应用程序在启动时,需要根据该应用程序所声明的相关配置信息对创建的进程进行初始化。并且,随着应用程序的运行,配置信息中的部分状态参数也会发生变化,其中,状态参数可包括定时任务参数、计时器参数等。
本公开实施方式中,在***由第一应用实例切换至第二应用实例时,可以获取第一应用实例当前时刻的相关配置信息以及状态参数,得到当前时刻的第一配置信息,然后将第一配置信息缓存在当前运行的目标进程内存中。
S120、获取第二应用实例的第二配置信息,并根据第二配置信息对目标进程初始化配置,以在目标进程中运行第二应用实例。
可以理解,本公开实施方式中,在由第一应用实例切换至第二应用实例时,无需结束运行第一应用实例的目标进程,而是基于第二应用实例所声明 的第二配置信息,对当前目标进程进行初始化配置,使得当前目标进程运行第二应用实例。
基于前述可知,目标进程为正常运行第二应用实例,需要根据第二应用实例对应的第二配置信息重新初始化配置。另外,结合步骤S110可知,本公开实施方式中,在由当前应用实例切换至其它应用实例时,会对当前应用实例的配置信息进行缓存。因此,本公开实施方式中,第二应用实例可能是之前开启过但是被切换至后台的应用程序,也可能是首次开启的应用程序。
在一些实施方式中,当第二应用实例为之前开启过但是被切换至后台的应用程序时,可以直接读取进程内存中缓存的第二应用实例的第二配置信息。在另一些实施方式中,当第二应用实例为首次开启的应用程序时,可以读取第二应用实例对应的程序文件(Application File),得到程序文件中声明的第二配置信息。本公开下文实施方式中对此进行说明,在此暂不详述。
在获取第二应用实例对应的第二配置信息之后,根据第二配置信息直接对当前运行的目标进程进行初始化配置,也即,本公开实施方式中,无需结束当前运行的目标进程,而是直接对当前运行的目标进程配置第二应用实例,从而在目标进程中运行第二应用实例。
值得说明的是,本公开实施方式中,由于无需结束当前运行第一应用实例的目标进程,也无需为第二应用实例重新建立进程,从而可以减少进程创建、内存分配等处理的时间,而且,对于第一应用实例和第二应用实例相同的全局配置信息也无需重复配置,只需更改对应的配置参数即可,大大降低了应用启动时间。
通过上述可知,本公开实施方式中,在应用切换时无需建立新的进程,而且可以基于应用程序切换至后台时缓存的配置信息,在该应用程序被切换至前台时,无需重新启动,实现单进程中多个应用的同时保活,提高应用启动效率。
在上述实施方式中,在目标进程中由第一应用实例切换至第二应用实例运行时,由于第一应用实例的第一配置信息缓存在目标进程中,因此在由第二应用实例再次切换至第一应用实例时,即可根据目标进程中缓存的第一配置信息初始化第一应用实例。
也即,本公开实施方式的应用管理方法,还包括:响应于由当前运行的 第二应用实例切换至第一应用实例,根据目标进程中缓存的第一应用实例的第一配置信息,配置目标进程。
本公开实施方式中,在***再次由第二应用实例切换至第一应用实例时,由于在S110中已经在进程内存中缓存了第一应用实例进入后台时的第一配置信息,从而可以直接从内存中读取第一应用实例的第一配置信息,然后根据第一配置信息对目标进程进行初始化配置,以使得第一应用实例可以保持进入后台时刻的状态继续在目标进程中正常运行,无需重新启动。
在一些实施方式中,在第一应用实例切换至后台运行时缓存的第一配置信息中,包括第一应用实例对应的全局配置信息、以及进入后台时刻对应的状态参数。
全局配置信息是指第一应用实例声明的运行所需的相关配置信息,状态参数是指随第一应用实例运行产生变化的参数,例如定时任务进度等。在第一应用实例切换至后台运行时,将当前时刻的状态参数进行保存,从而在第一应用实例再次切换至前台运行时,可以根据保存的状态参数继续运行,无需重新启动第一应用实例,实现第一应用实例的后台保活。
另外可以理解,本公开实施方式中,在第一应用实例与第二应用实例进行前后台切换运行时,两者可以运行在同一个目标进程中,而且两者可以在一个进程中同时存活,实现单进程多应用的保活。
如图2所示,在一些实施方式中,本公开示例的应用管理方法,包括:
S210、响应于当前运行的第一应用实例切换至第二应用实例,获取第一应用实例的全局配置信息以及当前的状态参数。
S220、根据全局配置信息和状态参数确定第一配置信息,并将第一配置信息缓存在目标进程中。
本公开实施方式中,***由第一应用实例切换至第二应用实例时,第一应用实例需要进入后台保持,第二应用实例在前台运行。
可以理解,第一应用实例在目标进程中运行时,需要在目标进程中根据第一应用实例的第一配置信息进行初始化配置。第一配置信息包括全局配置信息以及状态参数。
全局配置信息是指第一应用实例所声明的全局变量配置,其可以包括例如:***能力接口信息,用于声明应用实例所需的API(Application  Programming Interface,应用程序接口);应用定时器信息,用于声明应用实例所需的定时器;应用插件信息,用于声明应用实例所需的插件相关信息;多语言信息,用于声明应用实例对应的语言信息;以及一些本地化设置信息。状态参数是指第一应用实例对应的动态参数,其可以随第一应用实例的运行发生变化,例如定时任务参数、计时器参数等。
第一应用实例在目标进程运行过程中,若***由当前运行第一应用实例切换至第二应用实例,可以将当前时刻第一应用实例对应的全局配置信息以及状态参数缓存在目标进程的内存中。
本公开实施方式中,第一应用实例进入后台运行,此时仅需要保存第一应用实例当前的第一配置信息,对于第一配置信息之外的例如显示界面等数据无需缓存,因此第一应用实例在后台运行时,第一配置信息所占用的内存空间很小,不会对目标进程中第二应用实例的运行产生影响。
在缓存第一应用实例的第一配置信息之后,第一应用实例进入后台保持,此时,第二应用实例即可配置到目标进程中,进行前台运行。
在一些实施方式中,如果第二应用实例为之前已经缓存在目标进程中的应用程序,也即在运行第一应用实例之前,第二应用实例已经按照前述过程将对应的第二配置信息缓存在目标进程中,说明在第一应用实例运行时,第二应用实例已经在目标进程的后台进行状态保持。
在此情况下,由于内存中已经缓存了第二应用实例的第二配置信息,只需要从目标进程的内存中直接读取得到第二应用实例的第二配置信息,然后根据第二配置信息对目标进程进行初始化配置,即可在目标进程中运行第二应用实例。
换言之,本公开实施方式中,在当前应用实例切换至其它应用实例时,会对当前应用实例的配置信息进行缓存,使得当前应用实例进入后台保持。当该应用实例再次被切换回前台运行时,只需要从内存中读取之前缓存的配置信息对目标进程进行初始化配置即可。
在另一些实施方式中,如果第二应用实例为新开启的应用程序,也即在运行第一应用实例之前,第二应用实例的第二配置信息没有缓存在目标进程的内存中,第二应用实例并非后台保持的应用程序。
在此情况下,由于内存中没有缓存第二应用实例的第二配置信息,从而 需要读取第二应用实例的程序文件(Application File),该程序文件中声明了第二应用实例所需的第二配置信息。通过读取第二应用实例的程序文件,可以得到第二配置信息,然后根据第二配置信息对目标进程进行初始化配置,即可在目标进程中运行第二应用实例。
可以理解,本公开实施方式中,第二配置信息同样可以包括前述的全局配置信息和状态参数,在第二应用实例被切换至后台时,可以将切换时刻第二应用实例对应的全局配置信息和当前的状态参数缓存在目标进程的内存中。
通过上述可知,本公开实施方式中,通过将后台应用的配置信息缓存在目标进程中,从而在后台应用切换至前台时,可以通过缓存的配置信息在当前进程中进行初始化配置,实现单进程多应用的同时保活。
如图3所示,在一些实施方式中,本公开示例的应用管理方法,根据第二配置信息对目标进程初始化配置的过程,包括:
S310、获取第二配置信息包括的全局配置信息和状态参数。
S320、根据全局配置信息配置目标进程的应用环境,根据状态参数在目标进程中配置第二应用实例,以在目标进程中运行第二应用实例。
本公开实施方式中,第二配置信息可以包括全局配置信息和状态参数。全局配置信息是指第二应用实例所声明的全局变量配置,其可以包括前述的***能力接口信息、应用定时器信息、应用插件信息、多语言信息以及本地化设置信息等。
状态参数是指第二应用实例对应的一些动态参数,例如定时任务参数、计时器参数等。可以理解,若第二应用实例为已经缓存在目标进程中的应用,状态参数可以是第二应用实例最近一次被切换至后台时刻对应的参数值;若第二应用实例为首次启动的应用,状态参数则可以是初始默认参数值。
在获取第二配置信息的全局配置信息和状态参数之后,即可根据全局配置信息所声明的诸如***能力接口信息、应用定时器信息、应用插件信息、多语言信息以及本地化设置信息,对目标进程的应用环境进行相关配置。同时,根据第二应用实例的状态参数在目标进程中配置第二应用实例,以在目标进程中运行第二应用实例,使其切换至前台运行。
通过上述可知,本公开实施方式中,在应用切换时无需建立新的进程,而且可以基于应用程序切换至后台时缓存的配置信息,在该应用程序被切换 至前台时,无需重新启动,实现单进程中多个应用的同时保活,提高应用启动效率。
在一些实施方式中,在应用实例切换至前台运行时,由于目标进程中仅缓存了应用示例的配置数据,而没有缓存对应的渲染界面,因此需要根据配置数据重新渲染显示界面,下面结合图4实施方式进行说明。
如图4所示,在一些实施方式中,本公开示例的应用管理方法,包括:
S410、根据目标进程当前运行的应用实例的配置信息,渲染应用实例对应的显示界面。
S420、在电子设备的显示装置上输出显示界面。
电子设备包括有显示装置,显示装置是指用于显示电子设备界面的装置,例如智能手机的显示模组、智能手表的显示屏等。在一些实施方式中,显示装置可以是例如LCD(Liquid Crystal Display,液晶显示)装置、OLED(Organic Light-Emitting Diode,有机发光半导体)装置等,本公开对此不作限制。
本公开实施方式中,在某个应用实例被切换至前台运行时,例如***由第二应用实例切换至第一应用实例运行,目标进程的内存中已经缓存第一应用实例被切换至后台运行时的第一配置信息,从而需要读取缓存的第一配置信息,根据第一配置信息对目标进程进行初始化配置,实现第一应用实例在目标进程中正常运行。
同时,在可视化层面,需要根据第一配置信息重新渲染第一应用实例对应的显示界面,也即应用程序的显示界面,并将该显示界面在显示装置上输出显示。对于用户而言,其在将第二应用程序切换至第一应用程序时,电子设备的显示装置上即可显示第一应用程序对应的显示界面,用户通过显示界面实现对第一应用程序的相关操作。
可以理解,上述以第二应用实例切换至第一应用实例为例进行了说明,事实上,对于任意应用实例,均可以按照上述过程进行显示界面渲染,从而将该应用实例的显示界面在显示装置上输出显示,本公开对此不再赘述。
通过上述可知,本公开实施方式中,在应用实例被切换至后台运行时,仅缓存该应用实例的配置信息,对于显示界面等数据不进行缓存,从而只需占用很少的进程内存空间,不会对前台应用实例的运行产生影响,实现单进程中多个应用的同时保活。
另外,值得特别说明的是,上文所述中仅以两个应用实例在目标进程中的切换过程进行了说明,事实上,本公开实施方式中,在同一个目标进程中可以实现更多数量应用实例的保活。
例如一个示例中,用户首先开启第一应用实例,第一应用实例在目标进程中正常运行。然后由第一应用实例切换至第二应用实例,基于前述的管理方法,可以将第一应用实例的第一配置信息缓存在目标进程中,将第一应用实例进入后台保持,第二应用实例配置在目标进程中正常运行。之后由第二应用实例切换至第三应用实例,基于前述的管理方法,可以将第二应用实例的第二配置信息缓存在目标进程中,将第二应用实例也进入后台保持,第三应用实例配置在目标进程中正常运行。再然后由第三应用实力切换回第一应用实例,基于前述的管理方法,可以将第三应用实例的第三配置信息缓存在目标进程中,将第三应用实例进入后台保持,读取缓存的第一配置信息,配置第一应用实例在目标进程中正常运行。
由于目标进程中缓存的仅仅是各个应用实例的配置信息,数据量很小,因此,即使对于智能手环、手表等轻量级的可穿戴设备,同样可以同时存活多个应用实例的配置数据,在同一个进程中实现多个应用程序的保活。用户在切换应用程序时,无需重新建立进程,也无需重新启动应用程序,大大提高使用体验。
通过上述可知,本公开实施方式中,实现单进程中多个应用实例的同时存活,在应用实例前后台切换时,无需建立新的进程,也无需等待应用实例重新启动,减少应用切换时间,尤其利于轻量级的可穿戴设备部署,提高设备使用体验。
第二方面,本公开实施方式提供了一种应用管理装置,该装置可应用于电子设备。本公开实施方式中,对电子设备的具体类型不作限制,可以是任何适于实施的设备类型,例如智能手机、平板电脑、智能手表、智能手环等等,本公开对此不作限制。
如图5所示,在一些实施方式中,本公开示例的应用管理装置,包括:
第一获取模块10,被配置为响应于由当前运行的第一应用实例切换至第二应用实例,获取第一应用实例当前的第一配置信息,并将第一配置信息缓存在当前运行的目标进程中;
第二获取模块20,被配置为获取第二应用实例的第二配置信息,并根据第二配置信息对目标进程初始化配置,以在目标进程中运行第二应用实例。
通过上述可知,本公开实施方式中,在应用切换时无需建立新的进程,而且可以基于应用程序切换至后台时缓存的配置信息,在该应用程序被切换至前台时,无需重新启动,实现单进程中多个应用的同时保活,提高应用启动效率。
在一些实施方式中,第一获取模块10被配置为:
响应于由当前运行的第一应用实例切换至第二应用实例,获取第一应用实例的全局配置信息以及当前的状态参数;
根据全局配置信息和状态参数确定第一配置信息,并将第一配置信息缓存在目标进程中。
在一些实施方式中,本公开的装置还包括配置模块,配置模块被配置为:
响应于由当前运行的第二应用实例切换至第一应用实例,根据目标进程中缓存的第一应用实例的第一配置信息,配置目标进程。
在一些实施方式中,第二获取模块20被配置为:
响应于目标进程中未缓存第二应用实例的第二配置信息,读取第二应用实例的程序文件,得到第二应用实例第二配置信息;
根据第二配置信息对目标进程初始化配置。
在一些实施方式中,第二获取模块20被配置为:
响应于目标进程中已缓存第二应用实例的第二配置信息,获取目标进程中缓存的第二配置信息,并根据第二配置信息对目标进程初始化配置。
在一些实施方式中,第二获取模块20被配置为:
获取第二配置信息包括的全局配置信息和状态参数;
根据全局配置信息配置目标进程的应用环境,根据所述状态参数在所述目标进程中配置所述第二应用实例,以在所述目标进程中运行所述第二应用实例。
在一些实施方式中,本公开的装置,还包括显示模块,显示模块被配置为:
根据目标进程当前运行的应用实例的配置信息,渲染应用实例对应的显示界面;
在电子设备的显示装置上输出显示界面。
在一些实施方式中,第一配置信息和第二配置信息均包括以下中至少之一:
***能力接口信息、应用定时器信息、应用插件信息、多语言信息、本地化设置信息。
在一些实施方式中,电子设备包括可穿戴设备。
通过上述可知,本公开实施方式中,实现单进程中多个应用实例的同时存活,在应用实例前后台切换时,无需建立新的进程,也无需等待应用实例重新启动,减少应用切换时间,尤其利于轻量级的可穿戴设备部署,提高设备使用体验。
第三方面,本公开实施方式提供了一种电子设备,包括:
处理器;和
存储器,存储有计算机指令,计算机指令用于使处理器执行根据第一方面任意实施方式的方法。
第四方面,本公开实施方式提供了一种存储介质,存储有计算机指令,计算机指令用于使计算机执行根据第一方面任意实施方式的方法。
图6中示出了本公开一些实施方式中的电子设备的结构框图,下面结合图6对本公开一些实施方式的电子设备及存储介质相关原理进行说明。
参照图6电子设备1800可以包括以下一个或多个组件:处理组件1802,存储器1804,电源组件1806,多媒体组件1808,音频组件1810,输入/输出(I/O)接口1812,传感器组件1816,以及通信组件1818。
处理组件1802通常控制电子设备1800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件1802可以包括一个或多个处理器1820来执行指令。此外,处理组件1802可以包括一个或多个模块,便于处理组件1802和其他组件之间的交互。例如,处理组件1802可以包括多媒体模块,以方便多媒体组件1808和处理组件1802之间的交互。又如,处理组件1802可以从存储器读取可执行指令,以实现电子设备相关功能。
存储器1804被配置为存储各种类型的数据以支持在电子设备1800的操作。这些数据的示例包括用于在电子设备1800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器1804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件1806为电子设备1800的各种组件提供电力。电源组件1806可以包括电源管理***,一个或多个电源,及其他与为电子设备1800生成、管理和分配电力相关联的组件。
多媒体组件1808包括在所述电子设备1800和用户之间的提供一个输出接口的显示屏。在一些实施例中,多媒体组件1808包括一个前置摄像头和/或后置摄像头。当电子设备1800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜***或具有焦距和光学变焦能力。
音频组件1810被配置为输出和/或输入音频信号。例如,音频组件1810包括一个麦克风(MIC),当电子设备1800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器1804或经由通信组件1818发送。在一些实施例中,音频组件1810包括一个扬声器,用于输出音频信号。
I/O接口1812为处理组件1802和***接口模块之间提供接口,上述***接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件1816包括一个或多个传感器,用于为电子设备1800提供各个方面的状态评估。例如,传感器组件1816可以检测到电子设备1800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备1800的显示器和小键盘,传感器组件1816可以检测电子设备1800或电子设备1800一个组件的位置改变,用户与电子设备1800接触的存在或不存在,电子设备1800方位或加速/减速和电子设备1800的温度变化。传感器组件1816可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组 件1816可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件1816可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件1818被配置为便于电子设备1800和其他设备之间有线或无线方式的通信。电子设备1800可以接入基于通信标准的无线网络,如Wi-Fi,2G,3G,4G,5G或6G,或它们的组合。在一个示例性实施例中,通信组件1818经由广播信道接收来自外部广播管理***的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件1818包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在示例性实施例中,电子设备1800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现。
第五方面,本公开实施方式提供了一种芯片,包括一个或多个接口电路和一个或多个处理器;所述接口电路用于从电子设备的存储器接收信号,并向所述处理器发送所述信号,所述信号包括存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,使得所述电子设备执行第一方面任意实施方式所述的方法。
在一些实施方式中,本公开提供的芯片可以为任意适于实施的芯片类型,例如CPU(central processing unit,中央处理器)芯片、GPU(graphics processing unit,图形处理器)芯片、SoC(***级芯片,System on Chip)等,也可以为人工智能技术专用的加速芯片,例如AI(Artificial Intelligence,人工智能)加速器等,本公开对此不作限制。
显然,上述实施方式仅仅是为清楚地说明所作的举例,而并非对实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。而由此所引伸出的显而易见的变化或变动仍处于本公开创造的保护范围之中。

Claims (13)

  1. 一种应用管理方法,其特征在于,应用于电子设备,所述方法包括:
    响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例当前的第一配置信息,并将所述第一配置信息缓存在当前运行的目标进程中;
    获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置,以在所述目标进程中运行所述第二应用实例。
  2. 根据权利要求1所述的方法,其特征在于,所述响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例当前的第一配置信息,并将所述第一配置信息缓存在当前运行的目标进程中,包括:
    响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例的全局配置信息以及当前的状态参数;
    根据所述全局配置信息和所述状态参数确定所述第一配置信息,并将所述第一配置信息缓存在所述目标进程中。
  3. 根据权利要求1所述的方法,其特征在于,还包括:
    响应于由当前运行的第二应用实例切换至所述第一应用实例,根据所述目标进程中缓存的所述第一应用实例的第一配置信息,配置所述目标进程。
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置,包括:
    响应于所述目标进程中未缓存所述第二应用实例的第二配置信息,读取所述第二应用实例的程序文件,得到所述第二应用实例第二配置信息;
    根据所述第二配置信息对所述目标进程初始化配置。
  5. 根据权利要求1至3任一项所述的方法,其特征在于,所述获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初 始化配置,包括:
    响应于所述目标进程中已缓存所述第二应用实例的第二配置信息,获取所述目标进程中缓存的所述第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置。
  6. 根据权利要求1所述的方法,其特征在于,根据所述第二配置信息对所述目标进程初始化配置,以在所述目标进程中运行所述第二应用实例,包括:
    获取所述第二配置信息包括的全局配置信息和状态参数;
    根据所述全局配置信息配置所述目标进程的应用环境,根据所述状态参数在所述目标进程中配置所述第二应用实例,以在所述目标进程中运行所述第二应用实例。
  7. 根据权利要求1所述的方法,其特征在于,所述第一配置信息和所述第二配置信息均包括以下中至少之一:
    ***能力接口信息、应用定时器信息、应用插件信息、多语言信息、本地化设置信息。
  8. 根据权利要求1所述的方法,其特征在于,
    所述电子设备包括可穿戴设备。
  9. 一种应用管理装置,其特征在于,包括:
    第一获取模块,被配置为响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例当前的第一配置信息,并将所述第一配置信息缓存在当前运行的目标进程中;
    第二获取模块,被配置为获取第二应用实例的第二配置信息,并根据所述第二配置信息对所述目标进程初始化配置,以在所述目标进程中运行所述第二应用实例。
  10. 根据权利要求9所述的装置,其特征在于,所述第一获取模块被 配置为:
    响应于由当前运行的第一应用实例切换至第二应用实例,获取所述第一应用实例的全局配置信息以及当前的状态参数;
    根据所述全局配置信息和所述状态参数确定所述第一配置信息,并将所述第一配置信息缓存在所述目标进程中。
  11. 根据权利要求9所述的装置,其特征在于,还包括配置模块,所述配置模块被配置为:
    响应于由当前运行的第二应用实例切换至所述第一应用实例,根据所述目标进程中缓存的所述第一应用实例的第一配置信息,配置所述目标进程。
  12. 一种电子设备,其特征在于,包括:
    处理器;和
    存储器,存储有计算机指令,所述计算机指令用于使所述处理器执行根据权利要求1至8任一项所述的方法。
  13. 一种存储介质,其特征在于,存储有计算机指令,所述计算机指令用于使计算机执行根据权利要求1至8任一项所述的方法。
PCT/CN2022/099930 2022-06-20 2022-06-20 应用管理方法、装置、电子设备以及存储介质 WO2023245366A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202280004237.XA CN117616390A (zh) 2022-06-20 2022-06-20 应用管理方法、装置、电子设备以及存储介质
PCT/CN2022/099930 WO2023245366A1 (zh) 2022-06-20 2022-06-20 应用管理方法、装置、电子设备以及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/099930 WO2023245366A1 (zh) 2022-06-20 2022-06-20 应用管理方法、装置、电子设备以及存储介质

Publications (1)

Publication Number Publication Date
WO2023245366A1 true WO2023245366A1 (zh) 2023-12-28

Family

ID=89378998

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/099930 WO2023245366A1 (zh) 2022-06-20 2022-06-20 应用管理方法、装置、电子设备以及存储介质

Country Status (2)

Country Link
CN (1) CN117616390A (zh)
WO (1) WO2023245366A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144600A (zh) * 2018-06-21 2019-01-04 连尚(新昌)网络科技有限公司 一种应用程序的运行方法、设备及计算机可读介质
CN110825772A (zh) * 2019-10-28 2020-02-21 爱钱进(北京)信息科技有限公司 多个服务实例的内存数据的同步方法、装置及存储介质
CN111596916A (zh) * 2020-04-20 2020-08-28 北京飞漫软件技术有限公司 一种应用程序管理方法、装置、设备及计算机存储介质
CN113806026A (zh) * 2020-06-12 2021-12-17 腾讯科技(上海)有限公司 一种应用程序安全切换方法、装置、设备及存储介质
CN114077461A (zh) * 2020-08-21 2022-02-22 北京小米移动软件有限公司 应用程序的运行方法、装置、设备及存储介质
CN114153570A (zh) * 2017-08-11 2022-03-08 华为技术有限公司 一种应用切换方法及装置
WO2022089281A1 (zh) * 2020-10-30 2022-05-05 阿里巴巴集团控股有限公司 基于容器的应用管理方法和装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114153570A (zh) * 2017-08-11 2022-03-08 华为技术有限公司 一种应用切换方法及装置
CN109144600A (zh) * 2018-06-21 2019-01-04 连尚(新昌)网络科技有限公司 一种应用程序的运行方法、设备及计算机可读介质
CN110825772A (zh) * 2019-10-28 2020-02-21 爱钱进(北京)信息科技有限公司 多个服务实例的内存数据的同步方法、装置及存储介质
CN111596916A (zh) * 2020-04-20 2020-08-28 北京飞漫软件技术有限公司 一种应用程序管理方法、装置、设备及计算机存储介质
CN113806026A (zh) * 2020-06-12 2021-12-17 腾讯科技(上海)有限公司 一种应用程序安全切换方法、装置、设备及存储介质
CN114077461A (zh) * 2020-08-21 2022-02-22 北京小米移动软件有限公司 应用程序的运行方法、装置、设备及存储介质
WO2022089281A1 (zh) * 2020-10-30 2022-05-05 阿里巴巴集团控股有限公司 基于容器的应用管理方法和装置

Also Published As

Publication number Publication date
CN117616390A (zh) 2024-02-27

Similar Documents

Publication Publication Date Title
CN113553014B (zh) 多窗口投屏场景下的应用界面显示方法及电子设备
CN105955765B (zh) 应用预加载方法及装置
CN111813536B (zh) 任务处理方法、装置、终端以及计算机可读存储介质
CN113553130B (zh) 应用执行绘制操作的方法及电子设备
CN108762881B (zh) 界面绘制方法、装置、终端及存储介质
CN109254849B (zh) 应用程序的运行方法及装置
WO2022083296A1 (zh) 一种显示方法及电子设备
CN109861966B (zh) 处理状态事件的方法、装置、终端及存储介质
CN114625525A (zh) 一种资源管控方法及设备
CN116028149B (zh) 窗口渲染方法、***、设备、存储介质和计算机程序产品
CN111865630B (zh) 拓扑信息获取方法、装置、终端及存储介质
WO2023245366A1 (zh) 应用管理方法、装置、电子设备以及存储介质
WO2017128664A1 (zh) 进程调用的方法及装置
WO2023066165A1 (zh) 动画效果显示方法及电子设备
CN116743908B (zh) 壁纸显示方法及相关装置
CN116795476B (zh) 一种删除壁纸的方法及电子设备
CN117135268B (zh) 拍摄的方法和电子设备、芯片、存储介质
WO2023245374A1 (zh) 视图显示方法、装置、电子设备和存储介质
CN116700660B (zh) 音频播放方法和电子设备
CN116709557B (zh) 业务处理方法、设备及存储介质
CN114143456B (zh) 拍照方法及装置
CN113179362B (zh) 电子设备及其图像显示方法
CN116048685B (zh) 杂志锁屏的显示方法、图形界面及电子设备
WO2023051036A1 (zh) 加载着色器的方法和装置
WO2023066177A1 (zh) 动画效果显示方法及电子设备

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202280004237.X

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22947147

Country of ref document: EP

Kind code of ref document: A1