WO2021027772A1 - Method for switching running of application and device - Google Patents

Method for switching running of application and device Download PDF

Info

Publication number
WO2021027772A1
WO2021027772A1 PCT/CN2020/108158 CN2020108158W WO2021027772A1 WO 2021027772 A1 WO2021027772 A1 WO 2021027772A1 CN 2020108158 W CN2020108158 W CN 2020108158W WO 2021027772 A1 WO2021027772 A1 WO 2021027772A1
Authority
WO
WIPO (PCT)
Prior art keywords
application
compilation
mode
compilation mode
check value
Prior art date
Application number
PCT/CN2020/108158
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Publication of WO2021027772A1 publication Critical patent/WO2021027772A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Definitions

  • the embodiments of the present application relate to the field of electronic technology, and in particular to a method and device for application switching operation.
  • Ark compiler adopts a static compilation method and is the first static compiler to replace the Android virtual machine mode. Huawei’s Ark Compiler provides a new system and application compilation and operation mechanism, which solves the problem of Android operating efficiency from the bottom. It allows developers to compile high-level languages into machine code at one time in the development environment, bringing extreme efficiency. Great improvement.
  • the application compiled with the Ark compiler is called the Ark application.
  • the packaging form of the Ark application has many forms.
  • the APK Android package, Android installation package
  • This BOTH form of the Ark application can be run in the system in Ark mode, or in the Android mode.
  • the embodiments of the present application provide a method and device for application switching operation, which can flexibly switch the compilation mode of the application, and use a brand-new way to solve problems such as application crashes and incompatibility.
  • an embodiment of the present application provides a method for switching and running an application, which includes: running a first application in a first compilation mode; when the first switching condition is met, running the first application in a second compilation mode.
  • the first application is an Ark application packaged in BOTH form.
  • the first switching condition is at least one of the following conditions: the number of crashes of the first application reaches a first threshold; or the current system memory usage exceeds a second threshold; or the memory of the first application The occupancy exceeds the third threshold; or the page response speed of the first application is lower than the fourth threshold; or the running time of the first application in the first compilation mode exceeds the fifth threshold; or the user’s location information changes; or The performance of the compiler in the second compilation mode is better than the performance of the compiler in the first compilation mode; or the current system time is within the preset time period.
  • the method when the first switching condition is that the number of crashes of the first application reaches a first threshold, the method further includes: recording the number of crashes of the first application, and setting the first application to switch State; when the first application is restarted, detect whether the first application is in the switching state; if the first application is in the switching state, run the first application in the second compilation mode.
  • the first application when the second switching condition is met, the first application is run in the first compilation mode.
  • the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
  • the second switching condition is: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
  • the process in which the first application runs further includes a second application
  • the method further includes: when the first application is run in the second compilation mode, switching the compilation mode of the second application to This second compilation mode.
  • the start time of the second application is earlier than the start time of the first application.
  • the start time of the second application is later than the start time of the first application.
  • the operation of the first application depends on the third application, and the first switching condition is: the APK state of the third application changes.
  • the operation of the first application depends on the third application, and the first switching condition is: the third application is switched to run in the second compilation mode.
  • the first check value is generated according to the API information of the first application; the first check value is packaged into the APK of the first application; The API information provided by the system generates a second check value and packs the second check value into the operating system; when the state of the first application changes, compare the first check value with the second check value Value; switch the compilation mode of the first application according to the comparison result.
  • the comparison between the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; and the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
  • the first compilation mode is the Android compilation mode
  • the second compilation mode is the Ark compilation mode
  • the first compilation mode is the Ark compilation mode
  • the second compilation mode is the Android compilation mode
  • the compilation mode of the application can be switched flexibly, and a brand-new method can be used to solve the problems of application crashes and incompatibility.
  • an embodiment of the present application provides an electronic device, including a first compilation module, a second compilation module, and a switching module, wherein: the first compilation module is configured to run a first application in a first compilation mode; the switching Module, used to determine when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode; the second compilation module is used to run the first application in the second compilation mode application.
  • the first application is an Ark application packaged in BOTH form.
  • the first switching condition is at least one of the following conditions: the number of crashes of the first application reaches a first threshold; or the current system memory usage exceeds a second threshold; or the memory of the first application The occupancy exceeds the third threshold; or the page response speed of the first application is lower than the fourth threshold; or the running time of the first application in the first compilation mode exceeds the fifth threshold; or the user’s location information changes; or The performance of the second compilation module is better than the performance of the first compilation module; or the current system time is within a preset time period.
  • the electronic device further includes a crash recording module and a restart detection module, wherein the first switching condition is that the number of crashes of the first application reaches a first threshold, wherein: the crash recording module is configured to The number of crashes of the first application is recorded, and the first application is set to the switching state; the restart detection module is configured to detect whether the first application is in the switching state when the first application is restarted; the second compilation module , Used to determine that when the first application is in the switching state, run the first application in the second compilation mode.
  • the first compilation module is further configured to: when the second switching condition is met, run the first application in the first compilation mode.
  • the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
  • the second switching condition is: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
  • the running process of the first application further includes a second application, wherein: the switching module is configured to switch the second application when the first application is running in the second compilation mode
  • the compilation mode is the second compilation mode.
  • the start time of the second application is earlier than the start time of the first application.
  • the start time of the second application is later than the start time of the first application.
  • the operation of the first application depends on the third application, and the first switching condition is: the APK state of the third application changes.
  • the operation of the first application depends on the third application, and the first switching condition is: the third application is switched to run in the second compilation mode.
  • the electronic device further includes a first check code generation module, a second check code generation module, and a comparison module, wherein: the first check code generation module is used to create the first check code In an application, a first check value is generated according to the API information of the first application, and the first check value is packaged into the APK of the first application; the second check code generation module is used to operate The API information provided by the system generates a second check value, and packs the second check value into the operating system; the comparison module is used to compare the first check value when the state of the first application changes Value and the second check value; the switching module is configured to switch the compilation mode of the first application according to the comparison result
  • the comparison between the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; and the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
  • the first compilation module is an Android compilation module
  • the second compilation module is an Ark compilation module
  • the first compilation module is an Ark compilation module
  • the second compilation module is an Android compilation module
  • the compilation mode of the application can be switched flexibly, and a brand-new method can be used to solve the problems of application crashes and incompatibility.
  • an embodiment of the present application provides an electronic device, including a first compiler, a second compiler, and a processor, wherein: the first compiler is configured to run a first application in a first compilation mode; The processor is configured to determine that when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode to run; the second compiler is configured to run in the second compilation mode The first application.
  • an embodiment of the present application provides an electronic device.
  • the electronic device includes: one or more processors and a memory, the memory is used to store computer program code, the computer program code includes instructions, when the one or more When the processor executes the instruction, the electronic device executes the method in the first aspect and any one of its possible designs.
  • an embodiment of the present application provides a computer-readable storage medium, which includes computer instructions.
  • the computer instructions run on an electronic device, the electronic device executes the first aspect and any of the possible Method in design.
  • an embodiment of the present application provides a computer program product, wherein when the computer program product runs on a computer, the computer is caused to execute the method in the first aspect and any one of its possible designs.
  • an embodiment of the present application provides a chip, which includes: a processor and an interface, configured to call and run a computer program stored in the memory from the memory, and execute the first aspect and any possible Method in design.
  • FIG. 1 is a schematic diagram of the hardware structure of a mobile terminal provided by an embodiment of the application.
  • FIG. 2 is a schematic diagram of the architecture of an Android operating system provided by an embodiment of the application.
  • Fig. 3 is a flow chart of a method for application switching operation provided by an embodiment of the application.
  • FIG. 4 is a flowchart of a method for switching compilation mode provided by an embodiment of the application.
  • FIG. 5 is a flowchart of a method for switching the compilation mode after the first application crashes according to an embodiment of the application.
  • 6A, 6B, 6C, 6D, and 6E are schematic diagrams of associated applications provided by embodiments of this application.
  • FIG. 7 is a flowchart of a method for switching compilation modes of multiple applications in the same process provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of switching compilation modes for applications in the same process according to an embodiment of the application.
  • FIG. 9 is a schematic diagram of another same-process application switching compilation mode provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of switching compilation modes of multiple applications with dependencies according to an embodiment of the application.
  • FIG. 11 is a flowchart of a method for switching compilation modes to solve compatibility problems according to an embodiment of the application
  • Mobile terminals may include mobile phones, tablets, wearable devices (for example, watches, bracelets, smart helmets, etc.), vehicle-mounted devices, smart home devices, augmented reality (AR)/virtual reality (VR) Equipment, notebook computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs), etc.
  • AR augmented reality
  • VR virtual reality
  • PDA personal digital assistants
  • Some embodiments of the present application take a mobile phone as an example. It should be understood that these embodiments can also be applied to other types of mobile terminals.
  • the application program (application, app) involved in the embodiments of the present application may be referred to as an application, which is a software program that can implement one or more specific functions.
  • an application which is a software program that can implement one or more specific functions.
  • multiple applications can be installed in an electronic device, for example, instant messaging applications, video applications, audio applications, image capturing applications, and so on.
  • the applications mentioned in the embodiments of the present application may be applications that have been installed when the electronic device leaves the factory, or may be applications downloaded from the network or obtained by other electronic devices during the process of using the electronic device.
  • the mobile terminal in the embodiment of the present application may be a mobile phone 100.
  • the embodiments are described in detail below taking the mobile phone 100 as an example. It should be understood that the illustrated mobile phone 100 is only an example of a mobile terminal, and the mobile phone 100 may have more or fewer components than those shown in the figure, two or more components may be combined, or There are different component configurations.
  • the mobile phone 100 may specifically include: a processor 101, a radio frequency (RF) circuit 102, a memory 103, a touch screen 104, a Bluetooth device 105, one or more sensors 106, a Wi-Fi device 107, a positioning device 108, Audio circuit 109, peripheral interface 110, power supply system 111 and other components. These components can communicate through one or more communication buses or signal lines (not shown in Figure 1). Those skilled in the art can understand that the hardware structure shown in FIG. 1 does not constitute a limitation on the mobile phone, and the mobile phone 100 may include more or less components than those shown in the figure, or combine some components, or arrange different components.
  • RF radio frequency
  • the processor 101 is the control center of the mobile phone 100. It uses various interfaces and lines to connect to the various parts of the mobile phone 100, and executes the operation of the mobile phone 100 by running or executing application programs stored in the memory 103 and calling data stored in the memory 103. Various functions and processing data.
  • the processor 101 may include one or more processing units; for example, the processor 101 may be a Kirin chip manufactured by Huawei Technologies Co., Ltd.
  • the above-mentioned processor 101 may further include a fingerprint verification chip for verifying the collected fingerprint.
  • the radio frequency circuit 102 can be used to receive and send wireless signals during the process of sending and receiving information or talking.
  • the radio frequency circuit 102 may receive the downlink data of the base station and send it to the processor 101 for processing; in addition, it may send the uplink data to the base station.
  • the radio frequency circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and so on.
  • the radio frequency circuit 102 can also communicate with other devices through wireless communication.
  • the wireless communication can use any communication standard or protocol, including but not limited to global system for mobile communications, general packet radio service, code division multiple access, broadband code division multiple access, long-term evolution, email, short message service, etc.
  • the memory 103 is used to store application programs and data.
  • the processor 101 executes various functions and data processing of the mobile phone 100 by running the application programs and data stored in the memory 103.
  • the memory 103 mainly includes a storage program area and a storage data area.
  • the storage program area can store the operating system and at least one application program required by at least one function (such as sound playback function, image playback function, etc.); the storage data area can store Data created at 100 o'clock (such as audio data, phone book, etc.).
  • the memory 103 may include a high-speed random access memory, and may also include a non-volatile memory, such as a magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
  • the memory 103 can store various operating systems, for example, those developed by Apple Operating system, developed by Google Operating system, etc.
  • the foregoing memory 103 may be independent and connected to the processor 101 through the foregoing communication bus; the memory 103 may also be integrated with the processor 101.
  • the touch screen 104 may include a touch pad 104-1 and a display 104-2.
  • the touchpad 104-1 can collect touch events on or near the user of the mobile phone 100 (for example, the user uses a finger, a stylus, or any other suitable object on the touchpad 104-1 or on the touchpad 104 -1 near operation), and send the collected touch information to other devices such as the processor 101.
  • the user's touch event near the touchpad 104-1 can be referred to as floating touch; floating touch can mean that the user does not need to directly touch the touchpad in order to select, move, or drag a target (such as an icon, etc.) , And only the user is located near the electronic device in order to perform the desired function.
  • the touchpad 104-1 capable of hovering touch can be realized by capacitive, infrared light sensing, and ultrasonic waves. In addition, multiple types such as resistive, capacitive, infrared, and surface acoustic wave can be used to implement the touch panel 104-1.
  • the display also referred to as a display screen
  • the display 104-2 can be used to display information input by the user or information provided to the user and various menus of the mobile phone 100.
  • the display 104-2 can be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • the touchpad 104-1 can cover the display 104-2. When the touchpad 104-1 detects a touch event on or near it, it transmits it to the processor 101 to determine the type of the touch event, and then the processor 101 can provide corresponding visual output on the display 104-2 according to the type of the touch event.
  • the touchpad 104-1 and the display 104-2 are used as two independent components to implement the input and output functions of the mobile phone 100, but in some embodiments, the touchpad 104- 1 is integrated with the display 104-2 to realize the input and output functions of the mobile phone 100. It is understandable that the touch screen 104 is formed by stacking multiple layers of materials.
  • the touchpad 104-1 may cover the display 104-2, and the size of the touchpad 104-1 is larger than the size of the display 104-2, so that the display 104- 2 It is completely covered under the touchpad 104-1, or the above-mentioned touchpad 104-1 can be configured on the front of the mobile phone 100 in the form of a full panel, that is, the user's touch on the front of the mobile phone 100 can be sensed by the mobile phone. You can achieve a full touch experience on the front of the phone.
  • the touchpad 104-1 is configured on the front of the mobile phone 100 in the form of a full panel
  • the display 104-2 can also be configured on the front of the mobile phone 100 in the form of a full panel, so that it is A frameless structure can be realized.
  • the mobile phone 100 may also have a fingerprint recognition function.
  • the fingerprint collection device 112 can be configured in the touch screen 104 to realize the fingerprint recognition function, that is, the fingerprint collection device 112 can be integrated with the touch screen 104 to realize the fingerprint recognition function of the mobile phone 100.
  • the fingerprint collection device 112 is configured in the touch screen 104, may be a part of the touch screen 104, or may be configured in the touch screen 104 in other ways.
  • the fingerprint collection device 112 can also be implemented as a full-board fingerprint collection device. Therefore, the touch screen 104 can be regarded as a panel that can perform fingerprint recognition at any position.
  • the fingerprint collecting device 112 may send the collected fingerprint to the processor 101, so that the processor 101 can process the fingerprint (for example, fingerprint verification, etc.).
  • the main component of the fingerprint collection device 112 in the embodiment of the present application is a fingerprint sensor.
  • the fingerprint sensor can use any type of sensing technology, including but not limited to optical, capacitive, piezoelectric or ultrasonic sensing technology.
  • the mobile phone 100 may also include a Bluetooth device 105, which is used to implement data exchange between the mobile phone 100 and other short-distance electronic devices (such as mobile phones, smart watches, etc.).
  • the Bluetooth device in the embodiment of the present application may be an integrated circuit or a Bluetooth chip.
  • the mobile phone 100 may also include at least one sensor 106, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor.
  • the ambient light sensor can adjust the brightness of the display of the touch screen 104 according to the brightness of the ambient light.
  • the proximity sensor can turn off the power of the display when the mobile phone 100 is moved to the ear. .
  • the accelerometer sensor can detect the magnitude of acceleration in various directions (usually three-axis), and can detect the magnitude and direction of gravity when stationary, and can be used to identify mobile phone posture applications (such as horizontal and vertical screen switching, related Games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, percussion), etc.; as for the other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. that can be configured in the mobile phone 100, we will not Repeat it again.
  • mobile phone posture applications such as horizontal and vertical screen switching, related Games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, percussion), etc.
  • vibration recognition related functions such as pedometer, percussion
  • the other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. that can be configured in the mobile phone 100, we will not Repeat it again.
  • the Wi-Fi device 107 is used to provide the mobile phone 100 with network access in compliance with Wi-Fi related standard protocols.
  • the mobile phone 100 can connect to the Wi-Fi access point through the Wi-Fi device 107 to help users send and receive emails, Browsing web pages and accessing streaming media, etc., it provides users with wireless broadband Internet access.
  • the Wi-Fi device 107 can also serve as a Wi-Fi wireless access point, which can provide Wi-Fi network access for other electronic devices.
  • the positioning device 108 is used to provide a geographic location for the mobile phone 100. It is understandable that the positioning device 108 may specifically be a receiver of a positioning system such as Global Positioning System (GPS), Beidou satellite navigation system, Russian GLONASS, etc. After receiving the geographic location sent by the above-mentioned positioning system, the positioning device 108 sends the information to the processor 101 for processing, or sends the information to the memory 103 for storage. In some other embodiments, the positioning device 108 may also be a receiver of an assisted global satellite positioning system (AGPS). The AGPS system assists the positioning device 108 to complete ranging and positioning services by acting as an auxiliary server.
  • AGPS assisted global satellite positioning system
  • the auxiliary positioning server communicates with the positioning device 108 (ie GPS receiver) of the mobile phone 100 via a wireless communication network to provide positioning assistance.
  • the positioning device 108 may also be a positioning technology based on a Wi-Fi access point.
  • Every Wi-Fi access point has a globally unique MAC address, electronic devices can scan and collect the broadcast signals of surrounding Wi-Fi access points when Wi-Fi is turned on, so they can get Wi-Fi -The MAC address broadcasted by the Fi access point; the electronic device sends the data (such as MAC address) that can indicate the Wi-Fi access point to the location server through the wireless communication network, and the location server retrieves each Wi-Fi access point
  • the geographic location of the entry point is combined with the strength of the Wi-Fi broadcast signal to calculate the geographic location of the electronic device and send it to the positioning device 108 of the electronic device.
  • the audio circuit 109, the speaker 113, and the microphone 114 can provide an audio interface between the user and the mobile phone 100.
  • the audio circuit 109 can transmit the electrical signal converted from the received audio data to the speaker 113, which is converted into a sound signal for output by the speaker 113; on the other hand, the microphone 114 converts the collected sound signal into an electrical signal, and the audio circuit 109 After being received, it is converted into audio data, and then the audio data is output to the RF circuit 102 to be sent to, for example, another mobile phone, or the audio data is output to the memory 103 for further processing.
  • the peripheral interface 110 is used to provide various interfaces for external input/output devices (such as a keyboard, a mouse, an external display, an external memory, a user identification module card, etc.). For example, it is connected to a mouse through a universal serial bus (USB) interface, and is connected to a subscriber identity module card (SIM) card provided by a telecommunication operator through a metal contact on a subscriber identity module card slot.
  • SIM subscriber identity module card
  • the peripheral interface 110 can be used to couple the aforementioned external input/output peripheral devices to the processor 101 and the memory 103.
  • the mobile phone 100 may also include a power supply device 111 (such as a battery and a power management chip) for supplying power to various components.
  • a power supply device 111 such as a battery and a power management chip
  • the battery can be logically connected to the processor 101 through the power management chip, so that the power supply device 111 can manage charging, discharging, and power consumption management. And other functions.
  • the mobile phone 100 may also include a camera (front camera and/or rear camera), a flash, a miniature projection device, a near field communication (NFC) device, etc., which will not be repeated here.
  • a camera front camera and/or rear camera
  • a flash a miniature projection device
  • NFC near field communication
  • FIG. 2 is a schematic diagram of the operating system structure of the mobile phone 100 running the Android operating system.
  • the Android operating system architecture is divided into four layers, from high-level to bottom-level divided into application layer, application framework layer, function library layer and Linux kernel layer.
  • the application layer is the top layer of the Android operating system architecture, including core application software assembled by the Android operating system, such as email clients, text messages, calls, calendars, maps, browsers, and contacts.
  • core application software assembled by the Android operating system
  • developers can write application software and install to this layer.
  • applications are developed in the Java language and completed by calling the API (Application Programming Interface) provided by the application framework layer.
  • the application framework layer (Application Framework) mainly provides developers with various APIs that can be used by applications.
  • the application framework layer includes some predefined functions. Developers interact with the bottom layer of Android (such as function library layer, Linux kernel layer, etc.) through the application framework layer to develop their own applications.
  • the application framework layer is mainly a series of services and management systems of the Android operating system.
  • the application framework layer mainly includes the following key services:
  • Activity Manager (Activity Manager) is used to manage the application life cycle and provide common navigation rollback functions
  • Content Providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, image, audio, phone calls made and received, browsing history and bookmarks, phone book, etc. So as to realize data sharing and access between different applications;
  • the Notification Manager is used to control the application to display prompt information (such as Alerts, Notifications, etc.) to the user in the status bar.
  • the application can display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify the download completion, message reminder, etc.
  • the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window.
  • prompt text information in the status bar sound a prompt sound, electronic device vibration, flashing indicator light, etc.;
  • Resource Manager Provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc. Can provide non-code resources (such as strings, graphics, layout files, etc.) for application programs;
  • Package Manager (Package Manager) is mainly used to manage the applications of the Android operating system
  • View with a rich and extensible collection of views, can be used to build an application, which specifically includes a list (List), a grid (Grid), a text box (TextBox), a button (Button), and embeddable Web browser.
  • the display interface can be composed of one or more views.
  • a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures;
  • Location Manager (Location Manager) mainly allows applications to access the current geographic location of the phone.
  • the library layer (Libraries) is the support of the application framework and an important link between the application framework layer and the Linux kernel layer.
  • the function library layer includes some function libraries compiled by computer program C language or C++ language, these function libraries can be used by different components in the Android operating system, and they provide services for developers through the Android application framework.
  • the function library includes the libc function library, which is specially customized for embedded Linux-based devices; the function library also includes the Android operating system multimedia library (Media Framework), which supports the playback and playback of audio/video in multiple encoding formats. Recording, while supporting still image files and common audio/video encoding formats.
  • the function library also includes the interface management library (Surface Manager), which is mainly responsible for managing access to the display system, specifically for managing the interaction between display and access operations when multiple applications are executed, and also responsible for 2D drawing and 3D The drawing is displayed and synthesized.
  • the function library layer also includes other function libraries for implementing various functions of Android operating system phones, such as: SGL (Scalable Graphics Library): 2D graphics and image processing engine based on XML (Extensible Markup Language) files; SSL (Secure Sockets Layer) ): Located between the TVP/IP protocol (TransmissionControlProtocol/InternetProtocol, Transmission Control Protocol/Internet Protocol) and various application layer protocols, providing support for data communication; OpenGL/ES: 3D effect support; SQLite: relational database engine ; Webkit: Web browser engine; FreeType: Bitmap and Vector font support; etc.
  • SGL Scalable Graphics Library
  • XML Extensible Markup Language
  • SSL Secure Sockets Layer
  • TVP/IP protocol TransmissionControlProtocol/InternetProtocol, Transmission Control Protocol/Internet Protocol
  • OpenGL/ES 3D effect support
  • SQLite relational database engine
  • Webkit Web browser engine
  • FreeType Bitmap and Vector font support
  • Android Runtime is a running environment on the Android operating system, and a new virtual machine used by the Android operating system.
  • AOT Ahead-Of-Time
  • the application layer and the application framework layer run in a virtual machine.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • Android Runtime can also be replaced by Core Libraries and Dalvik Virtual Machine (Dalvik Virtual Machine).
  • the core function library provides most of the functions in the Java language API (Application Programming Interface), and provides an interface to the application framework layer to call the underlying library through the JNI (Java Native Interface) method. It also contains some core APIs of Android, such as android.os, android.net, android.media, etc.
  • the Dalvik virtual machine uses a JIT (Just-in-Time) runtime compilation mechanism. Every time a process is started, the virtual machine needs to recompile the bytecode in the background, which will have a certain impact on the startup speed. Every Android application runs in an instance in a Dalvik virtual machine, and each Dalvik virtual machine instance is an independent process space.
  • the Dalvik virtual machine is designed to efficiently run multiple virtual machines on one device.
  • the executable file format of the Dalvik virtual machine is .dex.
  • the dex format is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed. What needs to be mentioned is that the Dalvik virtual machine relies on the Linux kernel to provide basic functions (threads, underlying memory management). It is understandable that Android Runtime and Dalvik belong to different types of virtual machines, and those skilled in the art can choose different forms of virtual machines in different situations.
  • Android's core system services are all based on the Linux kernel.
  • the Linux kernel also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to mobile devices, the main drivers are: Display Driver: Linux-based Frame Buffer driver. Keyboard Driver (KeyBoard Driver): As the keyboard driver of the input device. Flash driver (Flash Memory Driver): Flash driver based on MTD (memory technology device). Camera Driver: Commonly used Linux-based v4l2 (Video for Linux) driver. Audio Driver: A commonly used advanced Linux sound system driver based on ALSA (Advanced Linux Sound Architecture). Bluetooth Driver: Wireless transmission technology based on IEEE 802.15.1 standard. WiFi Drive: A driver based on the IEEE 802.11 standard. Binder (IPC) driver: A special driver for Android with a separate device node that provides the function of inter-process communication. Power Management: For example, battery power.
  • Compiler is a kind of translation of high-level language into new target code that can be used by computer or virtual machine.
  • the efficiency of compiler directly affects program performance and effect. For example, an application in a mobile phone is developed in a high-level language. When an application is started, the compiler plays the role of a "translator", converting the high-level language into machine code that can be understood by the machine.
  • a "translator” converting the high-level language into machine code that can be understood by the machine.
  • Java uses virtual machines to schedule hardware platform resources.
  • an integrated translator or compiler is also needed to interpret Java bytecode (ie intermediate code) into machine language that the machine understands, or directly compile it into machine code of 010101 that is directly executed by the machine.
  • Java bytecode ie intermediate code
  • Dalvik a virtual machine called Dalvik was used, which integrated an interpreter. Every time a user runs an application on an Android phone, the interpreter is woken up to explain the application to the Android hardware. The operation you want to perform is very inefficient. Version 2.2 was released in mid-2010, introducing the JIT (Just in Time) mechanism. JIT is smarter. When a user runs an APP on an Android phone, it will also compile the frequently used functions of the user into 010101 machine code that can be directly executed by the machine, without having to translate every sentence and every sentence. When uncommon functions appear, call the interpreter to translate.
  • JIT Just in Time
  • JIT must be compiled every time the APP is started.
  • the performance of the Dalvik virtual machine is relatively backward, so Google launched the Android 5.0 version in October 2014, replacing the virtual machine from Dalvik to ART (Android Run Time), and at the same time JIT
  • the compiler replaces AOT (Ahead of Time). This means that when the APP is downloaded and installed on the mobile phone, it also compiles the compiled code into 101010 that the machine understands. If the code that is not well translated is left, the interpreter will be woken up for translation when the user uses it.
  • AOT Address of Time
  • the intermediate code is not compiled during installation, but the part of the code that can be compiled into machine code when the user is free is statically compiled by the AOT compiler. If AOT has not had time to compile or cannot compile, then wake up JIT and interpreter to compile.
  • the current Android system uses Java as a programming language, which is easy to develop.
  • Android uses the ART (Android Runtime) mode, the Java code with many calls is compiled into machine code (static compilation); some pre-compilation is performed when the device is idle.
  • static compilation is still not possible for the dynamic semantic part, and the virtual machine is still required to act as a "translator” while interpreting and running, so efficiency and experience are limited.
  • the virtual machine + compiler + interpreter on the mobile phone not only occupies hardware resources, but also cannot maximize the performance of the software. Because of this, most mobile phone manufacturers can only make up for the drawbacks of virtual machines by increasing the memory and storage space of Android phones.
  • the compiler of the Android virtual machine is limited by the mobile phone hardware and the single code optimization template, and the code optimization space is limited. The compiler consists of three parts.
  • the front end Front End is mainly responsible for translating the source code into IR (Intermediate Representation); the middle end Optimizer is mainly responsible for code optimization, which optimizes the IR code translated from the front end to be more efficient; the back end Back End translates the optimized IR Compiled into 101010 machine code.
  • IR Intermediate Representation
  • the middle end Optimizer is mainly responsible for code optimization, which optimizes the IR code translated from the front end to be more efficient;
  • the back end Back End translates the optimized IR Compiled into 101010 machine code.
  • Android In order to prevent the ecology from becoming too fragmented, Android only opens simple compiled code optimization templates for third parties, with limited code optimization space.
  • the Ark compiler adopts a brand-new system and application compilation and operation mechanism, and statically compiles all Java semantics, effectively solving the inefficiency of "interpretation and execution" in the existing Android system, and adopts Ark compilation
  • the application of the device has been compiled in the development stage, that is to say, the compiled machine code is downloaded from the Huawei application market. After the application of Huawei's Ark Compiler, there is no need to compile it on the mobile phone anymore. It completely bid farewell to the virtual machine and let the Ark Compiler compile Java code into a language that can be directly executed by the machine.
  • the Ark compiler adopts a static compilation method. It is the first static compiler to replace the Android virtual machine mode. It allows developers to compile high-level languages into machine code in the development environment at one time. APP manufacturers do not need to re-develop APP, just use The Ark Compiler is recompiled and released to significantly improve the running speed and fluency. According to Huawei’s official test data, the operating system fluency increased by 24%, the system response speed increased by 44%, and the three-party application operation fluency increased by 60%. Currently, Huawei's Ark compiler has been open sourced to the industry.
  • the application compiled with the Ark compiler is called the Ark application.
  • the packaging form of the Ark application has many forms, such as the original Android form, including the original classes.dex file of the android application, excluding the maple.so file generated after Ark compilation; the Ark only form, including the maple generated after Ark compilation
  • the .so file does not include the original classes.dex file of the android application;
  • the BOTH packaged APK includes both the original classes.dex file of the android application and the maple.so file generated after compilation by Ark.
  • This BOTH form of the Ark application has the following characteristics: it can run in the system in the Ark mode or in the android mode, and the operating mode of the application is switchable.
  • This application takes advantage of this switchability to bring flexibility in the operating mode to the Ark application generated after compilation with the Ark compiler. For example, it can provide a new means for recovering from application stability (crash, crash, etc.) failures. In view of the complexity of the actual running scene of the Ark application, this application provides a corresponding switching strategy.
  • Figure 3 provides a method for application switching operation, which includes the following steps:
  • the compilation mode can be Android compilation mode or Ark compilation mode.
  • the first compilation mode may be one of these two compilation modes. Among them, in the Android compilation mode, the application is started and loaded into the Android process, which contains the Android ART virtual machine; in other words, the mobile terminal runs the classes.dex file in the first application APK; in the Ark compilation mode (It can also be called maple compilation mode), the application is started and loaded into the Ark process, the Ark process has the Ark runtime; in other words, the mobile terminal runs the maple generated by the Ark compiler in the first application APK. so file.
  • the first application may be an application currently running or an application to be run (for example, an application to be opened by the user).
  • the second compilation mode is another compilation mode different from the first compilation mode.
  • the second compilation mode is the Ark compilation mode.
  • the first compilation mode is the Ark compilation mode
  • the second compilation mode is the Android compilation mode.
  • the mobile terminal receives an instruction for the user to manually switch the compilation mode, or it may be that the mobile terminal receives an instruction for the system to automatically switch the compilation mode of the first application.
  • the instruction for manually switching the compilation mode may be that the user manually switches the compilation mode during the running of the first application, or may switch the compilation mode before opening the first application.
  • the user can switch between the setting options of the first application or the setting options of the mobile terminal system. There is no restriction on the way of switching. For example, you can click a button on the screen, press a button of the phone (or a combination of buttons), use gesture commands, use voice commands, shake the phone, flip the phone, and so on.
  • the command to automatically switch the compilation mode can be set and triggered by the user in advance, or it can be automatically set and triggered when the mobile terminal leaves the factory, or it can be triggered by accepting the settings on the server side during the operation of the mobile terminal, or it can be the first application default Set to trigger.
  • "when the first switching condition is met" may specifically be: the number of times the first application crashes reaches the first threshold; or, the current system memory usage exceeds a certain threshold; or, the memory usage of the first application exceeds A certain threshold; or, the response speed of the first application page is lower than a certain threshold; or, the time the first application has been running in the first compilation mode has exceeded a certain time threshold; or, the user’s location information (such as GPS information) , And/or time zone information, and/or the operator’s PLMN number has changed; or, the performance of the compiler in the second compilation mode is better than that in the first compilation mode; or, according to the hardware capabilities of the mobile terminal (CPU, Or storage capacity, or GPU, or disk read and write speed, or screen resolution, or screen size, etc.) switch; or switch according to the operating system version of the mobile terminal; or, the current mobile terminal system time is within a preset time period ;and many more.
  • Figure 4 shows an example of switching the compilation mode. After a traditional Android application crashes, the system will pop up a dialog box to remind the user that the application has encountered an exception, and there is no other effective way to fix it. Using the switchability of the Ark application, you can switch the compilation mode to run after the application crashes, so as to restore the normal operation of the application and obtain a better user experience. Specific steps are as follows:
  • the first threshold here represents the number of times the first application crashes in a certain period of time, and the first threshold can be flexibly set, such as 2 crashes within 1 minute, or 3 crashes within 5 minutes, and so on.
  • the first compilation mode is the Ark compilation mode
  • the number of crashes in a certain period of time reaches the first threshold, it is considered that the first switching condition is satisfied.
  • the operating system can detect and record the number of crashes, and set the first application to a switching state. Specifically, the switching state can be recorded in the APK file, for example, added to disable-maplePkgs.xml.
  • the operating system will detect that the first application has been set to the switching state, and thus switch to the second compilation mode to run, for example, start the first application in the Android compilation mode.
  • start the first application in the Android compilation mode for example, start the first application in the Android compilation mode.
  • the specific implementation of starting the first application in the Android compilation mode is well known.
  • a virtual machine instance can be created through the zygote process to create a new process, so as to start the first application in the Android compilation mode.
  • the above switching steps can be performed without the user's perception (for example, switching in the background without popping up a prompt message) to avoid a bad user experience that cannot be repaired after the application crashes.
  • the first application when the first application runs in the Ark compilation mode and continuously crashes, the first application can be switched to the Android compilation mode to run normally, thereby obtaining a better user experience. Since in step 402, the first application continuously crashes before switching the compilation mode, and can run normally after switching the compilation mode, the "switching" in step 402 may sometimes be referred to as "escape".
  • the first compilation mode is the Android compilation mode
  • the first application runs in the Android compilation mode
  • the number of crashes in a certain period reaches the first threshold
  • the operating system can detect and record the number of crashes, and set the first application to a switching state.
  • the operating system will detect that the first application has been set to the switching state, and thus switch to the second compilation mode to run, for example, start the first application in the Ark compilation mode.
  • a new process can be created through the mygote process, so as to start the first application in the Ark compilation mode.
  • the above switching steps can be performed without the user's perception (for example, switching in the background without popping up a prompt message) to avoid a bad user experience that cannot be repaired after the application crashes.
  • step 402 the following step 403 may be further included:
  • the first application switches to the second compilation mode to run. If the second switching condition is met after the switching, the first application can also switch back to the first compilation mode to run.
  • the second switching condition may be that the number of crashes of the first application after running in the second compilation mode is greater than the first threshold, which means that after the step 402 is switched to the second compilation mode, the crash of the application is less than when running in the first compilation mode Even worse, the number of crashes exceeded the first threshold. This shows that the application running condition deteriorated after the switch in step 402, and it is better to switch back to the first compilation mode to run. Similar to step 402, the handover of step 403 can also be performed without the user's perception.
  • the second switching condition may also be detecting that the crash vulnerability of the first application in the first compilation mode has been repaired. At this time, using the first compilation mode can make the first application run in a better condition, then You can switch back to the first compilation mode. It is understandable that the second switching condition may also be that the mobile terminal receives other switching instructions set by the user or the system.
  • Figure 5 is a schematic flow diagram of a possible first application to switch to Android compilation mode after crashing in Ark compilation mode.
  • the first compilation mode is the Ark compilation mode
  • the first application is started in the Android compilation mode.
  • the operating system will perform APK scan, then device booting, then application start, and then run the zygote process to create a new process to start the first application ( zygote fork).
  • step 507 it is checked whether the Ark compilation mode is disabled. If it is (disabled), the Android compilation mode is still used to start, and step 508 is executed; if If no (not disabled), start the first application in Ark compilation mode, that is, use the mygote process to start the first application (mygote fork) (509).
  • the above is an example of switching the compilation mode of a single application.
  • multiple applications need to switch the compilation mode.
  • the number mentioned here can be two or more than two.
  • the compilation mode switching of one application may cause the compilation mode switching of other associated applications.
  • Fig. 6A, Fig. 6B, Fig. 6C, Fig. 6D, Fig. 6E are five examples of related applications. Some of these 5 examples are that the Ark application runs in the Ark process. It is understandable that the Android application can also have a similar implementation when running in the Android process, and vice versa.
  • the Android application can also have a similar implementation when running in the Android process, and vice versa.
  • FIG 6A multiple applications run together in the same process, for example, Ark Application A (package name: com.package.a) and Ark Application B (package name: com.package.b) run in common In an Ark process 1 (process1).
  • an application can run in multiple processes.
  • Ark application A (package name: com.package.a) starts Ark process 1 (process1)
  • Ark application B (package name: com.package. b) Simultaneously run in Ark process 1 (process1) and Ark process 2 (process2).
  • Figure 6C is a variant of Figure 6B.
  • Ark application A (package name: com.package.a) starts Ark process 1 (process1)
  • Ark application B (package name: com.package.b) runs In the Ark process 2 (process2)
  • the Ark application C (package name: com.package.c) runs in the Ark process 1 (process1) and the Ark process 2 (process2) at the same time.
  • Figure 6D shows an application running in the Android process and the Ark process respectively.
  • Android application A (package name: com.package.a) starts the Android process (process1)
  • Ark application B (package name: com.package.b) Run in both the Android process (process1) and the Ark process (process2) at the same time.
  • Ark application B in Figure 6D runs in the Android process process1 and the Ark process process2 at the same time, it runs the classes.dex file in the Android compilation mode and the maple.so file in the Ark compilation mode, respectively.
  • Figure 6E is a variant of Figure 6D.
  • Android application A (package name: com.package.a) starts the Android process (process1)
  • Ark application B (package name: com.package.b) runs In the Ark process (process2)
  • the Ark application C (package name: com.package.c) runs in both the Android process (process1) and the Ark process (process2).
  • Figure 7 shows the steps for switching the compilation mode when multiple applications are in the same process, including:
  • a first list can be created to record all applications in the process.
  • the application process starts (that is, when the Activity component of the application starts)
  • the ActivityManagerService of the Android system creates a ProcessRecord for each process to save process information.
  • a pkgList list (the first list) can be created in ProcessRecord, which can record all applications running under the process. It is understandable that "all applications running under this process" can refer to other applications that are started running under this process after the first application is started; in some cases, it can also be before the first application is started. , Other applications already running under this process.
  • the first application switches the compilation mode (switches from the first compilation mode to the second compilation mode, for example, switches from the Android compilation mode to the Ark compilation mode, or switches from the Ark compilation mode to the Android compilation mode)
  • it is also possible to record the switching mode when it is set to the switching state that is, specifically switching from the Android compilation mode to the Ark compilation mode, or from the Ark compilation mode to the Android compilation mode).
  • both the switching status and the switching mode can be stored in the operating system file.
  • step 702 may also be other applications (for example, the second application) recorded in the first list, and when the second application switches the compilation mode, all applications in the first list are set to the switching state.
  • all applications in the process can be set to the switching state.
  • all applications in the process can be set to the switching state.
  • the application can be run according to the switching state (optionally, including switching mode) set in step 702 .
  • the switching state (optionally, including switching mode) set in step 702 .
  • the second application described in 703 is only an example of a certain application, and it may also be "when the first application is started, run the first application in the switching state".
  • Running in the switching state may be switching the compilation mode to run when the application is started. For example, when step 701 is running in the Android compilation mode, step 703 may run the second application in the Ark compilation mode.
  • the switching method in FIG. 7 it is possible to realize the chain switching of other applications in the same process after a certain application under one process is switched, thereby conveniently realizing the multi-application switching compilation mode. For example, for multiple applications in the same process, when one of the applications crashes continuously, the system will not only set the application to the switching state, but also set other applications in the same process to the switching state. At startup, it will switch operation according to this switching state.
  • the above-mentioned application-dependent switching of the compilation mode may be active or passive.
  • the dependent application when the dependent application is actively switching, the dependent application will actively monitor the state change of the dependent application (whether it has been uninstalled, whether it has been deleted, whether it has been replaced/updated to another version, or whether it is running in another compilation mode Etc.), if the state of the dependent application changes, the dependent application will automatically switch the compilation mode.
  • both the dependent application and the dependent application run in the Ark compilation mode at the beginning, and later the dependent application monitors that the dependent application is switched to run in the Android compilation mode, and the dependent application will automatically switch to run in the Android compilation mode accordingly.
  • both the dependent application and the dependent application run in the Ark compilation mode at the beginning, and later the dependent application monitors that the dependent application has been deleted or uninstalled, the dependent application will actively switch to run in the Android compilation mode.
  • the system can automatically switch the compilation mode of the dependent application.
  • application A is a dependent application and application B is a dependent application.
  • the dependency relationship between the two has been registered in the system.
  • the system will automatically Switch the compilation mode of application A (for example, switch from Ark compilation mode to Android compilation mode).
  • the system can mark application A as the switching state, and start it in the switching state when application A is started; or, the system can notify application A so that application A marks itself as the switching state, and when application A is started The switching state starts.
  • the developer can abstract into an Ark based on the API (Application Programming Interface) information of the Ark application, such as the classes, members, or methods of the android framework API used in compilation.
  • the group check value (md5 or other means to generate the check value) forms the first check value.
  • the first check value can be packaged and preset into the APK.
  • API is a collection of definitions, procedures and protocols, and is a series of special rules and requirements provided by computer software to ensure mutual communication. Through API, communication can be realized between application and operating system.
  • the first check value will change as the code applied by the Ark changes. For example, when the Ark application is upgraded, new code will be introduced, and the API information will change at this time, resulting in a change in the abstracted first check value.
  • the API information provided by the Ark system externally such as the information provided externally on the android framework layer API classes, members, or methods, is abstracted into a set of check values (md5 or other methods to generate check values) to form a second check value.
  • the method for generating the second check value is the same as the method for generating the first check value in step 1101. And pack the second check value and preset it into the Ark system.
  • the second check value will change as the code of the Ark system changes. For example, when the version of the Ark system is updated, new codes will be introduced. At this time, the API information will change, causing the abstracted second check value to also change.
  • the first check value of the Ark application API is a subset of the second check value of the Ark system API.
  • the status change can be installation, update, OTA (over the air) upgrade, patching, etc.; the status change of the Ark application can cause a change in the first check value.
  • the Ark system will compare the first check value with the second check value to determine whether the first check value is a subset of the second check value.
  • the first check value is a subset of the second check value, there is no need to switch the compilation mode of the Ark application, that is, the Ark compilation mode is still running. If the first check value is not a subset of the second check value, indicating that there may be version compatibility issues (for example, the Ark app version and the Ark system version are not compatible), switch the compilation mode of the Ark app, that is, switch to Android Compile mode.
  • check value there may be multiple methods for generating the check value, and the above-mentioned using API information to generate the check value is just one example.
  • Other methods of generating check values include, but are not limited to: using code-generated library files to generate check values, using a code segment in the code-generated library files to generate check codes, and using classes in the code to generate check values. Use the method in the class to generate the check value, or use the interface in the class to generate the check value, and so on.
  • the compilation mode can be switched when the application is incompatible, thereby solving the problem of incompatibility between the Ark application and the Ark system.
  • this application also provides a method for application switching operation, including:
  • a method for application switching operation characterized in that the method comprises:
  • the first application is run in the second compilation mode.
  • the method according to 1 or 2 characterized in that the first handover condition is at least one of the following conditions:
  • the number of crashes of the first application reaches a first threshold
  • the current system memory usage exceeds the second threshold
  • the memory occupation of the first application exceeds a third threshold
  • the page response speed of the first application is lower than the fourth threshold.
  • the running time of the first application in the first compilation mode exceeds a fifth threshold
  • the performance of the compiler in the second compilation mode is better than the performance of the compiler in the first compilation mode
  • the current system time is within the preset time period.
  • the first application is run in the first compilation mode.
  • the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
  • the APK status of the third application changes.
  • the third application is switched to run in the second compilation mode.
  • comparing the first check value with the second check value is: detecting whether the first check value is the second check value A subset of values;
  • the switching the coding mode of the first application according to the comparison result is specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application .
  • the first compilation mode is the Android compilation mode
  • the second compilation mode is the Ark compilation mode
  • the first compilation mode is the Ark compilation mode
  • the second compilation mode is the Android compilation mode.
  • the present application also provides an electronic device, including a first compilation module, a second compilation module, and a switching module, wherein: the first compilation module is configured to run a first application in a first compilation mode; the switching module , Used to determine when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode to run; the second compilation module is used to run in the second compilation mode The first application.
  • the first application is an Ark application packaged in BOTH form.
  • the first switching condition is at least one of the following conditions:
  • the number of crashes of the first application reaches a first threshold
  • the current system memory usage exceeds the second threshold
  • the memory occupation of the first application exceeds a third threshold
  • the page response speed of the first application is lower than the fourth threshold.
  • the running time of the first application in the first compilation mode exceeds a fifth threshold
  • the performance of the second compilation module is better than the performance of the first compilation module
  • the current system time is within the preset time period.
  • the electronic device further includes a crash recording module and a restart detection module, wherein the first switching condition is that the number of crashes of the first application reaches a first threshold, and the crash recording module is configured to record the first The number of crashes of an application, the first application is set to the switching state; the restart detection module is configured to detect whether the first application is in the switching state when the first application is restarted; the second The compiling module is configured to determine that when the first application is in a switching state, run the first application in the second compiling mode.
  • the first switching condition is that the number of crashes of the first application reaches a first threshold
  • the crash recording module is configured to record the first The number of crashes of an application, the first application is set to the switching state
  • the restart detection module is configured to detect whether the first application is in the switching state when the first application is restarted
  • the second The compiling module is configured to determine that when the first application is in a switching state, run the first application in the second compiling mode.
  • the first compilation module is further configured to: when a second switching condition is met, run the first application in the first compilation mode.
  • the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
  • the second switching condition may also be: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
  • the process in which the first application runs further includes a second application
  • the switching module is configured to switch the compilation mode of the second application when the first application is run in the second compilation mode.
  • the second compilation mode is configured to switch the compilation mode of the second application when the first application is run in the second compilation mode.
  • the start time of the second application is earlier than the start time of the first application.
  • the start time of the second application is later than the start time of the first application.
  • the operation of the first application depends on the third application, and the first switching condition may be: the APK status of the third application changes.
  • the operation of the first application depends on the third application, and the first switching condition may also be: the third application is switched to run in the second compilation mode.
  • the electronic device further includes a first check code generation module, a second check code generation module, a comparison module, and the first check code generation module is used to create the first application according to
  • the API information of the first application generates a first check value, and the first check value is packaged into the APK of the first application;
  • the second check code generation module is configured to operate The API information provided by the system generates a second check value, and packs the second check value into the operating system;
  • the comparison module is used to compare all the data when the state of the first application changes.
  • the switching module is configured to switch the compilation mode of the first application according to the comparison result.
  • the comparison of the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
  • the first compilation module is an Android compilation module
  • the second compilation module is an Ark compilation module
  • the first compilation module is an Ark compilation module
  • the second compilation module is an Android compilation module
  • the present application also provides an electronic device, including a first compiler, a second compiler, and a processor, the first compiler is configured to run a first application in a first compilation mode; the processor is configured to , It is determined that when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode; the second compiler is configured to run in the second compilation mode The first application.
  • the first application is an Ark application packaged in BOTH form.
  • the first switching condition is at least one of the following conditions:
  • the number of crashes of the first application reaches a first threshold
  • the current system memory usage exceeds the second threshold
  • the memory occupation of the first application exceeds a third threshold
  • the page response speed of the first application is lower than the fourth threshold.
  • the running time of the first application in the first compilation mode exceeds a fifth threshold
  • the performance of the second compiler is better than the performance of the first compiler
  • the current system time is within the preset time period.
  • the processor when the first switching condition is that the number of crashes of the first application reaches a first threshold, the processor is further configured to: record the number of crashes of the first application, and set the first application to Switch state
  • the first compiler is further configured to: when a second switching condition is met, run the first application in the first compilation mode.
  • the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
  • the second switching condition may also be: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
  • the running process of the first application further includes a second application
  • the processor is configured to: when the first application is run in the second compilation mode, switch the compilation mode of the second application to The second compilation mode is described.
  • the start time of the second application is earlier than the start time of the first application.
  • the start time of the second application is later than the start time of the first application.
  • the operation of the first application depends on the third application, and the first switching condition may be: the APK status of the third application changes.
  • the operation of the first application depends on the third application, and the first switching condition may also be: the third application is switched to run in the second compilation mode.
  • the processor is further configured to: when creating the first application, generate a first check value according to the API information of the first application; and pack the first check value into the first application APK; generate a second check value from the API information provided by the operating system, and pack the second check value into the operating system; when the state of the first application changes, compare the first A check value and the second check value; switch the compilation mode of the first application according to the comparison result.
  • the comparison of the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
  • the first compiler is an Android compiler
  • the second compiler is an Ark compiler
  • the first compiler is an Ark compiler
  • the second compiler is an Android compiler
  • This application also provides an electronic device, characterized in that the electronic device includes: one or more processors and a memory, the memory is used to store computer program code, the computer program code includes instructions, when the one When the instruction is executed by or multiple processors, the electronic device executes the method described in any of the foregoing embodiments.
  • the present application also provides a computer-readable storage medium, which is characterized by comprising computer instructions, which, when the computer instructions run on an electronic device, cause the electronic device to execute the method described in any of the foregoing embodiments.
  • the present application also provides a computer program product, which is characterized in that when the computer program product runs on a computer, the computer is caused to execute the method described in any of the foregoing embodiments.
  • the present application also provides a chip, which is characterized by comprising: a processor and an interface, configured to call and run a computer program stored in the memory from the memory, and execute the method described in any of the foregoing embodiments.
  • the disclosed device and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be other division methods for example, multiple units or components may be It can be combined or integrated into another device, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate parts may or may not be physically separate.
  • the parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of software products, which are stored in a storage medium.
  • a device which may be a single-chip microcomputer, a chip, etc.
  • a processor processor
  • the aforementioned storage medium includes: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.

