Device control method, readable storage medium, program product and electronic device

By backing up battery control data in the memory of electronic devices, the problem of battery control data acquisition caused by abnormal access to permanent storage areas is solved, ensuring the reliability and security of battery management.

CN118409906BActive Publication Date: 2025-03-18HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410821179.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2025-03-18
Estimated Expiration
2044-06-24

AI Technical Summary

Technical Problem

In electronic devices, the permanent storage area is abnormally accessed or the battery control data cannot be updated after the battery is replaced, resulting in the inability to obtain or obtain incorrect battery control data, affecting battery management and security.

Method used

By backing up battery control data in persistent partitions and other partitions of the memory (such as OEM partitions, data partitions), it is ensured that in the case of abnormal persistent partitions, electronic devices can obtain at least part of the battery control data from other partitions and perform battery control.

Benefits of technology

It is realized that when persistent partition abnormalities, electronic devices can still obtain battery control data, ensuring the reliability and security of battery management, and avoiding battery control failures caused by data loss or errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118409906B_ABST
    Figure CN118409906B_ABST
Patent Text Reader

Abstract

The present application relates to the field of storage technology, and in particular to a device control method, a readable storage medium, a program product, and an electronic device. The device control method is applied to an electronic device, wherein a persistent partition in the memory of the electronic device stores battery control data, and at least part of the battery control data is backed up in an original equipment manufacturer partition and a data partition. When the persistent partition is abnormal, the battery control data can be obtained from the original equipment manufacturer partition or the data partition. When the persistent partition and the data partition are abnormal, the battery control data can be obtained from the original equipment manufacturer partition. This ensures that the electronic device obtains the correct battery control data to control the battery.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage, and in particular to a device management and control method, a readable storage medium, a program product, and an electronic device. Background Art

[0002] At present, some electronic devices are equipped with permanent storage areas for storing some key business data, such as data for battery power limit control, to ensure that the corresponding key business data is not lost when the electronic device is restored to factory settings or flashed, thereby ensuring that the key business of the electronic device can be executed normally.

[0003] For example, in some electronic devices, data for battery safety management and control (such as battery power limit identification, battery serial number, battery cycle count, battery capacity and other battery management information, hereinafter referred to as battery management and control data) can be stored in the permanent storage area. When a risk is detected in the battery of an electronic device, the electronic device can perform safety management and control on the battery based on the battery management and control data (for example, limiting the power of the battery, prompting the user to replace the battery, etc.).

[0004] However, in some cases, such as abnormal access to the permanent storage area, or failure to write the battery management data corresponding to the new battery into the permanent storage area after replacing the battery, the electronic device may be unable to obtain the corresponding battery management data from the permanent storage area or obtain incorrect battery management data, resulting in the inability to perform battery management services normally. Summary of the invention

[0005] The embodiments of the present application provide a device management method, a readable storage medium, a program product and an electronic device, so that when a persistent partition storing battery management data is abnormal, the electronic device can obtain at least part of the battery management data from the original equipment manufacturer partition, thereby performing battery management.

[0006] In a first aspect, an embodiment of the present application provides a device management method, which is applied to an electronic device, wherein the electronic device includes a memory, the memory includes a persistent partition and a first partition, the first partition includes an original equipment manufacturer partition, and the persistent partition stores first battery management data; the method includes: detecting an instruction to manage a battery of the electronic device; corresponding to an abnormal reading of the first battery management data in the persistent partition, managing the battery based on the second battery management data backed up in the first partition.

[0007] Exemplarily, in some embodiments of the present application, the first battery control data may also be referred to as battery control data. After receiving the battery control data, the electronic device stores the battery control data in a persistent partition and backs it up to the OEM partition, wherein the storage space of the OEM partition is relatively small. Therefore, the OEM partition can store key data in the battery control data. Both the OEM partition and the persistent partition are permanent storage areas (for example, partitions that will not lose data during application version updates, electronic device system updates, electronic device flashing, or electronic device factory settings restoration). The persistent partition may be unable to read and store data in the electronic device due to situations such as the file being full. At this time, the electronic device can read the key data in the battery control data from the OEM partition and perform basic battery control. This allows for better management of the battery of the electronic device, ensuring that the electronic device can perform basic battery control.

[0008] In a possible implementation of the first aspect above, the reading of the first battery management and control data in the above persistent partition is abnormal, including: the first battery management and control data read from the persistent partition does not match the second battery management and control data read from the first partition; or the first battery management and control data cannot be read from the persistent partition.

[0009] Exemplarily, when the space in the persistent partition cannot store new battery control data, the battery control data read by the electronic device from the persistent partition is old battery control data, so the electronic device may read old battery control data from the persistent partition, causing the first battery control data read by the electronic device from the persistent partition to be different from the second battery control data read from the first partition.

[0010] Alternatively, when the electronic device reads the first battery control data from the persistent partition, it needs to decompress the first battery control data and other operations need to occupy part of the persistent partition's space, but the persistent partition's files are already full. As a result, the electronic device cannot read the first battery control data from the persistent partition, and therefore the first battery control data in the persistent partition is read abnormally.

[0011] In a possible implementation of the first aspect above, the first partition also includes a data partition, and the second battery control data includes first sub-data and second sub-data; wherein the first sub-data is stored in the original equipment manufacturer partition, and the second sub-data is stored in the data partition; and the number of battery control parameters corresponding to the first sub-data is less than the number of battery control parameters corresponding to the first battery control data, and the number of battery control parameters corresponding to the second sub-data is the same as the number of battery control parameters corresponding to the first battery control data.

[0012] Exemplarily, in some embodiments of the present application, the electronic device may also store the battery management data in the data partition. The data in the data partition cannot be stored permanently. For example, the data in the data partition will be lost when the application version is updated, the electronic device system is updated, the electronic device is flashed, or the electronic device is restored to factory settings. However, the data partition has a large storage space and can store complete battery management data. In the case of an abnormal reading of the battery management data of the persistent partition, if the second sub-data of the data partition matches the first sub-partition of the original equipment manufacturer partition, the complete battery management data can be read from the data partition to manage the battery.

[0013] The first sub-data may be at least part of the battery management and control data stored in the OEM partition, and the second sub-data may be the complete battery management and control data stored in the data partition.

[0014] In a possible implementation of the first aspect above, the first battery management and control data read from the persistent partition does not match the second battery management and control data read from the first partition, including: the first sub-data does not match the first battery management and control data, and the second sub-data does not match the first battery management and control data.

[0015] In a possible implementation of the first aspect above, the battery is controlled based on the second battery control data backed up in the first partition, including: corresponding to the first sub-data matching the second sub-data, the battery is controlled using the second sub-data; corresponding to the first sub-data not matching the second sub-data, the battery is controlled using the first sub-data.

[0016] For example, in some embodiments of the present application, the second battery control data also includes the first sub-data and the second sub-data. Therefore, when the second battery control data is used to control the battery, it is also necessary to select data without abnormalities from the first sub-data and the second sub-data to control the battery.

[0017] Exemplarily, when the first sub-data matches the second sub-data, it can be determined that both the first sub-data and the second sub-data are correct data, and since the second sub-data stored in the data partition is complete battery management data, the second sub-data can be selected to manage the battery. If the first sub-data does not match the second sub-data, since the first sub-data is stored in a data partition that can permanently store data (for example, data will not be lost during application version updates, electronic device system updates, electronic device flashing, or electronic device factory settings restoration), it can be determined that the second sub-data is abnormal (for example, data in the data partition is lost), and the electronic device can manage the battery based on the first sub-data.

[0018] In a possible implementation of the first aspect above, the above-mentioned persistent partition also stores a first verification code corresponding to the first battery control data, the original equipment manufacturer partition also stores a second verification code corresponding to the first sub-data, and the data partition also stores a third verification code corresponding to the second sub-data; the first sub-data does not match the first battery control data, and the second sub-data does not match the first battery control data, including: the first verification code is different from the second verification code, and the first verification code is different from the third verification code; corresponding to the first sub-data matching the second sub-data, including: the second verification code is the same as the third verification code; corresponding to the first sub-data not matching the second sub-data, including: the second verification code is different from the third verification code.

[0019] For example, in some embodiments of the present application, when the electronic device stores battery control data in the persistent partition, the OEM partition, and the data partition, it also stores a check code (hereinafter also a random check code) in the three partitions. That is, if the random check codes in two partitions are the same, it can be determined that the battery control data stored in the corresponding two partitions are the same group of battery control data.

[0020] It can be understood that if the check codes are the same, it can be determined that the corresponding battery control data matches. That is, when the second check code is the same as the third check code, the first sub-data matches the second sub-data. When the first check code is different from the second check code, and the first check code is different from the third check code, the first battery control data does not match the second battery control data. In this way, it can be determined whether the battery control data in the three partitions match based on the check codes stored in the three partitions.

[0021] In a possible implementation of the first aspect above, the third battery control data is obtained, and the third battery control data corresponds to a fourth verification code; the third battery control data and the fourth verification code are written to the persistent partition; the third battery control data and the fourth verification code are written to the data partition; and at least part of the third battery control data and the fourth verification code are written to the original equipment manufacturer partition.

[0022] It can be understood that when the electronic device stores the third battery control data in the persistent data storage, the third check code corresponding to the third battery control data can also be written into the persistent partition. And when the third battery control data is backed up to the data partition, the fourth check code will also be written into the data partition, and when at least part of the third battery control data is backed up to the original equipment manufacturer partition, the fourth check code can be written into the original equipment manufacturer partition. In this way, after the electronic device obtains the check codes in the three partitions, it can determine whether the battery control data stored in the corresponding partitions is correct according to whether the check codes corresponding to the three partitions are the same.

[0023] In a possible implementation of the first aspect above, the battery control parameters in the above-mentioned first sub-data include: a power limit flag for performing power limit management on the battery and the serial number of the battery; the battery control parameters in the first control data include a power limit flag, a battery serial number, a maximum charge state, a minimum charge state, a version number, and a termination charging voltage.

