An application access method, a service stopping method, and an electronic device

By adding a proxy center module to the application framework layer of electronic devices and stopping services before switching applications to the background, the high power consumption problem caused by background application wake-up was solved, achieving power reduction and performance improvement.

CN115442875BActive Publication Date: 2026-04-03HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-01
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

When an electronic device switches from the foreground to the background, the power consumption is high due to the wake-up of background application services, which affects device performance.

Method used

By adding a proxy center module at the application framework layer, the services of the first application can be proxied, and notification messages can be sent to the second application to prevent it from accessing the service, or the service can be stopped before the application switches to the background and enters the hibernation state, thereby reducing the number of wake-ups.

Benefits of technology

It reduces the power consumption of electronic devices, improves performance, and enhances user experience and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115442875B_ABST
    Figure CN115442875B_ABST
Patent Text Reader

Abstract

This application provides an application access method, a service termination method, and an electronic device. The method may include: when the service of a first application is accessed by a second application, the first application may send a notification message to the second application when it meets set conditions, to notify the second application that access to the first application is not allowed or that the first application does not exist; or the application may be switched to the background and its service terminated in advance before service detection is performed. Through these methods, the second application will not wake up the first application, reducing the number of application wake-ups and lowering the power consumption of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to an application access method, a service stopping method, and an electronic device. Background Technology

[0002] With the widespread use of smartphones, tablets and other electronic devices, users often open multiple applications when using a smartphone. These applications (referred to as "applications") can generally include foreground applications and background applications.

[0003] When an application switches from the foreground to the background, it may be woken up for various reasons. If the application is in a suspended state and is woken up as a background application, it may result in higher power consumption of the electronic device and affect its performance. Summary of the Invention

[0004] This application provides an application access method, a service stop method, and an electronic device to reduce the number of times the electronic device is woken up, reduce the power consumption of the electronic device, and improve performance.

[0005] In a first aspect, this application provides an application access method, which includes: when the service of a first application is accessed by a second application, if the first application and the second application meet the set conditions, a first notification message can be sent to the second application to notify the second application that access to the first application is not allowed or to notify the second application that the first application does not exist; otherwise, the second application is allowed to access the service of the first application.

[0006] With the above technical solution, when the service of the first application is accessed by the second application, a notification message can be sent to the second application when the set conditions are met. In this way, the second application will not wake up the first application, reducing the number of times the application is woken up and reducing the power consumption of electronic devices.

[0007] In one possible design, the conditions may include any of the following:

[0008] Condition 1: The second application is a background application;

[0009] Condition 2: The second application is a foreground application, and the application status of the first application is suspended;

[0010] Condition 3: The application identifier of the second application is an application identifier in the blacklist set by the user, and the blacklist includes application identifiers that are prohibited from accessing the first application;

[0011] Condition 4: The application identifier of the first application is an application identifier in the blacklist set by the user, and the blacklist includes application identifiers of applications that are prohibited from being accessed.

[0012] By using the above conditions, it can be determined whether the first application and the second application meet the set conditions, thereby determining whether the second application can access the services of the first application.

[0013] In one possible design, sending a first notification message to the second application includes: the proxy center module of the electronic device application framework layer acting as an agent for the services of the first application and sending the first notification message to the second application; or the proxy center module of the electronic device application framework layer acting as an agent for the services of the first application and sending the first notification message to the second application through a third application. The third application is an application used to interact with the proxy center module of the application framework layer.

[0014] In this embodiment, by adding a proxy center module to the application framework layer, the proxy center module acts as a proxy for the services of the first application and sends a notification message to the second application that it is not allowed to access the first application or that the first application does not exist. In this way, the second application will not access the first application and thus will not wake up the first application.

[0015] In one possible design, if it is determined that the first application and / or the second application meet the set conditions, a first notification message is sent to the second application, including:

[0016] If it is determined that the first application and / or the second application meet the set conditions, a first prompt message is displayed, which prompts the user to confirm whether to allow the second application to access the services of the first application; in response to the first operation, a first notification message is sent to the second application, where the first operation is the user's triggering operation of the negative button; or when the time for displaying the first prompt message reaches a preset duration, a first notification message is sent to the second application.

[0017] The above technical solution can display a prompt message for user confirmation when the first application and / or the second application meet the set conditions. This method increases user interaction, improves security in application access scenarios, prevents user privacy from being leaked, and enhances user experience.

[0018] In one possible design, the first notification message includes a spoofed value, which is used to indicate that the service of the first application does not exist.

[0019] The above technical solution can use a spoofed value to notify the application that the application being accessed does not exist, thus preventing the application from being accessed and reducing the number of times it is woken up.

[0020] In one possible design, the setting interface is either the startService interface or the bindService interface.

[0021] The above technical solution can determine the specific situation of the second application accessing the first application based on the name of the interface called. For example, when calling the startService interface or the bindService interface, it can be determined that the second application is accessing the service of the first application.

[0022] In one possible design, after the electronic device detects that a second application accesses a first application through a set interface, the method further includes: the electronic device determining that a process exists for the first application.

[0023] Using the above technical solution, when a second application accesses the service of a first application, it can be determined whether a process of the first application exists. If a process exists, the solution of this application embodiment can be adopted, that is, a notification message can be sent to the second application through a service proxy method.

