An application keep-alive method for an electronic device which can automatically close applications running in the background, wherein the method comprises: automatically performing, by the electronic device, a first locking operation on a first application running in the background, to add an application lock of a first type to the first application, wherein the application lock of the first type is an application lock actively added by the electronic device, the first application is an application that the electronic device predicts that a user needs to continue to use, and the first locking operation is used to enable the first application to be in a keep-alive state; in response to a first operation of the user, displaying, by the electronic device, a multi-task interface, wherein the multi-task interface comprises preview interfaces (902, 903, 904) of a plurality of recently used applications, the plurality of recently used applications comprise the first application and a second application, the preview interfaces (902, 903, 904) of the plurality of applications comprise a first preview interface and a second preview interface, the first preview interface is a preview interface of the first application, and the second preview interface is a preview interface of the second application; displaying a first identifier on the first preview interface of the multi-task interface, wherein the first identifier is used to indicate that the application lock of the first type is added to the first application; and in response to a second operation performed by the user on the second preview interface, performing, by the electronic device, a second locking operation on the second application to add an application lock of a second type to the second application, and displaying a second identifier on the second preview interface, wherein the second identifier is used to indicate that the application lock of the second type is added to the second application, the second locking operation is used to enable the second application to be in a keep-alive state, and the application lock of the second type is an application lock added by the electronic device in response to a user operation. automatically performing, by the electronic device, a first locking operation on a first application running in the background, to add an application lock of a first type to the first application, wherein the application lock of the first type is an application lock actively added by the electronic device, the first application is an application that the electronic device predicts that a user needs to continue to use, and the first locking operation is used to enable the first application to be in a keep-alive state; in response to a first operation of the user, displaying, by the electronic device, a multi-task interface, wherein the multi-task interface comprises preview interfaces (902, 903, 904) of a plurality of recently used applications, the plurality of recently used applications comprise the first application and a second application, the preview interfaces (902, 903, 904) of the plurality of applications comprise a first preview interface and a second preview interface, the first preview interface is a preview interface of the first application, and the second preview interface is a preview interface of the second application; displaying a first identifier on the first preview interface of the multi-task interface, wherein the first identifier is used to indicate that the application lock of the first type is added to the first application; and in response to a second operation performed by the user on the second preview interface, performing, by the electronic device, a second locking operation on the second application to add an application lock of a second type to the second application, and displaying a second identifier on the second preview interface, wherein the second identifier is used to indicate that the application lock of the second type is added to the second application, the second locking operation is used to enable the second application to be in a keep-alive state, and the application lock of the second type is an application lock added by the electronic device in response to a user operation.