[0024] In a possible implementation of the first aspect, the detecting of the instruction to control the battery of the electronic device includes: detecting that the electronic device starts charging, the electronic device restarts, or the first application for controlling the battery restarts.

[0025] In a second aspect, the present application provides an electronic device, the electronic device comprising: a memory for storing instructions; at least one processor for executing instructions so that the device implements the first aspect and any possible implementation method of the first aspect. The beneficial effects that can be achieved in the second aspect can refer to the beneficial effects of the method provided in any implementation of the first aspect, and will not be repeated here.

[0026] In a third aspect, the present application provides a computer-readable storage medium, in which instructions are stored, and when the instructions are executed by a device, the computer implements the method provided in the first aspect and any possible implementation of the first aspect. The beneficial effects that can be achieved in the third aspect can refer to the beneficial effects of the method provided in any implementation of the first aspect, and will not be repeated here.

[0027] In a fourth aspect, the present application provides a computer program product, which, when running on a device, enables the device to implement the method provided in the first aspect and any possible implementation of the first aspect. The beneficial effects that can be achieved in the fourth aspect can refer to the beneficial effects of the method provided in any implementation of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1A A schematic diagram showing the management and control of a battery by an electronic device is shown;

[0029] Figure 1B A schematic diagram showing storage conditions of various storage areas of an electronic device is shown;

[0030] Figure 1C A schematic diagram showing a situation where electronic equipment cannot be controlled by power restriction;

[0031] Figure 2 According to some embodiments of the present application, a system framework diagram of an electronic device is shown;

[0032] Figure 3 According to an embodiment of the present application, a flowchart of an implementation of battery management and control by an electronic device is shown;

[0033] Figure 4 According to some embodiments of the present application, a flowchart for implementing determining a first priority path is shown;

[0034] Figure 5 According to some embodiments of the present application, an interactive flow chart of battery management and control of an electronic device is shown;

[0035] Figure 6 According to some embodiments of the present application, a flowchart of an implementation of battery management and control by an electronic device is shown;

[0036] Figure 7 According to an embodiment of the present application, a structural schematic diagram of an electronic device is shown. DETAILED DESCRIPTION

[0037] The illustrative embodiments of the present application include, but are not limited to, a device management method, a readable storage medium, a program product, and an electronic device.

[0038] For ease of understanding, the partitioning of the memory of the electronic device is first introduced.

[0039] In some embodiments, the physical memory of the electronic device (e.g., universal flash storage (UFS)) can be divided into multiple logical partitions for storing different data. For example, the physical memory can include a persistent partition (persist partition), an original equipment manufacturer (OEM) partition, and a data partition (data partition).

[0040] Among them, the persistent partition can, for example, store persistent system settings and configuration data. For example, the persistent partition can store user-defined system settings, network configurations, application configurations, etc. These data can be retained after the electronic device / corresponding application is restarted, the system / corresponding application of the electronic device is updated, the electronic device is flashed, or the factory settings are restored (for example, the storage area where the data will not be lost when the electronic device is restored to factory settings, the version / parameters of the mobile phone manager are updated, or the flashing is referred to as a permanent storage area below) to ensure that the user's personalized settings and application configurations are not lost, so as to maintain persistence after the device is restarted. Generally speaking, the space for data in the persistent partition is small (for example, in the order of tens of megabytes (MB) to hundreds of megabytes). As the data stored in the persistent partition grows, there is a risk that the persistent partition will be full of data and overflow, and data cannot be stored and read.

[0041] OEM partition is a part of the space reserved by the original equipment manufacturer and is a permanent storage area. This partition is mainly used to store resources preset by the original equipment manufacturer, such as some file resources and drivers, to ensure the normal operation of the electronic device. Generally speaking, the storage space of the OEM partition is small (for example, tens of megabytes (MB) to hundreds of megabytes), so some more critical data is usually stored in the OEM partition.

[0042] The data partition can be used to store application data and user data, for example. This includes application settings, databases, media files, documents, etc. Most user-generated data is stored in this partition. Generally speaking, the storage space of the data partition is large (for example, on the order of 10GB to several hundred 1000GB). When the electronic device is restored to factory settings, the version / parameters of the mobile phone manager are updated, or the machine is flashed, some data in the data partition may be overwritten or lost. Exemplarily, in the above partitions, the data partition has the largest storage space, but there is a risk of losing data. The persistent partition can store data persistently, but the storage space of the persistent partition is smaller than that of the data partition, and there is a risk that the persistent partition is full and cannot read / store data. The storage space of the OEM partition is the smallest, but a part of the space can be reserved in the OEM partition to store the corresponding data (for example, the first data), and other data will not affect the storage space of the first data. Therefore, the OEM partition is not prone to the risk of being full and unable to read or store data.

[0043] It should be noted that the logical partition of the memory of the electronic device may also include other partitions, such as a system partition, a kernel partition, and the like.

[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0045] It should be noted that in some embodiments of the present application, battery control data for safety control of the battery of the electronic device can be stored in a permanent storage area. Therefore, the device control method of the present application will be introduced below using battery safety control as an example. In other embodiments, data of other control schemes in the electronic device can also be stored in the permanent storage area of ​​the electronic device, and the electronic device can be controlled based on the control scheme. The embodiments of the present application do not limit the control scheme of the electronic device.

[0046] As mentioned above, when there is an abnormality in the permanent storage area of ​​the electronic device, the electronic device cannot read the battery management and control data, and thus cannot normally perform battery management and control related services.

[0047] Exemplarily, taking battery safety management as an example, the electronic device can store battery safety-related battery management data in a persistent partition of the electronic device's memory. When the electronic device determines that there is a safety problem with the battery, the electronic device can obtain the battery management data from the persistent partition to perform safety management of the battery.

[0048] For example, Figure 1A A schematic diagram showing the management and control of a battery by an electronic device is shown.

[0049] It should be noted that the present application does not limit the specific form of the electronic device, and the electronic device may be a mobile phone, a laptop computer, a tablet, a large-screen device, a wearable device (e.g., a watch, smart glasses, a helmet), a desktop computer, an augmented reality (AR) / virtual reality (VR) device, a personal digital assistant (PDA), etc. In the following, a mobile phone is used as an example of the electronic device 100.

[0050] like Figure 1A As shown, the electronic device 100 includes a mobile phone manager and a persistent partition, wherein the persistent partition stores battery management data.

[0051] For example, when the electronic device 100 is dropped, collided, squeezed, etc., which may cause defects in the battery electrode, the user cannot check the specific condition of the battery in time. Even if the battery electrode is defective, the user will continue to use the electronic device with an increased risk of battery short circuit and spontaneous combustion without noticing. Whether in the normal use of electronic devices or in the process of charging the battery of electronic devices, batteries with the risk of short circuit and spontaneous combustion are very likely to cause the electronic device to overheat or other performance abnormalities. In severe cases, it may cause damage to the electronic device or even cause a fire due to battery short circuit and spontaneous combustion, which brings great safety hazards to users.

[0052] In this case, the mobile phone manager of the electronic device 100 can obtain battery status information (such as the serial number (SN) of the battery, the actual capacity of the battery, the actual discharge cycle of the battery, the actual output voltage of the battery, and the actual output current, etc.), and determine whether the battery is defective based on the battery safety-related algorithm. For example, the electronic device 100 can also upload the battery status information to the server, and the server can determine whether the battery is abnormal based on the battery status information. If the battery is defective, the server can send the corresponding battery management data to the electronic device 100, in order to ensure that the electronic device 100 can manage the battery based on the battery management data for a long time. The electronic device 100 can store the battery management data in a persistent partition. When the system of the electronic device 100 is restarted, or the mobile phone manager is restarted or starts charging, the mobile phone manager can obtain the battery management data from the persistent partition. Among them, the battery management data may include, for example, the serial number of the battery, the power limit flag of the battery, the battery voltage, the battery current, etc. After obtaining the battery management data, the mobile phone manager can perform power limit management on the battery.

[0053] For example, refer to Figure 1A After the mobile phone manager obtains the battery management and control data from the persistent partition, it can limit the power of the battery. For example, if it is detected that the actual capacity of the battery is less than the rated capacity of the battery and the actual capacity of the battery is less than the preset capacity lower limit, the actual discharge cycle of the battery is less than the rated discharge cycle of the battery, and the actual discharge cycle of the battery is less than the preset discharge cycle lower limit, etc., the mobile phone manager can limit the power of the battery based on the battery management and control data obtained from the persistent partition, and pop up a prompt box 11 on the display interface 10 of the electronic device 100. The information in the prompt box 11 can be, for example, "The battery is in poor health, please go to the official authorized service center for inspection." After testing the battery or replacing the battery, the electronic device 100 can end the power limit control on the battery, thereby ensuring the safe use of the battery of the electronic device 100.

[0054] Exemplarily, each time the electronic device 100 is charged, the electronic device 100 can upload battery status information to the server. The uploaded battery status information can also include, for example, the falling information of the electronic device 100 when it falls (which can be measured by the gyroscope in the electronic device 100). And information such as battery short circuit and interrupted charging. The server can perform battery abnormality analysis on each electronic device 100 according to the battery status information of each electronic device 100. If one or more battery status information of the electronic device 100 is abnormal, it is considered that the battery of the electronic device 100 is abnormal. Exemplarily, the server can determine whether the battery of the electronic device 100 is abnormal according to a parameter in the battery status information of the electronic device 100. For example, if the actual capacity of the battery is less than the rated capacity of the battery, it can be considered that the battery is abnormal; or, if the actual resistance of the battery is less than the rated resistance of the battery, it can be considered that the battery is abnormal; or, if the actual discharge cycle of the battery is less than the rated discharge cycle of the battery, it can be considered that the battery is abnormal, etc. Exemplarily again, the server can determine whether the battery of the electronic device 100 is abnormal according to multiple parameters of the battery status information of the electronic device 100. For example, if the actual capacity of the battery is less than the rated capacity of the battery, and the actual resistance of the battery is less than the rated resistance of the battery, it can be considered that the battery is abnormal, etc. In some embodiments, whether the battery is abnormal can also be determined by human judgment. For example, the staff can judge whether the battery is abnormal based on the battery status information uploaded by the electronic device 100 on the server.