[0024] Secondly, this application provides a service termination method, which includes: first, an electronic device displays the interface of a first application, whereby the user can switch the first application to run in the background, and then, after the first application is switched to the background and before background service detection is performed, the service of the first application is terminated.

[0025] The above technical solution allows the service of the first application to be stopped before service testing, so that the service of the first application cannot be detected during service testing, thus preventing the first application from being woken up, reducing the number of times the first application is woken up, and reducing the power consumption of electronic devices.

[0026] In this embodiment, the services of the first application may include multiple services. The electronic device may stop the services of the first application in several ways:

[0027] Method 1: The electronic device stops the first service of the first application according to the service type of the first application, wherein the first service is any one of the plurality of services, and the first service is a foreground service.

[0028] Method 2: The electronic device responds to a third operation by stopping the first service of the first application, wherein the third operation is a user's selection operation among the plurality of services, and the first service is at least one of the plurality of services.

[0029] In this way, electronic devices can stop foreground services based on the type of application service, or users can choose which services to stop, thus improving the user experience.

[0030] In one possible design, after the electronic device stops the service of the first application, the method further includes: the electronic device detecting that the application state of the first application has switched from an active state to a suspended state.

[0031] In other words, in this application, after the first application switches to the background, its service can be stopped while it is still in an active state. Then, the first application will switch from an active state to a suspended state, and finally, a service check will be performed. In other words, stopping the service is executed before the application switches to a suspended state, thus avoiding the need to wake up the first application and reducing the number of wake-ups.

[0032] In one possible design, the method further includes: the electronic device sending a wake-up prohibition command to a first application. Thus, the first application will not wake up after receiving the wake-up prohibition command.

[0033] Thirdly, this application provides an electronic device, the electronic device including a display screen; one or more processors; one or more memories; one or more sensors; multiple applications; and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the first aspect and any possible design of the first aspect.

[0034] Fourthly, this application provides an electronic device including a display screen; one or more processors; one or more memories; one or more sensors; multiple applications; and one or more computer programs; wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the methods described in the second aspect and any possible design of the second aspect.

[0035] Fifthly, this application also provides an electronic device comprising modules / units for performing the first aspect or any possible design method of the first aspect; these modules / units may be implemented in hardware or by hardware executing corresponding software.

[0036] Sixthly, this application also provides an electronic device comprising modules / units for performing the second aspect or any possible design method of the second aspect; these modules / units may be implemented in hardware or by hardware executing corresponding software.

[0037] In a seventh aspect, this application also provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the first aspect and any possible application access method designed within the first aspect.

[0038] Eighthly, this application also provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the second aspect and any possible service termination method designed within the second aspect.

[0039] Ninthly, an embodiment of this application provides a computer program product that, when run on an electronic device, causes the electronic device to execute the first aspect of this application and any possible application access method designed within the first aspect.

[0040] In a tenth aspect, an embodiment of this application provides a computer program product that, when run on an electronic device, causes the electronic device to execute the second aspect of this application and any possible service termination method designed within the second aspect.

[0041] For the various aspects from the third to the tenth aspects mentioned above, and the technical effects that each aspect may achieve, please refer to the description of the technical effects that can be achieved by the various possible solutions for the first and second aspects mentioned above. They will not be repeated here. Attached Figure Description

[0042] Figure 1A A service lifecycle diagram provided for an embodiment of this application;

[0043] Figure 1B This application provides a schematic diagram of an application state switching embodiment;

[0044] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0045] Figure 3A A software structure block diagram provided for an embodiment of this application;

[0046] Figure 3B A schematic diagram of a software module provided in an embodiment of this application;

[0047] Figure 4 A user interface diagram provided for an embodiment of this application;

[0048] Figure 5 A flowchart of a service termination method provided in this application embodiment;

[0049] Figure 6This is a diagram illustrating the time points when an application switches to the background.

[0050] Figure 7 A flowchart of an application access method provided in an embodiment of this application;

[0051] Figure 8 This is a schematic diagram of the structure of another electronic device provided in an embodiment of this application. Detailed Implementation

[0052] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0053] To facilitate understanding, the relevant terms and concepts involved in the embodiments of this application will be introduced below.

[0054] 1. Front-end application, back-end application

[0055] Applications can be categorized into foreground and background applications based on whether they can be directly interacted with by the user. Foreground applications are those placed in the foreground and directly interactive by the user, while background applications are those placed in the background and not directly interactive. Specifically, whether an application is foreground or background can be determined by listening to the foreground / background event callbacks of the system's ProcessObserve interface. For example, when a user opens application A on the main interface of an electronic device, the system's ProcessObserve interface can listen for this event, determining that application A is a foreground application. Then, when the user returns to the main interface and opens application B, the system's ProcessObserve interface can listen for this event, determining that application B is a foreground application and application A is a background application. In the embodiments of this application, the foreground or background application can be determined based on whether the application is directly visible. Specifically, an application is a foreground application when it is visible, and a background application when it is not visible. For example, when the application's interface is displayed on the screen of the electronic device, the application is a foreground application; when the application's interface is not displayed on the screen of the electronic device, the application is a background application. The application's interface does not include the operating system's top status bar or notification bar.

[0056] It is worth noting that an application can switch between foreground and background modes in response to user actions.

[0057] 2. Service

