Application starting method and device
By reusing tasks to embed the target application's screen into the Android operating system, the problem of the target application crashing was solved, and the application's running efficiency was improved.
Patent Information
- Application Number
- CN202410756789.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-12
- Publication Date
- 2025-12-19
AI Technical Summary
In the Android operating system, embedding the screen of a target application into a target view may cause some applications to crash or display abnormalities.
By reusing tasks, the screen of the target application can be displayed in the window of another application, avoiding the simultaneous running of multiple target application tasks, thereby reducing display anomalies such as crashes.
It reduces display errors caused by launching the target application and improves the application's running efficiency.
Smart Images

Figure CN121166239A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to an application launch method and apparatus. Background Technology
[0002] To improve application performance, electronic devices can display the target application's screen in a non-full-screen format. For example, this could be done as a floating window, or by embedding the target application's screen within the target view of another application's window.
[0003] In this method, by embedding the target application's screen within a target view, users can control the target application not only through input on its screen but also through input on another application, providing a superior user experience. Currently, in the Android operating system, when embedding the target application's screen within a target view, the electronic device can create a new task and launch the target application's activity within that task. This allows the electronic device to display the target application's screen within the target view by setting the layer corresponding to the new task as a child node of the layer corresponding to the target view.
[0004] However, this method may cause some applications to crash or display abnormalities. Summary of the Invention
[0005] This application provides an application launch method and apparatus, applicable to the field of terminal technology. It enables the display of a target application's screen within the window of another application by reusing tasks, helping to reduce display anomalies such as app crashes caused by launching the target application.
[0006] In a first aspect, embodiments of this application propose an application startup method. The method includes: when an electronic device is running a first task of a first application in the background, the electronic device receives a first operation from a user to open a first function; in response to the first operation, the electronic device displays a first interface of a second application and runs the first task in a first view of the first interface, wherein a first activity at the top of the stack in the first task corresponds to the first function, and the first task is a child node of the first view; when the electronic device displays the first interface, the electronic device stops running the first task in the background and runs the first task in the foreground.
[0007] In this context, the first application can be social application 1 (described below), the first function can be the payment code function of application 1, the first activity can be activity a1 of application 1, and the first task can be task a-1 of application 1. The second application can be the quick code display application (described below), and the first interface of the second application can be... Figure 12In the interface (a), the first view can be view 1202 as described below. The first operation can be the operation of opening the first function of the first application through the second application, such as tapping the screen or double-tapping the icon of the quick code application as described below.
[0008] The application launch method of this application, since the first activity is launched by reusing the first task running in the background, stops the first task running in the background when the electronic device displays the first interface. This prevents the electronic device from running multiple first tasks of the first application simultaneously, thus avoiding the situation where multiple first tasks contain separate first activities, allowing the first activity to exist as a single instance. This reduces display anomalies such as application crashes caused by the limitation that the first activity can only exist as a single instance.
[0009] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the electronic device displays the first interface, the electronic device receives a second operation from the user to open the second function; in response to the second operation, the electronic device switches the first interface to the second interface of the second application, and runs a first task in the second view of the second interface, wherein the second activity at the top of the stack in the first task corresponds to the second function, and the first task is a child node of the second view.
[0010] The second function can be the scan function of application 1 (described below), the second activity can be activity a2 of application 1, and the first task can be task a-1 of application 1. The second interface of the second application can be... Figure 12 In the interface (b), the second view can be view 1203. The first operation can be clicking. Figure 12 The interface (a) includes a scan button, etc.
[0011] It should be understood that the second activity is initiated by the first task running in the foreground when the electronic device displays the first interface. Compared to when the electronic device displays the first interface, when the electronic device displays the second interface, the activity at the top of the stack in the first task is updated from the first activity to the second activity, and the parent node of the first task is updated from the first view to the second view.
[0012] In this way, the electronic device can display different screens of the first application in different views of the second application.
[0013] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the electronic device is running the first task in the foreground, the electronic device is running the second task of the third application in the background; when the electronic device displays the first interface, the electronic device receives a third operation from the user to open the third function; in response to the third operation, the electronic device switches the first interface to the third interface of the second application and runs the second task in the third view of the third interface, wherein the third activity at the top of the stack in the second task corresponds to the third function, and the second task is a child node of the third view; when the electronic device displays the third interface, the electronic device stops running the second task in the background and runs the second task in the foreground, while the electronic device runs the first task in the background.
[0014] The third application can be the payment application 2 mentioned below, the third function can be the payment code function of application 2, the third activity can be activity a3 of application 2, and the second task can be task a-2 of application 2. The third interface of the second application can be... Figure 12 In the interface (c), the third view can be view 1204. The third operation can be a third function that opens a third application through the second application, for example, in... Figure 12 In the interface (a), after clicking the edit button, select the payment code function of application 2, etc.
[0015] Optionally, when the electronic device displays the third interface, the first task can run in the background in either an embedded or non-embedded state. When the first task runs in the background in an embedded state, its parent node is none; when the first task runs in the background in a non-embedded state, its parent node is the default task display area. Furthermore, when the first task runs in the background in a non-embedded state, it can run in full-screen mode or in a mode that reuses its previous form. Reusing the previous form refers to the form of the first task when the electronic device receives the first operation.
[0016] Optionally, when the electronic device displays the third interface, the background display interface of the first task can be either the interface corresponding to the first function or the display interface before reusing the first task. The display interface before reusing the first task is the display interface of the first task when the electronic device receives the first operation. The display interface of the first task can also be understood as the display interface provided by the first task, or the interface displayed by the electronic device by running the first task. For example, before reusing the first task, the display interface of the first task is a chat interface; the interface corresponding to the first function is a payment code interface. Therefore, when the electronic device displays the third interface, the background display interface of the first task can be either the chat interface or the payment code interface.
[0017] It should be understood that the third activity is initiated by the second task running in the background when the electronic device displays the first interface. Compared to when the electronic device displays the first interface, when the electronic device displays the second interface, the first task running in the first view switches to background operation, and the second task running in the background switches to foreground operation.
[0018] In this way, the electronic device can display the screens of different applications in different views of the second application, resulting in higher application operating efficiency.
[0019] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the electronic device displays the first interface, the electronic device receives a fourth operation from the user to close the first function; in response to the fourth operation, the electronic device switches the first interface to the fourth interface; when the electronic device displays the fourth interface, the electronic device runs the first task in the background in full-screen mode, and the parent node of the first task is updated from the first view to the default task display area.
[0020] The fourth operation can be in Figure 12 In the interface (a), click on the blank area in window 1201 or click the return button above view 1202, etc.
[0021] In one scenario, the fourth interface can be the interface of the second application. The difference between the fourth and first interfaces is that the fourth interface does not display the screen corresponding to the first function. Instead, the rectangular area corresponding to the first view in the fourth interface can display a blank layer or a view related to the second application. For example, the fourth interface could be: window 1201 includes view 1202, but view 1202 does not display the screen corresponding to the payment code function of application 1. View 1202 could, for example, display a blank layer or a view related to the quick code display application. That is, compared to... Figure 12 The difference between interface (a) and view 1202 is that view 1202 displays a blank layer or a related view of the quick code application.
[0022] In another scenario, the fourth interface could be the interface of another application, such as the desktop.
[0023] Optionally, when the electronic device displays the fourth interface, the electronic device can also run the first task in the background in other forms. For example, it can run in the background in the form prior to reusing the first task. For instance, if the form prior to reusing the first task is a floating window, then when the electronic device displays the fourth interface, the electronic device runs the first task in the background as a floating window.
[0024] It should be understood that when an electronic device displays a fourth interface, compared to the first interface displayed on the first electronic device, the first task is switched from the foreground to the background, and the parent node of the first task is updated from the first view to the default task display area.
[0025] This allows the first task embedded in the first view to be switched to a non-embedded state and run in the background. In response to a user's view of the multitasking card, the multitasking card can include a card for the first application, which is displayed by the first task running in the background in a non-embedded state. Furthermore, the content displayed on the first application's card can be the screen corresponding to the first function, such as the screen corresponding to the payment code function of application 1.
[0026] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the electronic device displays the first interface, the electronic device receives a fifth operation from the user to close the second application; in response to the fifth operation, the electronic device switches the first interface to the fifth interface; when the electronic device displays the fifth interface, the electronic device runs a first task in the background, and the parent node of the first task is updated from the first view to none.
[0027] The fifth interface can be the interface of another application. For example, the fifth operation could be the user closing the second application, such as double-clicking a blank area in window 1201, or clicking a button to close window 1201. The fifth interface could be the desktop (e.g., the desktop is displayed after the electronic device executes S1713). The fifth operation could also be launching another application, such as clicking a notification message to launch another application, for example, a shopping application. Therefore, when the electronic device displays the first interface, if it displays a notification message from a shopping application on top of the first interface, in response to the user clicking the notification message, the electronic device displays the fifth interface of the shopping application.
[0028] It should be understood that when an electronic device displays a fifth interface, compared to the first interface, the first task switches from the foreground to the background, and the parent node of the first task is updated from the first view to none; that is, the first task remains embedded. At this time, in response to the user's operation of viewing multitasking cards, the multitasking cards can include the card of the first application running in the background (the card displayed through the first task running in the background). Because the first task is embedded, the card of the first application can be different from the card of applications in non-embedded states. For example, the size and / or position of the card of the first application may differ from those of applications in non-embedded states. Here, the non-embedded state application refers to the application whose task is not embedded.
[0029] In this way, when the user closes the second application, the first task embedded in the first view can still switch to background operation in an embedded state. This makes it more efficient for the electronic device to embed the first task into the view of other applications the next time.
[0030] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the electronic device is running the first task in the background and the parent node of the first task is none, the electronic device receives a sixth operation from the user to open the fourth function; in response to the sixth operation, the electronic device displays the sixth interface of the first application in full screen by running the first task, wherein the fourth activity at the top of the stack in the first task corresponds to the fourth function, and the parent node of the first task is the default task display area; when the electronic device displays the sixth interface, the electronic device stops running the first task in the background and runs the first task in the foreground.
[0031] The sixth operation could be clicking the icon of application 1 in S1714, the fourth function could be the payment code function, and the fourth activity could be an activity corresponding to the payment code function, such as activity a1 in the following text. Correspondingly, the sixth interface is the interface corresponding to the payment code function. Alternatively, the sixth operation could be sharing a link to the chat interface of application 1 in a short video application, the fourth function could be the chat function, and the fourth activity could be an activity corresponding to the chat function. Correspondingly, the sixth interface is the chat interface. Alternatively, the sixth operation could be clicking the pop-up window of application 1, the fourth function could be the chat function, and the fourth activity could be an activity corresponding to the chat function. Correspondingly, the sixth interface is the chat interface.
[0032] It should be understood that the fourth activity is started by reusing the first task running in the background. Compared to the electronic device running the first task in the background, where the parent node of the first task is none, when the electronic device displays the sixth interface, the first task switches from the background to the foreground, and the parent node of the first task changes from none to the default task display area. Furthermore, the activity at the top of the stack in the first task corresponds to the fourth function. The fourth activity can be the first activity or an activity of other first applications.
[0033] In this way, when the first task is running in the background in an embedded state, it can also switch to a non-embedded state to run in the foreground in response to user operations.
[0034] Alternatively, the sixth interface can also be displayed in the form of a split screen or a floating window. For example, if the sixth operation instruction is used to launch the fourth function of the first application in the form of a split screen or a floating window, the electronic device can display the sixth interface in the form of a split screen or a floating window.
[0035] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the electronic device displays the first interface, the electronic device receives a seventh operation from the user to open the fifth function; in response to the seventh operation, the electronic device switches the first interface to the seventh interface of the fourth application, and runs the first task in the fourth view of the seventh interface, wherein the fifth activity at the top of the stack in the first task corresponds to the fifth function, and the first task is a child node of the fourth view; when the electronic device displays the seventh interface, the first task is not running in the background of the electronic device, and the first task running in the first view when the electronic device displays the first interface runs in the fourth view.
[0036] The fifth function can be the scan function of Application 1 (described below), and the fifth activity can be an activity corresponding to the scan function of Application 1, such as activity a2 (described below). The seventh operation can be the operation of opening the scan function of Application 1 through the smart assistant (described below). The fourth application can be the smart assistant. The fourth view can be view 505 in method 1600. The seventh interface can be the interface provided by method 1600. Figure 12 (b) The seventh interface jumps to another interface. Figure 5 The interface (b) is similar to the seventh interface. Figure 5 The difference between interface (b) and the previous one is that view 505 is displayed in window 501, and view 505 displays... Figure 12 The screen corresponding to the scan function of application 1.
[0037] It should be understood that the seventh activity is started by reusing the first task running in the foreground. Compared to when the electronic device displays the first interface, when the electronic device displays the seventh interface, the activity at the top of the stack in the first task is the fifth activity, which may be the same as or different from the first activity. Furthermore, the parent node of the first task is updated from the first view to the fourth view.
[0038] In this way, the first task of the first application can be switched from the view embedded in the second application to the view embedded in the fourth application. That is, the screen of the first application can be embedded in different applications.
[0039] In conjunction with the first aspect, in some implementations of the first aspect, the first interface is displayed by the electronic device through the fourth task of running the second application; or, the first interface is displayed in a first window, the first window being created by a service of the second application, the service of the second application running in the background of the electronic device.
[0040] The second application can be the quick code display application mentioned below, and the fourth task can be task b mentioned below. The first window can be window 1201 mentioned below. The service of the second application can be started after the electronic device is powered on.
[0041] With the second application running in the background of the electronic device, the second application can run in the background for a long time and can respond to user operations in a timely manner, embedding the screen of the first application into the view of the first window.
[0042] In conjunction with the first aspect, in some implementations of the first aspect, the electronic device displays a first interface of the second application and runs a first task in a first view of the first interface, including: the electronic device creates a first window of the second application and sets a first view in the first window, and the first interface is displayed in the first window; the electronic device sets the first task running in the background to run in the foreground and starts a first activity in the first task; and sets the parent node of the first task as the first view.
[0043] In this way, the first task can run in the first view, and the electronic device can display the first interface.
[0044] It should be understood that the implementation of this scheme is similar to the implementation of S1401 to S1410, and can be referred to the description below.
[0045] In conjunction with the first aspect, in some implementations of the first aspect, the electronic device sets a first task running in the background to run in the foreground, including: when the first information is set in the first flag bit, the electronic device sets the first task running in the background to run in the foreground, and the first information is used to indicate that the first activity is started in the manner of reusing the task.
[0046] The first flag bit can be option 4 set in S1404, and the first information can be information used to indicate that activity a1 is started in the manner of reusing a task.
[0047] In this way, based on the initial information, the activity task management module can start the first activity by reusing tasks.
[0048] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the first task is running in the first view, the electronic device receives a second operation from the user to open the second function; in response to the second operation, the electronic device sets the second view in the first window and removes the first view; the electronic device launches a second activity of the first application in the first task, the second activity corresponding to the second function; the electronic device sets the parent node of the first task from the first view to the second view.
[0049] In this way, the electronic device can reuse the first task running in the first view to launch the second activity, and by setting the parent node of the first task, the first task can run in the second view. This allows the electronic device to switch from the first interface to the second interface.
[0050] It should be understood that the implementation of this scheme is similar to the implementation of S1411 to S1422, and can be referred to the description below.
[0051] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the first task is running in the first view, the electronic device runs a second task of the third application in the background, and the electronic device receives a third operation from the user to open a third function; in response to the third operation, the electronic device sets a third view in the first window and removes the first view; the electronic device sets the second task to run in the foreground and starts a third activity of the third application in the second task, the third activity corresponding to the third function; the electronic device sets the parent node of the first task to none and returns the first task to run in the background; the electronic device sets the parent node of the second task to the third view.
[0052] In this way, for the second application, the first task of running the first application in the first view is switched to the second task of running the third application in the third view. Furthermore, the first task of the first application is switched from running in the foreground in the first view to running in an embedded state in the background; the second task is switched from running in the background to running in the foreground in the third view. This allows the electronic device to switch from the first interface to the third interface.
[0053] It should be understood that the implementation of this scheme is similar to the implementation of S1501 to S1515, and can be referred to the description below.
[0054] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the first task is running in the first view, the electronic device receives a fourth operation from the user to close the first function; in response to the fourth operation, the electronic device returns the first task to the background in full-screen mode and sets the parent node of the first task from the first view to the default task display area.
[0055] In this way, the electronic device can run the primary task in the background in a non-embedded state. This allows the electronic device to switch from a first interface to a fourth interface, and the primary task can run in the background in full-screen mode.
[0056] It should be understood that the implementation of this scheme is similar to the implementation of S1701 to S1705 (or S1701 to S1708), and can be referred to the description below.
[0057] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the first task is running in the first view, the electronic device receives a fifth operation from the user to close the second application; in response to the fifth operation, the electronic device returns the first task to the background and sets the parent node of the first task from the first view to none.
[0058] In this way, the electronic device can close the second application and run the first task in an embedded state in the background. This allows the electronic device to switch from the first interface to the fifth interface, and in response to the user's operation of viewing the multitasking cards, the electronic device can display the card of the first application, which is displayed through the first task running in an embedded state in the background.
[0059] It should be understood that the implementation of this scheme is similar to the implementation of S1709 to S1713, and can be referred to the description below.
[0060] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: when the electronic device is running the first task in the background and the parent node of the first task is none, the electronic device receives a sixth operation from the user to open the fourth function; in response to the sixth operation, the electronic device moves the first task from the background to the foreground, starts the fourth activity of the first application in the first task, the fourth activity corresponds to the fourth function, and sets the parent node of the first task from none to the default task display area.
[0061] In this way, the electronic device can switch the first task running in the background from embedded mode to run in the foreground in non-embedded mode. This allows the electronic device to switch from the first interface to the sixth interface. Furthermore, in response to the user's operation of viewing multi-task cards, the electronic device can display the card of the first application, which is displayed through the first task running in the foreground in non-embedded mode.
[0062] It should be understood that the implementation of this scheme is similar to the implementation of S1714 to S1721, and can be referred to the description below.
[0063] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: the method further includes: when the first task is running in the first view, the electronic device receives a seventh operation from the user to open the fifth function; in response to the seventh operation, the electronic device creates a second window of the fourth application and sets the fourth view in the second window; the electronic device starts a fifth activity of the first application in the first task, the fifth activity corresponding to the fifth function; the electronic device removes the first window; the electronic device sets the parent node of the first task from the first view to the fourth view.
[0064] The second window can be window 501 as described below, and the fourth view can be view 505 set in window 501.
[0065] In this way, the electronic device can switch the first task from the view running in the second application to the view running in the fourth application; that is, the interface of the first application can be embedded in the views of different applications. This allows the electronic device to switch from the first interface to the seventh interface.
[0066] It should be understood that the implementation of this solution is similar to the implementations of S1601 to S1612, and can be referred to the description below. In a second aspect, embodiments of this application provide an application launch device, which can be an electronic device, or a chip or chip system within an electronic device. The application launch device may include a data display unit and a processing unit. When the application launch device is an electronic device, the display unit may be a display screen, and the processing unit may be a processor. The application launch device may also include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit to cause the electronic device to implement an object recognition method described in the first aspect or any possible implementation of the first aspect. When the application launch device is a chip or chip system within an electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit to cause the electronic device to implement an application launch method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit within the chip (e.g., a register, cache, etc.), or a storage unit located outside the chip within the electronic device (e.g., a read-only memory, random access memory, etc.).
[0067] For example, a processing unit is used to generate a first interface; a display unit is used to display the first interface.
[0068] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory for storing code instructions, and the processor for running the code instructions to perform the methods described in the first aspect or any possible implementation of the first aspect.
[0069] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program or instructions that, when executed on a computer, cause the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0070] Fifthly, embodiments of this application provide a computer program product including a computer program, which, when run on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation thereof.
[0071] Sixthly, this application provides a chip or chip system including at least one processor and a communication interface. The communication interface and the at least one processor are interconnected via a circuit. The at least one processor is used to run computer programs or instructions to perform the methods described in the first aspect or any possible implementation thereof. The communication interface in the chip can be an input / output interface, pins, or circuits, etc.
[0072] In one possible implementation, the chip or chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip, such as a register or cache, or it can be a storage unit of the chip itself (e.g., read-only memory, random access memory, etc.).
[0073] It should be understood that the second to sixth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description
[0074] Figure 1 This is a schematic diagram used to display images corresponding to an event;
[0075] Figure 2 This is a schematic diagram of a task management activity.
[0076] Figure 3 This is a schematic diagram of a layer that displays activities;
[0077] Figure 4 This is a schematic diagram illustrating a process of initiating an activity by reusing tasks.
[0078] Figure 5 This is a schematic diagram of an interface that embeds application 'a' into a target window;
[0079] Figure 6 This is a schematic diagram of another interface that embeds application 'a' into the target window;
[0080] Figure 7 This is a method of embedding task 'a' into a view by creating a new task. Figure 1 A schematic diagram of the process;
[0081] Figure 8 This is a schematic diagram of a multi-task card;
[0082] Figure 9 This is a method of embedding task 'a' into a view by creating a new task. Figure 1 And exit the embedded view of task a Figure 1 A flowchart;
[0083] Figure 10 The embodiments of this application provide a way to embed task a into the view by reusing tasks. Figure 1 A schematic diagram of the process;
[0084] Figure 11 A schematic diagram of a multi-task card provided in an embodiment of this application;
[0085] Figure 12 A schematic diagram of an interface in which other applications are embedded in the window of the quick code display application provided in the embodiments of this application;
[0086] Figure 13 A schematic block diagram of the software architecture of an electronic device provided in an embodiment of this application;
[0087] Figure 14 A flowchart illustrating the first application startup method provided in this application embodiment;
[0088] Figure 15 A flowchart illustrating the second application launch method provided in this application embodiment;
[0089] Figure 16 A flowchart illustrating the third application launch method provided in this application embodiment;
[0090] Figure 17 A flowchart illustrating the process of exiting the window of the embedded quick code display application provided in the embodiments of this application;
[0091] Figure 18 A schematic block diagram of the hardware architecture of an electronic device provided in an embodiment of this application;
[0092] Figure 19 A schematic block diagram of the hardware architecture of the application launch device provided in the embodiments of this application. Detailed Implementation
[0093] To facilitate a clear description of the technical solutions in the embodiments of this application, some terms and technologies involved in the embodiments of this application will be briefly introduced below:
[0094] 1. Window
[0095] A window is a rectangular area on the screen of an electronic device that can be drawn and interacted with. A window is characterized by accepting input, outputting images, and occupying a rectangular area. The rectangular area occupied by the window is called the window's extent. Images drawn by the electronic device can be displayed within the window's extent. Users can interact with the electronic device based on the images displayed within the window's extent. For example, if the window's extent includes control 1, the user can click on control 1 to cause the electronic device to execute the logic corresponding to control 1.
[0096] 2. View
[0097] It can also be called a surface view or a control. It can refer to a rectangular area within a window. One view can correspond to one rectangular area within a window. Views are used for drawing and event management within their corresponding rectangular areas. Visual layers can be drawn within the rectangular area corresponding to a view, and these visual layers can also be called the layers corresponding to the view.
[0098] 3. Relationship between windows and views
[0099] A window can have a view root. The view root can be a single view or a group of views, which in turn consists of multiple views. Therefore, a window can have one or more views. When a window has multiple views, these views can completely overlap, partially overlap, or not overlap at all. Furthermore, a tree relationship may or may not exist between these views.
[0100] 4. Activity
[0101] Also known as activity components, these are components of an Android application. An Android application can include one or more activities. Application developers can set a view tree for each activity; a view tree consists of one or more views, and one or more views corresponding to an activity can be placed in the activity's window. Each view of an activity can draw visual content, such as controls, allowing users to interact with the electronic device through these visual contents. Alternatively, it can be understood that each of the one or more views corresponding to an activity can draw visual layers, which form the user-visible interface, also known as the screen of that activity.
[0102] It should be understood that in the embodiments of this application, the interface may also be referred to as a screen, and this application does not specifically limit it in this regard.
[0103] For example, such as Figure 1 As shown, the views corresponding to Activity 1 include: View Figure 1 ,See Figure 2 ,See Figure 3 ,See Figure 4 and vision Figure 5 The view corresponding to Activity 1 is set in window 1 of Activity 1. The screen corresponding to Activity 1 includes the view... Figure 1 ,See Figure 2 ,See Figure 3 ,See Figure 4 and vision Figure 5The controls within the interface. These controls can each correspond to different layers, and these layers form the view visible to the user.
[0104] It should be understood that, for the sake of brevity, the one or more views that an application developer sets for an activity will be referred to as the views of that activity in the following text.
[0105] 5. Relationship between activities, windows, and views
[0106] To manage the view of each activity, an electronic device can create a window for the launched activity. In this way, the view of the activity can be set within that window, and the view of the activity can be understood as a child node of that window.
[0107] 6. Task and Activity Stack
[0108] When an electronic device runs an application, it can invoke one or more activities to fulfill user needs. A task can be understood as one or more activities that interact with the user when performing an operation within an application. These activities are arranged in an activity stack according to the order they are opened. Alternatively, a task can be understood as a collection of one or more activities arranged in a stack-like pattern.
[0109] In a task comprising multiple activities, these activities are linked by a sequence, or they can be understood as the task managing these activities according to a Last-In-First-Out (LIFO) rule. That is, the activity added last to the task is at the top of the stack. The electronic device can display the visual content of one or more views of this top-ranked activity, allowing the user to interact with it. Upon receiving user input, such as a back action, the electronic device can remove the top-ranked activity from the stack and display the screen corresponding to the next top-ranked activity, allowing the user to interact with that next top-ranked activity, until no more activities remain in the task, at which point the task ends.
[0110] For example, such as Figure 2 As shown, user input operation 1 is detected, which is used to launch Activity 1 of application 1. In response to input operation 1, the electronic device pushes Task 1 to the foreground or creates a new Task 1, and launches Activity 1 within Task 1. Activity 1 can be, for example, the main activity of application 1, meaning the screen corresponding to Activity 1 is the main interface of application 1. In response to user input operation 2 in the screen corresponding to Activity 1, Activity 1 launches Activity 2, and the electronic device pushes Activity 2 to the top of the stack, giving Activity 2 focus; furthermore, Activity 1 remains in the stack, and Activity 1 retains the state of its corresponding screen. In response to user input operation 3 in the screen corresponding to Activity 2, Activity 2 launches Activity 3, and the electronic device pushes Activity 3 to the top of the stack, while Activity 2 retains the state of its corresponding screen.
[0111] In response to user input operation 4 in the layer corresponding to activity 3, input operation 4 indicates returning to the previous layer, activity 3 at the top of the stack is popped from the top of the stack and destroyed; the electronic device pushes activity 2 to the top of the stack, and the electronic device displays the state of the screen corresponding to activity 2.
[0112] For example, if application 1 is email, activity 1 can be used to display a new email list. When the user selects a new email from the new email list, the electronic device launches activity 2, which displays that new email. After the user has finished viewing the new email, they can click the back button, after which the electronic device can display the new email list corresponding to activity 1.
[0113] It should be noted that, in the embodiments of this application, the electronic device can start an activity by calling onCreate(), for example, calling onCreate() to start activity 2; it can stop an activity by calling onPause(), for example, calling onPause() to stop activity 2 when activity 3 is started; and it can destroy an activity by calling onDestroy(), for example, calling onDestroy() to destroy activity 3. Here, onCreate(), onPause(), and onDestroy() can be understood as callbacks provided by the activity class, or they can be understood as functions or methods; this application does not specifically limit them in this regard.
[0114] 7. The relationship between tasks and activities
[0115] One or more activities included in a task are child nodes of that task; the task is the parent node of those one or more activities.
[0116] As can be seen from the above description of tasks, when an application's task is running in the foreground, the user can interact with the activity at the top of the task's stack. That is, the interface displayed on the electronic device can be the screen corresponding to the activity at the top of the task's stack.
[0117] Since the interface displayed on an electronic device can be composed of multiple layers, from the perspective of the electronic device's display interface, a task running in the foreground of the electronic device, where the user can interact with the activity at the top of the task's stack, can ultimately be represented by layers. In other words, the relationship between tasks and activities, as well as the relationship between activities and views, can ultimately be reflected in the relationships between the task's layers, activity layers, and view layers. Thus, by setting the relationships between the task's layers, activity layers, and view layers, the electronic device can display the screen corresponding to the activity at the top of the stack within the running task.
[0118] Therefore, the relationships between task layers, activity layers, and view layers are explained below. A view layer is a visual layer drawn within the view. An activity layer is a layer created by the electronic device for that activity. A task layer is a layer created by the electronic device for that task. Activity and task layers can be transparent.
[0119] 8. The relationship between task layers, activity layers, and view layers.
[0120] The view's layer is a child node of the active layer, and the active layer is a child node of the task's layer.
[0121] Therefore, changes in the state of a task's layer can lead to changes in the state of the active layer; changes in the state of the active layer can lead to changes in the state of the view's layers. These changes include, but are not limited to, the size and position of the layer.
[0122] It should be understood that the relationship between the task layer, activity layer, and view layer mentioned above is based on the following condition: the activity is within a task, and the view is the view of that activity. For the sake of brevity, this will not be elaborated further below.
[0123] As explained above, when an electronic device has a task running in the foreground, the interface displayed by the device is actually the screen corresponding to the activity at the top of the task's stack. Below, we will explain this from the perspective of layers.
[0124] For example, such as Figure 3 As shown, assume that electronic device 300 is running application a in task 1 in the foreground. Task 1 includes activities A, B, and C. In task 1, activity C is at the top of the stack, activity B is below activity C, and activity A is below activity B. One or more views corresponding to activity A are called view A, one or more views corresponding to activity B are called view B, and one or more views corresponding to activity C are called view C.
[0125] From a layer perspective, the layers of Activity A, Activity B, and Activity C are child nodes of the layer of Task 1. Since Activity C is at the top of the stack in Task 1, Activity B is below Activity C, and Activity A is below Activity B, the layer of Activity C is above the layer of Activity B; and the layer of Activity B is above the layer of Activity A.
[0126] Since the layer of view A is a child node of the layer of activity A, the layer of view B is a child node of the layer of activity B, and the layer of view C is a child node of the layer of activity C, and the position of child nodes is affected by the position of their parent nodes, the layer of view C is located above the layer of view B, and the layer of view B is located above the layer of view A. This ensures that the interface displayed by the electronic device 300 includes the layer of view C, i.e., the screen corresponding to activity C.
[0127] It should be understood that, in the embodiments of this application, "one layer is above another layer" can also be understood as "one layer covers or overlaps another layer." For example, an electronic device can set the vertical position of layers using the Z-order parameter. The Z-order parameter can be understood as the coordinate of the layer on the Z-axis, which can refer to the axis perpendicular to the display screen of the electronic device and pointing from the back of the electronic device to the display screen. When one layer is above another, the electronic device can set the Z-order parameter of the one layer to be greater than the Z-order parameter of the other layer, so that the one layer covers the other layer. For example, in combination with... Figure 2 The Z-Order parameter of the layer corresponding to activity C can be greater than the Z-Order parameter of the layer corresponding to activity B; the Z-Order parameter of the layer corresponding to activity B can be greater than the Z-Order parameter of the layer corresponding to activity A, and so on.
[0128] Electronic devices can initiate activities in two ways: by reusing tasks and by creating new tasks. The methods of creating new tasks and reusing tasks are explained below.
[0129] 9. Methods for creating new tasks
[0130] This can refer to an electronic device creating a task to initiate a target activity, and then initiating the target activity within that created task. For example, in response to an input operation indicating the initiation of activity 1, the electronic device creates task 1 and initiates activity 1 within task 1. Here, activity 1 belongs to application 1, and the input operation indicating the initiation of activity 1 could be, for example, clicking the icon of application 1.
[0131] 10. Methods of reusing tasks
[0132] This can refer to an electronic device launching a target activity by reusing a target task that is running in the background. In other words, an electronic device can bring a target task running in the background to the foreground and launch the target activity within that target task. The target task can be a task with the same task affinity as the target activity.
[0133] When the target task is running in the background, it may include one or more activities. These activities may or may not include the target activity. If the target activity is included, the electronic device starts the target activity within the target task by bringing the target task to the foreground and placing the target activity at the top of the stack. If the target activity is not included, the electronic device starts the target activity within the target task by bringing the target task to the foreground and then starting the target activity within the target task.
[0134] It should be understood that task affinity can also be referred to as affinity or affinity degree. The attributes of each activity in an electronic device can include affinity, and the attributes of each task can also include affinity. An activity can be launched in a task with the same affinity as that activity. Affinity can be, for example, the application's package name.
[0135] For example, such as Figure 4 As shown, at time 1, task 1 is running in the foreground of the electronic device. Task 1 includes activity 1 and activity 2 of application 1. Activity 2 is at the top of the stack, meaning the electronic device displays the screen corresponding to activity 2. Meanwhile, tasks 2, 3, and 4 are running in the background of the electronic device. Task 3 includes activity 3 of application 2. At time 2, following time 1, in response to an instruction to launch activity 3 of application 2, the electronic device can bring task 3 corresponding to application 2 to the foreground and push activity 3 to the top of the stack.
[0136] It should be understood that the method of creating a new task can also be called the method of creating a new stack, and the method of reusing a task can also be called the method of reusing a stack. This application does not make any specific limitation in this regard.
[0137] The above text introduced activities, one of the four major components of an Android application. In addition to activities, the four major components of an Android application also include services.
[0138] 11. Service
[0139] A service typically refers to a background component that performs long-running operations or tasks without requiring user interface interaction. Services can start automatically when the system boots up and run without a user logged in.
[0140] 12. Other terms
[0141] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with substantially the same function and purpose. For example, "first chip" and "second chip" are used only to distinguish different chips and do not limit their order of execution. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.
[0142] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0143] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.
[0144] 13. Electronic equipment
[0145] The electronic devices in this application embodiment may include handheld devices with facial recognition function, vehicle-mounted devices, etc. For example, some electronic devices include: mobile phones, tablets, PDAs, laptops, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving vehicles, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, wearable devices, terminal devices in 5G networks, or future evolution of public land mobile communication networks. Terminal devices in a network (PLMN), etc., are not limited to this in the embodiments of this application.
[0146] By way of example and not limitation, in this embodiment, the electronic device can also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for devices that utilize wearable technology to intelligently design and develop everyday wearables, such as glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are worn directly on the body or integrated into the user's clothing or accessories. Wearable devices are not merely hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are feature-rich, large in size, and can achieve complete or partial functions without relying on a smartphone, such as smartwatches or smart glasses, as well as those that focus on a specific type of application function and require the use of other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.
[0147] Furthermore, in this embodiment of the application, the electronic device can also be a terminal device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network of human-machine interconnection and object-to-object interconnection.
[0148] The electronic devices in the embodiments of this application may also be referred to as: terminal equipment, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent, or user device, etc.
[0149] In this embodiment, the electronic device or various network devices include a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on top of the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux, Unix, Android, iOS, or Windows. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0150] To improve application efficiency and user visual and operational experience, electronic devices can display parts of the application screen in a non-full-screen display manner.
[0151] Taking application a as an example, electronic devices can display the screen of application a in a non-full-screen manner in the following two ways.
[0152] First, it's important to clarify that displaying the screen of application 'a' on an electronic device can also be understood as the electronic device running a task related to application 'a' in the foreground, such as task 'a'. Furthermore, the activity at the top of the stack within task 'a' is the activity of application 'a', such as activity 'a'. Therefore, the screen of application 'a' is the screen corresponding to activity 'a'. For ease of understanding, the following description of displaying the screen of application 'a' or the screen corresponding to activity 'a' on an electronic device will be as follows: the electronic device is running task 'a' in the foreground, and activity 'a' is at the top of the stack of task 'a'.
[0153] Method 1: Run task a in the foreground as a floating window, with activity a at the top of task a's stack.
[0154] In this way, the electronic device can set the size of task 'a's layer to be smaller than the size of the electronic device's screen. Since task 'a's layer is the parent node of activity 'a's layer, the size of activity 'a's layer is smaller than the size of the electronic device's screen. Because the layer of the view corresponding to activity 'a' is a child node of activity 'a's layer, the size of the screen corresponding to activity 'a' displayed on the electronic device is smaller than the size of the electronic device's screen. This allows the electronic device to display the screen corresponding to activity 'a' in a floating window format.
[0155] Method 2: Run task a in a view of application b, such as view b. Figure 1 Activity 'a' is located in the stack of task 'a'.
[0156] Application b is an application other than application a. Application b can create the target window and view... Figure 1 It can be set in the target window, and view Figure 1 It can be used for tasks that run other applications, such as task a that runs application a.
[0157] In order to see Figure 1 Running task a in the middle, task a can be set as a view Figure 1 The child nodes. Thus, when task a is running in the foreground and activity a is at the top of task a's stack, the screen corresponding to activity a is displayed in the viewport. Figure 1 The corresponding rectangular area.
[0158] It should be understood that, from the perspective of electronic device display, setting task a as the visual... Figure 1 The child node actually sets the layer of task a as the view. Figure 1 The child nodes of the layer. Since the layer of task a is the parent node of the layer of activity a, and the layer of activity a is the parent node of the layer of view a (view a is the view of activity a), the screen corresponding to activity a formed by the layer of view a can be displayed on the view. Figure 1 Therefore, in this embodiment of the application, when applying b's view... Figure 1 The screen displaying activity 'a' (the screen applying 'a') is actually set as the viewport for task 'a'. Figure 1 The child nodes of the layer. However, for the sake of brevity, the layer of task a will be set as the view in the following text. Figure 1 All child nodes of the layer are called the layers where task a is set as the view. Figure 1 The child nodes.
[0159] It should also be understood that setting task a as the view Figure 1 The child node will also be where task a runs in the view. Figure 1 Embed task a into the view Figure 1And because by setting task a as the view... Figure 1 The child nodes of activity a ensure that the screen corresponding to activity a (the screen applying a) is displayed in the view. Figure 1 In the corresponding rectangular area, task a is set as the view. Figure 1 The child node can also be called the one that embeds the screen corresponding to activity 'a' into the view. Figure 1 Embed the screen corresponding to activity a into the target window (view). Figure 1 (Setting it in the target window of application b) or embedding application a in the target window, etc. This application does not specifically limit this.
[0160] Through the above method two, in the view Figure 1 When the size of the corresponding rectangular area is smaller than the size of the electronic device's display screen, the electronic device displays the image corresponding to activity 'a' in a non-full-screen manner.
[0161] It should be noted that when the electronic device runs task a using method one, the parent node of task a is not a view of other applications on the electronic device; rather, the parent node of task a is the default task display area on the electronic device. In other words, changes to the views of other applications on the electronic device will not affect the running state of task a. However, when the electronic device runs task a using method two, task a is a view... Figure 1 The child nodes. Therefore, the target window or view Figure 1 Changes in [the context of the task] can lead to changes in the running state of task a. For example, if the user closes the target window, the electronic device can destroy task a, etc.
[0162] It should be understood that setting the parent node of a task to the default task display area can also be understood as setting the parent node of the task's layer to the default task display area. By setting the parent node of a task to the default task display area, the application's window (the application's screen) can be displayed in the default position on the electronic device's screen, such as making the application window display in full screen. This default task display area is independent of the rectangular area corresponding to any view.
[0163] Depending on the activity at the top of the stack in task a, the target window of application b can display the screen corresponding to the different activities, that is, display different screens of application a; furthermore, task a can also be replaced by a task from another application, so that the target window of application b can display the screens of different applications, making the application run more efficiently.
[0164] In one example, combined Figure 5 First, a note-taking application is running in the foreground of the electronic device; such as Figure 5As shown in interface (a), in response to the user's input on Restaurant A in the note-taking application, the electronic device launches the Smart Assistant. This input could be, for example, copying Restaurant A. The Smart Assistant is another application within the electronic device. After the Smart Assistant is launched, it creates a window 501, which fills the entire screen of the electronic device. The layers within window 501 are semi-transparent. Window 501 can be used to embed other applications. Window 501 includes a view 502, which displays a floating ball and information prompting the user to locate Restaurant A. In response to the user clicking the triangle control in view 502, the content displayed in view 502 expands.
[0165] In response to the user clicking the triangle control in view 502, such as Figure 5 As shown in interface (b), the electronic device displays view 503 in window 501, which is used to display the expanded state of the content in view 502; and window 501 also includes view 504. In response to the user clicking the triangle control in view 502, the electronic device also displays the screen corresponding to activity x1 of the navigation application in view 504.
[0166] It should be understood that in this example, the smart assistant can be understood as application b in the above embodiment, window 501 can be understood as the target window, and view 504 can be understood as the view within the target window. Figure 1 Navigation applications can be understood as application a, and activity x1 can be understood as activity a.
[0167] In another example, such as Figure 6 As shown, the electronic device can have a bubble notification function. That is, after the electronic device detects a message notification, it can embed the chat screen into a full-screen window. For example, when the electronic device is displaying its desktop, it receives message 1; upon detecting message 1, the electronic device can display a full-screen window 601 corresponding to the bubble notification function. The layers in window 601 are semi-transparent, and window 601 can embed other applications. An avatar 602 is displayed in window 601. In response to the user's click on avatar 602, the electronic device can launch activity x2 of a social application through view 603 laid out in window 601, and the chat screen corresponding to activity x2 is displayed in view 603 of window 601.
[0168] It should be understood that in this example, the function of the bubble notification can be understood as application b in the above embodiment, window 601 can be understood as the target window, and view 603 can be understood as the view within the target window. Figure 1 Social applications can be understood as application a, and activities x2 can be understood as activity a.
[0169] It is understandable that when an electronic device runs task a using the above-mentioned method two, due to the visual... Figure 1 It is the parent node of task a, making the view Figure 1 A change in the state of task a can lead to a change in the state of task a. However, a change in the state of task a does not necessarily lead to a change in the state of the visual task. Figure 1 The state changes. These state changes may include, but are not limited to, size, position, and on / off states.
[0170] For example, due to the view Figure 1 It is set in the target window, so the view Figure 1 Changes in the state of the target window can be reflected in the state changes of the view. Figure 1 When task a is running, the electronic device can close the screen corresponding to activity a based on an instruction to remove task a, but the electronic device can still display the target window. For example, combined with... Figure 5 In response to a user clicking the triangle button in interface (b), the electronic device can display interface (a), meaning window 501 remains displayed, but the screen of navigation applications is closed; or, the electronic device can remove the target window and task a based on the operation of removing the target window, i.e., close the screen corresponding to the target window and activity a. For example, combining Figure 5 In response to the user closing window 501, the electronic device can remove window 501, and the screen of navigation applications is also closed.
[0171] In some embodiments, electronic devices can create new tasks in the view Figure 1 In the running task a, that is, task a is a newly created task on the electronic device. The following is in conjunction with... Figure 7 and Figure 8 To run task a in the view as a newly created task Figure 1 The process will be explained.
[0172] For example, such as Figure 7 As shown in (a), at time 1, the electronic device has Task 1 of the Notes application running in the foreground, and Task 2 of the Gallery application, Task a of application a, and a service of task b running in the background. Application a can be a social application, and Activity 3 within application a is at the top of the stack, providing a chat interface. At this time, in response to the user's action of viewing the multitasking cards (e.g., swiping up from the bottom of the screen and holding), the multitasking cards displayed on the electronic device can be as follows: Figure 8 As shown in (a), the multitasking card includes a card for the foreground note-taking application, a card for the background gallery application, and a card for application a, with application a displaying a chat interface.
[0173] At time 2, following time 1, the service of task b detects the user's action of opening the payment code function of application a, such as... Figure 7 As shown in (b), the service using b can create a target window, and the target window has a view... Figure 1 ,See Figure 1 Application a can be embedded in it.
[0174] Here, the target window created by application b's service can be understood as a window running in the foreground. That is, this target window is the window that the current user can interact with. Alternatively, in a multitasking card, this target window is located in the position of the card representing the application running in the foreground. For example, combined with... Figure 8 (b) in the middle, and Figure 8 The difference in (b) is that the target window is located above the note-taking application, that is, the target window is located in the position of the card of the application running in the foreground, but the screen corresponding to the payment function of application a is not displayed in the target window.
[0175] At time 3 after time 2, such as Figure 7 As shown in (c), since the payment code function of application a corresponds to activity a, the electronic device creates a new task a, starts activity a in the new task a, and sets task a as the view. Figure 1 The child nodes. This allows task a to run in the view. Figure 1 In this case, in response to the user's action of viewing the multitasking card, the electronically displayed multitasking card can be displayed as follows: Figure 8 As shown in (b), the multitasking card includes a card for application a running in the foreground, which displays a payment code interface and is embedded in the target window; the multitasking card also includes cards for the note-taking application, the gallery application, and application a running in the background, with the card for application a running in the background displaying a chat interface.
[0176] It should be noted that, Figure 7 For example only, in Figure 7 In (a), the background task of the electronic device can also be a task of another application. For example, at time 1, the background task may not include the task of application a. In this case, the electronic device will also create a new task a and start activity a in the new task a. In other words, in Figure 7 In the method shown, the electronic device creates a new task a regardless of whether the electronic device is running task a with application a.
[0177] For example, combining Figure 5 The navigation application's activity x1 is launched in a newly created task, and this newly created task is a child node of view 504; combined with Figure 6The activity x2 of the social application is launched in a newly created task, and the newly created task is a child node of view 603.
[0178] It should be understood that application b's service can run in the background of the electronic device after the Android system starts, and application b's service does not need to provide a user interface. Therefore, as Figure 8 As shown in (a)-(b), in response to the user's action of viewing the multitasking cards, the electronic device does not display the card for application b. For the sake of brevity, this will not be elaborated upon further below.
[0179] The following is combined Figure 9 From the perspective of the interaction between internal modules of electronic devices, the electronic device runs task 'a' in the view by creating a new task. Figure 1 The process, and task a stops running in view Figure 1 The process will be explained in detail.
[0180] The electronic device may include an embedded management module, an Activity Task Manager Service (ATMS) module, a Windows Manager Service (WMS) module, and a layer management module. The embedded management module can be used to launch activities in an embedded manner.
[0181] Figure 9 This is a flowchart illustrating an application launch method 900. Method 900 includes the following steps, wherein S901 to S909 are steps in which an electronic device embeds application a into a target window by creating a new task.
[0182] S901, In response to the user's operation of launching application a (function 1), application b instructs the view management module to create a view. Figure 1 .
[0183] For example, in combination Figure 5 Application 'a' is, for example, a navigation application. Function 1 of application 'a' is, for example, a navigation function. The user's action to activate function 1 of application 'a' could be, for example, clicking the triangle button in view 502 within interface (a). In response to this action, the view management module can create view 504 (i.e., view ...) in window 501 (i.e., the target window). Figure 1 ).
[0184] Alternatively, application b can determine which view is available based on a pre-installed XML file in the electronic device. Figure 1 The screen corresponding to function 1 is embedded in the middle; application b instructs the view management module to create a view based on this XML file. Figure 1 ; and will be regarded as Figure 1Set in the target window. The target window can be created by the window management module invoked by application b prior to S901.
[0185] S902, The view management module instructs the layer management module to create a view. Figure 1 The layer.
[0186] For example, still using Figure 5 As shown in the example scenario, after receiving the above instruction, the view management module can create view 504 (i.e., view error). Figure 1 The layer 504 is used to display related activities of navigation applications.
[0187] S903, Application b requests the embedded management module to start activity a, and function 1 of application a corresponds to activity a of application a.
[0188] For example, still using Figure 5 As shown in the example scenario, the smart assistant (i.e., application b) requests the embedded management module to launch activity x1 (i.e., activity a) of the navigation application, which is used to provide the screen in view 504.
[0189] Optionally, application b can call the view through the embedded management module. Figure 1 The relevant methods or functions in the module are used to start activity 'a'. This allows the embedded management module to determine which screen corresponds to activity 'a' and requires embedding. Figure 1 middle.
[0190] Furthermore, application b can also indicate the bounds attribute parameter 1 to the embedded management module. The bounds attribute parameter 1 can be understood as a parameter describing the size and position of the screen corresponding to activity a. For example, bounds attribute parameter 1 can include coordinates 1 and 2. Coordinate 1 can be understood as the coordinates of the upper left corner of the screen corresponding to activity a, and coordinate 2 can be understood as the coordinates of the lower right corner of the screen corresponding to activity a. This facilitates subsequent settings of the size and position of the screen corresponding to activity a on the electronic device.
[0191] It should be understood that coordinates 1 and 2 are coordinates within the coordinate system of the electronic device's display screen. The coordinate system of the electronic device's display screen can also be called the screen coordinate system, which is a coordinate system used to position elements such as graphics or text on the electronic device's display screen. The origin of the screen coordinate system can be, for example, the upper left corner of the screen, the x-axis can be a horizontal axis pointing to the right side of the display screen, and the y-axis can be a vertical axis pointing to the bottom of the display screen. This application does not impose specific limitations on this.
[0192] It should be noted that the bounds attribute parameter 1 can also be the size of task a, etc., and this application does not make specific restrictions on it.
[0193] Optionally, application b can request the embedded management module to launch activity a upon detecting that the user has launched function 1 of application a (function 1 corresponds to activity a). For example, in combination with Figure 5 This input event can be generated based on the user's click on the triangle control in view 502; or, in combination with... Figure 6 This input event can be generated based on the user's click on the avatar 602. S904, the embedded management module sets the activity options for activity a and requests the activity task management module to start activity a.
[0194] The activity options can also be referred to as the startup parameters of activity a. The activity options can include various parameters used to start activity a. The activity options for each activity can be encapsulated in a class within the electronic device for managing these activity options. When the embedded management module starts activity a, it can obtain the activity options for activity a and set them so that the activity task management module can start activity a according to the settings indicated by the activity options.
[0195] For example, the activity options for activity a may include option 1, which is used to set whether activity a is launched in an embedded or non-embedded manner. Based on the operation of application b calling the embedded management module, the embedded management module can determine that activity a needs to be launched in an embedded manner. Therefore, the embedded management module can set option 1 to information indicating that activity a is launched in an embedded manner. The information indicating that activity a is launched in an embedded manner may be, for example, true or 1.
[0196] It should be understood that launching activity 'a' in an embedded manner can also be understood as: after launching activity 'a' in task 'a', the parent node of task 'a' needs to be set to the view of another application; launching activity 'a' in a non-embedded manner can also be understood as: after launching activity 'a' in task 'a', the parent node of task 'a' needs to be set to the default task display area.
[0197] Activity A's activity options may also include option 2, which is used to set the bounds attribute parameter 1 of the screen corresponding to activity A. The embedded management module can set option 2 based on the instructions of application B.
[0198] Activity A's activity options may also include option 3, which can be used to set instructions for viewing. Figure 1 This information. Thus, option 3 can instruct the frame corresponding to activity a to be embedded in the video. Figure 1 Option 3 can be based on S903 settings. In S903, application b calls the view through the embedded management module. Figure 1The relevant methods or functions initiate activity a; therefore, the embedded management module sets option 3 to indicate the view. Figure 1 Information.
[0199] It should be understood that the activity options for activity a may also include other options such as the name of activity a, a uniform resource identifier (URI), or the task affinity option for activity a. This application does not specifically limit the other options among the activity options for activity a.
[0200] S905. In response to an instruction from the embedded management module, the activity task management module creates a new task a and starts activity a in task a.
[0201] It should be understood that, in response to option 1 in the activity options for activity a, the activity task management module can determine that activity a needs to be launched in an embedded manner. This is because task a is run as a newly created task within the viewport. Figure 1 Therefore, the activity task management module can determine that a new task needs to be created and start activity a within this new task. Furthermore, the activity options for activity a can include information indicating a task capable of managing activity a, such as task a that applies activity a. Thus, the activity management module can further create task a based on the activity options of activity a.
[0202] S906, The activity and task management module indicates information about activity a and task a to the window management module.
[0203] Information about activity a and task a may include: the bounds attribute parameter 1, which indicates that task a will be run in the viewport. Figure 1 Information includes information for indicating activity a and information for indicating task a. Information for indicating activity a could be, for example, the name of activity a, and information for indicating task a could be, for example, the ID of task a.
[0204] Among them, the one used to indicate that the screen corresponding to activity a is embedded in the view Figure 1 The information could be, for example, setting up a cross-process transferable object that can be used to indicate the view. Figure 1 This is understandable, because the activity task management module reads the activity options of activity a when starting activity a, and option 3 among them has a setting for indicating the view. Figure 1 Based on this information, the activity task management module can determine that task a needs to run in the view. Figure 1 In the middle. Furthermore, the activity task management module can instruct the window management module to run task a in the view. Figure 1 middle.
[0205] It should be understood that each task running in an electronic device can have one or more attributes set. The attributes of a task can also be understood as marker bits used to describe the size, visibility, and other properties of the task's layer.
[0206] In response to instructions from the activity task management module, the window management module can create a window for activity 'a', which is the parent node of activity 'a's view. Furthermore, the window management module can set the size and layout of this window based on the `bounds` attribute parameter 1.
[0207] S907, The window management module instructs the layer management module to create the screen corresponding to activity a.
[0208] In response to instructions from the window management module, the layer management module creates a layer for view a, where view a is one or more views of activity a. The layer of view a can form the screen corresponding to activity a.
[0209] S908, The window management module instructs the embedded management module to run task a in the window. Figure 1 .
[0210] For example, the window management module provides information to the embedded management module for instructing task a and for instructing the view. Figure 1 Information, such as task a and view. Figure 1 The name, etc. It is understandable that, because the activity task management module, based on option 3, instructs the window management module to run task a in the viewport. Figure 1 The information. In response to this instruction from the activity task management module, the window management module further instructs the embedded management module to run task a in the view. Figure 1 .
[0211] It should be understood that S907 and S908 can be executed in parallel, and S907 can be executed before or after S908. This application does not make any specific restrictions on this.
[0212] S909, The embedded management module instructs the layer management module to set task a as the view. Figure 1 The child nodes.
[0213] Among them, task a is set as the view Figure 1 The child nodes can also be replaced with: view Figure 1 Set it as the parent node of task a; or, mount task a to the view. Figure 1 Inferior.
[0214] Thus, since task a manages activity a, and activity a is at the top of the stack, when task a is the view... Figure 1 In the case of child nodes, the screen corresponding to activity 'a' can be displayed in the view. Figure 1 middle.
[0215] Based on the above embodiments, optionally, the embedded management module or window management module can also instruct the layer management module to set the attributes of task a, such as setting task a to be visible. It can also instruct the layer management module to set the size and position of the screen corresponding to activity a based on the bounds attribute parameter 1.
[0216] Thus, after configuring the layer management module, task a can run in the viewport. Figure 1 In, for example Figure 5 As shown in interface (a), the screen of a navigation application is displayed in view 504.
[0217] S910 to S912 are instances where task a stops running in the view Figure 1 The steps in the process. Combined with... Figure 5 This means that the screen of navigation applications stops displaying in view 504.
[0218] It should be understood that task a stops running in the view Figure 1 This can also be referred to as: Task a exits the embedded view. Figure 1 The exit screen of application a is embedded in the view. Figure 1 The screen corresponding to activity a exits the embedded video. Figure 1 Or the screen corresponding to activity a exits from the embedded target window, etc., this application does not make specific limitations in this regard.
[0219] S910, Application b requests the embedded management module to remove task a.
[0220] In one possible approach, application b can call the view through the embedded management module. Figure 1 The method or function in the request field removes task a. This allows the electronic device to close the screen corresponding to activity a. However, the electronic device can still display the visual layers in the target window.
[0221] For example, combined Figure 5 In response to the user clicking the triangle button in view 503 of interface (b), the content in view 503 can be collapsed, and the navigation application screen can no longer be displayed in view 504. However, the electronic device can still display window 501, that is, the interface displayed by the electronic device can be switched from interface (b) to interface (a).
[0222] In another possible approach, application b requesting the embedded management module to remove task a can be replaced with application b requesting the embedded management module to remove the target window; or, it can be understood as the embedded management module listening to the view Figure 1 Or the target window may be removed. In this way, the electronic device can close the target window, and because of the view... Figure 1 Set in the target window, task a is the view Figure 1The child nodes of activity 'a' will also cause task 'a' to be removed. That is, the electronic device will no longer display the screen corresponding to activity 'a', nor will it display the visual layer in the target window.
[0223] For example, combined Figure 5 In response to the user clicking on a blank area in window 501 of interface (b), the electronic device can display the interface of the note-taking application. That is, window 501 is closed, and the screen of the navigation application is no longer displayed in view 503.
[0224] S911, The embedded management module requests the activity task management module to remove task a.
[0225] S912. In response to a request from the embedded management module, the activity task management module removes task a.
[0226] S913, The activity task management module instructs the window management module to remove information about task a and activity a.
[0227] In response to instructions from the activity task management module, the window management module can, for example, delete the `bounds` attribute parameter 1, which indicates that task a should be run in the viewport. Figure 1 Information, information used to indicate activity a, information used to indicate task a, and the window for activity a, etc.
[0228] S914, The window management module instructs the layer management module to remove the screen corresponding to activity a.
[0229] In this way, the layer management module can delete the layer of view a.
[0230] However, by creating a new task, task a can be run in the viewport. Figure 1 The following problems may exist.
[0231] Problem 1: May cause abnormal display on electronic devices.
[0232] In one example, there might be relationships between activities within an electronic device. These relationships could include destroying one activity while another is still active. Thus, combining... Figure 7 Suppose that launching activity 'a' would cause activity '2' (the activity in the note-taking app) to be destroyed. In other words, if the note-taking app's interface is displayed full-screen on the electronic device's screen, launching activity 'a' might cause activity '2' to be destroyed, preventing the electronic device from displaying the note-taking app's interface in full-screen mode. This could result in the note-taking app crashing, leading to a poor user experience. For example, combining... Figure 5Activity 2 can be understood as the activity of the note-taking application, providing a full-screen view of the note-taking application interface below window 501. Activity a can also be understood as activity x1 included in navigation applications. After activity x1 is launched, the note-taking application activity is destroyed, causing the full-screen view of the note-taking application interface below window 501 to disappear. That is, the user can see the note-taking application crashing through window 501.
[0233] In another example, activity 'a' in an electronic device can only exist as a single instance. That is, multiple identical activities 'a' cannot exist within an electronic device. Thus, combined with... Figure 7 Assuming that background task 'a' includes activity 'a', and since activity 'a' can only exist as a single instance on an electronic device, activity 'a' in a newly created task 'a' might be immediately destroyed after being started. Thus, when an electronic device starts activity 'a' in a newly created task 'a', it will... Figure 1 The screen corresponding to activity 'a' can be displayed, but as activity 'a' in the newly created task is destroyed, the screen will no longer display. Figure 1 The screen corresponding to activity 'a' in the application then closes, causing the user to see application 'a' crash.
[0234] Therefore, in the above scenario, to ensure that the screen corresponding to activity 'a' is stably displayed in the target window, it may be necessary to configure the rules for activity 'a' to run on the electronic device, such as allowing activity 'a' to exist as multiple instances. This significantly increases the development complexity.
[0235] Question 2: Creating new tasks results in higher power consumption for electronic devices.
[0236] Question 3: When application a and task a are already running in the background of an electronic device, how can the screen of application a be embedded in the video? Figure 1 In this scenario, the electronic device creates a new task 'a' for application 'a'. Thus, in response to the user's action of viewing the multitasking card, the electronic device displays two cards for application 'a', resulting in a poor user experience. For example, combining... Figure 7 In (c), the electronic device has application a running in the background, task a, and the foreground is in view. Figure 1 Application a is also running task a. At this time, in response to the user's operation of viewing the multitasking card, the electronically displayed multitasking card can be displayed as follows: Figure 8 As shown in (b), the electronic device displays two cards for application a, resulting in a poor user experience.
[0237] In view of this, this application provides an application launch method, in which an electronic device can launch activity a by reusing tasks, and can set task a (which includes activity a) as the target window of application b. Figure 1 The child nodes of activity 'a' allow the screen corresponding to activity 'a' to be displayed in the viewport. Figure 1In this way, electronic devices do not need to create new tasks, resulting in lower power consumption.
[0238] Furthermore, when task 'a' running in the background includes activity 'a', the electronic device sets task 'a' to the foreground and places activity 'a' at the top of the task 'a' stack. Since the electronic device will not create new tasks, but will launch an activity 'a' within a new task, ensuring that activity 'a' exists only as a single instance, will not be destroyed after being launched due to this single-instance limitation. This reduces the probability of the user experiencing application 'a' crashing, allowing the electronic device to display the screen corresponding to activity 'a' correctly.
[0239] Furthermore, if application A and task A are already running in the background on the electronic device, the device will not create a new task A. When the user views the applications running on the electronic device, the device will not display application cards for two applications A. This results in a superior user experience.
[0240] The following is combined Figure 10 and Figure 11 Running task a in the view using a reusable task approach Figure 1 The process will be explained.
[0241] For example, such as Figure 10 As shown in (a) in the figure, Figure 10 The scene shown in (a) is similar to Figure 7 The scenario shown in (a) is similar. At time 4, the electronic device is running application b's service, application a's task a, and gallery task 2 in the background; the electronic device is running note-taking application task 1 in the foreground. Application a is a social application, and activity 3 in task a is at the top of the stack, providing a chat interface. At this time, in response to the user's operation of viewing the multitasking cards, the electronically displayed multitasking cards can be as follows: Figure 11 As shown in (a), the multitasking card includes a card for the foreground note-taking application, a card for the background gallery application, and a card for application a, with application a displaying a chat interface.
[0242] At time 5, after time 4, if application b's service detects the user opening the payment code function of application a, then... Figure 10 As shown in (b), the service using b can create a target window, and the view can be set within the target window. Figure 1 Since the payment code function of application 'a' corresponds to activity 'a', the electronic device needs to launch activity 'a'. Therefore, if the electronic device determines that activity 'a' can reuse the background running task 'a' for launching, it can bring task 'a' to the foreground.
[0243] At time 6, after time 5, such as Figure 10As shown in (c), the electronic device sets task a of application a to the foreground and launches activity a within task a. Since activity 3 is at the top of the stack when task a is running in the background, activity 3 is below activity a after activity a is launched within task a. Furthermore, the electronic device sets task a as the viewport. Figure 1 The child nodes. This allows task a to run in the view. Figure 1 In this case, in response to the user's action of viewing the multitasking card, the electronically displayed multitasking card can be displayed as follows: Figure 11 As shown in (b), the multitasking card includes application a running in the foreground, which displays a payment code interface, and the payment code interface is embedded in the target window of application b; the multitasking card also includes cards for a note-taking application and a gallery application running in the background.
[0244] Will Figure 11 (b) shows the multitasking card and Figure 8 By comparing the multitasking card shown in (b), it can be seen that the method of this application runs task a on the view. Figure 1 This allows for the absence of two separate application cards (a and 'a') in a multitasking card, thus improving the user experience.
[0245] Understandable. Figure 10 For example only, task a may also include activities other than activity a and activity 3. For example, in Figure 10 In (a), the background running task a includes not only activity 3 at the top of the stack, but also one or more activities below activity 3. Then in Figure 10 In (c), when task a is set to the foreground and activity a is set to the top of the stack, activity 3 includes one or more other activities below it. This application does not specifically limit this.
[0246] Furthermore, if in Figure 10 In (a), in addition to activity 3, the background running task a also includes activity a. Therefore, for the electronic device to start activity a within task a, it is done by setting task a to the foreground and placing activity a at the top of the stack; if in Figure 10 In (a), if the background running task a does not include activity a except for activity 3, then the electronic device starts activity a in task a as follows: set task a to the foreground and start activity a in task a.
[0247] Alternatively, the target window of application b can be created not only through the service of application b, but also through one of the following two methods.
[0248] In one possible way, combining Figure 10In step (a), at time 4, assume that task b of application b is running in the background of the electronic device. Then, at time 5, after time 4, in response to the user's operation of opening the payment code function of application a, task b of application b can be brought to the foreground, and an activity of application b, such as activity b, can be launched in task b. Subsequently, the electronic device can create a window for activity b, which becomes the target window of application b. Further, the electronic device can run task a in a view of this target window, such as view... Figure 1 middle.
[0249] In another possible approach, the difference from the one mentioned above lies in the combination of Figure 10 In step (a), at time 4, no task for application b is running in the background of the electronic device. At time 5, following time 4, in response to the user's action of activating the payment code function of application a, the electronic device creates task b for application b and launches an activity of application b, such as activity b, within task b. Subsequently, the electronic device can create a window for activity b, which serves as the target window for application b. Further, the electronic device can run task a within a view of this target window, such as view... Figure 1 middle.
[0250] It should be noted that the above explanation uses the example of embedding application a within the target window of application b. In some possible implementations, application a can be multiple different applications. For example, multiple views can be set in the target window. Furthermore, some of these views can be used to embed different applications or different activities corresponding to the same application. The following will combine... Figure 12 This will be explained further.
[0251] like Figure 12 As shown, application b can be an application that can launch one or more other applications, such as a quick code-scanning application. The window of the quick code-scanning application is window 1201 (i.e., the target window). Window 1201 contains a visible layer that is displayed full-screen on the electronic device's screen, and this visible layer is semi-transparent. Therefore, through this visible layer, the user can also see the electronic device's desktop and other applications. Furthermore, multiple views can be set in window 1201. The rectangular areas corresponding to the multiple views can be the same or different. Some of these views can be used to embed screens corresponding to different activities; these views can also be called embedded views, i.e., views that can embed screens of other applications.
[0252] At this point, application 'a' can be a social application 1, a payment application 2, or a video conferencing application 3, etc. Applications 1 and 2 have functions such as providing payment codes, scanning QR codes, providing payment codes, and providing transit codes; application 3 has functions such as providing payment codes, scanning QR codes, providing payment codes, and clocking in and out. The screens corresponding to the different functions in application 1, application 2, or application 3 can be provided by different activities in application 1, application 2, or application 3.
[0253] For example, activity a1 in application 1 corresponds to the payment code function of application 1; activity a2 in application 1 corresponds to the scan function of application 1. Activity a3 in application 2 corresponds to the payment code function of application 2; activity a4 in application 2 corresponds to the scan function of application 2; activity a5 in application 2 corresponds to the transit code function of application 2. Activity a6 in application 3 corresponds to the attendance check-in function of application 3.
[0254] First, it should be noted that on electronic devices displaying... Figure 12 Before any interface in the Quick Code Display application, that is, before embedding the screen of application 1, application 2, or application 3 within the Quick Code Display application, one or more of application 1, application 2, and application 3 may already be running in the background of the electronic device. Specifically, if a task of application 1, such as task a-1, is running in the background, subsequent activities of application 1 launched by the electronic device (such as activities a1 and a2) can reuse task a-1; if a task of application 2, such as task a-2, is running in the background, subsequent activities of application 2 launched by the electronic device (such as activities a3, a4, and a5) can reuse task a-2; and if a task of application 3, such as task a-3, subsequent activities of application 3 launched by the electronic device (such as activity a6) can reuse task a-3. In the above scenario, the Quick Code Display application can embed the screens of application 1, application 2, and application 3 in the following ways.
[0255] In response to an action performed by opening the payment code function in application 1 via the quick code display application (such as tapping the screen or double-tapping the quick code display application icon), the electronic device can display... Figure 12 The interface (a) is shown in the window (a). As shown in the window (a), the window 1201 where the quick code display application is located includes a view 1202, which displays the screen corresponding to the payment code function of another application (i.e., application 1).
[0256] In this context, the screen corresponding to the payment code function of Application 1 can be the screen corresponding to Activity a1 of Application 1. Activity a1 is started by reusing Task a-1, therefore, Task a-1 switches from the background to the foreground. Task a-1 is a child node of View 1202, so that the screen corresponding to Activity a1, which is at the top of the stack in Task a-1, is displayed in View 1202.
[0257] Furthermore, view 1202 can be understood as Figure 12 The view corresponding to the "Pay / Receive" button selected in interface (a). That is, in response to selecting the "Pay / Receive" button, the electronic device can display the screen corresponding to the payment code function in view 1202. The selected button can be understood as... Figure 12 The buttons circled in the box in the interface shown are the ones for payment, scan, travel, and check-in.
[0258] It should be noted that the "Pay / Receive," "Scan," and "Travel" buttons are not located in view 1202. These buttons are drawn in other views of window 1202 and are part of the quick QR code display application.
[0259] In response to a user's action of opening the scan function in application 1 via a quick code scanning application (e.g., clicking the scan button on interface (a)), the electronic device can display... Figure 12 The interface (b) in window 1201. At this time, view 1202 in window 1201 is switched to view 1203, and view 1203 displays the screen corresponding to the scan function of application 1.
[0260] In this context, the screen corresponding to the scan function of application 1 can be the screen corresponding to activity a2 of application 1. Activity a2 can also be started by reusing task a-1. Therefore, after the electronic device switches from interface (a) to interface (b), the activity at the top of the stack in task a-1 switches from activity a1 to activity a2. Furthermore, the parent node of task a-1 switches from view 1202 to view 1203. View 1203 can be understood as... Figure 12 The view corresponding to the selected scan button in interface (b). That is, in response to the selection of the scan button, the electronic device can display the screen corresponding to the scan function in view 1203.
[0261] In response to a user's action of opening the payment code function of application 2 through the quick code display application (e.g., clicking the edit button in interface (b) and then selecting the payment code function of application 2), the electronic device can display... Figure 12 The interface (c) in window 1201. At this time, view 1203 in window 1201 switches to view 1204, and view 1204 displays the screen corresponding to the payment code function of application 2.
[0262] The screen corresponding to the payment code function of Application 2 can be the screen corresponding to Activity a3 of Application 2. Activity a3 can be started by reusing Task a-2. Therefore, after the electronic device switches from interface (b) to interface (c), Task a-2 has also switched from the background to the foreground. Furthermore, Task a-1 can switch from the foreground to the background. Task a-2 is a child node of View 1204. View 1204 can be understood as... Figure 12 The view corresponding to the selection of the payment button in interface (c). That is, in response to the selection of the payment button, the electronic device can display the screen corresponding to the payment code function of application 2 in view 1204.
[0263] In response to a user's action of opening the scan function of application 2 via the quick code scanning application (such as clicking the scan button in interface (c)), the electronic device can display... Figure 12 The interface (d) in window 1201. At this time, view 1204 in window 1201 switches to view 1205, which displays the screen corresponding to the scan function of application 2.
[0264] In this context, the screen corresponding to the scan function of application 2 can be the screen corresponding to activity a4 of application 2. Activity a4 can be started by reusing task a-2. Therefore, after the electronic device switches from interface (c) to interface (d), the activity at the top of the stack in task a-2 switches from activity a3 to activity a4. Furthermore, the parent node of task a-2 switches from view 1204 to view 1205. View 1205 can be understood as... Figure 12 The view corresponding to the selected scan button in interface (d). That is, in response to the selection of the scan button, the electronic device can display the screen corresponding to the scan function of application 2 in view 1205.
[0265] In response to a user's action of opening the travel function screen of application 2 via the quick code scanning application (such as clicking the travel button in interface (d)), the electronic device can display... Figure 12 The interface (e) in window 1201. At this time, view 1205 in window 1201 switches to view 1206, which displays the screen corresponding to the travel function of application 2. The screen corresponding to the travel function may include a ride code, for example. Figure 12 The interface (e) shows the bus ride code, etc.
[0266] In this context, the screen corresponding to the travel function of Application 2 can be the screen corresponding to activity a5 of Application 2. Activity a5 can be initiated by reusing task a-2. Therefore, after the electronic device switches from interface (d) to interface (e), the activity at the top of the stack in task a-2 switches from activity a4 to activity a5. Furthermore, the parent node of task a-2 switches from view 1205 to view 1206. View 1206 can be understood as... Figure 12 The view corresponding to the selected travel button in interface (e). That is, in response to the selection of the travel button, the electronic device can display the screen corresponding to the travel function of application 2 in view 1206.
[0267] In response to the user's action of opening the check-in function of application 3 through the quick code scanning application, the electronic device can display... Figure 12 The interface (f) in the context. For example, the user can open the check-in function screen of application 3 via the quick code-showing application by clicking the edit button in interface (e) and then selecting the check-in function of application 3. At this time, view 1206 of the window layout 1201 switches to view 1207, which displays the screen corresponding to the check-in function of application 3.
[0268] In this context, the screen corresponding to the check-in function of application 3 can be the screen corresponding to activity a6 of application 3. Activity a6 can be started by reusing task a-3. Therefore, after the electronic device switches from interface (e) to interface (f), task a-3 has switched from the background to the foreground, and task a-2 has switched from the foreground to the background. Task a-3 is a child node of view 1207. View 1207 can be understood as... Figure 12 The view corresponding to the selected check-in button in the interface (f). That is, in response to the selection of the check-in button, the electronic device can display the screen corresponding to the check-in function of application 3 in view 1207.
[0269] In addition, for Figure 12 As shown in interfaces (a) to (f), users can close the screen corresponding to application 1, application 2, or application 3 by clicking on the blank area in window 1201. The blank area in window 1201 can also be understood as a semi-transparent area in window 1201; or, Figure 12 The interfaces (a) to (f) shown may also include a button that can close the screen corresponding to application 1, application 2 or application 3. In response to the user clicking the button, the electronic device can close the screen corresponding to application 1, application 2 or application 3.
[0270] Understandable. Figure 12 The interface shown is merely an example; in some possible implementations, Figure 12The interfaces (a) to (f) shown may include more or fewer icons, and this application does not specifically limit this.
[0271] It should be understood that Figure 12 The example shown illustrates an electronic device sequentially displaying interfaces (a), (b), (c), (d), (e), and (f). In some possible implementations, the order in which the electronic device displays these interfaces may differ, and this application does not impose a specific limitation on this.
[0272] also, Figure 12 This description uses the default display interface (a) of the quick code display application as an example. In some possible implementations, the user can also set an interface other than the default display interface (a) when launching the quick code display application. In this way, in response to the operation of launching the quick code display application, such as double-clicking the quick code display application icon, the electronic device can display an interface other than interface (a), such as the default display interface (d).
[0273] Combination Figure 12 As can be seen, through the application launch method of this application, in response to the user's click on the icon of the quick code display application on the desktop, when other applications (application 1, application 2, or application 3) are embedded in the window 1201 of the quick code display application, the user sees the desktop of the electronic device through window 1201. Thus, even if the activity of application 1, application 2, or application 3 causes other activities to be destroyed after being launched, the user will not be aware of it. Compared to... Figure 5 The example shown illustrates this: if the navigation app's screen is displayed in view 504 and the note-taking app crashes, the user will see the note-taking app's screen disappear. The application launch method of this application can improve the user experience.
[0274] The following is combined Figures 13 to 17 The technical solutions of this application and how they solve the aforementioned technical problems are described in detail with specific embodiments. The following specific embodiments can be implemented independently or in combination with each other. Identical or similar concepts or processes may not be described again in some embodiments.
[0275] The embodiments shown in this application can be executed by an electronic device, a chip, chip system, or processor that supports the electronic device in implementing the application startup method, or a logic module or software capable of implementing all or part of the functions of the electronic device. This application does not impose specific limitations in this regard.
[0276] The embodiments of this application are described below using an electronic device as an example. The specific form and number of the devices shown are merely examples and should not be construed as limiting the implementation of the methods provided in this application.
[0277] To facilitate understanding this solution, we will first combine... Figure 13 Describe the software architecture of the electronic device.
[0278] The software systems of electronic devices can adopt layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. The following section will combine these with... Figure 13 Taking the layered architecture of the Android system as an example, this paper illustrates the software architecture of an electronic device.
[0279] To facilitate understanding, we will first explain the layered architecture of the Android system and the related terminology.
[0280] like Figure 13 As shown, a layered architecture divides the software system of an electronic device into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0281] The application layer can include a series of application packages; an application (APP) can also be simply referred to as an application. For example... Figure 13 As shown, the application package may include applications such as quick code scanning, maps, phone, navigation, notes, social applications, payment applications, smart assistants, and video conferencing applications.
[0282] Among them, the smart assistant and quick code display application can be applications that can launch multiple other applications. Application b mentioned above could be, for example, a smart assistant or a quick code display application. Notes could be, for example, a... Figure 5 The example shown is a note-taking application. Social applications can include various types of applications such as SMS, for example, Figure 6 The social applications shown in the examples Figure 8 and Figure 11 Applications of a and Figure 12 The example shown is Application 1, etc. Payment applications, for example, could be... Figure 12 Application 2 is shown in the example. A video conferencing application could be, for example,... Figure 12 Application 3 is shown in the example. A smart assistant, for example, could be... Figure 5 The example shown features a smart assistant.
[0283] It is understood that the smart assistant and the quick code display application can be applications or services. For example, after the electronic device is powered on, the quick code display application service is started, causing it to run in the background. This application does not impose any specific limitations on this.
[0284] Quick code scanning and other applications that can launch various other applications can be used to launch social networking apps, payment apps, video conferencing apps, or navigation apps. Social networking and payment apps can provide functions such as providing payment codes, scanning QR codes, providing payment collection codes, and travel-related functions. Video conferencing apps can provide functions such as providing payment codes, scanning QR codes, providing payment collection codes, and clocking in / out. Electronic devices can display the corresponding screens of various functions from social networking apps, payment apps, or video conferencing apps in the target window of quick code scanning.
[0285] A smart assistant, also known as YOYO suggestions, can be understood as an application or a standalone window, also called a YOYO window. A standalone window is not a window within a user-opened application, but rather a system-provided window on the electronic device. This standalone window can be placed above any application page displayed on the electronic device. It can embed task entry points for one or more applications. When a task is executed within this standalone window, a new task can be created or a task can be reused for the corresponding application. Through this standalone window, social networking applications, payment applications, navigation apps, etc., can be launched, allowing their screens to be embedded within the standalone window.
[0286] When launching other applications via a new task, the execution of the new task can be independent of other running tasks. This allows the screen of other applications to be embedded in a separate window without easily interrupting the operation of any application displayed on the electronic device. In this way, the invocation of the window does not affect the user's current operation, improving the user experience. For example, if a user is watching a video or playing a game on their electronic device, and the user triggers the display of this window, the video and game can continue uninterrupted.
[0287] It should be understood that the Quick Code Display application and Smart Assistant are just examples. Electronic devices may also include other applications that can launch multiple applications, which will not be shown here.
[0288] It should also be understood that the application names shown in the embodiments of this application are merely examples, and the names of each application can be replaced with other names. For example, quick code display can be called smart code display, etc. The embodiments of this application do not specifically limit this.
[0289] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer includes some predefined functions. For example... Figure 13As shown, the application framework layer may include embedded management modules, non-embedded management modules, activity task management modules, window management modules, view management modules, and layer management modules, etc.
[0290] The embedded management module can be understood as an API used to launch activities that need to be embedded in the target window; that is, an API for launching activities in an embedded manner. The embedded management module can set activity options for the activity. It can also instruct the layer management module to set task 'a' as the viewport of the target window. Figure 1 The child nodes.
[0291] It should be understood that the activity options of an activity can also be understood as the activity's startup parameters. In the embodiments of this application, the activity options of an activity include options for indicating whether to start the activity in an embedded manner and options for indicating whether to start the activity as a new task or a reused task.
[0292] The view management module can be used to create views that can be embedded in other applications, and it can also call the layer management module to create layers for the view, such as creating a view. Figure 1 Layers, etc.
[0293] Non-embedded management modules can be understood as APIs that launch activities in a non-embedded manner.
[0294] The activity task management module can be used to launch activities by creating new tasks or reusing existing tasks.
[0295] The window management module is used to manage window applications. It can create active windows, which can layout one or more views corresponding to that activity, and allows setting the window's layout and size, among other things.
[0296] The layer management module can create layers for views, enabling electronic devices to display the corresponding screen for an activity. The layer management module can also set the relationship between tasks and views, for example, setting task 'a' as view 'a'. Figure 1 Child nodes, etc.
[0297] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.
[0298] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0299] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0300] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.
[0301] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0302] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0303] A 2D graphics engine is a graphics engine for 2D drawing.
[0304] The kernel layer is the layer between hardware and software. It drives the hardware, enabling it to function. The kernel layer includes at least a display driver and a graphics processing unit (GPU) driver. For example, the display driver can drive the screen to display the image corresponding to activity 'a'.
[0305] It should be noted that, Figure 13 The software architecture shown is merely an example. Electronic devices can include many more. Figure 13 Software modules not shown in the diagram, for example, the application layer may include applications such as cameras and music; the kernel layer may include camera drivers, etc. Furthermore, electronic devices may include even more layers, such as the hardware abstraction layer (HAL), etc. Figure 13 The software architecture shown does not constitute a limitation on the embodiments of this application.
[0306] Below, in conjunction with Figure 14 , with application a as Figure 12 Application 1 is shown, and application b is... Figure 12 Taking the quick code display application shown as an example, from electronic devices including such Figure 13 The method of embedding the payment code function of application 1 into the window 1201 of the quick code display application, from the perspective of interaction between the software modules shown, is explained.
[0307] The embedded view of the quick code display application includes view 1202, which can embed the screen corresponding to the payment code function of application 1. The payment code function of application 1 corresponds to activity a1. That is, by activating activity a1 through method 1400, the electronic device can display, as shown below. Figure 12 The interface shown in (a) is shown in the image.
[0308] To facilitate understanding, it's important to first clarify that before executing method 1400, i.e., before embedding the screen corresponding to the payment code function of Application 1 into the window 1201 of the quick code display application, a task of Application 1 is running in the background of the electronic device. This task is, for example, task a-1. The activity at the top of the stack in task a-1 can be activity 3, which provides the chat interface for Application 1. Therefore, in response to the user's operation of viewing the multi-task card, the electronic device can display the card of the background-running Application 1, and this card displays the chat interface. For example, see reference... Figure 11 In (a), the card for application 1 is shown as the card for application a.
[0309] Figure 14 This is a flowchart illustrating the application launch method 1400 provided in this embodiment of the application. Process 1400 includes the following steps:
[0310] S1401, In response to a user's operation of activating the payment code function of Application 1 through the Quick Code Display application, such as double-clicking the icon of the Quick Code Display application or double-clicking the back panel of the electronic device, the Quick Code Display application instructs the view management module to create view 1202. View 1202 can be used to embed the screen corresponding to the payment code function of Application 1.
[0311] Among them, view 1202 can be with Figure 12 The view corresponding to the selection of the "Receive / Pay" button in interface (a). Figure 12 The selected payment button in interface (a) (which is also a view in window 1201 of the Quick Code Show application) can be associated with view 1202. Therefore, based on the user's operation of activating the payment code function of application 1, the Quick Code Show application can request the view management module to create view 1202.
[0312] It is understandable that prior to S1401, the electronic device could run the Quick Code Display application service in the background. The Quick Code Display application service can be understood as a component of the Quick Code Display application. When the Quick Code Display application service detects a user activating the payment code function of application 1, it can call the window management module to create window 1201. Furthermore, the Quick Code Display application service can also obtain an XML file containing one or more views. These views may include view 1202. The Quick Code Display application service can instruct the view management module to create view 1202. The window management module can then set view 1202 created by the view management module within window 1201. Thus, window 1201 can display the screen shown in view 1202.
[0313] S1402, The view management module instructs the layer management module to create a layer for view 1202.
[0314] S1403, The quick code display application requests the embedded management module to start activity a1. Activity a1 is the activity corresponding to the payment code function of application 1.
[0315] For example, the quick code display application starts activity a1 by calling relevant methods or functions in view 1202 through the embedded management module. In this way, the embedded management module can determine that the screen corresponding to activity a1 needs to be embedded in view 1202.
[0316] It is understandable that S1403 could also be executed based on the user's activation of the payment code function in application 1. Figure 12 The selected "Pay / Receive" button in interface (a) (which is also a view of window 1201) can be configured with logic 1: selecting the "Pay / Receive" button will display the screen in view 1202 in window 1201, and the screen in view 1202 is the screen corresponding to the payment code function of application 1. Since the payment code function corresponds to activity a1, the quick code display application requests to start activity a1. The user's operation of starting the payment code function of application 1 can be associated with the selected "Pay / Receive" button in interface (a). Therefore, based on the user's operation of starting the payment code function of application 1, the quick code display application can request to start activity a1 through view 1202.
[0317] It should be understood that S1403 and S1401 can be executed in parallel, and S1403 can be executed after or before S1401. This application does not make any specific restrictions on this.
[0318] Optionally, the quick code display application can also indicate parameter 1 or parameter 2 to the embedded management module.
[0319] Parameter 1 indicates that the screen corresponding to activity a1 is embedded in window 1201 by reusing a task. Parameter 2 indicates that the screen corresponding to activity a1 is embedded in window 1201 by creating a new task. For example, parameter 1 can be 0 and parameter 2 can be 1; or parameter 1 can be 1 and parameter 2 can be 0, etc.
[0320] The quick code display application can also indicate parameter 3 to the embedded management module. Parameter 3 is used to indicate the bounds attribute parameter 2 of the screen corresponding to activity a1. The bounds attribute parameter 2 can be understood as a parameter used to indicate the size and position of the screen corresponding to activity a1. The bounds attribute parameter 2 can include the coordinates of the upper left corner and the lower right corner of the screen corresponding to activity a1.
[0321] Optionally, the electronic device may have a pre-set window 1201 for the quick code display application embedded with the screen corresponding to the payment code function of application 1. For example, the electronic device may have a pre-set message 1 indicating that the screen corresponding to the payment code function of application 1 is embedded into the window 1201 of the quick code display application in a reused task manner.
[0322] Suppose we replace the quick code display application with Figure 5 If the smart assistant shown in the figure replaces application 1 with a navigation application, the electronic device can preset the smart assistant to embed the navigation application into the target window by creating a new task.
[0323] In this way, when navigation applications are embedded into the smart assistant's window 501 by creating a new task, the electronic device's display window 501 has minimal impact on other displayed applications. For example, combined with Figure 5 In interface (b), the navigation application embedded in window 501 of the electronic device is displayed. At the same time, the note-taking application is still displayed in full screen below window 501. When the screen corresponding to the payment code function of application 1 is embedded in window 1201 by reusing tasks, the power consumption of the electronic device is low, and activity a1 can exist as a single instance, which reduces the possibility of application 1 crashing. The success rate of embedding the screen corresponding to the payment code function of application 1 in window 1201 of the electronic device is high.
[0324] S1404. The embedded management module sets the activity options for activity a1 and requests the activity task management module to start activity a1.
[0325] The activity options for activity a1 can include option 1, which is used to set whether activity a1 is launched in an embedded mode or a non-embedded mode. It can be understood that based on the operation of the quick code-encoding application calling the embedded management module, the embedded management module can determine that activity a1 needs to be launched in an embedded mode. Therefore, the embedded management module can set option 1 to indicate information for launching activity a1 in an embedded mode. The information indicating whether to launch activity a1 in an embedded mode could be, for example, true or 1. In this way, the activity task management module can determine to launch activity a1 in an embedded mode based on option 1.
[0326] The activity options for activity a1 can also include option 2, which is used to set the bounds attribute parameter 2 of the screen corresponding to activity a1. The embedded management module can set option 2 based on parameter 3 of the quick code application instruction. In this way, the activity task management module can instruct the window management module to adjust the position and size of the screen corresponding to activity a1 based on option 2.
[0327] The activity options for activity a1 may also include option 3, which is used to set information indicating the view 1202 to be embedded in the screen corresponding to activity a1. That is, option 3 can be set to indicate information for view 1202. For example, the embedded management module can determine that the screen corresponding to activity a1 should be embedded in view 1202 based on the quick code display application in S1403 requesting to start activity a1 through view 1202, and then set option 3 to indicate information for view 1202.
[0328] The activity options for activity a1 may also include option 4, which is used to set whether the screen corresponding to activity a1 is embedded in view 1202 as a new task or a reused task. The embedded management module can set option 4 to indicate whether activity a1 is started as a reused task based on parameter 1 of the quick code application indication; or, the embedded management module can set option 4 to indicate whether activity a1 is started as a new task based on parameter 2 of the quick code application indication. In this way, the activity task management module can determine whether to start activity a1 as a new task or a reused task based on option 4.
[0329] It should be understood that the activity options of activity a1 can also be referred to as the startup parameters of activity a1, which can be used to set parameters required by various activity task management modules to start activity a1. The activity options of activity a1 may also include other options such as those for setting the name, URI, or task affinity of activity a1. This application does not specifically limit the other options included in the activity options of activity a1.
[0330] When the embedded management module sets option 4 based on parameter 2 to indicate that activity a1 is started as a new task, the electronic device can execute S905 to S909, and replace activity a with activity a1 and task a with task a-1 in S905 to S909.
[0331] When the embedded management module sets option 4 based on parameter 1 to indicate that activity a1 is started in a way that reuses a task, the electronic device executes S1405, that is, the activity task management module determines whether there is a reusable task.
[0332] In one scenario, if the activity task management module determines that there is no reusable task, the electronic device can execute S905 to S909, that is, embed the screen corresponding to activity a1 into view 1202 by creating a new task, and replace activity a with activity a1 and task a with task a-1 in S905 to S909.
[0333] In another scenario, if the activity task management module determines that there is a reusable task, the electronic device can execute S1406 to S1410.
[0334] It should be understood that the activity task management module determines the existence of reusable tasks by searching among the tasks running on the electronic device to see if there is a reusable task that can launch activity a1. This process is independent of whether the task includes activity a1. Taking task a-1 as an example, if task a-1 is a reusable task for launching activity a1, when task a-1 is running in the background, task a-1 can include activity a1, and in addition to activity a1, task a-1 can also include one or more other activities; or, task a-1 may not include activity a1, but task a-1 may include one or more other activities, etc.
[0335] Optionally, S1405 can be implemented in one of the following two ways: The activity task management module determines whether there is a task with the same task affinity as activity a1 among the tasks running in the electronic device. If so, the task with the same task affinity as activity a1 is a reusable task; otherwise, there is no reusable task. Alternatively, the activity options for activity a1 may also include option 5, which can be set to indicate information for managing the tasks of activity a1; in this way, the activity task management module can also determine whether there is a task indicated by option 5 among the tasks running in the electronic device based on option 5. If so, the task indicated by option 5 is a reusable task; if not, there is no reusable task.
[0336] The task affinity of activity a1 can also be understood as an attribute of activity a1, which can be recorded in the activity options of activity a1. The task affinity of each task running on an electronic device is included in its attribute information. Task affinity can be, for example, the application's package name. Electronic devices can reuse tasks with the same task affinity to start activities.
[0337] S1406, the activity task management module brings task a-1 to the foreground and starts activity a1 within task a-1. The activity task management module also records information about task a-1 and, if it determines that task a-1 is not embedded in other views, sets a correspondence 1 between task a-1 and view 1202. Correspondence 1 is used to indicate that task a-1 should be run in view 1202.
[0338] Thus, in response to bringing task a-1 to the foreground, task a-1 is no longer running in the background of the electronic device. In response to the user viewing the multitasking cards, the multitasking cards will no longer display the chat interface of application 1.
[0339] It is understandable that if task a-1 includes activity a1, the activity task management module can move activity a1 to the top of the stack in task a-1; if task a-1 does not include activity a1, the activity task management module will start activity a1 in task a-1.
[0340] The information for task a-1 may include, for example, information indicating task a-1, such as the task a-1 ID; and / or, the display status information of task a-1, which describes the display status of the screen corresponding to task a-1 during background operation. For example, it may indicate that the screen corresponding to task a-1 is running in the background in a split-screen, full-screen, or floating window state. This facilitates the restoration and reuse of the previous state of task a-1 when exiting the embedded system.
[0341] Correspondence 1 can be set in the following ways: set an object that can be transferred across processes to indicate view 1202; or set flag 1 to indicate information for view 1202, and flag 1 is used to record the parent node of task a-1.
[0342] Optionally, the activity task management module can determine that task a-1 is not embedded in other views by: the activity task management module determining that the flag bit x is set with information indicating that task a-1 exists in a non-embedded state. A non-embedded state can indicate that the parent node of task a-1 is the default task display area.
[0343] It should be noted that, since the activity task management module can determine in S1406 that activity a1 needs to be started in an embedded manner, it can also set the flag bit x to indicate that task a1 exists in an embedded state if it determines that task a-1 is not embedded in another view. This way, when the activity task management module reuses task a-1 the next time, it can determine that task a-1 exists in an embedded state. Here, embedded state can be understood as task a-1 running in a view of another application, or task a-1's parent node being a view of another application, or task a-1's parent node being none, etc.
[0344] As an optional embodiment, in S1406, if the activity task management module determines that task a-1 is in an embedded state, the activity task management module can also determine which view is the parent node of task a-1.
[0345] In one possible approach, if the activity task management module determines that the parent node of task a-1 is none, then the activity task management module can set the correspondence between task a-1 and view 1202, and can set the parent node of task a-1 to view 1202 through S1409 and S1410, so that the screen corresponding to activity a1 is displayed in view 1202.
[0346] In another possible approach, if the activity task management module determines that the parent node of task a-1 is another view, the activity task management module can modify the correspondence between task a-1 and other views to correspondence 1, and the electronic device can embed the screen corresponding to activity a1 into view 1202 through the implementation of S1416 to S1422.
[0347] S1407. The activity task management module indicates the information of activity a1 and task a-1 to the window management module.
[0348] The information for activity a1 and task a-1 may include: the bounds attribute parameter 2 of the screen corresponding to activity a1, information indicating that the screen corresponding to activity a1 should be embedded in view 1202, information indicating activity a1, and information indicating task a-1.
[0349] The information used to indicate activity a1 could be, for example, the name of activity a1, and the information used to indicate task a-1 could be, for example, the ID of task a. The information used to indicate embedding the screen corresponding to activity a1 into view 1202 could be, for example, setting an object that can be transferred across processes. This object can be used to indicate view 1202.
[0350] In response to instructions from the activity task management module, the window management module can create a window for activity a1, and can set the size and position of this window based on the bounds attribute parameter 2. This window can set one or more views for activity a1.
[0351] S1408, The window management module instructs the layer management module to create the screen corresponding to activity a1.
[0352] In one scenario, if task a-1 is running in the background before it is reused, and if activity a1 is not included in task a-1, the layer management module can draw the layer of view 1202. View 1202 is one or more views of activity a1. The layer of view 1202 is the visual layer drawn in view 1202. Furthermore, the layer management module can create a layer for activity a1 and set the layer of activity a1 as the parent node of the layer of view 1202. In this way, by setting the Z-Order parameter of the layer of activity a1, the layer of activity a1 can be adjusted above the layers of other activities in task a-1, allowing the electronic device to display the screen corresponding to activity a1.
[0353] In another scenario, if task a-1 is running in the background before it is reused, and if task a-1 includes activity a1, the layer management module can set the position of the layer in view 1202 (for example, by setting the Z-Order parameter of the layer in activity a1), so that the electronic device can display the layer in view 1202 (i.e. the screen corresponding to activity a1).
[0354] S1409, The window management module instructs the embedded management module to run task a-1 in view 1202.
[0355] It should be understood that S1409 and S1408 can be executed in parallel, and S1409 can be executed before or after S1408. This application does not make any specific restrictions on this.
[0356] S1410, The embedded management module instructs the layer management module to set task a-1 as a child node of view 1202. Setting task a-1 as a child node of view 1202 can also be replaced by setting view 1202 as the parent node of task a-1, etc.
[0357] Based on the above embodiments, optionally, the embedded management module or window management module can also instruct the layer management module to set the attributes of task a-1, such as setting task a-1 to be visible; it can also set the size and position of the layer of task a-1 based on the bounds attribute parameter 2. In this way, since the layer of task a-1 is the parent node of the layer of activity a1, and the layer of activity a1 is the parent node of the layers in the window of activity a1, the layer management module can set the screen corresponding to activity a1 to be visible, and can set the size and position of the screen corresponding to activity a1, so that the screen corresponding to activity a1 is displayed in view 1202.
[0358] It is understandable that although S1410 specifies setting task a-1 as a child node of view 1202, from the perspective of the electronic device display interface, the layer management module actually sets the layer of task a-1 as a child node of the layer of view 1202. In this embodiment, for the sake of brevity, setting the layer of task a-1 as a child node of the layer of view 1202 is referred to as setting task a-1 as a child node of view 1202. This description does not constitute a limitation on the embodiments of this application.
[0359] It should also be understood that, in the embodiments of this application, the layer management module setting the attributes of a task can also be understood as the layer management module setting the attributes of the layer of that task; the layer management module setting the size and position of the screen corresponding to an activity (e.g., activity a) can also be understood as the layer management module setting the size and position of the layer of a task (e.g., task a), where task a includes activity a. This application does not impose any specific limitations on this.
[0360] Through S1401 to S1410, the electronic device can display Figure 12 The interface (a) in the middle. Since Application 1 displays the chat interface in the background before executing method 1400, after embedding the payment code function of Application 1 into the window 1201 of the quick code display application by reusing the task, Application 1 switches from the background to the foreground, and Application 1 also switches from displaying the chat interface to the screen corresponding to the payment code function.
[0361] However, combined Figure 12 Furthermore, the window 1201 of the quick code scanning application can also embed screens corresponding to other functions of application 1, such as the screen corresponding to the scan function shown in interface (b). Therefore, after S1410, the electronic device can also respond to the user's... Figure 12 After clicking the scan button in interface (a), interface (b) continues to be displayed. This is in response to the user's action. Figure 12 The operation of clicking the scan button in interface (a) and the process of switching from interface (a) to interface (b) can be implemented through S1411 to S1422.
[0362] in, Figure 12 In the interface (b), the scan function of application 1 corresponds to activity a2 of application 1, and activity a2 can also be launched by reusing task a-1.
[0363] S1411, Responding to user input Figure 12 In interface (a), clicking the "Scan" button triggers the Quick Code Display application's indicator view management module to create view 1203 within window 1201 of the Quick Code Display application. View 1203 can be used to embed the screen corresponding to the scan function of application 1.
[0364] Among them, view 1203 can be Figure 12 The view corresponding to the "Scan" button selected in the middle interface (a).
[0365] It is understandable that after creating view 1203 in the view management module, view 1203 can be set in window 1201 through the window management module. Furthermore, the window management module can also remove view 1202 so that the electronic device does not display the screen in view 1202.
[0366] S1412, The view management module instructs the layer management module to create a layer for view 1203.
[0367] S1413, Quick Code Display Application requests embedded management module to start activity a2.
[0368] For example, the quick code display starts activity a2 by calling the relevant methods or functions in view 1203 through the embedded management module, so that the embedded management module can determine that the screen corresponding to activity a2 needs to be embedded in view 1203.
[0369] It is understandable that S1413 could also be based on user input. Figure 12 The operation of clicking the "Scan" button in interface (a) is executed. Figure 12 The operation of clicking the scan button in interface (a) can be used to indicate the display of the screen corresponding to activity a2, that is, to display the screen corresponding to the scan function of application 1.
[0370] It should be understood that S1413 and S1411 can be executed in parallel, and S1413 can be executed before or after S1411. This application does not make any specific restrictions on this.
[0371] S1414. The embedded management module sets the activity options for activity a2 and requests the activity task management module to start activity a2.
[0372] When the embedded management module sets option 4 based on parameter 2 to indicate that activity a2 should be started as a new task, the electronic device can execute S905 to S909, replacing activity a with activity a2 and task a with task a-1 in S905 to S909. Option 4 in the activity options of activity a2 is used to set either information indicating that activity a2 should be started as a new task, or information indicating that activity a2 should be started as a reused task.
[0373] When the embedded management module sets option 4 to indicate information for starting activity a2 in a way that reuses a task based on parameter 1, the electronic device executes S1415, that is, the activity task management module determines whether there is a reusable task.
[0374] Assuming the activity task management module, based on the activity options of activity a2, determines that the reusable task is the foreground running task a-1.
[0375] It should be understood that the implementation methods of S1411 to S1415 are similar to those of S1401 to S1405, and can be referred to the description above, which will not be repeated here.
[0376] S1416. The activity task management module records the information of task a-1, and if it determines that task a-1 has been embedded in view 1202, it modifies the correspondence between task a-1 and view 1202 (relationship 1) to the correspondence between task a-1 and view 1203 (relationship 2). Correspondence 2 is used to indicate that task a-1 should be run in view 1203.
[0377] For example, the activity task management module can determine that task a-1 exists in an embedded state based on the flag bit x set in S1406. Furthermore, the activity task management module can also determine that the parent node of task a-1 is view 1202 by calling functions or other means. Therefore, the activity task management module modifies correspondence 1 to correspondence 2.
[0378] Optionally, the activity task management module can modify correspondence 1 to correspondence 2, for example, by updating the cross-process transferable object used to indicate view 1202 to the cross-process transferable object used to indicate view 1203.
[0379] S1417, The activity task management module instructs the embedded management module task a-1 to stop running in view 1202.
[0380] S1418, The embedded management module indicates that the quick code display application task a-1 has stopped running in view 1202.
[0381] S1419. The activity / task management module instructs the window management module on the information of activity a2 and task a-1. The information of activity a2 and task a-1 includes correspondence 2.
[0382] It should be understood that S1417 and S1419 can be executed in parallel, and S1417 can be executed after or before S1419. This application does not make any specific restrictions on this.
[0383] S1420, The window management module instructs the layer management module to create the screen corresponding to activity a2.
[0384] It should be understood that the implementation methods of S1419 and S1420 are similar to those of S1407 and S1408, and can be referred to the description above, which will not be repeated here.
[0385] S1421, The window management module instructs the embedded management module to set task a-1 as a child node of view 1203.
[0386] It should be understood that S1421 and S1420 can be executed in parallel, and S1421 can be executed before or after S1420. This application does not make any specific restrictions on this.
[0387] It should also be understood that the implementation methods of S1421 and S1409 are similar, and can be referred to the description above, which will not be repeated here.
[0388] S1422, The embedded management module instructs the layer management module to set the parent node of task a-1 from view 1202 to view 1203.
[0389] The interface displayed by the electronic devices S1411 to S1422 is from Figure 12 The interface (a) redirects to Figure 10 The interface (b).
[0390] In addition, combined Figure 12 As can be seen from interfaces (b) and (c), different application screens can also be embedded in the quick code display.
[0391] Below, in conjunction with Figure 15 ,by Figure 12 Taking the process from interface (b) to interface (c) as an example, this paper explains the process of embedding different activity layers of different applications into different views in window 1201.
[0392] in, Figure 12 The interface (c) includes the screen corresponding to the payment code function of application 2. The payment code function of application 2 corresponds to activity a3 of application 2. The embedded view of the window 1201 of the quick code display application includes view 1204, and view 1204 can be used to embed the screen corresponding to the payment code function of application 2.
[0393] It should be noted that before the electronic device executes method 1500, a payment application 2 is running in the background of the electronic device. Figure 12 The example shown is application 2), which is a task running in the background of an electronic device. This task is, for example, task a-2. Assume that the activity at the top of the stack in task a-2 is activity 4, which provides the main interface of application 2. Then, in response to a user's action of viewing a multitasking card, which includes a card for application 2, the main interface of application 2 is displayed.
[0394] Figure 15 This is a flowchart illustrating another application launch method 1500 provided in an embodiment of this application. Method 1500 includes the following steps:
[0395] First, the electronic device displays the information via steps S1401 to S1422. Figure 12 The interface (b) in the view shows that task a-1 is running in view 1203.
[0396] Subsequently, in response to Figure 12 In the interface (b) used to instruct the activation of the payment code function in application 2, the electronic device executes S1501 to S1515. It can be understood that in order to display the screen corresponding to the payment code function in application 2 in window 1201, the electronic device can first remove the screen corresponding to the scan function of application 1 from the embedded window 1201 (even if task a-1 of application 1 is no longer running in view 1203); and then embed the screen corresponding to the payment code function of application 2 into window 1201.
[0397] S1501, Responding to the operation of the screen corresponding to the payment code function in application 2 when the user launches it (e.g., in...). Figure 12 (b) Click the edit button on the interface, and then select the operation of the payment code function of application 2. The quick code display application instruction view management module creates view 1204. View 1204 can be used to embed the screen corresponding to the payment code function of application 2.
[0398] It is understandable that after the view 1204 is created in the view management module, the view 1204 can be set in the window 1201 through the window management module. Furthermore, the window management module can also remove the view 1203 so that the electronic device does not display the screen in the view 1203.
[0399] S1502, The view management module instructs the layer management module to create a layer for view 1204.
[0400] S1503, Quick Code Display Request Embedded Management Module to start Activity a3 of Application 2, Activity a3 corresponds to the payment code function of Application 2.
[0401] It should be understood that S1503 and S1501 can be executed in parallel, and S1503 can be executed before or after S1501. This application does not make any specific restrictions on this.
[0402] S1504. The embedded management module sets the activity options for activity a3 and requests the activity task management module to start activity a3.
[0403] S1505, The activity task management module determines whether there are reusable tasks.
[0404] If it exists, then execute S1506 to S1515.
[0405] If it does not exist, execute S905 to S909, and replace activity a with activity a3 and task a with task a-2 in S905 to S909.
[0406] Alternatively, if no reusable task exists, the electronic device can also, via steps S1510 to S1515, remove the screen corresponding to activity a2 from the window 1201. This prevents the interface displayed by the electronic device from simultaneously including the screen corresponding to activity a2 and the screen corresponding to activity a3. This reduces the overlap between the screens corresponding to activity a2 and activity a3, thereby improving the user experience.
[0407] It is understandable that the activity task management module can determine reusable tasks in the following way: the activity options for activity a3 include information 2, which represents an attribute of the task (such as task affinity or task name), and activity a3 can be started from a task that matches information 2. Then, the activity task management module can determine whether the tasks running on the electronic device include a task that matches information 2. Suppose the activity task management module determines that task a-2 matches information 2, for example, the task affinity of task a-1 is the same as the task affinity indicated in information 2, or the name of task a-2 is the same as the name indicated in information 2, etc. Therefore, the activity task management module determines that task a-2 can be reused to start activity a3.
[0408] It should be noted that the activity task management module determines whether a reusable task exists based on information 2 and the attributes of the background running task, and is unrelated to whether the background running task includes activity a3. For example, task a-1 may or may not include activity a3.
[0409] S1506. The activity task management module records the information of task a-2; moves task a-2 to the foreground, and the activity task management module starts activity a3 in task a-2, or moves activity a3 that already exists in task a-2 to the top of the stack.
[0410] In addition, if the activity task management module determines that task a-2 is not embedded in other views, it sets the correspondence between task a-2 and view 1204.
[0411] S1507, The activity / task management module instructs the window management module on the information of activity a3 and task a-2. The information of activity a3 and task a-2 includes the correspondence 3.
[0412] S1508, The window management module instructs the layer management module to create the screen corresponding to activity a3.
[0413] S1509, The window management module instructs the embedded management module to run task a-2 in view 1204.
[0414] It should be understood that the implementation methods of S1501 to S1509 are similar to those of S1401 to S1409, and can be referred to the description above, which will not be repeated here.
[0415] S1510, The embedded management module indicates that the quick code display application task a-1 has stopped running in view 1203.
[0416] It should be understood that, in order to prevent multiple overlapping screens from being displayed in the window 1201 of the quick code display application, thereby providing a good visual experience for the user, the window 1201 of the quick code display application can embed a screen corresponding to the activity. Therefore, after the embedded management module determines that task a-1 is embedded in view 1203 of window 1201, the embedded management module instructs the quick code display application task a-1 to stop running in view 1203.
[0417] Optionally, the embedded management module may maintain, for example, a table 1, which records the tasks of other applications running in window 1201. For example, table 1 records that task a-1 is running in view 1203. Table 1 can also be replaced with other views that can be used to record the tasks of other applications running in window 1201.
[0418] S1511, The embedded management module instructs the activity task management module to return task a-1 to the background.
[0419] S1512, The activity task management module returns task a-1 to the background, but task a-1 remains in an embedded state. That is, the flag bit x is still set to indicate that task a-1 exists in an embedded state.
[0420] S1513, The activity task management module instructs the window management module to update the information of activity a2 and task a-1. For example, the window management module deletes the information used to indicate the correspondence between task a-1 and view 1203 (i.e., correspondence 2), and updates the size and layout of the window of activity a2, etc.
[0421] S1514. Since the flag bit x is set to indicate that task a-1 exists in an embedded state, the window management module instructs the layer management module to set the parent node of task a-1 from view 1203 to none.
[0422] In this way, task a-1 can run in the background in an embedded state. In response to the user's action of viewing the multitasking card, the application 1 card displayed on the electronic device exists in an embedded state. The application 1 card in embedded state can display the screen corresponding to application 1's scan function, or it can display a chat interface.
[0423] It should be understood that the size or proportion of the application card in an embedded state may differ from that of the application card in a non-embedded state. This application does not impose specific limitations in this regard.
[0424] Optionally, in S1512, the activity task management module can also return task a-1 to the background in a non-embedded state and set the flag bit x to indicate that task a-1 exists in a non-embedded state. Furthermore, the activity task management module sets the display state of task a-1 to full-screen display, allowing the screen corresponding to task a-1 to run in the background in full-screen mode. Alternatively, the activity task management module can set the display state of task a-1 to the state indicated by the display state information of task a-1 recorded in S1406, allowing the screen corresponding to task a-1 to be displayed in a reused state, and task a-1 to run in the background in a reused state.
[0425] Correspondingly, in S1514, since the flag bit x is set to indicate that task a-1 exists in a non-embedded state, the window management module instructs the layer management module to set the parent node of task a-1 from view 1203 to the default task display area.
[0426] S1515, The embedded management module instructs the layer management module to set the parent node of task a-2 as view 1204.
[0427] It is understood that S1515 can be executed in parallel with S1511 and S1510, and S1515 can also be executed after S1511 and S1510. This application does not make any specific restrictions on this.
[0428] It should be understood that, through S1501 to S1515, the interface displayed by the electronic device can be changed from... Figure 12 Switch to the interface (b) Figure 12The interface (c) in the middle. Furthermore, since the electronic device embeds the screen corresponding to the payment code function of application 2 into the window 1201 of the quick code display application in the manner of task reuse, the task a-2 of application 2 running in the background is switched from the background to the foreground, and application 2 switches from displaying the main interface to displaying the screen corresponding to the payment code function.
[0429] As an optional embodiment, the electronic device can also change the interface displayed by the electronic device from S1401 to S1410 and S1501 to S1509. Figure 12 The interface (a) redirects to Figure 12 The interface (c) is described above and will not be repeated here.
[0430] It should be noted that methods 1400 and 1500 respectively illustrate the process of embedding different function-corresponding screens of the same application in the window 1201 of the quick code display application and the process of embedding screens of different applications.
[0431] In some possible implementations, the electronic device can also run the same task in views of different applications. For example, task a-1 of application 1 (e.g., the scan screen of application 1 is embedded in the quick code scanning application) runs in window 1201 of the quick code scanning application; then, the smart assistant embeds task a-1 of application 1 by reusing task a-1 (the smart assistant also embeds the scan screen of application 1). This smart assistant can be referenced, for example, from... Figure 5 The smart assistant is shown in the figure. Suppose that another view can be laid out in the window 501 of the smart assistant, such as view 505, and view 505 can display the scan screen of application 1.
[0432] In this scenario, since the parent node of task a-1 is view 1203 of the quick code display application, the electronic device needs to first stop task a-1 from running in view 1203 of the quick code display application, and then make task a-1 run in view 505 of the smart assistant.
[0433] Below, in conjunction with Figure 16 This section explains the process of embedding the corresponding screen of Application 2's scan function into View 505 of the Smart Assistant, assuming that the screen corresponding to Application 2's scan function is already embedded in View 1203 of the Quick Code Display application. That is, the electronic device... Figure 12 The interface (b) jumps to another interface, and the other interface is the same as... Figure 5 The interface (b) is similar. Another interface is... Figure 5 The difference between interface (b) and the previous one is that view 505 is displayed in window 501, and view 505 displays... Figure 12 The screen corresponding to the scan function of application 1.
[0434] Figure 16 This is a flowchart illustrating another application launch method 1600 provided in an embodiment of this application. Method 1600 includes the following steps:
[0435] First, the electronic device embeds the screen corresponding to the scan function of Application 1 into the view 1203 of the quick code display window 1201 via S1401 to S1422.
[0436] In response to a user's instruction to activate the scan function of application 1 via the smart assistant, the electronic device executes steps S1601 to S1612. The scan function of application 1 corresponds to activity a2 of application 1.
[0437] S1601, The Smart Assistant Instruction View Management Module creates View 505. View 505 can be used to embed the screen corresponding to the scan function of Application 1.
[0438] S1602, The view management module instructs the layer management module to create a layer for view 505.
[0439] S1603, The smart assistant requests the embedded management module to start activity a2.
[0440] S1604. The embedded management module sets the activity options for activity a2 and requests the activity task management module to start activity a2.
[0441] S1605, The activity task management module determines whether there are reusable tasks.
[0442] If no reusable task exists, the electronic device can execute S905 to S909, that is, by creating a new task, embed the screen corresponding to activity a2 into the view 505 of window 501, and replace activity a with activity a2 and task a with task a-1 in S905 to S909.
[0443] If a reusable task exists, the electronic device can execute S1606 to S1612.
[0444] It is understandable that at this time, the electronic device is running task a-1 of application 1 (task a-1 runs in view 1203 of the quick code display application). Assume that the activity task management module determines that task a-1 is a reusable task.
[0445] S1606 The activity task management module records the information of task a-1, and when it is determined that task a-1 has been embedded in view 1203, it modifies the correspondence 2 between task a-1 and view 1203 to the correspondence 4 between task a-1 and view 505.
[0446] Furthermore, since activity a2 is at the top of the stack in task a-1, the activity task management module does not need to start activity a2.
[0447] It should be understood that the implementation methods of S1601 to S1606 are similar to those of S1411 to S1416, and can be referred to the description above, which will not be repeated here.
[0448] S1607, The activity task management module instructs the embedded management module task a-1 to stop running in view 1203.
[0449] S1608, The embedded management module indicates that the quick code display application task a-1 has stopped running in view 1203.
[0450] Furthermore, the quick code display application can also instruct the window management module to remove window 1201; the window management module can instruct the layer management module to remove window 1201. The layer management module can set the layers in window 1201 to invisible, so the electronic device will no longer display window 1201.
[0451] S1609. The activity / task management module instructs the window management module to update the information of activity a2 and task a-1. For example, the window management module updates correspondence 2 to correspondence 4, etc.
[0452] S1610, The window management module instructs the layer management module to update the screen corresponding to activity a2. For example, updating the size and position of the screen corresponding to activity a2.
[0453] S1611, The window management module instructs the embedded management module to run task a-1 in view 505.
[0454] S1612, The embedded management module instructs the layer management module to change the parent node of task a-1 from view 1203 to view 505.
[0455] It should be understood that the implementation methods of S1607 to S1612 are similar to those of S1417 to S1422, and can be referred to the description above, which will not be repeated here.
[0456] Furthermore, when the view 1202 of the quick code display application has already embedded the screen corresponding to the payment code function of application 1 (corresponding to activity a1), the process of embedding the screen corresponding to the scan function of application 1 (corresponding to activity a2) in the view 505 of the smart assistant is similar to method 1600. The difference is that the electronic device first embeds the screen corresponding to the payment code function (corresponding to activity a1) in the view 1202 of the quick code display application through S1401 to S1408, and then embeds the screen corresponding to the scan function (corresponding to activity a2) in the view 505 of the smart assistant through S1601 to S1610. Please refer to the description above; it will not be repeated here.
[0457] The above explains the process by which electronic devices embed the screen of application A into the view of application B in several different scenarios. Below, we will combine... Figure 17 ,by Figure 12 Taking the process of exiting view 1202 of the embedded quick code display application corresponding to the payment code function of application 1 as an example, the process of exiting the view of embedded application b corresponding to the screen of application a will be explained. That is... Figure 17 The steps in this process can be performed after S1410 in method 1400.
[0458] It is understandable that when an electronic device embeds the screen corresponding to the payment code function of Application 1 into view 1202 of the quick code display application by creating a new task, the electronic device can exit view 1202 by exiting the embedded screen of the payment code function of Application 1 through steps S910 to S914. When an electronic device embeds the screen corresponding to the payment code function of Application 1 into view 1202 of the quick code display application by reusing a task, the process of exiting view 1202 by exiting the embedded screen of the payment code function of Application 1 can refer to method 1700. Method 1700 has the following two scenarios: scenario one and scenario two.
[0459] First, it should be noted that the above explanation, for ease of understanding, describes embedding the screen corresponding to the payment code function of Application 1 into view 1202 of the Quick Code Display application. In reality, embedding the screen corresponding to the payment code function of Application 1 into view 1202 of the Quick Code Display application means running task a-1 of Application 1 in view 1202, with activity a1 (corresponding to the payment code function) at the top of the stack within task a-1. Therefore, removing the screen corresponding to the payment code function of Application 1 from view 1202 of the Quick Code Display application also means stopping task a-1 from running in view 1202.
[0460] Scenario 1 involves disabling the payment code function of Application 1. In response to a user's action to disable the payment code function of Application 1 (e.g., clicking a blank area of window 1201 or clicking the back button at the top of view 1202), the screen corresponding to the payment code function of Application 1 will no longer be displayed in view 1202; that is, task a-1 will stop running in view 1202. In this scenario, the electronic device can still display window 1201. However, the screen corresponding to the payment code function of Application 1 will not be displayed in view 1202. View 1202 may display, for example, a blank layer or a view related to the quick code display application.
[0461] In Scenario 1, the user's action is to instruct the user to disable the payment code function of Application 1. This means the screen corresponding to the user's instruction regarding the payment code function of Application 1 no longer needs to be embedded in the quick code display application's view 1202. Therefore, in Scenario 1, the electronic device can either allow Application 1 to return to the background in its previous state before being embedded in the quick code display application's view 1202, or it can allow Application 1 to return to the background in full-screen mode. Here, returning Application 1 to the background refers to Task a-1 of Application 1 returning to the background.
[0462] Scenario 2 involves closing the Quick Code Display application. Closing the Quick Code Display application also means closing its window 1201. In response to the user's action to close window 1201 (e.g., double-clicking a blank area of window 1201, or clicking a button within window 1201 to close it), window 1201 is removed. Since window 1201 is the parent node of view 1202, and view 1202 is the parent node of task a-1, the screen corresponding to the payment code function of application 1 is no longer displayed. Electronic devices, for example, can... Figure 12 The interface (a) switches to the desktop, etc.
[0463] In Scenario 2, the user's action is to close the window 1201 of the quick code display application, while the user may not be instructing the screen corresponding to the payment code function of application 1 (i.e., task a-1) to exit the embedded state. Therefore, in Scenario 2, task a-1 exits the embedded view 1202, but task a-1 is still switched back to background operation in embedded state.
[0464] Figure 17 This is a flowchart illustrating the process 1700 of application 1 exiting the embedded quick code display application in the application startup method provided in this application embodiment. S1701 to S1705 correspond to scenario one, and S1706 to S1710 correspond to scenario two.
[0465] S1701, Quick Code Display application requests the embedded management module to remove task a-1.
[0466] For example, the quick code display application can remove task a-1 by calling the relevant methods or functions of view 1202 through the embedded management module. Removing task a-1 can also be understood as stopping task a-1 from running in view 1202.
[0467] For example, combining Figure 12 As shown in the interface (a), after the quick code display application detects the user's click on the blank area in window 1201, it can request the embedded management module to remove task a-1.
[0468] S1702, The embedded management module requests the active task management module to remove task a-1. That is, the embedded management module instructs the active task management module to stop task a-1 from running in view 1202.
[0469] S1703. In response to the request from the embedded management module, the activity task management module sets the status of task a-1 to full-screen display and returns task a-1 to the background.
[0470] In addition, the activity task management module also sets the flag bit x to indicate that task a-1 exists in a non-embedded state. The information used to indicate that task a-1 exists in a non-embedded state can be, for example, false or 0.
[0471] In some possible implementations, the activity task management module may also set the state of task a-1 to the state indicated by the display state information of task a-1. It can be understood that the display state information of task a-1 is the information recorded by the activity task management module when reusing task a-1 to start activity a1 (e.g., the information recorded in S1406), which is used to describe the display state of the screen corresponding to task a-1 when task a-1 is running in the background (i.e., before reusing task a-1).
[0472] It is understandable that by setting the state of task a-1 to the state indicated by the display status information of task a-1, task a-1 can be restored to the state before reusing task a-1. In this way, when the electronic device starts task a-1 again in a non-embedded manner, the screen corresponding to task a-1 can be displayed in the state before reusing task a-1, which can improve the user experience.
[0473] For example, combined Figure 12Assuming that before the electronic device displays interface (a), the screen corresponding to task a-1 exists as a floating window, then during the process of composing interface (a) (in S1406), the display status information of task a-1 recorded by the electronic device can instruct the screen of application 1 to run in the background as a floating window. Thus, when the electronic device removes task a-1, it can return task a-1 to the background as a floating window. This allows the screen of application 1 to be displayed in the background as a floating window, and when the user launches application 1 again by clicking its icon, application 1 can be displayed as a floating window.
[0474] Alternatively, the activity task management module can adjust the order of activities managed in task a-1 or destroy activity a1 so that the screen corresponding to task a-1 is still the screen corresponding to task a-1 before task a-1.
[0475] For example, when the activity task management module determines that there is a reusable task, task a-1 (S1405), task a-1 includes activity a1. Activity a1 is not at the top of the stack, and the activities managed by task a-1 are in the first order. For example, activity 3 is at the top of the stack, and activity 3 corresponds to the chat interface, that is, the card of application 1 displays the chat interface. In order to start activity a1, the task management module will adjust activity a1 to the top of the stack (S1406), and obtain the second order (the activity at the top of the stack is changed from activity 3 to activity a1), so that application 1 switches from the chat interface to the screen corresponding to the payment code function. Correspondingly, when task a-1 is returned to the background, the activity task management module also needs to adjust the second order of the activities managed by task a-1 to the first order, that is, change the activity at the top of the stack from activity a1 to activity 3, so that application 1 switches from the screen corresponding to the payment code function back to the chat interface. In this way, the card of application 1 in the background can display the chat interface again.
[0476] Alternatively, if the activity task management module determines that a reusable task a-1 exists, and task a-1 does not include activity a1, then the activity task management module will start activity a1. For example, if the activity at the top of the stack in the background task a-1 is activity 3, and activity 3 corresponds to the chat interface, then the card of application 1 in the background will display the chat interface. After starting activity a1, application 1 will switch from the chat interface to the screen corresponding to the payment code function. Correspondingly, when task a-1 is returned to the background, the activity task management module can also destroy activity a1, so that activity 3 is once again at the top of the task a-1 stack, and application 1 will switch from the screen corresponding to the payment code function to the chat interface. In this way, the card of application 1 in the background can display the chat interface again.
[0477] In this way, when the user launches application 1 again by clicking the application 1 icon, the electronic device can display the screen corresponding to the previous task a-1. For example, when the user launches application 1 again by clicking the application 1 icon, the electronic device displays the chat interface of application 1.
[0478] It should be noted that the size of the display screen provided by task a-1 varies depending on its state. For example, when task a-1 is displayed in full-screen mode, its size can be larger; when task a-1 is running in view 1202, its size (the size of application 1's screen) can be smaller. Therefore, after the activity task management module updates the state of task a-1, it will also update the size of task a-1 accordingly, that is, update the bounds attribute parameter 2, for example, from the bounds attribute parameter 2 corresponding to the embedded state to the bounds attribute parameter 3 corresponding to the full-screen display state, etc.
[0479] S1704, the activity task management module instructs the window management module to update the information of task a-1 and activity a1. Furthermore, the activity task management module instructs the window management module on the bounds attribute parameter 3 of the screen corresponding to activity a1. This allows the window management module to update the size and layout of activity a1's window based on the bounds attribute parameter 3. For example, setting the size of activity a1's window to full-screen display.
[0480] In response to instructions from the activity task management module, the window management module can also delete information such as the correspondence between task a-1 and view 1202.
[0481] S1705, The window management module instructs the layer management module to update the screen corresponding to activity a1.
[0482] For example, in response to the information in the flag bit x indicating that task a-1 exists in a non-embedded state, the window management module also instructs the layer management module to set the parent node of task a-1 as the default task display area. Thus, the parent node of task a-1 is no longer view 1202, and the screen corresponding to activity a1 is no longer displayed in view 1202.
[0483] Furthermore, in response to instructions from the window management module, the layer management module can also make the screen corresponding to activity a1 invisible. For example, making task a-1 invisible. Additionally, the window management module can instruct the layer management module to set the size and position of the screen corresponding to activity a1 based on the bounds attribute parameter 3. In this way, the layer management module can set the screen corresponding to activity a1 to its non-embedded state size.
[0484] At this time, the screen corresponding to activity a1 is no longer displayed in view 1202, but the electronic device still displays window 1201, that is, window 1201 is still displayed on the screen, but the screen corresponding to the payment code function of application 1 is not displayed in view 1202. In order to improve the user's visual experience, the electronic device can also close window 1201 through S1706 to S1708.
[0485] S1706, The window management module instructs the task a-1 running in the quick code display application view 1202 to be removed through the embedded management module.
[0486] S1707, Quick Code Display Indicator Window Management Module Remove Window 1201.
[0487] S1708, the window management module instructs the layer management module to remove window 1201. This allows the layer management module to set the layers in window 1201 to invisible, thus preventing the electronic device from displaying window 1201.
[0488] The above, combined with S1701 to S1708, explains the process of removing the screen corresponding to the payment code function of Application 1 from the embedded view 1202 in Scenario 1. The following, combined with S1709 to S1713, explains the process of removing the screen corresponding to the payment code function of Application 1 from the embedded view 1202 in Scenario 2.
[0489] S1709. When the Quick Code Display application detects that the user has closed window 1201, the Quick Code Display application requests the embedded management module to remove window 1201.
[0490] For example, combined Figure 12 The interface (a) shown in the figure allows the electronic device to close window 1201 in response to a user double-clicking an empty area in window 1201; or, window 1201 includes a button for closing window 1201, allowing the electronic device to close window 1201 in response to a user clicking the button.
[0491] Thus, the embedded management module can determine that window 1201 has been removed. Since window 1201 is the parent node of view 1202, the embedded management module can also determine that view 1202 has been removed. Since view 1202 is the parent node of task a-1, the embedded management module can execute S1710, responding to the instruction of the quick code application, the embedded management module instructs the active task management module to return task a-1 to the background.
[0492] It should be understood that the difference from S1702 is that in Scenario 1, the user instructs to remove task a-1 (i.e., close the screen corresponding to the payment code function of application 1), causing the embedded management module in S1702 to instruct the activity task management module to remove task a-1. This allows the activity task management module to set task a-1 to a non-embedded state. In Scenario 2, the user instructs to remove window 1201, causing the embedded management module in S1710 to instruct the activity task management module to return task a-1 to the background, i.e., without modifying the embedded state of task a-1.
[0493] S1711. In response to the instruction from the embedded management module, the activity task management module returns task a-1 to the background.
[0494] It should be noted that since the embedded management module instructs to return task a-1 to the background, the active task management module returns task a-1 to the background, and the active task management module retains the information used to indicate that task a-1 exists in an embedded state. That is, the active task management module does not update the flag bit x, and the flag bit x still records the information used to indicate that task a-1 exists in an embedded state.
[0495] S1712, The activity task management module instructs the window management module to update the information of task a-1 and activity a1. For example, it can delete the correspondence between task a-1 and view 1202, etc.
[0496] S1713, The window management module instructs the layer management module to update the screen corresponding to activity a1.
[0497] For example, based on the information recorded in the flag bit x indicating that task a-1 exists in an embedded state, the layer management module can set the parent node of task a-1 to none. Thus, when the electronic device embeds task a-1 into the view of another application by reusing tasks, the electronic device can determine the parent node of task a-1 based on the information recorded in the flag bit x indicating that task a-1 exists in an embedded state. If the parent node of task a-1 is none, the active task management module sets the mapping between task a-1 and the view of the other application and instructs the layer management module to set the parent node of task a-1 to the view of the other application. This makes it more efficient for the electronic device to run task a-1 in the view of another application.
[0498] Furthermore, in response to instructions from the window management module, the layer management module can also set task a-1 to invisible, etc., so that the screen corresponding to activity a1 is no longer displayed on the display screen.
[0499] In scenario two, task a-1 remains in an embedded state, meaning the flag bit x records information indicating that task a-1 exists in an embedded state. In this case, the electronic device can also exit the embedded state for task a-1 via steps S1714 to 1721.
[0500] S1714. Application c requests the non-embedded management module to start the activity of application 1.
[0501] For example, if application c can be a desktop launcher, then in response to the user clicking the icon of application 1 on the desktop, the desktop launcher requests the non-embedded management module to start the activity of application 1.
[0502] It's understandable that launching application 1 via its icon will display the interface of application 1 as it would appear in the background. For example, if application 1 displays a chat interface in the background, clicking its icon will bring up the chat interface on the electronic device. Therefore, in this scenario, since scenario two uses the display of the payment code function (corresponding to activity a1) by application 1 as an example (i.e., application 1 runs in an embedded state in the background and displays the screen corresponding to the payment code function), the activity of application 1 requested by the desktop launcher is activity a1 (the activity corresponding to the payment code function). Correspondingly, the interface displayed after application 1 is launched is also the screen corresponding to the payment code function.
[0503] Alternatively, application c could be another application, such as a short video application. In response to a user sharing a link from the short video application to the chat interface of application 1, and if the chat interface corresponds to activity 3, the short video application requests the non-embedded management module to launch activity 3. Correspondingly, the interface of application 1 after launch is the chat interface.
[0504] Alternatively, application c can be replaced with a banner notification module or an application capable of sending pop-up notifications. When application c receives a notification message from application 1, it can display a pop-up window from application 1, prompting the user to receive the notification message. In response to the user clicking the pop-up, application c can request the non-embedded management module to launch an activity for application 1. The activity of application 1 can be related to the type of notification message. For example, if the notification message is a chat message and activity 3 corresponds to the chat interface, then the activity of application 1 is activity 3, and the interface displayed after application 1 is launched is the chat interface. If the notification message is a system notification message from application 1, such as a message indicating the number of steps taken, and activity 4 of application 1 corresponds to displaying the step count interface, then the activity of application 1 is activity 4, and the interface displayed after application 1 is launched is the step count interface.
[0505] It should be understood that the activity of application 1 requested by application c shown above is only an example. In some other scenarios, application c can be other applications, such as shopping applications; and the activity of application 1 requested by application c can also be other activities of application 1. This application does not make any specific limitations in this regard.
[0506] S1715, The non-embedded management module requests the activity task management module to start the activity of application 1.
[0507] S1716. The activity task management module determines that a reusable task exists, and that the reusable task is task a-1. It also determines that task a-1 exists in an embedded state. That is, the flag bit x records information indicating that task a-1 exists in an embedded state.
[0508] S1717. The activity task management module clears the information used to indicate that task a-1 exists in an embedded state. Alternatively, it can be understood as setting the flag bit x to indicate that task a-1 exists in a non-embedded state.
[0509] S1718, The activity task management module instructs the window management module to update the information of task a-1 and activity a1.
[0510] S1719, The window management module instructs the layer management module to update the screen corresponding to activity a1.
[0511] It should be understood that the implementation methods of S1718 and S1719 are similar to those of S1704 and S1705, and can be referred to the description above, which will not be repeated here.
[0512] S1720, The activity task management module instructs the embedded management module task a-1 to exit the embedded state.
[0513] S1721, The embedded management module instructs the quick code display application task a-1 to exit the embedded state. Thus, the next time the electronic device runs task a-1 through the quick code display application's view, the electronic device can launch application 1 according to method 1400.
[0514] It should be understood that method 1700 is illustrated using the example of exiting the embedded window 1201 from the screen corresponding to the payment code function of application 1. In some possible implementations, the screen corresponding to the scan function of application 1 or the screen corresponding to the payment code function of application 2 can also exit the embedded window 1201 in the manner described in method 1700. For the sake of brevity, these will not be elaborated upon here.
[0515] It should be understood that the sequence numbers in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic.
[0516] The application launch method of the embodiments of this application has been described above. The application launch apparatus for executing the above method provided in the embodiments of this application is described below. Those skilled in the art will understand that the methods and apparatus can be combined and referenced with each other, and the related apparatus provided in the embodiments of this application can execute the steps in the above list sorting method.
[0517] The application launch device can be an electronic device, and the hardware structure of the electronic device will be described below.
[0518] Figure 18 This is a schematic diagram of the structure of the electronic device 1800 provided in an embodiment of this application. Figure 18 As shown, the electronic device 1800 may include a processor 1810, an external memory interface 1820, an internal memory 1821, a universal serial bus (USB) interface 1830, a charging management module 1840, a power management module 1841, a battery 1842, an antenna 1, an antenna 2, a mobile communication module 1850, a wireless communication module 1860, an audio module 1870, a sensor module 1880, buttons 1890, an indicator 1892, a camera 1893, and a display screen 1894, etc.
[0519] The audio module 1870 may include, but is not limited to, a speaker, a receiver, a microphone, and a headphone jack.
[0520] The sensor module 1880 may include, but is not limited to, one or more of the following sensors: pressure sensor, gyroscope sensor, barometric pressure sensor, magnetic sensor, accelerometer, distance sensor, proximity sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor, and bone conduction sensor, etc.
[0521] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 1800. In other embodiments of this application, the electronic device 1800 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0522] Processor 1810 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). Optionally, processor 1810 may also include memory for storing instructions and data. The different processing units may be independent devices or integrated into one or more processors.
[0523] The wireless communication function of electronic device 1800 can be implemented through antenna 1, antenna 2, mobile communication module 1850, wireless communication module 1860, modem processor and baseband processor, etc.
[0524] Electronic device 1800 implements display functions through a GPU, a display screen 1894, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 1894 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 1818 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0525] The display screen 1894 is used to display images, videos, etc. In some embodiments, the electronic device 1800 may include one or N display screens 1894, where N is a positive integer greater than 1.
[0526] For example, the application processor can use a GPU or similar device to render the layers in the target window and the screen corresponding to activity 'a', and can display the layers in the target window and the screen corresponding to activity 'a' located above the layers in the target window on the display screen 1894. The size of the screen corresponding to activity 'a' is smaller than the size of the display screen.
[0527] The external memory interface 1820 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 1800. The internal memory 1821 can be used to store computer executable program code, which includes instructions.
[0528] In addition, the application launch device can also have the following structure.
[0529] Figure 19This is a schematic block diagram of an application launch device 1900 provided in an embodiment of this application. The device 1900 includes a processor 1901, a communication interface 1902, and a memory 1903. The processor 1901, communication interface 1902, and memory 1903 communicate with each other via internal connection paths. The memory 1903 is used to store instructions, and the processor 1901 is used to execute the instructions stored in the memory 1903. The communication interface 1902 can be used to send signals to other devices (e.g., the processor 1901 or a touchscreen of an electronic device) and to receive signals from other devices (e.g., the memory 1903). Exemplarily, the communication interface 1902 reads instructions stored in the memory 1903 and sends the instructions to the processor 1901.
[0530] It should be understood that the device 1900 may specifically be an electronic device as described in the above embodiments, and may be used to perform the various steps and / or processes corresponding to the electronic device in the above method embodiments. Optionally, the memory 1903 may include read-only memory and random access memory, and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information. The processor 1901 may be used to execute instructions stored in the memory, and when the processor 1901 executes instructions stored in the memory, the processor 1901 is used to perform the various steps and / or processes of the above method embodiments.
[0531] It should be understood that, in the embodiments of this application, the processor may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0532] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or as a combination of hardware and software modules within the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor executes the instructions in the memory, combining them with its hardware to complete the steps of the above method. To avoid repetition, detailed descriptions are omitted here.
[0533] The application launch method provided in this application embodiment can be applied to electronic devices with communication functions. Electronic devices include terminal devices, and the specific device form of the terminal device can be referred to the above-mentioned descriptions, which will not be repeated here.
[0534] This application provides an electronic device, which includes a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, causing the terminal device to perform the above-described method.
[0535] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.
[0536] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0537] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage or other magnetic storage devices, or any other medium targeted to carry or to store the required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0538] This application provides a computer program product, which includes a computer program that, when run, causes a computer to perform the above-described method.
[0539] 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 should 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 computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0540] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.
Claims
1. An application launch method, characterized in that, include: When the electronic device is running the first task of the first application in the background, the electronic device receives the first operation from the user to open the first function; In response to the first operation, the electronic device displays a first interface of the second application and runs the first task in a first view of the first interface. The first activity at the top of the stack in the first task corresponds to the first function, and the first task is a child node of the first view. When the electronic device displays the first interface, the electronic device stops running the first task in the background and runs the first task in the foreground.
2. The method according to claim 1, characterized in that, The method further includes: When the electronic device displays the first interface, the electronic device receives a second operation from the user to open the second function; In response to the second operation, the electronic device switches the first interface to the second interface of the second application and runs the first task in the second view of the second interface. The second activity at the top of the stack in the first task corresponds to the second function, and the first task is a child node of the second view. When the electronic device displays the second interface, the first task is not running in the background of the electronic device, and the first task that was running in the first view when the electronic device displays the first interface is running in the second view.
3. The method according to claim 1 or 2, characterized in that, The method further includes: When the electronic device is running the first task in the foreground, the electronic device is running the second task of the third application in the background; When the electronic device displays the first interface, the electronic device receives a third operation from the user to open the third function; In response to the third operation, the electronic device switches the first interface to the third interface of the second application and runs the second task in the third view of the third interface. The third activity at the top of the stack in the second task corresponds to the third function, and the second task is a child node of the third view. When the electronic device displays the third interface, the electronic device stops running the second task in the background and runs the second task in the foreground, while the electronic device runs the first task in the background.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: When the electronic device displays the first interface, the electronic device receives a fourth operation from the user to disable the first function; In response to the fourth operation, the electronic device switches the first interface to the fourth interface; When the electronic device displays the fourth interface, the electronic device runs the first task in the background in full-screen mode, and the parent node of the first task is updated from the first view to the default task display area.
5. The method according to any one of claims 1 to 3, characterized in that, The method further includes: When the electronic device displays the first interface, the electronic device receives a fifth operation from the user to close the second application; In response to the fifth operation, the electronic device switches the first interface to the fifth interface; When the electronic device displays the fifth interface, the electronic device runs the first task in the background, and the parent node of the first task is updated from the first view to none.
6. The method according to claim 5, characterized in that, The method further includes: When the electronic device is running the first task in the background and the parent node of the first task is none, the electronic device receives a sixth operation from the user to open the fourth function. In response to the sixth operation, the electronic device displays the sixth interface of the first application in full screen by running the first task. The fourth activity at the top of the stack in the first task corresponds to the fourth function, and the parent node of the first task is the default task display area. When the electronic device displays the sixth interface, the electronic device stops running the first task in the background and runs the first task in the foreground.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: When the electronic device displays the first interface, the electronic device receives a seventh operation from the user to open the fifth function; In response to the seventh operation, the electronic device switches the first interface to the seventh interface of the fourth application and runs the first task in the fourth view of the seventh interface. The fifth activity at the top of the stack in the first task corresponds to the fifth function, and the first task is a child node of the fourth view. When the electronic device displays the seventh interface, the first task is not running in the background of the electronic device, and the first task running in the first view when the electronic device displays the first interface runs in the fourth view.
8. The method according to any one of claims 1 to 7, characterized in that, The first interface is displayed by the electronic device through a fourth task running the second application; or, The first interface is displayed in the first window, which is created by the service of the second application, and the service of the second application runs in the background of the electronic device.
9. The method according to any one of claims 1 to 8, characterized in that, The electronic device displays a first interface of a second application and runs the first task in a first view of the first interface, including: The electronic device creates a first window for the second application and sets the first view in the first window, with the first interface displayed in the first window; The electronic device sets the first task running in the background to run in the foreground, and starts the first activity in the first task; Set the parent node of the first task as the first view.
10. The method according to claim 9, characterized in that, The electronic device sets the first task, which was running in the background, to run in the foreground, including: When the first information is set in the first flag bit, the electronic device sets the first task running in the background to run in the foreground, and the first information is used to indicate that the first activity is started in the manner of reusing the task.
11. The method according to claim 9 or 10, characterized in that, The method further includes: When the first task is running in the first view, the electronic device receives a second operation from the user to open the second function; In response to the second operation, the electronic device sets a second view in the first window and removes the first view; The electronic device initiates a second activity of the first application in the first task, the second activity corresponding to the second function; The electronic device changes the parent node of the first task from the first view to the second view.
12. The method according to any one of claims 9 to 11, characterized in that, The method further includes: When the first task is running in the first view, the electronic device is running the second task of the third application in the background, and the electronic device receives the third operation from the user to open the third function; In response to the third operation, the electronic device sets a third view in the first window and removes the first view; The electronic device sets the second task to run in the foreground and launches the third activity of the third application within the second task, the third activity corresponding to the third function; The electronic device sets the parent node of the first task to none and returns the first task to run in the background; The electronic device sets the parent node of the second task as the third view.
13. The method according to any one of claims 9 to 12, characterized in that, The method further includes: When the first task is running in the first view, the electronic device receives a fourth operation from the user to disable the first function; In response to the fourth operation, the electronic device returns the first task to the background in full-screen mode and sets the parent node of the first task from the first view to the default task display area.
14. The method according to any one of claims 9 to 12, characterized in that, The method further includes: When the first task is running in the first view, the electronic device receives a fifth operation from the user to close the second application; In response to the fifth operation, the electronic device returns the first task to the background and sets the parent node of the first task from the first view to none.
15. The method according to claim 14, characterized in that, The method further includes: When the electronic device is running the first task in the background and the parent node of the first task is none, the electronic device receives a sixth operation from the user to open the fourth function. In response to the sixth operation, the electronic device moves the first task from the background to the foreground, starts the fourth activity of the first application in the first task, the fourth activity corresponds to the fourth function, and sets the parent node of the first task from none to the default task display area.
16. The method according to any one of claims 9 to 15, characterized in that, The method further includes: When the first task is running in the first view, the electronic device receives a seventh operation from the user to open the fifth function; In response to the seventh operation, the electronic device creates a second window for the fourth application and sets a fourth view in the second window; The electronic device initiates a fifth activity of the first application in the first task, the fifth activity corresponding to the fifth function; The electronic device removes the first window; The electronic device sets the parent node of the first task from the first view to the fourth view.
17. An electronic device, characterized in that, The electronic device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, and the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 16.
18. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 16.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 16.
20. A computer program product, characterized in that, The computer program product includes computer program code that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 16.
Citation Information
Cited By
Application startup method and apparatus
EP4769136A1
Application startup method and apparatus
WO2025256323A1