Method and device for prohibiting factory reset

By monitoring user operations and judging system signature information, triggering a prohibition on restoring factory settings, the problem of customization dependence and cumbersome processes in the existing technology is solved, and the effects of flexible settings and device reuse are achieved.

CN115114591BActive Publication Date: 2025-01-21QI AN XIN TECHNOLOGY GROUP INC +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110308707.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-23
Publication Date
2025-01-21
Estimated Expiration
2041-03-23

AI Technical Summary

Technical Problem

When the existing technology prohibits Android system from restoring factory settings, it depends on the system manufacturer to customize it. The process is cumbersome, the reusability is poor, and it cannot be flexibly set. It cannot be used after switching scenes, and data from specific scenes cannot be cleared.

Method used

By monitoring the user-triggered prohibition of factory settings restoration operation, it is determined whether there is preset system signature information. When it is determined that there is signature information, the prohibition of factory settings restoration instruction is triggered, and the host clears the operation of the receiving component, so as to realize the prohibition of factory settings restoration. operation.

Benefits of technology

It realizes the flexible setting of prohibiting factory reset, simplifies the operation process, reduces the dependence on system manufacturer customization, ensures that the device can still be used after switching scenes, and supports data clearing operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115114591B_ABST
    Figure CN115114591B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for prohibiting factory reset, comprising: when a user-triggered prohibition of factory reset is detected, determining whether there is preset system signature information, the system signature information is used to represent the permission to prohibit factory reset authorized by the Android system; when it is determined that there is preset system signature information, triggering a prohibition of factory reset instruction; prohibiting the operation of a host clear receiving component according to the prohibition of factory reset instruction to achieve the prohibition of factory reset, the host clear receiving component is used to capture the host clear instruction broadcast by the Android system, and execute the factory reset operation according to the host clear instruction. The beneficial effect of the present invention is that the operation steps for prohibiting factory reset are simplified, so that prohibition of factory reset can be flexibly applied.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of mobile terminal security technology, and in particular to a method and device for prohibiting restoration of factory settings. Background Art

[0002] Android is widely used in mobile terminals used by government departments, educational institutions, medical institutions and other enterprises and institutions because of its advantages of open source, easy customization and rich application programs. In the use of these Android systems, applications that can be used in the Android system are often customized according to the usage scenarios, and the usage methods are limited. The Android system has an option to restore factory settings in the settings. Misoperation by users or restoration of mobile terminals after loss will result in the loss of original data, making the mobile terminal out of the control environment and no longer applicable to specific scenarios.

[0003] At present, the main way to prohibit factory reset based on the Android system is to hide or disable the factory reset option in the settings of the mobile terminal through the Android system manufacturer before the mobile terminal leaves the factory. The implementation of this method depends on the customization of the system manufacturer, and the modification and compilation of the system takes a long time and the process is cumbersome. In addition, the reusability is poor after actual application, and it cannot be guaranteed that the mobile terminal can be used again after switching scenes. And after a scene is used, the data of the scene cannot be cleared and other operations. Summary of the invention

[0004] In view of this, an object of the embodiments of the present invention is to provide a method and device for prohibiting factory reset, which can flexibly set the prohibition of factory reset.

[0005] To achieve the above object, an embodiment of the present invention provides a method for prohibiting restoration to factory settings, comprising:

[0006] When a user-triggered operation of prohibiting factory reset is detected, it is determined whether there is preset system signature information, where the system signature information is used to indicate that the permission authorized by the Android system to prohibit factory reset is obtained;

[0007] When it is determined that the system has the preset signature information, a command prohibiting the factory reset is triggered;

[0008] According to the prohibition of factory reset instruction, the operation of the host clear receiving component is prohibited to realize the prohibition of factory reset operation. The host clear receiving component is used to capture the host clear instruction broadcast by the Android system and perform the factory reset operation according to the host clear instruction.

[0009] Furthermore, the step of prohibiting the host from clearing the receiving component according to the prohibition of restoring factory settings instruction to implement the operation of prohibiting restoring factory settings includes:

[0010] According to the instruction prohibiting factory reset, obtaining the system version number of the Android system;

[0011] Determine whether the system version number is greater than a preset version number;

[0012] When the system version number is greater than the preset version number, a preset first function is called according to the prohibition of restoring factory settings instruction, and the host is prohibited from clearing the receiving component through the first function.

