Application switching processing method and apparatus, electronic device, and readable storage medium
By freeing up the computing resources of the first application on the smart device to ensure the successful launch of the second application, the problem of application switching failure is solved, thus improving the user experience.
Patent Information
- Application Number
- CN202211683667.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-12-27
AI Technical Summary
When switching between applications on smart devices with limited space, switching failures often occur, leading to a decline in user experience.
By releasing and reclaiming the computing resources occupied by the first running application, it is ensured that the second application has sufficient computing resources available when it starts up.
It improved the success rate of application switching and enhanced the user's device experience.
Smart Images

Figure CN115981815B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of application processing, and more specifically, to application switching processing methods, apparatus, electronic devices, and readable storage media. Background Technology
[0002] For some devices, size is a constraint; for example, some Bluetooth-enabled smart wearable devices (watches, glasses, etc.) also run operating systems, such as real-time operating systems, on which various applications run.
[0003] The inventors discovered that application switching frequently fails when switching between devices. For example, when using a smartwatch, if a user needs to switch from application 1 (for tracking steps) to application 2 (for displaying heart rate), the switch may fail, degrading the user experience. No effective solution to this problem has yet been proposed in the existing technology. Summary of the Invention
[0004] This application provides an application switching processing method, apparatus, electronic device, and readable storage medium to at least solve the problem of switching failure that occurs when a device switches applications in the prior art.
[0005] According to one aspect of this application, an application switching processing method is provided, comprising: receiving a switching command, wherein the switching command is used to instruct switching a first application currently running on a device to a second application; the device is a device running a real-time operating system, and the first application and the second application run on the real-time operating system; releasing computing resources occupied by the first application while it is running on the device, and reclaiming the released computing resources; and after releasing the computing resources occupied by the first application, starting the second application.
[0006] According to another aspect of this application, an application switching processing apparatus is also provided, comprising: a receiving module for receiving a switching command, wherein the switching command is used to instruct a first application currently running on a device to be switched to a second application; the device is a device running a real-time operating system, and the first application and the second application run on the real-time operating system; a processing module for releasing computing resources occupied by the first application while it is running on the device, and reclaiming the released computing resources; and a startup module for starting the second application after releasing the computing resources occupied by the first application.
[0007] According to another aspect of this application, an electronic device is also provided, including a memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps described above.
[0008] According to another aspect of this application, a readable storage medium is also provided, on which computer instructions are stored, wherein the computer instructions, when executed by a processor, implement the above-described method steps.
[0009] In this embodiment, a switching command is received, instructing the switching of a first application running on the device to a second application; the computing resources occupied by the first application while it is running on the device are released and the released computing resources are reclaimed; after releasing the computing resources occupied by the first application, the second application is launched. Normally, during application switching, the first application is switched to the background without releasing computing resources. This approach ensures that the running first application continues to run for a period of time, and the probability of problems is low on devices with sufficient computing resources. However, on devices running real-time operating systems, computing resources are not always sufficient. To ensure a high success rate when switching to the second application, the approach of releasing the computing resources occupied by the first application is adopted. By releasing some or all of the computing resources occupied by the first application and reclaiming the released computing resources, the reclaimed resources can be used by other applications. This increases the number of idle resources, ensuring that the second application has sufficient computing resources available when it starts. Therefore, this application solves the problem of switching failures that occur when switching applications on a device in the prior art, thereby improving the success rate of application switching and enhancing the user's device experience. Attached Figure Description
[0010] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0011] Figure 1 This is a flowchart of an application switching processing method according to an embodiment of this application;
[0012] Figure 2 This is a schematic diagram illustrating the application operation switching according to an embodiment of this application;
[0013] Figure 3 This is a schematic diagram illustrating application switching and resource release according to an embodiment of this application; and,
[0014] Figure 4This is a schematic diagram of the application switching process in a smartwatch according to an embodiment of this application. Detailed Implementation
[0015] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0016] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0017] The following embodiments involve scripting languages and applications derived from scripting languages (hereinafter referred to as applications). The technical terms involved in the following embodiments will be explained first.
[0018] scripting language
[0019] Scripting languages (or scripting languages) are computer programming languages created to shorten the traditional edit-compile-link-run process. Although many scripting languages have transcended the realm of automating simple computer tasks and matured to the point of allowing the writing of sophisticated programs, they are still called scripts. A script is typically interpreted rather than compiled. Scripting languages are generally characterized by simplicity, ease of learning, and ease of use, aiming to enable programmers to quickly complete program writing tasks. For example, JavaScript (JS) and VBScript are scripting languages that fall between Hypertext Markup Language (HTML) and programming languages such as C, C++, Java, and C#. HTML is typically used for formatting and linking text, while programming languages are typically used to issue a series of complex instructions to the machine. Unlike C or C++, which can be compiled into binary code and exist as executable files, scripting languages do not require compilation and can be used directly, with an interpreter handling the interpretation. When using scripting languages, an interpreter needs to be included in the software program. This script interpreter is a separate module but also part of the software program. Once the interpreter is included, it can execute code written in the corresponding scripting language. Therefore, the interpreter is also called a script engine or engine. For example, the JavaScript interpreter can be called the JS engine. There are many types of script engines. For example, for the JavaScript language, there are engines like Spider-Monkey and Chakra. Spider-Monkey is the JavaScript engine used in the Firefox browser, while Chakra is the JavaScript engine in the Internet Explorer browser.
[0020] QuickJS
[0021] QuickJS is a lightweight JavaScript engine. The JS Runtime is the underlying execution environment of QuickJS. A JS Runtime can be viewed as a JavaScript virtual machine environment; multiple JS Runtimes are isolated and cannot call or communicate with each other. A JS Context is the context environment within the virtual machine. A single JS Runtime can contain multiple JSContexts, each with its own global and system objects. Different JSContexts can access and share objects.
[0022] Memory paging management
[0023] Paging divides the entire virtual and physical memory space into fixed-size segments. Specifically, it divides the logical address space into fixed-size pages and the physical memory space into fixed-size frames, and establishes a scheme to translate logical addresses into physical addresses (pages to frames). Pages are contiguous virtual memory, while frames are non-contiguous physical memory; not all pages have corresponding frames. Virtual addresses and physical addresses are mapped through page tables, which are stored in memory. Because the page size is fixed, external memory fragmentation is avoided, resulting in only a small amount of internal fragmentation.
[0024] RTOS
[0025] A Real-Time Operating System (RTOS) is an operating system that, when external events or data occur, can accept and process them quickly enough, and the results can control the production process or respond rapidly to the processing system within a specified time, scheduling all available resources to complete real-time tasks and controlling all real-time tasks to run in a coordinated manner. Small operating systems embedded as part of microdevices (e.g., Bluetooth-enabled watches) often require a real-time operating system.
[0026] For devices with limited size, the size of the various hardware components used internally is also limited. Therefore, the computing resources they can provide are also limited, and all applications running on them require these resources. Computing resources are extremely valuable in these devices, especially memory. If computing resources are insufficient, various problems will occur during device operation, one of which is application switching failure.
[0027] Taking smart devices (devices running an operating system and capable of running various applications on that operating system can be called smart devices) as an example, smart devices typically include multiple applications. For instance, a smartwatch might include payment applications, pedometer applications, and heart rate applications. The payment application is used for payment transactions, the pedometer application records steps, and the heart rate application obtains current heart rate information. Similarly, smart glasses might include camera applications, map applications, and media player applications. The camera application uses the smart glasses' camera to take pictures, the map application displays maps and navigation information, and the media player plays video or audio files.
[0028] When using smart devices, users inevitably need to switch between applications. For example, a user might switch from a pedometer app to a payment app. However, switching between applications can sometimes fail. Research has shown that this is because switching applications consumes significant computing resources (especially memory), leading to the failure.
[0029] To address the aforementioned issues, the following implementation provides an application switching processing method. Figure 1 This is a flowchart of an application switching processing method according to an embodiment of this application, such as... Figure 1 As shown below, Figure 1 The steps involved in the method shown in the figure will be explained.
[0030] Step S102: A switching command is received, wherein the switching command is used to instruct the first application currently running on the device to be switched to the second application.
[0031] In this step, there are many ways to receive a switching command. For example, if the user minimizes the first application, this operation does not necessarily indicate that the user is switching applications. Assuming the user does not perform any other operations after minimizing the first application, the first application continues to run in the background. If the user launches or wakes up the second application from the background after minimizing the first application, this is considered as receiving a switching command, and steps S104 to S106 are then executed. Taking a smartwatch as an example, when using a pedometer application, the user inputs a first touch gesture on the watch's touchscreen, and the watch returns to the default desktop. Subsequently, the user selects a heart rate application from the desktop, indicating that the user has switched applications, and the following steps for releasing computing resources are executed. It should be noted that the steps shown in the following embodiments can be applied to various devices. For example, the device can be a device running a real-time operating system, on which the first and second applications run. Devices running real-time operating systems have limited computing resources, therefore, running the steps in the following embodiments on devices running real-time operating systems can achieve better results.
[0032] Step S104: Release the computing resources occupied by the first application while it is running on the device, and reclaim the released computing resources.
[0033] Typically, during application switching, the first application is moved to the background without releasing computing resources. This approach ensures the running application continues to run for a period of time, and it's less likely to cause problems on devices with ample computing resources. Figure 1 The primary objective of the illustrated steps is to ensure a high success rate when switching to the second application. Therefore, a method is adopted to release the computing resources occupied by the first application. Various units or modules within the first application consume computing resources. Taking memory resources as an example, the first application uses a user interface (UI), which consumes memory resources. The first application also stores various data, which consumes memory resources. This step allows for the release of some or all of the computing resources occupied by the first application, and the released computing resources are then reclaimed for use by other applications. This step increases the availability of more free resources, ensuring that the second application has sufficient computing resources available upon startup.
[0034] Step S106: After releasing the computing resources occupied by the first application, the second application is launched. When launching the second application, since the computing resources occupied by the first application have been released, the second application can use more computing resources, thus ensuring the success rate of launching the second application.
[0035] In the above process, instead of switching the original application (i.e., the first application) to the background to continue running when switching applications, the computing resources occupied by the first application are released, so that more idle computing resources are available on the device. Therefore, the above steps solve the problem of switching failure that occurs when switching applications on the device in the prior art, thereby improving the success rate of application switching and thus improving the user's device experience.
[0036] It should be noted that, Figure 1 The steps shown can be applied to various devices or operating systems, such as real-time operating systems. Therefore, the first and second applications may be written in different programming languages. For example, when the first and second applications are programmed using languages like C++, they can be compiled and run directly on the operating system. In this example, the computing resources used by the first and second applications are those inherent to the applications themselves; for instance, if the first application uses 100 megabits of memory during runtime, then releasing the 100 megabits of memory can be done. In another example, a script engine can be run on the operating system, and the application code can be written using a scripting language, running on the script engine to achieve the corresponding functionality. That is, the first and / or second applications can also be written in scripting languages. Unlike programming languages like C++, applications written in scripting languages need to run on a corresponding script engine; for example, JavaScript needs to run on a JS engine, and VBScript needs to run on a VBScript engine. In other words, when an application written in a scripting language runs, it consumes two types of resources: resources required by the application itself and resources required by the script engine. When releasing the resources consumed by the first application, at least one of these two types of resources can be released. Specifically, in this optional implementation, when the first application is written in a scripting language, releasing the computing resources consumed by the first application while it is running on the device can include: releasing the computing resources consumed by the first application itself during runtime; and / or, releasing the computing resources consumed by the script engine to support the operation of the first application, where the script engine is the engine that executes the scripting language, and the first application runs on the script engine. This optional implementation allows for the release of computing resources consumed by applications written in scripting languages, making it possible to free up more computing resources.
[0037] There are several ways to release the resources occupied by the script engine. In one optional implementation, releasing the computing resources occupied by the script engine to support the operation of the first application may include at least one of the following: destroying the script engine's runtime, wherein the script runtime is a software module started to execute the scripting language, and the first application runs in the script runtime; or, terminating the process corresponding to the script engine to shut down the script engine. It should be noted that the runtime encapsulates the runtime environment of an application written in a scripting language. The runtime is a reusable program or instance packaged or rebuilt into a "runtime library," which can be linked or called by any program during runtime. This optional implementation can release the computing resources occupied by the script engine.
[0038] If the second application is also written in the above-mentioned scripting language, then the startup of the second application also requires a script engine. In this case, starting the second application may include the following steps: if the script runtime is destroyed, recreate the script runtime; if the script engine is shut down, restart the script engine; and start the second application after the script runtime is recreated or the script engine is restarted.
[0039] As can be seen from the above implementation methods, when the first application is written in a scripting language, the computing resources occupied by the first application itself and the resources occupied by the script engine can be released. As an optional implementation method, the computing resources occupied by the first application itself during runtime can be released first, and then it can be determined whether the remaining computing resources meet the conditions for starting the second application. If they do, then it is not necessary to release the resources occupied by the script engine. This approach has the advantage that if the second application is also written in a scripting language, without releasing the resources occupied by the script engine, the second application can run directly on that script engine, improving the startup speed of the second application. If the remaining computing resources are insufficient to meet the conditions for starting the second application without releasing the script engine, then the computing resources occupied by the script engine also need to be released to ensure the successful startup of the second application.
[0040] In the above embodiments, when switching from the first application to the second application, the computing resources occupied by the first application running on the device are released. In this case, if the user switches back to the first application, the first application needs to be restarted, which increases the startup time of the first application. In an optional embodiment, when switching from the first application to the second application, it can be determined whether the remaining computing resources on the device are sufficient. If they can support the startup of the second application, the resources occupied by the first application do not need to be released, so that the first application can be launched quickly when switching back. That is, in this optional embodiment, releasing the computing resources occupied by the first application running on the device may include the following steps: determining whether the remaining computing resources on the device meet the requirements for launching the second application; if the requirements for launching the second application cannot be met, releasing the computing resources occupied by the first application running on the device; if the requirements can be met, retaining the computing resources occupied by the first application and launching the second application.
[0041] When releasing the resources occupied by the first application, the two parts of resources occupied by the first application can also be released separately according to the above implementation method. That is, if the requirements for starting the second application cannot be met, releasing the computing resources occupied by the first application when it is running on the device may include the following steps: after releasing and reclaiming the computing resources occupied by the first application itself when it is running, it is determined whether the remaining computing resources on the device meet the requirements. If they do, the second application is started; if they still do not meet the requirements, the computing resources occupied by the script engine to support the operation of the first application are released. The script engine is the engine that executes the script language, and the first application runs on the script engine.
[0042] The above optional implementation method is illustrated below with an example. Figure 4 This is a schematic diagram of the application switching process in a smartwatch according to an embodiment of this application, such as... Figure 4As shown, before running, the user opens the first application on their smartwatch, a route-tracking application. This application records the route the user takes during the run and displays it on a map. During the run, the user needs to purchase items and opens a second application, a QR code generator for payment. At this point, the user needs to switch from the first application to the second. This is a common scenario, and typically, after completing the payment, the user will record the running route using the first application. If all the resources used by the first application are released immediately upon launching the second application, it might lead to data loss and slow down the launch of the first application, impacting the user experience. In this example, a more suitable approach is to first determine if there are sufficient remaining computing resources to decide whether to release the resources used by the first application. If sufficient resources are available, the second application can be launched directly, while the first application remains running in the background.
[0043] exist Figure 4 The document illustrates an optional implementation. After the smartwatch starts recording steps and route on a running device (i.e., the first application), if the user needs to open the payment application (i.e., the second application), two methods are displayed: one is by swiping left or right on the screen. After switching to the payment application in this way, the first application continues to run in the background, and the smartwatch interface will display a message indicating that the first application is running in the background; the other is by swiping up or down on the screen. After switching to the payment application in this way, the resources occupied by the first application are released, and the first application will no longer run in the background.
[0044] As the examples above illustrate, some applications require that they ideally remain running until closed by the user. Examples include path tracking applications and step counting applications. Therefore, in one optional implementation, identification information can be configured for one or more applications. This identification information indicates that when switching from one application to another, the application should continue running in the background without releasing its computing resources. Specifically, in the above implementation, when switching from one application to another, it is first determined whether the first application has configured identification information. If it does, then the first application does not release computing resources during the switch; otherwise, the computing resources used by the first application can be released according to the above implementation method. Which applications need to release resources when switched out and which do not can be configured through the user interface, and then identification information is added to these applications based on the user's configuration.
[0045] There's a special case where, if the first application has configured identification information, then switching from the first application to the second application doesn't require releasing the computing resources used by the first application, and the remaining computing resources on the device are insufficient to start the second application. In this situation, we can iterate through the device to see if any other applications are running. If so, we select the application whose resources can be released (e.g., the application doesn't have configured identification information, or the application hasn't been used by the user for a predetermined time), and then release the computing resources used by the selected application. For example, if a path recording application is running and needs to switch to a payment application, and the remaining memory resources on the device are low, and we find that an audio playback application is still running in the background, then we can release the computing resources used by the audio playback application.
[0046] When switching applications, the first application is first switched to the background. In one optional implementation, the decision to release computing resources used by the first application can be based on the different methods used to trigger the switch. For example, on a smartwatch, swiping left or right on the screen can switch the currently running application to the background. It can be configured that swiping left switches the application to the background without releasing its computing resources, while swiping right releases them.
[0047] Different applications consume varying amounts of computing resources upon startup. This data can be obtained beforehand through experimentation. For example, the computing resources required to launch a payment application alone can be calculated, as can the computing resources required to switch from a path tracking application to the payment application, or from a heartbeat statistics application to the payment application. This way, the computing resources consumed by each application upon startup can be determined. When the user switches the first application to the background, the computing resources required by each other application on the device if it were launched can be calculated. The maximum computing resources required can then be determined. If the remaining computing resources on the device exceed this maximum, the computing resources consumed by the first application can be retained.
[0048] The above embodiments describe several scenarios where the computing resources occupied by the first application are released or not released when switching from the first application to the second application. In actual implementation, the appropriate scenario can be chosen flexibly according to actual needs. The above optional embodiments can be applied to various devices. The following description uses a device running a real-time operating system as an example. The applications running on this device are written in JavaScript and all run on a real-time operating system. This real-time operating system uses QuickJS (QJS for short) as its JavaScript engine (JS engine for short). Of course, other engines can also be used, which will not be elaborated upon here.
[0049] Figure 2 This is a schematic diagram illustrating the application operation switching according to an embodiment of this application, such as... Figure 2 As shown, QJS is running on the device as the script engine. This QJS engine creates JSRuntime. APP1 (the first application) and APP2 (the second application) run on QJS and JSRuntime. Both APP1 and APP2 use memory resources. Figure 2 Pages 1 to 3 in the memory represent page resources. When switching from APP1 to APP2, the memory usage spikes significantly, which prevents the device from supporting multi-application switching.
[0050] To address the issue of application switching failures caused by high peak memory usage during switching, application memory release was introduced. Figure 3 This is a schematic diagram illustrating application switching and resource release according to an embodiment of this application, such as... Figure 3 As shown, an application management module can be introduced, which can manage the memory used by the application. Figure 3 In the scenario shown, before switching to APP2, the application management module first releases all module memory and UI page resources, then destroys JSRuntime, releasing JS global variables and code-related resources, recreates JSRuntime, and then starts APP2. Figure 3 The proposed solution can reclaim resources in a timely manner and reduce peak memory usage, allowing multiple applications to run on devices with limited memory.
[0051] Through the above implementation method, when switching applications, the resources occupied by the previous application are released and reclaimed in a timely manner by killing the JS engine and other mechanisms, and then a new JS engine is created to start the new application. This can reduce peak memory usage, thus enabling the function of switching between multiple applications on low-end RTOS system devices.
[0052] In this embodiment, an electronic device is provided, including a memory and a processor. The memory stores a computer program, and the processor is configured to run the computer program to perform the methods described in the above embodiments.
[0053] The aforementioned program can run on a processor or be stored in memory (or computer-readable medium). Computer-readable medium includes both permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable medium does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0054] These computer programs may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes can be implemented using different modules, and different steps can be implemented using different modules.
[0055] This embodiment provides such a device. The device, referred to as an application switching processing device, includes: a receiving module for receiving a switching command, wherein the switching command instructs switching a first application currently running on the device to a second application; a processing module for releasing computing resources occupied by the first application while it is running on the device and reclaiming the released computing resources; and a launching module for launching the second application after releasing the computing resources occupied by the first application. The receiving module, processing module, and launching module in this device implement the functions of the aforementioned application management module.
[0056] The system or apparatus is used to implement the functions of the methods in the above embodiments. Each module in the system or apparatus corresponds to each step in the method, as has been described in the method and will not be repeated here.
[0057] Optionally, the processing module is used to release the computing resources occupied by the first application itself during runtime; and / or, to release the computing resources occupied by the script engine to support the operation of the first application, wherein the script engine is an engine that executes the script language, and the first application runs on the script engine.
[0058] Optionally, the processing module is used to destroy the script runtime of the script engine, wherein the script runtime is a module started to execute the script language, and the first application runs in the script runtime; the startup module is used to recreate the script runtime after it is destroyed; and to start the second application after the script runtime is recreated.
[0059] Optionally, the processing module is used to release the computing resources occupied by the script engine to support the operation of the first application, including: terminating the process corresponding to the script engine to shut down the script engine and release the computing resources occupied by the script engine; the startup module is used to restart the script engine after the script engine is shut down; and to start the second application after the script engine is restarted.
[0060] Optionally, the processing module is further configured to determine whether the remaining computing resources on the device meet the requirements for launching the second application; if the requirements for launching the second application cannot be met, release the computing resources occupied by the first application while it is running on the device; if the requirements can be met, retain the computing resources occupied by the first application and launch the second application.
[0061] Optionally, the processing module is configured to, after releasing and reclaiming the computing resources occupied by the first application itself during runtime, determine whether the remaining computing resources on the device meet the requirements. If they do, the second application is started; if they still do not meet the requirements, the computing resources occupied by the script engine to support the operation of the first application are released. The script engine is an engine that executes the script language, and the first application runs on the script engine.
[0062] Optionally, the processing module is configured to determine whether identification information has been pre-configured for the first application, wherein the identification information is used to instruct the first application with the identification information not to release the computing resources it occupies when it is switched; if it is determined that the identification information has not been configured for the first application, the processing module releases the computing resources occupied by the first application when it runs on the device.
[0063] Optionally, the computing resources include memory resources.
[0064] Optionally, a real-time operating system runs on the device, and the first application and the second application run on the real-time operating system.
[0065] Optionally, the device includes a smart wearable device.
[0066] The above optional implementation methods solve the problem of application switching failure that occurs when switching devices, thereby improving the success rate of application switching and enhancing the user's device experience.
[0067] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An application switching processing method, comprising: A switching command is received, wherein the switching command is used to instruct a first application currently running on the device to be switched to a second application; the device is a resource-constrained device running a real-time operating system, and the first application and the second application are running on the real-time operating system; If the first application is written in a scripting language, release the computing resources occupied by the first application itself during runtime; and / or, release the computing resources occupied by the script engine to support the operation of the first application, wherein the script engine is the engine that executes the scripting language, the first application runs on the script engine, and reclaim the released computing resources. After releasing the computing resources occupied by the first application, the second application is launched.
2. The method according to claim 1, wherein, Releasing the computing resources occupied by the script engine to support the operation of the first application includes: destroying the script runtime of the script engine, wherein the script runtime is a module started to execute the script language, and the first application runs in the script runtime; Starting the second application includes: after the script runtime is destroyed, recreating the script runtime; and after the script runtime is recreated, starting the second application.
3. The method according to claim 1, wherein, Releasing the computing resources occupied by the script engine to support the operation of the first application includes: terminating the process corresponding to the script engine to shut down the script engine and release the computing resources occupied by the script engine; Starting the second application includes: restarting the script engine after it is shut down; and starting the second application after the script engine is restarted.
4. The method according to any one of claims 1 to 3, wherein, Before releasing the computing resources occupied by the first application while it is running on the device, the method further includes: Determine whether the remaining computing resources on the device meet the requirements for launching the second application; If the requirements for launching the second application cannot be met, the computing resources occupied by the first application while it is running on the device are released; if the requirements can be met, the computing resources occupied by the first application are retained, and the second application is launched.
5. The method according to claim 4, wherein, If the requirements for launching the second application cannot be met, releasing the computing resources occupied by the first application while it is running on the device includes: After releasing and reclaiming the computing resources occupied by the first application during runtime, it is determined whether the remaining computing resources on the device meet the requirements. If they do, the second application is launched. If the conditions are still not met, the computing resources occupied by the script engine to support the operation of the first application are released, wherein the script engine is the engine that executes the script language, and the first application runs on the script engine.
6. The method according to any one of claims 1 to 3, wherein, Releasing the computing resources occupied by the first application while it is running on the device includes: Determine whether identification information has been pre-configured for the first application, wherein the identification information is used to instruct the first application with the identification information not to release the computing resources it occupies when it is switched; If it is determined that the identification information has not been configured for the first application, the computing resources occupied by the first application when it is running on the device are released.
7. The method according to any one of claims 1 to 3, wherein, The device includes a smart wearable device, and / or the computing resources include memory resources.
8. An application switching processing device, comprising: A receiving module is configured to receive a switching command, wherein the switching command is configured to instruct a first application currently running on the device to be switched to a second application; the device is a resource-constrained device running a real-time operating system, and the first application and the second application run on the real-time operating system; The processing module is configured to, when the first application is written in a scripting language, release the computing resources occupied by the first application itself during runtime; and / or, release the computing resources occupied by the script engine to support the operation of the first application, wherein the script engine is an engine that executes the scripting language, the first application runs on the script engine, and reclaim the released computing resources. A startup module is used to launch the second application after releasing the computing resources occupied by the first application.
9. An electronic device comprising a memory and a processor; wherein, The memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the steps of the method according to any one of claims 1 to 7.
10. A readable storage medium having computer instructions stored thereon, wherein, When executed by a processor, the computer instructions implement the steps of the method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Application program starting method and device, equipment and storage medium
CN109408149A