Landscapes

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

Abstract

The embodiments of the present application relate to the technical field of electronics, and provided is a method for switching the running of an application. The specific solution comprises: using a first compiling mode to run a first application; and when a first switching condition is met, using a second compiling mode to run the first application. The compiling mode of an application may be flexibly switched, thus providing a new idea for solving problems such as application crashing and incompatibility.

Description

一种应用切换运行的方法及设备Method and equipment for application switching operation
本申请要求在2019年8月15日提交中国国家知识产权局、申请号为201910755635.5的中国专利申请的优先权,发明名称为“一种应用切换运行的方法及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office of China with the application number 201910755635.5 on August 15, 2019, and the priority of the Chinese patent application with the title of "A method and equipment for application switching operation" , Its entire content is incorporated in this application by reference.
技术领域Technical field
本申请实施例涉及电子技术领域,尤其涉及一种应用切换运行的方法及设备。The embodiments of the present application relate to the field of electronic technology, and in particular to a method and device for application switching operation.
背景技术Background technique
华为研发并发布了方舟编译器,方舟编译器采取了静态编译的方式,是首个取代了安卓虚拟机模式的静态编译器。华为方舟编译器提供了全新的系统及应用的编译和运行机制,从底层解决了安卓运行效率问题,可供开发者在开发环境一次性的将高级语言编译为机器码,带来效率上的极大提升。Huawei developed and released the Ark compiler. The Ark compiler adopts a static compilation method and is the first static compiler to replace the Android virtual machine mode. Huawei’s Ark Compiler provides a new system and application compilation and operation mechanism, which solves the problem of Android operating efficiency from the bottom. It allows developers to compile high-level languages into machine code at one time in the development environment, bringing extreme efficiency. Great improvement.
使用方舟编译器编译过的应用称为方舟应用。方舟应用的打包形态具备多种形态,其中的BOTH打包形态下,APK(Android package,Android安装包)内部既包括android应用原始的classes.dex文件,又包括方舟编译后生成的maple.so文件。此种BOTH形态的方舟应用可以用方舟模式运行在系统中,也可以用android模式运行在系统中。The application compiled with the Ark compiler is called the Ark application. The packaging form of the Ark application has many forms. In the BOTH packaging form, the APK (Android package, Android installation package) includes both the original classes.dex file of the android application and the maple.so file generated after compilation of the Ark. This BOTH form of the Ark application can be run in the system in Ark mode, or in the Android mode.
发明内容Summary of the invention
本申请实施例提供一种应用切换运行的方法及设备,能够灵活切换应用的的编译模式,使用一种全新的方式来解决应用崩溃、不兼容等问题。The embodiments of the present application provide a method and device for application switching operation, which can flexibly switch the compilation mode of the application, and use a brand-new way to solve problems such as application crashes and incompatibility.
为达到上述目的,本申请实施例采用如下技术方案:In order to achieve the foregoing objectives, the following technical solutions are adopted in the embodiments of this application:
第一方面,本申请实施例提供一种应用切换运行的方法,包括:以第一编译模式运行第一应用;当满足第一切换条件时,以第二编译模式运行该第一应用。In a first aspect, an embodiment of the present application provides a method for switching and running an application, which includes: running a first application in a first compilation mode; when the first switching condition is met, running the first application in a second compilation mode.
在一种可能的设计中,该第一应用是以BOTH形态打包的方舟应用。In one possible design, the first application is an Ark application packaged in BOTH form.
在一种可能的设计中,该第一切换条件为以下条件的至少一种:该第一应用的崩溃次数达到第一阈值;或当前系统内存占用超过第二阈值;或该第一应用的内存占用超过第三阈值;或该第一应用的页面响应速度低于第四阈值;或该第一应用以该第一编译模式运行时间超过第五阈值;或用户的位置信息发生改变;或该第二编译模式的编译器性能优于该第一编译模式的编译器性能;或当前系统时间处于预设时间段内。In a possible design, the first switching condition is at least one of the following conditions: the number of crashes of the first application reaches a first threshold; or the current system memory usage exceeds a second threshold; or the memory of the first application The occupancy exceeds the third threshold; or the page response speed of the first application is lower than the fourth threshold; or the running time of the first application in the first compilation mode exceeds the fifth threshold; or the user’s location information changes; or The performance of the compiler in the second compilation mode is better than the performance of the compiler in the first compilation mode; or the current system time is within the preset time period.
在一种可能的设计中,当该第一切换条件为该第一应用的崩溃次数达到第一阈值时,该方法还包括:记录该第一应用的崩溃次数,将该第一应用设置为切换状态;在该第一应用重新启动时,检测该第一应用是否是切换状态;如果该第一应用是切换状态,则以该第二编译模式运行该第一应用。In a possible design, when the first switching condition is that the number of crashes of the first application reaches a first threshold, the method further includes: recording the number of crashes of the first application, and setting the first application to switch State; when the first application is restarted, detect whether the first application is in the switching state; if the first application is in the switching state, run the first application in the second compilation mode.
在一种可能的设计中,当满足第二切换条件时,以该第一编译模式运行该第一应用。In a possible design, when the second switching condition is met, the first application is run in the first compilation mode.
在一种可能的设计中,该第二切换条件为:该第一应用以该第二编译模式运行后的崩溃次数大于该第一阈值。In a possible design, the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
在一种可能的设计中,该第二切换条件为:检测到该第一应用在该第一编译模式下的崩溃漏洞被修复。In a possible design, the second switching condition is: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
在一种可能的设计中,该第一应用运行的进程下还包括第二应用,该方法还包括:当以 该第二编译模式运行该第一应用时,切换该第二应用的编译模式为该第二编译模式。In a possible design, the process in which the first application runs further includes a second application, and the method further includes: when the first application is run in the second compilation mode, switching the compilation mode of the second application to This second compilation mode.
在一种可能的设计中,该第二应用的启动时间早于该第一应用的启动时间。In a possible design, the start time of the second application is earlier than the start time of the first application.
在一种可能的设计中,该第二应用的启动时间晚于该第一应用的启动时间。In a possible design, the start time of the second application is later than the start time of the first application.
在一种可能的设计中,该第一应用的运行依赖于第三应用,该第一切换条件为:该第三应用的APK状态发生变化。In a possible design, the operation of the first application depends on the third application, and the first switching condition is: the APK state of the third application changes.
在一种可能的设计中,该第一应用的运行依赖于第三应用,该第一切换条件为:该第三应用切换为以该第二编译模式运行。In a possible design, the operation of the first application depends on the third application, and the first switching condition is: the third application is switched to run in the second compilation mode.
在一种可能的设计中,在创建该第一应用时,根据该第一应用的API信息生成第一校验值;将该第一校验值打包到该第一应用的APK中;将操作系统提供的API信息生成第二校验值,将该第二校验值打包到该操作系统中;当该第一应用的状态改变时,比对该第一校验值和该第二校验值;根据比对结果,切换该第一应用的编译模式。In a possible design, when the first application is created, the first check value is generated according to the API information of the first application; the first check value is packaged into the APK of the first application; The API information provided by the system generates a second check value and packs the second check value into the operating system; when the state of the first application changes, compare the first check value with the second check value Value; switch the compilation mode of the first application according to the comparison result.
在一种可能的设计中,该比对该第一校验值和该第二校验值为:检测该第一校验值是否为该第二校验值的子集;该根据比对结果,切换该第一应用的编译模式,具体为:如果该第一校验值不是该第二校验值的子集,则切换该第一应用的编译模式。In a possible design, the comparison between the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; and the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
在一种可能的设计中,该第一编译模式为Android编译模式,该第二编译模式为方舟编译模式;或者,该第一编译模式为方舟编译模式,该第二编译模式为Android编译模式。In a possible design, the first compilation mode is the Android compilation mode, and the second compilation mode is the Ark compilation mode; or, the first compilation mode is the Ark compilation mode, and the second compilation mode is the Android compilation mode.
通过以上方案,可以灵活切换应用的的编译模式,使用一种全新的方式来解决应用崩溃、不兼容等问题。Through the above solution, the compilation mode of the application can be switched flexibly, and a brand-new method can be used to solve the problems of application crashes and incompatibility.
第二方面,本申请实施例提供一种电子设备,包括第一编译模块,第二编译模块,切换模块,其中:该第一编译模块,用于以第一编译模式运行第一应用;该切换模块,用于确定当满足第一切换条件时,使得该第一应用从该第一编译模式切换为第二编译模式运行;该第二编译模块,用于以该第二编译模式运行该第一应用。In a second aspect, an embodiment of the present application provides an electronic device, including a first compilation module, a second compilation module, and a switching module, wherein: the first compilation module is configured to run a first application in a first compilation mode; the switching Module, used to determine when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode; the second compilation module is used to run the first application in the second compilation mode application.
在一种可能的设计中,该第一应用是以BOTH形态打包的方舟应用。In one possible design, the first application is an Ark application packaged in BOTH form.
在一种可能的设计中,该第一切换条件为以下条件的至少一种:该第一应用的崩溃次数达到第一阈值;或当前系统内存占用超过第二阈值;或该第一应用的内存占用超过第三阈值;或该第一应用的页面响应速度低于第四阈值;或该第一应用以该第一编译模式运行时间超过第五阈值;或用户的位置信息发生改变;或该第二编译模块的性能优于该第一编译模块的性能;或当前系统时间处于预设时间段内。In a possible design, the first switching condition is at least one of the following conditions: the number of crashes of the first application reaches a first threshold; or the current system memory usage exceeds a second threshold; or the memory of the first application The occupancy exceeds the third threshold; or the page response speed of the first application is lower than the fourth threshold; or the running time of the first application in the first compilation mode exceeds the fifth threshold; or the user’s location information changes; or The performance of the second compilation module is better than the performance of the first compilation module; or the current system time is within a preset time period.
在一种可能的设计中,该电子设备还包括崩溃记录模块,重启检测模块,其中,该第一切换条件为该第一应用的崩溃次数达到第一阈值,其中:该崩溃记录模块,用于记录该第一应用的崩溃次数,将该第一应用设置为切换状态;该重启检测模块,用于在该第一应用重新启动时,检测该第一应用是否是切换状态;该第二编译模块,用于确定当该第一应用是切换状态,则以该第二编译模式运行该第一应用。In a possible design, the electronic device further includes a crash recording module and a restart detection module, wherein the first switching condition is that the number of crashes of the first application reaches a first threshold, wherein: the crash recording module is configured to The number of crashes of the first application is recorded, and the first application is set to the switching state; the restart detection module is configured to detect whether the first application is in the switching state when the first application is restarted; the second compilation module , Used to determine that when the first application is in the switching state, run the first application in the second compilation mode.
在一种可能的设计中,该第一编译模块还用于:当满足第二切换条件时,以该第一编译模式运行该第一应用。In a possible design, the first compilation module is further configured to: when the second switching condition is met, run the first application in the first compilation mode.
在一种可能的设计中,该第二切换条件为:该第一应用以该第二编译模式运行后的崩溃次数大于该第一阈值。In a possible design, the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
在一种可能的设计中,该第二切换条件为:检测到该第一应用在该第一编译模式下的崩溃漏洞被修复。In a possible design, the second switching condition is: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
在一种可能的设计中,该第一应用运行的进程下还包括第二应用,其中:该切换模块,用于当以该第二编译模式运行该第一应用时,切换该第二应用的编译模式为该第二编译模式。In a possible design, the running process of the first application further includes a second application, wherein: the switching module is configured to switch the second application when the first application is running in the second compilation mode The compilation mode is the second compilation mode.
在一种可能的设计中,该第二应用的启动时间早于该第一应用的启动时间。In a possible design, the start time of the second application is earlier than the start time of the first application.
在一种可能的设计中,该第二应用的启动时间晚于该第一应用的启动时间。In a possible design, the start time of the second application is later than the start time of the first application.
在一种可能的设计中,该第一应用的运行依赖于第三应用,该第一切换条件为:该第三应用的APK状态发生变化。In a possible design, the operation of the first application depends on the third application, and the first switching condition is: the APK state of the third application changes.
在一种可能的设计中,该第一应用的运行依赖于第三应用,该第一切换条件为:该第三应用切换为以该第二编译模式运行。In a possible design, the operation of the first application depends on the third application, and the first switching condition is: the third application is switched to run in the second compilation mode.
在一种可能的设计中,该电子设备还包括第一校验码生成模块,第二校验码生成模块,比对模块,其中:该第一校验码生成模块,用于在创建该第一应用时,根据该第一应用的API信息生成第一校验值,该将该第一校验值打包到该第一应用的APK中;该第二校验码生成模块,用于将操作系统提供的API信息生成第二校验值,将该第二校验值打包到该操作系统中;该比对模块,用于当该第一应用的状态改变时,比对该第一校验值和该第二校验值;该切换模块,用于根据比对结果,切换该第一应用的编译模式In a possible design, the electronic device further includes a first check code generation module, a second check code generation module, and a comparison module, wherein: the first check code generation module is used to create the first check code In an application, a first check value is generated according to the API information of the first application, and the first check value is packaged into the APK of the first application; the second check code generation module is used to operate The API information provided by the system generates a second check value, and packs the second check value into the operating system; the comparison module is used to compare the first check value when the state of the first application changes Value and the second check value; the switching module is configured to switch the compilation mode of the first application according to the comparison result
在一种可能的设计中,该比对该第一校验值和该第二校验值为:检测该第一校验值是否为该第二校验值的子集;该根据比对结果,切换该第一应用的编译模式,具体为:如果该第一校验值不是该第二校验值的子集,则切换该第一应用的编译模式。In a possible design, the comparison between the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; and the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
在一种可能的设计中,该第一编译模块为Android编译模块,该第二编译模块为方舟编译模块;或者,该第一编译模块为方舟编译模块,该第二编译模块为Android编译模块。In a possible design, the first compilation module is an Android compilation module, and the second compilation module is an Ark compilation module; or, the first compilation module is an Ark compilation module, and the second compilation module is an Android compilation module.
通过以上方案,可以灵活切换应用的的编译模式,使用一种全新的方式来解决应用崩溃、不兼容等问题。Through the above solution, the compilation mode of the application can be switched flexibly, and a brand-new method can be used to solve the problems of application crashes and incompatibility.
第三方面,本申请实施例提供一种电子设备,包括第一编译器,第二编译器,处理器,其中:该第一编译器被配置为,以第一编译模式运行第一应用;该处理器被配置为,确定当满足第一切换条件时,使得该第一应用从该第一编译模式切换为第二编译模式运行;该第二编译器被配置为,以该第二编译模式运行该第一应用。In a third aspect, an embodiment of the present application provides an electronic device, including a first compiler, a second compiler, and a processor, wherein: the first compiler is configured to run a first application in a first compilation mode; The processor is configured to determine that when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode to run; the second compiler is configured to run in the second compilation mode The first application.
第四方面,本申请实施例提供一种电子设备,该电子设备包括:一个或多个处理器、存储器,该存储器用于存储计算机程序代码,该计算机程序代码包括指令,当该一个或多个处理器执行该指令时,该电子设备执行如第一方面及其任一种可能的设计中的方法。In a fourth aspect, an embodiment of the present application provides an electronic device. The electronic device includes: one or more processors and a memory, the memory is used to store computer program code, the computer program code includes instructions, when the one or more When the processor executes the instruction, the electronic device executes the method in the first aspect and any one of its possible designs.
第五方面,本申请实施例提供一种计算机可读存储介质,其中,包括计算机指令,当该计算机指令在电子设备上运行时,使得该电子设备执行如第一方面及其任一种可能的设计中的方法。In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes computer instructions. When the computer instructions run on an electronic device, the electronic device executes the first aspect and any of the possible Method in design.
第六方面,本申请实施例提供一种计算机程序产品,其中,当该计算机程序产品在计算机上运行时,使得该计算机执行如第一方面及其任一种可能的设计中的方法。In a sixth aspect, an embodiment of the present application provides a computer program product, wherein when the computer program product runs on a computer, the computer is caused to execute the method in the first aspect and any one of its possible designs.
第七方面,本申请实施例提供一种芯片,其中,包括:处理器和接口,用于从存储器中调用并运行该存储器中存储的计算机程序,执行如第一方面及其任一种可能的设计中的方法。In a seventh aspect, an embodiment of the present application provides a chip, which includes: a processor and an interface, configured to call and run a computer program stored in the memory from the memory, and execute the first aspect and any possible Method in design.
附图说明Description of the drawings
图1为本申请实施例提供的一种移动终端的硬件结构示意图。FIG. 1 is a schematic diagram of the hardware structure of a mobile terminal provided by an embodiment of the application.
图2为本申请实施例提供的一种Android操作系统的架构示意图。FIG. 2 is a schematic diagram of the architecture of an Android operating system provided by an embodiment of the application.
图3为本申请实施例提供的一种应用切换运行的方法流程图。Fig. 3 is a flow chart of a method for application switching operation provided by an embodiment of the application.
图4为本申请实施例提供的一种切换编译模式的方法流程图。FIG. 4 is a flowchart of a method for switching compilation mode provided by an embodiment of the application.
图5为本申请实施例提供的第一应用崩溃后切换编译模式的方法流程图。FIG. 5 is a flowchart of a method for switching the compilation mode after the first application crashes according to an embodiment of the application.
图6A、6B、6C、6D、6E为本申请实施例提供的关联应用的示意图。6A, 6B, 6C, 6D, and 6E are schematic diagrams of associated applications provided by embodiments of this application.
图7为本申请实施例提供的多个同进程应用切换编译模式的方法流程图。FIG. 7 is a flowchart of a method for switching compilation modes of multiple applications in the same process provided by an embodiment of the application.
图8为本申请实施例提供的一种同进程应用切换编译模式的示意图。FIG. 8 is a schematic diagram of switching compilation modes for applications in the same process according to an embodiment of the application.
图9为本申请实施例提供的另一种同进程应用切换编译模式的示意图。FIG. 9 is a schematic diagram of another same-process application switching compilation mode provided by an embodiment of the application.
图10为本申请实施例提供的一种具有依赖关系的多个应用切换编译模式的示意图。FIG. 10 is a schematic diagram of switching compilation modes of multiple applications with dependencies according to an embodiment of the application.
图11为本申请实施例提供的一种为解决兼容问题而切换编译模式的方法流程图FIG. 11 is a flowchart of a method for switching compilation modes to solve compatibility problems according to an embodiment of the application
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this document is only a description of related objects The association relationship of indicates that there can be three relationships, for example, A and/or B, which can indicate: A alone exists, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" means two or more than two.
移动终端可以包括诸如手机、平板电脑、可穿戴设备(例如,手表、手环、智能头盔等)、车载设备、智能家居设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等。本申请一些实施例以手机为例,可以理解的是,这些实施例也可应用于其他类型的移动终端。Mobile terminals may include mobile phones, tablets, wearable devices (for example, watches, bracelets, smart helmets, etc.), vehicle-mounted devices, smart home devices, augmented reality (AR)/virtual reality (VR) Equipment, notebook computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs), etc. Some embodiments of the present application take a mobile phone as an example. It should be understood that these embodiments can also be applied to other types of mobile terminals.
本申请实施例涉及的应用程序(application,app),可以简称应用,为能够实现某项或多项特定功能的软件程序。通常,电子设备中可以安装多个应用,例如,即时通讯类应用、视频类应用、音频类应用、图像拍摄类应用等等。本申请实施例中提到的应用,可以是电子设备出厂时已安装的应用,也可以是用户在使用电子设备的过程中从网络下载或其他电子设备获取的应用。The application program (application, app) involved in the embodiments of the present application may be referred to as an application, which is a software program that can implement one or more specific functions. Generally, multiple applications can be installed in an electronic device, for example, instant messaging applications, video applications, audio applications, image capturing applications, and so on. The applications mentioned in the embodiments of the present application may be applications that have been installed when the electronic device leaves the factory, or may be applications downloaded from the network or obtained by other electronic devices during the process of using the electronic device.
如图1所示,本申请实施例中的移动终端可以为手机100。下面以手机100为例对实施例进行具体说明。应该理解的是,图示手机100仅是移动终端的一个范例,并且手机100可以具有比图中所示出的更多的或者更少的部件,可以组合两个或更多的部件,或者可以具有不同的部件配置。As shown in FIG. 1, the mobile terminal in the embodiment of the present application may be a mobile phone 100. The embodiments are described in detail below taking the mobile phone 100 as an example. It should be understood that the illustrated mobile phone 100 is only an example of a mobile terminal, and the mobile phone 100 may have more or fewer components than those shown in the figure, two or more components may be combined, or There are different component configurations.
如图1所示,手机100具体可以包括:处理器101、射频(RF)电路102、存储器103、触摸屏104、蓝牙装置105、一个或多个传感器106、Wi-Fi装置107、定位装置108、音频电路109、外设接口110以及电源系统111等部件。这些部件可通过一根或多根通信总线或信号线(图1中未示出)进行通信。本领域技术人员可以理解,图1中示出的硬件结构并不构成对手机的限定,手机100可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。As shown in FIG. 1, the mobile phone 100 may specifically include: a processor 101, a radio frequency (RF) circuit 102, a memory 103, a touch screen 104, a Bluetooth device 105, one or more sensors 106, a Wi-Fi device 107, a positioning device 108, Audio circuit 109, peripheral interface 110, power supply system 111 and other components. These components can communicate through one or more communication buses or signal lines (not shown in Figure 1). Those skilled in the art can understand that the hardware structure shown in FIG. 1 does not constitute a limitation on the mobile phone, and the mobile phone 100 may include more or less components than those shown in the figure, or combine some components, or arrange different components.
下面结合图1对手机100的各个部件进行具体的介绍:Hereinafter, each component of the mobile phone 100 will be specifically introduced in conjunction with FIG. 1:
处理器101是手机100的控制中心,利用各种接口和线路连接手机100的各个部分,通过运行或执行存储在存储器103内的应用程序,以及调用存储在存储器103内的数据,执行手机100的各种功能和处理数据。在一些实施例中,处理器101可包括一个或多个处理单元;举例来说,处理器101可以是华为技术有限公司制造的麒麟芯片。在本申请一些实施例中,上述处理器101还可以包括指纹验证芯片,用于对采集到的指纹进行验证。The processor 101 is the control center of the mobile phone 100. It uses various interfaces and lines to connect to the various parts of the mobile phone 100, and executes the operation of the mobile phone 100 by running or executing application programs stored in the memory 103 and calling data stored in the memory 103. Various functions and processing data. In some embodiments, the processor 101 may include one or more processing units; for example, the processor 101 may be a Kirin chip manufactured by Huawei Technologies Co., Ltd. In some embodiments of the present application, the above-mentioned processor 101 may further include a fingerprint verification chip for verifying the collected fingerprint.
射频电路102可用于在收发信息或通话过程中,无线信号的接收和发送。特别地,射频电路102可以将基站的下行数据接收后,给处理器101处理;另外,将涉及上行的数据发送给基站。通常,射频电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声 放大器、双工器等。此外,射频电路102还可以通过无线通信和其他设备通信。所述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统、通用分组无线服务、码分多址、宽带码分多址、长期演进、电子邮件、短消息服务等。The radio frequency circuit 102 can be used to receive and send wireless signals during the process of sending and receiving information or talking. In particular, the radio frequency circuit 102 may receive the downlink data of the base station and send it to the processor 101 for processing; in addition, it may send the uplink data to the base station. Generally, the radio frequency circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and so on. In addition, the radio frequency circuit 102 can also communicate with other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to global system for mobile communications, general packet radio service, code division multiple access, broadband code division multiple access, long-term evolution, email, short message service, etc.
存储器103用于存储应用程序以及数据,处理器101通过运行存储在存储器103的应用程序以及数据,执行手机100的各种功能以及数据处理。存储器103主要包括存储程序区以及存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等);存储数据区可以存储根据使用手机100时所创建的数据(比如音频数据、电话本等)。此外,存储器103可以包括高速随机存取存储器,还可以包括非易失存储器,例如磁盘存储器件、闪存器件或其他易失性固态存储器件等。存储器103可以存储各种操作系统,例如,苹果公司所开发的
Figure PCTCN2020108158-appb-000001
操作系统,谷歌公司所开发的
Figure PCTCN2020108158-appb-000002
操作系统等。上述存储器103可以是独立的,通过上述通信总线与处理器101相连接;存储器103也可以和处理器101集成在一起。
The memory 103 is used to store application programs and data. The processor 101 executes various functions and data processing of the mobile phone 100 by running the application programs and data stored in the memory 103. The memory 103 mainly includes a storage program area and a storage data area. The storage program area can store the operating system and at least one application program required by at least one function (such as sound playback function, image playback function, etc.); the storage data area can store Data created at 100 o'clock (such as audio data, phone book, etc.). In addition, the memory 103 may include a high-speed random access memory, and may also include a non-volatile memory, such as a magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. The memory 103 can store various operating systems, for example, those developed by Apple
Figure PCTCN2020108158-appb-000001
Operating system, developed by Google
Figure PCTCN2020108158-appb-000002
Operating system, etc. The foregoing memory 103 may be independent and connected to the processor 101 through the foregoing communication bus; the memory 103 may also be integrated with the processor 101.
触摸屏104可以包括触控板104-1和显示器104-2。其中,触控板104-1可采集手机100的用户在其上或附近的触摸事件(比如用户使用手指、触控笔等任何适合的物体在触控板104-1上或在触控板104-1附近的操作),并将采集到的触摸信息发送给其他器件例如处理器101。其中,用户在触控板104-1附近的触摸事件可以称之为悬浮触控;悬浮触控可以是指,用户无需为了选择、移动或拖动目标(例如图标等)而直接接触触控板,而只需用户位于电子设备附近以便执行所想要的功能。在悬浮触控的应用场景下,术语“触摸”、“接触”等不会暗示用于直接接触触摸屏,而是附近或接近的接触。能够进行悬浮触控的触控板104-1可以采用电容式、红外光感以及超声波等实现。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型来实现触控板104-1。显示器(也称为显示屏)104-2可用于显示由用户输入的信息或提供给用户的信息以及手机100的各种菜单。可以采用液晶显示器、有机发光二极管等形式来配置显示器104-2。触控板104-1可以覆盖在显示器104-2之上,当触控板104-1检测到在其上或附近的触摸事件后,传送给处理器101以确定触摸事件的类型,随后处理器101可以根据触摸事件的类型在显示器104-2上提供相应的视觉输出。虽然在图1中,触控板104-1与显示屏104-2是作为两个独立的部件来实现手机100的输入和输出功能,但是在某些实施例中,可以将触控板104-1与显示屏104-2集成而实现手机100的输入和输出功能。可以理解的是,触摸屏104是由多层的材料堆叠而成,本申请实施例中只展示出了触控板(层)和显示屏(层),其他层在本申请实施例中不予记载。另外,在本申请其他一些实施例中,触控板104-1可以覆盖在显示器104-2之上,并且触控板104-1的尺寸大于显示屏104-2的尺寸,使得显示屏104-2全部覆盖在触控板104-1下面,或者,上述触控板104-1可以以全面板的形式配置在手机100的正面,也即用户在手机100正面的触摸均能被手机感知,这样就可以实现手机正面的全触控体验。在其他一些实施例中,触控板104-1以全面板的形式配置在手机100的正面,显示屏104-2也可以以全面板的形式配置在手机100的正面,这样在手机的正面就能够实现无边框的结构。The touch screen 104 may include a touch pad 104-1 and a display 104-2. Among them, the touchpad 104-1 can collect touch events on or near the user of the mobile phone 100 (for example, the user uses a finger, a stylus, or any other suitable object on the touchpad 104-1 or on the touchpad 104 -1 near operation), and send the collected touch information to other devices such as the processor 101. Among them, the user's touch event near the touchpad 104-1 can be referred to as floating touch; floating touch can mean that the user does not need to directly touch the touchpad in order to select, move, or drag a target (such as an icon, etc.) , And only the user is located near the electronic device in order to perform the desired function. In the application scenario of floating touch, the terms "touch", "contact", etc. do not imply direct contact with the touch screen, but nearby or close contact. The touchpad 104-1 capable of hovering touch can be realized by capacitive, infrared light sensing, and ultrasonic waves. In addition, multiple types such as resistive, capacitive, infrared, and surface acoustic wave can be used to implement the touch panel 104-1. The display (also referred to as a display screen) 104-2 can be used to display information input by the user or information provided to the user and various menus of the mobile phone 100. The display 104-2 can be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The touchpad 104-1 can cover the display 104-2. When the touchpad 104-1 detects a touch event on or near it, it transmits it to the processor 101 to determine the type of the touch event, and then the processor 101 can provide corresponding visual output on the display 104-2 according to the type of the touch event. Although in FIG. 1, the touchpad 104-1 and the display 104-2 are used as two independent components to implement the input and output functions of the mobile phone 100, but in some embodiments, the touchpad 104- 1 is integrated with the display 104-2 to realize the input and output functions of the mobile phone 100. It is understandable that the touch screen 104 is formed by stacking multiple layers of materials. Only the touch panel (layer) and the display screen (layer) are shown in the embodiments of the present application, and other layers are not described in the embodiments of the present application. . In addition, in some other embodiments of the present application, the touchpad 104-1 may cover the display 104-2, and the size of the touchpad 104-1 is larger than the size of the display 104-2, so that the display 104- 2 It is completely covered under the touchpad 104-1, or the above-mentioned touchpad 104-1 can be configured on the front of the mobile phone 100 in the form of a full panel, that is, the user's touch on the front of the mobile phone 100 can be sensed by the mobile phone. You can achieve a full touch experience on the front of the phone. In some other embodiments, the touchpad 104-1 is configured on the front of the mobile phone 100 in the form of a full panel, and the display 104-2 can also be configured on the front of the mobile phone 100 in the form of a full panel, so that it is A frameless structure can be realized.
在本申请实施例中,手机100还可以具有指纹识别功能。例如,可以在触摸屏104中配置指纹采集器件112来实现指纹识别功能,即指纹采集器件112可以与触摸屏104集成在一起来实现手机100的指纹识别功能。在这种情况下,该指纹采集器件112配置在触摸屏104中,可以是触摸屏104的一部分,也可以以其他方式配置在触摸屏104中。另外,该指纹采集器件112还可以被实现为全面板指纹采集器件。因此,可以把触摸屏104看成是任何位置都可以进行指纹识别的一个面板。该指纹采集器件112可以将采集到的指纹发送给处理器101, 以便处理器101对该指纹进行处理(例如指纹验证等)。本申请实施例中的指纹采集器件112的主要部件是指纹传感器,该指纹传感器可以采用任何类型的感测技术,包括但不限于光学式、电容式、压电式或超声波传感技术等。In the embodiment of the present application, the mobile phone 100 may also have a fingerprint recognition function. For example, the fingerprint collection device 112 can be configured in the touch screen 104 to realize the fingerprint recognition function, that is, the fingerprint collection device 112 can be integrated with the touch screen 104 to realize the fingerprint recognition function of the mobile phone 100. In this case, the fingerprint collection device 112 is configured in the touch screen 104, may be a part of the touch screen 104, or may be configured in the touch screen 104 in other ways. In addition, the fingerprint collection device 112 can also be implemented as a full-board fingerprint collection device. Therefore, the touch screen 104 can be regarded as a panel that can perform fingerprint recognition at any position. The fingerprint collecting device 112 may send the collected fingerprint to the processor 101, so that the processor 101 can process the fingerprint (for example, fingerprint verification, etc.). The main component of the fingerprint collection device 112 in the embodiment of the present application is a fingerprint sensor. The fingerprint sensor can use any type of sensing technology, including but not limited to optical, capacitive, piezoelectric or ultrasonic sensing technology.
手机100还可以包括蓝牙装置105,用于实现手机100与其他短距离的电子设备(例如手机、智能手表等)之间的数据交换。本申请实施例中的蓝牙装置可以是集成电路或者蓝牙芯片等。The mobile phone 100 may also include a Bluetooth device 105, which is used to implement data exchange between the mobile phone 100 and other short-distance electronic devices (such as mobile phones, smart watches, etc.). The Bluetooth device in the embodiment of the present application may be an integrated circuit or a Bluetooth chip.
手机100还可以包括至少一种传感器106,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节触摸屏104的显示器的亮度,接近传感器可在手机100移动到耳边时,关闭显示器的电源。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机100还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The mobile phone 100 may also include at least one sensor 106, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display of the touch screen 104 according to the brightness of the ambient light. The proximity sensor can turn off the power of the display when the mobile phone 100 is moved to the ear. . As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in various directions (usually three-axis), and can detect the magnitude and direction of gravity when stationary, and can be used to identify mobile phone posture applications (such as horizontal and vertical screen switching, related Games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, percussion), etc.; as for the other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. that can be configured in the mobile phone 100, we will not Repeat it again.
Wi-Fi装置107,用于为手机100提供遵循Wi-Fi相关标准协议的网络接入,手机100可以通过Wi-Fi装置107接入到Wi-Fi接入点,进而帮助用户收发电子邮件、浏览网页和访问流媒体等,它为用户提供了无线的宽带互联网访问。在其他一些实施例中,该Wi-Fi装置107也可以作为Wi-Fi无线接入点,可以为其他电子设备提供Wi-Fi网络接入。The Wi-Fi device 107 is used to provide the mobile phone 100 with network access in compliance with Wi-Fi related standard protocols. The mobile phone 100 can connect to the Wi-Fi access point through the Wi-Fi device 107 to help users send and receive emails, Browsing web pages and accessing streaming media, etc., it provides users with wireless broadband Internet access. In some other embodiments, the Wi-Fi device 107 can also serve as a Wi-Fi wireless access point, which can provide Wi-Fi network access for other electronic devices.
定位装置108,用于为手机100提供地理位置。可以理解的是,该定位装置108具体可以是全球定位系统(GPS)或北斗卫星导航系统、俄罗斯GLONASS等定位系统的接收器。定位装置108在接收到上述定位系统发送的地理位置后,将该信息发送给处理器101进行处理,或者发送给存储器103进行保存。在另外的一些实施例中,该定位装置108还可以是辅助全球卫星定位系统(AGPS)的接收器,AGPS系统通过作为辅助服务器来协助定位装置108完成测距和定位服务,在这种情况下,辅助定位服务器通过无线通信网络与电子设备例如手机100的定位装置108(即GPS接收器)通信而提供定位协助。在另外的一些实施例中,该定位装置108也可以是基于Wi-Fi接入点的定位技术。由于每一个Wi-Fi接入点都有一个全球唯一的MAC地址,电子设备在开启Wi-Fi的情况下即可扫描并收集周围的Wi-Fi接入点的广播信号,因此可以获取到Wi-Fi接入点广播出来的MAC地址;电子设备将这些能够标示Wi-Fi接入点的数据(例如MAC地址)通过无线通信网络发送给位置服务器,由位置服务器检索出每一个Wi-Fi接入点的地理位置,并结合Wi-Fi广播信号的强弱程度,计算出该电子设备的地理位置并发送到该电子设备的定位装置108中。The positioning device 108 is used to provide a geographic location for the mobile phone 100. It is understandable that the positioning device 108 may specifically be a receiver of a positioning system such as Global Positioning System (GPS), Beidou satellite navigation system, Russian GLONASS, etc. After receiving the geographic location sent by the above-mentioned positioning system, the positioning device 108 sends the information to the processor 101 for processing, or sends the information to the memory 103 for storage. In some other embodiments, the positioning device 108 may also be a receiver of an assisted global satellite positioning system (AGPS). The AGPS system assists the positioning device 108 to complete ranging and positioning services by acting as an auxiliary server. In this case The auxiliary positioning server communicates with the positioning device 108 (ie GPS receiver) of the mobile phone 100 via a wireless communication network to provide positioning assistance. In some other embodiments, the positioning device 108 may also be a positioning technology based on a Wi-Fi access point. Since every Wi-Fi access point has a globally unique MAC address, electronic devices can scan and collect the broadcast signals of surrounding Wi-Fi access points when Wi-Fi is turned on, so they can get Wi-Fi -The MAC address broadcasted by the Fi access point; the electronic device sends the data (such as MAC address) that can indicate the Wi-Fi access point to the location server through the wireless communication network, and the location server retrieves each Wi-Fi access point The geographic location of the entry point is combined with the strength of the Wi-Fi broadcast signal to calculate the geographic location of the electronic device and send it to the positioning device 108 of the electronic device.
音频电路109、扬声器113、麦克风114可提供用户与手机100之间的音频接口。音频电路109可将接收到的音频数据转换后的电信号,传输到扬声器113,由扬声器113转换为声音信号输出;另一方面,麦克风114将收集的声音信号转换为电信号,由音频电路109接收后转换为音频数据,再将音频数据输出至RF电路102以发送给比如另一手机,或者将音频数据输出至存储器103以便进一步处理。The audio circuit 109, the speaker 113, and the microphone 114 can provide an audio interface between the user and the mobile phone 100. The audio circuit 109 can transmit the electrical signal converted from the received audio data to the speaker 113, which is converted into a sound signal for output by the speaker 113; on the other hand, the microphone 114 converts the collected sound signal into an electrical signal, and the audio circuit 109 After being received, it is converted into audio data, and then the audio data is output to the RF circuit 102 to be sent to, for example, another mobile phone, or the audio data is output to the memory 103 for further processing.
外设接口110,用于为外部的输入/输出设备(例如键盘、鼠标、外接显示器、外部存储器、用户识别模块卡等)提供各种接口。例如通过通用串行总线(USB)接口与鼠标连接,通过用户识别模块卡卡槽上的金属触点与电信运营商提供的用户识别模块卡(SIM)卡进行连接。外设接口110可以被用来将上述外部的输入/输出外围设备耦接到处理器101和存储器103。The peripheral interface 110 is used to provide various interfaces for external input/output devices (such as a keyboard, a mouse, an external display, an external memory, a user identification module card, etc.). For example, it is connected to a mouse through a universal serial bus (USB) interface, and is connected to a subscriber identity module card (SIM) card provided by a telecommunication operator through a metal contact on a subscriber identity module card slot. The peripheral interface 110 can be used to couple the aforementioned external input/output peripheral devices to the processor 101 and the memory 103.
手机100还可以包括给各个部件供电的电源装置111(比如电池和电源管理芯片),电池可以通过电源管理芯片与处理器101逻辑相连,从而通过电源装置111实现管理充电、放电、以及功耗管理等功能。The mobile phone 100 may also include a power supply device 111 (such as a battery and a power management chip) for supplying power to various components. The battery can be logically connected to the processor 101 through the power management chip, so that the power supply device 111 can manage charging, discharging, and power consumption management. And other functions.
尽管图1未示出,手机100还可以包括摄像头(前置摄像头和/或后置摄像头)、闪光灯、微型投影装置、近场通信(NFC)装置等,在此不再赘述。Although not shown in FIG. 1, the mobile phone 100 may also include a camera (front camera and/or rear camera), a flash, a miniature projection device, a near field communication (NFC) device, etc., which will not be repeated here.
图2是一种运行Android操作系统的手机100的操作系统结构示意图。Android操作系统架构分为四层,从高层到底层分为应用程序层,应用程序框架层,函数库层和Linux内核层。FIG. 2 is a schematic diagram of the operating system structure of the mobile phone 100 running the Android operating system. The Android operating system architecture is divided into four layers, from high-level to bottom-level divided into application layer, application framework layer, function library layer and Linux kernel layer.
1、应用程序层:1. Application layer:
应用程序层(Applications)是Android操作系统架构的最上一层,包括Android操作系统装配的核心应用软件,例如电子邮件客户端、短信、通话、日历、地图、浏览器、联系人等。当然,对于开发者来说,开发者可以编写应用软件并安装到该层。一般而言,应用程序都是使用Java语言开发,通过调用应用程序框架层所提供的API(Application Programming Interface)来完成。The application layer (Applications) is the top layer of the Android operating system architecture, including core application software assembled by the Android operating system, such as email clients, text messages, calls, calendars, maps, browsers, and contacts. Of course, for developers, developers can write application software and install to this layer. Generally speaking, applications are developed in the Java language and completed by calling the API (Application Programming Interface) provided by the application framework layer.
2、应用程序框架层:2. Application framework layer:
应用程序框架层(Application Framework),主要是为开发者提供了可以访问应用程序所使用的各种API,应用程序框架层包括一些预先定义的函数。开发者通过应用程序框架层来与Android底层(例如函数库层、Linux内核层等)进行交互,开发自己的应用。该应用程序框架层主要是Android操作系统的一系列的服务和管理系统。应用程序框架层主要包括如下关键服务:The application framework layer (Application Framework) mainly provides developers with various APIs that can be used by applications. The application framework layer includes some predefined functions. Developers interact with the bottom layer of Android (such as function library layer, Linux kernel layer, etc.) through the application framework layer to develop their own applications. The application framework layer is mainly a series of services and management systems of the Android operating system. The application framework layer mainly includes the following key services:
活动管理器(Activity Manager)用来管理应用程序生命周期并提供常用的导航回退功能;Activity Manager (Activity Manager) is used to manage the application life cycle and provide common navigation rollback functions;
内容提供器(Content Providers),用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。从而实现不同应用程序间的数据共享和访问;Content Providers are used to store and retrieve data and make these data accessible to applications. The data may include video, image, audio, phone calls made and received, browsing history and bookmarks, phone book, etc. So as to realize data sharing and access between different applications;
通知管理器(Notification Manager),用于控制应用程序在状态栏显示提示信息(例如警告(Alerts)、通知消息(Notifications)等)给用户。使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等;The Notification Manager is used to control the application to display prompt information (such as Alerts, Notifications, etc.) to the user in the status bar. The application can display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the download completion, message reminder, etc. The notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, prompt text information in the status bar, sound a prompt sound, electronic device vibration, flashing indicator light, etc.;
资源管理器(Resource Manager):为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。可以提供非代码资源(如字符串、图形和布局文件(Layoutfile)等)供应用程序使用;Resource Manager: Provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc. Can provide non-code resources (such as strings, graphics, layout files, etc.) for application programs;
包管理器(Package Manager)主要用于对Android操作系统的应用程序进行管理;Package Manager (Package Manager) is mainly used to manage the applications of the Android operating system;
视图(View),具有丰富的、可扩展的视图集合,可用于构建一个应用程序,它具体包括列表(List)、网格(Grid)、文本框(TextBox)、按钮(Button),以及可嵌入的网页浏览器。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图;View, with a rich and extensible collection of views, can be used to build an application, which specifically includes a list (List), a grid (Grid), a text box (TextBox), a button (Button), and embeddable Web browser. The display interface can be composed of one or more views. For example, a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures;
位置管理器(Location Manager),主要是让应用程序可以访问到手机当前的地理位置。Location Manager (Location Manager) mainly allows applications to access the current geographic location of the phone.
3、函数库层:3. Function library layer:
函数库层(Libraries)是应用程序框架的支撑,是连接应用程序框架层与Linux内核层的 重要纽带。函数库层包括一些由计算机程序C语言或C++语言编译的函数库,这些函数库能被Android操作系统中的不同的组件使用,它们通过Android应用程序框架为开发者提供服务。具体地,函数库包括libc函数库,它是专门为基于embedded linux的设备定制的;函数库还包括Android操作系统多媒体库(Media Framework),该库支持多种编码格式的音频/视频的回放和录制,同时支持静态图像文件,以及常见的音频/视频编码格式。函数库还包括界面管理库(Surface Manager),主要负责管理针对显示系统的访问,具体用于在执行多个应用程序时候,负责管理显示与存取操作间的互动,另外也负责2D绘图与3D绘图进行显示合成。The library layer (Libraries) is the support of the application framework and an important link between the application framework layer and the Linux kernel layer. The function library layer includes some function libraries compiled by computer program C language or C++ language, these function libraries can be used by different components in the Android operating system, and they provide services for developers through the Android application framework. Specifically, the function library includes the libc function library, which is specially customized for embedded Linux-based devices; the function library also includes the Android operating system multimedia library (Media Framework), which supports the playback and playback of audio/video in multiple encoding formats. Recording, while supporting still image files and common audio/video encoding formats. The function library also includes the interface management library (Surface Manager), which is mainly responsible for managing access to the display system, specifically for managing the interaction between display and access operations when multiple applications are executed, and also responsible for 2D drawing and 3D The drawing is displayed and synthesized.
函数库层中还包括其他的用于实现Android操作系统手机各个功能的函数库,例如:SGL(Scalable Graphics Library):基于XML(Extensible Markup Language)文件的2D图形图像处理引擎;SSL(Secure Sockets Layer):位于TVP/IP协议(TransmissionControlProtocol/InternetProtocol,传输控制协议/互联网络协议)与各种应用层协议之间,为数据通讯提供支持;OpenGL/ES:3D效果的支持;SQLite:关系型数据库引擎;Webkit:Web浏览器引擎;FreeType:位图(Bitmap)及矢量(Vector)字体支持;等等。The function library layer also includes other function libraries for implementing various functions of Android operating system phones, such as: SGL (Scalable Graphics Library): 2D graphics and image processing engine based on XML (Extensible Markup Language) files; SSL (Secure Sockets Layer) ): Located between the TVP/IP protocol (TransmissionControlProtocol/InternetProtocol, Transmission Control Protocol/Internet Protocol) and various application layer protocols, providing support for data communication; OpenGL/ES: 3D effect support; SQLite: relational database engine ; Webkit: Web browser engine; FreeType: Bitmap and Vector font support; etc.
Android Runtime是一种在Android操作系统上的运行环境,是Android操作系统所使用的一种新的虚拟机。在Android Runtime中,采用AOT(Ahead-Of-Time)技术,应用程序在第一次安装的时候,该应用程序的字节码就会被预先编译成机器码,让程序成为真正的本地应用,之后再次运行,就省去了编译这一步骤,启动和执行都会变得更加快速。应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。Android Runtime is a running environment on the Android operating system, and a new virtual machine used by the Android operating system. In Android Runtime, using AOT (Ahead-Of-Time) technology, when an application is installed for the first time, the bytecode of the application will be pre-compiled into machine code, making the program a real local application. After running it again, the compilation step is omitted, and the startup and execution will become faster. The application layer and the application framework layer run in a virtual machine. The virtual machine executes the java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
在早期的Android系统中,Android Runtime也可以由核心函数库(Core Libraries)和Dalvik虚拟机(Dalvik Virtual Machine)代替。核心函数库提供了Java语言API(Application Programming Interface)中的大多数功能,主要通过JNI(Java Native Interface)的方式向应用程序框架层提供调用底层程序库的接口。同时也包含了Android的一些核心API,如android.os、android.net、android.media等等。Dalvik虚拟机使用一种JIT(Just-in-Time)的运行时编译的机制,每次启动一个进程都需要虚拟机在后台重新编译字节码,会对启动速度有一定的影响。每一个Android应用程序都运行在是一个Dalvik虚拟机中的实例中,每一个Dalvik虚拟机实例都是一个独立的进程空间。Dalvik虚拟机设计成在一个设备可以高效地运行多个虚拟机。Dalvik虚拟机可执行文件格式是.dex,dex格式是专为Dalvik设计的一种压缩格式,适合内存和处理器速度有限的系统。需要提出的是Dalvik虚拟机依赖于Linux内核提供基本功能(线程、底层内存管理)。可以理解的是,Android Runtime、Dalvik属于不同类型的虚拟机,本领域技术人员可以在不同情况下选用不同形式的虚拟机。In the early Android system, Android Runtime can also be replaced by Core Libraries and Dalvik Virtual Machine (Dalvik Virtual Machine). The core function library provides most of the functions in the Java language API (Application Programming Interface), and provides an interface to the application framework layer to call the underlying library through the JNI (Java Native Interface) method. It also contains some core APIs of Android, such as android.os, android.net, android.media, etc. The Dalvik virtual machine uses a JIT (Just-in-Time) runtime compilation mechanism. Every time a process is started, the virtual machine needs to recompile the bytecode in the background, which will have a certain impact on the startup speed. Every Android application runs in an instance in a Dalvik virtual machine, and each Dalvik virtual machine instance is an independent process space. The Dalvik virtual machine is designed to efficiently run multiple virtual machines on one device. The executable file format of the Dalvik virtual machine is .dex. The dex format is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed. What needs to be mentioned is that the Dalvik virtual machine relies on the Linux kernel to provide basic functions (threads, underlying memory management). It is understandable that Android Runtime and Dalvik belong to different types of virtual machines, and those skilled in the art can choose different forms of virtual machines in different situations.
4、Linux内核层:4. Linux kernel layer:
Android的核心系统服务,如安全性、内存管理、进程管理、网络协议栈和驱动模型等都基于Linux内核。Linux内核同时也作为硬件和软件栈之间的抽象层。该层有许多与移动设备相关的驱动程序,主要的驱动有:显示驱动(Display Driver):基于Linux的帧缓冲(Frame Buffer)驱动。键盘驱动(KeyBoard Driver):作为输入设备的键盘驱动。Flash驱动(Flash Memory Driver):基于MTD(memory technology device内存技术设备)的Flash驱动程序。照相机驱动(Camera Driver):常用的基于Linux的v4l2(Video for Linux)驱动。音频驱动(Audio Driver):常用的基于ALSA(Advanced Linux Sound Architecture)的高级Linux声音体系驱动。蓝牙驱动(Bluetooth Driver):基于IEEE 802.15.1标准的无线传输技术。WiFi驱动(WiFi Drive):基 于IEEE 802.11标准的驱动程序。Binder(IPC)驱动:Android的一个特殊的驱动程序,具有单独的设备节点,提供进程间通讯的功能。电源管理(Power Management):比如电池电量等。Android's core system services, such as security, memory management, process management, network protocol stack and driver model, are all based on the Linux kernel. The Linux kernel also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to mobile devices, the main drivers are: Display Driver: Linux-based Frame Buffer driver. Keyboard Driver (KeyBoard Driver): As the keyboard driver of the input device. Flash driver (Flash Memory Driver): Flash driver based on MTD (memory technology device). Camera Driver: Commonly used Linux-based v4l2 (Video for Linux) driver. Audio Driver: A commonly used advanced Linux sound system driver based on ALSA (Advanced Linux Sound Architecture). Bluetooth Driver: Wireless transmission technology based on IEEE 802.15.1 standard. WiFi Drive: A driver based on the IEEE 802.11 standard. Binder (IPC) driver: A special driver for Android with a separate device node that provides the function of inter-process communication. Power Management: For example, battery power.
编译器是一种将高级语言翻译为能被计算机或虚拟机新的目标代码,编译器的效率直接影响程序运行性能和效果。例如,手机里的应用程序是由高级语言开发而成的,当启动某个应用程序的时候,编译器扮演者“翻译者”的角色,把高级语言转换成机器能读懂的机器码,并按照指令运行。Compiler is a kind of translation of high-level language into new target code that can be used by computer or virtual machine. The efficiency of compiler directly affects program performance and effect. For example, an application in a mobile phone is developed in a high-level language. When an application is started, the compiler plays the role of a "translator", converting the high-level language into machine code that can be understood by the machine. Follow the instructions.
Java为了能够实现跨平台操作,便借助虚拟机来调度硬件平台资源。在虚拟机里,还需要集成翻译器或者编译器,来将Java的字节码(即中间代码)解释成机器听得懂的机器语言,或者直接编译成机器直接执行的010101的机器码。Android 1.0刚发布的时候,使用的是一个叫Dalvik的虚拟机,里面集成了一个解释器,每次用户在安卓手机上运行应用时,就会叫醒这个解释器,来给安卓的硬件解释应用想执行的操作,效率非常低下。在2010年中发布了2.2版本,引入了JIT(Just in Time,即时编译)机制。JIT比较聪明,当用户在安卓手机运行APP时,会同时将用户经常使用的功能编译为机器能直接执行的010101机器码,不用每一句每一句的去翻译。当出现不常用的功能时,再把解释器叫起来翻译。In order to achieve cross-platform operation, Java uses virtual machines to schedule hardware platform resources. In the virtual machine, an integrated translator or compiler is also needed to interpret Java bytecode (ie intermediate code) into machine language that the machine understands, or directly compile it into machine code of 010101 that is directly executed by the machine. When Android 1.0 was first released, a virtual machine called Dalvik was used, which integrated an interpreter. Every time a user runs an application on an Android phone, the interpreter is woken up to explain the application to the Android hardware. The operation you want to perform is very inefficient. Version 2.2 was released in mid-2010, introducing the JIT (Just in Time) mechanism. JIT is smarter. When a user runs an APP on an Android phone, it will also compile the frequently used functions of the user into 010101 machine code that can be directly executed by the machine, without having to translate every sentence and every sentence. When uncommon functions appear, call the interpreter to translate.
JIT每次启动APP都要先编译一次,加上Dalvik虚拟机性能比较落后,所以谷歌在2014年10月推出了Android 5.0版本,将虚拟机从Dalvik替代成ART(Android Run Time),同时把JIT的编译器替代成AOT(Ahead of Time)。意思就是说,APP在下载后安装到手机上时同时把能编译的代码先编译成机器听得懂的101010。剩下不太好翻译的代码,就在用户使用时再叫醒解释器来翻译。AOT相比JIT的好处,就是不用每次打开APP都需要先编译一遍。但是,坏处就是用户安装APP的时间有点长。JIT must be compiled every time the APP is started. In addition, the performance of the Dalvik virtual machine is relatively backward, so Google launched the Android 5.0 version in October 2014, replacing the virtual machine from Dalvik to ART (Android Run Time), and at the same time JIT The compiler replaces AOT (Ahead of Time). This means that when the APP is downloaded and installed on the mobile phone, it also compiles the compiled code into 101010 that the machine understands. If the code that is not well translated is left, the interpreter will be woken up for translation when the user uses it. The advantage of AOT over JIT is that it does not need to be compiled every time you open the app. However, the disadvantage is that it takes a long time for users to install APP.
谷歌在2017年Android 7.0又做了一点改进,安装时先不编译中间代码,而是在用户空闲时将能够编译成机器码的那部分代码,通过AOT编译器先静态编译了。如果AOT还没来得及编译或者不能编译,再唤醒JIT和解释器编译。Google made a little improvement in Android 7.0 in 2017. The intermediate code is not compiled during installation, but the part of the code that can be compiled into machine code when the user is free is statically compiled by the AOT compiler. If AOT has not had time to compile or cannot compile, then wake up JIT and interpreter to compile.
当前的Android系统使用Java作为编程语言,易于开发,尽管Android采用了ART(Android Runtime)模式,对调用次数多的Java代码编译为机器码(静态编译);在设备空闲的时候进行一些预编译,解决了部分Java代码执行效率问题,但对于动态语义部分还是无法实现静态编译,仍需要虚拟机充当“翻译”边解释边运行,效率和体验提升有限。The current Android system uses Java as a programming language, which is easy to develop. Although Android uses the ART (Android Runtime) mode, the Java code with many calls is compiled into machine code (static compilation); some pre-compilation is performed when the device is idle. The problem of efficiency of some Java code execution is solved, but static compilation is still not possible for the dynamic semantic part, and the virtual machine is still required to act as a "translator" while interpreting and running, so efficiency and experience are limited.
无论是编译器还是解释器,只是在虚拟机上打补丁。手机上的虚拟机+编译器+解释器本身不仅占用硬件资源,还无法最大发挥软件运行性能。正因如此,所以绝大部分手机厂商只能通过提升安卓手机的内存和存储空间,来弥补虚拟机的弊端。安卓虚拟机的编译器受限于手机硬件和代码优化模板单一,代码优化空间有限。编译器包含三个部分。前端Front End,主要负责将源代码翻译成IR(Intermediate Representation,中间表示);中端的Optimizer主要负责代码优化,将前端翻译过来的IR代码优化得更高效;后端Back End则将优化后的IR编译成101010的机器码。为了防止生态过于碎片化,安卓只为第三方开放了简单的编译代码优化模板,代码优化空间有限。Whether it is a compiler or an interpreter, it is just a patch on the virtual machine. The virtual machine + compiler + interpreter on the mobile phone not only occupies hardware resources, but also cannot maximize the performance of the software. Because of this, most mobile phone manufacturers can only make up for the drawbacks of virtual machines by increasing the memory and storage space of Android phones. The compiler of the Android virtual machine is limited by the mobile phone hardware and the single code optimization template, and the code optimization space is limited. The compiler consists of three parts. The front end Front End is mainly responsible for translating the source code into IR (Intermediate Representation); the middle end Optimizer is mainly responsible for code optimization, which optimizes the IR code translated from the front end to be more efficient; the back end Back End translates the optimized IR Compiled into 101010 machine code. In order to prevent the ecology from becoming too fragmented, Android only opens simple compiled code optimization templates for third parties, with limited code optimization space.
方舟编译器采用了全新的系统及应用的编译和运行机制,对所有的Java语义全部做到静态编译,有效解决现有Android系统中存在的“边解释边执行”的低效现象,采用方舟编译器的应用在开发阶段就已经完成了编译,也就是说,从华为应用市场下载的就是编译过的机器码了。经过华为方舟编译器的应用,再也不需要在手机上编译了,彻底告别了虚拟机,让方舟编译器能够将Java代码编译成机器能直接执行的语言。The Ark compiler adopts a brand-new system and application compilation and operation mechanism, and statically compiles all Java semantics, effectively solving the inefficiency of "interpretation and execution" in the existing Android system, and adopts Ark compilation The application of the device has been compiled in the development stage, that is to say, the compiled machine code is downloaded from the Huawei application market. After the application of Huawei's Ark Compiler, there is no need to compile it on the mobile phone anymore. It completely bid farewell to the virtual machine and let the Ark Compiler compile Java code into a language that can be directly executed by the machine.
方舟编译器采取了静态编译的方式,是首个取代了Android虚拟机模式的静态编译器, 可供开发者在开发环境一次性将高级语言编译为机器码,APP厂商无需重新开发APP,只要用方舟编译器重新编译发布,即可显著提升运行速度、流畅度。根据华为官方的测试数据显示,操作系统流畅度提升24%,系统响应速度提升44%,三方应用操作流畅度提升60%。目前华为方舟编译器已面向业界开源。The Ark compiler adopts a static compilation method. It is the first static compiler to replace the Android virtual machine mode. It allows developers to compile high-level languages into machine code in the development environment at one time. APP manufacturers do not need to re-develop APP, just use The Ark Compiler is recompiled and released to significantly improve the running speed and fluency. According to Huawei’s official test data, the operating system fluency increased by 24%, the system response speed increased by 44%, and the three-party application operation fluency increased by 60%. Currently, Huawei's Ark compiler has been open sourced to the industry.
使用方舟编译器编译过的应用称为方舟应用。方舟应用的打包形态具备多种形态,例如原有的Android形态,包括android应用原始的classes.dex文件,不包括方舟编译后生成的maple.so文件;方舟only形态,包括方舟编译后生成的maple.so文件,不包括android应用原始的classes.dex文件;BOTH打包形态的APK内部既包括android应用原始的classes.dex文件,又包括方舟编译后生成的maple.so文件。此种BOTH形态的方舟应用具备如下特征:既可以用方舟模式运行在系统中,也可以用android模式运行在系统中,应用的运行方式具备可切换性。The application compiled with the Ark compiler is called the Ark application. The packaging form of the Ark application has many forms, such as the original Android form, including the original classes.dex file of the android application, excluding the maple.so file generated after Ark compilation; the Ark only form, including the maple generated after Ark compilation The .so file does not include the original classes.dex file of the android application; the BOTH packaged APK includes both the original classes.dex file of the android application and the maple.so file generated after compilation by Ark. This BOTH form of the Ark application has the following characteristics: it can run in the system in the Ark mode or in the android mode, and the operating mode of the application is switchable.
本申请利用这种可切换性,为使用方舟编译器编译后产生的方舟应用带来了运行方式上的灵活性。例如,可以为应用的稳定性(崩溃、闪退等)故障的恢复提供新的手段。针对方舟应用实际运行的场景复杂性,本申请提供了相应的切换策略。This application takes advantage of this switchability to bring flexibility in the operating mode to the Ark application generated after compilation with the Ark compiler. For example, it can provide a new means for recovering from application stability (crash, crash, etc.) failures. In view of the complexity of the actual running scene of the Ark application, this application provides a corresponding switching strategy.
图3提供了一种应用切换运行的方法,该方法包括以下步骤:Figure 3 provides a method for application switching operation, which includes the following steps:
301、以第一编译模式运行第一应用。301. Run a first application in a first compilation mode.
编译模式可以是Android编译模式或者方舟编译模式。第一编译模式可以是这两种编译模式其中的一种。其中,在Android编译模式下,应用启动并加载到Android进程中,该Android进程里有Android的ART虚拟机;或者说,移动终端运行第一应用APK中的classes.dex文件;在方舟编译模式下(也可以称作maple编译模式),应用启动并加载到方舟进程中,该方舟进程里有方舟的runtime;或者说,移动终端运行第一应用APK中的经方舟编译器编译后生成的maple.so文件。第一应用,可以是当前正在运行的应用,或者将要运行的应用(例如用户将要打开的应用)。The compilation mode can be Android compilation mode or Ark compilation mode. The first compilation mode may be one of these two compilation modes. Among them, in the Android compilation mode, the application is started and loaded into the Android process, which contains the Android ART virtual machine; in other words, the mobile terminal runs the classes.dex file in the first application APK; in the Ark compilation mode (It can also be called maple compilation mode), the application is started and loaded into the Ark process, the Ark process has the Ark runtime; in other words, the mobile terminal runs the maple generated by the Ark compiler in the first application APK. so file. The first application may be an application currently running or an application to be run (for example, an application to be opened by the user).
302、当满足第一切换条件时,以第二编译模式运行所述第一应用。302. When the first switching condition is met, run the first application in a second compilation mode.
第二编译模式,是不同于第一编译模式的另一种编译模式。例如,当第一编译模式是Android编译模式时,第二编译模式是方舟编译模式。又例如,当第一编译模式是方舟编译模式时,第二编译模式是Android编译模式。The second compilation mode is another compilation mode different from the first compilation mode. For example, when the first compilation mode is the Android compilation mode, the second compilation mode is the Ark compilation mode. For another example, when the first compilation mode is the Ark compilation mode, the second compilation mode is the Android compilation mode.
当满足第一切换条件时,可以是移动终端收到用户手动切换编译模式的指令,也可以是移动终端收到系统自动切换第一应用的编译模式的指令。手动切换编译模式的指令,可以是用户在第一应用运行过程中手动切换编译模式,也可以在打开第一应用之前切换编译模式。具体的,用户可以在第一应用的设置选项,或者移动终端系统的设置选项中进行切换。切换的方式不做限制,例如可以通过点击屏幕上的按钮,按下手机的按键(或者按键的组合),使用手势指令,使用语音指令,晃动手机,翻转手机等等。自动切换编译模式的指令,可以由用户事先设置然后触发,也可以在移动终端出厂时自动设置并触发,也可以在移动终端运行过程中接受服务器侧的设置而触发,还可以是第一应用默认的设置而触发。When the first switching condition is met, it may be that the mobile terminal receives an instruction for the user to manually switch the compilation mode, or it may be that the mobile terminal receives an instruction for the system to automatically switch the compilation mode of the first application. The instruction for manually switching the compilation mode may be that the user manually switches the compilation mode during the running of the first application, or may switch the compilation mode before opening the first application. Specifically, the user can switch between the setting options of the first application or the setting options of the mobile terminal system. There is no restriction on the way of switching. For example, you can click a button on the screen, press a button of the phone (or a combination of buttons), use gesture commands, use voice commands, shake the phone, flip the phone, and so on. The command to automatically switch the compilation mode can be set and triggered by the user in advance, or it can be automatically set and triggered when the mobile terminal leaves the factory, or it can be triggered by accepting the settings on the server side during the operation of the mobile terminal, or it can be the first application default Set to trigger.
作为不完全举例,“当满足第一切换条件时”具体可以是:所述第一应用崩溃次数达到第一阈值;或者,当前系统内存占用超过某个阈值;或者,第一应用的内存占用超过了某个阈值;或者,第一应用页面响应速度低于某个阈值;或者,第一应用以第一编译模式运行的时间已经超过某个时间阈值;或者,用户的位置信息(如GPS信息),和/或时区信息,和/或运营商PLMN号发生了变化;或者,第二编译模式的编译器性能优于第一编译模式的编译器性能;或者,根据移动终端的硬件能力(CPU,或存储容量,或GPU,或磁盘读写速度,或屏 幕分辨率,或屏幕尺寸等)切换;或者,根据移动终端的操作系统版本切换;或者,当前移动终端的系统时间处于预设时间段内;等等。As an incomplete example, "when the first switching condition is met" may specifically be: the number of times the first application crashes reaches the first threshold; or, the current system memory usage exceeds a certain threshold; or, the memory usage of the first application exceeds A certain threshold; or, the response speed of the first application page is lower than a certain threshold; or, the time the first application has been running in the first compilation mode has exceeded a certain time threshold; or, the user’s location information (such as GPS information) , And/or time zone information, and/or the operator’s PLMN number has changed; or, the performance of the compiler in the second compilation mode is better than that in the first compilation mode; or, according to the hardware capabilities of the mobile terminal (CPU, Or storage capacity, or GPU, or disk read and write speed, or screen resolution, or screen size, etc.) switch; or switch according to the operating system version of the mobile terminal; or, the current mobile terminal system time is within a preset time period ;and many more.
图4示出了一个切换编译模式的例子。传统的Android应用在崩溃后,系统会弹出对话框提示用户该应用遇到了异常,没有其他有效的修复方式。利用方舟应用的可切换性,可以在应用崩溃后切换编译模式来运行,从而恢复应用正常运行,获得更好的用户体验。具体步骤如下:Figure 4 shows an example of switching the compilation mode. After a traditional Android application crashes, the system will pop up a dialog box to remind the user that the application has encountered an exception, and there is no other effective way to fix it. Using the switchability of the Ark application, you can switch the compilation mode to run after the application crashes, so as to restore the normal operation of the application and obtain a better user experience. Specific steps are as follows:
401,以第一编译模式运行第一应用。401. Run a first application in a first compilation mode.
402、当满足第一切换条件时,以第二编译模式运行所述第一应用,其中,所述第一切换条件为:所述第一应用崩溃次数达到第一阈值。402. When the first switching condition is met, run the first application in a second compilation mode, where the first switching condition is: the number of times the first application crashes reaches a first threshold.
当该第一应用发生连续崩溃(frequently crash),例如在1分钟内崩溃或者闪退达到2次,就认为满足了第一切换条件。可以理解的是,这里的第一阈值表示一定时间周期内该第一应用崩溃的次数,第一阈值可以灵活设置,比如1分钟内崩溃2次,或者5分钟内崩溃3次,等等。在满足第一切换条件后,操作系统会检测并记录到该连续崩溃的状况,并将该应用设置为切换状态。然后,该应用在重新启动时,操作系统会对已设置为切换状态的该应用进行切换运行,例如从第一编译模式切换到第二编译模式运行。When the first application crashes frequently, for example, it crashes or crashes twice within 1 minute, it is considered that the first switching condition is satisfied. It is understandable that the first threshold here represents the number of times the first application crashes in a certain period of time, and the first threshold can be flexibly set, such as 2 crashes within 1 minute, or 3 crashes within 5 minutes, and so on. After the first switching condition is met, the operating system will detect and record the continuous crash, and set the application to the switching state. Then, when the application is restarted, the operating system will switch and run the application that has been set to the switch state, for example, switch from the first compilation mode to the second compilation mode to run.
例如,如果第一编译模式是方舟编译模式,当第一应用以方舟编译模式运行时在一定时间周期内发生崩溃的次数达到了第一阈值,则认为满足了第一切换条件。操作系统可以检测并记录崩溃次数情况,并将该第一应用设置为切换状态。具体的,可以将该切换状态记录到APK文件中,例如添加到disable-maplePkgs.xml中。然后,在该第一应用重新启动时,操作系统会检测到该第一应用已被设置为切换状态,从而切换到第二编译模式运行,例如以Android编译模式启动该第一应用。以Android编译模式启动该第一应用的具体实现是公知的,例如可以通过zygote进程创建一个虚拟机实例来创建新进程,从而以Android编译模式启动该第一应用。以上切换步骤可以在用户无感知的情况下进行(例如在后台切换而不弹出提示消息),避免应用崩溃后一直无法修复带来的糟糕的用户体验。通过以上步骤,当第一应用以方舟编译模式运行发生连续崩溃后,该第一应用可以切换成Android编译模式正常运行,从而获得了更好的用户体验。由于在步骤402中,第一应用切换编译模式前发生了连续崩溃,切换编译模式后可以正常运行,所以步骤402的“切换”有时候也可以称作“逃生”。For example, if the first compilation mode is the Ark compilation mode, when the first application is running in the Ark compilation mode, the number of crashes in a certain period of time reaches the first threshold, it is considered that the first switching condition is satisfied. The operating system can detect and record the number of crashes, and set the first application to a switching state. Specifically, the switching state can be recorded in the APK file, for example, added to disable-maplePkgs.xml. Then, when the first application is restarted, the operating system will detect that the first application has been set to the switching state, and thus switch to the second compilation mode to run, for example, start the first application in the Android compilation mode. The specific implementation of starting the first application in the Android compilation mode is well known. For example, a virtual machine instance can be created through the zygote process to create a new process, so as to start the first application in the Android compilation mode. The above switching steps can be performed without the user's perception (for example, switching in the background without popping up a prompt message) to avoid a bad user experience that cannot be repaired after the application crashes. Through the above steps, when the first application runs in the Ark compilation mode and continuously crashes, the first application can be switched to the Android compilation mode to run normally, thereby obtaining a better user experience. Since in step 402, the first application continuously crashes before switching the compilation mode, and can run normally after switching the compilation mode, the "switching" in step 402 may sometimes be referred to as "escape".
又例如,如果第一编译模式是Android编译模式,当该第一应用以Android编译模式运行时在一定周期内发生崩溃的次数达到了第一阈值,则认为满足了第一切换条件。操作系统可以检测并记录崩溃次数情况,并将该第一应用设置为切换状态。然后,在该第一应用重新启动时,操作系统会检测到该第一应用已被设置为切换状态,从而切换到第二编译模式运行,例如以方舟编译模式启动该第一应用。以方舟编译模式启动该第一应用时,可以通过mygote进程来创建新进程,从而以方舟编译模式启动该第一应用。以上切换步骤可以在用户无感知的情况下进行(例如在后台切换而不弹出提示消息),避免应用崩溃后一直无法修复带来的糟糕的用户体验。For another example, if the first compilation mode is the Android compilation mode, when the first application runs in the Android compilation mode, the number of crashes in a certain period reaches the first threshold, it is considered that the first switching condition is satisfied. The operating system can detect and record the number of crashes, and set the first application to a switching state. Then, when the first application is restarted, the operating system will detect that the first application has been set to the switching state, and thus switch to the second compilation mode to run, for example, start the first application in the Ark compilation mode. When the first application is started in the Ark compilation mode, a new process can be created through the mygote process, so as to start the first application in the Ark compilation mode. The above switching steps can be performed without the user's perception (for example, switching in the background without popping up a prompt message) to avoid a bad user experience that cannot be repaired after the application crashes.
可选的,在步骤402之后,还可以包括以下步骤403:Optionally, after step 402, the following step 403 may be further included:
403:当满足第二切换条件时,以第一编译模式运行所述第一应用。403: When the second switching condition is met, run the first application in the first compilation mode.
在上述步骤402中,第一应用切换到第二编译模式运行。如果切换后满足第二切换条件,该第一应用还可以再次切换回第一编译模式运行。例如,第二切换条件可以是第一应用以第二编译模式运行后的崩溃次数大于第一阈值,此时意味着步骤402切换为第二编译模式后,应用崩溃情况比以第一编译模式运行时还要严重,崩溃次数超过了第一阈值。从而说明步骤 402切换后应用运行情况反而恶化了,还不如切换回第一编译模式来运行。类似于步骤402,步骤403的切换也可以在用户无感知的情况下进行。可选的,第二切换条件还可以是检测到第一应用在第一编译模式下的崩溃漏洞已被修复,此时使用第一编译模式已经可以使得第一应用以较好的状况运行,则可以切换回第一编译模式。可以理解的是,第二切换条件还可以是移动终端收到用户或者系统设置的其他切换指令。In the above step 402, the first application switches to the second compilation mode to run. If the second switching condition is met after the switching, the first application can also switch back to the first compilation mode to run. For example, the second switching condition may be that the number of crashes of the first application after running in the second compilation mode is greater than the first threshold, which means that after the step 402 is switched to the second compilation mode, the crash of the application is less than when running in the first compilation mode Even worse, the number of crashes exceeded the first threshold. This shows that the application running condition deteriorated after the switch in step 402, and it is better to switch back to the first compilation mode to run. Similar to step 402, the handover of step 403 can also be performed without the user's perception. Optionally, the second switching condition may also be detecting that the crash vulnerability of the first application in the first compilation mode has been repaired. At this time, using the first compilation mode can make the first application run in a better condition, then You can switch back to the first compilation mode. It is understandable that the second switching condition may also be that the mobile terminal receives other switching instructions set by the user or the system.
图5是一种可能的第一应用在方舟编译模式下崩溃后切换到Android编译模式的流程示意图。在上述步骤402中,如果第一编译模式是方舟编译模式,当满足了第一切换条件,则以Android编译模式启动该第一应用。在现有的应用崩溃重启时,操作系统会执行APK扫描(APK scan),然后设备启动(device booting),然后应用启动(App start),然后运行zygote进程创建新进程来启动该第一应用(zygote fork)。Figure 5 is a schematic flow diagram of a possible first application to switch to Android compilation mode after crashing in Ark compilation mode. In the above step 402, if the first compilation mode is the Ark compilation mode, when the first switching condition is met, the first application is started in the Android compilation mode. When an existing application crashes and restarts, the operating system will perform APK scan, then device booting, then application start, and then run the zygote process to create a new process to start the first application ( zygote fork).
在图5中,当第一应用发生了连续崩溃(frequently crash)(501),则操作系统会把崩溃情况记录在disable-maplePkgs.xml文件中(502)。然后在应用崩溃重启时,操作系统执行APK扫描(APK scan)会读取该disable-maplePkgs.xml文件(503),然后设备启动(device booting)(504),然后应用启动(App start)(505)。应用启动时会检查是否是方舟编译模式(即maple编译模式)(506),如果是,则检查方舟编译模式是否被禁用(disabled)(507);如果否,则以Android编译模式启动,即用zygote进程创建新进程来启动该第一应用(zygote fork)(508).在507步骤检查方舟编译模式是否被禁用,如果是(被禁用),则仍然使用Android编译模式启动,执行步骤508;如果否(没有被禁用),则以方舟编译模式启动该第一应用,即用mygote进程来启动该第一应用(mygote fork)(509)。In FIG. 5, when the first application crashes frequently (501), the operating system will record the crash in the disable-maplePkgs.xml file (502). Then when the application crashes and restarts, the operating system executes APK scan (APK scan) to read the disable-maplePkgs.xml file (503), then the device starts (device booting) (504), and then the application starts (App start) (505) ). When the application starts, it will check whether it is in Ark compilation mode (ie maple compilation mode) (506), if it is, check whether the Ark compilation mode is disabled (507); if not, start in Android compilation mode, that is, use The zygote process creates a new process to start the first application (zygote fork) (508). In step 507, it is checked whether the Ark compilation mode is disabled. If it is (disabled), the Android compilation mode is still used to start, and step 508 is executed; if If no (not disabled), start the first application in Ark compilation mode, that is, use the mygote process to start the first application (mygote fork) (509).
以上是单个应用切换编译模式的例子,在系统实际运行过程中,可能会遇到多个应用需要切换编译模式的情况。注意,此处所说的多个可以是两个,也可以是多于两个的情况。例如,当多个应用之间存在关联关系时(这些应用相互之间可以称为关联应用),一个应用的编译模式切换可能会导致其他关联应用的编译模式切换。The above is an example of switching the compilation mode of a single application. In the actual operation of the system, there may be situations where multiple applications need to switch the compilation mode. Note that the number mentioned here can be two or more than two. For example, when there is an association relationship between multiple applications (these applications may be referred to as associated applications with each other), the compilation mode switching of one application may cause the compilation mode switching of other associated applications.
图6A,图6B,图6C,图6D,图6E是关联应用的5个例子。这5个例子中有些是方舟应用运行在方舟进程中,可以理解的是,Android应用运行在Android进程中也可以有类似的实现,反之亦然。在图6A中,多个应用一起运行在同一个进程(process)中,例如,方舟应用A(包名:com.package.a)和方舟应用B(包名:com.package.b)共享运行在一个方舟进程1(process1)中。在图6B中,一个应用可以运行在多个进程中,例如方舟应用A(包名:com.package.a)启动了方舟进程1(process1),而方舟应用B(包名:com.package.b)同时运行在方舟进程1(process1)和方舟进程2(process2)中。图6C是图6B的一个变种,图6C中,有方舟应用A(包名:com.package.a)启动了方舟进程1(process1),方舟应用B(包名:com.package.b)运行在方舟进程2(process2),方舟应用C(包名:com.package.c)同时运行在方舟进程1(process1)和方舟进程2(process2)中。图6D是一个应用分别运行在Android进程和方舟进程中,例如Android应用A(包名:com.package.a)启动了Android进程(process1),方舟应用B(包名:com.package.b)同时运行在Android进程(process1)和方舟进程(process2)中。可以理解的是,图6D中方舟应用B同时运行在Android进程process1和方舟进程process2中时,分别运行Android编译模式下的classes.dex文件和方舟编译模式下的maple.so文件。图6E是图6D的一个变种,例如在图6E中,Android应用A(包名:com.package.a)启动了Android进程(process1),方舟应用B(包名:com.package.b)运行在方舟进程中(process2),方舟应用C(包名:com.package.c)同时运行在Android进程(process1)和方舟进程(process2)中。Fig. 6A, Fig. 6B, Fig. 6C, Fig. 6D, Fig. 6E are five examples of related applications. Some of these 5 examples are that the Ark application runs in the Ark process. It is understandable that the Android application can also have a similar implementation when running in the Android process, and vice versa. In Figure 6A, multiple applications run together in the same process, for example, Ark Application A (package name: com.package.a) and Ark Application B (package name: com.package.b) run in common In an Ark process 1 (process1). In Figure 6B, an application can run in multiple processes. For example, Ark application A (package name: com.package.a) starts Ark process 1 (process1), and Ark application B (package name: com.package. b) Simultaneously run in Ark process 1 (process1) and Ark process 2 (process2). Figure 6C is a variant of Figure 6B. In Figure 6C, Ark application A (package name: com.package.a) starts Ark process 1 (process1), and Ark application B (package name: com.package.b) runs In the Ark process 2 (process2), the Ark application C (package name: com.package.c) runs in the Ark process 1 (process1) and the Ark process 2 (process2) at the same time. Figure 6D shows an application running in the Android process and the Ark process respectively. For example, Android application A (package name: com.package.a) starts the Android process (process1), and Ark application B (package name: com.package.b) Run in both the Android process (process1) and the Ark process (process2) at the same time. It is understandable that when the Ark application B in Figure 6D runs in the Android process process1 and the Ark process process2 at the same time, it runs the classes.dex file in the Android compilation mode and the maple.so file in the Ark compilation mode, respectively. Figure 6E is a variant of Figure 6D. For example, in Figure 6E, Android application A (package name: com.package.a) starts the Android process (process1), and Ark application B (package name: com.package.b) runs In the Ark process (process2), the Ark application C (package name: com.package.c) runs in both the Android process (process1) and the Ark process (process2).
图7示出了多个应用同进程的情况下切换编译模式的步骤,包括:Figure 7 shows the steps for switching the compilation mode when multiple applications are in the same process, including:
701:在第一应用的进程启动时,创建第一列表记录所述进程中的所有应用。701: When the process of the first application is started, create a first list to record all applications in the process.
例如,当第一应用启动并以第一编译模式运行时,可以在第一应用的进程启动时,创建第一列表记录所述进程中的所有应用。具体的,可以是在应用进程启动时(即应用的Activity组件启动时),Android系统的ActivityManagerService会为每个进程创建ProcessRecord,用于保存进程信息。其中,可以在ProcessRecord中创建pkgList列表(第一列表),该列表可以记录运行在该进程下的所有应用。可以理解的是,“运行在该进程下的所有应用”,可以是指当第一应用启动之后,启动的运行在该进程下的其他应用;在有些情况下,也可以是第一应用启动之前,已经运行在该进程下的其他应用。For example, when the first application starts and runs in the first compilation mode, when the process of the first application starts, a first list can be created to record all applications in the process. Specifically, when the application process starts (that is, when the Activity component of the application starts), the ActivityManagerService of the Android system creates a ProcessRecord for each process to save process information. Among them, a pkgList list (the first list) can be created in ProcessRecord, which can record all applications running under the process. It is understandable that "all applications running under this process" can refer to other applications that are started running under this process after the first application is started; in some cases, it can also be before the first application is started. , Other applications already running under this process.
702:当第一应用切换编译模式时,把所述第一列表中的所有应用设置为切换状态。702: When the first application switches the compilation mode, set all the applications in the first list to the switching state.
当第一应用切换编译模式时(从第一编译模式切换为第二编译模式,例如从Android编译模式切换为方舟编译模式,或者从方舟编译模式切换为Android编译模式),可以遍历该进程下的pkgList列表,把其中记录的所有应用都设置为切换状态。可选的,还可以在设置为切换状态时记录切换方式(即具体是从Android编译模式切换为方舟编译模式,还是从方舟编译模式切换为Android编译模式)。可选的,切换状态和切换方式都可以存储在操作系统文件中。When the first application switches the compilation mode (switches from the first compilation mode to the second compilation mode, for example, switches from the Android compilation mode to the Ark compilation mode, or switches from the Ark compilation mode to the Android compilation mode), you can traverse the process pkgList list, set all applications recorded in it to switch state. Optionally, it is also possible to record the switching mode when it is set to the switching state (that is, specifically switching from the Android compilation mode to the Ark compilation mode, or from the Ark compilation mode to the Android compilation mode). Optionally, both the switching status and the switching mode can be stored in the operating system file.
可选的,步骤702也可以是第一列表记录的其他应用(例如第二应用),当第二应用切换编译模式时,把所述第一列表中的所有应用设置为切换状态。可选的,当该进程中的任一应用切换时,可以把该进程中的所有应用设置为切换状态。可选的,当该进程个的任意几个应用切换时,可以把该进程中的所有应用设置为切换状态。Optionally, step 702 may also be other applications (for example, the second application) recorded in the first list, and when the second application switches the compilation mode, all applications in the first list are set to the switching state. Optionally, when any application in the process switches, all applications in the process can be set to the switching state. Optionally, when any several applications in the process switch, all applications in the process can be set to the switching state.
703:当启动第二应用时,以所述切换状态运行所述第二应用,所述第二应用是所述第一列表记录的所有应用中的一个应用。703: When the second application is started, run the second application in the switching state, where the second application is one of all applications recorded in the first list.
当上述pkgList列表中的某个应用(即所述进程下的所有应用中的某个应用)启动时,可以按照步骤702设置的切换状态(可选的,也可以包括切换方式)来运行这个应用。可以理解的是,703所述的第二应用只是某个应用的例子,也可以是“当启动第一应用时,以所述切换状态运行所述第一应用”。以所述切换状态运行,可以是该应用启动时切换编译模式运行,例如,当步骤701是以Android编译模式运行时,步骤703可以以方舟编译模式运行第二应用。When an application in the pkgList list (that is, an application in all applications under the process) is started, the application can be run according to the switching state (optionally, including switching mode) set in step 702 . It can be understood that the second application described in 703 is only an example of a certain application, and it may also be "when the first application is started, run the first application in the switching state". Running in the switching state may be switching the compilation mode to run when the application is started. For example, when step 701 is running in the Android compilation mode, step 703 may run the second application in the Ark compilation mode.
通过图7中的切换方法,可以实现一个进程下某个应用切换后其他同进程应用连锁切换,从而方便的实现多应用切换编译模式。例如,对于同进程的多个应用,当其中一个应用发生连续崩溃时,系统不仅会设置该应用为切换状态,同时会把同进程的其他应用也设置为切换状态,当其他同进程应用在下次启动时,会根据此切换状态来切换运行。Through the switching method in FIG. 7, it is possible to realize the chain switching of other applications in the same process after a certain application under one process is switched, thereby conveniently realizing the multi-application switching compilation mode. For example, for multiple applications in the same process, when one of the applications crashes continuously, the system will not only set the application to the switching state, but also set other applications in the same process to the switching state. At startup, it will switch operation according to this switching state.
举例来说,如图8所示,应用A的进程启动后,该进程中还运行有同进程应用B和同进程应用C,其中,应用B和应用C晚于应用A启动(对应用B和应用C二者之间的启动顺序不做限制)。当应用A切换编译模式时,同进程的应用B和C也都会自动切换编译模式。例如,当方舟应用A因为连续崩溃而切换到以Android编译模式运行时,晚于方舟应用A启动的同进程方舟应用B和方舟应用C也会自动切换到以Android编译模式运行。又例如,当Android应用A的进程启动后,又启动Android应用B,二者在同一进程下运行;当Android应用A因为自身内存占用超过了某个阈值从而切换为以方舟编译模式运行时,Android应用B也会同步切换到以方舟编译模式运行。For example, as shown in Figure 8, after the process of application A is started, the same process application B and the same process application C are also running in the process. Among them, application B and application C start later than application A (for application B and The startup sequence between the two applications C is not restricted). When application A switches the compilation mode, applications B and C in the same process will also automatically switch the compilation mode. For example, when Ark app A switches to running in Android compilation mode due to continuous crashes, Ark app B and Ark app C in the same process started later than Ark app A will also automatically switch to running in Android compilation mode. For another example, when the process of Android application A is started, Android application B is started, and both run in the same process; when Android application A switches to run in Ark compilation mode because its memory usage exceeds a certain threshold, Android Application B will also switch to run in Ark compilation mode.
在另一些例子中,如图9所示,应用A的进程启动后,该进程中还运行有同进程应用B 和同进程应用C,其中,应用B晚于应用A启动,应用C晚于应用B启动。在一种情况下,当应用B切换编译模式时,早于应用B启动的应用A也会自动切换编译模式,晚于应用B启动的应用C也会自动切换编译模式;在另一种情况下,当应用C切换编译模式时,早于应用C启动应用A和应用B都会自动切换编译模式。又例如,当方舟应用A的进程启动后,该进程中还运行有同进程方舟应用B,当方舟应用B因为连续崩溃而切换到以Android编译模式运行时,早于方舟应用B启动的方舟应用A也会自动切换为以Android编译模式运行。In other examples, as shown in Figure 9, after the process of application A is started, the same process application B and the same process application C are also running in the process, where application B starts later than application A, and application C is later than application B starts. In one case, when application B switches the compilation mode, application A that starts earlier than application B will also automatically switch compilation mode, and application C that starts later than application B will also automatically switch compilation mode; in another case , When the application C switches the compilation mode, both application A and application B will automatically switch the compilation mode before starting application C. For another example, when the process of Ark application A is started, the same process Ark application B is also running in the process. When Ark application B switches to running in Android compilation mode due to continuous crashes, the Ark application started earlier than Ark application B A will also automatically switch to run in Android compilation mode.
以上介绍了同进程的多个应用切换编译模式的例子,还存在另一种情况,即多个应用虽然不是同进程,但存在业务上的依赖关系,这种依赖关系可以在系统中注册或者记录。例如,如图10所示,A应用(也可以称为“依赖应用”)的运行依赖于应用B(也可以称为“被依赖应用”),如果应用B被删除或者改变,可能导致应用A无法启动或者无法正常运行,尽管这两个应用不在同一进程运行。在这种情况下,如果应用B切换编译模式,则可能导致应用A无法启动或者无法正常运行;所以,如果多个应用间存在依赖和被依赖的关系,如果被依赖的应用切换了编译模式,则依赖应用也要随之切换编译模式,从而确保依赖应用能够正常启动和运行。例如,方舟应用A的运行依赖于方舟版本的webview(被依赖应用),当该webview的APK状态发生了变化,例如被卸载、被删除、被损坏、被替换/更新为非方舟版本(例如被更新为Android版本)、切换为以其他编译模式运行等情况,都会导致方舟应用A无法正常启动或者运行。此时,如果该webview切换为Android编译模式,则方舟应用A也要自动/手动切换为以Android编译模式运行,才能正常启动和运行。The above introduces an example of switching the compilation mode of multiple applications in the same process. There is another situation, that is, although multiple applications are not in the same process, they have business dependencies. This dependency can be registered or recorded in the system. . For example, as shown in Figure 10, application A (also called "dependent application") depends on application B (also called "dependent application") to run. If application B is deleted or changed, application A may be Cannot start or can not run normally, even though the two applications are not running in the same process. In this case, if application B switches the compilation mode, it may cause application A to fail to start or fail to run normally; therefore, if there is a dependency and dependent relationship among multiple applications, if the dependent application switches the compilation mode, The dependent application must also switch the compilation mode accordingly to ensure that the dependent application can start and run normally. For example, the running of Ark application A depends on the Ark version of webview (dependent application). When the APK status of the webview changes, such as uninstalled, deleted, damaged, replaced/updated to a non-Ark version (for example, Update to the Android version), switch to other compilation modes, etc., will cause the Ark application A to fail to start or run normally. At this time, if the webview is switched to the Android compilation mode, the Ark application A must also be automatically/manually switched to run in the Android compilation mode to start and run normally.
可选的,上述依赖应用切换编译模式,可以是主动切换的,也可以是被动切换的。举例来说,在依赖应用主动切换的情况下,该依赖应用会主动监听被依赖应用的状态变化(是否被卸载,是否被删除,是否被替换/更新为其他版本,或者是否以其他编译模式运行等),如果被依赖应用状态有变化,则依赖应用会自动进行切换编译模式。例如,被依赖应用和依赖应用开始时都以方舟编译模式运行,后来依赖应用监听到被依赖应用切换为以Android编译模式运行,则该依赖应用会主动随之切换为以Android编译模式运行。又例如,被依赖应用和依赖应用开始时都以方舟编译模式运行,后来依赖应用监听到被依赖应用已被删除或卸载,则该依赖应用会主动切换为以Android编译模式运行。Optionally, the above-mentioned application-dependent switching of the compilation mode may be active or passive. For example, when the dependent application is actively switching, the dependent application will actively monitor the state change of the dependent application (whether it has been uninstalled, whether it has been deleted, whether it has been replaced/updated to another version, or whether it is running in another compilation mode Etc.), if the state of the dependent application changes, the dependent application will automatically switch the compilation mode. For example, both the dependent application and the dependent application run in the Ark compilation mode at the beginning, and later the dependent application monitors that the dependent application is switched to run in the Android compilation mode, and the dependent application will automatically switch to run in the Android compilation mode accordingly. For another example, both the dependent application and the dependent application run in the Ark compilation mode at the beginning, and later the dependent application monitors that the dependent application has been deleted or uninstalled, the dependent application will actively switch to run in the Android compilation mode.
在依赖应用被动切换的情况下,当被依赖应用发生状态变化,由于系统中已经注册了二者的依赖关系,则系统可以自动对依赖应用进行编译模式的切换。例如,应用A是依赖应用,应用B是被依赖应用,系统中已经注册了二者的依赖关系,当应用B发生了状态变化时(例如从方舟编译模式切换为Android编译模式),系统会自动切换应用A的编译模式(例如从方舟编译模式切换为Android编译模式)。具体的,系统可以将应用A标记为切换状态,在应用A启动的时候以该切换状态启动;或者,系统可以通知应用A,使得应用A标记自身为切换状态,在应用A启动的时候以该切换状态启动。In the case of passive switching of dependent applications, when the dependent application undergoes a state change, since the dependency relationship between the two has been registered in the system, the system can automatically switch the compilation mode of the dependent application. For example, application A is a dependent application and application B is a dependent application. The dependency relationship between the two has been registered in the system. When the state of application B changes (such as switching from Ark compilation mode to Android compilation mode), the system will automatically Switch the compilation mode of application A (for example, switch from Ark compilation mode to Android compilation mode). Specifically, the system can mark application A as the switching state, and start it in the switching state when application A is started; or, the system can notify application A so that application A marks itself as the switching state, and when application A is started The switching state starts.
方舟应用通过静态化编译直接将java字节码编译为机器码,因此分别独立编译的maple.so和方舟系统间存在版本的兼容问题。在某些特定场景下,例如开发人员错误编译,可能会出现发布的方舟应用与方舟系统间不兼容的情况。为了解决此类异常问题,图11给出了一种解决方案,包括以下步骤:The Ark application directly compiles java bytecode into machine code through static compilation, so there is a version compatibility problem between the separately compiled maple.so and the Ark system. In some specific scenarios, such as the developer's incorrect compilation, there may be incompatibility between the released Ark application and the Ark system. In order to solve this kind of abnormal problem, Figure 11 shows a solution, including the following steps:
1101:创建方舟应用时,根据该方舟应用的API信息生成第一校验值,并将该第一校验值打包到APK中。1101: When creating the Ark application, generate a first check value according to the API information of the Ark application, and pack the first check value into the APK.
在开发人员创建方舟应用的过程中,可以根据该方舟应用的API(Application Programming Interface,应用程序编程接口)信息,例如编译中使用到的android framework API 的类、成员或方法等信息,抽象成为一组校验值(md5或者其他方式生成校验值),形成第一校验值。该第一校验值可以打包预置到APK中。其中,API是一组定义、程序及协议的集合,是计算机软件之间为了保证互相通信所提供的一系列特殊规则和要求。通过API,应用程序和操作系统之间可以实现通信。In the process of creating the Ark application, the developer can abstract into an Ark based on the API (Application Programming Interface) information of the Ark application, such as the classes, members, or methods of the android framework API used in compilation. The group check value (md5 or other means to generate the check value) forms the first check value. The first check value can be packaged and preset into the APK. Among them, API is a collection of definitions, procedures and protocols, and is a series of special rules and requirements provided by computer software to ensure mutual communication. Through API, communication can be realized between application and operating system.
第一校验值会随着该方舟应用的代码变化而变化。例如,当该方舟应用升级时,会引入新的代码,此时API信息会发生变化,导致抽象出的第一校验值也发生变化。The first check value will change as the code applied by the Ark changes. For example, when the Ark application is upgraded, new code will be introduced, and the API information will change at this time, resulting in a change in the abstracted first check value.
1102:将方舟系统提供的API信息生成第二校验值,并将该第二校验值打包到方舟系统中。1102: Generate a second check value from the API information provided by the Ark system, and package the second check value into the Ark system.
将方舟系统对外提供的API信息,例如对外提供的android framework层API类、成员或方法等信息,抽象成为一组校验值(md5或者其他方式生成校验值),形成第二校验值。该第二校验值生成的方法与步骤1101中第一校验值生成的方法相同。并将该第二校验值打包预置到方舟系统中。The API information provided by the Ark system externally, such as the information provided externally on the android framework layer API classes, members, or methods, is abstracted into a set of check values (md5 or other methods to generate check values) to form a second check value. The method for generating the second check value is the same as the method for generating the first check value in step 1101. And pack the second check value and preset it into the Ark system.
第二校验值会随着该方舟系统的代码变化而变化。例如,当该方舟系统版本更新时,会引入新的代码,此时API信息会发生变化,导致抽象出的第二校验值也发生变化。一般来说,方舟应用API的第一校验值是方舟系统API的第二校验值的子集。The second check value will change as the code of the Ark system changes. For example, when the version of the Ark system is updated, new codes will be introduced. At this time, the API information will change, causing the abstracted second check value to also change. Generally speaking, the first check value of the Ark application API is a subset of the second check value of the Ark system API.
1103:当该方舟应用状态改变时,方舟系统比对第一校验值和第二校验值。1103: When the Ark application status changes, the Ark system compares the first check value with the second check value.
状态改变,可以是安装、更新、OTA(over the air,空中下载)升级、打补丁等;方舟应用的状态改变可以引起第一校验值的变化。当该方舟应用发生状态改变时,方舟系统会比对上述第一校验值和第二校验值,确定第一校验值是否是第二校验值的子集。The status change can be installation, update, OTA (over the air) upgrade, patching, etc.; the status change of the Ark application can cause a change in the first check value. When the state of the Ark application changes, the Ark system will compare the first check value with the second check value to determine whether the first check value is a subset of the second check value.
1104:根据该比对结果,切换方舟应用的编译模式。1104: Switch the compilation mode of the Ark application according to the comparison result.
如果第一校验值是第二校验值的子集,则不必切换该方舟应用的编译模式,即仍然保持方舟编译模式运行。如果第一校验值不是第二校验值的子集,说明可能存在版本的兼容性问题(例如方舟应用版本和方舟系统版本不兼容),则切换该方舟应用的编译模式,即切换为Android编译模式。If the first check value is a subset of the second check value, there is no need to switch the compilation mode of the Ark application, that is, the Ark compilation mode is still running. If the first check value is not a subset of the second check value, indicating that there may be version compatibility issues (for example, the Ark app version and the Ark system version are not compatible), switch the compilation mode of the Ark app, that is, switch to Android Compile mode.
可以理解的是,生成校验值的方法可以有多种,上述使用API信息生成校验值只是其中一个例子。其他生成校验值的方法包括但不限于:使用代码生成的库文件生成校验值,使用代码生成的库文件中的某一个代码段生成校验码,使用代码中的类生成校验值,使用类中的方法生成校验值,或使用类中的接口生成校验值,等等。It is understandable that there may be multiple methods for generating the check value, and the above-mentioned using API information to generate the check value is just one example. Other methods of generating check values include, but are not limited to: using code-generated library files to generate check values, using a code segment in the code-generated library files to generate check codes, and using classes in the code to generate check values. Use the method in the class to generate the check value, or use the interface in the class to generate the check value, and so on.
使用图11中所示的方法,可以在应用不兼容的情况下切换编译模式,从而解决方舟应用和方舟系统不兼容的问题。Using the method shown in Figure 11, the compilation mode can be switched when the application is incompatible, thereby solving the problem of incompatibility between the Ark application and the Ark system.
另外,本申请还提供一种应用切换运行的方法,包括:In addition, this application also provides a method for application switching operation, including:
1.一种应用切换运行的方法,其特征在于,所述方法包括:1. A method for application switching operation, characterized in that the method comprises:
以第一编译模式运行第一应用;Run the first application in the first compilation mode;
当满足第一切换条件时,以第二编译模式运行所述第一应用。When the first switching condition is met, the first application is run in the second compilation mode.
2.根据1所述的方法,其特征在于,所述第一应用是以BOTH形态打包的方舟应用。2. The method according to 1, wherein the first application is an Ark application packaged in BOTH form.
3.根据1或2所述的方法,其特征在于,所述第一切换条件为以下条件的至少一种:3. The method according to 1 or 2, characterized in that the first handover condition is at least one of the following conditions:
所述第一应用的崩溃次数达到第一阈值;或The number of crashes of the first application reaches a first threshold; or
当前系统内存占用超过第二阈值;或The current system memory usage exceeds the second threshold; or
所述第一应用的内存占用超过第三阈值;或The memory occupation of the first application exceeds a third threshold; or
所述第一应用的页面响应速度低于第四阈值;或The page response speed of the first application is lower than the fourth threshold; or
所述第一应用以所述第一编译模式运行时间超过第五阈值;或The running time of the first application in the first compilation mode exceeds a fifth threshold; or
用户的位置信息发生改变;或The user’s location information changes; or
所述第二编译模式的编译器性能优于所述第一编译模式的编译器性能;或The performance of the compiler in the second compilation mode is better than the performance of the compiler in the first compilation mode; or
当前系统时间处于预设时间段内。The current system time is within the preset time period.
4.根据1-3所述的方法,其特征在于,当所述第一切换条件为所述第一应用的崩溃次数达到第一阈值时,所述方法还包括:4. The method according to 1-3, characterized in that, when the first switching condition is that the number of crashes of the first application reaches a first threshold, the method further includes:
记录所述第一应用的崩溃次数,将所述第一应用设置为切换状态;Record the number of times the first application crashes, and set the first application to a switching state;
在所述第一应用重新启动时,检测所述第一应用是否是切换状态;When the first application is restarted, detecting whether the first application is in a switching state;
如果所述第一应用是切换状态,则以所述第二编译模式运行所述第一应用。If the first application is in the switching state, run the first application in the second compilation mode.
5.根据1-4所述的方法,其特征在于,所述方法还包括:5. The method according to 1-4, characterized in that the method further comprises:
当满足第二切换条件时,以所述第一编译模式运行所述第一应用。When the second switching condition is met, the first application is run in the first compilation mode.
6.根据5所述的方法,其特征在于,所述第二切换条件为:6. The method according to 5, wherein the second handover condition is:
所述第一应用以所述第二编译模式运行后的崩溃次数大于所述第一阈值。The number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
7.根据5所述的方法,其特征在于,所述第二切换条件为:7. The method according to 5, characterized in that the second handover condition is:
检测到所述第一应用在所述第一编译模式下的崩溃漏洞被修复。It is detected that the crash vulnerability of the first application in the first compilation mode is repaired.
8.根据1-7所述的方法,其特征在于,所述第一应用运行的进程下还包括第二应用,所述方法还包括:8. The method according to 1-7, wherein the process in which the first application is running further includes a second application, and the method further includes:
当以所述第二编译模式运行所述第一应用时,切换所述第二应用的编译模式为所述第二编译模式。When running the first application in the second compilation mode, switch the compilation mode of the second application to the second compilation mode.
9.根据8所述的方法,其特征在于,所述第二应用的启动时间早于所述第一应用的启动时间。9. The method according to 8, wherein the start time of the second application is earlier than the start time of the first application.
10.根据8所述的方法,其特征在于,所述第二应用的启动时间晚于所述第一应用的启动时间。10. The method according to 8, wherein the start time of the second application is later than the start time of the first application.
11.根据1所述的方法,其特征在于,所述第一应用的运行依赖于第三应用,所述第一切换条件为:11. The method according to 1, wherein the operation of the first application depends on a third application, and the first switching condition is:
所述第三应用的APK状态发生变化。The APK status of the third application changes.
12.根据1所述的方法,其特征在于,所述第一应用的运行依赖于第三应用,所述第一切换条件为:12. The method according to 1, wherein the operation of the first application depends on a third application, and the first switching condition is:
所述第三应用切换为以所述第二编译模式运行。The third application is switched to run in the second compilation mode.
13.根据1所述的方法,其特征在于,所述方法还包括:13. The method according to 1, wherein the method further comprises:
在创建所述第一应用时,根据所述第一应用的API信息生成第一校验值;When creating the first application, generate a first check value according to the API information of the first application;
将所述第一校验值打包到所述第一应用的APK中;Packing the first check value into the APK of the first application;
将操作系统提供的API信息生成第二校验值,将所述第二校验值打包到所述操作系统中;Generate a second check value from API information provided by the operating system, and package the second check value into the operating system;
当所述第一应用的状态改变时,比对所述第一校验值和所述第二校验值;When the state of the first application changes, compare the first check value with the second check value;
根据比对结果,切换所述第一应用的编译模式。According to the comparison result, the compilation mode of the first application is switched.
14.根据13所述的方法,其特征在于,所述比对所述第一校验值和所述第二校验值为:检测所述第一校验值是否为所述第二校验值的子集;14. The method according to 13, wherein the comparing the first check value with the second check value is: detecting whether the first check value is the second check value A subset of values;
所述根据比对结果,切换所述第一应用的编译模式,具体为:如果所述第一校验值不是所述第二校验值的子集,则切换所述第一应用的编译模式。The switching the coding mode of the first application according to the comparison result is specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application .
15.根据1-14所述的方法,其特征在于:15. The method according to 1-14, characterized in that:
所述第一编译模式为Android编译模式,所述第二编译模式为方舟编译模式;或者,The first compilation mode is the Android compilation mode, and the second compilation mode is the Ark compilation mode; or,
所述第一编译模式为方舟编译模式,所述第二编译模式为Android编译模式。The first compilation mode is the Ark compilation mode, and the second compilation mode is the Android compilation mode.
另外,本申请还提供一种电子设备,包括第一编译模块,第二编译模块,切换模块,其中:所述第一编译模块,用于以第一编译模式运行第一应用;所述切换模块,用于确定当满足第一切换条件时,使得所述第一应用从所述第一编译模式切换为第二编译模式运行;所述第二编译模块,用于以所述第二编译模式运行所述第一应用。In addition, the present application also provides an electronic device, including a first compilation module, a second compilation module, and a switching module, wherein: the first compilation module is configured to run a first application in a first compilation mode; the switching module , Used to determine when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode to run; the second compilation module is used to run in the second compilation mode The first application.
其中,所述第一应用是以BOTH形态打包的方舟应用。Wherein, the first application is an Ark application packaged in BOTH form.
其中,所述第一切换条件为以下条件的至少一种:Wherein, the first switching condition is at least one of the following conditions:
所述第一应用的崩溃次数达到第一阈值;或The number of crashes of the first application reaches a first threshold; or
当前系统内存占用超过第二阈值;或The current system memory usage exceeds the second threshold; or
所述第一应用的内存占用超过第三阈值;或The memory occupation of the first application exceeds a third threshold; or
所述第一应用的页面响应速度低于第四阈值;或The page response speed of the first application is lower than the fourth threshold; or
所述第一应用以所述第一编译模式运行时间超过第五阈值;或The running time of the first application in the first compilation mode exceeds a fifth threshold; or
用户的位置信息发生改变;或The user’s location information changes; or
所述第二编译模块的性能优于所述第一编译模块的性能;或The performance of the second compilation module is better than the performance of the first compilation module; or
当前系统时间处于预设时间段内。The current system time is within the preset time period.
其中,所述电子设备还包括崩溃记录模块,重启检测模块,其中,所述第一切换条件为所述第一应用的崩溃次数达到第一阈值,所述崩溃记录模块,用于记录所述第一应用的崩溃次数,将所述第一应用设置为切换状态;所述重启检测模块,用于在所述第一应用重新启动时,检测所述第一应用是否是切换状态;所述第二编译模块,用于确定当所述第一应用是切换状态,则以所述第二编译模式运行所述第一应用。Wherein, the electronic device further includes a crash recording module and a restart detection module, wherein the first switching condition is that the number of crashes of the first application reaches a first threshold, and the crash recording module is configured to record the first The number of crashes of an application, the first application is set to the switching state; the restart detection module is configured to detect whether the first application is in the switching state when the first application is restarted; the second The compiling module is configured to determine that when the first application is in a switching state, run the first application in the second compiling mode.
其中,所述第一编译模块还用于:当满足第二切换条件时,以所述第一编译模式运行所述第一应用。Wherein, the first compilation module is further configured to: when a second switching condition is met, run the first application in the first compilation mode.
其中,所述第二切换条件为:所述第一应用以所述第二编译模式运行后的崩溃次数大于所述第一阈值。Wherein, the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
其中,所述第二切换条件还可以为:检测到所述第一应用在所述第一编译模式下的崩溃漏洞被修复。Wherein, the second switching condition may also be: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
其中,所述第一应用运行的进程下还包括第二应用,所述切换模块,用于当以所述第二编译模式运行所述第一应用时,切换所述第二应用的编译模式为所述第二编译模式。Wherein, the process in which the first application runs further includes a second application, and the switching module is configured to switch the compilation mode of the second application when the first application is run in the second compilation mode. The second compilation mode.
其中,所述第二应用的启动时间早于所述第一应用的启动时间。Wherein, the start time of the second application is earlier than the start time of the first application.
其中,所述第二应用的启动时间晚于所述第一应用的启动时间。Wherein, the start time of the second application is later than the start time of the first application.
其中,所述第一应用的运行依赖于第三应用,所述第一切换条件可以为:所述第三应用的APK状态发生变化。Wherein, the operation of the first application depends on the third application, and the first switching condition may be: the APK status of the third application changes.
其中,所述第一应用的运行依赖于第三应用,所述第一切换条件也可以为:所述第三应用切换为以所述第二编译模式运行。Wherein, the operation of the first application depends on the third application, and the first switching condition may also be: the third application is switched to run in the second compilation mode.
其中,所述电子设备还包括第一校验码生成模块,第二校验码生成模块,比对模块,所述第一校验码生成模块,用于在创建所述第一应用时,根据所述第一应用的API信息生成第一校验值,所述将所述第一校验值打包到所述第一应用的APK中;所述第二校验码生成模块,用于将操作系统提供的API信息生成第二校验值,将所述第二校验值打包到所述操作系统中;所述比对模块,用于当所述第一应用的状态改变时,比对所述第一校验值和所述第二校验值;所述切换模块,用于根据比对结果,切换所述第一应用的编译模式。Wherein, the electronic device further includes a first check code generation module, a second check code generation module, a comparison module, and the first check code generation module is used to create the first application according to The API information of the first application generates a first check value, and the first check value is packaged into the APK of the first application; the second check code generation module is configured to operate The API information provided by the system generates a second check value, and packs the second check value into the operating system; the comparison module is used to compare all the data when the state of the first application changes. The first check value and the second check value; the switching module is configured to switch the compilation mode of the first application according to the comparison result.
其中,所述比对所述第一校验值和所述第二校验值为:检测所述第一校验值是否为所述第二校验值的子集;所述根据比对结果,切换所述第一应用的编译模式,具体为:如果所述 第一校验值不是所述第二校验值的子集,则切换所述第一应用的编译模式。Wherein, the comparison of the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
其中,所述第一编译模块为Android编译模块,所述第二编译模块为方舟编译模块;或者,所述第一编译模块为方舟编译模块,所述第二编译模块为Android编译模块。Wherein, the first compilation module is an Android compilation module, and the second compilation module is an Ark compilation module; or, the first compilation module is an Ark compilation module, and the second compilation module is an Android compilation module.
本申请还提供一种电子设备,包括第一编译器,第二编译器,处理器,所述第一编译器被配置为,以第一编译模式运行第一应用;所述处理器被配置为,确定当满足第一切换条件时,使得所述第一应用从所述第一编译模式切换为第二编译模式运行;所述第二编译器被配置为,以所述第二编译模式运行所述第一应用。The present application also provides an electronic device, including a first compiler, a second compiler, and a processor, the first compiler is configured to run a first application in a first compilation mode; the processor is configured to , It is determined that when the first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode; the second compiler is configured to run in the second compilation mode The first application.
其中,所述第一应用是以BOTH形态打包的方舟应用。Wherein, the first application is an Ark application packaged in BOTH form.
其中,所述第一切换条件为以下条件的至少一种:Wherein, the first switching condition is at least one of the following conditions:
所述第一应用的崩溃次数达到第一阈值;或The number of crashes of the first application reaches a first threshold; or
当前系统内存占用超过第二阈值;或The current system memory usage exceeds the second threshold; or
所述第一应用的内存占用超过第三阈值;或The memory occupation of the first application exceeds a third threshold; or
所述第一应用的页面响应速度低于第四阈值;或The page response speed of the first application is lower than the fourth threshold; or
所述第一应用以所述第一编译模式运行时间超过第五阈值;或The running time of the first application in the first compilation mode exceeds a fifth threshold; or
用户的位置信息发生改变;或The user’s location information changes; or
所述第二编译器的性能优于所述第一编译器的性能;或The performance of the second compiler is better than the performance of the first compiler; or
当前系统时间处于预设时间段内。The current system time is within the preset time period.
其中,当所述第一切换条件为所述第一应用的崩溃次数达到第一阈值时,所述处理器还用于:记录所述第一应用的崩溃次数,将所述第一应用设置为切换状态;Wherein, when the first switching condition is that the number of crashes of the first application reaches a first threshold, the processor is further configured to: record the number of crashes of the first application, and set the first application to Switch state
在所述第一应用重新启动时,检测所述第一应用是否是切换状态;When the first application is restarted, detecting whether the first application is in a switching state;
如果所述第一应用是切换状态,则以所述第二编译模式运行所述第一应用。If the first application is in the switching state, run the first application in the second compilation mode.
其中,所述第一编译器还用于:当满足第二切换条件时,以所述第一编译模式运行所述第一应用。Wherein, the first compiler is further configured to: when a second switching condition is met, run the first application in the first compilation mode.
其中,所述第二切换条件为:所述第一应用以所述第二编译模式运行后的崩溃次数大于所述第一阈值。Wherein, the second switching condition is: the number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
其中,所述第二切换条件还可以为:检测到所述第一应用在所述第一编译模式下的崩溃漏洞被修复。Wherein, the second switching condition may also be: detecting that the crash vulnerability of the first application in the first compilation mode is repaired.
其中,所述第一应用运行的进程下还包括第二应用,所述处理器用于:当以所述第二编译模式运行所述第一应用时,切换所述第二应用的编译模式为所述第二编译模式。Wherein, the running process of the first application further includes a second application, and the processor is configured to: when the first application is run in the second compilation mode, switch the compilation mode of the second application to The second compilation mode is described.
其中,所述第二应用的启动时间早于所述第一应用的启动时间。Wherein, the start time of the second application is earlier than the start time of the first application.
其中,所述第二应用的启动时间晚于所述第一应用的启动时间。Wherein, the start time of the second application is later than the start time of the first application.
其中,所述第一应用的运行依赖于第三应用,所述第一切换条件可以为:所述第三应用的APK状态发生变化。Wherein, the operation of the first application depends on the third application, and the first switching condition may be: the APK status of the third application changes.
其中,所述第一应用的运行依赖于第三应用,所述第一切换条件也可以为:所述第三应用切换为以所述第二编译模式运行。Wherein, the operation of the first application depends on the third application, and the first switching condition may also be: the third application is switched to run in the second compilation mode.
其中,所述处理器还用于:在创建所述第一应用时,根据所述第一应用的API信息生成第一校验值;将所述第一校验值打包到所述第一应用的APK中;将操作系统提供的API信息生成第二校验值,将所述第二校验值打包到所述操作系统中;当所述第一应用的状态改变时,比对所述第一校验值和所述第二校验值;根据比对结果,切换所述第一应用的编译模式。Wherein, the processor is further configured to: when creating the first application, generate a first check value according to the API information of the first application; and pack the first check value into the first application APK; generate a second check value from the API information provided by the operating system, and pack the second check value into the operating system; when the state of the first application changes, compare the first A check value and the second check value; switch the compilation mode of the first application according to the comparison result.
其中,所述比对所述第一校验值和所述第二校验值为:检测所述第一校验值是否为所述第二校验值的子集;所述根据比对结果,切换所述第一应用的编译模式,具体为:如果所述 第一校验值不是所述第二校验值的子集,则切换所述第一应用的编译模式。Wherein, the comparison of the first check value and the second check value is: detecting whether the first check value is a subset of the second check value; the comparison result is based on , Switching the coding mode of the first application, specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application.
其中,所述第一编译器为Android编译器,所述第二编译器为方舟编译器;或者,所述第一编译器为方舟编译器,所述第二编译器为Android编译器。Wherein, the first compiler is an Android compiler, and the second compiler is an Ark compiler; or, the first compiler is an Ark compiler, and the second compiler is an Android compiler.
本申请还提供一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器、存储器,所述存储器用于存储计算机程序代码,所述计算机程序代码包括指令,当所述一个或多个处理器执行所述指令时,所述电子设备执行上述任一实施例所述的方法。This application also provides an electronic device, characterized in that the electronic device includes: one or more processors and a memory, the memory is used to store computer program code, the computer program code includes instructions, when the one When the instruction is executed by or multiple processors, the electronic device executes the method described in any of the foregoing embodiments.
本申请还提供一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行上述任一实施例所述的方法。The present application also provides a computer-readable storage medium, which is characterized by comprising computer instructions, which, when the computer instructions run on an electronic device, cause the electronic device to execute the method described in any of the foregoing embodiments.
本申请还提供一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行上述任一实施例所述的方法。The present application also provides a computer program product, which is characterized in that when the computer program product runs on a computer, the computer is caused to execute the method described in any of the foregoing embodiments.
本申请还提供一种芯片,其特征在于,包括:处理器和接口,用于从存储器中调用并运行所述存储器中存储的计算机程序,执行上述任一实施例所述的方法。The present application also provides a chip, which is characterized by comprising: a processor and an interface, configured to call and run a computer program stored in the memory from the memory, and execute the method described in any of the foregoing embodiments.
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can understand that, for the convenience and conciseness of the description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functions as required. The function module is completed, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be It can be combined or integrated into another device, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate parts may or may not be physically separate. The parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of software products, which are stored in a storage medium There are several instructions to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above content is only the specific implementation of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Covered in the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (35)

  1. 一种应用切换运行的方法,其特征在于,所述方法包括:A method for application switching operation, characterized in that the method includes:
    以第一编译模式运行第一应用;Run the first application in the first compilation mode;
    当满足第一切换条件时,以第二编译模式运行所述第一应用。When the first switching condition is met, the first application is run in the second compilation mode.
  2. 根据权利要求1所述的方法,其特征在于,所述第一应用是以BOTH形态打包的方舟应用。The method of claim 1, wherein the first application is an Ark application packaged in BOTH form.
  3. 根据权利要求1或2所述的方法,其特征在于,所述第一切换条件为以下条件的至少一种:The method according to claim 1 or 2, wherein the first handover condition is at least one of the following conditions:
    所述第一应用的崩溃次数达到第一阈值;或The number of crashes of the first application reaches a first threshold; or
    当前系统内存占用超过第二阈值;或The current system memory usage exceeds the second threshold; or
    所述第一应用的内存占用超过第三阈值;或The memory occupation of the first application exceeds a third threshold; or
    所述第一应用的页面响应速度低于第四阈值;或The page response speed of the first application is lower than the fourth threshold; or
    所述第一应用以所述第一编译模式运行时间超过第五阈值;或The running time of the first application in the first compilation mode exceeds a fifth threshold; or
    用户的位置信息发生改变;或The user’s location information changes; or
    所述第二编译模式的编译器性能优于所述第一编译模式的编译器性能;或The performance of the compiler in the second compilation mode is better than the performance of the compiler in the first compilation mode; or
    当前系统时间处于预设时间段内。The current system time is within the preset time period.
  4. 根据权利要求1-3所述的方法,其特征在于,当所述第一切换条件为所述第一应用的崩溃次数达到第一阈值时,所述方法还包括:The method according to claims 1-3, wherein when the first switching condition is that the number of times the first application crashes reaches a first threshold, the method further comprises:
    记录所述第一应用的崩溃次数,将所述第一应用设置为切换状态;Record the number of times the first application crashes, and set the first application to a switching state;
    在所述第一应用重新启动时,检测所述第一应用是否是切换状态;When the first application is restarted, detecting whether the first application is in a switching state;
    如果所述第一应用是切换状态,则以所述第二编译模式运行所述第一应用。If the first application is in the switching state, run the first application in the second compilation mode.
  5. 根据权利要求1-4所述的方法,其特征在于,所述方法还包括:The method according to claims 1-4, wherein the method further comprises:
    当满足第二切换条件时,以所述第一编译模式运行所述第一应用。When the second switching condition is met, the first application is run in the first compilation mode.
  6. 根据权利要求5所述的方法,其特征在于,所述第二切换条件为:The method according to claim 5, wherein the second handover condition is:
    所述第一应用以所述第二编译模式运行后的崩溃次数大于所述第一阈值。The number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
  7. 根据权利要求5所述的方法,其特征在于,所述第二切换条件为:The method according to claim 5, wherein the second handover condition is:
    检测到所述第一应用在所述第一编译模式下的崩溃漏洞被修复。It is detected that the crash vulnerability of the first application in the first compilation mode is repaired.
  8. 根据权利要求1-7所述的方法,其特征在于,所述第一应用运行的进程下还包括第二应用,所述方法还包括:The method according to claims 1-7, wherein the process in which the first application is running further includes a second application, and the method further comprises:
    当以所述第二编译模式运行所述第一应用时,切换所述第二应用的编译模式为所述第二编译模式。When running the first application in the second compilation mode, switch the compilation mode of the second application to the second compilation mode.
  9. 根据权利要求8所述的方法,其特征在于,所述第二应用的启动时间早于所述第一应用的启动时间。The method according to claim 8, wherein the start time of the second application is earlier than the start time of the first application.
  10. 根据权利要求8所述的方法,其特征在于,所述第二应用的启动时间晚于所述第一应用的启动时间。The method according to claim 8, wherein the start time of the second application is later than the start time of the first application.
  11. 根据权利要求1所述的方法,其特征在于,所述第一应用的运行依赖于第三应用,所述第一切换条件为:The method according to claim 1, wherein the operation of the first application depends on a third application, and the first switching condition is:
    所述第三应用的APK状态发生变化。The APK status of the third application changes.
  12. 根据权利要求1所述的方法,其特征在于,所述第一应用的运行依赖于第三应用,所述第一切换条件为:The method according to claim 1, wherein the operation of the first application depends on a third application, and the first switching condition is:
    所述第三应用切换为以所述第二编译模式运行。The third application is switched to run in the second compilation mode.
  13. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, wherein the method further comprises:
    在创建所述第一应用时,根据所述第一应用的API信息生成第一校验值;When creating the first application, generate a first check value according to the API information of the first application;
    将所述第一校验值打包到所述第一应用的APK中;Packing the first check value into the APK of the first application;
    将操作系统提供的API信息生成第二校验值,将所述第二校验值打包到所述操作系统中;Generate a second check value from API information provided by the operating system, and package the second check value into the operating system;
    当所述第一应用的状态改变时,比对所述第一校验值和所述第二校验值;When the state of the first application changes, compare the first check value with the second check value;
    根据比对结果,切换所述第一应用的编译模式。According to the comparison result, the compilation mode of the first application is switched.
  14. 根据权利要求13所述的方法,其特征在于,所述比对所述第一校验值和所述第二校验值为:检测所述第一校验值是否为所述第二校验值的子集;The method according to claim 13, wherein the comparing the first check value with the second check value is: detecting whether the first check value is the second check value A subset of values;
    所述根据比对结果,切换所述第一应用的编译模式,具体为:如果所述第一校验值不是所述第二校验值的子集,则切换所述第一应用的编译模式。The switching the coding mode of the first application according to the comparison result is specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application .
  15. 根据权利要求1-14所述的方法,其特征在于:The method according to claims 1-14, characterized in that:
    所述第一编译模式为Android编译模式,所述第二编译模式为方舟编译模式;或者,The first compilation mode is the Android compilation mode, and the second compilation mode is the Ark compilation mode; or,
    所述第一编译模式为方舟编译模式,所述第二编译模式为Android编译模式。The first compilation mode is the Ark compilation mode, and the second compilation mode is the Android compilation mode.
  16. 一种电子设备,包括第一编译模块,第二编译模块,切换模块,其特征在于:An electronic device, comprising a first compilation module, a second compilation module, and a switching module, characterized in that:
    所述第一编译模块,用于以第一编译模式运行第一应用;The first compilation module is configured to run a first application in a first compilation mode;
    所述切换模块,用于确定当满足第一切换条件时,使得所述第一应用从所述第一编译模式切换为第二编译模式运行;The switching module is configured to determine that when a first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode to run;
    所述第二编译模块,用于以所述第二编译模式运行所述第一应用。The second compilation module is configured to run the first application in the second compilation mode.
  17. 根据权利要求16所述的电子设备,其特征在于,所述第一应用是以BOTH形态打包的方舟应用。16. The electronic device of claim 16, wherein the first application is an Ark application packaged in BOTH form.
  18. 根据权利要求16或17所述的电子设备,其特征在于,所述第一切换条件为以下条件的至少一种:The electronic device according to claim 16 or 17, wherein the first switching condition is at least one of the following conditions:
    所述第一应用的崩溃次数达到第一阈值;或The number of crashes of the first application reaches a first threshold; or
    当前系统内存占用超过第二阈值;或The current system memory usage exceeds the second threshold; or
    所述第一应用的内存占用超过第三阈值;或The memory occupation of the first application exceeds a third threshold; or
    所述第一应用的页面响应速度低于第四阈值;或The page response speed of the first application is lower than the fourth threshold; or
    所述第一应用以所述第一编译模式运行时间超过第五阈值;或The running time of the first application in the first compilation mode exceeds a fifth threshold; or
    用户的位置信息发生改变;或The user’s location information changes; or
    所述第二编译模块的性能优于所述第一编译模块的性能;或The performance of the second compilation module is better than the performance of the first compilation module; or
    当前系统时间处于预设时间段内。The current system time is within the preset time period.
  19. 根据权利要求16-18所述的电子设备,所述电子设备还包括崩溃记录模块,重启检测模块,其中,所述第一切换条件为所述第一应用的崩溃次数达到第一阈值,其特征在于:The electronic device according to claims 16-18, further comprising a crash recording module and a restart detection module, wherein the first switching condition is that the number of crashes of the first application reaches a first threshold, which is characterized Lies in:
    所述崩溃记录模块,用于记录所述第一应用的崩溃次数,将所述第一应用设置为切换状态;The crash recording module is configured to record the number of times the first application has crashed, and set the first application to a switching state;
    所述重启检测模块,用于在所述第一应用重新启动时,检测所述第一应用是否是切换状态;The restart detection module is configured to detect whether the first application is in a switching state when the first application is restarted;
    所述第二编译模块,用于确定当所述第一应用是切换状态,则以所述第二编译模式运行所述第一应用。The second compilation module is configured to determine that when the first application is in a switching state, run the first application in the second compilation mode.
  20. 根据权利要求16-19所述的电子设备,其特征在于,所述第一编译模块还用于:The electronic device according to claims 16-19, wherein the first compilation module is further configured to:
    当满足第二切换条件时,以所述第一编译模式运行所述第一应用。When the second switching condition is met, the first application is run in the first compilation mode.
  21. 根据权利要求20所述的电子设备,其特征在于,所述第二切换条件为:The electronic device according to claim 20, wherein the second switching condition is:
    所述第一应用以所述第二编译模式运行后的崩溃次数大于所述第一阈值。The number of crashes of the first application after running in the second compilation mode is greater than the first threshold.
  22. 根据权利要求20所述的电子设备,其特征在于,所述第二切换条件为:The electronic device according to claim 20, wherein the second switching condition is:
    检测到所述第一应用在所述第一编译模式下的崩溃漏洞被修复。It is detected that the crash vulnerability of the first application in the first compilation mode is repaired.
  23. 根据权利要求1-7所述的电子设备,所述第一应用运行的进程下还包括第二应用,其特征在于:7. The electronic device according to claims 1-7, wherein the running process of the first application further comprises a second application, characterized in that:
    所述切换模块,用于当以所述第二编译模式运行所述第一应用时,切换所述第二应用的编译模式为所述第二编译模式。The switching module is configured to switch the compilation mode of the second application to the second compilation mode when the first application is run in the second compilation mode.
  24. 根据权利要求23所述的电子设备,其特征在于,所述第二应用的启动时间早于所述第一应用的启动时间。The electronic device of claim 23, wherein the start time of the second application is earlier than the start time of the first application.
  25. 根据权利要求23所述的电子设备,其特征在于,所述第二应用的启动时间晚于所述第一应用的启动时间。23. The electronic device according to claim 23, wherein the start time of the second application is later than the start time of the first application.
  26. 根据权利要求16所述的电子设备,其特征在于,所述第一应用的运行依赖于第三应用,所述第一切换条件为:The electronic device according to claim 16, wherein the operation of the first application depends on a third application, and the first switching condition is:
    所述第三应用的APK状态发生变化。The APK status of the third application changes.
  27. 根据权利要求16所述的电子设备,其特征在于,所述第一应用的运行依赖于第三应用,所述第一切换条件为:The electronic device according to claim 16, wherein the operation of the first application depends on a third application, and the first switching condition is:
    所述第三应用切换为以所述第二编译模式运行。The third application is switched to run in the second compilation mode.
  28. 根据权利要求16所述的电子设备,所述电子设备还包括第一校验码生成模块,第二校验码生成模块,比对模块,其特征在于:The electronic device according to claim 16, further comprising a first verification code generation module, a second verification code generation module, and a comparison module, wherein:
    所述第一校验码生成模块,用于在创建所述第一应用时,根据所述第一应用的API信息生成第一校验值,所述将所述第一校验值打包到所述第一应用的APK中;The first check code generation module is configured to generate a first check value according to the API information of the first application when the first application is created, and the first check value is packaged in the In the APK of the first application;
    所述第二校验码生成模块,用于将操作系统提供的API信息生成第二校验值,将所述第二校验值打包到所述操作系统中;The second check code generation module is configured to generate a second check value from API information provided by the operating system, and package the second check value into the operating system;
    所述比对模块,用于当所述第一应用的状态改变时,比对所述第一校验值和所述第二校验值;The comparison module is configured to compare the first check value with the second check value when the state of the first application changes;
    所述切换模块,用于根据比对结果,切换所述第一应用的编译模式。The switching module is configured to switch the compilation mode of the first application according to the comparison result.
  29. 根据权利要求28所述的电子设备,其特征在于,所述比对所述第一校验值和所述第二校验值为:检测所述第一校验值是否为所述第二校验值的子集;The electronic device according to claim 28, wherein the comparison between the first check value and the second check value: detecting whether the first check value is the second check value A subset of the test value;
    所述根据比对结果,切换所述第一应用的编译模式,具体为:如果所述第一校验值不是所述第二校验值的子集,则切换所述第一应用的编译模式。The switching the coding mode of the first application according to the comparison result is specifically: if the first check value is not a subset of the second check value, switching the coding mode of the first application .
  30. 根据权利要求16-29所述的电子设备,其特征在于:The electronic device according to claims 16-29, wherein:
    所述第一编译模块为Android编译模块,所述第二编译模块为方舟编译模块;或者,The first compilation module is an Android compilation module, and the second compilation module is an Ark compilation module; or,
    所述第一编译模块为方舟编译模块,所述第二编译模块为Android编译模块。The first compilation module is an Ark compilation module, and the second compilation module is an Android compilation module.
  31. 一种电子设备,包括第一编译器,第二编译器,处理器,其特征在于:An electronic device, comprising a first compiler, a second compiler, and a processor, characterized in that:
    所述第一编译器被配置为,以第一编译模式运行第一应用;The first compiler is configured to run the first application in a first compilation mode;
    所述处理器被配置为,确定当满足第一切换条件时,使得所述第一应用从所述第一编译模式切换为第二编译模式运行;The processor is configured to determine that when a first switching condition is met, the first application is switched from the first compilation mode to the second compilation mode to run;
    所述第二编译器被配置为,以所述第二编译模式运行所述第一应用。The second compiler is configured to run the first application in the second compilation mode.
  32. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器、存储器,所述存储器用于存储计算机程序代码,所述计算机程序代码包括指令,当所述一个或多个处理器执行所述指令时,所述电子设备执行如权利要求1-15中任意一项所述的方法。An electronic device, characterized in that, the electronic device includes: one or more processors, a memory, the memory is used to store computer program code, the computer program code includes instructions, when the one or more processing When the device executes the instruction, the electronic device executes the method according to any one of claims 1-15.
  33. 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1-15中任意一项所述的方法。A computer-readable storage medium, characterized by comprising computer instructions, which when the computer instructions run on an electronic device, causes the electronic device to execute the method according to any one of claims 1-15.
  34. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-15中任一项所述的方法。A computer program product, characterized in that, when the computer program product runs on a computer, the computer is caused to execute the method according to any one of claims 1-15.
  35. 一种芯片,其特征在于,包括:处理器和接口,用于从存储器中调用并运行所述存储器中存储的计算机程序,执行如权利要求1-15中任一项所述的方法。A chip, characterized by comprising: a processor and an interface, used for calling and running a computer program stored in the memory from the memory, and executing the method according to any one of claims 1-15.