[0058] A service is an application component that can run in the background for an extended period without providing a user interface. Services can be started by other application components, and they continue to run in the background even if the user switches to another application. Furthermore, components can interact with services by binding to them, and even perform inter-process communication (IPC). For example, a service can handle network transactions, play music, perform file input / output (I / O), or interact with content providers in the background.

[0059] The following describes the different service types:

[0060] (1) Foreground services perform operations that the user can notice or perceive. For example, services displayed in the notification bar can be considered foreground services. For instance, an audio application uses a foreground service to play audio tracks. Even if the user stops interacting with the application, the foreground service continues to run.

[0061] (2) Background services perform operations that users will not directly notice, such as services that are not displayed in the notification bar. For example, if an application uses a service to compress its storage space, this service is usually a background service.

[0062] Specifically, when an application needs a service, it can send a message to the system, instructing the system to create the service. At this point, the system can assign identification information to the service. For example, suppose an application needs a foreground service that plays music. It will then instruct the system to create such a service for the application. The system will then create the music playback foreground service based on the application's needs and mark it as a foreground service. In this way, the system can store services with identification information.

[0063] Services themselves have a lifecycle, which (from creation to destruction) can follow any of the following paths:

[0064] (1) Start the service

[0065] This service is created when another component calls `startService()`, then runs indefinitely and must be stopped by calling `stopSelf()`. Alternatively, other components can also stop this service by calling `stopService()`. Once the service is stopped, it is destroyed by the system.

[0066] (2) Binding services

[0067] The service is created when other components (clients) call bindService(). The client then communicates with the service through the IBinder interface. The client can close the connection by calling unbindService(). Multiple clients can bind to the same service, and the service is destroyed when all bindings are canceled (the service does not need to stop running on its own).

[0068] These two paths are not entirely independent. You can bind to a service that has already been started using `startService()`. For example, you can use an Intent (identifying the music to play) to call `startService()`, thus starting a background music service. Subsequently, when the user needs to control the player or get information about the currently playing song, the Activity can bind to the service by calling `bindService()`. In such cases, `stopService()` or `stopSelf()` will not actually stop the service until all clients unbind.

[0069] For example, such as Figure 1A The diagram illustrates the lifecycle of a service according to an embodiment of this application. The diagram includes five methods: StartService(), onCreate(), onStartCommand(), StopService(), and onDestroy(). The service lifecycle begins with StartService() starting the service, then onCreate() creating the service, onStartCommand() initiating the service, StopService() closing the service, and finally onDestroy() destroying the service.

[0070] 3. Process

[0071] In most cases, each Android application runs in its own Linux process. When the system needs to run some of the application's code, it creates this process for the application and keeps it running until it is no longer needed and the system needs to reclaim its memory for other applications. It should be noted that an application can have multiple services and multiple processes. One service corresponds to one process, and one process can correspond to one or more services. Of course, a process can also have no services; this application does not impose any restrictions on this.

[0072] Because the native Android system offers virtually no control, applications can employ various methods to stay active in the background, significantly impacting the performance and power consumption of electronic devices. Therefore, domestic mobile phone manufacturers have introduced various control mechanisms based on the native Android system, such as background cleanup, application auto-start control, and background process suspension. However, due to the openness of the Android system and the diversity of third-party application implementations, many situations have arisen where control is "unmanageable" or "unthinkable." For example, it is impossible to control situations where background applications are woken up by services.

[0073] The following section introduces a solution for waking up applications via services.

[0074] Option 1:

[0075] When an application switches from foreground to background, it can be in three states: running, hibernation, or died. In the running state, the application can still use the CPU and allocate memory. In the hibernation state, the application still uses memory resources but cannot use CPU or other software and hardware resources, having almost no impact on system power consumption. In the died state, the application is cleaned up in the background, including due to low memory usage, high power consumption, or user-initiated cleanup. At this time, the application has no background processes and zero memory and CPU usage.

[0076] For example, such as Figure 1B The diagram illustrates an application state transition according to an embodiment of this application. After an application switches from the running state to the background for a duration T1, it may enter a hibernation state. Then, after the application switches back to the background for a duration T2, a service check is triggered, waking up the application and triggering a callback to the application service's lifecycle to stop the service. This wakes the application from the hibernation state back to the running state. If the application is cleaned up while in the hibernation or running state, it will enter a died state. When the application is restarted, it can switch from the died state back to the running state. For example, assuming T1 is 10 seconds and T2 is 1 minute, application A switches from the foreground to the background and enters the hibernation state 10 seconds later. Then, after application A switches back to the background for 1 minute, a service check is triggered, waking up application A.

[0077] The second option:

[0078] Different applications can be linked and woken up by binding services or starting services. When application A is in the foreground, application B can be woken up by accessing related services. For example, when application A switches from the foreground to the background application T1 (e.g., after 10 seconds), application A may be in a hibernation state. Assuming that the foreground application is application B at this time, application B can access application A's service and wake up application A.

[0079] In other words, existing technical solutions, whether for service detection or application association, will wake up the application again, increasing the power consumption of electronic devices and affecting performance.

[0080] In view of this, embodiments of this application provide a service stopping method. When an application switches from a foreground application to a background application, and before the application enters a hibernation state, the application's service is stopped. This way, the background application's service cannot be detected during service detection, thus preventing the background application from being woken up. This reduces the number of times the application is woken up, lowers power consumption, and improves performance.

