Disclosure of Invention
The application provides a factory setting restoration method and device based on a container system and electronic equipment. The method is used for solving the problems that the existing factory setting recovery time is long, and the factory setting recovery efficiency is low.
In a first aspect, an embodiment of the present application provides a factory-restoring method based on a container system, which is applied to an electronic device, where the electronic device includes a host system and at least two container systems, and the factory-restoring method based on the container systems includes: when one of the first container systems sends a first instruction to the host system is detected, the first instruction transmitted by the first container system to the host system is intercepted, and the host system and at least two container systems are in an operation state; if the first instruction is used for indicating the host machine system to restart so as to restore factory setting of the first container system, controlling the first container system to stop running and erasing target data in a target partition of the first container system; the first container system is restarted.
In one embodiment of the application, intercepting a first instruction transmitted by a first container system to a host system comprises: establishing inter-process communication between each container system and a host system; and intercepting the first instruction by adopting inter-process communication corresponding to the first container system.
In one embodiment of the present application, the container system-based factory reset method further comprises: if the first instruction is used for indicating to restart the first container system, after the first container system is restarted, the inter-process communication between the first container system and the host machine system is reestablished, wherein when the first container system stops running, the inter-process communication between the first container system and the host machine system is disconnected.
In one embodiment of the application, erasing target data in a target partition of a first container system includes: acquiring first data of each partition of a first container system and second data corresponding to an interactive interface; and erasing target data belonging to the target partition in the first data and the second data.
In one embodiment of the present application, the factory setting restoration method based on the container system further comprises: when target data in a target partition of the first container system is erased, prompt information is sent to a display interface corresponding to the first container system, and the prompt information is used for indicating that the erasing progress is displayed on the display interface.
In one embodiment of the application, at least two container systems comprise: and the first container system corresponding to the central control and the second container system corresponding to the instrument are controlled.
In one embodiment of the present application, before intercepting the first instruction transmitted by the first container system to the host system, the method further includes: when the power-on of the electronic equipment is detected, a host machine system is operated, and container environments corresponding to at least two container systems are created; starting a second container system based on the container environment, and running an application program corresponding to the second container system, wherein the second container system is other container systems except the first container system in at least two container systems; the first container system is started.
In a second aspect, an embodiment of the present application provides a factory-restoring device based on a container system, which is applied to an electronic device, where the electronic device includes a host system and at least two container systems, and the factory-restoring device based on the container systems includes:
the interception module is used for intercepting a first instruction transmitted by a first container system to a host machine system when detecting that the first container system transmits the first instruction to the host machine system, and the host machine system and at least two container systems are in an operation state;
the erasing module is used for controlling the first container system to stop running and erasing target data in a target partition of the first container system if the first instruction is used for indicating the host system to restart to restore factory setting of the first container system;
and the starting module is used for restarting the first container system.
In one embodiment of the present application, the interception module is specifically configured to: establishing inter-process communication between each container system and a host system; and intercepting the first instruction by adopting inter-process communication corresponding to the first container system.
In one embodiment of the present application, the factory-reset-based device for container system further comprises: and the restarting module is used for restarting the first container system if the first instruction is used for indicating the restarting of the first container system, and reestablishing the inter-process communication between the first container system and the host machine system after the restarting of the first container system, wherein the inter-process communication between the first container system and the host machine system is disconnected when the first container system stops running.
In one embodiment of the application, the erase module is specifically configured to: acquiring first data of each partition of a first container system and second data corresponding to an interactive interface; and erasing target data belonging to the target partition in the first data and the second data.
In one embodiment of the present application, the factory-reset-based device for container system further comprises: the sending module is used for sending prompt information to a display interface corresponding to the first container system when the target data in the target partition of the first container system is erased, wherein the prompt information is used for indicating the erasure progress to be displayed on the display interface.
In one embodiment of the application, at least two container systems comprise: and the first container system corresponding to the central control and the second container system corresponding to the instrument are controlled.
In one embodiment of the present application, the factory-reset-based device for container system further comprises: the system comprises a creation module, an operation module and an initial starting module;
the creation module is used for operating the host machine system when the electronic equipment is detected to be electrified and creating container environments corresponding to at least two container systems;
the operation module is used for starting a second container system based on the container environment and operating an application program corresponding to the second container system, wherein the second container system is other container systems except the first container system in at least two container systems;
and the initial starting module is used for starting the first container system.
In a third aspect, an embodiment of the present application provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the electronic device to perform the container system based factory reset method of any one of the first aspects of the application.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the container system-based factory-restoration method of any one of the first aspects of the present application.
The embodiment of the application provides a factory setting restoration method and device based on a container system and electronic equipment, wherein the factory setting restoration method based on the container system comprises the following steps: when one of the first container systems sends a first instruction to the host system is detected, the first instruction transmitted by the first container system to the host system is intercepted, and the host system and at least two container systems are in an operation state; if the first instruction is used for indicating the host machine system to restart so as to restore factory setting of the first container system, controlling the first container system to stop running and erasing target data in a target partition of the first container system; the first container system is restarted. In the application, when the first container system is restored to the factory setting, the first instruction for indicating the host system to restart is intercepted, so that the host system cannot restart, and the time consumed by restoring the factory setting of the first container is further reduced. And because the host machine system can not be restarted, other container systems except the first container system can still normally operate, and further, when one container system is restored to factory setting, the normal operation of the other container systems can not be influenced.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms first, second, third and the like in the description and in the claims and in the above drawings, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein.
Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a schematic view of a scenario of a container system-based factory-restoration setting method according to an embodiment of the present application, and as shown in fig. 1, an electronic device 11 includes: a host system 111 and at least two container systems (container system 112 and container system 113 in the figure). Also included in fig. 1 are first display 12 and second display 13. Wherein the first display 12 is controlled to be displayed by the container system 112 and the second display 13 is controlled to be displayed by the container system 113. In the automotive field, the container system 112 is a central control system, and corresponding to the first display screen 12, may display audio and video applications. The container system 113 is an instrument system, and the corresponding second display 13 can display instrument data corresponding to the automobile.
In the above application scenario, when the factory setting needs to be restored to the container system 112, the whole electronic device 11 is generally restarted and then subjected to related operations for restoring the factory setting, and then the whole electronic device 11 is restarted to complete the restoration of the factory setting of the container system 112. The electronic device is restarted twice, which is time-consuming, and the restarting of the electronic device requires that the container system 113 is also restarted, so that the normal operation of the automobile is affected when the container system 113 is an instrument system of the automobile.
Based on the problems of the application scene, the application provides the factory setting restoration method based on the container system, which can restore factory setting to the first container system after intercepting the first instruction indicating the host system to restart, can not influence the normal operation of other container systems, and has short time consumption and high efficiency.
The technical scheme of the application is described in detail through specific embodiments. It should be noted that the following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
Fig. 2 is a flowchart of a method for restoring factory settings based on a container system according to an embodiment of the present application. The embodiment of the application provides a factory-restoration setting method based on a container system, which is applied to electronic equipment, wherein the electronic equipment comprises a host system and at least two container systems, and the factory-restoration setting method based on the container systems specifically comprises the following steps:
s201, when one of the first container systems is detected to send a first instruction to the host system, the first instruction transmitted by the first container system to the host system is intercepted.
In an embodiment of the present application, the electronic device may have a host with at least two containers. The host system is a host system, and the container system is a virtual machine system. The term "host" derives from the content of the host system in which the container system is running. The container system can run inside the container, and the container system can be a Linux system or an android system. The containers are isolated from each other, the application sets of lightweight components or the application sets of the whole host system are arranged in the containers, files on which processes running the application sets depend are provided by the container mirror image, and then the application sets are run on an isolated container system which is run on the host system.
Illustratively, the first container system runs a corresponding set of applications for automotive center control, the set of applications comprising: video, audio, and network, etc. The second container system runs an application set corresponding to the automobile instrument, and the application set comprises: fuel oil indication, electronic throttle indication, alarm indication, front and rear fog lamp indication and the like.
Wherein S201 is performed while the host system and the at least two container systems are in an operational state. The host system and at least two container systems are in an operating state, which means that the application sets corresponding to the two container systems work normally. For example, the video, audio, network, etc. corresponding to the first container system are operating normally. And the fuel oil indication, the electronic throttle indication, the alarm indication, the front fog lamp indication and the rear fog lamp indication corresponding to the second container system work normally.
Specifically, the host system may intercept a first instruction transmitted by any container system to the host system. Wherein the first instruction comprises: a container system restart instruction or an instruction to restart the host system to restore the factory settings of the first container system.
The method comprises the steps that a user triggers an interface of a display screen corresponding to a first container system, the first container system receives trigger operation corresponding to the user, the trigger operation is judged to be used for indicating the first container system to restore factory setting, and the first container system adopts an init process and sends a host restarting signal to a host system so as to restart the host system.
In addition, the triggering operation is judged to be used for indicating the first container system to restart, the first container system also adopts an init process, and a first container system restart signal is sent to the host machine system so as to restart the first container system.
In the embodiment of the application, the host can be prevented from restarting by intercepting the first instruction, so that the time consumption is reduced, and the normal operation of other container systems except the first container system is prevented from being influenced.
S202, if the first instruction is used for indicating the host machine system to restart to restore factory setting of the first container system, controlling the first container system to stop running and erasing target data in a target partition of the first container system.
If the first instruction is sent by the first container system, the host system is instructed to restart to restore the factory setting of the first container system. And controlling the first container system to stop running so as to carry out related operations of restoring the factory settings subsequently.
If the first container system is not stopped, the service sets such as video, audio, network and the like corresponding to the running application sets of the first container system collide with the subsequent formatting of the disk data corresponding to the first container system, so that the risk of system running can occur.
In an embodiment of the present application, the target partition includes: data (data) partitions and cache (cache) partitions. In addition, the target partition may also be a user-defined partition.
S203, restarting the first container system.
Step S202 is executed to stop the operation of the first container system and erase the target data, and step S203 is executed to restart the first container system to complete the restoration of the first container system.
Specifically, after the first container system is restarted, the first container system operates each application set corresponding to the first container system, and factory setting restoration of the first container system is completed.
In the embodiment of the application, as the data of the target partition of the first container system is erased, certain difference exists between the content of the application set operated by the first container system when the first container system is started currently and the content of the application set operated before the factory setting is restored.
In the embodiment of the application, when the first container system is restored to the factory setting, the second container system always operates normally. The first container system is restored to the factory setting, the operation of the second container system is not affected, and the host computer system is not required to be restarted, so that the effects of short time consumption and high efficiency are achieved.
Referring to fig. 3, a flowchart of steps of a factory reset method based on a container system according to another embodiment of the present application specifically includes the following steps:
and S301, when the electronic equipment is detected to be powered on, the host machine system is operated, and container environments corresponding to at least two container systems are created.
Wherein at least two of the container systems comprise: and the first container system corresponding to the central control and the second container system corresponding to the instrument are controlled. The first container system and the second container system may be run on a single vehicle-machine chip of the vehicle.
Specifically, after the electronic device is powered on, a host image (host. Img) file is loaded, a Linux kernel (kernel) binary file in the host image file and a root file system of a host system are analyzed, and the root file system is copied to a specified memory. After the Linux kernel is initialized, the host system operates normally, and a container environment (virtualized environment) of LXC (Linux containers) is ready for starting each container system (e.g., a first container system and a second container system).
Further, the host system is defined as an operating system running on physical hardware in the LXC virtualized environment. A container system is defined as a virtual machine operating system running on a container.
S302, starting a second container system based on the container environment, and running an application program corresponding to the second container system.
Wherein the second container system is a further container system of the at least two container systems than the first container system. The second container system can be a container system corresponding to the instrument, and the second container system is started preferentially, so that the real-time requirement of ignition starting of the automobile can be ensured.
If the first container system and the second container system are container systems corresponding to other functions, it is possible to determine whether to preferentially activate the first container system or the second container system according to the need, which is not limited herein.
Further, the application program corresponding to the second container system includes: and the application programs correspond to services such as fuel oil indication, electronic throttle indication, alarm indication, front and rear fog lamp indication and the like. In the embodiment of the application, the application program corresponding to the second container system normally operates in the whole step flow of the application. The steps of the embodiment of the application do not influence the normal operation of the application program corresponding to the second container system.
S303, starting the first container system.
After the first container system is started, each application program corresponding to the first container system can be operated. Such as audio, video, etc.
In the embodiment of the application, a host system is adopted to start each container system.
S304, establishing inter-process communication between each container system and the host system.
After the host system of the automobile starts each container system, an event monitoring service of each container system is created, and then a bridge for communication between the host system and the processes of each container system is established. Each container system has its own corresponding inter-process communication.
Specifically, inter-process communication (IPC, inter-Process Communication) refers to the propagation or exchange of information between different processes. Information may be exchanged between the host system and the respective container systems.
S305, intercepting a first instruction by adopting inter-process communication corresponding to the first container system.
In the embodiment of the application, each container system has its own corresponding inter-process communication, so that the first container system corresponds to the inter-process communication with the host system, and the second container system also corresponds to the inter-process communication with the host system.
The method comprises the steps that a user triggers an interface of a display screen corresponding to a first container system, the first container system receives triggering operation corresponding to the user, and a first instruction is sent to a host system. The host computer system waits for the first container system to be actively connected with the host computer system and report the event corresponding to the first instruction. When no event is reported, the inter-process communication of the first container system is in a suspended state.
S306, determining whether the first instruction is to instruct the host system to restart for restoration of the first container system.
If yes, S307 is executed, and if not, S311 is executed. And if the first instruction does not instruct the host system to restart to restore the factory setting, the first instruction is used for instructing to restart the first container system.
Specifically, the automobile host system analyzes the first instruction according to the interprocess communication message, and if the first instruction indicates that the host system is restarted to perform factory restoration setting of the first container system, S307 is executed.
S307, controlling the first container system to stop running, and acquiring first data of each partition of the first container system and second data corresponding to the interactive interface.
Wherein each partition includes: and the second data corresponding to the interactive interface comprises Chinese fonts of a recovery application man-machine interactive interface.
Specifically, the host system runs a recovery (recovery) application program, and the recovery (recovery) application program is adopted to analyze first data of each partition of the first container system and second data corresponding to the interactive interface.
S308, erasing target data belonging to a target partition in the first data and the second data.
The target partition is a data partition and a cache partition, and can also be other user-defined partitions. The recovery application determines target data belonging to the target partition from the first data and the second data.
The recovery application program executes a data disk erasing task and erases data in the data partition, the cache partition and other custom partitions.
S309, when target data in a target partition of the first container system is erased, prompt information is sent to a display interface corresponding to the first container system.
Further, the prompt message is used for indicating to display the erasing progress on the display interface. And the Recovery application program can display the current erasing progress on the display screen corresponding to the first container system while erasing the target data. Specifically, the erasing progress can be displayed in an animation mode so as to prompt the user that the first container system is erasing the target data of the disk.
S310, restarting the first container system.
And restarting the first container system, and running each application program corresponding to the first container system.
S311, after the first container system is restarted, the inter-process communication between the first container system and the host system is reestablished.
Wherein when the first container system stops operating, the inter-process communication between the first container system and the host system is disconnected. Therefore, if the first instruction indicates to restart the first container system, the first container system needs to be disconnected first and then started, and the first container system after restarting needs to reestablish the inter-process communication between the first container system and the host system.
In addition, after step S311, S305 is performed to form a loop.
Further, in the whole process of the step, the display screen of the instrument corresponding to the second container system is always in a normal display state. The central control display screen corresponding to the first container system is in a normal display state in S303 to S306, in a stop display state in S307 to S308, in a erase progress in S309, and in a normal display state in S310.
The embodiment of the application provides a factory setting restoration method based on a container system, when a first container system restores factory setting, a first instruction for indicating a host system to restart is intercepted, so that the host system cannot restart, and the time consumed by restoring the factory setting of the first container is further reduced. And because the host machine system can not restart, other container systems except the first container system can still normally operate, and further normal operation of other container systems can not be influenced when one container system is restored to factory setting.
Fig. 4 is a block diagram illustrating a factory reset apparatus 40 based on a container system according to an embodiment of the present application. The factory setting restoration device based on the container system is applied to electronic equipment, the electronic equipment comprises a host system and at least two container systems, as shown in fig. 4, the factory setting restoration device 40 based on the container system provided by the embodiment of the application comprises:
the interception module 41 is configured to intercept, when detecting that one of the first container systems sends a first instruction to the host system, the first instruction transmitted by the first container system to the host system, where the host system and at least two container systems are in an operation state;
the erasing module 42 is configured to control the first container system to stop running and erase target data in a target partition of the first container system if the first instruction is used to instruct the host system to restart for restoring the factory setting of the first container system;
a start module 43 for restarting the first container system.
In one embodiment of the application, the interception module 41 is specifically configured to: establishing inter-process communication between each container system and a host system; and intercepting the first instruction by adopting inter-process communication corresponding to the first container system.
In one embodiment of the present application, the factory-reset-based device for container system further comprises: a restart module (not shown) for reestablishing inter-process communication between the first container system and the host system after the first container system is restarted if the first instruction is used to instruct to restart the first container system, wherein the inter-process communication between the first container system and the host system is disconnected when the first container system stops running.
The erase module 42 is specifically configured to: acquiring first data of each partition of a first container system and second data corresponding to an interactive interface; and erasing target data belonging to the target partition in the first data and the second data.
In one embodiment of the present application, the container system based factory reset apparatus 40 further comprises: and the sending module (not shown) is used for sending prompt information to the display interface corresponding to the first container system when the target data in the target partition of the first container system is erased, wherein the prompt information is used for indicating the erasure progress to be displayed on the display interface.
In one embodiment of the application, at least two container systems comprise: and the first container system corresponding to the central control and the second container system corresponding to the instrument are controlled.
In one embodiment of the present application, the container system based factory reset apparatus 40 further comprises: a creation module (not shown), a run module (not shown), and an initial start-up module (not shown);
the creation module is used for operating the host machine system when the electronic equipment is detected to be electrified and creating container environments corresponding to at least two container systems;
the operation module is used for starting a second container system based on the container environment and operating an application program corresponding to the second container system, wherein the second container system is other container systems except the first container system in at least two container systems;
and the initial starting module is used for starting the first container system.
The factory setting restoration device based on the container system provided by the embodiment of the application is used for executing the technical scheme in the method embodiment corresponding to fig. 2 or fig. 3, and the implementation principle and the technical effect are similar, and are not repeated here.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device (a first electronic device or a second electronic device) according to an embodiment of the present application. As shown in fig. 5, the electronic device 50 of the embodiment of the present application may include: at least one processor 51 (only one processor is shown in fig. 5); and a memory 52 communicatively coupled to the at least one processor. The memory 52 stores instructions executable by the at least one processor 51, and the instructions are executed by the at least one processor 51 to enable the electronic device 50 to perform the technical solutions of any of the method embodiments described above.
Alternatively, the memory 52 may be separate or integrated with the processor 51.
When the memory 52 is a device separate from the processor 51, the electronic device 50 further includes: a bus 53 for connecting the memory 52 and the processor 51.
The electronic device provided by the embodiment of the application can execute the technical scheme of any of the method embodiments, and the implementation principle and the technical effect are similar, and are not repeated here.
The embodiment of the application also provides a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program is used for realizing the technical scheme in any one of the method embodiments when being executed by a processor.
Embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements the technical solution in any of the foregoing method embodiments.
The embodiment of the application also provides a chip, which comprises: the processing module and the communication interface, the processing module can execute the technical scheme in the embodiment of the method.
Further, the chip further includes a storage module (e.g., a memory), where the storage module is configured to store the instructions, and the processing module is configured to execute the instructions stored in the storage module, and execution of the instructions stored in the storage module causes the processing module to execute the technical solution in the foregoing method embodiment.
It should be understood that the above processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or to one type of bus.
The storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). The processor and the storage medium may reside as discrete components in an electronic device.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.