[0013] Further, when the system version number is not greater than the preset version number, calling a preset second function according to the prohibition of restoring factory settings instruction;

[0014] The operation of the external storage formatting component is prohibited through the second function to realize the prohibition of the factory reset operation. The external storage formatting component is used to capture the external storage clearing instruction broadcast by the Android system and perform the factory reset operation according to the external storage clearing instruction.

[0015] Furthermore, the method further comprises:

[0016] A factory reset prohibition switch is set for the factory reset prohibition operation.

[0017] Furthermore, the method further comprises:

[0018] Monitoring whether the switch for prohibiting restoring to factory settings is in an on state;

[0019] When the factory reset prohibition switch is in the on state, the factory reset prohibition instruction is triggered.

[0020] Furthermore, the method further comprises:

[0021] When it is detected that the factory reset prohibition switch changes from the on state to the off state, a command for cancelling the factory reset prohibition is triggered, and a system version number of the Android system is obtained according to the command for cancelling the factory reset prohibition;

[0022] Determine whether the system version number is greater than the preset version number;

[0023] When it is determined that the system version number is greater than the preset version number, calling the first function according to the instruction to release the prohibition of restoring factory settings, so as to enable the host clear receiving component through the first function;

[0024] When the system version number is not greater than the preset version number, the first function and the second function are called according to the instruction to lift the prohibition of restoring factory settings, so as to enable the host clear receiving component through the first function and enable the external storage formatting component through the second function.

[0025] Furthermore, the method further comprises:

[0026] Capturing the host clear instruction broadcast by the Android system through the host clear receiving component;

[0027] When the host clearing instruction is captured by the host clearing receiving component, the preset factory restoring logic is executed to implement the factory restoring operation.

[0028] To achieve the above purpose, an embodiment of the present invention further provides a device for prohibiting restoration to factory settings, comprising:

[0029] A judgment module, used for judging whether there is preset system signature information when a user-triggered operation of prohibiting factory reset is detected, wherein the system signature information is used to indicate that the permission authorized by the Android system to prohibit factory reset is obtained;

[0030] A trigger module, used for triggering a prohibition instruction of restoring to factory settings when it is determined that the preset system signature information is present;

[0031] The prohibition module is used to prohibit the operation of the host clear receiving component according to the prohibition of restoring factory settings instruction to realize the operation of prohibiting restoring factory settings. The host clear receiving component is used to capture the host clear instruction broadcast by the Android system and perform the factory reset operation according to the host clear instruction.

[0032] To achieve the above-mentioned purpose, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program that can be executed on the processor, and when the computer program is executed by the processor, the steps of the method for prohibiting restoring factory settings as described above are implemented.

[0033] To achieve the above objectives, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the method for prohibiting restoring factory settings as described above.

[0034] The method and device for prohibiting factory restoration provided by the embodiment of the present invention, when monitoring the prohibiting factory restoration operation triggered by the user, determines whether there is preset system signature information, the system signature information is used to represent the permission authorized by the Android system to allow the prohibiting factory restoration to be executed; when it is determined that there is preset system signature information, a prohibiting factory restoration instruction is triggered; according to the prohibiting factory restoration instruction, the operation of the host clear receiving component is prohibited to realize the prohibiting factory restoration operation, the host clear receiving component is used to capture the host clear instruction broadcast by the Android system, and execute the factory restoration operation according to the host clear instruction. This solution does not need to be specially customized by the system manufacturer, can simplify the operation of prohibiting factory restoration, and simplifies the operation process. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 This is a flow chart of a first implementation mode of a method for prohibiting factory reset according to a first embodiment of the present invention.

[0036] Figure 2 This is a flow chart of steps S200 to S220 of embodiment 1 of the method for prohibiting factory reset according to the present invention.

[0037] Figure 3 This is a flow chart of steps S141 to S143 of embodiment 1 of the method for prohibiting factory reset according to the present invention.

[0038] Figure 4 This is a flow chart of steps S144 to S145 of embodiment 1 of the method for prohibiting factory reset according to the present invention.

[0039] Figure 5 This is a flow chart of steps S300 to S360 of embodiment 1 of the method for prohibiting factory reset according to the present invention.

[0040] Figure 6 This is a flow chart of steps S400 to S420 of embodiment 1 of the method for prohibiting factory reset according to the present invention.

[0041] Figure 7 This is a schematic diagram of program modules of Embodiment 2 of the device for prohibiting restoration to factory settings of the present invention.

