A memory management method and related device
By dynamically managing the depth-of-field lock screen image cache of terminal devices, the problem of excessive memory usage by lock screen wallpapers is solved, enabling smooth display during screen switching and landscape/portrait rotation, thus improving device performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-05-29
- Publication Date
- 2026-07-10
Smart Images

Figure CN121092296B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to a memory management method and related equipment. Background Technology
[0002] A lock screen image (or lock screen wallpaper) is an image displayed on the lock screen interface. For example, when an electronic device has a lock screen password, the lock screen image is displayed on the lock screen interface when the screen of the electronic device is turned on again after being turned off.
[0003] Taking a terminal device with at least two displays of different aspect ratios as an example, the lock screen wallpaper includes multiple images with different aspect ratios to adapt to the different screen ratios. To improve the user's visual experience, the resolution of lock screen wallpapers is getting higher and higher, thus requiring more memory space for each wallpaper. Furthermore, since these types of terminal devices involve switching between different displays (optionally including landscape / portrait rotation), it is necessary to cache lock screen wallpapers of each aspect ratio to ensure smooth display of the wallpaper in each scenario.
[0004] Therefore, for this type of terminal device, due to factors such as the number of lock screen wallpapers, resolution requirements, and scenarios involving screen switching and landscape / portrait rotation, the bitmap corresponding to the lock screen wallpaper occupies a large amount of memory. Summary of the Invention
[0005] This application provides a memory management method and related device, which can save memory resources and improve device performance.
[0006] A first aspect provides a memory management method applied to an electronic device, the electronic device having a first display screen and a second display screen, the first display screen and the second display screen having different screen ratios, the method comprising: in response to triggering a screen lock operation, loading a cache of a first depth-of-field lock screen image adapted to the size of the first display screen, and loading a cache of a second depth-of-field lock screen image adapted to the screen size of the second display screen, according to the original image of the first lock screen, assigning the cache of the first depth-of-field lock screen image to the cache of the current depth-of-field lock screen image of the first display screen, and displaying a first lock screen interface on the first display screen, wherein the first depth-of-field lock screen image includes a first foreground image and a first background image, the second depth-of-field lock screen image includes a second foreground image and a second background image, and the first lock screen... The screen interface includes: a first background image, a first lock screen element displayed on the first background image, and a first foreground image that partially obscures the first lock screen element; in response to an unlocking operation, a first non-lock screen interface is displayed on the first display screen, and the cache of a second depth lock screen image is released; and / or, in response to an operation of replacing the first original lock screen image with the second original lock screen image, the cache of a depth lock screen image loaded according to the first original lock screen image is released, and a cache of a third depth lock screen image adapted to the size of the first display screen is loaded according to the second original lock screen image, and the cache of the third depth lock screen image is assigned to the cache of the current foreground lock screen image on the first display screen, wherein the third depth lock screen image includes a third foreground image and a third background image.
[0007] The above solution loads all depth-of-field lock screen images corresponding to all displays when entering the lock screen scenario, which can prevent the black screen from occurring when the user switches displays or switches between portrait and landscape modes while in the lock screen state, thereby improving the user experience.
[0008] Understandably, if all depth lock screen images are not loaded according to the above scheme, assuming the first display screen shows the first depth lock screen image in the first screen display state, only the first depth lock screen image occupies the running memory. When the user switches to the second display screen, the electronic device needs to temporarily load the second depth lock screen image. Since loading the second depth lock screen image takes a certain amount of time, it is very likely that the loading will not be timely and a black screen will occur, affecting the user experience.
[0009] The above solution, in the unlocking scenario, releases the cache of the second depth-of-field lock screen image, which can save memory resources while ensuring the user's visual experience, thereby improving the operating performance of the terminal device and further enhancing the user experience.
[0010] The above solution, after changing the wallpaper, immediately releases the depth-sensor lock screen wallpaper from all displays before the wallpaper change and loads a cached depth-sensor lock screen image for the currently used display. On one hand, it promptly clears useless cache, saving RAM resources; on the other hand, it loads a cached depth-sensor lock screen image that may be used soon. Compared to loading the depth-sensor lock screen wallpaper from all displays, this approach saves RAM resources while maintaining a good user experience. Therefore, it improves the operating performance of the terminal device and further enhances the user experience.
[0011] In one possible embodiment, the first display screen supports a first screen display state and a second screen display state, and a first depth-of-field lock screen image or a third depth-of-field lock screen image corresponds to the first screen display state; displaying a first lock screen interface on the first display screen includes: displaying the first lock screen interface on the first display screen based on the first screen display state; the method further includes: in response to a screen lock triggering operation, loading a cache of a fourth depth-of-field lock screen image adapted to the size of the first display screen and the second screen display state according to the original first lock screen image; displaying a first unlocked interface on the first display screen includes: displaying the first unlocked interface on the first display screen in the first screen display state; the method further includes: in response to an unlock triggering operation, releasing the cache of the fourth depth-of-field lock screen image.
[0012] The above solution, based on the scenario where the first display screen has two display states before and after rotation, allows for more refined dynamic memory management, thereby further conserving RAM resources. Therefore, it improves the performance of the terminal device and enhances the user experience.
[0013] In one possible embodiment, when the first display screen displays a first unlocked screen interface in a first screen display state, the method further includes: in response to the operation of rotating the electronic device, displaying a second unlocked screen interface on the first display screen based on a second screen display state, and releasing the cache of a first depth-of-field lock screen image and loading the cache of a fourth depth-of-field lock screen image, wherein the first screen display state and the second screen display state are the corresponding display states of the first display screen before and after rotation, respectively.
[0014] The above solution adjusts the caching of the depth lock screen image accordingly when switching screen display states in the non-lock screen interface. This ensures a good user experience (without a black screen) while saving RAM resources, thus improving the performance of the terminal device and enhancing the user experience.
[0015] In one possible embodiment, when the first display screen displays a first unlocked screen interface, the method further includes: in response to an operation of switching the second display screen to the display screen of the currently displayed image, displaying a third unlocked screen interface on the second display screen, releasing the cache of the first depth-of-field lock screen image, and loading the cache of the second depth-of-field lock screen image.
[0016] The above solution, by adjusting the cache of the depth lock screen image accordingly when switching displays outside the lock screen interface, can save memory resources while ensuring user experience (avoiding black screens), thus improving the operating performance of the terminal device and further enhancing the user experience.
[0017] In one possible embodiment, the second display screen supports a third screen display state and a fourth screen display state, and the second depth-of-field lock screen image corresponds to the third screen display state. The method further includes: in response to a screen lock operation, loading a cache of a fifth depth-of-field lock screen image adapted to the size of the second display screen and the fourth screen display state based on the first original lock screen image; and in response to an unlock operation, releasing the cache of the fifth depth-of-field lock screen image.
[0018] The above solution, based on the scenario where the second display screen has two display states before and after rotation, allows for more refined dynamic memory management, thereby further conserving RAM resources. Therefore, it improves the performance of the terminal device and enhances the user experience.
[0019] In one possible embodiment, the electronic device has N displays, each with a different screen ratio. The N displays include a first display and a second display. M of the N displays support two screen display states, and each of the M displays corresponds to two depth-of-field lock screen images, where 0 ≤ M ≤ N, N ≥ 2, and M and N are both integers. When the first display displays the first lock screen interface, the bitmaps of the N+M depth-of-field lock screen images corresponding to the N displays all occupy the running memory of the electronic device. Each of the N+M depth-of-field lock screen images includes a foreground image and a background image. When the first display displays the first non-lock screen interface, only the first depth-of-field lock screen image occupies the running memory of the electronic device. In the case where the first display is one of the M displays, the first display currently displays the first non-lock screen interface based on the first screen display state, and the first depth-of-field lock screen image corresponds to the first screen display state.
[0020] The above solution addresses this issue. In lock screen mode, electronic devices generally require limited RAM to meet user needs. Loading a cache of all depth-sensing lock screen images won't impact the user experience and ensures that switching or rotating the screen doesn't result in a blackout, maintaining a smooth visual experience. In unlocked mode, dynamic memory management significantly conserves RAM, thus improving device performance and further enhancing the user experience.
[0021] In one possible embodiment, the electronic device has a foldable screen. The first display screen is a large foldable screen, and the second display screen is a small screen. The large screen supports two screen display states: a landscape display state and a portrait display state. The landscape display state corresponds to a first depth-of-field lock screen image, and the portrait display state corresponds to a fourth depth-of-field lock screen image. If the electronic device is detected to switch from an unfolded state to a folded state, the display is switched from the landscape or portrait display state of the large screen to the small screen, releasing the cache of the first or fourth depth-of-field lock screen image and loading the cache of the second depth-of-field lock screen image. Alternatively, if the electronic device is detected to switch from a folded state to an unfolded state, the display is switched from the landscape or portrait display state of the large screen to the small screen, releasing the cache of the first or fourth depth-of-field lock screen image and loading the cache of the second depth-of-field lock screen image. The screen switches between landscape and portrait modes, releasing the cache of the second depth-of-field lock screen image and loading the cache of the first or fourth depth-of-field lock screen image. If the screen is in landscape mode and a rotating electronic device is detected, the screen switches to portrait mode, releasing the cache of the first depth-of-field lock screen image and loading the cache of the fourth depth-of-field lock screen image. Alternatively, if the screen is in portrait mode and a rotating electronic device is detected, the screen switches to landscape mode, releasing the cache of the fourth depth-of-field lock screen image and loading the cache of the first depth-of-field lock screen image.
[0022] Using the memory management method provided in this application for foldable devices can significantly save on RAM resources, thereby improving the operating performance of the terminal device and effectively enhancing the user experience.
[0023] In one possible embodiment, after loading the third depth-of-field lock screen image, the method further includes: detecting that the user enters the lock screen image editing page from the first lock screen interface, and replacing the first original lock screen image with the second original lock screen image; or, detecting that the user enters the lock screen image editing page from the first non-lock screen interface, and replacing the first original lock screen image with the second original lock screen image.
[0024] The above solutions provide implementation methods for changing the lock screen wallpaper on both the lock screen and non-lock screen interfaces, and further refine the applicable scenarios for memory management methods.
[0025] In one possible embodiment, detecting that a user enters a lock screen image editing page from a first lock screen interface and replacing the first original lock screen image with a second original lock screen image includes: in response to a user's pinch-to-zoom operation on the first lock screen interface, displaying a lock screen image editing page on a first display screen, the lock screen image editing page including multiple lock screen images; and in response to a setting operation, setting a third depth-of-field lock screen image among the multiple lock screen images as the replaced depth-of-field lock screen image.
[0026] The above solution provides a further implementation method for changing the lock screen wallpaper on the lock screen interface, and further refines the applicable scenarios for the memory management method.
[0027] In one possible embodiment, detecting that a user enters the lock screen image editing page from a first non-lock screen interface and replacing the first original lock screen image with a second original lock screen image includes: in response to the user's operation of setting a depth-of-field image theme, setting the second original lock screen image in the depth-of-field image theme selected by the user as the replaced original lock screen image; or, in response to the user's operation of setting a depth-of-field lock screen image in the gallery of the electronic device, setting the second original lock screen image selected by the user in the gallery as the replaced original lock screen image.
[0028] The above solution provides a further implementation method for changing the lock screen wallpaper on non-lock screen interfaces, and further refines the applicable scenarios for memory management methods.
[0029] In a second aspect, this application provides an electronic device including one or more processors and one or more memories; wherein the one or more memories are coupled to one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when executed by one or more processors, cause the electronic device to perform the method described in the first aspect and any possible implementation thereof.
[0030] Thirdly, embodiments of this application provide a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the methods described in the first aspect and any possible implementation thereof.
[0031] Fourthly, this application provides a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform the method described in the first aspect and any possible implementation thereof.
[0032] Fifthly, this application provides a computer program product containing instructions that, when the computer program product is run on an electronic device, cause the electronic device to perform the method described in the first aspect and any possible implementation thereof.
[0033] Understandably, the electronic device provided in the second aspect, the chip system provided in the third aspect, the computer storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in this application. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods, and will not be repeated here. Attached Figure Description
[0034] Figure 1 A schematic diagram illustrating an example of a depth-of-field lock screen image provided in an embodiment of this application;
[0035] Figure 2 This is a schematic diagram illustrating another example of a depth-of-field lock screen image provided in an embodiment of this application;
[0036] Figure 3 This is a schematic diagram illustrating another example of a depth-of-field lock screen image provided in an embodiment of this application;
[0037] Figure 4 A schematic diagram illustrating an example of scenario 1 provided in an embodiment of this application;
[0038] Figure 5 A schematic diagram illustrating yet another example of scenario 1 provided in the embodiments of this application;
[0039] Figure 6 A schematic diagram illustrating an example of scenario 2 provided in an embodiment of this application;
[0040] Figure 7 A schematic diagram illustrating an example of scenario 3 provided in an embodiment of this application;
[0041] Figure 8 A schematic diagram illustrating yet another example of scenario 3 provided in the embodiments of this application;
[0042] Figure 9 A schematic diagram illustrating an example of scenario 4 provided in an embodiment of this application;
[0043] Figure 10 A schematic diagram illustrating yet another example of scenario 4 provided in the embodiments of this application;
[0044] Figure 11 A schematic diagram illustrating a memory management method applicable to the above-described scenario provided in an embodiment of this application;
[0045] Figure 12 This is a block diagram of a software system for an electronic device provided in an embodiment of this application;
[0046] Figure 13 A flowchart of method 100, a specific example of Example 1 provided in this application embodiment;
[0047] Figure 14 A schematic diagram of a timing interaction method 200, which is a specific example of Example 1 provided in the embodiments of this application;
[0048] Figure 15 A flowchart of method 300, a specific example of Example 2 provided in this application embodiment;
[0049] Figure 16 A schematic diagram of a timing interaction method 400, which is a specific example of Example 2 provided in the embodiments of this application;
[0050] Figure 17 A flowchart of method 500, a specific example of Example 3 provided in this application embodiment;
[0051] Figure 18 A schematic diagram of a timing interaction method 600, which is a specific example of Example 3 provided in the embodiments of this application;
[0052] Figure 19 A schematic diagram of a timing interaction method 700, which is a specific example of Example 3 provided in the embodiments of this application;
[0053] Figure 20 A flowchart of method 800, a specific example of Example 4 provided in this application embodiment;
[0054] Figure 21 A schematic diagram of a timing interaction method 900, which is a specific example of Example 4 provided in the embodiments of this application;
[0055] Figure 22 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0057] Before providing a detailed description of the memory management method provided in the embodiments of this application, a brief introduction to the custom terms and terminology involved in the embodiments of this application will be given first.
[0058] 1. Lock screen interface: This refers to the first user interface that appears when the system restarts or the screen is turned on again after being turned off, provided that a lock screen password is set on the electronic device.
[0059] 2. Lock screen image or lock screen wallpaper: This is the image applied to the lock screen interface. Users can usually set the lock screen image from the theme, or they can customize the lock screen image from the gallery.
[0060] 3. Depth-of-field lock screen image or depth-of-field lock screen wallpaper: This refers to using an image with depth-of-field effect, capability, or characteristics (referred to as depth-of-field image) as the lock screen image. The depth-of-field image includes a foreground image and a background image. When the depth-of-field image is displayed in the lock screen interface, the foreground image is displayed on the upper layer of the lock screen elements (such as the system time indicator, system date indicator, etc.) and partially obscures the lock screen elements.
[0061] For example, please see Figure 1 , Figure 1 This is a schematic diagram illustrating an example of a depth-of-field lock screen image provided in an embodiment of this application. The foreground image (i.e., the main image A1) depicts a person with arms crossed over their chest, and the background image (i.e., image B) is the background of the lock screen image excluding the person; alternatively, the background image (i.e., image B) includes both the person with arms crossed over their chest and the background, while the foreground image (i.e., the main image A1) depicts the person with arms crossed over their chest. Some time information is partially obscured by the foreground image.
[0062] 4. Screen ratio: This refers to the ratio of the screen width to its height, also known as aspect ratio or length-to-width ratio.
[0063] The electronic devices to which this application applies include at least two displays with different screen ratios. It is understood that to display a lock screen image on displays with different screen ratios, it is necessary to obtain a lock screen image adapted to the screen ratio of each display. In other words, the electronic device needs to crop the corresponding lock screen image for each display with a different screen ratio, thus each lock screen image for a different screen ratio occupies its own memory.
[0064] Taking electronic devices with foldable screens as an example, these include both large and small screens, with different screen ratios. The electronic devices need to crop lock screen images to the appropriate size not only for the large screen but also for the small screen.
[0065] It should be noted that, Figure 1 Taking a foldable screen terminal device with a large vertical screen as an example, the lock screen interface of the smaller screen of this terminal device can also display a depth-of-field lock screen image. For example, please see... Figure 2 , Figure 2This is a schematic diagram illustrating another example of a depth-of-field lock screen image provided in an embodiment of this application. The foreground image (i.e., the main image A2) depicts a person with arms crossed over their chest, and the background image (i.e., image C) is the background of the lock screen image excluding the person; alternatively, the background image (i.e., image C) includes both the person with arms crossed over their chest and the background, while the foreground image (i.e., the main image A2) depicts the person with arms crossed over their chest. Some time information is partially obscured by the foreground image.
[0066] Depend on Figure 2 It is evident that the screen ratio of small screens differs from that of large screens. On the one hand, this is to adapt to the screen ratio of small screens, and on the other hand, to ensure the depth effect of the lock screen interface on small screens, the foreground and background images of the depth lock screen image also need to be cropped to different sizes.
[0067] 5. RAM (Random Access Memory): Terminal devices generally have two types of memory: RAM and ROM. RAM is the space used to temporarily store data while applications are running. It allows the processor to quickly read and write data, improving speed and smoothness. ROM is the space used for long-term data storage. It can store system software, applications, photos, videos, and other files, affecting the phone's storage capacity and read / write speed.
[0068] The size of RAM directly affects the performance of a terminal device because it determines how many applications can run simultaneously and how quickly to switch between them. More RAM allows more applications to be opened, making the processor more efficient. Conversely, insufficient RAM causes the processor to wait when reading and writing data, leading to stuttering, crashes, and other issues.
[0069] 6. Resident memory: The memory space occupied by an application does not change as the application starts and closes. This type of memory resides in the computer's physical memory and is therefore called resident memory.
[0070] In contrast to resident memory, there is the concept of application memory. When an application starts, it occupies a certain amount of memory to run. This memory space is released when the application is closed; this memory space is called application memory.
[0071] 7. Theme: This refers to the interface style of an electronic device, including but not limited to desktop images and lock screen images. Users can set their preferred themes on their electronic devices. Different themes result in different interface styles. Theme-related lock screen images typically include animated lock screen images and depth-of-field lock screen images; animated lock screen images refer to lock screen images with dynamic effects.
[0072] As an example, the depth-of-field lock screen image applied from a theme can be simply referred to as the theme depth-of-field lock screen image. It can be understood that when a user selects a theme that includes a depth-of-field lock screen image as the theme to be used, they are essentially selecting the theme depth-of-field lock screen image as the lock screen image to be used. Similarly, when a user changes a theme that includes a depth-of-field lock screen image, they are essentially changing the lock screen image to be used.
[0073] 8. Custom Lock Screen Image: This typically refers to an image selected from the gallery application and used as the lock screen image. Custom lock screen images generally include custom standard lock screen images and custom depth-of-field lock screen images. A custom depth-of-field lock screen image is an image with depth capabilities selected by the user from the gallery application as the lock screen image; a custom standard lock screen image is an image without depth capabilities, meaning a regular image selected by the user from the gallery application as the lock screen image.
[0074] In one application scenario, when a user is using an electronic device, if the device supports switching between portrait and landscape modes, meaning the screen can be displayed in either portrait or landscape mode, the user may turn on the screen to enter the lock screen when the device is in portrait mode, or they may turn on the screen to enter the lock screen when the device is in landscape mode.
[0075] For example, taking an electronic device with a foldable screen and a large screen that supports landscape and portrait switching, if the lock screen image is a depth-of-field lock screen image, in order to ensure the depth-of-field effect of the lock screen wallpaper on both the landscape and portrait screens, the corresponding foreground and background images need to be cropped separately for the landscape and portrait screens. In other words, the foreground and background images of the landscape lock screen wallpaper on the large screen are different in size from the foreground and background images of the portrait lock screen wallpaper on the large screen.
[0076] It's understandable that while landscape and portrait lock screen wallpapers on large screens may come from the same image (or have the same image content), they need to be cropped differently to avoid the foreground image obscuring too much of the lock screen elements and affecting the user's ability to view the time or date, and to avoid the foreground image not obscuring the lock screen elements and thus failing to present a depth-of-field effect.
[0077] In other words, to achieve a better depth-of-field effect in the lock screen images, landscape and portrait depth-of-field lock screen wallpapers require different cropping methods to obtain different aspect ratios and relative positions. Therefore, two sets of depth-of-field lock screen wallpapers (i.e., two sets of foreground and background images) need to be cached. The different aspect ratios refer to the fact that the aspect ratios of the foreground and background images in the landscape lock screen wallpapers are different from those in the portrait lock screen wallpapers. The different relative positions refer to the fact that the relative positions of the foreground and background images in the landscape lock screen wallpapers are different from those in the portrait lock screen wallpapers.
[0078] For example, see Figure 3 , Figure 3 This is a schematic diagram illustrating another example of a depth-of-field lock screen image provided in this application embodiment. The foreground image (i.e., the main image A3) depicts a person with arms crossed over their chest, and the background image (i.e., image D) is the background of the lock screen image excluding the person; alternatively, the background image (i.e., image D) includes both the person with arms crossed over their chest and the background, while the foreground image (i.e., the main image A3) depicts the person with arms crossed over their chest. Some temporal information is partially obscured by the foreground image. Optionally, the aspect ratio of the main image A3 can be the same as that of the main image A1.
[0079] It is also understandable that depth lock screen images include foreground and background images, which take up significantly more memory than regular lock screen images. Therefore, for terminal devices with at least two displays with different screen ratios, the memory space required for depth lock screen images corresponding to all screen ratios is also larger.
[0080] Taking a foldable screen terminal device as an example, assuming a large screen with a landscape lock screen, the memory occupied by a certain image as a regular lock screen image (i.e., a non-depth-of-field lock screen image) is 20MB. When the corresponding depth-of-field lock screen image is used as the lock screen image, the foreground image occupies 20MB of memory (generally in the tens of megabytes, but we'll use 20MB as an example here), and the background image occupies 20MB of memory (generally in the tens of megabytes, but we'll use 20MB as an example here), meaning the depth-of-field lock screen image occupies 40MB of memory. Similarly, assuming a large screen with a portrait lock screen, the memory occupied by a certain image as a regular lock screen image is 20MB, and the corresponding depth-of-field lock screen image is used as the lock screen image, the depth-of-field lock screen image occupies 40MB of memory. Similarly, assuming that on a small screen lock screen, a standard lock screen image occupies 10MB of memory, while a depth-sensing lock screen image occupies 20MB, this depth-sensing image occupies 20MB of memory. In other words, to ensure smooth display of the lock screen wallpaper during screen transitions and rotations, approximately 100MB (generally close to 100MB or several hundredMB; we'll use 100MB as an example) of memory is needed to cache the depth-sensing lock screen image for each screen aspect ratio.
[0081] It is also understandable that by caching the bitmaps corresponding to the depth lock screen wallpapers of all screen ratios as resident memory, after exiting the lock screen interface, if a lock screen operation is detected in scenarios such as screen switching or screen rotation (e.g., clicking the power button, timeout screen off, or automatic screen off), the depth lock screen wallpaper corresponding to the current screen ratio can be smoothly displayed.
[0082] For example, suppose display #1 shows depth-sensing lock screen image #1. If a user unlocks the device via display #1, the user interface is displayed on display #1. Subsequently, if a user switches displays on the terminal device, the user interface is displayed on display #2. Then, if a screen lock operation is detected, the depth-sensing lock screen image #2 is displayed on display #2. Because the bitmaps corresponding to the depth-sensing lock screen wallpapers for all screen ratios are cached in resident memory, display #2 can smoothly display the depth-sensing lock screen image #2.
[0083] For example, suppose display screen #1 shows depth-sensing lock screen image #1. If a user unlocks the device via display screen #1, the user interface is displayed on display screen #1. Subsequently, if a user rotates the device, the user interface is displayed on display screen #1. Then, if a screen lock is triggered (e.g., clicking the power button, timeout, or automatic screen shutdown), the screen lock screen image #2 is displayed on display screen #1. The aspect ratios of depth-sensing lock screen images #1 and #2 are different. Because the bitmaps corresponding to the depth-sensing lock screen wallpapers for all screen ratios are cached in resident memory, display screen #1 can smoothly display depth-sensing lock screen image #2.
[0084] However, during daily use of electronic devices, the time spent displaying the user interface on the screen is far greater than the time spent displaying the lock screen image. If the bitmaps corresponding to the depth-sensing lock screen wallpapers of all screen ratios are cached as resident memory, meaning that the time the screen is not displaying the lock screen image, the depth-sensing lock screen wallpapers of all screen ratios will still occupy a significant amount of RAM, which could potentially affect the performance of the terminal device.
[0085] In summary, as mentioned above, when using depth-sensing lock screen images on terminal devices with at least two displays of different aspect ratios, firstly, due to the inclusion of foreground and background images, they occupy more memory space than regular lock screen wallpapers; secondly, to ensure the depth-sensing effect, wallpapers of corresponding aspect ratios need to be cropped separately for each display, requiring multiple depth-sensing lock screen wallpapers, further increasing the memory space occupied by depth-sensing lock screen wallpapers compared to electronic devices with a single display; thirdly, to enhance the user's visual experience, depth-sensing lock screen wallpapers have high resolution, further increasing the memory space occupied by them; additionally, in scenarios involving display switching and screen rotation, the bitmap corresponding to the lock screen wallpaper is cached in resident memory, still consuming a significant amount of RAM even when the lock screen image is not displayed.
[0086] In other words, in order for foldable screen devices to present users with good depth lock screen images and ensure the aesthetics of the depth lock screen images, depth lock screen wallpapers corresponding to all screen ratios occupy a large amount of RAM. Furthermore, the terminal device needs to use the memory occupied by the depth lock screen wallpapers corresponding to all screen ratios as resident memory. As a result, this part of the memory will continuously occupy RAM resources during the use of the terminal device, which may affect the operating performance of the terminal device.
[0087] In view of this, for terminal devices that use depth-of-field lock screen images, how to save RAM resources and thus improve the performance of the terminal devices has become an urgent problem to be solved.
[0088] The memory management method provided in this application can be applied to electronic devices including at least two displays with different screen ratios. By dynamically managing the caching of depth-sensory lock screen wallpapers in different scenarios, the resident memory space corresponding to the depth-sensory lock screen wallpapers is reduced, thereby saving memory resources and improving device performance.
[0089] The following is combined with Figures 4 to 10 Examples of different scenarios are presented.
[0090] Scenario 1: Entering the lock screen from the non-lock screen interface.
[0091] For example, when an electronic device is displaying an unlocked screen, the system detects a user's activation of the device's power button.
[0092] For example, when an electronic device displays an unlocked screen, it will automatically lock the screen if it detects that the user has not performed any operation on the terminal device for a preset time threshold.
[0093] Figure 4 This is a schematic diagram illustrating an example of scenario 1 provided in an embodiment of this application. For example... Figure 4 As shown, taking the small screen display of the non-lock screen interface as an example, the lock screen interface is displayed after the user clicks the power button, or the screen is automatically locked after a timeout and the lock screen interface is displayed.
[0094] For example, when an electronic device displays an unlocked screen, it detects that the user has locked the desktop.
[0095] Figure 5 This is a schematic diagram illustrating yet another example of scenario 1 provided in the embodiments of this application. For example... Figure 5 As shown in (1), taking the small screen display interface as an example, while detecting the user's two-finger pinch operation on the lock screen interface, the user unlocks the phone via face recognition and enters the wallpaper editing page, as shown in (1). Figure 5 As shown in (2), the current lock screen interface is minimized to a wallpaper editing control on the lock screen interface. When the user clicks on the wallpaper editing control, as shown... Figure 5 As shown in (3), it was detected that the user continued to select the currently used lock screen wallpaper, such as Figure 5 As shown in (4) in the diagram, the lock screen interface is displayed.
[0096] Scenario 2: Unlocking from the lock screen to enter the unlock screen.
[0097] For example, unlocking methods may include fingerprint recognition, facial recognition, or password unlocking.
[0098] The non-lock screen interface referred to in this application can be the desktop or the interface of a certain application; this application does not limit it. This will be explained uniformly here and will not be elaborated further below.
[0099] Figure 6 This is a schematic diagram illustrating an example of scenario 2 provided in an embodiment of this application. For example... Figure 6 As shown, taking the small screen lock screen as an example, the desktop is displayed on the small screen after the user unlocks the device.
[0100] Scenario 3: Change the depth-of-field lock screen wallpaper.
[0101] For example, the electronic device detects the user's action of changing the theme to one with a depth-of-field effect.
[0102] Figure 7 This is a schematic diagram illustrating an example of scenario 3 provided in an embodiment of this application. Please refer to... Figure 7 If a user wants their phone's lock screen image to have a depth-of-field effect, they can set it as the lock screen image through the theme application. See also Figure 7 In (1), the user can click on the application identifier of the settings application; the phone responds to the click operation on the application identifier of the settings application by displaying as follows. Figure 7 In the settings interface E1 shown in (2), the user can click the "Wallpaper" option in the settings interface; in response to the click operation of the "Wallpaper" option, the phone can display as follows: Figure 7 The wallpaper settings interface E2 shown in (3) displays lock screen image type options, such as "Wallpaper" (usually a static lock screen image option), "Theme," and "Magazine Lock Screen." Users can click the "Theme" option. In response to clicking the "Theme" option, the phone displays... Figure 7 The theme selection interface E3 shown in (4) displays lock screen images corresponding to different themes. For example, it displays animated images with names such as "Walking (Animated)," "Forest (Animated)," and "Stars (Animated)" corresponding to the animated image theme, and a depth-of-field image with a name such as "People (Depth-of-Field)" corresponding to the depth-of-field image theme. The user can select the depth-of-field image with the name "People (Depth-of-Field)" as the lock screen image. In response to the selection operation of the depth-of-field image with the name "People (Depth-of-Field)," the phone displays as follows: Figure 7 In the preset theme interface E4 shown in (5), if the user decides to use the depth image as the lock screen image, they can click the "Apply" option in the preset theme interface; in response to the click operation of the "Apply" option, the phone can save the depth image as the lock screen image; afterwards, when the phone displays the lock screen interface, the phone's lock screen interface can be as follows: Figure 7 As shown in (6) of the text. Figure 7In (6), after the phone screen is turned on, the lock screen displays the set theme depth lock screen image. The theme depth lock screen image includes a foreground image, namely the main image A1. The main image A1 is located above the system time indicator and partially covers the system time indicator.
[0103] For example, the electronic device detects the user changing the custom depth-of-field lock screen wallpaper.
[0104] Figure 8 This is a schematic diagram illustrating yet another example of scenario 3 provided in the embodiments of this application. Please refer to... Figure 8 The depth image in this lock screen image can also be a user-defined image; see [link / reference]. Figure 8 In (1), the user can click the application icon of the Gallery application; the phone responds to the click operation on the application icon of the Gallery application by displaying, as shown in (1). Figure 8 The gallery preview interface E5 shown in (2) can display thumbnails of multiple stored images. Users can select one thumbnail and set the selected thumbnail's corresponding image as the lock screen image. For example, a user can long-press the thumbnail of the selected image H. In response to the long-press operation on the thumbnail of image H, the following is displayed: Figure 8 The editing window E6 shown in (3) has a "Set as wallpaper" option. The user can click the "Set as wallpaper" option, and in response to this click, the phone can save the selected image H as the lock screen image. Then, when the phone displays the lock screen, if the image H is an image with depth capabilities, the phone's lock screen can be displayed as follows: Figure 8 As shown in (4) of the text. Figure 8 In (4), after the phone screen is turned on, the lock screen displays the custom depth lock screen image that has been set. The custom depth lock screen image includes the foreground image, namely the main image A1. The main image A1 is located above the system time indicator and partially covers the system time indicator.
[0105] Scenario 4: When the screen is not locked, perform landscape or portrait orientation flipping or switch between inner and outer screens.
[0106] For example, when an electronic device is displaying an unlocked screen, it detects that the user is flipping the screen between portrait and landscape modes.
[0107] Figure 9 This is a schematic diagram illustrating an example of scenario 4 provided in an embodiment of this application. For example... Figure 9As shown, taking the large screen of a foldable device as an example, when displaying the unlocked interface in portrait mode, the screen switches to landscape mode in response to the user rotating the electronic device, and the unlocked interface is displayed in landscape mode. Alternatively, when displaying the unlocked interface in landscape mode, the screen switches to portrait mode in response to the user rotating the electronic device, and the unlocked interface is displayed in portrait mode.
[0108] For example, when an electronic device is displaying an unlocked screen, it detects that the user is switching between the inner and outer screens.
[0109] Figure 10 This is a schematic diagram illustrating yet another example of scenario 4 provided in an embodiment of this application. For example... Figure 10 As shown, taking a foldable device as an example, when displaying the unlocked interface on the small screen, in response to the user unfolding the electronic device, the small screen switches to the large screen, and the unlocked interface is displayed on the large screen. Alternatively, when displaying the unlocked interface on the large screen, in response to the user folding the electronic device, the large screen switches to the small screen, and the unlocked interface is displayed on the small screen.
[0110] Figure 11 This is a schematic diagram illustrating a memory management method applicable to the above-described scenario, provided in an embodiment of this application. It should be noted that... Figure 11 The arrows in the text only indicate one possible implementation order and do not limit the combination and execution order of memory management methods in various scenarios of this application.
[0111] For example, this memory management method is applicable to an electronic device having a first display screen and a second display screen, the first display screen and the second display screen having different screen ratios.
[0112] Example 1, for scenario 1, dynamic memory management includes: loading the cache of depth-sensing lock screen images corresponding to all displays; optionally, if at least one display supports landscape / portrait rotation, loading the cache corresponding to all screen display states. Furthermore, the cache of the depth-sensing lock screen image corresponding to the display to be displayed is assigned to the cache of the current depth-sensing lock screen image of the electronic device to ensure accurate display of the lock screen image.
[0113] Specifically, in response to the screen lock operation, based on the first original lock screen image, a cache of a first depth-of-field lock screen image adapted to the size of the first display screen is loaded, and a cache of a second depth-of-field lock screen image adapted to the screen size of the second display screen is loaded. The cache of the first depth-of-field lock screen image is then assigned to the cache of the current depth-of-field lock screen image on the first display screen. Finally, the first lock screen interface is displayed on the first display screen.
[0114] The first depth-of-field lock screen image includes a first foreground image and a first background image, and the second depth-of-field lock screen image includes a second foreground image and a second background image.
[0115] The first lock screen interface includes: a first background image, a first lock screen element displayed on the first background image, and a first foreground image that partially obscures the first lock screen element. In other words, the first lock screen interface is a lock screen interface that displays a depth-of-field effect.
[0116] The first original image can be the one set by the user in the last time (e.g., through a theme or custom settings) or the one that is the default image on the electronic device (e.g., the one that is pre-configured at the factory).
[0117] The first display screen is the display screen that is lit up before the operation of triggering the screen lock is detected, or in other words, the operation of triggering the screen lock is detected while the user is using the first display screen.
[0118] Specifically, the cache of the first depth-of-field lock screen image is assigned to the cache of the current depth-of-field lock screen image of the first display screen. In other words, the cache of the depth-of-field lock screen image corresponding to the display screen currently being used by the user of the electronic device is assigned to the cache of the first depth-of-field lock screen image.
[0119] In other words, loading all depth-of-field lock screen images corresponding to all displays while the screen is locked can prevent the screen from going black when the user switches displays while the screen is locked, thereby improving the user experience.
[0120] Based on Example 1, it is possible to consider that the first display screen and / or the second display screen have the ability to switch between portrait and landscape modes, that is, to have two screen display states.
[0121] Optionally, the first display screen supports a first screen display state and a second screen display state. The first depth-of-field lock screen image corresponds to the first screen display state.
[0122] Example 1 displays a first lock screen on the first display screen; that is, the first lock screen is displayed on the first display screen based on the first screen's display state. Example 1 also includes: in response to a lock screen triggering operation, loading a cache of a fourth depth-of-field lock screen image adapted to the size of the first display screen and the second screen's display state, based on the original first lock screen image.
[0123] In other words, when the first display screen supports landscape and portrait rotation, loading the depth-of-field lock screen image of all screen display states corresponding to the first display screen can prevent the black screen from occurring when the user switches between landscape and portrait modes while the screen is locked, thereby improving the user experience.
[0124] Optionally, the second display screen supports a third screen display state and a fourth screen display state, and the second depth-of-field lock screen image corresponds to the third screen display state.
[0125] Example 1 also includes: in response to a screen lock triggering operation, loading a cache of a fifth depth-of-field screen image adapted to the size of the second display and the display state of the fourth screen, based on the first original screen lock image.
[0126] In other words, when the second display supports landscape and portrait orientation switching, loading the depth-of-field lock screen image of all screen display states corresponding to the second display can prevent the black screen from occurring when the user switches between landscape and portrait orientations while the screen is locked, thereby improving the user experience.
[0127] The above solution loads all depth-of-field lock screen images corresponding to all displays when entering the lock screen scenario, which can prevent the black screen from occurring when the user switches displays or switches between portrait and landscape modes while in the lock screen state, thereby improving the user experience.
[0128] Understandably, if all depth lock screen images are not loaded according to the above scheme, assuming the first display screen shows the first depth lock screen image in the first screen display state, only the first depth lock screen image occupies the running memory. When the user switches to the second display screen, the electronic device needs to temporarily load the second depth lock screen image. Since loading the second depth lock screen image takes a certain amount of time, it is very likely that the loading will not be timely and a black screen will occur, affecting the user experience.
[0129] It should be noted that, in this application, the cache for loading depth-of-field lock screen images can be understood as the cache corresponding to the bitmap of the depth-of-field lock screen image; the memory occupied by the depth-of-field lock screen image can be understood as the memory occupied by the bitmap of the depth-of-field lock screen image; and the cache for releasing the depth-of-field lock screen image can be understood as releasing the bitmap of the depth-of-field lock screen image or the cache corresponding to the bitmap. This is explained uniformly here and will not be elaborated further below.
[0130] Example 2, for scenario 2, dynamic memory management includes: releasing the depth lock screen image corresponding to the display screen other than the currently lit display screen; optionally, if the first display screen supports landscape and portrait screen flipping, releasing the cache of the depth lock screen image corresponding to the display state other than the currently used screen display state.
[0131] Specifically, in response to the unlocking operation, a first unlock screen interface is displayed on the first display screen, and the cache of the second depth-of-field lock screen image is released.
[0132] As is understandable, Example 2 is illustrated by showing Scenario 2 occurring after Scenario 1. In Scenario 1, the first lock screen is displayed on the first display screen, and subsequently in Scenario 2, the first unlock screen is displayed on the first display screen. Unlike Scenario 1, since the first unlock screen has already been displayed, the user generally cannot directly access the lock screen on other displays or other screen states of the current display screen by operating the electronic device.
[0133] For example, when displaying the first unlocked screen, if a user wants to display the second lock screen on the second display, one approach is to switch to the second display while still unlocked and then trigger the lock screen; another approach is to trigger the lock screen first and then switch to the second display. In the former approach, the electronic device can manage memory to prepare the cache of the depth-sensing lock screen image required for the second lock screen (described in Example 4 below); in the latter approach, triggering the lock screen results in the same behavior as in Example 1 above. In other words, both approaches allow sufficient loading time for the depth-sensing lock screen image on the second display. Therefore, in this specific scenario of Scenario 2, releasing the cache of the second depth-sensing lock screen image can save RAM resources while ensuring the user's visual experience, thereby improving the terminal device's performance and further enhancing the user experience.
[0134] For example, similarly, when the first display screen shows the first unlocked screen based on the first screen display state, if the user wants to display the third lock screen based on the second screen display state on the first display screen, it also needs to be done in two steps. One way is to trigger the lock screen first and then flip the electronic device. The other way is to flip the electronic device first and then trigger the lock screen. In the former way, triggering the lock screen results in Example 1 above. In the latter way, the electronic device can prepare the cache of the depth lock screen image corresponding to the second screen display state before triggering the lock screen after flipping the electronic device (this will be introduced in Example 4 below). Therefore, similar beneficial effects are also present in this sub-scenario of Scenario 2.
[0135] Optionally, the first display screen supports a first screen display state and a second screen display state. Example 2 also includes: releasing the cache of the fourth depth-of-field lock screen image in response to an unlocking operation.
[0136] Optionally, the second display screen supports a third screen display state and a fourth screen display state. Example 2 also includes: releasing the cache of the fifth depth-of-field lock screen image in response to an unlocking operation.
[0137] In one implementation, Example 1 is performed after Example 2, and the dynamic management of memory includes loading a cache of the second depth-of-field lock screen image, and optionally loading a cache of the fourth depth-of-field lock screen image.
[0138] Example 3, for scenario 3, includes dynamic memory management as follows: releasing the cache of the previous depth-of-field lock screen image, loading the changed depth-of-field lock screen image, and only loading the cache of the depth-of-field lock screen image of the currently used display screen. Furthermore, the cache of the depth-of-field lock screen image corresponding to the display screen to be displayed is assigned to the cache of the current depth-of-field lock screen image of the electronic device to ensure accurate display of the lock screen image.
[0139] Specifically, in response to the operation of replacing the first original lock screen image with the second original lock screen image, the cache of the depth lock screen image loaded according to the first original lock screen image is released, and the cache of the third depth lock screen image adapted to the size of the first display screen is loaded according to the second original lock screen image. The cache of the third depth lock screen image is assigned to the cache of the current depth lock screen image of the first display screen, wherein the third depth lock screen image includes a third foreground image and a third background image.
[0140] In one implementation, Figure 11 The example of implementing scene 3 after scene 2 is used for illustration. Since the second depth-of-field lock screen image has already been released in scene 2, only the first depth-of-field lock screen image is released in scene 3.
[0141] In other words, in this implementation method, the wallpaper can be changed by entering the lock screen image editing page from the non-lock screen interface.
[0142] For example, by Figure 7 or Figure 8 The method shown allows you to change the wallpaper on the non-lock screen interface.
[0143] For example, in response to a user setting a depth-of-field image theme, the second original lock screen image from the user-selected depth-of-field image theme is set as the new original lock screen image. This theme editing page can also be understood as the lock screen image editing page.
[0144] Alternatively, for example, in response to a user setting a depth-of-field lock screen image in the gallery of an electronic device, the second original lock screen image selected by the user in the gallery is set as the changed original lock screen image.
[0145] Thus, the electronic device can detect the user's action of changing the first original lock screen image to the second original lock screen image on the first unlock screen interface.
[0146] In another implementation, if scenario 3 is implemented directly after scenario 1, then the first depth-of-field lock screen image and the second depth-of-field lock screen image need to be released.
[0147] In other words, this implementation method changes the lock screen wallpaper from the lock screen image editing page on the lock screen interface.
[0148] For example, in response to a user's pinch-to-zoom operation on the first lock screen, a lock screen image editing page is displayed on the first display screen. The lock screen image editing page includes multiple lock screen images (e.g., multiple lock screen images can be viewed by swiping left or right or up or down, which may include a lock screen image and a depth lock screen image, and all of the multiple lock screen images are adapted to the display screen and screen display state currently used to display the lock screen image editing page); in response to a setting operation, the third depth lock screen image among the multiple lock screen images is set as the replaced depth lock screen image (e.g., after the user clicks on the third depth lock screen image, clicks the control to confirm the application of the third depth lock screen image as the lock screen image of the current lock screen interface, or after pinching out with two fingers, the lock screen is triggered, and a lock screen interface with the third depth lock screen image as the lock screen image is displayed).
[0149] After updating the first depth-of-field lock screen image to the third depth-of-field lock screen image, the electronic device can detect the user's operation of changing the first lock screen original image to the second lock screen original image on the first non-lock screen interface, and the wallpaper of other displays or screen display states will also change accordingly.
[0150] Combining the two implementation methods in Example 3, an updated lock screen interface is displayed after changing the lock screen wallpaper. The updated first lock screen interface includes: a third background image, a first lock screen element displayed on the third background image, and a third foreground image that partially obscures the first lock screen element.
[0151] The above solution, after changing the wallpaper, immediately releases the depth-sensor lock screen wallpaper from all displays (optionally, all screen display states) before the wallpaper change and loads a cached depth-sensor lock screen image for the currently used display. On one hand, it promptly clears useless cache, saving RAM resources; on the other hand, it loads a cached depth-sensor lock screen image that may be used soon. Compared to loading the depth-sensor lock screen wallpaper from all displays (optionally, all screen display states), this approach saves RAM resources while maintaining a good user experience. Therefore, it improves the operating performance of the terminal device and further enhances the user experience.
[0152] It is understandable that only the cached depth lock screen image that may be used soon is loaded, so that there will be no black screen and thus no impact on user experience.
[0153] For example, if a screen lock operation is detected after Example 3, a depth-of-field lock screen wallpaper with the display screen (optionally, all screen display states) can be loaded, referring to the method in Example 1.
[0154] For example, after Example 3, the first non-lock screen interface is displayed. After detecting the operation of rotating, unfolding, or folding the electronic device, a new display screen or screen display state to be used is determined, and then loading is performed according to the display screen to be used (optionally, the screen display state as well) (details will be introduced in Example 4 below). There is still sufficient time to load the corresponding depth lock screen image cache before the next operation that triggers the lock screen is detected.
[0155] Example 4, for scenario 4 (divided into scenario 4#1 and scenario 4#2).
[0156] For scenario 4#1, when the electronic device is displaying a non-lock screen interface, if the operation of rotating the electronic device is detected, the cache of the depth lock screen image corresponding to the screen display state before the rotation is released, and the cache of the depth lock screen image corresponding to the screen display state after the rotation is loaded.
[0157] Specifically, in response to the operation of rotating the electronic device, a second unlocked screen interface is displayed on the first display screen based on the second screen display state, and the cache of the first depth-of-field lock screen image is released, while the cache of the fourth depth-of-field lock screen image is loaded.
[0158] The first screen display state and the second screen display state are the display states of the first display screen before and after rotation, respectively.
[0159] For scenario 4#2, when an electronic device displays a non-lock screen interface, if a screen switching operation is detected (taking a foldable device as an example, it is the operation of folding or unfolding the electronic device), the cache of the depth lock screen image corresponding to the previous screen is released, and the cache of the depth lock screen image corresponding to the new screen is loaded.
[0160] Specifically, in response to the operation of switching the second display screen to the display screen of the currently displayed image, a third non-lock screen interface is displayed on the second display screen, the cache of the first depth-of-field lock screen image is released, and the cache of the second depth-of-field lock screen image is loaded.
[0161] Figure 11 Example 4 is implemented after Example 2 for illustration, but this does not limit the scope of protection of this application.
[0162] In one implementation, Example 1 can be implemented after Example 4.
[0163] In another implementation, the memory management method in Example 4 can be implemented after Example 3. For example, for scenario 4#1, the cache of the third depth lock screen image is released and the cache of the fifth depth lock screen image is loaded; for example, for scenario 4#2, the cache of the third depth lock screen image is released and the cache of the sixth depth lock screen image is loaded (wherein, the sixth depth lock screen image is a depth lock screen image that is adapted to the size of the second display screen based on the original image of the second lock screen).
[0164] The above solution adjusts the cache of the depth lock screen image accordingly when switching between displays or screen display states in the non-lock screen interface. This ensures a good user experience (without a black screen) while saving RAM resources, thus improving the performance of the terminal device and enhancing the user experience.
[0165] As shown in Examples 1 to 4 above, in the locked screen state, the electronic device loads a cache of depth-sensing lock screen images for all screen display states across all displays. In the unlocked screen state, through dynamic memory management, the electronic device's RAM can only hold a cache of one depth-sensing lock screen image (including foreground and background images) at any given time. In other words, after exiting the locked screen state, not all cached depth-sensing lock screen images occupy RAM space as resident images.
[0166] For example, an electronic device has N displays, each with a different screen ratio. The N displays include a first display and a second display. M of the N displays support two different screen display states. Each of the M displays corresponds to two different depth-of-field lock screen images. 0 ≤ M ≤ N, N ≥ 2, and both M and N are integers.
[0167] In the case where the first lock screen interface is displayed on the first display screen, the bitmaps of N+M depth lock screen images corresponding to the N display screens all occupy the running memory of the electronic device, and each of the N+M depth lock screen images includes a foreground image and a background image.
[0168] In the case where the first display screen shows the first non-locked screen interface, only the first depth-of-field lock screen image occupies the running memory of the electronic device among N+M depth-of-field lock screen images. In the case where the first display screen belongs to M display screens, the first display screen currently displays the first non-locked screen interface based on the first screen display state, and the first depth-of-field lock screen image corresponds to the first screen display state.
[0169] Therefore, in the locked screen state, the amount of RAM required by electronic devices to meet user needs is generally small. Loading a cache of all depth-sensing lock screen images at this time will not affect the user experience and will ensure that switching or rotating the screen does not result in a blackout, thus guaranteeing a smooth visual experience. In the unlocked screen state, dynamic memory management can significantly save RAM resources, thereby improving the device's performance and further enhancing the user experience.
[0170] For example, taking a folding device as an example, the electronic device has a folding screen. The first display screen is a large foldable screen, and the second display screen is a small screen. The large screen supports two screen display states, including a landscape display state and a portrait display state. The landscape display state corresponds to the first depth-of-field lock screen image, and the portrait display state corresponds to the fourth depth-of-field lock screen image.
[0171] If the electronic device is detected to switch from an unfolded state to a folded state, and the display mode changes from landscape or portrait on the large screen to display on the small screen, the cache of the first or fourth depth-of-field lock screen image is released, and the cache of the second depth-of-field lock screen image is loaded; or, if the electronic device is detected to switch from a folded state to an unfolded state, and the display mode changes from landscape or portrait on the small screen to display on the large screen, the cache of the second depth-of-field lock screen image is released, and the cache of the first or fourth depth-of-field lock screen image is loaded.
[0172] When displaying in landscape mode on a large screen, if the operation of rotating an electronic device is detected, the display switches to portrait mode on the large screen, releasing the cache of the first depth-of-field lock screen image and loading the cache of the fourth depth-of-field lock screen image; or, when displaying in portrait mode on a large screen, if the operation of rotating an electronic device is detected, the display switches to landscape mode on the large screen, releasing the cache of the fourth depth-of-field lock screen image and loading the cache of the first depth-of-field lock screen image.
[0173] Therefore, using the memory management method provided in this application for foldable devices can significantly save on running memory resources, thereby improving the operating performance of the terminal device and effectively enhancing the user experience.
[0174] Figure 12 This is a block diagram of a software system for an electronic device provided in an embodiment of this application. See also... Figure 12 A layered architecture divides software 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, the system layer, and the kernel layer.
[0175] The application layer can include a series of application packages. For example... Figure 12 As shown, the application layer can include system applications (System UI), theme applications, gallery applications, and other applications.
[0176] System UI is the first application visible to the user during the system startup process of an electronic device, such as the lock screen displayed after the device is powered on, and the desktop and status bar displayed after unlocking. System UI is a set of UI components that provide system-level information display and interaction for the user, and can be used to control the display of lock screen and desktop images. In the embodiments of this application, System UI can be used to interact with theme applications or gallery applications to display the set depth-of-field lock screen image on the lock screen interface after the screen is turned on, when a depth-of-field lock screen image is applied to the electronic device. For an example, please refer to... Figure 12 The System UI includes multiple functional modules, including but not limited to the following: Lock screen service module (KeyguardService), Lock screen wallpaper module (KeyguardWallpaper), Lock screen view media module (KeyguardViewMediator), Lock screen update monitoring module (KeyguardUpdateMonitor), Depth Effect Helper module (DepthEffectHelper), Foreground view adapter (WallpaperPagerAdapterForeground), Magazine lock screen utility module (MagazineUtils), Wallpaper Change Broadcast Receiver Controller module (WallpaperChangedReceiverController), Magazine wallpaper module (MagazineWallpaper), Magazine lock screen display module (MagazineView), and Lock screen interface change view module (BackDropView).
[0177] The KeyguardService module is responsible for managing the device's lock screen mechanism. This includes controlling the lock screen state and displaying the lock screen interface.
[0178] The KeyguardWallpaper module and the LockscreenWallpaper module are used for interaction. The LockscreenWallpaper module interacts with lock-screen related modules or classes outside the system UI, while the KeyguardWallpaper module interacts with lock-screen related modules or classes within the system UI. Both are used to handle the logic of updating the wallpaper when the lock screen wallpaper changes.
[0179] The KeyguardViewMediator module is responsible for handling all interface-related operations of SystemUI. All calls to it will be transferred to the user interface (UI) thread.
[0180] The lock screen update monitoring module (KeyguardUpdateMonitor) is a monitor for all events that affect the entire standby unlock / lock screen service. (Besides acting as a monitor, it also functions as a context; perhaps we should name this class the unlock context (KeyguardContext). It monitors events such as time changes, battery status changes, time zone changes, SIM card status changes, phone status changes, and phone signal changes.)
[0181] The DepthEffectHelper module is used to manage the caching of depth lock screen images.
[0182] The WallpaperPagerAdapterForeground is used to populate the views in the foreground view page component (which contains multiple views, each of which can be used to render the foreground image of the depth image).
[0183] The Magazine Lock Screen Utils module manages and provides magazine-style wallpapers, which typically feature dynamic changes that display different content based on user habits and ambient lighting.
[0184] The WallpaperChangedReceiverController module is used to receive wallpaper change events and reset the related state or resources.
[0185] The MagazineWallpaper module is used to display magazine lock screens.
[0186] The Magazine Lock Screen Display module (MagazineView) is responsible for refreshing the magazine lock screen view.
[0187] The BackDropView module handles the display logic of the lock screen interface when the lock screen state changes.
[0188] The theme application offers a variety of themes for users to set as desktop or lock screen images on their electronic devices. This theme application can be a built-in system settings application or an installed third-party application.
[0189] The gallery application is used to store images, which may be sourced from photographs or the cloud. As an example of this application, the gallery application includes both regular images and images with depth-of-field capabilities. Regular images do not have a depth-of-field effect when applied to the lock screen, while images with depth-of-field capabilities do. Users can select any image from the gallery application and set it as the lock screen image for their electronic device.
[0190] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0191] As an example of this application, the application framework layer includes a wallpaper management service module. This module sends a wallpaper change broadcast message to the System UI when it receives a notification of a wallpaper change event from the theme application or gallery application, enabling the System UI to process the wallpaper change. In one example, the wallpaper management service module is named WallpaperManagerService.
[0192] Please refer to Figure 12 The application framework layer also includes a power management service module and a window management service module. The power management service module controls the screen to turn on or off in the event of a screen-off or screen-on event on the electronic device, and sends screen-off or screen-on notifications to relevant modules. The window management service module is responsible for managing the lock screen interface, such as displaying the lock screen image. In one example, the power management service module is named PowerManagerService, and the window management service module is named WindowManagerService.
[0193] The Android Runtime comprises the core libraries and the virtual machine. The Android Runtime is responsible for scheduling and managing the Android system. The core libraries consist of two parts: one part contains the functionalities that Java calls, and the other part comprises the core Android libraries. The application layer and application framework layer run in the 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.
[0194] The system library can include multiple functional modules, such as a surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL). The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The media libraries support various audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing libraries are used for 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D graphics.
[0195] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0196] The following is combined Figures 13 to 21 The specific examples of Examples 1 to 4 above are described in detail.
[0197] The following is combined Figure 13 and Figure 14 A detailed explanation of Example 1 above.
[0198] Figure 13 A flowchart of a specific example of method 100 provided for an embodiment of this application. Figure 13 It is executed by a module or class in the System UI.
[0199] S101, confirm whether to turn off the screen or lock it.
[0200] Understandably, modules or classes in System UI can obtain information about whether an electronic device is off or locked, based on modules in the application framework layer, such as the power management service module and the window management service module.
[0201] S102, Load depth lock screen image cache (including foreground and background images).
[0202] This includes S102a to S102c.
[0203] S102a, Determine whether the screen of the electronic device is a foldable screen.
[0204] If the result is negative, execute S102b to load the cache of the depth lock screen image for the portrait-oriented small screen.
[0205] If the judgment result is yes, execute S102c to load the cache of the depth lock screen image for portrait small screen; load the cache of the depth lock screen image for portrait large screen; and load the cache of the depth lock screen image for landscape large screen.
[0206] S103, Update the current drawable cache (refresh CurrentDrawableCache).
[0207] This includes S103a to S103g.
[0208] S103a, Determine whether the screen of the electronic device is a foldable screen.
[0209] If the judgment result is yes, the cache of the current foreground depth lock screen image is assigned a value in two cases.
[0210] Scenario 1: The depth lock screen image currently used by the electronic device is a depth lock screen image included in the depth theme.
[0211] If it is detected that the screen being used by the user is in landscape mode when the screen is off or locked, S103b, the cache of the current depth lock screen image is assigned to the cache of the landscape large screen depth lock screen image.
[0212] If it is detected that the screen being used by the user is in portrait mode when the screen is off or locked, S103c, the current depth lock screen image cache is assigned to the cache of the depth lock screen image of the portrait small screen or large screen.
[0213] Understandably, depth-of-field lock screen images for depth-of-field themes do not differentiate between large and small screens. When caching, they are loaded based on resources preset by user experience (UX), and when displayed, they are cropped or stretched to the same size as the current screen size.
[0214] Scenario 2: The depth lock screen image currently used by the electronic device is a custom depth lock screen image.
[0215] If it is detected that the display screen used by the user when the screen is off or locked is a small screen, S103d will assign the current depth lock screen image cache to the depth lock screen image cache of the portrait small screen.
[0216] If it is detected that the display screen used by the user when the screen is off or locked is a small screen and the display state of the screen used by the user is portrait mode, S103e, the current depth lock screen image cache is assigned to the depth lock screen image cache of the portrait large screen.
[0217] If it is detected that the display screen used by the user when the screen is off or locked is a small screen and the display state of the screen used by the user is landscape, S103f, the current depth lock screen image cache is assigned to the depth lock screen image cache of the landscape large screen.
[0218] If the result is negative, execute S103g to assign the current depth lock screen image cache to the cache of the depth lock screen image for portrait small screen.
[0219] Figure 14 This is a schematic diagram of a timing interaction method 200, specifically an example of Example 1 provided in this application embodiment. The power management service module and the window management service module belong to the application framework layer, while the other modules belong to the System UI.
[0220] S201, the power management service module received an instruction from the user to turn off the screen.
[0221] S202, the power management service module instructs the window management service module to enter sleep mode (gotoSleep).
[0222] S203, the window management service module instructs the lock screen service module to begin entering sleep mode (onStartedGoingToSleep).
[0223] S204, The lock screen service module instructs the lock screen view media module to begin entering sleep mode (onStartedGoingToSleep).
[0224] S205, the lock screen view media module instructs the lock screen update monitoring module to begin entering sleep mode (onStartedGoingToSleep).
[0225] S206, the lock screen update monitoring module has started to enter sleep mode (HandleStartedGoingToSleep).
[0226] S207, The lock screen update monitoring module instructs the depth assistant module to reload the depth cache when the screen is locked (reloadDepthEffectCacheWhenScreenOff).
[0227] S208, The Depth Assist module instructs the Foreground View Adapter module to load the cache.
[0228] For example, S102 can be a concrete implementation of S207 and S208.
[0229] S209, the foreground view adapter module updates the currently drawable cache.
[0230] For example, S103 can be a concrete implementation of S209.
[0231] It is understood that the beneficial effects of method 100 and timing interaction graph 200 can be seen in the description corresponding to Example 1.
[0232] The following is combined Figure 15 and Figure 16 A detailed explanation of Example 2 above.
[0233] Figure 15 A flowchart of a specific example of method 300 provided for an embodiment of this application. Figure 15 It is executed by a module or class in the System UI.
[0234] S301, confirm exiting the lock screen and entering the non-lock screen interface.
[0235] Please refer to the description related to Scenario 2 for details.
[0236] S302, release the depth lock screen image cache (clearCacheWhenExitKeyguard). The depth lock screen image cache includes the foreground image and the background image.
[0237] This includes S302a to S302f.
[0238] S302a, Determine whether the screen of an electronic device is a foldable screen.
[0239] If the result is negative, execute S302b and do not release the cache.
[0240] If the judgment result is yes, it is necessary to discuss it separately based on the sub-display screen and the screen display status.
[0241] If the screen display state of the lock screen is landscape, S302c releases the cache of the depth lock screen image for both portrait and small screens.
[0242] If the screen display state of the lock screen is portrait mode and the display screen is a small screen, S302e releases the cache of the depth lock screen image of the portrait large screen.
[0243] If the screen display state of the lock screen is portrait mode and the display screen is a large screen, S302f releases the cache of the depth lock screen image of the portrait small screen.
[0244] Figure 16This is a schematic diagram of a timing interaction method 400, specifically an example of Example 2 provided in this application. Figure 16 The module shown belongs to System UI.
[0245] S401, the lock screen view media module receives an instruction from the user to unlock.
[0246] S402, Lock screen view media module handling hide (handleHide).
[0247] S403, the lock screen view media module executes the lock screen disappearance thread (KeyguardGoingAwayRunnable).
[0248] S404, the lock screen view media module executes the lock screen disappearance (dokeyguardGoingAway).
[0249] S405, the lock screen view media module dispatches the lock screen disappearance (dispatchKeyguardGoingAway) to the lock screen update monitoring module.
[0250] S406, Lock screen update monitoring module handles lock screen disappearance (handleKeyguardGoingAway).
[0251] S407, the lock screen update monitoring module indicates to the magazine wallpaper module that the lock screen has disappeared (onKeyguardGoingAway).
[0252] S408, the magazine wallpaper module instructs the depth assistant module to clear the depth cache when exiting the lock screen (cleanDepthEffectCacheWhenExitKeyguard).
[0253] S409, The Depth Assist module instructs the Foreground View Adapter module to clear the cache when exiting the lock screen (clearCacheWhenExitKeyguard).
[0254] S410, Foreground View Adapter Module Releases Bitmap.
[0255] For example, S303 can be a concrete implementation of S410.
[0256] It is understandable that the beneficial effects of method 300 and timing interaction graph 400 can be seen in the description corresponding to Example 2.
[0257] The following is combined Figures 17 to 19 A detailed explanation of Example 3 above is provided.
[0258] Figure 17A flowchart of a specific example of method 500 provided for an embodiment of this application. Figure 17 It is executed by a module or class in the System UI.
[0259] S501, confirm the change of depth-of-field lock screen wallpaper.
[0260] For details, please refer to the description related to Scenario 3.
[0261] S502, clearDepthEffectCache (including clearing the cache of the foreground image and the cache of the background image).
[0262] Understandably, this is a cache of the depth-of-field lock screen wallpaper before the change.
[0263] S503, create a cache for the depth-of-field lock screen wallpaper (initDepthEffectCache).
[0264] Understandably, this is a cache of the changed depth-of-field lock screen wallpaper.
[0265] This includes S503a to S503g.
[0266] S503a determines whether the screen of an electronic device is a foldable screen.
[0267] If the judgment result is yes, the cache of the current foreground depth lock screen image is loaded and assigned values in two ways.
[0268] Scenario 1: The depth lock screen image currently used by the electronic device is a depth lock screen image included in the depth theme.
[0269] If it is detected that the screen being used by the user is in landscape mode when the depth lock screen wallpaper is changed, S503b loads the cache of the landscape depth lock screen image; and assigns the current depth lock screen image cache to the cache of the landscape large screen depth lock screen image.
[0270] If it is detected that the screen being used by the user is in portrait mode when the depth lock screen wallpaper is changed, S503c loads the cache of the portrait depth lock screen image; and assigns the current depth lock screen image cache to the cache of the portrait depth lock screen image.
[0271] Understandably, depth-of-field lock screen images for depth-of-field themes do not differentiate between large and small screens. When caching, they are loaded based on resources preset by user experience (UX), and when displayed, they are cropped or stretched to the same size as the current screen size.
[0272] Scenario 2: The depth lock screen image currently used by the electronic device is a custom depth lock screen image.
[0273] If it is detected that the user's display screen is a small screen when the depth lock screen wallpaper is changed, S503d loads the cache of the depth lock screen image of the small screen in portrait mode; and assigns the current depth lock screen image cache to the cache of the depth lock screen image of the small screen in portrait mode.
[0274] If it is detected that the user's display screen is a small screen when the depth lock screen wallpaper is changed, and the user's screen display state is portrait mode, S503e, load the cache of the depth lock screen image of the portrait large screen; and assign the current depth lock screen image cache to the cache of the depth lock screen image of the portrait large screen.
[0275] If it is detected that the user's display screen is a small screen when the depth lock screen wallpaper is changed, and the user's screen display state is landscape, S503f, load the cache of the depth lock screen image of the landscape large screen; and assign the current depth lock screen image cache to the cache of the depth lock screen image of the landscape large screen.
[0276] If the result is negative, execute S503g to load the cache of the depth lock screen image for the portrait-oriented small screen; and assign the current depth lock screen image cache to the cache of the depth lock screen image for the portrait-oriented small screen.
[0277] Figure 18 This is a schematic diagram of a timing interaction method 600, specifically an example of Example 3 provided in this application embodiment. The timing interaction method 600 is illustrated using changing the theme wallpaper as an example. The wallpaper management service module belongs to the application framework layer, while the other modules belong to the System UI.
[0278] S601, the wallpaper management service module receives an instruction from the user to change the theme wallpaper.
[0279] S602, the wallpaper management service module receives a wallpaper change broadcast (WallpaperChanged Receiver.onReceive).
[0280] S603, the wallpaper management service module indicates that the wallpaper change broadcast receiving control module is static wallpaper change (onStaticWallpaperChanged).
[0281] S604, The wallpaper change broadcast receiving control module instructs the depth-of-field assistant module to update the depth-of-field wallpaper memory (updateDepthEffectWallpaper).
[0282] S605, the Depth-Effect Cache is cleared in the Depth-Effect Module.
[0283] S606, the Depth Assist module instructs the Foreground View Adapter module to clear the cache.
[0284] S607, Foreground View Adapter Module Release Bitmap.
[0285] For example, S502 can be a concrete implementation of S607.
[0286] S608, the Depth Assistant module creates a depth-of-field cache (initDepthEffectCache).
[0287] S609, the Depth Assist module instructs the Foreground View Adapter module to create a depth-of-field image cache (forceTolnitDepthEffectFgCache).
[0288] S610, the foreground view adapter module loads the current wallpaper cache (reloadCurWallpaperCache).
[0289] For example, S503 can be a concrete implementation of S610.
[0290] Figure 19 This is a schematic diagram of a timing interaction method 700, a specific example of Example 3 provided in this application embodiment. The timing interaction method 700 is illustrated using changing a custom wallpaper as an example. The wallpaper management module and wallpaper management service module belong to the application framework layer, while other modules belong to the System UI.
[0291] S701, the wallpaper management module receives an instruction from the user to change the custom wallpaper.
[0292] S702, the wallpaper management module instructs the wallpaper management service module to set the wallpaper (setWallpaper).
[0293] S703, the wallpaper management service module indicates that the LockScreenwallpaper module has changed the wallpaper (onWallpaperChanged).
[0294] S704, LockScreenwallpaper module updates lock screen wallpaper (updateKeyguardWallpaper).
[0295] S705, the LockScreenwallpaper module instructs the KeyguardWallpaper module to allow the user to set the lock screen wallpaper (onUserResetKeyguardWallpaper).
[0296] S706, the lock screen wallpaper module (KeyguardWallpaper) sets a user-customized wallpaper (setUserCustomedWallpaper).
[0297] S707, the KeyguardWallpaper module instructs the magazine lock screen tool module to set a user-customized wallpaper (setUserCustomedWallpaper).
[0298] S708, the magazine lock screen tool module instructs the depth assistant module to create a depth cache (initDepthEffectCache).
[0299] S709, the Depth-Effect Cache is cleared in the Depth-Effect Module.
[0300] S710, the Depth Assist module instructs the Foreground View Adapter module to clear the cache.
[0301] S711, Foreground View Adapter Module release Bitmap.
[0302] For example, S502 can be a concrete implementation of S711.
[0303] S712, the Depth Assistant module creates a depth-of-field cache (initDepthEffectCache).
[0304] S713, the Depth Assist module instructs the Foreground View Adapter module to create a depth-of-field image cache (forceTolnitDepthEffectFgCache).
[0305] S714, the foreground view adapter module loads the current wallpaper cache (reloadCurWallpaperCache).
[0306] For example, S503 can be a concrete implementation of S714.
[0307] It is understandable that the beneficial effects of method 500 and timing interaction graphs 600 and 700 can be seen in the description corresponding to Example 3.
[0308] The following is combined Figure 20 and Figure 21 A detailed explanation of the specific example in Example 4 above.
[0309] Figure 20 A flowchart of a specific example of method 800 provided for an embodiment of this application. Figure 20It is executed by a module or class in the System UI.
[0310] S801, determine whether to switch the display screen or switch the screen display status.
[0311] For details, please refer to the description related to Scenario 4.
[0312] S802, clear the cache of the current foreground lock screen wallpaper (release the cache of the foreground image and the cache of the background image).
[0313] Understandably, this is a cache of the previous depth-of-field lock screen wallpaper.
[0314] S803 determines the display screen currently in use by the electronic device and the screen display status.
[0315] Understandably, this is the display screen and its display status after the switch.
[0316] S804, load the depth lock screen image cache after switching (including foreground and background images).
[0317] S804 includes S804a to S804c.
[0318] If it is detected that the display screen used by the user is a small screen when switching the display screen or switching the screen display state, S804a, load the cache of the depth lock screen image of the portrait small screen; optionally, assign the current depth lock screen image cache to the cache of the depth lock screen image of the portrait small screen.
[0319] If it is detected that the screen used by the user is a small screen when switching displays or switching screen display states, and the screen display state used by the user is portrait mode, S804b, load the cache of the depth lock screen image of the portrait large screen; optionally, assign the current depth lock screen image cache to the cache of the depth lock screen image of the portrait large screen.
[0320] If it is detected that the screen used by the user is a small screen when switching displays or switching screen display states, and the screen display state used by the user is landscape, S804c, load the cache of the depth lock screen image of the landscape large screen; optionally, assign the current depth lock screen image cache to the cache of the depth lock screen image of the landscape large screen.
[0321] Figure 21 This is a schematic diagram of a timing interaction method 900, a specific example of Example 4 provided in this application embodiment. Figure 21 The module involved belongs to System UI.
[0322] S901, the lock screen interface view change module receives an instruction from the user to flip the screen between portrait and landscape modes or switch between inner and outer screens.
[0323] S902, callback method (onConfig Changed) when the lock screen interface view module configuration changes.
[0324] This is understandable; the system will call back this method when the electronic device's display changes, or when the device's orientation changes. A change in device orientation means rotating the device, which changes the screen display state.
[0325] S903, the lock screen interface changes the view module to reload the depth background and foreground (reloadDepthEffectBgAndFg), that is, reload the foreground and background that match the current device state.
[0326] For example, S804 can be a concrete implementation of S903.
[0327] S904, the lock screen interface changes the view module to update the wallpaper.
[0328] S905, the lock screen interface change view module indicates the magazine lock screen display module update wallpaper (updateWallpaper).
[0329] S906, the magazine lock screen display module sets a drawable image (setImageDrawable), that is, the magazine lock screen display module sets an image for display on the relevant controls.
[0330] It is understandable that the beneficial effects of method 800 and timing interaction graph 900 can be seen in the description corresponding to Example 4.
[0331] Next, the electronic devices involved in the embodiments of this application will be described.
[0332] The method provided in this application embodiment can be executed by an electronic device, which includes at least two displays with different screen ratios. Optionally, at least one of the displays supports screen rotation. By way of example and not limitation, the electronic device can be, but is not limited to, tablet computers, desktop computers, laptop computers, netbooks, augmented reality (AR) / virtual reality (VR) devices, foldable phones, etc., and this application embodiment does not limit this.
[0333] Taking a foldable phone as an example, the electronic device can optionally be a horizontally foldable phone, including a horizontally foldable phone that folds the large screen inward to switch to a small screen, and also includes a horizontally foldable phone that folds the large screen outward to switch to a small screen; alternatively, the electronic device can be a vertically foldable phone, including a vertically foldable phone that folds the large screen inward to switch to a small screen, and also includes a vertically foldable phone that folds the large screen outward to switch to a small screen.
[0334] Take a candybar phone as an example, which has at least two displays with different screen ratios. The candybar phone has a display on both the front and the back.
[0335] Figure 22 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. See also... Figure 22 The electronic device 1000 may include a processor 1010, an external memory interface 1020, an internal memory 1021, a universal serial bus (USB) interface 1030, a charging management module 1040, a power management module 1041, a battery 1042, an antenna T1, an antenna T2, a mobile communication module 1050, a wireless communication module 1060, an audio module 1070, a speaker 1070A, a receiver 1070B, a microphone 1070C, a headphone jack 1070D, a sensor module 1080, buttons 1090, a motor 1091, an indicator 1092, a camera 1093, a display screen 1094, and a subscriber identification module (SIM) card interface 1095, etc. The sensor module 1080 may include a pressure sensor 1080A, a gyroscope sensor 1080B, a barometric pressure sensor 1080C, a magnetic sensor 1080D, an accelerometer sensor 1080E, a distance sensor 1080F, a proximity sensor 1080G, a fingerprint sensor 1080H, a temperature sensor 1080J, a touch sensor 1080K, an ambient light sensor 1080L, a bone conduction sensor 1080M, etc.
[0336] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 1000. In other embodiments of this application, the electronic device 1000 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.
[0337] The processor 1010 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0338] The controller can be the nerve center and command center of the electronic device 1000. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0339] The processor 1010 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 1010 is a cache memory. This memory can store instructions or data that the processor 1010 has just used or that are used repeatedly. If the processor 1010 needs to use the instruction or data again, it can retrieve it directly from this memory. This avoids repeated accesses, reduces the waiting time of the processor 1010, and thus improves the efficiency of the system.
[0340] In some embodiments, the processor 1010 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0341] Electronic device 1000 implements display functions through a GPU, a display screen 1094, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 1094 and the application processor. The GPU performs mathematical and geometric calculations and is used for graphics rendering. Processor 1010 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0342] The external storage interface 1020 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 1000. The external memory card communicates with the processor 1010 through the external storage interface 1020 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0343] Internal memory 1021 can be used to store computer-executable program code, which includes instructions. Processor 1010 executes various functional applications and data processing of electronic device 1000 by running the instructions stored in internal memory 1021. Internal memory 1021 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created by electronic device 1000 during use (such as audio data, phonebook, etc.). Furthermore, internal memory 1021 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0344] The 1080E accelerometer can detect the magnitude of acceleration of electronic device 1000 in various directions (typically three axes). When electronic device 1000 is stationary, it can detect the magnitude and direction of gravity. The 1080E accelerometer can also be used to identify the attitude of electronic device 1000, and can be applied to applications such as screen orientation switching and pedometers.
[0345] The touch sensor 1080K, also known as a "touch panel," can be located on the display screen 1094. The touch sensor 1080K and the display screen 1094 together form a touchscreen, also known as a "touch screen." The touch sensor 1080K detects touch operations applied to or near it. The touch sensor 1080K can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 1094. In other embodiments, the touch sensor 1080K may also be located on the surface of the electronic device 1000, in a different position than the display screen 1094.
[0346] This application provides a chip system including one or more processors for calling and executing instructions stored in memory, thereby performing the methods described in this application. The chip system may be composed of chips or may include chips and other discrete devices.
[0347] The chip system may include input circuits or interfaces for transmitting information or data, and output circuits or interfaces for receiving information or data.
[0348] This application also provides a computer program product that, when executed by a processor, implements the methods described in any of the method embodiments of this application.
[0349] The computer program product can be stored in memory and, after processes such as preprocessing, compilation, assembly, and linking, is finally converted into an executable object file that can be executed by a processor.
[0350] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the methods described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.
[0351] The computer-readable storage medium can be volatile memory or non-volatile memory, or it can include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0352] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and technical effects of the above-described apparatus and equipment can be referred to the corresponding processes and technical effects in the foregoing method embodiments, and will not be repeated here.
[0353] In the several embodiments provided in this application, the systems, apparatuses, and methods disclosed can be implemented in other ways. For example, some features of the method embodiments described above can be ignored or not performed. The apparatus embodiments described above are merely illustrative; the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Multiple units or components can be combined or integrated into another system. Furthermore, the coupling between units or components can be direct coupling or indirect coupling, including electrical, mechanical, or other forms of connection.
[0354] It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0355] It should be understood that "multiple" as used in this application refers to two or more. The term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Furthermore, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0356] The terms (or numbers) "first," "second," etc., appearing in the embodiments of this application are for descriptive purposes only, that is, only to distinguish different objects, such as different "coordinates," etc., and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first," "second," etc., may explicitly or implicitly include one or more features. In the description of the embodiments of this application, "at least one (item)" refers to one or more. "Multiple" means two or more. "At least one (item) below" or similar expressions refer to any combination of these items, including any combination of a single (item) or a plurality of (items).
[0357] In summary, the above description is merely a preferred embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A memory management method applied to an electronic device, the electronic device having a first display screen and a second display screen, the first display screen and the second display screen having different screen ratios, characterized in that, The method includes: In response to the screen lock operation, based on the first original lock screen image, a cache of a first depth-of-field lock screen image adapted to the size of the first display screen is loaded, and a cache of a second depth-of-field lock screen image adapted to the screen size of the second display screen is loaded. The cache of the first depth-of-field lock screen image is assigned to the cache of the current depth-of-field lock screen image of the first display screen. The first lock screen interface is displayed on the first display screen. The first depth-of-field lock screen image includes a first foreground image and a first background image. The second depth-of-field lock screen image includes a second foreground image and a second background image. The first lock screen interface includes: the first background image, a first lock screen element displayed on the first background image, and the first foreground image that partially occludes the first lock screen element. In response to the unlocking operation, a first unlock screen interface is displayed on the first display screen, and the cache of the second depth-of-field lock screen image is released.
2. The method as described in claim 1, characterized in that, The first display screen supports a first screen display state and a second screen display state, and the first depth-of-field lock screen image corresponds to the first screen display state; wherein, the first screen display state includes a landscape display state and the second screen display state includes a portrait display state, or the first screen display state includes a portrait display state and the second screen display state includes a landscape display state. The step of displaying the first lock screen interface on the first display screen includes: displaying the first lock screen interface on the first display screen based on the first screen display state; the method further includes: in response to the operation of triggering the lock screen, loading a cache of a fourth depth lock screen image adapted to the size of the first display screen and the second screen display state according to the original image of the first lock screen; The step of displaying the first unlocked screen interface on the first display screen includes: displaying the first unlocked screen interface on the first display screen in the first screen display state; the method further includes: releasing the cache of the fourth depth-of-field lock screen image in response to the unlocking operation.
3. The method as described in claim 2, characterized in that, When the first non-lock screen interface is displayed on the first display screen in the first screen display state, the method further includes: In response to the operation of rotating the electronic device, on the first display screen, based on the second screen display state, a second unlocked screen interface is displayed, and the cache of the first depth-of-field lock screen image is released, and the cache of the fourth depth-of-field lock screen image is loaded, wherein the first screen display state and the second screen display state are the corresponding display states of the first display screen before and after rotation.
4. The method as described in claim 1 or 2, characterized in that, When the first non-lock screen interface is displayed on the first display screen, the method further includes: In response to the operation of switching the second display screen to the display screen of the currently displayed image, a third non-lock screen interface is displayed on the second display screen, the cache of the first depth-of-field lock screen image is released, and the cache of the second depth-of-field lock screen image is loaded.
5. The method as described in claim 1 or 2, characterized in that, The second display screen supports a third screen display state and a fourth screen display state. The second depth-of-field lock screen image corresponds to the third screen display state, wherein the third screen display state includes a landscape display state and the fourth screen display state includes a portrait display state, or the third screen display state includes a portrait display state and the fourth screen display state includes a landscape display state; the method further includes: In response to the screen lock trigger operation, a cache of a fifth depth-of-field screen image adapted to the size of the second display screen and the display state of the fourth screen is loaded according to the first original screen lock image; In response to the unlocking operation, the cache of the fifth depth-of-field lock screen image is released.
6. The method as described in claim 1, characterized in that, The electronic device has N displays, each with a different screen ratio. The N displays include the first display and the second display. M of the N displays support two screen display states, namely landscape and portrait. Each of the M displays corresponds to two depth-of-field lock screen images, where 0 ≤ M ≤ N, N ≥ 2, and both M and N are integers. When the first lock screen interface is displayed on the first display screen, the bitmaps of the N+M depth lock screen images corresponding to the N display screens all occupy the running memory of the electronic device, and each of the N+M depth lock screen images includes a foreground image and a background image. When the first non-locked screen interface is displayed on the first display screen, only the first depth-of-field lock screen image occupies the running memory of the electronic device among the N+M depth-of-field lock screen images. When the first display screen belongs to the M display screens, the first display screen currently displays the first non-locked screen interface based on the first screen display state, and the first depth-of-field lock screen image corresponds to the first screen display state.
7. The method as described in claim 1 or 6, characterized in that, The electronic device has a foldable screen. The first display screen is a large foldable screen, and the second display screen is a small screen. The large screen supports two screen display states, including a landscape display state and a portrait display state. The landscape display state corresponds to the first depth-of-field lock screen image, and the portrait display state corresponds to the fourth depth-of-field lock screen image. If the electronic device is detected to switch from an unfolded state to a folded state, the display is switched from the landscape or portrait display state of the large screen to the display state of the small screen, the cache of the first depth lock screen image or the fourth depth lock screen image is released, and the cache of the second depth lock screen image is loaded. Alternatively, if the electronic device is detected to switch from a folded state to an unfolded state, the display is switched from the small screen to the landscape or portrait display state of the large screen, the cache of the second depth-of-field lock screen image is released, and the cache of the first depth-of-field lock screen image or the fourth depth-of-field lock screen image is loaded. When the display is based on the landscape display state of the large screen, if the operation of rotating the electronic device is detected, the display is switched to the portrait display state based on the large screen, the cache of the first depth lock screen image is released, and the cache of the fourth depth lock screen image is loaded. Alternatively, if the display is based on the portrait mode of the large screen, and the operation of rotating the electronic device is detected, the display is switched to the landscape mode of the large screen, the cache of the fourth depth-of-field lock screen image is released, and the cache of the first depth-of-field lock screen image is loaded.
8. The method as described in claim 1, characterized in that, The method further includes: In response to the operation of replacing the first original lock screen image with the second original lock screen image, the cache of the depth lock screen image loaded according to the first original lock screen image is released, and the cache of the third depth lock screen image adapted to the size of the first display screen is loaded according to the second original lock screen image. The cache of the third depth lock screen image is assigned to the cache of the current depth lock screen image of the first display screen, wherein the third depth lock screen image includes a third foreground image and a third background image. The first display screen supports a first screen display state and a second screen display state, and the third depth-of-field lock screen image corresponds to the first screen display state.
9. The method as described in claim 8, characterized in that, After loading the third depth-of-field lock screen image, the method further includes: The system detects that a user has entered the lock screen image editing page from the first lock screen interface and replaces the first original lock screen image with the second original lock screen image; or... The system detects that a user has entered the lock screen image editing page from the first non-lock screen interface, and replaces the first original lock screen image with the second original lock screen image.
10. The method as described in claim 9, characterized in that, The step of detecting that a user enters the lock screen image editing page from the first lock screen interface and replacing the first original lock screen image with the second original lock screen image includes: In response to a user's pinch-to-open gesture on the first lock screen interface, the lock screen image editing page is displayed on the first display screen, and the lock screen image editing page includes multiple lock screen images; In response to the setting operation, the third depth-of-field lock screen image among the plurality of lock screen images is set as the replaced depth-of-field lock screen image.
11. The method as described in claim 9, characterized in that, The step of detecting that a user enters the lock screen image editing page from the first non-lock screen interface and replacing the first original lock screen image with the second original lock screen image includes: In response to the user's action of setting a depth-of-field image theme, the second original lock screen image in the user-selected depth-of-field image theme is set as the changed original lock screen image; or... In response to a user's action of setting a depth-of-field lock screen image in the gallery of the electronic device, the second original lock screen image selected by the user in the gallery is set as the replaced original lock screen image.
12. An electronic device, characterized in that, The electronic device includes: one or more processors, and 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, 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 11.
13. 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 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes 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 11.