PCT/CN2020/108158 2019-08-15 2020-08-10 Method for switching running of application and device WO2021027772A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910755635.5 2019-08-15
CN201910755635.5A CN112394906B (en) 2019-08-15 2019-08-15 Method and equipment for switching application operation

Publications (1)

Publication Number Publication Date
WO2021027772A1 true WO2021027772A1 (en) 2021-02-18

Family

ID=74569312

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/108158 WO2021027772A1 (en) 2019-08-15 2020-08-10 Method for switching running of application and device

Country Status (2)

Country Link
CN (1) CN112394906B (en)
WO (1) WO2021027772A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113805962A (en) * 2021-08-31 2021-12-17 北京百度网讯科技有限公司 Application page display method and device and electronic equipment
CN113950034A (en) * 2021-10-14 2022-01-18 北京鲸鲮信息系统技术有限公司 Bluetooth behavior simulation method, device and equipment

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114879948B (en) * 2022-07-08 2022-10-28 北京百度网讯科技有限公司 WebAssembly-based intelligent contract processing method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8578355B1 (en) * 2010-03-19 2013-11-05 Google Inc. Scenario based optimization
CN103886095A (en) * 2014-04-03 2014-06-25 北京深思数盾科技有限公司 Cross-platform object file multiplexing method
CN106020921A (en) * 2016-05-16 2016-10-12 广东天波信息技术股份有限公司 Peripheral application transplantation method and system
CN108595214A (en) * 2018-04-11 2018-09-28 北京海杭通讯科技有限公司 Android user versions obtain the method and system of root privileges under SELinux compulsory modes
CN109656566A (en) * 2018-12-14 2019-04-19 北京中科寒武纪科技有限公司 Heterogeneous computing system executable file acquisition methods, operation method and Related product

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6973646B1 (en) * 2000-07-21 2005-12-06 International Business Machines Corporation Method for compiling program components in a mixed static and dynamic environment
US9753704B2 (en) * 2012-01-18 2017-09-05 Metrologic Instruments, Inc. Web-based scan-task enabled system and method of and apparatus for developing and deploying the same on a client-server network
WO2014142430A1 (en) * 2013-03-15 2014-09-18 주식회사 에스이웍스 Dex file binary obfuscation method in android system
US8918775B1 (en) * 2013-07-12 2014-12-23 Ca, Inc. Dynamic release control of software application version changes
US20150094150A1 (en) * 2013-09-30 2015-04-02 Zynga Inc. Operation of a browser-incompatible application within a browser
CN106371940B (en) * 2015-07-21 2020-02-11 腾讯科技(深圳)有限公司 Method and device for solving program crash
CN107632836A (en) * 2017-09-26 2018-01-26 湖南机友科技有限公司 Softwarecompatible method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8578355B1 (en) * 2010-03-19 2013-11-05 Google Inc. Scenario based optimization
CN103886095A (en) * 2014-04-03 2014-06-25 北京深思数盾科技有限公司 Cross-platform object file multiplexing method
CN106020921A (en) * 2016-05-16 2016-10-12 广东天波信息技术股份有限公司 Peripheral application transplantation method and system
CN108595214A (en) * 2018-04-11 2018-09-28 北京海杭通讯科技有限公司 Android user versions obtain the method and system of root privileges under SELinux compulsory modes
CN109656566A (en) * 2018-12-14 2019-04-19 北京中科寒武纪科技有限公司 Heterogeneous computing system executable file acquisition methods, operation method and Related product

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113805962A (en) * 2021-08-31 2021-12-17 北京百度网讯科技有限公司 Application page display method and device and electronic equipment
CN113805962B (en) * 2021-08-31 2023-10-20 北京百度网讯科技有限公司 Application page display method and device and electronic equipment
CN113950034A (en) * 2021-10-14 2022-01-18 北京鲸鲮信息系统技术有限公司 Bluetooth behavior simulation method, device and equipment
CN113950034B (en) * 2021-10-14 2024-04-26 北京字节跳动网络技术有限公司 Bluetooth behavior simulation method, device and equipment