[0042] Figure 8 This is a schematic diagram of the hardware structure of the computer device embodiment 3 of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0044] Embodiment 1

[0045] See also Figure 1 , shows a flowchart of the steps of the method for prohibiting factory reset according to the first embodiment of the present invention. It can be understood that the flowchart in the embodiment of the method is not used to limit the order of executing the steps. The following is an exemplary description with the computer device 5 as the execution subject. The details are as follows.

[0046] Step S100, when a user-triggered operation of prohibiting factory reset is detected, it is determined whether there is preset system signature information, wherein the system signature information is used to indicate that the permission authorized by the Android system to prohibit factory reset is obtained.

[0047] Exemplarily, when the user triggers the operation of prohibiting factory restoration, it is determined whether there is signature information that is the signature information of the system manufacturer. When it is determined that there is signature information of the system manufacturer, it can be considered that the permission to prohibit factory restoration has been authorized by the Android system, and thus the user has the authority to prohibit factory restoration on the Android system.

[0048] In an exemplary embodiment, the method further comprises:

[0049] A factory reset prohibition switch is set for the factory reset prohibition operation.

[0050] For example, in order to allow users to flexibly control the operation of prohibiting factory restore, a prohibit factory restore switch can be set for the prohibit factory restore operation, and the prohibit factory restore instruction and the release of the prohibit factory restore instruction are triggered according to the state of the prohibit factory restore switch. The prohibit factory restore switch can cooperate with the control instructions at any time to decide whether to execute the prohibit factory restore, thereby maintaining the reusability of the device. Among them, the prohibit factory restore switch can be a physical entity switch or a virtual switch, which can be triggered to open or close the switch through operation instructions such as rotation, touch, click, and slide.

[0051] Step S120: When it is determined that the system has the preset system signature information, a prohibition instruction of restoring to factory settings is triggered.

[0052] Exemplarily, the permission to execute the logic of prohibiting restoring factory settings is obtained through signature information, without making any modification to the system code of the Android system, thereby achieving decoupling from the Android system.

[0053] In an exemplary embodiment, see Figure 2 , the method further includes step S200 and step S220:

[0054] Step S200, monitoring whether the factory reset prohibition switch is in the on state; Step S220, when the factory reset prohibition switch is in the on state, triggering the factory reset prohibition instruction.

[0055] Exemplarily, when the factory reset prohibition switch is in the on state, the factory reset prohibition instruction is triggered to implement the factory reset prohibition operation according to the factory reset prohibition instruction.

[0056] Step S140, prohibiting the operation of the host clear receiving component according to the prohibition of restoring factory settings instruction to achieve the operation of prohibiting restoring factory settings. The host clear receiving component is used to capture the host clear instruction broadcast by the Android system and perform the factory reset operation according to the host clear instruction.

[0057] Exemplarily, the host clear receiving component can be a MasterClearReceiver component, which is used to format the host when it is turned on. Since the logic of the Android system to perform factory reset is that when the Android system detects the triggering of the factory reset instruction, the Android system will send a broadcast android.intent.action.MASTER_CLEAR, that is, a host clear instruction; when the MasterClearReceiver component (full name: com.android.server.MasterClearReceiver) captures the broadcast, it starts to execute the factory reset logic. Therefore, regardless of whether the system version number of the Android system is less than Android 6.0, it is necessary to prohibit the operation of the host clear receiving component. When prohibiting the operation of the host clear receiving component according to the prohibition of factory reset instruction, it is aimed at Android systems with system version numbers greater than Android 6.0, because system versions before API 23 can store applications in external storage, such as SD cards. Therefore, when executing the prohibition of factory reset, different processing is required according to the system version number. For example, when the system version number is not greater than Android 6.0, it is necessary to prohibit the host from clearing the receiving component and the external storage formatting component from running; and when the system version number is greater than Android 6.0, it is only necessary to prohibit the host from clearing the receiving component from running.

[0058] In an exemplary embodiment, see Figure 3 The step S140 further includes:

[0059] Step S141, obtaining the system version number of the Android system according to the instruction prohibiting factory reset; Step S142, determining whether the system version number is greater than a preset version number; Step S143, when the system version number is greater than the preset version number, calling a preset first function according to the instruction prohibiting factory reset, and prohibiting the host from clearing the operation of the receiving component through the first function.