[0081] The application programs (hereinafter referred to as "applications") involved in the embodiments of this application are software programs capable of performing one or more specific functions. Typically, multiple applications can be installed on an electronic device. Examples include camera applications, SMS applications, email applications, video applications, and music applications. The applications mentioned below may be applications pre-installed on the electronic device at the factory, or applications downloaded by the user from the network or obtained from other electronic devices during the use of the electronic device.

[0082] It should be noted that the method provided in this application embodiment can be applied to any electronic device with a display screen, such as mobile phones, tablets, wearable devices (e.g., watches, bracelets, smart helmets, smart glasses, etc.), in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc., and this application embodiment is not limited to these. Furthermore, exemplary embodiments of the electronic device include, but are not limited to, devices equipped with... HarmonyOS Or electronic devices with other operating systems.

[0083] The following section uses a mobile phone as an example to introduce the structure of electronic devices.

[0084] like Figure 2As shown, the mobile phone 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0085] Processor 110 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may serve as the central nervous system and command center of the mobile phone 100. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. Processor 110 may also include memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has recently used or is reusing. If the processor 110 needs to reuse the instruction or data, it can directly retrieve it from the memory. This avoids repeated access, reduces the processor 110's waiting time, and thus improves system efficiency.

[0086] USB interface 130 is a USB standard compliant interface, specifically a Mini USB interface, Micro USB interface, USB Type-C interface, etc. USB interface 130 can be used to connect a charger to charge mobile phone 100, and can also be used for data transfer between mobile phone 100 and peripheral devices. Charging management module 140 receives charging input from the charger. Power management module 141 connects to battery 142, charging management module 140, and processor 110. Power management module 141 receives input from battery 142 and / or charging management module 140, providing power to processor 110, internal memory 121, external memory, display 194, camera 193, and wireless communication module 160, etc.

[0087] The wireless communication function of mobile phone 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in mobile phone 100 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.

[0088] The mobile communication module 150 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the mobile phone 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0089] The wireless communication module 160 can provide solutions for wireless communication applications on the mobile phone 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2. Exemplarily, in this embodiment, different electronic devices can establish communication connections via BT or WLAN.

[0090] In some embodiments, antenna 1 of mobile phone 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling mobile phone 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), the fifth generation (5G) mobile communication system, future communication systems such as the sixth generation (6G) system, BT, GNSS, WLAN, NFC, FM and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0091] The display screen 194 is used to display the application's interface, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone 100 may include one or N display screens 194, where N is a positive integer greater than 1. In this embodiment, the display screen 194 can be used to simultaneously display multiple application interfaces.

[0092] Camera 193 is used to capture still images or videos. Camera 193 may include a front-facing camera and a rear-facing camera.

[0093] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the mobile phone 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system and software code for at least one application (e.g., iQiyi application, WeChat application, etc.). The data storage area may store data generated during the use of the mobile phone 100 (e.g., images, videos, etc.). Furthermore, the internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0094] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, images, videos, and other files can be saved on the external storage card.

[0095] The mobile phone 100 can achieve audio functions such as music playback and recording through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0096] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch buttons. The mobile phone 100 can receive button input and generate key signal inputs related to user settings and function control. Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations applied to different applications (such as taking photos, playing audio, etc.). Indicator 192 can be an indicator light, used to indicate charging status, battery level changes, messages, missed calls, notifications, etc. SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact and separation with the mobile phone 100.

[0097] Understandable Figure 2 The components shown do not constitute a specific limitation on the mobile phone. A mobile phone may include more or fewer components than shown, or combine some components, or separate some components, or have different component arrangements. In the following embodiments, [the following text is incomplete and likely refers to a different embodiment]. Figure 2 The following is an introduction using the mobile phone 100 shown as an example.

[0098] The software system of the aforementioned mobile phone 100 can adopt a layered architecture, including event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of the mobile phone 100. It should be understood that the system in this application embodiment can also be the HarmonyOS system, and this application does not limit it in this regard.

[0099] Figure 3A This is a software structure block diagram of a mobile phone 100 according to an embodiment of this application. The layered architecture divides the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system, from top to bottom, consists of the application layer, application framework layer, Android runtime (ART) and native C / C++ libraries, Hardware Abstraction Layer (HAL), and kernel layer.

[0100] The application layer can include a series of application packages. For example... Figure 3A As shown, applications such as music and Huawei Video can be installed within the application layer.

[0101] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0102] like Figure 3A As shown, the application framework layer may include a window manager, activity manager, content provider, view system, resource manager, notification manager, input manager, etc.

[0103] The window manager provides Window Manager Service (WMS), which can be used for window management, window animation management, surface management, and as a relay station for the input system.

[0104] The Activity Manager Service (AMS) can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers), as well as manage and schedule application processes.

[0105] AMS can include a Service module and a proxy center module. The Service module is used to provide services corresponding to applications at the application layer.

[0106] The proxy center module is used to stop an application's service before it switches from foreground to background and its state changes to hibernation. Alternatively, for inter-application access scenarios, if the initiating application is a background application, the proxy for the accessed application sends a notification message to the initiating application, instructing it not to wake up the accessed application. Or, in inter-application access scenarios, if the initiating application is a foreground application and the accessed application is in hibernation, the proxy for the accessed application sends a notification message to the initiating application.

[0107] Content providers store and retrieve data, making that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, etc.