[0055] After the server determines that the battery of the electronic device 100 is abnormal, the battery control data may be sent to the electronic device 100, and the battery control data includes an identification of the battery abnormality. In some embodiments, in order to avoid the battery control data being cleared when the electronic device 100 is flashed, the system is updated, the application parameters are updated (for example, the application parameters of the mobile phone manager are updated), or the factory settings are restored (for example, when the application parameters of the mobile phone manager are updated, the battery control data stored locally by the mobile phone manager is cleared), the electronic device 100 may store the battery control data in a persistent partition. For example, after the electronic device 100 obtains new battery control data, it may clear the old battery control data stored in the persistent partition, and then store the new battery control data sent by the server. The new battery control data includes an identification indicating that the battery is abnormal. The mobile phone manager of the electronic device 100 may obtain the battery control data from the persistent partition, and determine that the battery of the electronic device 100 is abnormal based on the identification indicating that the battery is abnormal, and then perform power limiting control on the battery of the electronic device 100 based on the battery control data.

[0056] However, in some cases, if there is an abnormality in the persistent partition of the electronic device 100, the mobile phone manager cannot obtain battery management data from the persistent partition, or obtains incorrect battery management data from the persistent partition, which will cause the battery management solution to be abnormal.

[0057] For example, refer to Figure 1B and Figure 1C ,in Figure 1B The storage status of each storage area of ​​the electronic device is shown. Figure 1C It shows the situation where electronic equipment cannot be controlled by power restriction.

[0058] like Figure 1B The memory of the electronic device 100 may include, for example, a persistent partition, a first partition (for example, an OEM partition), and a second partition (for example, a data partition). Exemplarily, the maximum capacity of the persistent partition is 500M, and the current capacity is 498M, the remaining capacity is 2M, and the space utilization rate is 99%. It can be understood that the persistent partition currently stores a lot of data, and there is a problem of overflow. If the persistent partition is full and overflows, the electronic device 100 will not be able to send new battery management data to the persistent partition storage server. Alternatively, when the electronic device 100 reads data from the persistent partition, it is necessary to parse the corresponding data in the persistent partition, but the parsed data may take up more storage space. At this time, the persistent partition does not have more space to store the parsed data. At this time, the electronic device 100 cannot read data from persist.

[0059] For example, refer to Figure 1C When the electronic device 100 is charging, the mobile phone manager can obtain battery management data from the persistent partition to manage the battery (for example, determine whether there is a problem with the battery based on the battery management information of the persistent partition). However, if there is an abnormality in the persistent partition (for example, the persistent partition is full of files and cannot store / read data), the mobile phone manager cannot obtain the correct battery management data from the persistent partition. In the case where there is a problem with the battery of the electronic device 100, the mobile phone manager cannot limit the power of the electronic device 100, and the electronic device 100 can still be charged normally. For example, a prompt message 12 indicating that charging is in progress is displayed on the display interface 10' of the electronic device 100. It can be understood that in the case where there is a problem with the battery (for example, the battery management information sent by the server indicates that there is a problem with the battery, but the user has not replaced the battery and continues to charge the electronic device 100), there are greater safety risks in using the electronic device 100 or charging the electronic device 100.

[0060] In some embodiments, when the persistent partition is full of data, the electronic device 100 cannot continue to store data in the persistent partition. For example, after the user replaces the battery, the battery management data corresponding to the new battery may not be written to the persistent partition. Or after the server detects that there is an abnormality in the battery of the electronic device 100, the updated battery management data cannot be written to the persistent partition. Therefore, the electronic device 100 can only use the old battery management data to control the battery or not limit the power of the battery. This causes a safety hazard to the battery of the electronic device. Or the battery of the electronic device is normal, but charging is restricted, affecting the user's use.

[0061] In summary, in electronic devices, the battery management data for managing the battery is stored in a persistent partition in the memory of the electronic device, so as to manage the risky battery for a long time. However, if there is an abnormality in the persistent partition, the electronic device cannot store / read the battery management data from the persistent partition, or reads the wrong battery management data, resulting in the electronic device being unable to perform correct battery management.

[0062] In order to solve the above problems, the present application proposes a device management method, in which, in addition to storing battery management data in a persistent partition of a memory (as an example of first battery management data), at least part of the battery management data is backed up and stored in at least one other partition of the memory (for example, an OEM partition, a data partition, etc.) (as an example of second battery management).

[0063] After detecting the instruction to perform safety control based on the battery control data, the electronic device can obtain the battery control data from the persistent partition if the persistent partition is normal, and obtain the battery control data from other partitions (such as OEM partition, data partition, etc.) if the persistent partition is abnormal, and perform battery control based on the obtained battery control data. In this way, even if the persistent partition is abnormal, the electronic device can obtain key information in the battery control data from other partitions (such as OEM partition, data partition), so as to perform basic battery control, which can avoid the problem that the electronic device cannot perform battery control on the battery due to the inability to obtain battery control data.

[0064] In some embodiments, the electronic device executes security control instructions after detecting that the electronic device starts charging, the system of the electronic device restarts, or the battery-related application (such as a mobile phone manager) of the electronic device is restarted.

[0065] Exemplarily, the electronic device can back up all the battery management data and store them in a data partition (data partition). The data partition has a large storage space and can store all the information of the battery management data (as an example of the second sub-data), but the data partition cannot permanently store the battery management data (for example, the data in the data partition may be lost when the electronic device is restored to factory settings, the version / parameters of the mobile phone manager are updated, or the device is flashed).

[0066] The electronic device can back up the critical data in the persistent partition and store it in the OEM partition.

[0067] When managing the battery, if the battery management data in at least one of the OEM partition and the data partition matches the battery management data in the persistent partition, it means that there is no abnormality in the persistent partition, and the electronic device can use the battery management data in the persistent partition to manage the battery.

[0068] If neither of them matches, the battery control data in one of the OEM partition and the data partition is used to control the battery. For example, if the battery control data in the OEM partition matches the battery control data in the data partition, the battery control data in the data partition is used to control the battery; if the battery control data in the OEM partition and the data partition do not match, the battery control data in the OEM partition is used to control the battery.

[0069] In some embodiments, the battery management data in the OEM partition and the persistent partition may match, for example, the key data stored in the OEM partition, which is the same as the corresponding key data in the persistent partition. It is understandable that, due to the small storage space of the OEM partition, the OEM partition generally only stores key data for battery management (as an example of the first sub-data). Similarly, the OEM partition and the data partition may match, for example, the key data stored in the OEM partition is the same as the corresponding data in the data partition. Exemplarily, if the key data includes the A parameter, the values ​​of the A parameter in the OEM partition and the data partition are the same, and the OEM partition matches the data partition.

[0070] In some embodiments, the data partition matches the battery management and control data in the persistent partition, for example, the data partition and the battery management and control data in the persistent partition are the same.

[0071] Exemplarily, the persistent partition and the OEM partition are permanent storage areas, and the data will not be lost when the electronic device is restored to factory settings or flashed. However, the persistent partition cannot read and write data when the file is full or an exception occurs. The storage space of the OEM partition is small and can store some key battery management data (such as the binary data of the battery serial number and the binary data of the battery power limit flag, etc.), so the battery management data in the OEM partition can only support basic power limit management (for example, limiting the maximum charge of the battery to the minimum level (such as 30% of the full charge)). The data partition is not a permanent area. When restoring the factory settings or flashing the machine, the data will be lost, so the battery management data of the data partition may be incomplete. Therefore, when obtaining the battery management data, it is necessary to determine whether there is an abnormality in each storage area.

[0072] In some embodiments, if the OEM partition can store complete battery management data, there is no need to back up the battery management data in the data partition. When the battery management data in the OEM partition does not match the battery management data in the persistent partition, the battery management data can be directly obtained from the OEM partition.

[0073] In some embodiments, random check codes are also stored in the persistent partition, OEM partition, and data partition. When acquiring battery control data, if the random check codes of the persistent partition, OEM partition, and data partition are the same (as an example in which the first check code, the second check code, and the third check code are the same), it can be considered that the battery control data in the persistent partition, OEM partition, and data partition match. At this time, the battery control data of the persistent partition is acquired to perform the first business. It can be understood that the random check code is generated, for example, each time the electronic device stores battery control data in the persistent partition, and when the battery control data is backed up to the OEM partition and the data partition, the random check codes in the OEM partition and the data partition are the same. In other words, the versions of the battery control data corresponding to the same random check code are the same.

[0074] If there are two storage areas with the same random check code in the persistent partition, OEM partition, and data partition, then the storage area with complete battery management data storage is selected from the two storage areas with the same random check code to obtain the battery management data.

[0075] For example, when the random check codes of the persistent partition and the OEM partition are the same (as an example in which the first check code and the second check code are the same), the battery control data of the persistent partition is selected to control the battery. When the random check codes of the persistent partition and the data partition are the same (as an example in which the first check code and the third check code are the same), the battery control data of the persistent partition is selected to control the battery. When the random check codes of the OEM partition and the data partition are the same, the battery control data of the data partition is selected to control the battery.

[0076] If the random check codes of the three storage areas are all different (as an example in which the first check code, the second check code, and the third check code are all different), the battery control data in the OEM partition is selected to control the battery. It can be understood that the OEM partition can, for example, allocate independent space to store battery-related data. Even if the data in the OEM partition is full and overflows, the battery control data can be read out, that is, the data in the OEM partition can be guaranteed to be correct.

[0077] The following describes the process of obtaining battery management and control data in this application.

[0078] For example, Figure 2 According to some embodiments of the present application, a system framework diagram of an electronic device is shown.

[0079] It should be noted that the present application does not limit the specific form of the electronic device, and the electronic device may be a mobile phone, a laptop computer, a tablet, a large-screen device, a wearable device (e.g., a watch, smart glasses, a helmet), a desktop computer, an augmented reality (AR) / virtual reality (VR) device, a personal digital assistant (PDA), etc. In the following, a mobile phone is used as an example of an electronic device.