[0060] Exemplarily, the preset version number is pre-set, and its specific version number can be determined according to the naming rules of Android system versions of different manufacturers, for example, the preset version number is Android 6.0, and the corresponding API level is API 23. When the system version number is greater than Android 6.0, the host is prohibited from clearing the operation of the receiving component by calling the first function.

[0061] In an exemplary embodiment, see Figure 4 , after step S142, further comprising:

[0062] Step S144, when the system version number is not greater than the preset version number, calling the preset second function according to the prohibition of factory reset instruction; Step S145, prohibiting the operation of the external storage formatting component through the second function to realize the prohibition of factory reset operation, the external storage formatting component is used to capture the external storage clear instruction broadcast by the Android system, and perform the factory reset operation according to the external storage clear instruction.

[0063] Exemplarily, when the system version number is greater than the preset version number, the factory reset instruction is a host clear instruction; when the system version number is not greater than the preset version number, the factory reset instruction includes a host clear instruction and an external storage clear instruction. Therefore, when the system version number is greater than the preset version number, it is only necessary to prohibit the operation of the host clear receiving component to achieve the operation of prohibiting the factory reset; when the system version number is not greater than the preset version number, it is necessary not only to prohibit the operation of the host clear receiving component, but also to run the external storage formatting component to achieve the operation of prohibiting the factory reset. The external storage formatting component can be an ExternalStorageFormatter component, which is used to format the SD card when it is turned on. When the system version number of the Android system is less than Android 6.0, it is also necessary to call the second function to prohibit the operation of the external storage formatting component, and prevent the SD card from being formatted by prohibiting the external storage formatting component.

[0064] In an exemplary embodiment, see Figure 5 The method further includes steps S300 to S360:

[0065] Step S300, when it is monitored that the switch for prohibiting factory reset is changed from the on state to the off state, triggering the instruction for lifting the prohibition of factory reset, and obtaining the system version number of the Android system according to the instruction for lifting the prohibition of factory reset; Step S320, judging whether the system version number is greater than or equal to the preset version number; Step S340, when it is judged that the system version number is greater than the preset version number, calling the first function according to the instruction for lifting the prohibition of factory reset, so as to enable the host clear receiving component through the first function; Step S360, when the system version number is not greater than the preset version number, calling the first function and the second function according to the instruction for lifting the prohibition of factory reset, so as to enable the host clear receiving component through the first function and enable the external storage formatting component through the second function.

[0066] Exemplarily, when it is necessary to lift the prohibition of restoring factory settings, the prohibition of restoring factory settings switch is changed from the on state to the off state, and the instruction to lift the prohibition of restoring factory settings is triggered based on the off state. Due to the different system version numbers, the components enabled for lifting the prohibition of restoring factory settings are also different. It can be understood that the steps for implementing the operation of prohibiting restoring factory settings are executed in reverse order. First, the first function can be called according to the instruction to lift the prohibition of restoring factory settings to enable the host clear receiving component, and then it can be determined whether the system version number of the Android system is greater than or equal to the preset version number. If it is greater than or equal to the preset version number, the external storage formatting component is enabled. It is also possible to first determine whether the system version number of the Android system is less than the preset version number, and then when the system version number is greater than or equal to the preset version number, enable the host clear receiving component, which simplifies the operation process of prohibiting and lifting the prohibition of restoring factory settings.

[0067] Exemplarily, when the system version number is less than a preset version number, the host clear receiving component and the external storage formatting component are enabled so as to convert the host clear receiving component and the external storage formatting component from a previously disabled state to an enabled state, so that the subsequent host clear receiving component and the external storage formatting component can normally execute data operation instructions, such as executing operation instructions to restore factory settings.

[0068] The first function can disable and enable the host clear receiving component, and perform different operations on the host clear receiving component according to the disable factory reset instruction and the release factory reset instruction. The second function can disable and enable the external storage formatting component, and perform different operations on the external storage formatting component according to the disable factory reset instruction and the release factory reset instruction.

[0069] In an exemplary implementation, the first interface and the second interface may be pre-set, the first function may be called through the first interface, and the second function may be called through the second interface. Before the first interface and the second interface call the first function and the second function, it is necessary to determine whether there is signature information, so that the execution permission for the Android system can be obtained through the signature information, and the component prohibition operation of the Android system is realized, thereby prohibiting the factory reset operation.