[0108] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0109] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0110] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0111] The Input Manager Service (IMS) provides input management services, which can be used to manage system inputs such as touchscreen input, keypad input, and sensor input. IMS retrieves events from input device nodes and, through interaction with the WMS (Windows Management System), distributes these events to appropriate windows.

[0112] The Android runtime consists of the core libraries and the Android runtime itself. The Android runtime is responsible for converting source code into machine code. The Android runtime primarily employs ahead-of-time (AOT) compilation and just-in-time (JIT) compilation techniques.

[0113] The core library primarily provides basic Java class library functionalities, such as libraries for fundamental data structures, mathematics, I / O, tools, databases, and networking. It also provides APIs for users to develop Android applications.

[0114] Native C / C++ libraries can include multiple functional modules. Examples include: surface manager, media framework, libc, OpenGL ES, SQLite, Webkit, etc.

[0115] The Surface Manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The Media Framework supports playback and recording of various common audio and video formats, as well as still image files. The Media Library supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. OpenGL ES provides drawing and manipulation of 2D and 3D graphics in applications. SQLite provides a lightweight relational database for applications on the electronic device.

[0116] The Hardware Abstraction Layer (HAL) runs in user space, encapsulates kernel-level drivers, and provides calling interfaces to higher layers. The HAL can include modules such as display, audio, and Bluetooth.

[0117] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0118] like Figure 3B The diagram shown is a schematic representation of a software module provided in an embodiment of this application. (See attached image.) Figure 3B As shown, it may specifically include an application state module, a proxy execution module, and a decision module. In some embodiments, when application A switches from a foreground application to a background application, it can first execute an application service stop operation through the proxy center module, call back the application service lifecycle, and then the application enters the hibernation state. As a result, when service detection is performed after T2 time (e.g., 1 minute) after application A switches to the background, the application service will not be detected, so application A will not be woken up.

[0119] In other embodiments, when application B accesses the service of application A, it can be determined whether application A has a process. If application A does not have a process, the application can be controlled through auto-start / associated start. If application A has a process, the decision module determines whether to allow application B to access it based on the state of application A. If the state of application A is hibernation, the proxy center module returns a notification message to application B on behalf of application A's service.

[0120] It should be understood that when an application has no processes, it can be understood as being in a dead state, and when an application has processes, it can be understood as being in a running state or a hibernation state. Figure 3B The agent execution module and decision module in the diagram shown can be understood as: Figure 3A The agent center module consists of two parts.

[0121] The following examples are applied to Figure 2 The architecture shown in the mobile phone 100 will be used as an example for description.

[0122] Furthermore, the at least one mentioned in the following embodiments includes one or more; wherein, "more" means two or more. Additionally, it should be understood that in the description of this application, terms such as "first" and "second" are used only for descriptive purposes.

[0123] Application wake-up can occur for various reasons, such as service wake-up, broadcast wake-up, data access wake-up, and user-initiated wake-up. Among these, service wake-up accounts for the largest proportion, meaning that applications are mostly woken up by services. For example, when an application switches from the foreground to the background and runs for a period of time, the service stopping will also wake up the application, which can affect the functionality and performance of electronic devices. Based on this, the following embodiments of this application mainly address the problem of applications being woken up by services.

[0124] For example, an electronic device, such as a mobile phone, Figure 4 As shown, suppose the phone displays the Huawei Video application interface 400, which is currently in the foreground. If the user swipes upwards along the bottom edge of the screen on interface 400, the phone will respond to the swipe, exiting the Huawei Video application interface 400 and returning to the main interface 410. The user can then tap the Notes application icon 411 on the main interface 410. The phone will respond to this tap, displaying the Notes application interface 420, which is now in the foreground and the Huawei Video application is in the background. Therefore, to stop the Huawei Video application service without waking it up, the action must be taken while the application is in the running state. This will stop the application service without waking it up.

[0125] And based on Figure 1B As the introduction states, when the Huawei Video application switches from the foreground to the background, the application is in the running state. Therefore, this period of the Huawei Video application's running state can be effectively utilized to call back the service's lifecycle during this period and execute the operation to stop the Huawei Video application service. This does not require waking up the application, which can reduce the number of times the application is woken up, reduce power consumption, and improve the performance of electronic devices.

[0126] like Figure 5 The diagram shown is a flowchart of a service termination method provided in an embodiment of this application. (See attached document.) Figure 5 As shown, the method may include the following steps:

[0127] S501: The electronic device responds to the first operation by switching the first application to a background application.

[0128] In some embodiments, the electronic device may launch a first application in response to a user's operation, where the first application is a foreground application. The operation of launching the first application may be a user clicking the application icon of the first application, or it may be a user launching the first application via voice triggering, etc., and this application does not limit the scope of the operation.

[0129] When the first application is in the foreground, the user can switch it to run in the background using a first operation, effectively turning it into a background application. For example, the first operation could be opening a second application, or it could be switching the current interface back to the main interface, etc. Figure 4 For example, assuming the first application is the Huawei Video application, the first operation can be a swipe operation where the user slides upwards along the bottom of the phone screen on the interface 400.

[0130] It should be understood that when the first application is in the foreground, the user can respond to the second operation and open the second application. At this time, the second application can be in the foreground, and the first application switches to the background.

[0131] S502: When the electronic device detects that the duration for which the first application has been switched to the background has reached a first duration, it stops the service of the first application.