[0080] Reference Figure 2 The system of the electronic device includes an application layer, a framework layer, a native layer, a hardware abstraction layer (Hal) and a kernel layer.

[0081] The application layer may include, for example, a mobile phone manager, which includes battery health services and other services. The mobile phone manager can manage the battery through the battery health services.

[0082] For example, the battery health service includes a battery safety algorithm library and other algorithm libraries. Through the battery safety algorithm library, the mobile phone manager can determine the current status of the battery and whether the battery needs to be safely managed.

[0083] In other embodiments, the application layer may also include other applications, such as camera, gallery, calendar, call, map, navigation, Bluetooth, music, video, short message and other applications.

[0084] The framework layer provides an application programming interface (API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions. In some embodiments of the present application, the framework layer may include, for example, a battery service, which is used to manage and monitor the battery status and provide battery-related services. For example, in some embodiments of the present application, the battery service can obtain battery status information, such as the SN value of the battery or the number of cycles of the battery, and send the battery status information to the mobile phone manager, and the mobile phone manager can determine whether to limit the power of the battery based on the battery status information. In some embodiments, the battery service can also receive battery control information issued by the mobile phone manager, such as the SN value of the battery and the power limit flag of the battery, so that the mobile phone can perform power limit operations.

[0085] The local layer is a layer used to provide local services and link libraries and other functions, and mainly handles tasks related to the underlying hardware drivers, complex calculations, etc. For example, in some embodiments of the present application, the local layer may include a healthd monitoring layer, which monitors battery events from the bottom layer, such as battery status information (power, temperature), etc. The collected battery status information is then passed upward to the battery service of the framework layer. In addition, the healthd monitoring layer can also send battery management information (such as power limit identification, battery SN, etc.) to the lower layer (such as the kernel layer).

[0086] The core layer includes the battery management module (Battery) and the charging management module (charge-ic).

[0087] The battery management module can monitor the battery's power, voltage, temperature and other status information in real time to ensure that the battery operates within a safe range. It can also control the charging process, such as adjusting charging current, voltage and other parameters to ensure battery charging efficiency and safety. It can also reduce the power consumption of the mobile phone and extend the battery life by optimizing the use of system resources and shutting down unnecessary hardware modules.

[0088] For example, in some embodiments, Battery may include the number of battery cycles (batt_cycle), the battery serial number (batt_sn), the current value of the battery (current), the battery voltage (vbat), and the like.

[0089] The number of battery cycles refers to the number of times a battery is fully discharged and fully charged. The number of battery cycles is an important indicator of battery aging. As the number of cycles increases, the battery capacity will gradually decrease.

[0090] The battery serial number is a unique identifier for the battery, usually assigned to each battery by the manufacturer during the production process. The battery serial number can be used to track the manufacturing date, batch and other information of the battery, and can also be used for after-sales service and verification during battery replacement.

[0091] The current value of the battery can be charging current (positive value) or discharging current (negative value). The magnitude and direction of the current value can reflect the working status of the battery, such as charging speed, discharging speed, etc.

[0092] The battery voltage is the voltage value provided by the battery to the system. It is used to reflect the remaining power and charging status of the battery.

[0093] The charging management module is used to manage and control the charging current and voltage. For example, it monitors and controls the current and voltage during the charging process to ensure that the charging process is safe and stable. It prevents abnormalities in the charger or charging line (such as short circuit, overload, etc.) to protect the device and charger. It detects the battery power, temperature and status, and achieves the best charging effect based on this information. It protects electronic devices from battery overcharging, over-discharging, overheating, etc., and extends the battery life.

[0094] For example, in some embodiments, the charging management module includes a maximum state of charge (max_soc, where the state of charge (SOC) is generally a percentage value ranging from 0% to 100%), a minimum state of charge (min_soc), and a charging current ratio (ichg_ratio) of the battery.

[0095] Maximum State of Charge defines the maximum state of charge that a battery can reach during charging. This is usually a safety limit to prevent overcharging the battery. For example, some batteries may be set to stop charging at 80% SOC to extend battery life.

[0096] The minimum state of charge defines the lowest state of charge that the battery can reach during discharge. This is usually a safety limit to prevent the battery from over-discharging. The battery should be charged when it reaches this minimum limit to avoid damaging the battery.

[0097] The charge current ratio is used to control the charge current of the battery. The charge current ratio is a ratio or coefficient used to calculate or adjust the actual charge current based on other parameters such as battery temperature, battery voltage, etc.

[0098] By adjusting the charge current ratio, the charging process can be optimized so that the battery can be charged under safer and more efficient conditions. For example, when the battery temperature is high, the charge current can be reduced by reducing the charge current ratio, thereby reducing the battery temperature and preventing overheating.

[0099] In some embodiments of the present application, a hardware abstraction layer (HAL) is also included between the kernel layer and the hardware layer. The HAL layer provides an interface for the upper-layer software to access the underlying hardware. For example, in some embodiments of the present application, the HAL layer can define a set of standardized interfaces through the hardware definition language (HIDL) for communicating with the battery driver of the kernel layer. Through the HIDL interface, the HAL layer can send a request to the kernel layer to obtain battery information. At the same time, the kernel layer can also return the battery information to the HAL layer through the HIDL interface. When the battery status changes, the HAL layer can notify the healthd monitoring layer of these changes. The healthd monitoring layer obtains the battery status information by monitoring these events and passes it to the battery service or other related components of the framework layer. The mobile phone manager can obtain the corresponding battery status information from the framework layer.

[0100] That is to say, the application layer and the kernel layer can transmit data through the HIDL interface. For example, the mobile phone manager of the application layer can obtain information such as the battery serial number and the number of cycles from the battery management module of the kernel layer through the HIDL interface. Then, the mobile phone manager can determine whether to control the battery safety based on the battery status information obtained according to the battery safety algorithm library. Exemplarily, the battery control scheme can be obtained from the memory of the electronic device (such as a persistent partition, an OEM partition, or a data partition).

[0101] In other embodiments, the electronic device may also send battery status information to the server (for example, the electronic device may send battery status information to the server once each time charging is completed). After the server determines that the battery of the electronic device has an abnormality based on the battery status information, it may update the battery management information, wherein the battery management information includes an identifier indicating that the battery has an abnormality (for example, if there is an identifier indicating a battery abnormality, it means that the battery has an abnormality, and if there is no identifier indicating a battery abnormality, it means that the battery has no abnormality. In some embodiments, if the battery has no abnormality, it is not necessary to update the battery management data to the electronic device). Or the identifier indicating whether the battery has an abnormality is a first value (for example, 1) indicating that the battery is abnormal, and a second value (for example, 0) indicating that the battery has no abnormality. The server may send the updated battery management information to the electronic device, and after the electronic device obtains the updated battery management data, it performs battery management based on the battery management data.

[0102] In some embodiments of the present application, the battery control data is stored in a permanent storage area in the memory, such as a persistent partition. In addition, the key information that can control the battery is backed up in the OEM partition of the memory. And the complete battery control data is stored in the data partition (data partition). After the electronic device obtains the corresponding battery control data from the server, it stores the battery control data in the corresponding storage area.

[0103] For example, the persistent partition stores information such as the battery serial number (batt_sn) and the battery power limit flag (flag). The power limit flag may, for example, include the power limit level for the battery. It can be understood that in some embodiments, different levels of battery risk are defined according to the different severities of battery abnormalities. For example, if there is one battery status information abnormality in the battery, the risk level of the battery is considered to be level three; if there are two battery status information abnormalities in the battery, the risk level of the battery is considered to be level two; if there are at least two battery status information abnormalities in the battery, the risk level of the battery is considered to be level one. The risk level of level one is greater than that of level two, and the risk level of level two is greater than that of level three.

[0104] In other embodiments, the risk level of the battery can also be determined according to the importance level of the battery status information. For example, the importance level of the battery status information is preset, and if the battery status information with the importance level of level 1 is abnormal, the battery abnormality risk level is considered to be level 1; if the battery status information with the importance level of level 2 is abnormal, the battery abnormality risk level is considered to be level 2, etc. For example, the importance level of the battery capacity is level 1, if the actual battery capacity is less than the rated battery capacity, and if there is a problem with the battery, the electronic device can select the battery power limit level according to the battery situation to limit the battery power.

[0105] The storage space of the OEM partition is relatively small, and it can store some key battery management and control data (such as the binary data of the battery serial number and the binary data of the battery power limit flag, etc.). For example, in some embodiments of the present application, the OEM partition stores basic information that can limit the power of the battery. When the battery is abnormal and the data partition and the persistent partition cannot accurately read the battery management and control data, the basic information of the battery management and control data in the OEM partition can be used to perform basic management and control of the battery. For example, the OEM partition stores the serial number of the battery and the binary information of the power limit flag corresponding to the first risk level. In other words, once the battery management and control data of the OEM partition is used, the battery is subject to the most stringent control level. This is because it is impossible to accurately obtain the complete battery management and control data, and it is impossible to know the current abnormality of the battery, so the battery can be directly controlled with the most stringent control level.

[0106] The data partition (data partition) also stores complete battery management data, for example, the data partition can store the maximum charge state (max_soc), the minimum charge state (min_soc), the battery serial number (batt_sn), the power limit flag (flag), the version number (version) (the server will record the version number of the corresponding battery management data each time it updates the battery management data), and the termination charging voltage (vterm), which is used to limit the charging voltage of the battery. When the battery voltage reaches or exceeds this specific value, the charger will stop charging. When the battery is power-limited, the termination charging voltage can be lowered. However, the data in the data partition may be cleared after flashing or restoring the factory settings or restarting the application. Therefore, in some embodiments of the present application, the complete data of the battery management data is stored in the persistent partition and the data partition respectively. And the key data of the battery management data is stored in the OEM partition.

[0107] When the electronic device determines that there is an abnormality in the battery, it can select the first priority path from the persistent partition, data partition and OEM partition to obtain the battery control data. There is no problem with the battery control data under the first priority path, and it is kept as complete as possible. In order to ensure that there is no problem with the battery control data under the first priority path, a random check code (verificode) can be added to the persistent partition, data partition and OEM partition (each time data is stored, the random check code of the three partitions is the same), and the random check code in the OEM partition is also converted into a binary number. Before obtaining the battery control data, it is necessary to determine the first priority path based on the random check code, and obtain the battery control data from the first priority path. It can be understood that since there will be no situation in the OEM partition where the data cannot be read due to overflow, the random check code stored in the OEM partition can be regarded as always correct.

[0108] For example, before obtaining battery management and control data, a random check code is obtained from the persistent partition, the data partition, and the OEM partition, and it is determined whether the three random check codes are the same.

[0109] If the three random checksums are the same, the persistent partition is used as the first priority path to obtain complete battery control data from the persistent partition. This is because the battery control data in the data partition may be incomplete (part or all of the data may be lost when flashing or restoring factory settings), and the OEM partition does not store complete battery control data. Therefore, when the random checksums of the three partitions are the same, the persistent partition is selected as the first priority path to obtain battery control data.

[0110] If there are two identical random check codes, one of the two partitions with the same random check code is selected as the first priority path. For example, when the two random check codes of the persistent partition and the OEM partition are identical, the persistent partition is selected as the first priority path. When the two random check codes of the data partition and the OEM partition are identical, the data partition is selected as the first priority path.

[0111] If the three random check codes are all different, the OEM partition is selected as the first priority path. It can be understood that the situation where the three random check codes are all different may be that the persistent partition file is full and overflowing, and the data cannot be read out or the wrong data is read out. In addition, the electronic device loses data in the data partition after flashing or restoring the factory settings. At this time, the OEM partition stores the correct battery management data, and the OEM partition is selected as the first priority path.

[0112] For example, the mobile phone manager can obtain information such as the battery serial number and number of cycles from the battery management module of the kernel layer through the HIDL interface. Then, the current state of the battery and whether to control the battery are determined based on the acquired data according to the battery safety algorithm library. In the case where the mobile phone manager determines that there is an abnormality in the battery and that the battery needs to be power-limited, the mobile phone manager can determine the first priority path and obtain the battery control information from the first priority path. For example, the mobile phone manager can obtain the battery control plan from the persistent partition in the memory through the HIDL interface. Then, the mobile phone manager sends the battery control plan to the charging management module of the kernel layer through the HIDL interface. The charging management module can adjust the battery's maximum charge state, minimum charge state, and charging current ratio and other parameters according to the battery control plan to achieve battery control.

[0113] In other embodiments, when the mobile phone manager determines that the OEM partition or the data partition is the first priority path, the mobile phone manager can directly obtain the battery management and control data from the corresponding partition in the memory.

[0114] Next, we will introduce the process of how electronic devices manage batteries.

[0115] For example, Figure 3 According to an embodiment of the present application, a flowchart of an implementation of battery management and control of an electronic device is shown.

[0116] It should be noted that the present application does not limit the specific form of the electronic device, and the electronic device may be a mobile phone, a laptop computer, a tablet, a large-screen device, a wearable device (e.g., a watch, smart glasses, a helmet), a desktop computer, an augmented reality (AR) / virtual reality (VR) device, a personal digital assistant (PDA), etc. The execution subjects of the following processes are all the above-mentioned electronic devices, and the execution subjects of each process will not be described in detail when introducing the following processes.

[0117] like Figure 3 As shown, the process includes:

[0118] S301, storing battery management and control data in a persistent partition, an OEM partition, and a data partition.

[0119] After obtaining the battery control data, the electronic device can store the obtained battery control in a persistent partition and generate a random check code in the persistent partition, and then back up and store all the battery control data and the corresponding random check code in the data partition, and store the key data and random check code in the battery control data in the OEM.

[0120] That is to say, for the same set of battery management data, the random check codes in the persistent partition, OEM partition, and data partition are the same. For example, in some embodiments of the present application, after the electronic device obtains the battery management data from the server, the battery management data can be stored in the persistent partition and backed up in the data partition. In order to ensure that the battery can be managed, the key information in the battery management data can be stored in the OEM partition.

[0121] In other embodiments, the electronic device may also obtain battery control data in other ways, for example, battery control data obtained when the electronic device leaves the factory, or battery control data transmitted by maintenance personnel through other devices when the battery of the electronic device is replaced. The embodiments of the present application do not limit the source of the battery control data obtained by the electronic device.

[0122] Among them, complete battery management data is stored in the persistent partition and the data partition. The persistent partition can store data permanently, but the data cannot be accessed when it is full and overflowing, resulting in the electronic device may not be able to obtain accurate battery management data from the persistent partition. The data can store complete battery management data, but the corresponding data will be lost after the electronic device is flashed or restored to factory settings. In other words, there is a risk of data loss in the data partition. The OEM partition can store data permanently, but the storage space of the OEM partition is small and can store key data in the battery management data. For example, data that can perform basic power-limiting services.

[0123] The battery control data can be obtained from the server, for example. For example, after the battery control data is updated, or the server determines that there is a problem with the battery of the electronic device based on the battery status information uploaded by the electronic device, the battery control data can be updated. At this time, the battery control data also includes an identification indicating that the battery is abnormal. After the electronic device receives the battery control data, it can store the battery control data in the above three areas. And each storage will update the random check code for the above three areas. In some embodiments, the random check codes of the three areas are the same random check code. In other embodiments, the random check codes of the above three partitions may also be different.

[0124] S302: An instruction to execute security control is detected.

[0125] For example, after the electronic device detects that the battery starts charging, the system of the electronic device restarts, or the mobile phone manager restarts, the electronic device can start executing security control instructions.

[0126] S303: When the battery management and control data in at least one partition of the OEM partition and the data partition matches the battery management and control data in the persistent partition, obtain the battery management and control data from the persistent partition.

[0127] Exemplarily, after the electronic device determines the instruction to execute security control based on the battery control data, it determines the first priority path from the persistent partition, the OEM partition and the data partition to obtain the battery control data. It can be understood that the battery control data under the first priority path will not have any problems and needs to be as complete as possible.

[0128] For example, a random check code is obtained from a persistent partition, a data partition, and an OEM partition, and it is determined whether the three random check codes are the same.

[0129] If the random check code in at least one of the OEM partition and the data partition is the same as that in the persistent partition, it can be considered that there is no abnormality in the persistent partition, and the persistent partition is used as the first priority path to obtain complete battery control data from the persistent partition. This is because the battery control data in the data partition may be incomplete (part or all of the data may be lost when flashing or restoring factory settings), and the OEM partition does not store complete battery control data. Therefore, when the random check code in at least one of the OEM partition and the data partition is the same as that in the persistent partition, the persistent partition is selected as the first priority path to obtain battery control data. It can be understood that each time the electronic device stores battery control data in the above three partitions, the random check code will be refreshed. Therefore, if the random check codes of the three partitions are the same, it can be determined that the data in each partition has been refreshed and has not been cleared, and they are all correct data.

[0130] S304: The battery control data in the OEM partition and the data partition do not match the battery control data in the persistent partition, and the battery control data is obtained from the OEM partition or the data partition.

[0131] Exemplarily, if there is no battery control data in the OEM partition or the data partition that matches the battery control data in the persistent partition. For example, if the random check codes in the OEM partition and the data partition are different from those in the persistent partition, it can be considered that there is an abnormality in the persistent partition, and the battery control data in the persistent partition cannot be used to control the battery. Therefore, the battery control data of one partition is selected from the OEM partition or the data partition. For example, when the two random check codes of the data partition and the OEM partition are the same, the data partition is selected as the first priority path. This is because when the random check codes of the data partition and the OEM partition are the same, the battery control data of the data partition and the OEM partition are both correct data, and the battery control data stored in the data partition is more complete. Therefore, the data partition is used as the first priority path, and the battery control data of the data partition is selected to control the battery.

[0132] If the three random check codes are all different, the OEM partition is selected as the first priority path. It can be understood that the situation where the three random check codes are all different may be that the persistent partition file is full and overflowing, and the data cannot be read out or the wrong data is read out. In addition, the electronic device loses data in the data partition after flashing or restoring the factory settings. At this time, the OEM partition stores the correct battery management data, and the OEM partition is selected as the first priority path.

[0133] In other embodiments, the random check codes of each partition are different, and whether the data of the corresponding partition has changed can be determined based on the random check codes of each partition. For example, when the battery management and control data is stored in the persistent partition, the first random check code is added. If the first random check code can still be obtained when the battery management and control data is obtained from the persistent partition, it means that the battery management and control data of the persistent partition has been updated, and the accuracy of the battery management and control data of the partition can be guaranteed. Similarly, when the battery management and control data of the persistent partition is correct, the battery management and control data of the persistent partition is used as the first priority path. When it is determined that the random check code of the persistent partition is wrong, but the random check code of the data partition is correct, the data partition is used as the first priority path. When it is determined that the random check code of the persistent partition and the data partition is wrong, the OEM partition is used as the first priority path. Exemplarily, the embodiments of the present application do not limit the method of determining the first priority path.

[0134] S305: Perform battery safety management and control based on the acquired battery management and control data.

[0135] Illustratively, in some embodiments of the present application, after the first priority path is determined, battery management and control data can be obtained from the first priority path, and battery management and control can be performed.

[0136] If the first priority path is a persistent partition or a data partition, complete battery management and control data can be obtained, so that corresponding power-limiting control operations for battery charging can be performed according to different risk levels of the battery. That is, power-limiting operations are performed according to charging power thresholds corresponding to different levels. Corresponding operations can be performed according to the severity of the battery abnormality, thereby further reducing the risk of accidents caused by battery short circuits during abnormal battery charging.

[0137] For example, for the limitation of battery capacity, different risk levels correspond to different power limits. When the battery risk level is level one, the limit on the maximum charge amount of the battery can be 30% (or other values) of the actual total capacity of the battery. When the battery risk level is level two, the limit on the maximum charge amount of the battery can be 50% (or other values) of the actual total capacity of the battery. When the battery risk level is level three, the limit on the maximum charge amount of the battery can be 70% (or other values) of the actual total capacity of the battery. Exemplarily, the embodiments of the present application do not limit the risk level of the battery and the power limit. That is to say, in other embodiments, the battery management and control data may also include more or fewer battery risk levels. The power limit corresponding to each battery risk level may also be other values. And the control parameters of the battery may also be other parameters, such as voltage, current or temperature.

[0138] If the first priority path is the OEM partition, it means that the battery control data of the persistent partition and the data partition are abnormal data, and safety control is performed based on the key data of the battery control data in the OEM partition. It can be understood that at this time, the electronic device cannot determine the risk level of the battery, and the battery can be power-limited at the highest risk level. In other words, in the OEM partition, the power-limiting flag bit stored is used to indicate the highest level of control scheme.

[0139] Through the above solution, the battery control data is stored in multiple areas respectively, which can ensure the reliability of electronic devices in obtaining battery control data. For example, when the electronic device is flashed or restored to factory settings, the battery control data can be obtained from the permanent storage area (persistent partition). When the persistent partition is abnormal due to full files, and the battery control data in the data partition is correct, the battery control data can be obtained from the data partition. When there are abnormalities in the battery control data of both the persistent partition and the data partition, the most basic battery control data can be obtained from the OEM partition. This ensures that the battery can be controlled normally when there are safety problems with the battery, reducing the safety risks of the battery.

[0140] The following describes a process for an electronic device to determine a first priority path in an embodiment of the present application.

[0141] For example, Figure 4 According to some embodiments of the present application, a flowchart for implementing determining a first priority path is shown.

[0142] Illustratively, in some embodiments of the present application, the execution subject of each of the following processes is the above-mentioned electronic device, and when introducing each of the following processes, the execution subject of each process is not described in detail.

[0143] like Figure 4 As shown, the process includes:

[0144] S401, start battery detection.

[0145] For example, in some embodiments of the present application, after the electronic device detects that the battery starts to charge, the electronic device is restarted, or the mobile phone manager is restarted, the electronic device can start battery detection.

[0146] S402, determining whether the random verification codes of the three parties are consistent.

[0147] For example, in some embodiments of the present application, after the electronic device performs battery detection, it is necessary to obtain battery control data. The battery control data is stored in the persistent partition, the OEM partition, and the data partition. Since the battery control data stored in the OEM partition is incomplete, the persistent partition and the data partition may not obtain the correct battery control data. Therefore, it is possible to determine whether there is an abnormal partition based on whether the random check codes of the three partitions are consistent.

[0148] If the judgment result is yes, then S403 is executed to use the persistent partition as the first priority path.

[0149] If the judgment result is no, then executing S404, it is determined whether the random verification codes of the two parties are consistent.

[0150] S403: Use the persistent partition as the first priority path.

[0151] It can be understood that when the random check codes of the three partitions are the same, it can be determined that the data of the three partitions are consistent, and the three partitions can obtain accurate battery management data. The persistent partition can be selected as the first priority path. This is because the persistent partition is a permanent storage area, and the battery management data stored is relatively complete. If there is no abnormality in the persistent partition, the persistent partition can be used as the first priority path.

[0152] S404, determining whether the random check codes of the two parties are consistent.

[0153] Exemplarily, if the random check codes of the three partitions are not all the same, it can be determined whether the random check codes of two partitions are the same.

[0154] If the judgment result is yes, then S406 is executed to use the persistent partition or the data partition as the first priority path.

[0155] If the judgment result is no, execute S405, take the OME partition as the first priority path, and try to obtain battery information from the cloud push file.

[0156] S405, taking the OME partition as the first priority path, and trying to obtain battery information from the cloud push file.

[0157] Exemplarily, in some embodiments of the present application, the OEM partition is a permanent storage area, and there will not be a situation where the file is full and overflowing and data cannot be read. Therefore, it can be considered that there will be no abnormality in the OEM partition. Therefore, when it is determined that there are no two partitions with the same random check code (that is, the random check codes of the three partitions are all different), the OEM partition can be used as the first priority path. Since the OEM partition only stores the key data in the battery management data, the battery management data of the OEM partition is incomplete. If the electronic device happens to receive the updated battery management data sent from the server (hereinafter referred to as the battery management data sent by the server is called the cloud push file), or the cloud push file has not been cleared, the electronic device can try to obtain the complete battery management data from the cloud push file.

[0158] S406: Use the persistent partition or the data partition as the first priority path.

[0159] For example, in some embodiments of the present application, since the OEM partition will not be unable to read the battery control data, when it is determined that the random check codes of two partitions are the same, one of them is the OEM partition. Since the battery control data of the OEM partition is incomplete, another partition can be selected as the first priority path. The other partition may be a persistent partition or a data partition.

[0160] S407, obtaining battery management and control data from the first priority path, and executing the battery management and control plan.

[0161] For example, in some embodiments of the present application, after the first priority path is determined, the battery management data can be obtained from the first priority path. Then the electronic device determines and executes a corresponding battery management plan according to the battery status information.

[0162] For example, in some cases, if the electronic device determines that the battery is abnormal based on the battery management data and the user has not replaced the battery, the electronic device can perform power limiting management on the battery based on the battery status information. For example, if the actual battery capacity is less than the rated battery capacity and the battery management data indicates that there is a problem with the battery, the electronic device can select the battery power limiting level according to the battery condition to perform power limiting management on the battery.

[0163] In some embodiments, the electronic device determines that there is an abnormality in the battery based on the battery management data, but if the electronic device detects that the user has replaced the battery (for example, detects that the serial number of the current battery is different from the serial number of the power-limited battery), the power-limiting control on the battery can be canceled.

[0164] S407a: When there is a cloud push file and the battery management and control data under the first priority path is inconsistent with the battery management and control data in the cloud push file, update the information under the first priority path.

[0165] It can be understood that in some embodiments of the present application, when the electronic device obtains the battery management data to determine whether the battery is abnormal, if the electronic device obtains the cloud push file, it will also determine whether the cloud push file is consistent with the battery management data under the first priority path. If they are consistent, it means that the electronic device has obtained and stored the latest version of the battery management data, and the battery management can be performed based on the data under the first priority path.

[0166] If there is inconsistency, it means that the battery management data stored in the first priority path of the electronic device has not been updated, and the electronic device can update the data under the first priority path based on the cloud push file.

[0167] S407b, back up the information under the first priority path to the other two storage areas.

[0168] For example, after the first priority path is determined, or after the first priority path is updated through a cloud push file, the battery management data under the first priority path can be backed up to the remaining two storage areas, and the random check codes of the three storage areas can be refreshed, so that the first priority path can be determined next time.

[0169] In summary, after the electronic device starts battery detection, in order to ensure that the electronic device can obtain accurate battery control data, each partition storing battery control data is verified, thereby ensuring the reliability of battery control. In addition, by storing the key information of battery control data in the OEM partition, when there are abnormalities in the battery control data of other partitions, the key information of battery control can also be obtained from the OEM partition, thereby executing the most basic battery control plan to ensure the safety of electronic equipment.

[0170] Next, we introduce the interactive process of battery management and control of electronic devices.

[0171] For example, Figure 5 According to some embodiments of the present application, an interactive flow chart for battery management and control of an electronic device is shown.

[0172] Exemplarily, each of the following processes is executed after the electronic device starts battery detection, for example.

[0173] like Figure 5 As shown, the interaction process includes:

[0174] S501, the mobile phone manager obtains battery management data.

[0175] For example, in some embodiments of the present application, after the electronic device detects that the battery starts to charge, the electronic device restarts, or the mobile phone manager restarts, the electronic device can obtain battery management data from the persistent partition, OEM partition, and data partition to perform battery detection. If the electronic device receives a cloud push file, it can also obtain battery management data from the cloud push file.

[0176] S502: The mobile phone manager determines a first priority path based on the random check code.

[0177] Exemplarily, the battery management data of each partition also includes a random check code, and the mobile manager can determine the first priority path according to the random check code of each partition. Exemplarily, the process of determining the first priority path can refer to Figure 3 or Figure 4 The corresponding embodiments.

[0178] S503, the mobile phone manager backs up the battery management and control data of the first priority path to other storage areas.

[0179] Exemplarily, in some embodiments of the present application, after determining the first priority path, the battery control data under the first priority path is selected for battery control. It can be understood that if the electronic device receives a cloud push file, the cloud push file can be compared with the battery control data under the first priority path. In some embodiments, the battery control data also includes a version number. That is, each time the server updates the battery control data, the corresponding version number will also be updated. If the version number of the battery control data of the current cloud push file is greater than the version number of the battery control data under the first priority path, the information under the first priority path can be updated based on the cloud push file.

[0180] After the battery management and control data under the first priority path is obtained or the battery management and control data under the first priority path is updated, the battery management and control data is backed up to the other two partitions, and the random check code of each partition is refreshed.

[0181] S504, the kernel layer uploads the battery status information to the healthd monitoring layer.

[0182] For example, after the mobile phone manager obtains the battery management data, it can continue to obtain the battery status information and determine the level of the battery management scheme based on the battery status information. For example, the healthd monitoring layer of the local layer can obtain the battery status information from the kernel layer based on the HIDL interface. For example, the battery serial number, charging voltage, battery capacity, charging current, charging temperature and other data.

[0183] S505, the healthd monitoring layer uploads the battery status information to the battery service.

[0184] For example, after the healthd monitoring layer obtains the battery status information, it can upload the battery status information to the battery service of the framework layer.

[0185] S506, the battery service will upload the battery status information to the mobile phone manager.

[0186] Exemplarily, the battery service may upload battery status information to the mobile phone manager.

[0187] S507, the mobile phone manager makes a power limit decision based on the battery status information.

[0188] It can be understood that in some embodiments, different levels of battery risk are defined according to the different severity of battery abnormalities. For example, if there is one battery status information abnormality, the battery risk level is considered to be level three; if there are two battery status information abnormalities, the battery risk level is considered to be level two; if there are at least two battery status information abnormalities, the battery risk level is considered to be level one. The risk level of level one is greater than that of level two, and the risk level of level two is greater than that of level three. The mobile phone manager can determine the risk level of the battery based on the battery status information and perform corresponding power restriction control.

[0189] In some embodiments, the mobile phone manager can also determine whether the user has replaced the battery based on the battery serial number, and cancel the power limit control on the battery after the user replaces the battery.

[0190] S508, the mobile phone manager sends battery management information to the battery service.

[0191] For example, after the mobile phone manager determines the battery control information according to the risk level of the battery, the battery control information can be sent to the battery service. The battery control information may include, for example, a power limit flag (the level of power limit on the battery can be determined according to the battery risk level). Exemplarily, if the first priority path is the OEM partition, and the acquired battery control information only includes the key data of the OEM partition, the power limit flag is the highest level, and the electronic device implements the most stringent battery control plan.

[0192] In other embodiments, after the mobile phone manager determines that the user has replaced the battery, it can also send battery management information to cancel the power limit.

[0193] S509: The battery service sends battery management information to the healthd monitoring layer.

[0194] Exemplarily, after receiving the battery control information, the battery service may send the battery control information to the healthd monitoring layer.

[0195] S510: The healthd monitoring layer sends battery control information to the kernel layer.

[0196] Exemplarily, the healthd monitoring layer can send battery management information to the kernel layer based on the HIDL interface.

[0197] S511, the kernel layer controls the battery based on the battery control information.

[0198] Exemplarily, after receiving the battery management and control information, the core layer may limit the power of the battery or cancel the power limitation of the battery based on the battery management and control information.

[0199] For example, when the battery management information indicates that the battery capacity is limited to 70% of the maximum capacity, the charging management module of the kernel layer can adjust the charging current ratio and end the battery charging when the battery power reaches 70%.

[0200] Or after the battery management and control information indicates that the power limiting of the battery has ended, the charging management module of the kernel layer can end the power limiting of the battery, and the battery can be charged to the current maximum capacity.

[0201] It can be understood that in the above interaction process, after the mobile phone manager obtains the battery management data, it can obtain the battery status information from the kernel layer of the electronic device, and determine the battery management plan in combination with the battery management data. For example, according to the risk level of the battery, different levels of power restriction are applied to the battery. And, after determining that the user has replaced the battery, the power restriction on the battery is ended.

[0202] Next, we will introduce the implementation process of the mobile phone manager to manage the battery.

[0203] For example, Figure 6 According to some embodiments of the present application, a flowchart for implementing battery management and control by an electronic device is shown.

[0204] Exemplarily, the executor of each of the following processes is the aforementioned electronic device (or the mobile phone manager on the electronic device). When introducing the following processes, there is no limitation on the executor of each process.

[0205] like Figure 6 As shown, the implementation process includes:

[0206] S601, determining whether the battery serial number is successfully obtained.

[0207] For example, in some embodiments, after the mobile phone manager of the electronic device obtains the battery management data, it can first determine whether the electronic device has replaced the battery. For example, in some embodiments, it can be determined by the serial number of the battery whether the user has replaced the battery. However, some electronic devices may not be able to obtain the serial number of the battery (for example, for some batteries without a battery chip, the mobile phone manager of the electronic device may not be able to obtain the serial number of the battery), so the mobile phone manager can determine whether the battery serial number has been successfully obtained.

[0208] If the judgment result is yes, then it is determined whether the current battery serial number is a battery serial number with limited power.

[0209] If the determination result is no, then determining whether the current number of battery charging cycles exceeds a preset value is performed.

[0210] S602, determining whether the current battery serial number is a battery serial number with limited power.

[0211] In some embodiments, if the mobile phone manager can obtain the serial number of the battery, it can determine whether the serial number of the current battery of the electronic device is the serial number of a limited-power battery. The limited-power battery is an abnormal battery in the battery management and control data.

[0212] If the judgment result is yes, then S605 is executed to output a second indication that the battery has not been replaced.

[0213] If the judgment result is no, S604 is executed to output a first identification indicating that the battery has been replaced.

[0214] S603, determining whether the current number of battery charging cycles exceeds a preset value.

[0215] Exemplarily, if the mobile phone manager cannot obtain the battery serial number of the electronic device, it can determine whether the user has replaced the battery based on the number of charging cycles of the battery. For example, a preset value for the number of charging cycles can be set (e.g., any value between 5 and 10 times). It can be understood that if the number of charging cycles of the current battery is greater than the preset value, it means that the current battery is an old battery and the user has not replaced it with a new battery. If the number of charging cycles of the current battery is less than or equal to the preset value, it can be determined that the user has replaced the battery.

[0216] That is, if the judgment result is yes, S605 is executed to output a second indication that the battery has not been replaced.

[0217] If the judgment result is no, S604 is executed to output a first identification indicating that the battery has been replaced.

[0218] S604: Output a first identification indicating that the battery has been replaced.

[0219] For example, in some embodiments, the first identifier may indicate that the user has replaced the battery, for example, the first identifier is 1. In some embodiments, other identifiers may also be used to indicate that the user has replaced the battery.

[0220] S605: Output a second indication that the battery has not been replaced.

[0221] Exemplarily, in some embodiments, the second identifier may indicate that the user has not replaced the battery, for example, the second identifier is 0. In some embodiments, other identifiers may also be used to indicate that the user has not replaced the battery.

[0222] It is understood that in some embodiments, the difference between the user replacing the battery and not replacing the battery can also be determined by an indicator. For example, after the user replaces the battery, an indicator can be output to indicate that the user has replaced the battery. When the user does not replace the battery, no indicator is output. Alternatively, when the user does not replace the battery, an indicator is output, and when the user replaces the battery, no indicator is output.

[0223] S606, determine whether there is a battery management and control solution.

[0224] For example, in some embodiments of the present application, some electronic devices may not have a battery management solution. Therefore, before performing power restriction management on the electronic device, it can be determined whether the current electronic device has a battery management solution.

[0225] If the judgment result is yes, then S607 is executed to judge whether the version number of the current battery management and control data is greater than the version number of the stored battery management and control data.

[0226] If the judgment result is no, the power restriction control is terminated.

[0227] S607: Determine whether the version number of the current battery management and control data is greater than the version number of the stored battery management and control data.

[0228] Exemplarily, in some embodiments, the version number of the new battery management data is greater than the version number of the old battery management data. After the mobile phone manager obtains the battery management data, if the user has replaced the battery, the above steps can obtain the first identification indicating the replacement of the battery. However, when the user charges the electronic device again (the mobile phone manager determines again whether the user has replaced the battery), the serial number of the battery can be used to determine that the user has not replaced the battery (in this case, the user has replaced the battery, but the battery serial number used to determine whether the battery has been replaced has been updated, resulting in the judgment result that the user has not replaced the battery.), because the user has replaced the battery, the mobile phone manager has determined that the battery does not need to be restricted, but the battery management data will still indicate that the battery is abnormal. Therefore, in this case, if the mobile phone manager determines that the user has replaced the battery, the mobile phone manager can store the version number of the current battery management data. If the version number of the current battery management data is the same as the version number of the battery management data stored by the mobile phone manager, it can be determined that the mobile phone manager has controlled the battery, and the user has also replaced the battery, so the battery will not be restricted.

[0229] If the version number of the current battery management data is greater than the version number of the stored battery management data, it means that the mobile manager has obtained new battery management data and needs to manage the battery again.

[0230] That is, if the judgment result is yes, then S608 is executed to determine whether the battery needs to be replaced.

[0231] If the judgment result is no, then S612 is executed to not limit the battery power.

[0232] S608, determine whether to replace the battery.

[0233] For example, if the version number of the current battery management data is greater than the version number of the battery management data already stored in the mobile phone manager, the mobile phone manager can determine whether the user has replaced the battery. For example, it can determine whether the user has replaced the battery based on the output results of the above S604 and S605.

[0234] If the judgment result is yes, then S609 is executed to store the version number of the current battery management and control data and clear the number of power-limiting cycles.

[0235] If the result of the judgment is no, then S610 is executed to store the current battery management and control data, and to set the number of power-limiting cycles. If the number of power-limiting cycles exists, the number of power-limiting cycles is adjusted.

[0236] S609, store the version number of the current battery management and control data, and clear the number of power-limiting cycles.

[0237] Exemplarily, in some embodiments, after the mobile phone manager determines that the user has replaced the battery, the version number of the current battery management data can be stored. Because after the current mobile phone manager determines that the user has replaced the battery, it can store the serial number of the new battery. When the next time it is determined whether the user has replaced the battery, since the battery serial number has been updated to the serial number of the new battery, the judgment result is that the user has not replaced the battery. But at this time the user has already replaced the battery, there is no need to limit the power of the battery. Therefore, after the mobile phone manager determines that the user has replaced the battery, the version number of the current battery management data can be stored. It is used to determine whether there is new battery management data (battery management data with a version number greater than the currently stored battery management data) to control the battery.

[0238] In other embodiments, if the electronic device receives new battery management data sent by the server indicating that there is a problem with the battery, and immediately performs a power-limiting management operation, it will give the user an intuitive feeling that the risk of the battery is caused by the application version (parameter) update operation, which may cause the user to be dissatisfied with the application version update operation. Therefore, when the mobile phone butler determines that the battery needs to be limited, the number of power-limiting cycles can be set. When the number of times the electronic device is recharged exceeds the number of power-limiting cycles, the mobile phone butler will limit the power of the battery again. This avoids the user thinking that the risk of the battery is caused by the application version (parameter) update operation. However, if the mobile phone butler has set the number of power-limiting cycles, but the number of times the electronic device is recharged has not reached the number of power-limiting cycles (that is, when the mobile phone butler has not yet limited the battery), the user has replaced the battery. Therefore, in this case, the mobile phone butler can clear the number of power-limiting cycles.

[0239] S610, storing current battery management and control data, and setting the number of power-limiting cycles, and adjusting the number of power-limiting cycles if there is one.

[0240] Exemplarily, in some embodiments of the present application, if the electronic device receives new battery management and control data sent by the server indicating that there is a problem with the battery, and immediately performs a power-limiting management and control operation, it will give the user an intuitive feeling that the risk of the battery is caused by the application version (parameter) update operation, which may cause the user to be dissatisfied with the application version update operation. Therefore, when the mobile phone manager determines that the battery needs to be limited, the number of power-limiting cycles can be set. When the number of recharges of the electronic device exceeds the number of power-limiting cycles, the mobile phone manager will limit the power of the battery again. This avoids the user thinking that the risk of the battery is caused by the application version (parameter) update operation. It can be understood that if the number of power-limiting cycles already exists, the number of power-limiting cycles can be adjusted.

[0241] For example, the mobile phone manager determines that the version number of the current battery management data is greater than the version number of the stored battery management data, and the user has not replaced the battery. The mobile phone manager can set the number of power-limiting cycles (for example, any value from 5 to 20 times, and 10 times can be used in the embodiment of the present application). When the user charges the phone next time, the mobile phone manager has set the number of power-limiting cycles (for example, 10 times), then the mobile phone manager can perform a charging count, for example, the current number of charges is 1. In other implementations, the adjustment of the number of power-limiting cycles can also be, for example, recording the number of charges minus 1, and the remaining number of charges is 9 times. This application does not limit the adjustment of the number of power-limiting cycles.

[0242] S611, determining whether the number of power-limiting cycles reaches a threshold.

[0243] For example, in some embodiments of the present application, after the mobile phone manager sets the number of power-limiting cycles, the number of power-limiting cycles will be adjusted each time the electronic device is charged. When the number of power-limiting cycles reaches a threshold, the battery starts to be limited.

[0244] That is to say, if the judgment result is yes, S613 is executed, the power limiting operation is performed according to the battery management information, and the user is prompted to replace the battery.

[0245] If the judgment result is no, then S612 is executed to not limit the battery power.

[0246] S612: Do not limit the battery power.

[0247] In some embodiments of the present application, in order to prevent users from thinking that the battery risk is caused by the application version (parameter) update operation, after determining that the battery is at risk, the electronic device can continue to charge normally, and before the number of times the electronic device continues to charge normally does not reach the power limit cycle number, the mobile phone manager will not limit the battery power, thereby avoiding a bad user experience.

[0248] S613: Execute power limiting operation according to the battery management and control information, and prompt the user to replace the battery.

[0249] For example, in some embodiments of the present application, after the mobile phone manager determines that the battery management data indicates that the battery is at risk and the battery continues to charge to reach a threshold number of power-limiting cycles, the mobile phone manager can perform a power-limiting operation on the battery based on the battery management information and prompt the user to replace the battery.

[0250] To sum up, after the mobile phone manager obtains the battery management data, it can perform battery management (for example, turning on or off power limiting, etc.) based on the battery status information of the battery and whether the user has replaced the battery.

[0251] Taking a mobile phone as an example, the electronic devices involved in some embodiments of the present invention are described in detail below.

[0252] Figure 7 According to an embodiment of the present application, a structural schematic diagram of an electronic device is shown.

[0253] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0254] It is to be understood that the structure illustrated in the embodiment of the present invention 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 separate 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.

