Method for starting up electronic equipment and electronic equipment
Patent Information
- Application Number
- CN202311679155.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-08
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2043-12-08
AI Technical Summary
Electronic equipment takes a long time to boot up, resulting in substandard performance. Especially when the sensor list changes after the system version is updated, it is difficult for the device to quickly identify newly added or deleted sensors, resulting in boot timeout and performance failure.
During the startup phase of the electronic device, delete the current sensor list and automatically scan the sensors that have been initialized. If a sensor is added, deleted, or the configuration path is changed, skip traversing the deleted or configuration path changed sensors and directly traverse the initialized sensors. sensors and generate a new sensor list for easy startup.
It shortens the boot time, avoids performance failure caused by failure to recognize new sensors, ensures that the sensors work normally after booting, and improves the booting efficiency after the system version is updated.
Smart Images

Figure CN117389638B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of electronic devices, and in particular to a method for starting up an electronic device and the electronic device. Background Art
[0002] With the development of electronic equipment technology, people are pursuing higher and higher performance of electronic equipment. For electronic equipment, the power-on time of electronic equipment is one of the important factors for evaluating the performance of electronic equipment. At present, the power-on time of electronic equipment is relatively long. Summary of the invention
[0003] The embodiments of the present application provide a method for starting up an electronic device and an electronic device, which can shorten the startup time of the electronic device.
[0004] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0005] In a first aspect, a method for starting up an electronic device is provided, which is applied to an electronic device, and the method includes: the electronic device deletes a sensor list in response to a power-on instruction; wherein the sensor list includes information about sensors that have been initialized during the historical power-on process of the electronic device. After the electronic device deletes the sensor list, the electronic device can scan each sensor that has been initialized in the current electronic device. After the electronic device completes scanning each sensor, the power-on is performed.
[0006] By adopting this technical solution, the current sensor list is deleted during the startup phase of the electronic device, and the electronic device automatically scans multiple sensors that have been initialized in the electronic device to complete the startup of the electronic device. As a result, the electronic device will not traverse the sensors based on the current sensor list, but will automatically scan multiple sensors that have been initialized after deleting the sensor list. If the electronic device has sensors added, deleted, or the configuration path changed after the system version is updated, the electronic device will not always scan the deleted or changed sensors, which can reduce the scanning time and will not miss the scanning of the newly added sensors, so that the newly added sensors can work normally after startup.
[0007] In a possible implementation of the first aspect, the electronic device deletes the sensor list in response to a power-on startup instruction, including: the electronic device obtains power-on information of the electronic device in response to the power-on startup instruction. The power-on information of the electronic device is used to indicate whether the current power-on of the electronic device is the first power-on of the electronic device after the system version is updated. If the power-on information indicates that the current power-on of the electronic device is the first power-on of the electronic device after the system version is updated, the electronic device deletes the sensor list.
[0008] In a possible implementation of the first aspect, after the electronic device scans each sensor that has been initialized in the current electronic device, the method further includes: the electronic device generates a new sensor list based on each sensor currently scanned. During the subsequent startup process of the electronic device after the system version is not updated, the electronic device can directly traverse multiple sensors in the new sensor list based on the new sensor list.
[0009] In a possible implementation of the first aspect, the method further includes: if the power-on information indicates that the electronic device is powered on for a non-first time after the system version is updated, the electronic device traverses multiple sensors in the new sensor list. The system version update includes a system version upgrade or a factory reset. Generally speaking, only after the system version is updated, the sensors in the electronic device will be deleted or newly added or the configuration path will be changed. Therefore, when the electronic device is powered on for a non-first time after the system version is updated, it is not necessary to delete the current sensor list, and multiple sensors in the sensor list can be traversed according to the new sensor list generated at the first power-on, thereby shortening the time it takes for the electronic device to scan the sensors when it is not powered on for the first time, and shortening the power-on time of the electronic device when it is not powered on for the first time.
[0010] In a possible implementation of the first aspect, the electronic device generates a new sensor list based on each sensor currently scanned, including: the electronic device initializes each sensor in the electronic device through a sensor management module to obtain the initialized sensors; the electronic device generates a new sensor list based on each initialized sensor.
[0011] In a possible implementation of the first aspect, before obtaining the power-on information of the electronic device, it also includes: if the current power-on is the first power-on of the electronic device after the system version is updated, the electronic device sets the power-on information to a first preset value. The power-on information being the first preset value indicates that the current power-on is the first power-on of the electronic device after the system version is updated. If the current power-on is not the first power-on of the electronic device after the system version is updated, the electronic device sets the power-on information to a second preset value. The power-on information being the second preset value indicates that the current power-on is not the first power-on of the electronic device after the system version is updated.
[0012] In a possible implementation of the first aspect, if the power-on information indicates that the electronic device is powered on for the first time after the system version is updated, the electronic device deletes the current sensor list, including: when the electronic device reads the power-on information as a first preset value, the current sensor list is deleted.
[0013] In a possible implementation of the first aspect, if the power-on information indicates that the electronic device is not powered on for the first time after the system version is updated, the electronic device traverses multiple sensors in the sensor list, including: when the electronic device reads the power-on information as a second preset value, it traverses multiple sensors in the sensor list.
[0014] In a second aspect, another method for starting up an electronic device is provided, which is applied to an electronic device, and the method includes: the electronic device responds to a power-on instruction, traverses multiple first sensors that have been initialized in a sensor list, and skips traversing the second sensor. The sensor list includes information about sensors that have been initialized during the historical power-on process of the electronic device; the configuration path of the second sensor in the current system version of the electronic device is different from the configuration path of the second sensor in the historical system version of the electronic device. After the electronic device completes traversing the multiple first sensors, it executes the power-on startup.
[0015] By adopting the above technical solution, the electronic device traverses multiple initialized first sensors and skips traversing the second sensor during the boot phase, and after the electronic device completes traversing the multiple first sensors, it performs boot-up. As a result, if the configuration path of the second sensor of the electronic device changes in the electronic device after the system version is updated, the electronic device can skip traversing the second sensor and only traverse the first sensor, which can shorten the time it takes for the electronic device to start the sensor service, thereby shortening the time it takes for the electronic device to boot up.
[0016] In a possible implementation manner of the second aspect, the second sensor includes at least one of the following: a sensor newly added by the electronic device after a system version is updated; a sensor deleted by the electronic device after the system version is updated; and a sensor whose configuration path is changed by the electronic device after the system version is updated.
[0017] In a third aspect, an electronic device is provided, comprising: a communication module, a memory and one or more processors; the communication module, the memory and the processor are coupled; the memory is used to store computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the electronic device, the electronic device executes the above method.
[0018] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer can execute any one of the methods in the first aspect or the second aspect.
[0019] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on an electronic device, enables the electronic device to execute any one of the methods in the first or second aspect.
[0020] In a sixth aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect or the second aspect. In a possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.
[0021] Among them, the technical effects brought about by any design method in the third to sixth aspects can refer to the technical effects brought about by different design methods in the first or second aspects, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 A schematic diagram of a scenario of powering on an electronic device provided in an embodiment of the present application;
[0023] Figure 2 A schematic diagram of a partial log of an electronic device provided in an embodiment of the present application;
[0024] Figure 3 A flowchart of starting up an electronic device provided in an embodiment of the present application;
[0025] Figure 4 A schematic diagram of the architecture of a startup process of an electronic device provided in an embodiment of the present application;
[0026] Figure 5 A schematic diagram of a process for starting up an electronic device provided in an embodiment of the present application;
[0027] Figure 6 A schematic diagram of a process for starting a sensor service provided in an embodiment of the present application;
[0028] Figure 7 A schematic diagram of a flow chart of deleting a sensor list of an electronic device provided in an embodiment of the present application;
[0029] Figure 8 A timing diagram of deleting a sensor list of an electronic device provided in an embodiment of the present application;
[0030] Fig. 9 A schematic diagram of a process flow of another method for starting up an electronic device provided in an embodiment of the present application;
[0031] Fig.10 A timing diagram for traversing a sensor list provided in an embodiment of the present application;
[0032] Fig.11 A timing diagram of another electronic device deleting a sensor list provided in an embodiment of the present application;
[0033] Fig.12 A schematic diagram of a process flow of another method for starting up an electronic device provided in an embodiment of the present application;
[0034] Fig.13 A timing diagram of another method for starting up an electronic device provided in an embodiment of the present application;
[0035] Fig.14 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0036] Fig.15 A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
[0037] Fig.16 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] The following terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, features defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "multiple" means two or more. In this application, the character " / " generally indicates that the objects associated with each other are in an "or" relationship. For example, A / B can be understood as A or B.
[0040] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not limited to the listed steps or modules, but may optionally include other steps or modules that are not listed, or may optionally include other steps or modules that are inherent to these processes, methods, products or devices.
[0041] In addition, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present concepts in a specific way.
[0042] See also Figure 1 , Figure 1 A schematic diagram of a scenario of starting up an electronic device is shown. Taking the electronic device as a mobile phone 1001 as an example, the mobile phone responds to the user's finger pressing the power button 1002, the mobile phone turns on, and enters the desktop of the mobile phone 1001.
[0043] At present, the power-on time of electronic devices is relatively long, which is caused by Figure 1 A to Figure 1 The b process is long, resulting in the power-on time of the electronic equipment not meeting the standard.
[0044] The following uses an Android-based product (such as a mobile phone) as an example.
[0045] See also Figure 2 , Figure 2 A partial log diagram of an electronic device is shown. Figure 2 As shown in a, the electronic device can check the log in the electronic device to find out that it takes a long time for the electronic device to start the sensor service. Figure 2 As shown in b, the electronic device can find out that the fusion perception (fusion_sense) sensor of the electronic device is a missing sensor (missing sensor) by further searching the corresponding part about the sensor service in the log, and gives up searching for the sensor after 8 seconds, that is, there is a timeout when the electronic device searches for fusion_sense.
[0046] Through analysis, it can be known that after the electronic device system is upgraded, the fusion sense has been moved from the HAL channel to another channel (also called the isf channel). Among them, the text file of the sensor list (sensors_list.txt) is stored in the persist partition of the electronic device, and the persist partition will not be overwritten during the upgrade process of the electronic device. Therefore, the electronic device will continue to use the text file of the sensor list before the upgrade during the upgrade process.
[0047] When the electronic device is powered on for the first time after the system upgrade, it will identify the fusion sense as a mandatory sensor in the hardware abstraction layer (HAL) channel and obtain the set user id (SUID) corresponding to the fusion sense. The isf channel is a module for placing fusion perception sensors. However, since some sensors of the electronic device may have changed their channels (for example, the fusion sense has been changed from the HAL channel to the isf channel), after the electronic device is upgraded, if the electronic device continues to use the text file of the sensor list before the upgrade, the electronic device may not be able to obtain the SUID of these sensors on the HAL channel, resulting in a timeout in the startup of the sensor service of the electronic device, which in turn affects the boot time of the electronic device.
[0048] The Hal layer can identify the type of sensor based on the SUID of the sensor, and the electronic device can determine whether the sensor has been initialized based on the SUID of the sensor. If the electronic device can obtain the corresponding SUID by scanning the sensor, the sensor has been initialized. If the electronic device cannot obtain the SUID of the sensor, the sensor has not been initialized.
[0049] Therefore, since the fusion sense path has changed, that is, the configuration path of the fusion sense has changed, the location of the fusion sense suid has also changed, that is, from the HAL path to the isf path, and the electronic device cannot obtain the fusion sense suid in the HAL path. As a result, the electronic device will be stuck in the HAL layer and try to obtain the fusion sense suid many times, resulting in a timeout for the electronic device to obtain the fusion sense suid. In addition, if the electronic device completes the boot process without obtaining the fusion sense suid, it may cause the electronic device to be unable to use the fusion sense normally after subsequent booting.
[0050] In other examples, during the upgrade process of an electronic device, some new sensors may be added. If the text file of the sensor list before the upgrade is still used after the electronic device is upgraded, the newly added sensors will not be found normally, resulting in the new sensors not being recognized and causing sensor malfunction.
[0051] In some other examples, some sensors may be deleted during the upgrade process of the electronic device. If, after the electronic device has completed the upgrade, the text file of the sensor list before the upgrade is still used, then since some sensors have been deleted in the electronic device, these deleted sensors cannot be found. As a result, the electronic device will search for sensors in the text file of the sensor list multiple times when traversing, thereby delaying the startup time of the sensor and causing the electronic device to take too long to start up.
[0052] See also Figure 3 , Figure 3 A flowchart of starting up an electronic device provided in an embodiment of the present application. Figure 3 As shown, the electronic device detects the power-on operation, responds to the power-on startup instruction, and then prepares the system operating environment. After the system operating environment of the electronic device is prepared, the electronic device starts the sensor service. Specifically, the electronic device can check the sensor list and verify whether each sensor in the sensor list is ready.
[0053] First, the electronic device determines whether there is a text file of a sensor list in the electronic device. If there is a text file of a sensor list in the electronic device, each sensor in the text file is matched with the acquired mandatory_sensor. Among them, the text file of the sensor list includes sensors of various types, and each sensor in the text file of the sensor list corresponds to a unique identifier. The mandatory_sensor acquired by the electronic device also includes multiple types of sensors. The above-mentioned matching of each sensor in the text file with the acquired mandatory_sensor refers to determining whether each sensor in the text file exists in the mandatory_sensor.
[0054] Then, the electronic device determines whether there is a target sensor in mandatory_sensor. If there is no target sensor in mandatory_sensor, the electronic device waits for a preset time (for example, 8 seconds) before continuing the subsequent boot process. If there is a target sensor in mandatory_sensor, the system starts and boots up normally. At this point, the sensor service is started, and if everything is ready, wait for the electronic device to start up. Finally, the electronic device starts up normally. The target sensor here refers to the sensor whose configuration path has been changed after the system version of the electronic device is updated.
[0055] If the text file of the sensor list does not exist in the electronic device, the electronic device will create a text file of the sensor list at the HAL layer. After receiving the creation request sent by the HAL layer, the sensor management (sensorhub) module of the electronic device initializes each sensor in the electronic device and reports the available initialized sensors to the HAL layer. The HAL layer writes the initialized sensors obtained from the sensorhub side into the text file to obtain the text file of the sensor list. At this point, the sensor service is started, and if everything is ready, wait for the electronic device to start up. Finally, the electronic device starts up normally.
[0056] The above problem may occur during the boot process of an electronic device after a system version update (such as a system version upgrade or factory reset). If the target sensor does not exist in mandatory_sensor, the boot process will continue after waiting for a preset time, causing the electronic device to take too long to start the sensor service, thereby causing the electronic device to take too long to boot up.
[0057] See also Figure 4 , Figure 4 This is a schematic diagram of the architecture of an electronic device startup process provided by an embodiment of the present application. Figure 4 As shown, the electronic device is turned on and the AP side is started, the data of the electronic device is loaded, and each service process is started. Then, the electronic device starts the sensor service. Specifically, the electronic device determines whether there is a text file of the sensor list in the electronic device. If the text file of the sensor list does not exist in the electronic device, the electronic device creates a new text file of the sensor list based on the initialized sensors. At this time, there is no change between the sensors in the electronic device and the individual sensors in the text file of the newly created sensor list, so there is no abnormality in the electronic device traversing the sensor list.
[0058] If there is a text file of a sensor list in the electronic device, the sensors in the electronic device are traversed according to the text file of the sensor list, and the sensor initialization is waited for completion. Among them, the electronic device determines whether there are any sensors changed in the text file of the sensor list before and after the system upgrade. If the text file of the sensor list after the system upgrade is changed compared with the text file of the sensor list before the system upgrade, for example, some sensors are deleted in the electronic device after the system upgrade, then the text file of the sensor list after the system upgrade reduces the information of some sensors compared with the text file of the sensor list before the system upgrade. Among them, if some sensors in the electronic device are deleted after the system upgrade, then, since the electronic device will search for the deleted sensor in the HAL layer many times after starting the sensor service, it will cause problems such as the electronic device booting timeout.
[0059] If the text file of the sensor list after the system upgrade is the same as the text file of the sensor list before the system upgrade, then the electronic device has no abnormality when traversing the sensor list. At this point, the sensor service of the electronic device is successfully started and waits for the sensorhub side of the electronic device to identify the identification of each sensor. Finally, the electronic device completes normal startup.
[0060] In order to solve the above problems, an embodiment of the present application provides a method for starting up an electronic device, which completes the startup of the electronic device by deleting the current sensor list during the startup phase of the electronic device, and automatically scanning multiple sensors that have been initialized in the electronic device by the electronic device. As a result, the electronic device will not traverse the sensors based on the sensor list, but will automatically scan multiple sensors that have been initialized after deleting the sensor list. If a sensor is added, deleted, or the configuration path of the electronic device is changed after the system version is updated, the electronic device will not always scan the deleted or changed sensors, which can shorten the scanning time and will not miss the scanning of the newly added sensors, so that the newly added sensors can work normally after startup.
[0061] Next, the embodiment of the present application introduces in detail a method for starting up an electronic device, which is applied to the electronic device. Figure 5 As shown, please refer to step S101-step S103.
[0062] Step S101: The electronic device deletes a sensor list in response to a power-on instruction.
[0063] In an embodiment of the present application, the electronic device may receive a user's touch operation on a power button of the electronic device and generate a power-on start instruction for the electronic device. The touch operation may include a press operation, which is not limited in the present application. In response to the power-on start instruction, the electronic device first starts the sensor service.
[0064] See also Figure 6 , Figure 6 A schematic diagram of a process for starting a sensor service provided by an embodiment of the present application. The service manager module (service manager) is a system service, which is started by the initialization (init) process, wherein the init process reads the configuration to be started through the init.rc file. Figure 6As shown, the electronic device runs the init process and parses the init.rc file. Among them, the init.rc file is an important configuration file of the system, which configures some important services. The init process starts these services by creating child processes. Then, the electronic device starts the basic service. Specifically, the electronic device executes the start service manager command, which will start a servicemanager that is not in operation. Then, since the specific service information is named and defined in the servicemanger.rc file, the electronic device parses the servicemanager.rc file and executes the init.vendor.sensors.rc command to finally start the sensor service.
[0065] After the electronic device starts the sensor service, it deletes the existing sensor list in the current electronic device. The sensor list includes information about sensors that have been initialized during the historical startup process of the electronic device. For example, the sensor list includes the name, type, and corresponding unique identifier of the sensor. It can be understood that the sensor list here is the text file (sensors_list.txt) of the sensor list in the above embodiment.
[0066] Step S102: The electronic device scans each sensor in the current electronic device that has been initialized.
[0067] In the embodiment of the present application, since the electronic device has deleted the existing sensor list, there is no sensor list in the electronic device at this time, so the electronic device can automatically scan each sensor that has been initialized in the electronic device.
[0068] Therefore, if some sensors are deleted or the configuration paths of some sensors are changed in the text file of the sensor list obtained by the electronic device after the system version is updated, the electronic device will not always identify and obtain the SUID of the deleted sensors or the SUID of the sensors whose configuration paths are not in the HAL path based on the previous text file of the sensor list, but will automatically traverse each sensor in the electronic device, which can save the waiting time (for example, 8 seconds) for the electronic device to obtain the SUID of the deleted sensors or the SUID of the sensors whose configuration paths are not in the HAL path, thereby shortening the boot time.
[0069] Also, if some sensors are added to the text file of the sensor list obtained by the electronic device after the system version is updated, the electronic device will not traverse the various sensors in the sensor list based on the previous text file of the sensor list, resulting in the problem of not being able to normally identify the newly added sensors. After deleting the text file of the existing sensor list, the electronic device automatically traverses the various sensors that have been initialized in the electronic device, and can identify the newly added sensors in the electronic device, solving the problem of sensor function failure caused by failure to identify the newly added sensors.
[0070] After the electronic device automatically traverses each sensor that has been initialized in the electronic device, a text file of a new sensor list may be generated according to the acquired sensor types.
[0071] Step S103: After the electronic device completes scanning of the multiple sensors, it starts up.
[0072] In summary, the electronic device can avoid traversing each sensor through the sensor list by deleting the existing sensor list during the startup phase through the above-mentioned electronic device startup method, so that the electronic device automatically scans multiple sensors that have been initialized in the electronic device, and can solve the problem that when there is a sensor deletion after the system version of the electronic device is updated, the electronic device will not always scan the deleted sensor according to the sensor list, resulting in a startup timeout. In addition, when there is a new sensor added after the system version of the electronic device is updated, the electronic device can automatically scan multiple sensors that have been initialized, and will not miss scanning the newly added sensor, so that the performance of the newly added sensor will not fail due to failure to scan the newly added sensor.
[0073] Among them, if there is a sensor deletion after the system version of the electronic device is updated, it may include directly deleting the sensor, or it may also include changing the name of the sensor, then the sensor can be considered to have been deleted in the sensor list.
[0074] See also Figure 7 , Figure 7 A schematic diagram of a flow chart of deleting a sensor list of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the AP side of the electronic device is started and enters the startup process. The various data in the electronic device are loaded, and the various service processes start. Then, the electronic device starts the sensor service. After the electronic device starts the sensor service, the electronic device deletes the text file of the current sensor list. The sensor service of the electronic device is successfully started, and waits to obtain the identification of each sensor recognized by the sensorhub side. Finally, the electronic device starts normally.
[0075] See also Figure 8 , Figure 8 This is a timing diagram of deleting a sensor list of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the system initialization process of the electronic device is loaded and the system service (systemserver) is started. The main method of the system service (systemserver) is executed in Zygote, causing its run method to be called.
[0076] Then, the system service (systemserver) loads the local library file and obtains the local method by calling system.loadlibrary("andriod_server"):. Then, System.loadlibrary is loaded into the JNI library file, causing the JNI_Onload function to be called; calling the local JNI file. The function array bound by the JNI file com_android_server_SystemServer.cpp is bound to the android_server_system_startsensorservice function by the Java start sensor service (startsensorservice) method.
[0077] Then, call the inistantiate function of the sensorservice.
[0078] Finally, the getservice in the sensorservice file starts the sensors2.0 service, and when scanning the init.vendor.sensors.rc file, the command to delete the sensor list (sensors_list) is executed using the on early-boot control.
[0079] The above-mentioned method for starting up an electronic device is simple to implement. After deleting the sensor list, the electronic device automatically scans multiple sensors that have been initialized in the electronic device, which can shorten the time wasted because the sensors have been deleted and cannot be scanned, thereby shortening the startup time and solving the problem of performance failure of new sensors caused by failure to scan new sensors.
[0080] In the above-mentioned method for starting up the electronic device, each time the electronic device is started up, it needs to go through steps S101 to S103.
[0081] The present application also provides a method for starting up an electronic device. Fig. 9 As shown, please refer to step S201-step S204.
[0082] Step S201: The electronic device obtains the startup information of the electronic device in response to the startup instruction.
[0083] In response to the power-on instruction, the electronic device first starts the sensor service, wherein the specific steps of starting the sensor service in step S101 may be referred to, and will not be described in detail here.
[0084] The startup information of the electronic device is used to indicate whether the current startup of the electronic device is the first startup of the electronic device after the system version is updated. The system version update of the electronic device may include upgrading the system version of the electronic device or restoring the system version to factory settings.
[0085] The startup information of the electronic device can be set to a first preset value and a second preset value. If the startup information is the first preset value, it indicates that this startup is the first startup of the electronic device after the system version is updated, and if the startup information is the second preset value, it indicates that this startup is not the first startup of the electronic device after the system version is updated.
[0086] Before the electronic device obtains the power-on information, the electronic device may set a preset value for the power-on information according to whether the current power-on is the first power-on of the electronic device after the system version is updated. Specifically, if the current power-on is the first power-on of the electronic device after the system version is updated, the power-on information of the electronic device is set to the first preset value. If the current power-on is not the first power-on of the electronic device after the system version is updated, the power-on information of the electronic device is set to the second preset value.
[0087] Step S202: If the startup information indicates that the current startup of the electronic device is the first startup of the electronic device after the system version is updated, the electronic device deletes the current sensor list.
[0088] In the embodiment of the present application, since the electronic device may add or delete sensors in the sensor list after the system version is updated, the current sensor list in the electronic device cannot include multiple sensors that have been initialized in the electronic device. If the electronic device traverses the sensors in the sensor list based on the current sensor list, it may fail to scan the deleted sensors or miss the newly added sensors. Therefore, if the power-on information indicates that the electronic device is powered on for the first time after the system version is updated, the electronic device can delete the current sensor list.
[0089] After the electronic device obtains the power-on information, if the electronic device reads the power-on information as the first preset value, then the current power-on of the electronic device is the first power-on of the electronic device after the system version is updated. At this time, the electronic device deletes the current sensor list.
[0090] Among them, since the electronic device has a pre-set scanning rule for the sensor, that is, if there is a text file of the sensor list in the electronic device, the electronic device will traverse the sensors in the sensor list based on the text file of the sensor list. If there is no text file of the sensor list in the electronic device, the electronic device will scan multiple sensors that have been initialized in the electronic device, thereby generating a new text file of the sensor list. At this time, after the electronic device deletes the current sensor list, the electronic device will automatically scan multiple sensors that have been initialized in the electronic device.
[0091] Step S203: the electronic device scans each sensor in the current electronic device that has been initialized.
[0092] In the embodiment of the present application, after the electronic device scans each sensor that has been initialized in the current electronic device, a new sensor list can be generated based on each sensor currently scanned.
[0093] Specifically, the electronic device initializes each sensor in the electronic device through the sensor management module, and obtains the initialized sensors. Then, the electronic device generates a new sensor list based on the initialized sensors.
[0094] If the startup information indicates that the current startup of the electronic device is not the first startup of the electronic device after the system version is updated, that is, the system version of the electronic device is not updated compared to the previous startup, then there is no new sensor or deleted sensor in the sensor list of the electronic device. Therefore, the electronic device can scan multiple sensors in the sensor list based on the sensor list generated at the first startup.
[0095] Specifically, after the electronic device obtains the power-on information, the electronic device reads the power-on information as the second preset value, then the current power-on of the electronic device is not the first power-on of the electronic device after the system version is updated. At this time, the electronic device scans multiple sensors in the sensor list.
[0096] See also Fig.10 , Fig.10 A timing diagram of an electronic device traversing a sensor list provided in an embodiment of the present application. When the sensor service (sensorservice) inherits from RefBase, the corresponding first reference (onFirstRef) method will be executed to obtain the sensor device (SensorDevice) object. Among them, RefBase has only one constructor, and the access rights are protected. onFirstRef() belongs to its parent class RefBase. When the strong reference sp adds a reference count, the first strong reference will automatically call this function.
[0097] Among them, after creating (new) several objects, SensorService.cpp can enter the threadLoop method of each parent class Threah by calling the SensorEventAckReceiver:run() method and the SensorService() method.
[0098] SensorService.cpp calls the getinstance method to send a call message to SensorDevice. SensorService.cpp gets a SensorDevice instance object, SensorDevice&dev(SensorDevice::getInstance()); The getinstance method mainly uses the getinstance function of this class in the main function to get the class object that the system has currently instantiated. If the current system has not instantiated this class object, the constructor of this class is called.
[0099] Then, SensorDevice loads the HAL library and searches for the module with the corresponding module ID "sensors" in the hal. Specifically, SensorDevice executes hw_get_module(SENSORS_HARDWARE_MODULE_ID,(hw_module_t const**)&mSensorModule) to get mSensorModule from Sensor.cpp of the HAL layer.
[0100] After receiving the call message, SensorDevice opens the sensor device by calling the sensor_open method of sensor.h. Specifically, SensorDevice executes sensors_open_1: module->methods->open to call the open function. In addition to the device information, hw_module_t provides another structure hw_module_methods_t, which has only one open function and calls the open callback registered by the device. Let the caller get the device structure based on hw_device_t, which contains hw_module_t. The core content of HAL is to obtain hw_device_t, transform it upward, and obtain the device data structure and function interface.
[0101] Then, SensorDevice sends the get_sensors_list command to Sensor.cpp to get the sensor list initialized by the chip vendor in the HAL layer and return the number of sensors. On the qcom platform, the actual control in the HAL layer is through NativeSensorManager, which also returns the sensorlist in the singleton NativeSensorManager object and the number of sensors.
[0102] SensorDevice executes active in a for loop according to the number of sensors.
[0103] Then, SensorDevice is constructed, and the SensorService obtains the instance object SensorDevice dev. Then, the SensorService obtains sensorlist and the number of sensors; the calling process is the same as above.
[0104] The sensor service (SensorService) registers sensors to the sensor service (SensorService) in a for loop according to the number of sensors. The registration process is to create the corresponding hardware sensor (HardwareSensor).
[0105] Therefore, through the above steps, the electronic device can complete the traversal of multiple sensors in the sensor list.
[0106] Step S204: After the electronic device completes scanning of each sensor, it starts up.
[0107] See also Fig.11 , Fig.11 This is a timing diagram of another electronic device deleting a sensor list provided in an embodiment of the present application. Fig.11 As shown, the system initialization process of the electronic device is loaded and the system service (systemserver) is started. The main method of the system service (systemserver) is executed in Zygote, causing its run method to be called.
[0108] Then, the system service (systemserver) loads the local library file and obtains the local method by calling System.loadlibrary("andriod_server"):. Then, System.loadlibrary is loaded into the JNI library file, causing the JNI_Onload function to be called; calling the local JNI file.
[0109] Among them, the system service (systemserver) starts the boot service (startBootstrapService) to set the property (prop) item persist.sys.isfirstboot to, if this boot is the first boot of the electronic device after the system version is updated, it is Yes, if this boot is not the first boot of the electronic device after the system version is updated, it is No. The prop item here is the boot information in the above embodiment, Yes is the first preset value, and No is the second preset value.
[0110] Then, the function array bound by the JNI file com_android_server_SystemServer.cpp has the Java start sensor service (startsensorservice) method bound to the android_server_system_startsensorservice function.
[0111] Then, call the inistantiate function of the sensorservice.
[0112] Finally, in the sensor service (sensorservice) file, get the service (getservice) to start the sensors2.0 service. When scanning the init.vendor.sensors.rc file, get the prop item persist.sys.isfirstboot to see if it is Yes. If it is Yes, the electronic device determines that this boot is the first boot of the electronic device after the system version is updated. At this time, the electronic device deletes the sensor list. If it is No, the electronic device determines that this boot is not the first boot of the electronic device after the system version is updated. At this time, the electronic device traverses multiple sensors in the sensor list based on the sensor list.
[0113] In summary, the above-mentioned electronic device startup method provided in the embodiment of the present application determines whether to traverse each sensor through the current sensor list by setting the startup information to indicate whether the current startup of the electronic device is the first startup after the system version of the electronic device is updated. Only when the startup information indicates that the current startup of the electronic device is the first startup after the system version of the electronic device is updated, the electronic device will delete the current sensor list and automatically scan the multiple sensors that have been initialized in the current electronic device. This can solve the problem that when there is a sensor deletion after the system version of the electronic device is updated, the electronic device will not always scan the deleted sensors according to the sensor list, resulting in a startup timeout. In addition, when there is a new sensor added after the system version of the electronic device is updated, the electronic device can automatically scan the multiple sensors that have been initialized, and will not miss scanning the newly added sensor, so that the performance of the newly added sensor will not fail due to the failure to scan the newly added sensor.
[0114] Then, when the electronic device is not turned on for the first time after the system version is updated, the initialized sensors in the new sensor list can be directly traversed according to the new sensor list generated when the device is turned on for the first time. As a result, the electronic device will delete the current sensor list only when the electronic device is turned on for the first time after the system version is updated, and when the electronic device is not turned on for the first time, the electronic device directly traverses the sensors in the new sensor list according to the new sensor list, which saves the operation of deleting the sensor list when the device is not turned on for the first time, can reduce unnecessary operations and waiting when the device is not turned on for the first time, improves the startup efficiency of the electronic device, and shortens the startup time of the electronic device.
[0115] The present application embodiment also provides another electronic device power-on method, which can be applied to the electronic device. Fig.12 As shown, please refer to step S301-step S302.
[0116] Step S301: In response to a power-on instruction, the electronic device traverses a plurality of initialized first sensors and skips traversing second sensors.
[0117] In response to the power-on instruction, the electronic device first starts the sensor service, wherein the specific steps of starting the sensor service in step S101 may be referred to, and will not be described in detail here.
[0118] After starting the sensor service, the electronic device can compare the configuration path of each sensor in the electronic device under the current system version with the configuration path under the historical system version, and set the sensor whose configuration path under the current system version is different from the configuration path under the historical system version as the second sensor, and set the sensor whose configuration path under the current system version is the same as the configuration path under the historical system version as the first sensor.
[0119] Among them, the second sensor may include at least one of the following: a sensor newly added to the electronic device after the system version is updated; a sensor deleted by the electronic device after the system version is updated; and a sensor whose configuration path is changed after the system version is updated. Among them, the sensor newly added to the electronic device after the system version is updated refers to a sensor that does not exist under the historical system version but is newly added under the current system version. The sensor deleted by the electronic device after the system version is updated refers to a sensor that existed under the historical system version but was deleted under the current system version. The sensor whose configuration path is changed after the system version is updated refers to a sensor whose configuration path under the current system version is different from the configuration path under the historical system version.
[0120] Take the sensor fusion sense in the electronic device as an example. After the system version of the electronic device is updated, the configuration path of the fusion sense is changed from the HAL path to the isf path. Therefore, the electronic device can set the sensor fusion sense as the second sensor, and other sensors in the electronic device whose configuration paths have not been changed are set as the first sensor. It can be understood that the above-mentioned first sensor is an initialized and available sensor in the electronic device.
[0121] The sensor list includes information about sensors that have been initialized during the historical startup process of the electronic device.
[0122] After starting the sensor service, the electronic device needs to traverse each sensor in the electronic device at the HAL layer to obtain information from each sensor and finally complete the startup of the electronic device. Therefore, the electronic device can traverse multiple first sensors and skip traversing the second sensor, saving the time wasted by the electronic device at the HAL layer due to multiple attempts due to failure to obtain information from the second sensor, which ultimately causes the startup time to be too long.
[0123] The electronic device traversing the plurality of first sensors and skipping traversing the second sensor may include directly skipping the second sensor and only acquiring information of the first sensor when traversing the sensor list of the electronic device.
[0124] Step S302: After the electronic device completes traversing the plurality of first sensors, it performs power-on startup.
[0125] In summary, in the above-mentioned electronic device startup method, when the electronic device traverses each sensor in the sensor list, it can directly skip the second sensor and only traverse the first sensor. Since the configuration path of the second sensor is no longer in the HAL layer, the electronic device will not be in a waiting state due to the failure to scan the second sensor in the HAL layer, and the electronic device shortens the time to traverse the sensors, thereby shortening the startup time of the electronic device.
[0126] See also Fig.13 , Fig.13 This is a timing diagram of another method for starting up an electronic device provided in an embodiment of the present application. Fig.13 As shown, the system initialization process of the electronic device is loaded and the system service (systemserver) is started. The main method of the system service (systemserver) is executed in Zygote, causing its run method to be called.
[0127] Then, the system service (systemserver) loads the local library file and obtains the local method by calling system.loadlibrary("andriod_server"):. Then, system.loadlibrary is loaded into the JNI library file, causing the JNI_Onload function to be called; calling the local JNI file. The function array bound by the JNI file com_android_server_SystemServer.cpp is bound to the android_server_system_startsensorservice function by the Java start sensor service (startsensorservice) method.
[0128] Then, call the inistantiate function of the sensor service.
[0129] Finally, the get service in the sensor service file starts the sensors 2.0 service. In the init_mandatory_list_db function in the sensor_factory.cpp file, add the type of sensor to determine. When traversing the sensor list, if there is fusion_sense (the second sensor), skip the sensor directly without waiting for the sensor to complete initialization.
[0130] It is understandable that since the configuration path of the second sensor is no longer in the HAL layer, the electronic device skips the second sensor in the HAL layer, but the electronic device can also obtain the information of the second sensor in the configuration path after the second sensor is replaced by other means, which will not affect the normal implementation of the function of the second sensor.
[0131] In summary, the electronic device startup method provided in the embodiment of the present application can complete the startup of the electronic device by deleting the current sensor list during the startup phase of the electronic device, and automatically scanning multiple sensors that have been initialized in the electronic device by the electronic device. As a result, the electronic device will not traverse the sensors based on the current sensor list, but will automatically scan multiple sensors that have been initialized after deleting the sensor list. If a sensor is added, deleted, or the configuration path of the electronic device is changed after the system version is updated, the electronic device will not always scan the deleted or changed sensors, which can shorten the scanning time and will not miss the scanning of the newly added sensors, so that the newly added sensors can work normally after startup.
[0132] Alternatively, the electronic device may traverse multiple initialized first sensors and skip traversing the second sensor during the startup phase of the electronic device, and after the electronic device completes traversing the multiple first sensors, the startup is performed. Thus, if the configuration path of the second sensor of the electronic device is changed in the electronic device after the system version is updated, the electronic device can skip traversing the second sensor and only traverse the first sensor, thereby shortening the time it takes for the electronic device to start the sensor service, thereby shortening the startup time of the electronic device.
[0133] The execution subject of the electronic device startup method provided in the embodiment of the present application may be a device for starting up the electronic device, and the execution device may be Fig.14 The electronic device shown. At the same time, the execution device can also be a central processing unit (CPU) of the electronic device, or a control module in the electronic device for starting up the electronic device. In the embodiment of the present application, an electronic device executing the electronic device starting method is taken as an example to illustrate the electronic device starting method provided by the embodiment of the present application.
[0134] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings. Fig.14The structure diagram of an electronic device 100 is shown. The electronic device 100 may include at least one of a mobile phone, a foldable electronic device, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device, or a smart city device. The specific type of the electronic device 100 is not particularly limited in the embodiment of the present application.
[0135] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) connector 130, a charging management module 140, a power management module, a battery, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker, a receiver, a microphone, an earphone interface, a sensor module 180, a button 190, a motor, an indicator, a camera, a display screen, and a subscriber identification module (SIM) card interface, etc. The sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc. The sensors that have been initialized in the embodiment of the present application may include the above sensors.
[0136] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0137] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0138] The processor can generate operation control signals based on instruction opcodes and timing signals to complete the control of instruction fetching and execution.
[0139] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 may be a cache memory. The memory may store instructions or data that have been used or are frequently used by the processor 110. If the processor 110 needs to use the instruction or data, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0140] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 may be connected to a touch sensor, an audio module, a wireless communication module, a display, a camera, and other modules through at least one of the above interfaces.
[0141] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0142] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0143] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0144] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0145] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), bluetooth low energy (BLE), ultra wide band (UWB), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0146] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other electronic devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0147] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card. Or files such as music and videos are transferred from the electronic device to the external memory card.
[0148] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional methods or data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.
[0149] Some other embodiments of the present application provide an electronic device. The electronic device may include: a communication module, a memory, and one or more processors; the communication module, the memory, and the processor are coupled. The memory is also used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device can perform the various functions or steps performed by the electronic device in the above method embodiment. The structure of the electronic device can refer to Fig.14 The structure of the electronic device 100 is shown.
[0150] like Fig.15 As shown, it is a diagram of the software architecture inside the electronic device. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the internal architecture of the electronic device can be divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (ART) and the native C / C++ library, the hardware abstract layer (HAL) and the kernel layer.
[0151] The application layer can include a series of application packages.
[0152] like Fig.15 As shown, the application package may include applications such as gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0153] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0154] like Fig.15 As shown, the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, an activity manager, an input manager, and the like.
[0155] The window manager provides window management services (WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.
[0156] Content providers are used to store and retrieve data and make it accessible to applications. This data can include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0157] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0158] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0159] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0160] The activity manager can provide activity management services (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers) as well as manage and schedule application processes.
[0161] The input manager can provide input management services (IMS), which can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes events from input device nodes and distributes them to appropriate windows through interaction with WMS.
[0162] In the embodiment of the present application, the application framework layer sets the first preset value or the second preset value for the startup information of the electronic device according to whether the electronic device is started for the first time after the system version is updated. The init.rc file in the application framework layer deletes the sensor list.
[0163] The Android runtime includes the core library and the Android runtime. The Android runtime is responsible for converting source code into machine code. The Android runtime mainly uses the ahead of time (AOT) compilation technology and the just in time (JIT) compilation technology.
[0164] The core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks, etc. The core library provides an API for users to develop Android applications.
[0165] The native C / C++ library can include multiple functional modules, such as surface manager, media framework, libc, OpenGL ES, SQLite, Webkit, etc.
[0166] Among them, the surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. OpenGL ES provides drawing and operation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for applications of electronic device 100.
[0167] The hardware abstraction layer runs in user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer. The hardware abstraction layer includes at least a display module, an audio module, a camera module, and a sensor module. In the embodiment of the present application, the hardware abstraction layer scans the initialized sensors in the electronic device and generates a new sensor list.
[0168] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0169] The electronic device power-on methods in the aforementioned embodiments can all be implemented in the electronic device 100 having the aforementioned hardware structure and software structure.
[0170] The present application also provides a chip system, such as Fig.16As shown, the chip system 1500 includes at least one processor 1501 and at least one interface circuit 1502. The processor 1501 and the interface circuit 1502 can be interconnected through lines. For example, the interface circuit 1502 can be used to receive signals from other devices (such as a computer's memory). For another example, the interface circuit 1502 can be used to send signals to other devices (such as the processor 1501). Exemplarily, the interface circuit 1502 can read instructions stored in the memory and send the instructions to the processor 1501. When the instruction is executed by the processor 1501, the computer can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0171] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device (such as a mobile phone), the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.
[0172] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile phone in the above method embodiment. The computer may be an electronic device, such as a mobile phone.
[0173] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0174] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0175] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0176] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0177] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0178] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for starting up an electronic device, characterized in that: Applied to electronic equipment, the method comprises: The electronic device obtains the power-on information of the electronic device in response to the power-on startup instruction; If the startup information indicates that the current startup of the electronic device is the first startup of the electronic device after the system version is updated, the electronic device deletes the sensor list; wherein the sensor list includes information of sensors that have been initialized during the historical startup process of the electronic device; the sensor list includes sensors whose configuration paths are changed after the system version is updated, or sensors deleted after the system version is updated; The electronic device scans various sensors that have been initialized in the current electronic device; wherein the various sensors that have been initialized in the electronic device do not include sensors whose configuration paths are changed after the system version is updated, or sensors that are deleted after the system version is updated; After the electronic device completes scanning of the various sensors, power-on startup is performed.
2. The method according to claim 1, characterized in that After the electronic device scans each sensor that has been initialized in the electronic device, the method further includes: The electronic device generates a new sensor list based on each sensor currently scanned.
3. The method according to claim 2, characterized in that The method further comprises: If the startup information indicates that the current startup of the electronic device is not the first startup of the electronic device after the system version is updated, the electronic device traverses multiple sensors in the new sensor list.
4. The method according to claim 2 or 3, characterized in that: The electronic device generates a new sensor list based on each sensor currently scanned, including: The electronic device initializes each sensor in the electronic device through the sensor management module, and obtains the initialized sensors; The electronic device generates the new sensor list based on each sensor that has been initialized.
5. The method according to claim 2 or 3, characterized in that: Before obtaining the power-on information of the electronic device, the method further includes: If this startup is the first startup of the electronic device after the system version is updated, the electronic device sets the startup information to a first preset value; wherein the startup information is the first preset value indicating that this startup is the first startup of the electronic device after the system version is updated; If this startup is not the first startup of the electronic device after the system version is updated, the electronic device sets the startup information to a second preset value; wherein the startup information is the second preset value indicating that this startup is not the first startup of the electronic device after the system version is updated.
6. The method according to claim 5, characterized in that If the startup information indicates that the current startup of the electronic device is the first startup of the electronic device after the system version is updated, the electronic device deletes the current sensor list, including: When the electronic device reads that the power-on information is the first preset value, the current sensor list is deleted; If the startup information indicates that the current startup of the electronic device is not the first startup of the electronic device after the system version is updated, the electronic device traverses multiple sensors in the sensor list, including: When the electronic device reads that the power-on information is the second preset value, it traverses multiple sensors in the sensor list.
7. A method for starting up an electronic device, characterized in that: Applied to electronic equipment, the method comprises: The electronic device, in response to a power-on instruction, traverses a plurality of first sensors in a sensor list that have been initialized and skips traversing a second sensor; wherein the sensor list includes information about sensors that have been initialized during a historical power-on process of the electronic device; a configuration path for the second sensor by a current system version of the electronic device is different from a configuration path for the second sensor by a historical system version of the electronic device; the second sensor includes at least one of the following: a sensor newly added to the electronic device after a system version update; and a sensor whose configuration path is changed after a system version update; the configuration path for the first sensor by the current system version of the electronic device is the same as a configuration path for the first sensor by a historical system version of the electronic device; the configuration path of the second sensor is not in a hardware abstraction layer; After the electronic device completes traversing the plurality of first sensors, power-on startup is performed.
8. An electronic device, characterized in that: The electronic device comprises: a communication module, a memory and one or more processors; the communication module, the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code comprises computer instructions, and when the computer instructions are executed by the electronic device, the electronic device executes the method as described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed in an electronic device, the electronic device executes the method according to any one of claims 1 to 7.