[0132] In this embodiment of the application, to avoid the application being woken up due to service interruption after switching to the background, the service of the first application can be stopped after the first application switches to the background application and while the application's state is running. That is, the service of the first application can be stopped at any time during the running state of the first application. Assuming that the time when the service of the first application is stopped is recorded as "the first moment", then the duration after the first application switches to the background application can be recorded as "the first duration".

[0133] In some embodiments, when the first application switches from a foreground application to a background application, the proxy center module can call back the lifecycle of the first application's service and stop the first application's service when a first duration has elapsed. The proxy center module can then notify the first application that its service has stopped, enabling the first application to perform other operations after the service has ceased.

[0134] Since an application may offer multiple services, not all of them need to be stopped. Stopping some services might render the application unusable. For example, in a music application, if the service for playing music stops, music cannot be played. Therefore, as a preferred implementation, when the electronic device detects that the first application has been switched to the background for a certain duration, it can selectively stop the services of the first application. In other words, only some services of the first application can be stopped. In some embodiments, the electronic device can decide whether to stop a service based on the service type of the application. For example, if the application's service type is a foreground service, the service is not stopped; if the application's service type is a background service, the service is stopped. For instance, users may perceive that foreground services such as downloading, playing music, recording, and navigation do not need to be stopped.

[0135] As another possible implementation, users can configure which applications' services need to be stopped and which do not, based on their own needs. For example, users can set up blacklists and whitelists, where the whitelist includes applications that do not need to have their services stopped, and the blacklist includes applications that do need to have their services stopped.

[0136] As another possible implementation, users can also configure which application services can be stopped and which do not need to be stopped. For example, an application service selection interface can be provided to users, allowing them to choose which services to stop and / or which services do not need to be stopped.

[0137] In this embodiment, when the application has been switched to the background for a certain period of time, the application's service lifecycle can be called back to stop the application service. Since the application is still in the running state at this time, i.e., not yet in the hibernation state, the onDestroy method of the service lifecycle is called back before hibernation to stop the service, thus avoiding the need to wake up the application. Figure 1A To illustrate this process, let's assume the application switches from the foreground to the background, and the service is in the `onStartCommand()` state. If the service needs to be stopped before the application hibernates, a callback to the service's lifecycle is required to stop the service. Since the application is in the `running` state at this point, it doesn't need to be woken up. The service only needs to run from the `onStartCommand()` state to the `onDestroy()` state to stop.

[0138] Optionally, in this embodiment, after an application switches from the foreground to the background, it may switch from the running state to the hibernation state after a period of time. However, some applications may not switch from the running state to the hibernation state after running in the background for a while. For example, a music application may not switch from the running state to the hibernation state after switching from the foreground to the background. If a music application is in the hibernation state, music cannot continue to play.

[0139] Assuming that the first application switches from the running state to the hibernation state after switching to the background application, as a possible implementation, the following steps can be performed after S402:

[0140] S503: When the electronic device detects that the duration for which the first application has been switched to the background has reached a second duration, it switches the state of the first application from the first state to the second state.

[0141] In this embodiment, for ease of description, the running state can be denoted as "first state," the hibernation state as "second state," the duration from when the application switches to the background to when the service stops as "first duration," the duration from when the first application switches to the background to when the application's state switches to the hibernation state as "second duration," and the duration from when the application switches to the background to when service detection is performed as "third duration." For example, as shown... Figure 6 The diagram illustrates the changes when an application switches to the background, as provided in an embodiment of this application. Assume the application switches from the foreground to the background at point A, and then the application service is stopped at point B. After switching to the background, the application can be suspended at point C and background service checks can be performed at point D. Therefore, the first duration is... Figure 6 The first duration can be the time elapsed from when the application switches to the background until it stops serving. The second duration can be the time elapsed from when the application switches to the background until it is in a suspended state. The third duration can be the time elapsed from when the application switches to the background until it performs background service checks. Since the service termination operation is performed when the application is in the running state, the application state is running between points A and C, and hibernation between points C and D. It should be understood that the first, second, and third durations are not specifically limited in this embodiment.

[0142] For example, assuming that in existing technology, after an application switches to the background, it enters the hibernation state after 10 seconds, this embodiment can stop the application's service 5 seconds before 10 seconds, and then switch the application's state to the hibernation state after 10 seconds. For example, if application A switches from the foreground to the background, its service can be stopped 5 seconds after switching, and then the application's state can be switched to the hibernation state after 5 seconds of service stoppage. Of course, the first duration can also be 6 seconds, 3 seconds, 1 second, 0 seconds, or other times, as long as the first duration is less than the second duration (10 seconds).

[0143] S504: The electronic device triggers background service detection after detecting that the duration of the first application being switched to a background application has reached the third duration.

[0144] In this embodiment, after the first application switches to the hibernation state, a background service detection process can be triggered after a certain period of time. For example, assuming the third period is 1 minute, the second period is 10 seconds, and the first period is 6 seconds, the first application can perform service detection 50 seconds after the hibernation state. Of course, the timing of service detection can be when the first application has been switching from the foreground to the background for 1 minute, or after the first application has been switching from the foreground to the background for 1 minute, or before the first application has been switching from the foreground to the background for 1 minute; this application does not specifically limit this.

[0145] Using the above method, electronic devices can stop the application's service in advance after the application is switched to the background and before the application state switches to hibernation. This ensures that the service is not detected during service detection, thus preventing the background application from being woken up. This reduces the number of times the application is woken up due to the service, lowers the power consumption of the electronic device, and improves performance.

