Device closing method and device, storage medium and computer device
By verifying the lock screen password before the device is turned off, the problem of unauthorized users bypassing system security restrictions is solved, and the device can be securely turned off with user authorization, thus improving the device's resistance to attacks and data security protection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANYSMART TECH CO LTD
- Filing Date
- 2026-02-11
- Publication Date
- 2026-06-12
AI Technical Summary
In the existing technology, the shutdown or restart operation of computer equipment can be easily bypassed by attackers or unauthorized users to bypass system security restrictions, resulting in data leakage and damage to system integrity, especially when the equipment is lost, it is impossible to effectively perform remote tracking and data erasure.
Upon receiving a device shutdown command, a password verification interface is displayed. The device shutdown task is only executed after the lock screen password is verified, ensuring that only authorized users can shut down the device.
It effectively prevents unauthorized users from bypassing system protection by forcibly shutting down or restarting the device, ensures that remote positioning and data erasure functions can be executed normally when the device is lost, improves the device's resistance to attacks and data security protection level, and simplifies the system architecture while achieving a balance between security strength and user experience.
Smart Images

Figure CN122196987A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a device shutdown method, apparatus, storage medium, and computer device. Background Technology
[0002] Currently, for various computer devices such as smartphones, tablets, laptops, desktop computers, and smart wearable devices, users can typically shut down or restart them directly by pressing and holding the power button, clicking the system shutdown option, or combining physical buttons, without any form of authentication. This allows attackers or unauthorized users to disrupt device security by shutting down or restarting, or even bypass system security restrictions through physical button combinations. Furthermore, in scenarios where the device is lost, unauthenticated shutdown may prevent security functions such as remote tracking and data erasure from taking effect. Therefore, shutdown or restart operations in these technologies can easily lead to data leaks and compromise system integrity and security. Summary of the Invention
[0003] This application provides a device shutdown method, apparatus, storage medium, and computer device, which can ensure that the computer device is shut down with user authorization, improve the device's resistance to attacks and data security protection level, and effectively protect system performance.
[0004] On one hand, embodiments of this application provide a device shutdown method, the method comprising:
[0005] In response to a device shutdown command for a computer device, a password verification interface is displayed; In response to an input operation on the password verification interface, password verification is performed based on the input content corresponding to the input operation and the lock screen password of the computer device; If the password verification is successful, a device shutdown task is executed to shut down the computer device.
[0006] Optionally, displaying the password verification interface in response to a device shutdown command for the computer device includes: in response to the device shutdown command, detecting whether the computer device has enabled the lock screen password; if the computer device has enabled the lock screen password, then displaying the password verification interface.
[0007] Optionally, detecting whether the computer device has enabled the lock screen password includes: closing the thread by running the system and calling the lock screen manager to detect whether the computer device has enabled the lock screen password.
[0008] Optionally, the step of displaying the password verification interface if the computer device enables the lock screen password includes: calling the lock screen manager by running the system shutdown thread; if the lock screen manager instructs the computer device to enable the lock screen password, calling a thread communication tool to send a password verification request to the system main thread; and calling a visual interaction component by running the system main thread to display a transparent interface, and displaying the password verification interface to cover the transparent interface.
[0009] Optionally, the step of responding to an input operation on the password verification interface and performing password verification based on the input content corresponding to the input operation and the lock screen password of the computer device includes: responding to the input operation and determining whether the input content matches the lock screen password; if the input content matches the lock screen password, then confirming that the password verification is successful; if the input content does not match the lock screen password, then confirming that the password verification fails.
[0010] Optionally, determining whether the input content matches the lock screen password includes: running the system main thread, calling the lock screen manager to obtain the input content and sending the input content to the security service component; and running the system main thread, calling the security service component to determine whether the input content matches the lock screen password.
[0011] Optionally, confirming successful password verification if the input content matches the lock screen password includes: running the system main thread, calling the security service component, and indicating successful password verification to the lock screen manager if the input content matches the lock screen password.
[0012] Optionally, confirming password verification failure if the input content does not match the lock screen password includes: running the system main thread, calling the security service component, and indicating password verification failure to the lock screen manager if the input content does not match the lock screen password.
[0013] Optionally, the step of executing the device shutdown task to shut down the computer device includes: calling a thread synchronization component to wake up the system shutdown thread by running the system main thread; calling a thread communication tool to send the device shutdown task to the system main thread by running the system shutdown thread; and executing the device shutdown task by running the system main thread to shut down the computer device.
[0014] Optionally, after displaying the password verification interface, the method further includes: in response to the computer device meeting the cancellation conditions, executing a prompting task to prompt the device to close the task cancellation; wherein the cancellation conditions include at least one of the following: the screen display state of the computer device changes, or a verification cancellation instruction is received.
[0015] Optionally, the device shutdown command includes a device shutdown command, and the device shutdown operation includes a device shutdown operation; or, the device shutdown command includes a device restart command, and the device shutdown operation includes a device restart operation.
[0016] On the other hand, embodiments of this application provide a device shutdown apparatus, the apparatus comprising: an interface display module, configured to display a password verification interface in response to a device shutdown command for a computer device; a password verification module, configured to perform password verification in response to an input operation on the password verification interface, based on the input content corresponding to the input operation and the lock screen password of the computer device; and a task execution module, configured to execute a device shutdown task to shut down the computer device if the password verification is successful.
[0017] On the other hand, embodiments of this application provide a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps in the device shutdown method described above.
[0018] On the other hand, embodiments of this application provide a computer device including a memory and a processor, wherein the memory stores a computer program or instructions, and when the computer program or instructions are executed by the processor, they implement the steps in the device shutdown method described above.
[0019] On the other hand, embodiments of this application provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the steps in the device shutdown method described above.
[0020] In summary, the technical solution provided in this application displays a password verification interface in response to a device shutdown command for a computer device; then, in response to an input operation on the password verification interface, it performs password verification based on the input content corresponding to the input operation and the computer device's lock screen password; if the password verification is successful, it executes a device shutdown task to shut down the computer device. This application, by performing password verification first when the user shuts down the computer device (e.g., during shutdown or restart), and then executing the device shutdown task only if the password verification is successful, ensures that the computer device shuts down with user authorization. This effectively blocks the risk of unauthorized users bypassing the system's real-time protection mechanism through forced shutdown or restart operations. It also ensures that anti-theft commands such as remote location tracking and data erasure can still be issued and executed normally in scenarios where the device is lost, improving the device's resistance to attacks and data security protection level, and effectively guaranteeing system performance. Furthermore, this application embodiment uses the lock screen password to perform password verification, eliminating the need for users to additionally remember passwords or configure an independent verification system. While reducing the complexity of use, it can rely on the deep integration of the system's native lock screen function and hardware-level secure storage to achieve uniformity with the overall security policy of the device. This simplifies the system architecture, ensures the reliability of password verification and the ability to prevent attacks, and achieves a balance between security strength and user experience. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of a device shutdown method provided in an embodiment of this application; Figure 2 This is a flowchart of another device shutdown method provided in an embodiment of this application; Figure 3 This is a schematic diagram of a function selection interface provided in an embodiment of this application; Figure 4 This is a schematic diagram of a password verification interface provided in an embodiment of this application; Figure 5 This is a schematic diagram of a device shutdown interface provided in an embodiment of this application; Figure 6 This is a schematic diagram of another password verification interface provided in an embodiment of this application; Figure 7 This is a schematic diagram of a main user interface provided in an embodiment of this application; Figure 8This is a schematic diagram of a device shut-off device provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0024] In the following description, specific embodiments of this application will be illustrated with reference to steps and symbols performed by one or more computers, unless otherwise stated. Therefore, these steps and operations will be referred to several times as being performed by a computer. Computer performance as referred to in this application includes operations performed by a computer processing unit on electronic signals represented by data in a structured format. This operation transforms the data or maintains it at a location in the computer's memory system, which can be reconfigured or otherwise alter the operation of the computer in a manner well known to those skilled in the art. The data structure maintained by the data is the physical location of the memory, which has specific characteristics defined by the data format. However, the principles of this application are illustrated with specific embodiments and are not intended to be limiting. Those skilled in the art will understand that many of the steps and operations described below can also be implemented in hardware.
[0025] The terms "module" or "unit" as used in this application can be considered as software objects executing on the computing system. The different components, modules, engines, and services described in this application can be considered as implementation objects on the computing system. While the apparatus and methods described in this application are preferably implemented in software, they can also be implemented in hardware, both of which are within the scope of protection of this invention.
[0026] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used in the embodiments of this application may also include the plural forms. It should be further understood that the term “comprising” as used in the specification of this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or combinations thereof. It should be understood that when an element is “connected” or “coupled” to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein may include wireless connection or wireless coupling. The term “and / or” as used herein includes all or any unit and all combinations of one or more associated listed items.
[0027] Please see Figure 1 , Figure 1 This is a flowchart illustrating a device shutdown method provided in an embodiment of this application. This device shutdown method can be applied to and executed by a computer device. Figure 1 As shown, the device shutdown method may include the following steps S100 to S300.
[0028] Step S100: In response to a device shutdown command for a computer device, a password verification interface is displayed; Step S200: In response to an input operation on the password verification interface, perform password verification based on the input content corresponding to the input operation and the lock screen password of the computer device; Step S300: If the password verification is successful, perform the device shutdown task to shut down the computer device.
[0029] It should be understood that the device shutdown described in the embodiments of this application includes, but is not limited to, device shutdown and device restart. That is, in some embodiments, the device shutdown command includes a device shutdown command and the device shutdown operation includes a device shutdown operation, or the device shutdown command includes a device restart command and the device shutdown operation includes a device restart operation. Here, device shutdown refers to completely shutting down the computer device and cutting off all power supply; device restart refers to first shutting down the computer device and then restarting it, so that the computer device's system returns to its initial operating state.
[0030] Typically, users can trigger device shutdown by pressing and holding the power button, clicking the system shutdown option, or using physical buttons. The computer device responds to this shutdown operation by receiving a shutdown command. This shutdown command can include the type of shutdown, such as device shutdown or device restart. This application does not limit the specific content of the shutdown operation or command; in practical applications, it can be flexibly set according to requirements.
[0031] In step S100, the computer device, in response to a device shutdown command, may display a password verification interface. This password verification interface is used to verify the computer device's lock screen password. This application embodiment does not limit the specific display method or content of the password verification interface; in practical applications, it can be flexibly set according to requirements. For example, the password verification interface can be displayed in full-screen mode on the computer device, or it can be displayed as a floating window or overlay on the computer device's original display interface; the password verification interface can be the computer device's lock screen verification interface, or it can be a separate interface specifically for performing password verification when the device is shut down; the password verification interface may include a lock screen password input module, password verification prompts, etc.
[0032] To facilitate user operation and reduce the learning curve, the lock screen password used for password verification when the device is off can be a universal verification password used when locking the computer screen. Of course, in practical applications, the lock screen password can also be a verification password specifically used for password verification when the device is off; this embodiment does not limit this. Furthermore, the lock screen password can be a system-preset, default, or randomly generated password in the computer device, or it can be set or modified by the user.
[0033] To avoid the verification process interfering with the user experience, password verification can be performed if a lock screen password is enabled on the computer device. In some embodiments, step S100 may include: in response to a device shutdown command, detecting whether a lock screen password is enabled on the computer device; if a lock screen password is enabled on the computer device, displaying a password verification interface. In practical applications, if a lock screen password is not enabled on the computer device, password verification is not required; instead, the device shutdown task is performed directly to shut down the computer device.
[0034] In some embodiments, detecting whether a computer device has a lock screen password enabled may include: calling a lock screen manager by running a system shutdown thread to detect whether the computer device has a lock screen password enabled. The system shutdown thread may be, for example, a ShutdownThread, which is a child thread or background thread of the computer device. The computer device runs a system shutdown thread, which can call the lock screen manager in response to a device shutdown command. The lock screen manager may be, for example, a KeyguardManager, a system security component, which can detect whether the computer device has a lock screen password enabled.
[0035] The lock screen manager can instruct the system shutdown thread whether a lock screen password is enabled on the computer device, such as by sending an instruction message to the system shutdown thread to indicate the status of the lock screen password. Specifically, the lock screen manager can instruct the system shutdown thread to enable the lock screen password only if it is enabled; or, regardless of whether the lock screen password is enabled, the lock screen manager can send the corresponding instruction message to the system shutdown thread to indicate whether the lock screen password is enabled. If the lock screen manager instructs the computer device not to enable the lock screen password, or if the system shutdown thread does not receive an instruction message to enable the lock screen password, the system shutdown thread can directly initiate a device shutdown task to shut down the computer device. The execution of the device shutdown task can be found in the following embodiments, which will not be elaborated upon here.
[0036] In some embodiments, the above-mentioned display of a password verification interface if the computer device enables a lock screen password may include: closing the thread by running the system, calling the lock screen manager, and if the lock screen manager instructs the computer device to enable a lock screen password, calling a thread communication tool to send a password verification request to the system main thread; and calling a visual interaction component by running the system main thread to display a transparent interface and displaying the password verification interface to cover the transparent interface.
[0037] Since the system shutdown thread is a sub-thread of the computer device and cannot directly manipulate the interface, the main system thread can control the display of the password verification interface. The system shutdown thread and the main system thread can interact through a thread communication tool, such as one based on the Handler mechanism. The computer device runs a main system thread. In response to a password verification request from the system shutdown thread, the main system thread can call a visual interactive component to display the password verification interface. This visual interactive component can be, for example, a transparent Activity. Since the password verification interface can only be accessed within an Activity context, a visual interactive component is required. This visual interactive component can create and display a transparent interface, such as using the Theme.Translucent.NoTitleBar.Fullscreen theme to achieve a borderless, full-screen transparent interface to avoid visual disjointedness. Then, the visual interactive component can display the password verification interface, covering the transparent interface. During the display of the password verification interface, animation transitions for the full-screen verification interface can be disabled, such as disabling overridePendingTransition(0, 0), to ensure a smooth verification process.
[0038] In step S200, in response to an input operation on the password verification interface, the computer device can perform password verification based on the input content corresponding to the input operation and the lock screen password enabled by the computer device. After the computer device displays the password verification interface, the user can enter a password, thereby allowing the computer device to obtain the user's input content and determine whether the input content matches the lock screen password, thus performing password verification. Based on this, in some embodiments, the above step S200 may include: in response to an input operation, determining whether the input content matches the lock screen password; if the input content matches the lock screen password, confirming successful password verification; if the input content does not match the lock screen password, confirming password verification failure.
[0039] This application does not limit the specific form of the lock screen password; in practical applications, it can be flexibly set according to needs. For example, the lock screen password can be any combination of one or more of the following: text, pattern, numbers, gestures, voice, fingerprint, and face. The displayed content of the password verification interface and the user's input may also differ for different types of lock screen passwords; in practical applications, it can be flexibly set according to needs and the specific type of lock screen password. For example, if the lock screen password is a face, a face recognition box can be displayed on the password verification interface, and the user's input can be a face image captured by the computer device; if the lock screen password is numbers, multiple numbers and number input boxes can be displayed on the password verification interface, and the user's input can be a combination of number touches captured by the computer device; if the lock screen password is a fingerprint, a fingerprint collection area can be displayed on the password verification interface, and the user's input can be fingerprint information captured by the computer device. The method for determining whether the input matches the lock screen password may also differ for different types of lock screen passwords; in practical applications, it can be flexibly set according to needs and the specific type of lock screen password. For example, if the lock screen password is text, numbers, and / or gestures, then if the input content matches the lock screen password, it is considered a match; otherwise, it is considered a mismatch. If the lock screen password is fingerprint, face, and / or voice, then if the input content is similar to the lock screen password (e.g., similarity greater than a threshold), it is considered a match; otherwise, it is considered a mismatch. If the input content matches the lock screen password, password verification is successful; if the input content does not match, password verification fails.
[0040] Since the lock screen password is used for password verification, affecting the integrity and security of the system, as well as user data privacy, a security service component can perform the password verification and feed back the verification result to the lock screen manager. Based on this, in some embodiments, the above-mentioned determination of whether the input content matches the lock screen password can include: running the system main thread to call the lock screen manager to obtain the input content and send it to the security service component; running the system main thread to call the security service component to determine whether the input content matches the lock screen password. In some embodiments, the above-mentioned confirmation of successful password verification if the input content matches the lock screen password can include: running the system main thread to call the security service component, and indicating successful password verification to the lock screen manager if the input content matches the lock screen password; the above-mentioned confirmation of failed password verification if the input content does not match the lock screen password can include: running the system main thread to call the security service component, and indicating failed password verification to the lock screen manager if the input content does not match the lock screen password.
[0041] The visual interaction component receives user input and sends it to the lock screen manager. The lock screen manager encrypts and packages the input before sending it to the security service component. This security service component can be, for example, a Gatekeeper service. It can run in a Trusted Execution Environment (TEE) so that the password verification process is performed in a hardware-isolated area, preventing the leakage of the lock screen password. The security service component determines whether the input matches the lock screen password. If they match, it indicates successful password verification to the lock screen manager; otherwise, it indicates password verification failure.
[0042] In step S300, if password verification is successful, a device shutdown task can be executed to shut down the computer device. This device shutdown task can be initiated by the system shutdown thread. However, since UI (User Interface) operations in the computer device's operating system, such as Android, must be performed on the system main thread, to avoid thread conflicts, the system shutdown thread can request the system main thread to execute the device shutdown task. Therefore, in some embodiments, step S300 may include: running the system main thread and invoking a thread synchronization component to wake up the system shutdown thread; running the system shutdown thread and invoking a thread communication tool to send the device shutdown task to the system main thread; and running the system main thread and executing the device shutdown task to shut down the computer device.
[0043] To ensure that the computer device only performs the device shutdown task upon successful password verification, and to prevent the device from shutting down during password verification, the system shutdown thread can invoke a thread synchronization component to self-block until awakened by another thread. In some embodiments, the above device shutdown method may further include: calling the thread synchronization component by running the system shutdown thread to put the system shutdown thread into a sleep state. The system shutdown thread can call the thread synchronization component to enter a sleep state after the visual interaction component starts. This thread synchronization component can be, for example, a CountDownLatch, implemented as a thread synchronization lock, enabling synchronized waiting between the system shutdown thread and the system main thread.
[0044] The aforementioned lock screen manager can invoke a visual interaction component to set a flag based on whether the password verification was successful or failed. This flag indicates whether the password verification was successful or failed, preventing the loss of password verification results due to the lifecycle of the visual interaction component. Then, the system main thread can invoke a thread synchronization component through the visual interaction component to wake the system shutdown thread from its dormant state. The system shutdown thread then runs, resolving the password verification success or failure from the flag set by the visual interaction component. If the password verification is successful, the system shutdown thread can execute the device shutdown task; if the password verification fails, the system shutdown thread can abort the device shutdown task. However, since the system shutdown thread is a sub-thread of the computer device and cannot directly operate the interface, it can invoke a thread communication tool to send the device shutdown task to the system main thread, which will then execute the device shutdown task to shut down the computer device.
[0045] In some embodiments, after step S100, the method may further include: in response to the computer device meeting the cancellation condition, executing a prompting task to prompt the device shutdown task to be cancelled. By setting cancellation conditions, abnormal situations in the password verification process can be detected in a timely manner, such as the user exiting password verification, thereby improving the robustness of abnormal scenarios and cancelling the device shutdown task promptly.
[0046] This application does not limit the specific content of the cancellation conditions, and in practical applications, they can be flexibly set according to requirements. For example, the cancellation conditions may include, but are not limited to, at least one of the following: a change in the screen display state of the computer device, or receiving a verification cancellation command. A change in the screen display state of the computer device may refer to the screen switching from a lit state to a dark state. Furthermore, the user can trigger the computer device to receive the verification cancellation command by touching a specific button (such as the HOME button on a smartphone) or by using voice commands.
[0047] In response to the computer device meeting the cancellation conditions, the device shutdown task can be cancelled, and a prompt task can be executed to notify the user that the device shutdown task has been cancelled. This application embodiment does not limit the specific type of the prompt task; in practical applications, it can be flexibly set according to requirements. For example, the prompt task may include at least one of the following types: text prompt, voice prompt, graphic prompt, animated prompt, etc.
[0048] Since the password verification interface is displayed by the system's main thread, the main thread can call the visual interaction component to set a flag in response to the computer device meeting the cancellation condition. This flag can indicate whether the password verification was successful or failed, or whether the password verification was cancelled. Afterward, the main thread can call the thread synchronization component through the visual interaction component to wake up the system shutdown thread from its dormant state. Once the system shutdown thread is running, it can parse the password verification cancellation from the flag set by the visual interaction component to cancel the device shutdown task, and can call the thread communication tool to request the main thread to execute the prompt task.
[0049] In summary, the technical solution provided in this application displays a password verification interface in response to a device shutdown command for a computer device; then, in response to an input operation on the password verification interface, it performs password verification based on the input content corresponding to the input operation and the computer device's lock screen password; if the password verification is successful, it executes a device shutdown task to shut down the computer device. This application, by performing password verification first when the user shuts down the computer device (e.g., during shutdown or restart), and then executing the device shutdown task only if the password verification is successful, ensures that the computer device shuts down with user authorization. This effectively blocks the risk of unauthorized users bypassing the system's real-time protection mechanism through forced shutdown or restart operations. It also ensures that anti-theft commands such as remote location tracking and data erasure can still be issued and executed normally in scenarios where the device is lost, improving the device's resistance to attacks and data security protection level, and effectively guaranteeing system performance. Furthermore, this application embodiment uses the lock screen password to perform password verification, eliminating the need for users to additionally remember passwords or configure an independent verification system. While reducing the complexity of use, it can rely on the deep integration of the system's native lock screen function and hardware-level secure storage to achieve uniformity with the overall security policy of the device. This simplifies the system architecture, ensures the reliability of password verification and the ability to prevent attacks, and achieves a balance between security strength and user experience.
[0050] The technical solution provided in the embodiments of this application will be described below with an example.
[0051] Please see Figure 2 , Figure 2This is a flowchart of another device shutdown method provided in an embodiment of this application. This device shutdown method can be applied to a computer device and executed by the computer device. Figure 2 As shown, the device shutdown method may include the following steps S201 to S207.
[0052] Step S201: In response to the device shutdown request, display the function selection interface.
[0053] Users can trigger device shutdown by pressing and holding the power button, clicking the system shutdown option, or combining physical buttons. In response to the user's shutdown operation, the computer device receives the shutdown request and displays a function selection interface. This interface allows users to select the type of shutdown, such as device shutdown or device restart. Figure 3 As shown, the function selection interface 301 can include various types of device shutdown options and their prompts, such as icons and text. The function selection interface can be displayed on top of the original user interface in the form of a floating window.
[0054] Step S202: In response to the device shutdown command, detect whether the computer device has a lock screen password enabled.
[0055] Users can select the specific type of device shutdown through the function selection interface. When the user selects the corresponding device shutdown option, the computer device can receive the corresponding device shutdown command and, in response to the command, check whether the computer device has a lock screen password enabled. The lock screen password verification logic is deeply bound to the system lock screen password module (such as the KeyguardManager) to ensure the consistency of the verification standard. If a lock screen password is enabled, proceed to step S203 below; otherwise, proceed to step S205 below.
[0056] Step S203: Display the password verification interface.
[0057] If the computer device has a lock screen password enabled, a password verification interface will be displayed. For example... Figure 4 As shown, the password verification interface 401 may include, but is not limited to, a password input module 402 and password verification prompts 403. The computer device can first implement a borderless, full-screen transparent interface using the Theme.Translucent.NoTitleBar.Fullscreen theme to avoid visual disjointedness; then, a full-screen password verification interface, such as a full-screen Activity without a title bar, can be overlaid on this transparent interface. Furthermore, during the display of the password verification interface, transition animation effects for the full-screen verification interface can be disabled to ensure a smooth verification process.
[0058] Step S204: In response to the input operation, determine whether the input content matches the lock screen password.
[0059] After the computer device displays the password verification interface, the user can enter a password. Responding to the user's input on the password verification interface, the computer device can obtain the user's input and determine whether the input matches the computer device's lock screen password, thereby performing password verification. If the input matches the lock screen password, proceed to step S205; otherwise, proceed to step S206.
[0060] Step S205: Perform the device shutdown task.
[0061] If the entered information matches the lock screen password, the password verification is successful. The computer device can then shut down by executing a device shutdown task through the system shutdown thread. Figure 5 As shown, during the device shutdown process, the computer device can display a shutdown interface 501 to indicate that the device is in the shutdown process until shutdown is complete. The system shutdown thread can use thread communication tools (such as Handler(Looper.getMainLooper())) to request the system main thread to execute the device shutdown task, ensuring that the shutdown logic is executed on the system main thread to avoid thread conflicts. Furthermore, the system shutdown thread and the system main thread can use thread synchronization components (such as CountDownLatch) to achieve synchronized waiting, preventing the loss of verification results due to Activity lifecycle issues.
[0062] Step S206: Display the verification failure indication message on the password verification interface.
[0063] If the entered information does not match the lock screen password, the password verification fails, and the computer device does not perform the device shutdown task. In this case, the computer device may display a verification failure indicator on the password verification interface to indicate that the user's input does not match the lock screen password. Figure 6 As shown, the computer device can display a verification failure indication message 404 on the password verification interface 401. In practical applications, the specific content of the verification failure indication message 404 may vary depending on the number of password verification failures. For example, when the number of verification failures is small, the message can directly indicate that the password verification has failed; while when the number of verification failures is large, the message can indicate that the password verification has failed and the user needs to wait a certain period of time before re-entering the password.
[0064] Step S207: In response to the computer device meeting the cancellation conditions, execute the prompt task.
[0065] During the password verification process, the user may cancel the verification. For example, the user may exit the verification process midway by clicking the HOME button, or the computer screen may automatically cancel the verification by switching from a lit state to a dark state due to prolonged inactivity. When the computer meets the cancellation conditions, such as switching from a lit state to a dark state or receiving a verification cancellation command, it can execute a prompt task to inform the user that the task has been cancelled. Figure 7 As shown, if the user exits the password verification process midway by clicking the HOME button, the computer device will cancel the display of the password verification interface and the password verification process. Furthermore, the main user interface 701 of the computer device can be displayed, and a prompting task can be performed to display a cancellation prompt message 702 for closing the device in the main user interface 701.
[0066] In summary, this application embodiment deeply binds system-level shutdown or restart operations with device lock screen password verification logic. When a user triggers shutdown or restart, the system security verification module is dynamically invoked, ensuring that only authorized users can perform shutdown or restart operations, thereby improving device security. Specifically: First, this application embodiment achieves seamless integration of shutdown or restart operations with system security policies, ensuring that only users who have passed password verification can perform the operation; second, this application embodiment uses a full-screen verification interface design (such as a full-screen Activity without a title bar) to avoid interference with the user experience during the verification process; third, this application embodiment supports thread synchronization components (such as CountDownLatch) and the system main thread callback mechanism to ensure reliable connection between the verification process and the underlying system shutdown logic.
[0067] To facilitate better implementation of the device shutdown method provided in this application, this application also provides a device shutdown apparatus based on the above-described device shutdown method. The meanings of the terms used are the same as in the device shutdown method described above, and specific implementation details can be found in the descriptions within the method embodiments.
[0068] Please see Figure 8 , Figure 8 This is a schematic diagram of a device shut-off device provided in an embodiment of this application. Figure 8 As shown, the device shutdown device 800 may include: an interface display module 810, a password verification module 820, and a task execution module 830.
[0069] The interface display module 810 is used to: display a password verification interface in response to a device shutdown command for a computer device; The password verification module 820 is used to: respond to an input operation on the password verification interface, and perform password verification based on the input content corresponding to the input operation and the lock screen password of the computer device; The task execution module 830 is used to: if the password verification is successful, execute the device shutdown task to shut down the computer device.
[0070] In some embodiments, the interface display module 810 is further configured to: detect whether the computer device has a lock screen password enabled in response to a device shutdown command; if the computer device has a lock screen password enabled, display a password verification interface.
[0071] In some embodiments, the interface display module 810 is further configured to: shut down the thread by running the system and call the lock screen manager to detect whether the computer device has a lock screen password enabled.
[0072] In some embodiments, the interface display module 810 is further configured to: close the thread by running the system, call the lock screen manager, and if the lock screen manager instructs the computer device to enable the lock screen password, call the thread communication tool to send a password verification request to the system main thread; and call the visual interaction component by running the system main thread to display the transparent interface and display the password verification interface to cover the transparent interface.
[0073] In some embodiments, the password verification module 820 is further configured to: in response to an input operation, determine whether the input content matches the lock screen password; if the input content matches the lock screen password, confirm that the password verification is successful; if the input content does not match the lock screen password, confirm that the password verification fails.
[0074] In some embodiments, the password verification module 820 is further configured to: call the lock screen manager by running the system main thread to obtain input content and send the input content to the security service component; call the security service component by running the system main thread to determine whether the input content matches the lock screen password; call the security service component by running the system main thread, and if the input content matches the lock screen password, indicate to the lock screen manager that the password verification was successful; call the security service component by running the system main thread, and if the input content does not match the lock screen password, indicate to the lock screen manager that the password verification failed.
[0075] In some embodiments, the task execution module 830 is further configured to: call a thread synchronization component by running the system main thread to wake up the system shutdown thread; call a thread communication tool to send a device shutdown task to the system main thread by running the system shutdown thread; and execute the device shutdown task by running the system main thread to shut down the computer device.
[0076] In some embodiments, the task execution module 830 is further configured to: in response to the computer device meeting the cancellation conditions, execute a prompting task to prompt the device to close the task cancellation; wherein the cancellation conditions include at least one of the following: the screen display state of the computer device changes, or a verification cancellation instruction is received.
[0077] In some embodiments, the device shutdown instruction includes a device power-off instruction, and the device shutdown operation includes a device power-off operation; or, the device shutdown instruction includes a device restart instruction, and the device shutdown operation includes a device restart operation.
[0078] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 9 The computer device 900 can be used to implement the steps described in the above method embodiments. The computer device 900 can be a terminal device such as a mobile phone, tablet computer, desktop computer, laptop computer, smart wearable device, or a server.
[0079] Computer device 900 may include one or more processors 910. The processor 910 can support the computer device 900 in implementing the steps described in the preceding method embodiments. The processor 910 may be a general-purpose processor or a special-purpose processor. For example, the processor 910 may be implemented as a Central Processing Unit (CPU); or, the processor 910 may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor 910 may be any conventional processor, etc.
[0080] The computer device 900 may further include one or more memories 920. The memories 920 store computer programs or instructions. The memories 920 may be independent of the processor 910 or integrated into the processor 910. The computer programs or instructions in the memories 920 can be executed by the processor 910, causing the processor 910 to perform the device shutdown method described in the above embodiments.
[0081] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0082] Therefore, this application also provides a computer-readable storage medium storing a computer program or instructions thereon, which is loaded by a processor to execute the device shutdown method described in the above embodiments.
[0083] For details on the implementation of each of the above operations / steps, please refer to the previous examples, which will not be repeated here.
[0084] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0085] Since the computer program or instructions stored in the computer-readable storage medium can execute the steps in any of the above method embodiments provided in the embodiments of this application, the beneficial effects that the methods described in any of the above method embodiments can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0086] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.
[0087] The foregoing has provided a detailed description of a device shutdown method, apparatus, storage medium, and computer device provided in the embodiments of this application. Specific examples have been used in this application to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for shutting down a device, characterized in that, The method includes: In response to a device shutdown command for a computer device, a password verification interface is displayed; In response to an input operation on the password verification interface, password verification is performed based on the input content corresponding to the input operation and the lock screen password of the computer device; If the password verification is successful, a device shutdown task is executed to shut down the computer device.
2. The method according to claim 1, characterized in that, The step of displaying a password verification interface in response to a device shutdown command for a computer device includes: In response to the device shutdown command, detect whether the computer device has the lock screen password enabled; If the computer device enables the lock screen password, the password verification interface is displayed.
3. The method according to claim 2, characterized in that, The step of detecting whether the computer device has enabled the lock screen password includes: By running the system to close the thread, the lock screen manager is invoked to detect whether the computer device has the lock screen password enabled.
4. The method according to claim 3, characterized in that, If the computer device enables the lock screen password, the password verification interface will be displayed, including: By running the system shutdown thread, the lock screen manager is invoked. If the lock screen manager instructs the computer device to enable the lock screen password, a thread communication tool is invoked to send a password verification request to the system main thread. By running the system's main thread, a visual interaction component is invoked to display a transparent interface, and the password verification interface is displayed to cover the transparent interface.
5. The method according to claim 1, characterized in that, The step of responding to an input operation on the password verification interface, and performing password verification based on the input content corresponding to the input operation and the lock screen password of the computer device, includes: In response to the input operation, determine whether the input content matches the lock screen password; If the input content matches the lock screen password, then the password verification is confirmed to be successful; If the input content does not match the lock screen password, then the password verification is confirmed to have failed.
6. The method according to claim 5, characterized in that, The step of determining whether the input content matches the lock screen password includes: running the system main thread, calling the lock screen manager to obtain the input content and sending the input content to the security service component; and running the system main thread, calling the security service component to determine whether the input content matches the lock screen password. The step of confirming successful password verification if the input content matches the lock screen password includes: running the system main thread, calling the security service component, and indicating successful password verification to the lock screen manager if the input content matches the lock screen password; The step of confirming password verification failure if the input content does not match the lock screen password includes: running the system main thread, calling the security service component, and indicating password verification failure to the lock screen manager if the input content does not match the lock screen password.
7. The method according to claim 1, characterized in that, The execution of the device shutdown task to shut down the computer device includes: By running the system's main thread, the thread synchronization component is invoked to wake up the system and shut down the thread; By running the system shutdown thread, the device shutdown task is sent to the system main thread via a thread communication tool. The system's main thread is used to execute the device shutdown task, thereby shutting down the computer device.
8. The method according to claim 1, characterized in that, After displaying the password verification interface, the system further includes: In response to the computer device meeting the cancellation condition, a prompting task is executed to prompt the device to close the task cancellation; The cancellation conditions include at least one of the following: the screen display state of the computer device changes, or a verification cancellation instruction is received.
9. The method according to claim 1, characterized in that, The device shutdown command includes a device shutdown command, and the device shutdown operation includes a device shutdown operation; or, the device shutdown command includes a device restart command, and the device shutdown operation includes a device restart operation.
10. A device for shutting off equipment, characterized in that, The device includes: The interface display module is used to: display a password verification interface in response to a device shutdown command for a computer device; The password verification module is used to: respond to an input operation on the password verification interface, and perform password verification based on the input content corresponding to the input operation and the lock screen password of the computer device; The task execution module is used to: if the password verification is successful, execute a device shutdown task to shut down the computer device.
11. A computer-readable storage medium, characterized in that, It stores a computer program or instructions that, when executed by a processor, implement the steps of the device shutdown method as described in any one of claims 1 to 9.
12. A computer device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program or instructions that, when executed by the processor, implement the steps of the device shutdown method as described in any one of claims 1 to 9.