[0070] In this embodiment, by implementing the logic code for prohibiting factory reset in the written application according to the scenario, the development workload of the Android system is reduced and the Android development cycle is shortened. In addition, the logic code for prohibiting factory reset can be applied to any device based on the Android system, and can be operated by using an API call function. The set API is based on the Android source code, and the API includes a first interface and a second interface, which has a wide adaptability.

[0071] In an exemplary embodiment, see Figure 6 The method further includes steps S400 to S420:

[0072] Step S400, capturing the host clear instruction broadcast by the Android system through the host clear receiving component; Step S420, when the host clear instruction is captured by the host clear receiving component, executing the preset factory restore logic to implement the factory restore operation.

[0073] Exemplarily, after the prohibition of factory reset is lifted, when the Android system detects that a factory reset instruction is triggered, the Android system will send a broadcast host clear instruction. The host clear instruction can be: android.intent.action.MASTER_CLEAR. The host clear instruction broadcast by the Android system is captured by the host clear receiving component, and then the factory reset operation is executed according to the factory reset logic.

[0074] Embodiment 2

[0075] Please continue reading Figure 7, showing a schematic diagram of program modules of the second embodiment of the device for prohibiting factory restoration of the present invention. In this embodiment, the device 50 for prohibiting factory restoration may include or be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the present invention, and can implement the above-mentioned method for prohibiting factory restoration. The program module referred to in the embodiment of the present invention refers to a series of computer program instruction segments that can perform specific functions, and is more suitable for describing the execution process of the device 50 for prohibiting factory restoration in a storage medium than the program itself. The following description will specifically introduce the functions of each program module of this embodiment:

[0076] The judgment module 500 is used to judge whether there is preset system signature information when a user-triggered prohibition of restoring factory settings operation is monitored. The system signature information is used to represent the permission authorized by the Android system to allow the prohibition of restoring factory settings to be executed.

[0077] Exemplarily, when the user triggers the operation of prohibiting factory reset, it is determined whether there is signature information that is the signature information of the system manufacturer. When it is determined that there is signature information of the system manufacturer, the user has the authority to prohibit factory reset on the Android system.

[0078] In an exemplary embodiment, the system is also used to perform the following method:

[0079] A factory reset prohibition switch is set for the factory reset prohibition operation.

[0080] For example, in order to allow users to flexibly control the operation of prohibiting factory reset, a factory reset switch can be set for the factory reset operation, and the factory reset instruction and the factory reset instruction can be triggered according to the state of the factory reset switch. The factory reset switch can decide whether to execute the factory reset at any time in accordance with the control instruction, thereby maintaining the reusability of the device.

[0081] The trigger module 502 is used to trigger the prohibition of restoring to factory settings instruction when it is determined that there is preset system signature information.

[0082] Exemplarily, the permission to execute the logic of prohibiting restoring factory settings is obtained through signature information, without making any modification to the system code of the Android system, thereby achieving decoupling from the Android system.

[0083] In an exemplary embodiment, the system is also used to perform the following method:

[0084] Monitor whether the factory reset prohibition switch is in an on state; when the factory reset prohibition switch is in the on state, trigger the factory reset prohibition instruction.

[0085] Exemplarily, when the factory reset prohibition switch is in the on state, the factory reset prohibition instruction is triggered to implement the factory reset prohibition operation according to the factory reset prohibition instruction.

[0086] The prohibition module 504 is used to prohibit the operation of the host clear receiving component according to the prohibition of restoring factory settings instruction to realize the operation of prohibiting restoring factory settings. The host clear receiving component is used to capture the host clear instruction broadcast by the Android system and perform the factory reset operation according to the host clear instruction.

[0087] Exemplarily, the host clear receiving component can be a MasterClearReceiver component. Since the logic of the Android system to perform factory reset is that when the Android system detects the triggering of the factory reset instruction, the Android system will send a broadcast android.intent.action.MASTER_CLEAR. When the MasterClearReceiver component (com.android.server.MasterClearReceiver) captures the broadcast, it starts to execute the factory reset logic. Therefore, regardless of whether the system version number of the Android system is less than Android 6.0, it is necessary to prohibit the operation of the host clear receiving component. When prohibiting the operation of the host clear receiving component according to the prohibition of factory reset instruction, it is aimed at Android systems with system versions greater than Android 6.0, because system versions before API 23 can store applications in external storage, such as SD cards. Therefore, when executing the prohibition of factory reset operation, different processing needs to be performed according to the system version number. For example: when the system version number is not greater than Android6.0, it is necessary to prohibit the operation of the host clear receiving component and the external storage formatting component; and when the system version number is greater than Android6.0, it is only necessary to prohibit the operation of the host clear receiving component.