[0146] It should be noted that, Figure 5 The method of the illustrated embodiment is to stop the application's service when the application is in a running state, thereby reducing the power consumption of the electronic device. In one possible implementation, after the application switches from a foreground application to a background application, the user can also decide whether to use the method of this application embodiment. For example, a switch can be set on the electronic device; if the user turns on the switch, the method of this application embodiment is not used by default; if the user does not turn on the switch, the method of this application embodiment is used by default. Alternatively, a prompt message can be displayed, which the user can use to determine whether to use the method of this application embodiment, such as "Do you want to turn on the power reduction switch?". It should be understood that the above examples are only illustrative and this application is not limited thereto.

[0147] The above describes how, after an application switches to the background, it may be woken up by other applications in conjunction with service detection, in addition to being woken up by service detection. For example, when application A accesses application B, if application B is in a hibernation state, it may wake application A from the hibernation state to the running state. To avoid this situation, in this embodiment, if application B accesses application A and certain conditions are met, application B is not allowed to wake up application A. For example, a proxy center module can send a message to application B on behalf of application A, disallowing wake-up. This way, application B will not wake up application B when accessing application A. The conditions can be that application B's application state is hibernation or dead, or application A is a background application.

[0148] One possible implementation is that users can set conditions, or in other words, users can set permissions for inter-application access (or wake-up). For example, a user can set all background applications to prevent application B from waking up, or they can set applications A and C to prevent application B from waking up, and regardless of whether applications A and C are foreground or background applications, they cannot wake up application B, etc.

[0149] As another possible implementation, when application A accesses application B, a prompt message can be displayed on the electronic device's screen, asking the user whether they agree to application A's access to application B. If the user agrees (for example, by clicking the "Yes" button), application A can access application B; if the user disagrees (for example, by clicking the "No" button), application A cannot access application B.

[0150] Considering that user privacy may be leaked when applications access each other, in order to improve security, when application B accesses application A, it can be prevented from accessing application A. For example, the proxy center module can send a message to application B that does not allow access, i.e., deny access, on behalf of application A, so that application B will not be able to access application A.

[0151] For example, such as Figure 7 The diagram shown is a flowchart of an application access method provided in an embodiment of this application. (See also...) Figure 7 As shown, the method may include the following steps:

[0152] S701: The electronic device detected that the first application was accessed by the second application.

[0153] For ease of description, in this embodiment, the application being accessed can be referred to as "first application" and the application initiating the access can be referred to as "second application".

[0154] In this embodiment, when the first application is accessed by the second application, it may include the access of a second service of the first application by the second application. It should be understood that the second service refers to any one of the multiple services of the first application. Specifically, when it is detected that the second application accesses the first application through startService() or bindService(), it can be determined that the second application intends to access a service of the first application.

[0155] In some embodiments, the inter-application access relationships are pre-configured. That is, which applications can be accessed, and which applications can access other applications, are pre-written logic code. For example, the inter-application access relationships can be seen in Table 1 below.

[0156] Table 1

[0157]

[0158] It should be understood that Table 1 above is merely illustrative. In practical applications, some applications can access all other applications except themselves, some applications can only access some other applications besides themselves, or some applications cannot access other applications at all. Furthermore, the access relationship between applications can be unidirectional or bidirectional, and this application does not limit this.

[0159] S702: The electronic device determines whether the second application is a background application. If the second application is a background application, then execute S604; if the second application is a foreground application, then continue to execute S703.

[0160] In this embodiment, if the application initiating the access is a background application, since the user is unaware that a background application is accessing other applications, it can be directly proxied without sending a wake-up message to the accessed application, thus avoiding waking up the accessed application. If the application initiating the access is a foreground application, then the state of the accessed application needs to be considered to determine whether to perform a proxy.

[0161] Specifically, when a second application tries to access the first application, it can send an access request message to the first application. The electronic device can then use the proxy center module at the application framework layer to determine whether the second application is a background application. If the second application is a background application, the proxy center module, on behalf of the first application, returns a notification message to the second application, informing it that the first application's service is no longer available. In this way, the second application cannot access the first application when it is in the background, thus protecting user privacy and improving user experience.

[0162] S703: The electronic device determines whether the state of the first application is hibernation. If the state of the first application is hibernation, then S704 is executed; if the state of the first application is not hibernation, then the second application accesses the service of the first application.

[0163] S704: The agent center module of the electronic device sends a notification message to the second application.

[0164] Specifically, when the second application is a foreground application, the proxy center module can send an application status query request message to the system. This message can include the package name (or identifier) ​​of the first application, allowing the system to query its application status. Correspondingly, the system sends the first application's status to the second application. If the first application's status is hibernation, the proxy center module, acting on behalf of the first application's services, sends a notification message to the second application, informing it that waking up the first application is not permitted.

[0165] As one possible implementation, the notification message sent by the proxy center module to the second application may include a spoofed value, which is used to indicate that the service of the first application does not exist. For example, assuming that "0" represents that the application's service does not exist and "1" represents that the application's service exists, then when the second application receives a notification message sent by the proxy center module with a spoofed value of "0", it means that the service of the first application does not exist.

[0166] As another possible implementation, the proxy center module can proxy the services of the first application and send notification messages to the second application to inform the second application that the services of the first application do not exist, so that the second application will not wake up the first application when accessing the first application.