[0255] 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.

[0256] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0257] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, 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.

[0258] 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.

[0259] The charging management module 140 is used to receive charging input from a charger.

[0260] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0261] 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.

[0262] 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 the antennas.

[0263] 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.

[0264] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and may be set in the same device as the mobile communication module 150 or other functional modules.

[0265] 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), 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 frequency of the electromagnetic wave signal and filters it, 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 of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0266] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a glass cover 10 and a display panel 20. The display panel 20 can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Mini-LED, Micro-LED, Micro-OLED, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0267] The camera 193 is used to capture still images or videos.

[0268] 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, such as storing music, video and other files in the external memory card.

[0269] 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 applications and 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. In some embodiments of the present application, the internal memory 121 may also store battery control data so that the mobile phone manager obtains battery control data from the internal memory to perform corresponding battery control.

[0270] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0271] The temperature sensor 180J in the sensor module 180 of the electronic device 100 can be used to detect the temperature. For example, in some embodiments, the electronic device 100 can detect the temperature of the electronic device 100 through the temperature sensor 180J. For example, during the charging process of the electronic device 100, if the electronic device 100 determines that the battery is abnormal, it can also detect the temperature in time while executing the power limit control, and make a more timely response. For example, when the temperature of the electronic device 100 is not considered, the electronic device 100 determines that the battery control data includes a first identifier that indicates that the battery is abnormal (or when the first identifier is a first value). During the charging process of the electronic device 100, the electronic device 100 stops the charging operation after determining that the charging power reaches a preset threshold. After considering the temperature of the electronic device 100, the electronic device 100 determines that the battery control data includes a first identifier that indicates that the battery is abnormal. During the charging process of the electronic device 100, if the temperature of the electronic device 100 reaches the temperature threshold, or the power reaches the preset threshold, the electronic device 100 will stop the charging operation. The charging of the electronic device 100 is limited and managed based on the temperature and charging power of the electronic device 100, effectively reducing the risks that may be caused by abnormal batteries.