[0088] In an exemplary embodiment, the prohibition module 504 is further configured to:

[0089] According to the instruction prohibiting factory reset, the system version number of the Android system is obtained; it is determined whether the system version number is greater than the preset version number; when the system version number is greater than the preset version number, a preset first function is called according to the instruction prohibiting factory reset, and the host is prohibited from clearing the operation of the receiving component through the first function.

[0090] Exemplarily, the preset version number is pre-set, and its specific version number can be determined according to the naming rules of Android system versions of different manufacturers, for example, the preset version number is Android 6.0, and the corresponding API level is API 23. When the system version number is greater than Android 6.0, the host is prohibited from clearing the operation of the receiving component by calling the first function.

[0091] In an exemplary embodiment, the prohibition module 504 is further configured to:

[0092] When the system version number is not greater than the preset version number, the preset second function is called according to the prohibition of factory reset instruction; the operation of the external storage formatting component is prohibited by the second function to realize the prohibition of factory reset operation, and the external storage formatting component is used to capture the external storage clearing instruction broadcast by the Android system, and perform the factory reset operation according to the external storage clearing instruction.

[0093] Exemplarily, when the system version number is greater than the preset version number, the factory reset instruction is a host clear instruction; when the system version number is not greater than the preset version number, the factory reset instruction includes a host clear instruction and an external storage clear instruction. Therefore, when the system version number is greater than the preset version number, it is only necessary to prohibit the operation of the host clear receiving component to achieve the operation of prohibiting the factory reset; when the system version number is not greater than the preset version number, it is necessary not only to prohibit the operation of the host clear receiving component, but also to run the external storage formatting component to achieve the operation of prohibiting the factory reset. The external storage formatting component can be an ExternalStorageFormatter component. When the system version number of the Android system is less than Android 6.0, it is also necessary to call the second function to prohibit the operation of the external storage formatting component, and prevent the SD card from being formatted by prohibiting the external storage formatting component.

[0094] In an exemplary implementation, the first interface and the second interface may be pre-set, the first function may be called through the first interface, and the second function may be called through the second interface. Before the first interface and the second interface call the first function and the second function, it is necessary to determine whether there is signature information, so that the execution permission for the Android system can be obtained through the signature information, and the component prohibition operation of the Android system is realized, thereby prohibiting the operation of restoring the factory settings.

[0095] In this embodiment, the logic code for prohibiting factory reset is implemented in the written application according to the scenario, which reduces the development workload of the Android system and shortens the Android development cycle. In addition, the logic code for prohibiting factory reset can be applied to any device based on the Android system, and can be operated by using API call functions, and the set APIs are all based on Android source code, which has wide adaptability.

[0096] In an exemplary embodiment, the system is also used to perform the following method:

[0097] When it is monitored that the switch for prohibiting factory reset is changed from the on state to the off state, a command for lifting the prohibition of factory reset is triggered, and the system version number of the Android system is obtained according to the command for lifting the prohibition of factory reset; it is determined whether the system version number is greater than the preset version number; when it is determined that the system version number is greater than the preset version number, the first function is called according to the command for lifting the prohibition of factory reset, so as to enable the host clear receiving component through the first function; when the system version number is not greater than the preset version number, the first function and the second function are called according to the command for lifting the prohibition of factory reset, so as to enable the host clear receiving component through the first function and enable the external storage formatting component through the second function.

[0098] Exemplarily, when it is necessary to lift the prohibition of restoring factory settings, the prohibition of restoring factory settings switch is changed from the on state to the off state, and the instruction to lift the prohibition of restoring factory settings is triggered based on the off state. Due to the different system version numbers, the components enabled for lifting the prohibition of restoring factory settings are also different. It can be understood that the steps for implementing the operation of prohibiting restoring factory settings are executed in reverse order. First, the host clear receiving component can be enabled according to the instruction to lift the prohibition of restoring factory settings, and then it can be determined whether the system version number of the Android system is greater than the preset version number. If it is greater than the preset version number, the external storage formatting component is enabled. It is also possible to first determine whether the system version number of the Android system is not greater than the preset version number, and then when the system version number is greater than or equal to the preset version number, enable the host clear receiving component, which simplifies the operation process of prohibiting and lifting the prohibition of restoring factory settings.