[0167] As another possible implementation, the proxy center module can proxy the services of the first application and send a notification message to the second application, informing it that it does not have permission to access the services of the first application. This way, the second application will not access the first application and thus will not wake up the first application. It should be noted that "the second application does not have permission to access the services of the first application" can include the second application not having permission to access the services of the first application under any circumstances, or the second application not having permission to access the services of the first application under a specific scenario, such as the second application not having permission to access the services of the first application during this particular access.

[0168] Furthermore, as a possible implementation, the proxy center module can proxy the services of the first application and send notification messages to the second application through a third application. The third application can be a dedicated application that interacts with the proxy center module. In other words, notification messages can be forwarded to the second application through the third application.

[0169] It should be understood that the above conditions can be used individually or in combination, and the embodiments of this application are not limited to the above judgment conditions. For example, in S702, it is determined whether the application initiating the access is a background application. In actual applications, this judgment condition may not be necessary. If the user has set up a blacklist and a whitelist, and the blacklist includes application identifiers that are not allowed to access other applications, then as long as the application identifier of the application initiating the access is in the blacklist, it cannot access other applications, etc.

[0170] In this way, the proxy center module proxies the services of the accessed application, so that when the application that initiates the access requests to the accessed application, the accessed application does not receive the access request message sent by the application that initiates the access, thus preventing the accessed application from being woken up and reducing power consumption.

[0171] The methods provided in the embodiments of this application above are described from the perspective of an electronic device as the executing entity. To implement the functions of the methods provided in the embodiments of this application above, the electronic device may include hardware structures and / or software modules, implementing the above functions in the form of hardware structures, software modules, or a combination of hardware structures and software modules. Whether a particular function is executed in the form of hardware structures, software modules, or a combination of hardware structures and software modules depends on the specific application and design constraints of the technical solution.

[0172] like Figure 8 As shown, other embodiments of this application disclose an electronic device, which may be an electronic device with a display screen. See also... Figure 8 As shown, the electronic device 800 includes: a display screen 801; one or more processors 802; one or more memories 803; one or more sensors 804 (not shown in the figure); multiple applications 805 (not shown in the figure); and one or more computer programs 806 (not shown in the figure). The above devices can be connected via one or more communication buses 807.

[0173] The display screen 801 is used to display the interface of the application in the electronic device or to display prompt information. The memory 803 stores one or more computer programs, each including instructions; the processor 802 invokes the instructions stored in the memory 803, causing the electronic device 800 to perform the method described in the above embodiments.

[0174] In this embodiment, the processor 802 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in this embodiment. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment can be directly implemented by the hardware processor, or implemented by a combination of hardware and software modules within the processor. The software modules may reside in the memory 803, and the processor 802 reads the program instructions from the memory 803 and, in conjunction with its hardware, completes the steps of the aforementioned methods.

[0175] In this embodiment, the memory 803 can be non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as RAM. The memory can also be any other medium capable of carrying or storing desired program code in the form of instructions or data structures, and accessible by a computer, but is not limited thereto. The memory in this embodiment can also be a circuit or any other device capable of implementing storage functions, used to store instructions and / or data.

[0176] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0177] Based on the above embodiments, this application also provides a computer storage medium storing a computer program, which, when executed by a computer, causes the computer to perform the method provided in the above embodiments.

[0178] This application also provides a computer program product, including instructions that, when run on a computer, cause the computer to perform the methods provided in the above embodiments.

[0179] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.

[0180] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0181] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

Claims

1. An application access method, characterized in that, include: After the first application switches from the foreground to the background, the service of the first application is stopped; Call back the lifecycle of the service of the first application, and the first application enters a suspended state; The electronic device detects that a second application accesses the services of the first application through a configured interface; When the first application process exists and the first application is in a suspended state, the proxy center module of the application framework layer sends a first notification message to the second application. The first notification message is used to notify the second application that access to the first application is not allowed or to notify the second application that the first application does not exist.

2. The method as described in claim 1, characterized in that, If it is determined that the first application and / or the second application meet the set conditions, a first notification message is sent to the second application, including: If it is determined that the first application and / or the second application meet the set conditions, a first prompt message is displayed. The first prompt message is used to prompt the user to confirm whether to allow the second application to access the services of the first application. In response to the first operation, a first notification message is sent to the second application, wherein the first operation is a user's triggering of the negative button; or When the first prompt message has been displayed for a preset duration, a first notification message is sent to the second application.

3. The method as described in claim 1, characterized in that, The first notification message includes a spoofing value, which is used to indicate that the service of the first application does not exist.

4. The method as described in claim 1, characterized in that, The specified interface is either the startService interface for starting a service or the bindService interface for binding a service.

5. The method as described in any one of claims 1 and 4, characterized in that, After the electronic device detects that a second application accesses a first application through a designated interface, the method further includes: The electronic device determines that the first application is in process.

6. An electronic device, characterized in that, The electronic device includes a display screen; one or more processors; one or more memories; one or more sensors; multiple applications; and one or more computer programs. The one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when invoked and executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1 to 5.

7. A computer-readable storage medium storing instructions, characterized in that, When the instructions are executed on an electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • A method and apparatus for managing application calls

    CN106537344A

  • Application permission management method, device and equipment and storage medium

    CN111523136A