[0272] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (e.g., x, y, and z axes) can be determined by the gyro sensor 180B. The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected.

[0273] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0274] The embodiments of the present application also provide a program product, which, when executed on an electronic device, can enable the electronic device to implement the methods provided in the aforementioned embodiments.

[0275] An embodiment of the present application further provides a readable storage medium, in which one or more programs are stored. When the one or more programs are executed by an electronic device, the electronic device implements the methods provided in the aforementioned embodiments.

[0276] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.

[0277] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor, a microcontroller, an application specific integrated circuit, or a microprocessor.

[0278] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

[0279] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried by or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed over a network or through other computer-readable media. Therefore, a machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including, but not limited to, floppy disks, optical disks, optical discs, compact disc-read only memory (CD-ROMs), magneto-optical disks, read-only memory (ROM), random-access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information using the Internet in an electrical, optical, acoustic or other form of propagation signal (e.g., carrier wave, infrared signal, digital signal, etc.). Therefore, a machine-readable medium includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).

[0280] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.

[0281] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.

[0282] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0283] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.

Claims

1. A device management and control method, applied to electronic equipment, characterized in that: The electronic device includes a memory, the memory includes a persistent partition and a first partition, the first partition includes an original equipment manufacturer partition, the persistent partition stores first battery management and control data, and the persistent partition is capable of persistently storing data; The method comprises: An instruction to control the battery of the electronic device is detected; Corresponding to the fact that the persistent partition is full of data, resulting in abnormal reading of the first battery management and control data in the persistent partition, the battery is managed based on the second battery management and control data backed up in the first partition; The OEM partition allocates an independent space to store the second battery management and control data, and other data in the OEM partition does not affect the independent space corresponding to the second battery management and control data; The first partition further includes a data partition, and the second battery management and control data includes first sub-data and second sub-data; wherein the first sub-data is stored in an independent space allocated in the OEM partition, and the second sub-data is stored in the data partition; Furthermore, the number of battery control parameters corresponding to the first sub-data is less than the number of battery control parameters corresponding to the first battery control data, and the number of battery control parameters corresponding to the second sub-data is the same as the number of battery control parameters corresponding to the first battery control data; The battery control parameters in the first sub-data include a power limit flag for performing power limit management on the battery and a serial number of the battery, wherein the power limit flag is used by the electronic device to perform corresponding power limit management on the battery based on the first-level risk level; The risk level is determined based on the severity of the battery abnormality, the risk level of level 1 is greater than the risk level of level 2, and the risk level of level 2 is greater than the risk level of level 3; The battery risk level is level one, and the corresponding maximum charge amount of the battery is limited to a first value; the battery risk level is level two, and the corresponding maximum charge amount of the battery is limited to a second value; the battery risk level is level three, and the corresponding maximum charge amount of the battery is limited to a third value; The third value is greater than the second value, and the second value is greater than the first value.