[0099] Exemplarily, when the system version number is not greater than a preset version number, the host clear receiving component and the external storage formatting component are enabled so as to convert the host clear receiving component and the external storage formatting component from a previously disabled state to an enabled state, so that the subsequent host clear receiving component and the external storage formatting component can normally execute data operation instructions, such as executing operation instructions to restore factory settings.

[0100] The first function can disable and enable the host clear receiving component, and perform different operations on the host clear receiving component according to the disable factory reset instruction and the release factory reset instruction. The second function can disable and enable the external storage formatting component, and perform different operations on the external storage formatting component according to the disable factory reset instruction and the release factory reset instruction.

[0101] In an exemplary embodiment, the system is also used to perform the following method:

[0102] The host clearing receiving component captures the host clearing instruction broadcasted by the Android system; when the host clearing receiving component captures the host clearing instruction, the preset factory restoration logic is executed to implement the factory restoration operation.

[0103] Exemplarily, after the prohibition of factory reset is lifted, when the Android system detects that a factory reset instruction is triggered, the Android system will send a broadcast host clear instruction. The host clear instruction can be: android.intent.action.MASTER_CLEAR. The host clear instruction broadcast by the Android system is captured by the host clear receiving component, and then the factory reset operation is executed according to the factory reset logic.

[0104] Embodiment 3

[0105] See also Figure 8 , is a schematic diagram of the hardware architecture of the computer device of the third embodiment of the present invention. In this embodiment, the computer device 5 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. The computer device 5 can be a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Figure 8 As shown, the computer device 5 at least includes, but is not limited to, a memory 51, a processor 52, a network interface 53, and a device 50 for prohibiting factory reset, which can be interconnected and communicated via a system bus.

[0106] In this embodiment, the memory 51 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 51 can be an internal storage unit of the computer device 5, such as a hard disk or memory of the computer device 5. In other embodiments, the memory 51 can also be an external storage device of the computer device 5, such as a plug-in hard disk equipped on the computer device 5, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 51 can also include both the internal storage unit of the computer device 5 and its external storage device. In this embodiment, the memory 51 is generally used to store operating devices and various application software installed in the computer device 5, such as the program code of the device 50 for prohibiting factory reset in the first embodiment. In addition, the memory 51 can also be used to temporarily store various types of data that have been output or are to be output.

[0107] The processor 52 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 52 is generally used to control the overall operation of the computer device 5. In this embodiment, the processor 52 is used to run the program code stored in the memory 51 or process data, such as running the device 50 for prohibiting factory reset, so as to implement the method for prohibiting factory reset of the first embodiment.

[0108] The network interface 53 may include a wireless network interface or a wired network interface, and the network interface 53 is generally used to establish a communication connection between the server 5 and other electronic devices. For example, the network interface 53 is used to connect the server 5 to an external terminal through a network, to establish a data transmission channel and a communication connection between the server 5 and the external terminal, etc. The network may be an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi and other wireless or wired networks. It should be pointed out that Figure 8 Only a computer device 5 having components 50 - 53 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0109] In this embodiment, the device 50 for prohibiting factory reset stored in the memory 51 can also be divided into one or more program modules, and the one or more program modules are stored in the memory 51 and executed by one or more processors (processor 52 in this embodiment) to complete the present invention.

[0110] For example, Figure 7 A schematic diagram of program modules of the second embodiment of the apparatus 50 for prohibiting factory reset is shown. In this embodiment, the apparatus 50 for prohibiting factory reset can be divided into the judgment module 500, the trigger module 502 and the prohibition module 504. The program module referred to in the present invention refers to a series of computer program instruction segments that can complete specific functions, which is more suitable for describing the execution process of the apparatus 50 for prohibiting factory reset in the computer device 5 than a program. The specific functions of the program modules 500-504 have been described in detail in the second embodiment and will not be repeated here.

[0111] Embodiment 4

[0112] This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored, and the program implements a corresponding function when executed by a processor. The computer-readable storage medium of this embodiment is used for a computer program, and when executed by a processor, the method for prohibiting factory reset of the first embodiment is implemented.

[0113] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.