Also Published As

Publication number Publication date
CN112394906A (en) 2021-02-23
CN112394906B (en) 2022-10-25

Similar Documents

Publication Publication Date Title
US11803451B2 (en) Application exception recovery
US11853820B2 (en) Cross-process communication method, apparatus, and device
WO2021027772A1 (en) Method for switching running of application and device
WO2019178869A1 (en) Method for opening esim card account, and terminal
WO2019227450A1 (en) Application function implementation method and electronic device
KR102193404B1 (en) Incrementally compiling software artifacts from an interactive development environment
WO2018223558A1 (en) Data processing method and electronic device
CN110058850B (en) Application development method and device and storage medium
CN106502703B (en) Function calling method and device
WO2018209843A1 (en) Method, device and terminal for executing hotpatch
CN110865837B (en) Method and terminal for system upgrade
CN110046497B (en) Function hook realization method, device and storage medium
CN109800030B (en) Application program running method and device and terminal
WO2019200588A1 (en) Method for display when exiting an application, and terminal
WO2020014926A1 (en) Patch package generation method and device
CN111713176B (en) Data transmission method and terminal
CN111557097B (en) Control method of power key in virtual remote controller and terminal
CN108780400B (en) Data processing method and electronic equipment
EP4195623A1 (en) Application interface migration system, method, and related device
WO2021057411A1 (en) Component loading method, device, and system
CN116643778B (en) Application program optimization method and electronic equipment
WO2021057390A1 (en) Method for launching quick application, and related device
CN109145598B (en) Virus detection method and device for script file, terminal and storage medium
US20050197157A1 (en) System enabling easy application development on mobile devices
US10839037B2 (en) Connected application experience

Legal Events

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

Ref document number: 20853388

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20853388

Country of ref document: EP

Kind code of ref document: A1