2. The method according to claim 1, characterized in that The first battery control data in the persistent partition is read abnormally, including: the first battery control data read from the persistent partition does not match the second battery control data read from the first partition; Alternatively, the first battery management and control data cannot be read from the persistent partition.

3. The method according to claim 2, characterized in that The first battery management and control data read from the persistent partition does not match the second battery management and control data read from the first partition, including: The first sub-data does not match the first battery management data, and the second sub-data does not match the first battery management data.

4. The method according to claim 3, characterized in that The controlling the battery based on the second battery control data backed up in the first partition includes: Corresponding to the first sub-data matching the second sub-data, the second sub-data is used to control the battery; Corresponding to the first sub-data not matching the second sub-data, the first sub-data is used to manage and control the battery.

5. The method according to claim 4, characterized in that The persistent partition further stores a first check code corresponding to the first battery management and control data, the OEM partition further stores a second check code corresponding to the first sub-data, and the data partition further stores a third check code corresponding to the second sub-data; The first sub-data does not match the first battery management data, and the second sub-data does not match the first battery management data, including: The first check code is different from the second check code, and the first check code is different from the third check code; The corresponding matching of the first sub-data and the second sub-data includes: The second check code is the same as the third check code; The corresponding to the first sub-data not matching the second sub-data includes: The second check code is different from the third check code.

6. The method according to claim 2, characterized in that Acquire third battery management and control data, where the third battery management and control data corresponds to a fourth verification code; Writing the third battery management and control data and the fourth verification code into the persistent partition; partitioning the third battery management and control data and the fourth check code into the data partition; And write at least part of the third battery management and control data and the fourth check code into the original equipment manufacturer partition.

7. The method according to claim 2, characterized in that The battery control parameters in the first control data include a power limit flag, a battery serial number, a maximum charge state, a minimum charge state, a version number, and a termination charging voltage.

8. The method according to claim 1, characterized in that The detecting of the instruction to control the battery of the electronic device includes: It is detected that the electronic device starts charging, the electronic device restarts, or the first application for managing the battery restarts.

9. An electronic device, characterized in that: The invention comprises: a memory for storing instructions; At least one processor is used to execute the instructions so that the electronic device implements the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 8.

11. A computer program product, characterized in that When the computer program product is executed on a device, the device is caused to perform the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Terminal battery abnormity management and control method and mobile terminal

    CN116723268A