[0115] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for prohibiting restoring factory settings, characterized in that: include: When a user-triggered operation of prohibiting factory reset is detected, it is determined whether there is preset system signature information, where the system signature information is used to indicate that the permission authorized by the Android system to prohibit factory reset is obtained; When it is determined that the system has the preset signature information, a command prohibiting the factory reset is triggered; According to the prohibition of factory reset instruction, the operation of the host clear receiving component is prohibited to realize the prohibition of factory reset operation, and the host clear receiving component is used to capture the host clear instruction broadcast by the Android system and perform the factory reset operation according to the host clear instruction; The step of prohibiting the host from clearing the receiving component according to the prohibition of restoring factory settings instruction to achieve the prohibition of restoring factory settings includes: According to the instruction prohibiting factory reset, obtaining the system version number of the Android system; Determine whether the system version number is greater than a preset version number; When the system version number is greater than the preset version number, a preset first function is called according to the prohibition of restoring factory settings instruction, and the host is prohibited from clearing the operation of the receiving component through the first function.

2. The method for prohibiting restoring factory settings according to claim 1, characterized in that: After the step of determining whether the system version number is greater than the preset version number, the following steps are included: When the system version number is not greater than the preset version number, calling a preset second function according to the prohibition of restoring factory settings instruction; The operation of the external storage formatting component is prohibited through the second function to realize the prohibition of the factory reset operation. The external storage formatting component is used to capture the external storage clearing instruction broadcast by the Android system and perform the factory reset operation according to the external storage clearing instruction.

3. The method for prohibiting restoring to factory settings according to claim 2, characterized in that: The method further comprises: A factory reset prohibition switch is set for the factory reset prohibition operation.

4. The method for prohibiting restoring to factory settings according to claim 3, characterized in that: The method further comprises: Monitoring whether the switch for prohibiting restoring to factory settings is in an on state; When the factory reset prohibition switch is in the on state, the factory reset prohibition instruction is triggered.

5. The method for prohibiting restoring to factory settings according to claim 4, characterized in that: The method further comprises: When it is detected that the factory reset prohibition switch changes from the on state to the off state, a command for cancelling the factory reset prohibition is triggered, and a system version number of the Android system is obtained according to the command for cancelling the factory reset prohibition; Determine whether the system version number is greater than the preset version number; When it is determined that the system version number is greater than the preset version number, calling the first function according to the instruction to release the prohibition of restoring factory settings, so as to enable the host clear receiving component through the first function; When the system version number is not greater than the preset version number, the first function and the second function are called according to the instruction to lift the prohibition of restoring factory settings, so as to enable the host clear receiving component through the first function and enable the external storage formatting component through the second function.

6. The method for prohibiting restoring to factory settings according to claim 5, characterized in that: The method further comprises: Capturing the host clear instruction broadcast by the Android system through the host clear receiving component; When the host clearing instruction is captured by the host clearing receiving component, the preset factory restoring logic is executed to implement the factory restoring operation.

7. A device for prohibiting restoration to factory settings, characterized in that: include: A judgment module, used for judging whether there is preset system signature information when a user-triggered operation of prohibiting factory reset is detected, wherein the system signature information is used to indicate that the permission authorized by the Android system to prohibit factory reset is obtained; A trigger module, used for triggering a prohibition instruction of restoring to factory settings when it is determined that the preset system signature information is present; A prohibition module, used to prohibit the operation of the host clear receiving component according to the prohibition of restoring factory settings instruction, so as to realize the prohibition of restoring factory settings operation, wherein the host clear receiving component is used to capture the host clear instruction broadcast by the Android system, and perform the factory reset operation according to the host clear instruction; The step of prohibiting the host from clearing the receiving component according to the prohibition of restoring factory settings instruction to achieve the prohibition of restoring factory settings includes: According to the instruction prohibiting factory reset, obtaining the system version number of the Android system; Determine whether the system version number is greater than a preset version number; When the system version number is greater than the preset version number, a preset first function is called according to the prohibition of restoring factory settings instruction, and the host is prohibited from clearing the operation of the receiving component through the first function.

8. A computer device, characterized in that: The computer device includes a memory and a processor. The memory stores a computer program that can be run on the processor. When the computer program is executed by the processor, the steps of the method for prohibiting factory reset according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by at least one processor to enable the at least one processor to perform the steps of the method for prohibiting factory reset according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Information processing method and device

    CN107545155A

  • Data clearing method, device, storage medium and terminal

    CN109508522A