A method for identifying version compatibility and an electronic device
By implementing the version compatibility recognition method in electronic devices, identifying and intercepting the incompatibility of operating system versions, the problem of interface call abnormalities caused by version incompatibility of electronic devices when updating application services or system services is solved, and the stability and user experience of the device are improved.
Patent Information
- Application Number
- CN202311509244.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-10
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2043-11-10
AI Technical Summary
When an electronic device updates the application service or system service, interface call exceptions may occur due to incompatibility of the operating system version.
By implementing the version compatibility recognition method in an electronic device, the operating system version information supported by the object and the current operating system version information are obtained, and the interface call request is intercepted when the version is incompatible to avoid exceptions.
It effectively avoids interface call process exceptions caused by incompatibility of operating system versions, and improves the stability and user experience of electronic devices.
Smart Images

Figure CN118467020B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the technical field of electronic devices, and in particular, to a method for identifying version compatibility and an electronic device. Background Art
[0002] In traditional operating systems, upgrades or version updates of application services / system services are all carried out through system image files. With the development of operating system technology, system services and application services can already support independent updates. Exemplarily, an electronic device can update some system services separately while not updating other system services; or, the electronic device can only update application services and not update system services. In some scenarios, the electronic device can perform version updates of some application services / some system services through an updatable module. Among them, the updatable module includes interface information of the application service / system service to be updated.
[0003] Since the system image file and the updatable module are updated independently of each other, the electronic device is prone to the problem that the version of the application service / system service updated in the updatable module is incompatible with the version of the current operating system, resulting in anomalies when the electronic device calls the application service / system service. Summary of the Invention
[0004] Embodiments of the present application provide a method for identifying version compatibility and an electronic device. When an interface call request for an object is received, in the case where it is determined that the version of the object is incompatible with the version of the current operating system, the interface call request for the object is intercepted, and the electronic device no longer continues to execute the interface call operation, avoiding the problem of abnormal interface call processes caused by the non-support of the operating system version.
[0005] To achieve the above object, the embodiments of the present application adopt the following technical solutions.
[0006] In a first aspect, a method for identifying version compatibility is provided, which is applied to an electronic device. The electronic device includes a system image file and an updatable module. Among them, the system image file is used for version updates of the operating system of the electronic device; the updatable module is used for version updates of some objects of the operating system. The objects of the operating system include application services and / or system services. The update of the system image file is independent of the update of the updatable module.
[0007] The method for identifying version compatibility includes:
[0008] In response to an interface call request for an object, the electronic device obtains first update information of the operating system supported by the object.
[0009] Among them, the update information includes the version data of the operating system and the update data of the operating system based on at least one updatable program block.
[0010] The electronic device obtains the second update information of the current operating system. When the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, the electronic device intercepts the interface call request.
[0011] In this application, when the electronic device receives an interface call request for an object, it can obtain the first update information of the operating system supported by the object and the second update information of the current operating system of the electronic device. It can compare the operating system version indicated by the first update information of the object with the operating system version indicated by the second update information of the electronic device. When it is determined that the operating system version indicated by the second update information does not support the operating system version indicated by the first update information, the interface call request for the object is intercepted, and the electronic device no longer continues to execute the interface call operation of the object, avoiding the problem of abnormal interface call process caused by the non - support of the operating system version, and simply and effectively identifying, judging and processing the compatibility between the operating system version supported by the object and the current operating system version.
[0012] In a possible implementation manner of the first aspect, the updatable program block includes script files of at least one object, and the script files corresponding to at least one object include the first update information of the operating system supported by the object.
[0013] Then, obtaining the first update information of the operating system supported by the object includes:
[0014] The electronic device scans the comments in the script files of at least one object in the updatable program block to obtain the first update information of the operating system supported by the object.
[0015] In this application, marking the update information of the operating system supported by the application service / system service through comments simply and effectively provides data support for the electronic device to identify and judge version compatibility, simplifies the process of the electronic device to identify and judge version compatibility, and improves the efficiency of the electronic device to identify and judge version compatibility.
[0016] In another possible implementation manner of the first aspect, the method further includes:
[0017] The electronic device obtains the initial update information of the operating system. The initial update information includes the version data of the operating system and the initial update data of the updatable program block. Among them, the initial update data is the first value.
[0018] The electronic device periodically scans the update information of the operating system.
[0019] If the electronic device detects a version update for at least one object based on the updatable program block in the first period, the electronic device updates the update data of the updatable program block to a second value in the second period. Wherein, the difference between the second value and the first value is the number of times the updatable program block performs a version update for at least one object in the first period, and the second period is the subsequent period in the adjacent time sequence of the first period.
[0020] The electronic device obtains second update information according to the update data of the updated updatable program block and the version data of the operating system.
[0021] In this application, the electronic device periodically detects whether there is a change in the update information of the operating system, and can obtain valid and accurate update information of the current operating system, thereby improving the accuracy of version compatibility recognition.
[0022] In another possible implementation manner of the first aspect, the method further includes:
[0023] The electronic device obtains initial update information of the operating system, and the initial update information includes the version data of the operating system and the initial update data of the updatable program block. Wherein, the initial update data is the first value.
[0024] If the electronic device detects a version update for the updatable program block pair each time, the electronic device updates the initial update data of the updatable program block to a second value, and the difference between the second value and the first value is 1. The electronic device obtains second update information according to the updated update data of the updatable program block and the version data of the operating system.
[0025] In this application, when the electronic device detects whether there is a change in the update information of the operating system each time, it updates the second update information of the current system, which can effectively improve the accuracy of version compatibility recognition.
[0026] In another possible implementation manner of the first aspect, the method further includes:
[0027] When the electronic device detects that the operating system is powered on, it obtains the second update information of the operating system. The electronic device stores the second update information in the version information management space of the electronic device.
[0028] Then, the electronic device obtains the second update information of the current operating system, including:
[0029] The electronic device obtains the second update information from the version information management space.
[0030] Among them, the situations where the operating system is powered on include that the electronic device updates the version of the operating system based on the system image file, and / or the electronic device updates the version of some objects of the operating system based on the updatable program block.
[0031] In this application, when the electronic device reads the second update information of the current operating system each time the operating system is powered on and stores the second update information in the version information management space, any application service / system service in the electronic device has the permission to access the version information management module to obtain the second update information. During the subsequent interface call process of any application service / system service, version compatibility identification and judgment can be performed based on the obtained second update information and the first update information supported by itself, reducing the redundant definition of each interface and optimizing the version compatibility identification and judgment performance of the electronic device.
[0032] In another possible implementation manner of the first aspect, the method further includes:
[0033] The electronic device executes the step of obtaining the second update information of the current operating system by calling a preset version management method class. In the case where the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, the electronic device intercepts the interface call request; the object of the operating system has the permission to call the preset version management method class.
[0034] In this application, the preset version management method class can be called by any application service / system service in the operating system to perform version compatibility judgment between the version of the application service / system service supporting the operating system and the version of the current operating system. There is no need to define corresponding reflection interfaces for identifying version compatibility for each application service / system service, reducing the development cost of version compatibility judgment and improving the performance of the electronic device in implementing version compatibility identification and judgment in application services / system services.
[0035] In another possible implementation manner of the first aspect, after the electronic device intercepts the interface call request, the method further includes:
[0036] The electronic device outputs a prompt message, and the prompt message is used to prompt the user that the version of the operating system of the electronic device does not support the implementation of the object.
[0037] In this application, the electronic device can interact with the user by outputting a prompt message, enabling the user to perceive that the version of the operating system supported by the application service / system service triggered by the user is incompatible with the version of the current operating system of the electronic device, and then perform operations such as updating the version of the operating system, improving the user experience of using the electronic device.
[0038] In a second aspect, an electronic device is provided. The electronic device includes a memory, a display screen, and one or more processors; the memory and the display screen are coupled to the processor; computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device is caused to execute the method according to any one of the above first aspects.
[0039] In a third aspect, a computer-readable storage medium is provided. Instructions are stored in the computer-readable storage medium. When the instructions are run on an electronic device, the electronic device can execute the method according to any one of the above first aspects.
[0040] In a fourth aspect, a computer program product including instructions is provided. When the computer program product is run on an electronic device, the electronic device can execute the method according to any one of the above first aspects.
[0041] In a fifth aspect, an embodiment of the present application provides a chip. The chip includes a processor, and the processor is configured to call a computer program in a memory to execute the method according to the first aspect.
[0042] It can be understood that for the beneficial effects that can be achieved by the electronic device described in the above second aspect, the computer-readable storage medium described in the third aspect, the computer program product described in the fourth aspect, and the chip described in the fifth aspect, reference can be made to the beneficial effects in the first aspect and any possible design thereof, which will not be elaborated herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 FIG. is a schematic diagram of a scenario where an application of an electronic device provided by an embodiment of the present application can be updated through an updatable program block or a system image file;
[0044] Figure 2 FIG. is a schematic diagram of a relationship where there may be compatibility issues between different objects provided by an embodiment of the present application;
[0045] Figure 3 FIG. is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;
[0046] Figure 4 FIG. is a software structure block diagram of an electronic device provided by an embodiment of the present application;
[0047] Figure 5 FIG. is a schematic flowchart of a method for identifying version compatibility provided by an embodiment of the present application;
[0048] Figure 6 FIG. is a schematic diagram of an operating system version update provided by an embodiment of the present application;
[0049] Figure 7 Another schematic diagram of operating system version update provided by an embodiment of the present application;
[0050] Figure 8 A flowchart of an electronic device obtaining second update information provided by an embodiment of the present application;
[0051] Figure 9 A schematic diagram of an interface for an electronic device to display prompt information and guiding information provided by an embodiment of the present application. Detailed implementation manners
[0052] In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "the", "above-mentioned", "this" and "such" are also intended to include expressions such as "one or more", unless clearly indicated to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one" and "one or more" mean one or more than two (including two). The term "and / or" is used to describe the association relationship of associated objects and means that three relationships may exist; for example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship.
[0053] The reference to "an embodiment" or "some embodiments" etc. described in this specification means that a specific feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, the statements "in an embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments" etc. appearing in different places in this specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "include", "comprise", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise stated. "First" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features.
[0054] In the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.
[0055] In the application scenarios of the prior art, an electronic device needs to install an operating system before it can be used by a user. In order to meet the user's functional requirements for the electronic device, the operating system of the electronic device has been upgraded multiple times regularly or irregularly since the release of the first version. After a new version of the operating system is released, the electronic device can update / upgrade the operating system in the electronic device by downloading the image file of the operating system.
[0056] Taking the operating system as an example, generally, the image file of the read-only memory (ROM) system of the operating system includes a system image file, a user data image file, a memory disk image file, a Linux kernel image file, a recovery image file (Recovery image file), and a cache image file, etc. Among them, the system image file is used to store the core files of the system, and the system image file includes the main directories and files of the system. The user data image is used to store data related to the user. For example, the data can be data generated during the user's use of the system. The memory disk image is used to store the core files to be loaded when the Linux kernel starts. The Linux kernel image contains the kernel binary and the memory disk image. The Recovery image file is often used for flashing. The cache image is used to store temporary data generated by the system or applications.
[0057] This embodiment mainly relates to the system image file, and the electronic device can update the version of the operating system through the system image file.
[0058] With the increase in the user's requirements for the functions of the operating system and the consideration of the cost of operating system version updates, existing operating systems have begun to support the update of some system services or some application services of the operating system through an update module. Referring to Figure 1 , Figure 1 shows a schematic diagram of a scenario where an application of an electronic device can be updated through an update module or the system image file of the operating system. Figure 1 In, Application 1 can be updated through the system image file of the operating system (such asFigure 1 (indicated by the solid line in the figure). If Application 1 needs to be updated, it can also be updated through the updatable program block (as Figure 1 (indicated by the dashed line in the figure). Application 2 can be updated through the updatable program block (as Figure 1 (indicated by the solid line in the figure); if the system image file of the operating system includes a new version of Application 2, Application 2 can also be updated through the system image file of the operating system (as Figure 1 (indicated by the dashed line in the figure).
[0059] The system image file and the update module can be updated independently of each other. The system image file is used to upgrade the firmware of the operating system through over-the-air (OTA) technology. The version update of the operating system based on the system image file is a global update. Therefore, the frequency of releasing new versions of the system image file is relatively low, and the production cycle is relatively long. For example, when the electronic device is a mobile phone, after a new version of the operating system is released, the mobile phone can obtain the system image file through OTA. After obtaining the system image file, a prompt message indicating that the operating system can be upgraded can be output. If the user triggers the operation of upgrading the version of the operating system, the mobile phone can be restarted. During the restart process, the data of the operating system is updated based on the system image file. After the data of the operating system is updated, the mobile phone is powered on, and the mobile phone desktop or the new function guidance interface after the version update of the operating system is displayed after power-on, realizing the version update of the operating system.
[0060] The update module is a binary file used to update and upgrade some application services / some system services of the operating system.
[0061] The update module can be quickly deployed in the operating system, so it can be updated at any time when version update is needed. The frequency of version upgrade through the update module is higher than that of the operating system version upgrade through the system image file. Therefore, there may be a problem that the version of the operating system updated by the update module is not compatible with the version of the operating system updated by the system image file. If the objects updated based on the update module include objects that always run in the background of the operating system, the electronic device needs to be restarted, and the object data is overwritten during the restart process of the electronic device, so that the version update of the object is completed after power-on. If the objects updated based on the update module do not include objects that run in the background of the operating system, the object data can be overwritten in the background while the electronic device is in normal use, and the version update of the object is completed during the process of keeping the electronic device powered on all the time.
[0062] For ease of description, in the following embodiments, application services and system services are collectively referred to as objects.
[0063] Since all objects in the operating system are implemented by relying on the ROM system interface or the module interface, when the version of the operating system corresponding to the object updated by the update module is inconsistent with the version of the operating system updated by the system image file, compatibility issues may occur between the object, the update module, and the operating system. Refer to Figure 2 , Figure 2 shows a schematic diagram of the relationship where compatibility issues may exist between different objects. For example, when objects are application services (such as Figure 2 Application 1 and Application 2 shown) and their versions are updated by different update modules, the compatibility between the application service and the update module needs to be considered. For example, the update module may update the version of the object on different versions of the operating system, and the compatibility between the update module and the operating system needs to be considered. For example, the update module can update multiple system services to enable each system service to have an independent update ability, and the compatibility between system services of different update module versions also needs to be considered.
[0064] Exemplarily, there is a compatibility issue between the object and the operating system. For example, an electronic device updates an application service "Flashlight" through the update module, and the version of the operating system supported by this application service is Version 2. However, the current operating system version of the electronic device is Version 1. Since Version 2 is higher than Version 1, the "Flashlight" application service only supports running in the operating system of Version 2 and cannot run in the lower-version operating system of Version 1. Therefore, a compatibility issue between the "Flashlight" application and the operating system version occurs.
[0065] Exemplarily, there is also a compatibility issue between the object and the update module. For example, the version update of the "Flashlight" application service is completed by the update module 2, but the current update module 1 of the electronic device does not support the "Flashlight" application service. Therefore, it can be considered that there is an incompatibility issue between the "Flashlight" application service and the update module 1.
[0066] In some embodiments, the compatibility between the object and the operating system means that the operating system can support the functions that the object can provide. Corresponding function calls can also be implemented between different objects.
[0067] In some embodiments, there may also be a problem that corresponding functions cannot be called between different objects, that is, there may also be version compatibility problems between different objects. For example, the QR code scanning function of Application 1 on an electronic device needs to call the camera application, but because the version of the camera application is too low and does not support QR code scanning, the QR code scanning function of Application 1 cannot be implemented. Therefore, it can be considered that "there is an incompatibility problem between Application 1 and the camera application."
[0068] If the versions of some objects on the electronic device are inconsistent or incompatible with the version of the operating system, or the versions of some objects are inconsistent or incompatible with the version of the update module, then when calling the interfaces of application services / system services, since the version of the operating system or the version of the update module cannot support the implementation of the application services / system services, the underlying programs of the application services / system services will report exceptions, and the processes of the application services / system services will hang up.
[0069] For the case where the version of the object is inconsistent with the version of the operating system, compatibility identification can be processed by means of reflection. For example, when executing the function provided by the object, information such as the name of the interface of the object, input parameters, return value, etc. are obtained through the reflection interface, and the interface of the object is called through the reflection interface to execute the corresponding service, and it is determined whether the interface of the object exists from whether the service can be successfully executed, so as to determine whether the object is compatible with the operating system. For example, the object is the application service of the flash. When the electronic device responds to the interface call request of the flash, it executes the interface call operation of the flash, and obtains information such as the interface name, input parameters, return value, etc. corresponding to the flash through the reflection interface. The interface call operation of the flash is executed through the reflection interface. If an error occurs during the execution of the process, it means that the current version of the operating system does not support the flash service, and the version of the flash service is incompatible with the version of the operating system; if the execution is normal and the electronic device can control the flash to turn on or off, it means that the current version of the operating system supports the flash service, and the version of the flash service is compatible with the version of the operating system. In this way, the version compatibility identification result between the flash service and the operating system version is obtained.
[0070] This method of compatibility judgment based on the reflection interface requires separate processing of each interface of the object in the operating system one by one, with high cost and complex processing. When calling the interface of each object, it is necessary to obtain the interface information of the object to define the corresponding reflection interface, and each reflection interface needs to be customized, with high development cost and low performance of the electronic device for version compatibility identification.
[0071] An embodiment of the present application provides a version compatibility recognition method. When an electronic device responds to an interface call request for an object, it can obtain first update information of the operating system supported by the object and second update information of the current operating system. In the case where the operating system version indicated by the first update information does not support the operating system version indicated by the second update information (for example, when the operating system version indicated by the first update information is lower than the operating system version indicated by the second update information), the electronic device can intercept the interface call request to avoid abnormal calls to the object's interface. In this embodiment, the electronic device can directly obtain the first update information supported by the object, and perform version compatibility judgment based on the first update information and the second update information. The processing process is simple, improving the performance of the electronic device in version compatibility recognition.
[0072] The version compatibility recognition method provided by the embodiment of the present application can be applied to an electronic device. The electronic device can be a portable computer (such as a mobile phone), a tablet computer, a laptop computer, a personal computer (PC), a wearable electronic device (such as a smart watch), an augmented reality (AR) / virtual reality (VR) device, an in-vehicle computer, etc. The following embodiments do not impose special restrictions on the specific form of the electronic device.
[0073] Exemplarily, Figure 3 A schematic structural diagram of an electronic device 100 is given. 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 sensor module 180, a display screen 194, etc.
[0074] It can be understood that the structure schematically shown 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 certain components, or split certain components, or have different component arrangements. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware.
[0075] 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 processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0076] Among them, the controller may be the nerve center and command center of the electronic device 100. The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.
[0077] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may save the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0078] In some embodiments, the processor 110 may include one or more interfaces. The interfaces 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.
[0079] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are only illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0080] The charging management module 140 is used to receive a charging input from a charger. Herein, the charger may be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 may receive the charging input from the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 may also supply power to the electronic device through the power management module 141.
[0081] 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 the inputs from the battery 142 and / or the charging management module 140 and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, the wireless communication module 160, etc. The power management module 141 may also be used to monitor parameters such as the battery capacity, the number of battery cycles, and the battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.
[0082] The wireless communication function of the electronic device 100 may be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0083] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas may also be multiplexed to improve the utilization rate of the antennas. For example: the antenna 1 may be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna may be used in combination with a tuning switch.
[0084] The mobile communication module 150 may provide a solution for wireless communication including 2G / 3G / 4G / 5G, etc., which is applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be disposed in the same device.
[0085] In some embodiments, the electronic device may obtain the system image file or update module of the operating system from a cloud server or other specified server through the mobile communication module 150 to perform version update of the operating system or version update of an object. Alternatively, the electronic device may receive the system image file or update module of the operating system sent by a cloud server or other specified server through the mobile communication module 150 to perform version update of the operating system or version update of an object.
[0086] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and disposed in the same device as the mobile communication module 150 or other functional modules.
[0087] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive the signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.
[0088] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, such that electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).
[0089] Electronic device 100 implements a display function through a GPU, display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0090] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0091] In some embodiments, when the electronic device determines that the version of the operating system supported by the object does not support the current version of the operating system, after the electronic device intercepts the interface call request for the object, the electronic device can also output a prompt message on the display screen 194. The prompt message is used to prompt the user that the current version of the operating system is too low to implement the corresponding functions of the object. The prompt message can prompt the user to update the version of the operating system.
[0092] 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 the data storage function. For example, files such as music and videos are saved in the external memory card.
[0093] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, the image playback function, etc.). The data storage area can store the data created during the use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0094] The audio module 170 includes a speaker, a receiver, a microphone, a headphone jack, etc. The electronic device 100 can implement audio functions through the audio module 170, the speaker, the receiver, the microphone, the headphone jack, and the application processor, etc. For example, music playback, recording, etc.
[0095] In some embodiments, the electronic device can also output a voice prompt message through the audio module to prompt the user that the current operating system version is too low to implement the corresponding function of the object, or to prompt the user to update the operating system version.
[0096] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present invention, taking the system of the layered architecture as an example, the software structure of the electronic device 100 is exemplarily described.
[0097] Figure 4 is the software structure block diagram of the electronic device 100 in the embodiments of the present invention.
[0098] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers, from top to bottom are the application layer, the application framework layer, the service layer, and the memory.
[0099] The application layer may include a series of application packages. As Figure 4 shown, the application package may include multiple application programs such as Application 1.
[0100] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the application programs in the application layer. The application framework layer includes some predefined functions.
[0101] As Figure 4 shown, the application framework layer may include an Application 1 module that provides an API interface for Application 1, etc.
[0102] The service layer includes a system service module, a version configuration module, and a version information management module. Among them, the system service module can be the execution body of the version compatibility recognition method provided in the embodiments of the present application. The version configuration module can initialize the update information of the operating system. The second update information of the operating system can be saved in the version information management module. The first update information corresponding to the object of the operating system can be included in the memory.
[0103] When the system service module receives an interface call request for Application 1 sent by Application 1 module, it can obtain the first update information from the memory, obtain the second update information from the version information management module, and perform version compatibility identification based on the first update information and the second update information. If the version of the operating system indicated by the second update information supports the version of the operating system indicated by the first update information, the system service module can return a normal response to the interface call request to Application 1 module, so that Application 1 can perform interface calls normally and implement the corresponding services / functions. If the version of the operating system indicated by the second update information does not support the version of the operating system indicated by the first update information, the system service module can intercept the interface call request.
[0104] In some embodiments, the system service module can also return a prompt message to Application 1 module to prompt the user that the operating system version is too low to implement the corresponding services / functions of Application 1.
[0105] In some embodiments, it is described in combination with Figure 5 the flowchart of a version compatibility identification method given. A version compatibility identification method provided in this embodiment can be applied to an electronic device. Among them, the electronic device includes a system image file and an updatable program block. Among them, the system image file is used for updating the version of the operating system of the electronic device; the updatable program block is used for updating the version of some objects of the operating system. The update of the system image file and the update of the updatable program block are independent of each other.
[0106] Referring to Figure 5 , the version compatibility identification method provided in this embodiment includes:
[0107] S201. In response to an interface call request for an object, the electronic device obtains the first update information of the operating system supported by the object.
[0108] Among them, the object can be an application service and / or a system service of the operating system. Among them, the application service can include system applications and third-party applications. The system applications include applications such as cameras, calculators, compasses, wallets, global notes, and flashlights. The third-party applications include chat applications, payment applications, navigation applications, audio and video applications, and so on. The system services can include services such as ringtone settings, desktop settings, security settings, and system upgrade settings.
[0109] When the object is triggered by the user or by another object to be called, a corresponding interface call request will be generated. When the electronic device receives the interface call request, it obtains the first update information of the object corresponding to the interface call request.
[0110] For example, when the user turns on the flashlight, a flash interface call request will be triggered; for example, when the user turns on the flash in the camera application, a camera application flash interface call request will be triggered. For example, when the user uses a certain function in the global notes, an interface call request corresponding to the function will be triggered, and so on.
[0111] In some embodiments, the update information includes version data of the operating system and update data of the operating system based on at least one updatable program block.
[0112] Among them, the version data (apiLevel) of the operating system can be the version number. For example, with the release of the first version of the operating system and version updates, the version number of the operating system can be named based on a certain rule. A certain version can be operating system 98 (apiLevel = 98). The version number of the operating system after multiple version updates can be operating system 100 (apiLevel = 100). The update data (extApiLevel) of the operating system based on at least one update module can be understood as the number of times of object updates based on the updatable program block after a certain version of the operating system is released. For example, in operating system 100 (apiLevel = 100), application service 1 is updated through update module 1. The update data of the operating system based on at least one update module can be 1 (extApiLevel = 1). After that, in operating system 100 (apiLevel = 100), application service 3 is updated through update module 2. The update data of the operating system based on at least one update module can be 2 (extApiLevel = 2).
[0113] In some embodiments, based on the actual operating system version update scenario, the update information may further include other update data. For example, the operating system can also update the version of some application services (or system services) or the entire operating system in other ways, and the update data can include the number of updates corresponding to other ways, etc. This embodiment does not make any limitations in this regard.
[0114] S202. The electronic device obtains second update information of the current operating system.
[0115] In this embodiment, the electronic device can obtain relevant data of the current operating system from the register to obtain second update information of the current operating system. The second update information includes version data (apiLevel1) of the current operating system and update data (extApiLevel1) of the current operating system based on at least one update module.
[0116] S203. The electronic device determines whether the first operating system version supports the second operating system version; if not, execute S204; if so, execute S205.
[0117] Wherein, the first operating system version is the operating system version indicated by the first update information; the second operating system version is the operating system version indicated by the second update information.
[0118] In this embodiment, if the apiLevel in the first update information is less than or equal to the apiLevel1 in the second update information, and the extApiLevel in the first update information is less than or equal to the extApiLevel1 in the second update information, it can be considered that the operating system version indicated by the first update information supports the operating system version indicated by the second update information. That is, the first operating system version supports the second operating system version. In this case, the electronic device can execute corresponding operations in response to the object interface call request.
[0119] If there is at least one piece of update data in the first update information that does not support the update data in the second update information. For example, if the apiLevel in the first update information is greater than the apiLevel1 in the second update information, and / or the extApiLevel in the first update information is greater than the extApiLevel1 in the second update information, it can be considered that the operating system version indicated by the first update information does not support the operating system version indicated by the second update information. That is, the first operating system version does not support the second operating system version. In this case, the electronic device can intercept the object interface call request.
[0120] S204. The electronic device intercepts the interface call request.
[0121] In this embodiment, when the electronic device determines that the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, it intercepts the object interface call request to avoid running the interface of the object until an abnormal suspension problem occurs in the process of the object.
[0122] In some embodiments, after the electronic device obtains the first update information and the second update information, it also includes the case where the operating system version indicated by the first update information supports the operating system version indicated by the second update information:
[0123] S205. The electronic device responds to the interface call request and executes corresponding operations.
[0124] In this embodiment, when the electronic device determines that the operating system version indicated by the first update information supports the operating system version indicated by the second update information, it responds to the interface call request, executes corresponding operations, and normally executes the functions corresponding to the object.
[0125] Exemplarily, the version compatibility identification method provided in this embodiment is described through examples of several specific scenarios.
[0126] For example, when application 1 calls the function provided by the object through the system service, the electronic device needs to determine the compatibility of the object with the operating system. For example, application 1 is a camera application and the object is a flash service. When the user takes a photo through the camera application, the operation of turning on the flash is triggered. The camera application initiates an interface call request for the flash through the system service, and the system service receives the interface call request and obtains the first update information supported by the flash service and the second update information of the current operating system. When it is determined that the operating system version indicated by the first update information supports the operating system version indicated by the second update information, that is, the flash service can be performed under the current operating system, the system service responds to the interface call request of the flash and performs the corresponding flash-on operation. If the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, that is, the flash service does not support the current operating system, the system service intercepts the interface call request of the flash. The camera application cannot turn on the flash.
[0127] Or, exemplarily, when a user triggers the use of a function provided by application 3, the electronic device needs to determine the compatibility of application 3 with the operating system. Application 3 may be a global note function. When the user turns on the global note function, he uses service 1 in the global note function. The global note function initiates an interface call request for service 1 through the system service, and the system service receives the interface call request and obtains the first update information supported by service 1 and the second update information of the current operating system. When it is determined that the operating system version indicated by the first update information supports the operating system version indicated by the second update information, that is, service 1 can be performed under the current operating system, the system service responds to the interface call request of service 1 and performs the corresponding operation in the global note function. If the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, that is, service 1 does not support being performed under the current operating system, the system service intercepts the interface call request of service 1. The user cannot use service 1 in the global note function.
[0128] In the embodiments of the present application, when an electronic device receives an interface call request for an object, it can obtain the first update information of the operating system supported by the object and the second update information of the current operating system of the electronic device. It can compare the operating system version indicated by the first update information of the operating system of the object with the operating system version indicated by the second update information of the electronic device. When it is determined that the operating system version indicated by the second update information does not support the operating system version indicated by the first update information, the interface call request for the object is intercepted, and the electronic device no longer continues to execute the interface call operation for the object. Compared with the situation where the electronic device directly responds to the interface call request of the object and then always executes the corresponding interface call operation until it is found that the interface cannot be called or the next operation cannot be executed, and then it is determined that the version of the operating system is incompatible with the version of the object, resulting in an interface call process exception problem. In the embodiments of the present application, when responding to the interface call request of the object, the compatibility recognition and judgment of the object version and the operating system version are performed, avoiding the problem of process exception caused by running until the process is suspended, reducing the waste of the process running resources of the electronic device, and simply and effectively identifying, judging, and processing the compatibility between the operating system version supported by the object and the current operating system version.
[0129] In this embodiment, the electronic device performs compatibility recognition on the operating system version and the update module version of the current operating system based on the first update information and the second update information, and the operating system version and the update module version supported by the object, which can effectively solve the problem of version compatibility among the object, the update module, and the operating system.
[0130] In some embodiments, the updatable program block may include update data of the operating system supported by a preset object. In some embodiments, the updatable program block includes script files of at least one object, and the first update information of the operating system supported by the object is included in the script files corresponding to at least one object.
[0131] Then, the electronic device obtaining the first update information of the operating system supported by the object in S201 includes:
[0132] The electronic device scans the comments in the script files of at least one object in the updatable program block to obtain the first update information of the operating system supported by the object.
[0133] Exemplarily, in the script file of an object, a comment is marked with the update information of the supported operating system. For example, the comment can be expressed as @ModuleApi(client = ModuleApi.client.PUBLIC_LIBRARIES). Or, exemplarily, the comment of the interface corresponding to the object can be expressed as @testinterfaceAPI(apiLevel = 99, extApiLevel = 1). Among them, the comment includes the update data of the operating system (such as the version number apiLevel) and the update data of the operating system based on at least one updatemodule (such as the version number extApiLevel).
[0134] The electronic device can perform code scanning on the script files of at least one object in the updatemodule, scan the comments of each object, and obtain the first update information represented by the comment corresponding to the object.
[0135] In some embodiments, the first update information is preset in the script file of the object. Further, the value of the first update information can be determined in the following manner. Refer to Figure 6 as shown Figure 6 A schematic diagram of the operating system version update is given.
[0136] For each release of the operating system version, the corresponding update data of the version can be obtained. After each release of the operating system version, code scanning of the updatemodule is performed every other period to obtain the first update information represented by the comments of all objects in the update module. A version file is generated based on the update data of the operating system and the update data of the update module in the operating system.
[0137] For example, after the release of the operating system (ROM) version V1 (apiLevel = 98), the initial value of the update data of the update module in the operating system is 0 (extApiLevel = 0). Code scanning is performed every other cycle to obtain and record the comments of each object, generating a version file 1. For example, in the ROM version V1, there is an update to application service 1 based on the update module. In the version file 2 generated after code scanning, comments for application service 1 are newly added. The inconsistency between version file 2 and version file 1 indicates new comments, and the extApiLevel is updated by increasing extApiLevel to 1. It can also be understood as the second update information for application service 1, that is, the update information of the operating system supported by application service 1 includes apiLevel = 98 and extApiLevel = 1. That is, in the operating system with the version apiLevel = 98 and extApiLevel = 1, application service 1 can be used.
[0138] For example, after the release of the operating system (ROM) version V2 (apiLevel = 99), the initial value of the update data of the update module in the operating system is 0 (extApiLevel = 0). Code scanning is performed every other cycle to obtain and record the comments of each object, generating a version file 3. For example, in the ROM version V2, there is an update to application service 1 based on the update module. In the version file 4 generated after code scanning, comments for application service 1 are newly added. The inconsistency between version file 4 and version file 3 indicates new comments, and the extApiLevel is updated by increasing extApiLevel to 1. It can also be understood as the second update information for application service 1, that is, the update information of the operating system supported by application service 1 includes apiLevel = 99 and extApiLevel = 1. That is, in the operating system with the version apiLevel = 99 and extApiLevel = 1, application service 1 can be used.
[0139] In some embodiments, if N object version updates based on the update module are performed in one cycle, the value of extApiLevel of the update module is increased by N. Refer to Figure 7 as shown Figure 7 Another schematic diagram of operating system version update is given.
[0140] Figure 7Among them, for example, after the release of the operating system (ROM) version V1 (apiLevel = 98), the initial value of the update data of the update module in the operating system is 0 (extApiLevel = 0). Code scanning is performed every other cycle to obtain and record the annotations of each object, and a version file 1 is generated. For example, in the ROM version V1, there are updates to application service 1 based on update module 1 and updates to application service 2 based on update module 2. In the version file 2 generated after code scanning, the annotations of application service 1 and application service 2 are newly added. If the version file 2 is inconsistent with the version file 1, indicating new annotations, the extApiLevel is updated. According to the number of times of updating the application service based on update module 1, the extApiLevel is increased to 2. It can also be understood as the second update information of application service 1 and application service 2, that is, the update information of the operating system supported by application service 1 includes apiLevel = 98, extApiLevel = 2, and the update information of the operating system supported by application service 2 includes apiLevel = 98, extApiLevel = 2. That is, in the operating system with the version apiLevel = 98, extApiLevel = 2, the functions provided by application service 1 and application service 2 can be used.
[0141] In some embodiments, if the update data of the operating system supported by the annotation of the object is modified to a larger version, for example, the current update information of the operating system includes apiLevel = 99, extApiLevel = 1. However, the second update information of application service 3 includes apiLevel = 200, extApiLevel = 0, and the current operating system cannot support the function implementation of application service 3. Therefore, application service 3 can be considered as an abandoned application service. It should be noted that this is only an implementable method, and when actually annotating the object, it needs to be determined according to the current update information of the operating system and the actual application environment. This embodiment does not make any limitations in this regard.
[0142] In some embodiments, in the form of annotations, the update information is marked in the script file of the updatable program block, and the update information of the operating system supported by each object can be obtained through scanning, so as to perform subsequent version compatibility identification and judgment based on the first update information and the second update information. The method provided by this embodiment is simple and effective.
[0143] In some embodiments, after the electronic device updates the version of an object based on the update module, it can obtain the update information corresponding to the object and store the update information in a specified storage space. For example, it can be stored in the memory corresponding to the object. When the electronic device receives an interface call request for an object, it can obtain the identifier of the object in the interface call request and obtain the first update information corresponding to the identifier from the memory.
[0144] In some embodiments, after the electronic device updates the version of an object based on the update module each time, it can write the updated object and the corresponding update information into a specified information table. The information table can be stored in a specified storage space. When the electronic device receives an interface call request for an object, it can query the update information corresponding to the object in the interface call request based on the information table to obtain the first update information.
[0145] In some embodiments, there are various ways for the electronic device to obtain the second update information of the current operating system. In some embodiments, the version compatibility recognition method further includes:
[0146] S301. The electronic device obtains the initial update information of the operating system.
[0147] Among them, the initial update information includes the version data of the operating system and the initial update data of the updatable program block. The initial update data is a first value.
[0148] In this embodiment, the electronic device can obtain the initial update information of the operating system after each power-on of the operating system or the device. The initial update information is the latest update information of the current operating system. Exemplarily, the second update information of the current system includes apiLevel = 98 and extApiLevel = 0.
[0149] In some embodiments, after the electronic device updates the operating system based on the system image file, the initial update data extApiLevel of the update module is a first value. Exemplarily, the first value can be 0.
[0150] In some embodiments, the initial update information may be the update information of the operating system after the electronic device is powered on. For example, the update information may be the update information obtained after the electronic device is powered on after the operating system version is updated. In this case, the value of extApiLevel in the update information is 0. Or, in some embodiments, the update information may be the update information obtained after the electronic device simply restarts or powers on and off without performing an operating system version update. In this case, the value of extApiLevel in the update information is the default value, and the default value is the value before restarting or powering on and off. For example, the default value may be a natural number greater than 0.
[0151] S302. The electronic device periodically scans the update information of the operating system.
[0152] In this embodiment, the electronic device may scan whether the operating system has a version update or whether there is an update in the update module in the operating system according to a preset period, so as to obtain the update information of the operating system.
[0153] S303. If the electronic device detects a version update of at least one object based on the updatable program block in the first period, the electronic device updates the update data of the updatable program block to a second value in the second period.
[0154] Wherein, the difference between the second value and the first value is the number of times of version update of at least one object by the updatable program block in the first period.
[0155] The second period is the subsequent period in the adjacent time sequence of the first period.
[0156] If the electronic device detects a version update based on the update module, the value of extApiLevel is increased. For example, if a new version of the update module is incorporated in the first period and the extApiLevel in the first period is 0, then the value of extApiLevel is incremented by 1 in the second period, and the value of extApiLevel is updated from the first value 0 to the second value 1. Or, if the electronic device detects an operating system version update in the first period and the operating system apiLevel in the first period is 98, then the value of apiLevel is updated in the second period, and the value of apiLevel is updated from 98 to 99.
[0157] In some embodiments, version updates of at least one object by the updatable program block may occur multiple times in the same cycle. For example, in the first cycle, it is detected that the updatable program block 1 updates the version of the application service 1 and the updatable program block 2 updates the version of the system service 1. Two version updates occur in the first cycle. In this case, the electronic device updates the value of extApiLevel from the first value 0 to the second value 2.
[0158] For example, in the first cycle, it is detected that the updatable program block 1 updates the version of the application service 1 twice, that is, the application service 1 has two version updates in the first cycle. In this case, the electronic device updates the value of extApiLevel from the first value 0 to the second value 2.
[0159] That is, the difference between the updated value (the second value) of extApiLevel and the first value is the number of version updates of the object based on the updatable program block that occur in the first cycle. If N version updates of the object based on the updatable program block occur in the first cycle, then the second value is the first value + N.
[0160] S304. The electronic device obtains second update information according to the update data of the updated updatable program block and the version data of the operating system.
[0161] In this embodiment, the electronic device uses the update data of the updated update module and the version data of the operating system as the update information of the current operating system. For example, when it is detected that the operating system has a version update and the value of apiLevel is updated from 98 to 99; when it is detected that a new version based on the update module is incorporated and the value of extApiLevel changes from 0 to 1. Then the second update information of the current system includes apiLevel = 99 and extApiLevel = 1.
[0162] In some embodiments, the electronic device may write the second update information of the current system into a specified file or store it in a specified storage space, and can directly obtain and use it when performing version compatibility identification on each object in the operating system.
[0163] In this embodiment, the electronic device periodically detects whether there is a change in the update information of the operating system, and can obtain effective and accurate update information of the current operating system, thereby improving the accuracy of version compatibility identification.
[0164] In some embodiments, the electronic device is not limited to periodic detection, but obtains the second update information every time it detects that the operating system has a version update or the updatable program block has a version update. Exemplarily, the version compatibility identification method further includes:
[0165] S401. The electronic device obtains the initial update information of the operating system.
[0166] Among them, the initial update information includes the version data of the operating system and the initial update data of the updatable program block. The initial update data is the first value.
[0167] Reference may be made to S301, which will not be elaborated in this embodiment.
[0168] S402. If the electronic device detects a version update of at least one object based on the updatable program block, the electronic device updates the update data of the updatable program block to a second value. The electronic device obtains the second update information according to the initial update data of the updated updatable program block and the version data of the operating system.
[0169] Among them, the difference between the second value and the first value is 1.
[0170] In this embodiment, if the electronic device detects a version update based on the update module, the value of extApiLevel is increased. For example, if the electronic device detects a version update of the update module and extApiLevel is 0, then the value of extApiLevel is incremented by 1, and the value of extApiLevel changes from 0 to 1. Or, if the electronic device detects a version update of the operating system and the operating system apiLevel is 98, then the value of apiLevel is updated from 98 to 99. The electronic device uses the initialized update data of the updated update module and the version data of the operating system as the update information of the current operating system. For example, when detecting a version update of the operating system, the value of apiLevel is updated from 98 to 99; when detecting a version update based on the update module, the value of extApiLevel changes from 0 to 1. Then the second update information of the current system includes apiLevel = 99 and extApiLevel = 1.
[0171] In some embodiments, each time the electronic device detects a version update of an object based on the updatable program block, the value of extApiLevel is increased. If multiple consecutive object version updates or multiple version updates of the same object are detected, the value of extApiLevel will be continuously increased.
[0172] In this embodiment, the electronic device updates the second update information of the current system each time it detects whether there is a change in the update information of the operating system, which can effectively improve the accuracy of version compatibility recognition.
[0173] During the process of the electronic device updating the version of the operating system, the device needs to be restarted, that is, powered off and then powered on again. During the power-on process of the electronic device (operating system), the electronic device updates and overwrites the relevant data of the operating system based on the system image file to achieve the version update of the operating system. Alternatively, the electronic device updates and overwrites the relevant data of some objects based on the update module to achieve the version update of the objects. In some embodiments, the version compatibility recognition method further includes:
[0174] When the electronic device detects the power-on of the operating system, it obtains the second update information of the operating system. The electronic device stores the second update information in the version information management space of the electronic device.
[0175] Among them, the situation of the power-on of the operating system includes that the electronic device updates the version of the operating system based on the system image file, and / or the electronic device updates the version of some objects of the operating system based on the updatable program block.
[0176] In this embodiment, the electronic device can update and overwrite the relevant data of the operating system based on the system image file to achieve the version update of the operating system. Alternatively, the electronic device updates and overwrites the relevant data of some objects based on the update module to achieve the version update of the objects. In some embodiments, when the electronic device updates the version of the operating system based on the system image file, the device needs to be powered off and then powered on again, and the electronic device (operating system) needs to be restarted. In some embodiments, when the electronic device updates the version of some objects of the operating system based on the update module, there may also be a situation where the electronic device (operating system) needs to be restarted.
[0177] Reference Figure 8 , Figure 8The flowchart for an electronic device to obtain second update information is given. When the system service of the electronic device detects that the operating system is powered on or the device is powered on, it sends a control instruction to the version configuration module. The control instruction is used to instruct the version configuration module to obtain the update information of the operating system from the version information management space, so as to obtain the second update information after the operating system version is updated and powered on. Exemplarily, the version information management space can be the storage space in the version information management module of the electronic device. All objects of the electronic device have the permission to access the version information management module to obtain the second update information. For example, when the electronic device runs a request for interface call of the camera flash, the flash service has the permission to obtain the second update information from the version information management module, so that it can perform version compatibility identification and judgment based on the second update information and the first update information of the flash service. For example, when the electronic device runs a request for interface call of screen recording, the screen recording service has the permission to obtain the second update information from the version information management module, so that it can perform version compatibility identification and judgment based on the second update information and the first update information of the screen recording service.
[0178] In this embodiment, when the electronic device reads the second update information of the current operating system each time the operating system is powered on and stores the second update information in the version information management space, any object in the electronic device has the permission to access the version information management module to obtain the second update information. During the interface call process of any subsequent object, version compatibility identification and judgment can be performed based on the obtained second update information and the first update information supported by itself, reducing the redundant definition of each interface and optimizing the version compatibility identification and judgment performance of the electronic device.
[0179] In some embodiments, the electronic device can define a version compatibility identification method in the interface call request of each object. That is, when the electronic device runs the interface call operation of each object, in response to the interface call request, it obtains the first update information corresponding to the object, obtains the second update information of the current operating system, and performs version compatibility identification and judgment.
[0180] For example, the electronic device responds to an interface call request of the camera flash, and based on the version compatibility recognition method defined in the interface call request, determines whether the version of the flash service is compatible with the version of the current operating system. If the version of the current operating system does not support the flash service and the version of the flash service is not compatible with the version of the current operating system, the electronic device intercepts the interface call request of the camera flash. If the versions are compatible, the electronic device responds to the interface call request of the camera flash and performs the corresponding control operation of the flash. For example, the electronic device responds to an interface call request for screen recording, and based on the version compatibility recognition method defined in the interface call request, determines whether the version of the screen recording service is compatible with the version of the current operating system. If the version of the current operating system does not support the screen recording service and the version of the screen recording service is not compatible with the version of the current operating system, the electronic device intercepts the interface call request of the camera flash. If the version of the current operating system supports the screen recording service and the version of the screen recording service is compatible with the version of the current operating system, the electronic device responds to the interface call request of the camera flash and performs the corresponding control operation of the flash.
[0181] In some embodiments, the method for the electronic device to perform the operating system version compatibility recognition and determination can also be implemented through the toolkit kit. For example, the toolkit kit refers to encapsulating some common methods to form a method class that can be called by other interfaces, and this method class can be packaged in the Android application package of the operating system.
[0182] For example, when the electronic device responds to an interface call request of the camera flash, it can directly call the encapsulated method class to obtain the recognition result of whether the version of the flash is compatible with the version of the current operating system. When the electronic device obtains a recognition result of incompatibility, that is, the version of the current operating system does not support the flash service, the electronic device intercepts the interface call request of the camera flash. When the electronic device obtains a recognition result of compatibility based on the encapsulated method class, that is, the version of the current operating system supports the flash service, the electronic device responds to the interface call request of the camera flash and performs the corresponding control operation of the flash.
[0183] The encapsulated method class can provide a black box for version compatibility recognition for objects in the operating system. The electronic device can obtain the recognition result of whether the version is compatible through the encapsulated method class, and then perform corresponding operations. Encapsulating the version compatibility recognition method in this way does not require defining the version compatibility recognition method in the interface call request of each object, reducing the development cost and improving the efficiency and performance of the electronic device for version compatibility recognition.
[0184] In some embodiments, the method further includes:
[0185] The electronic device obtains the second update information of the current operating system by invoking a preset version management method class, and intercepts the interface call request when the operating system version indicated by the first update information does not support the operating system version indicated by the second update information; the object of the operating system has the calling right of the preset version management method class.
[0186] In this embodiment, when the electronic device runs to the interface of the object, based on the obtained first update information of the object, it invokes the preset version management method class to perform the compatibility identification and judgment of the operating system version.
[0187] In some embodiments, the specific implementation code of the preset version management method class can refer to the pseudo code shown in Table 1 below.
[0188] Table 1
[0189]
[0190] Among them, testinterfaceAPI() is the test interface of a certain object, and the first update information of the test interface of this object is preset to include "apiLevel = 99, extApiLevel = 1", where the version number of the operating system is 99 and the version number of updatemodule is 1.
[0191] testcompat() is the preset version management method class, which is used to perform the compatibility identification between the operating system version indicated by the first update information and the operating system version indicated by the second update information. When running the test interface of the object, the version compatibility judgment can be performed by invoking testcompat().
[0192] The preset version management method class testcompat() includes a version compatibility judgment statement, "if(testinterfaceAPI.apiLevel() <= apiLevel1 && testinterfaceAPI.extApiLevel() <= apiLevelextApiLevel1){return true;}". Among them, testinterfaceAPI.apiLevel() represents the version data of the operating system in the first update information. For example, the version data can be the version number; apiLevel1 is the version data of the operating system in the second update information. For example, the version data can be the version number; testinterfaceAPI.extApiLevel() represents the update data of updatemodule in the first update information; apiLevelextApiLevel1 is the update data of updatemodule in the second update information.
[0193] If the version number of the operating system in the first update information is less than or equal to the version number of the operating system in the second update information, and the version number of the updatemodule in the first update information is less than or equal to the version number of the updatemodule block in the second update information, return "true", that is, determine that the operating system version indicated by the first update information supports the operating system version indicated by the second update information, and return a compatible judgment result. For example, if testinterfaceAPI.apiLevel() is 99 and apiLevel1 is 99; testinterfaceAPI.extApiLevel() is 1 and apiLevelextApiLevel1 is 1, the judgment result of version compatibility is compatible. For example, if testinterfaceAPI.apiLevel() is 99 and apiLevel1 is 100; testinterfaceAPI.extApiLevel() is 1 and apiLevelextApiLevel1 is 2, the judgment result of version compatibility is compatible. For example, if testinterfaceAPI.apiLevel() is 99 and apiLevel1 is 100; testinterfaceAPI.extApiLevel() is 1 and apiLevelextApiLevel1 is 1, the judgment result of version compatibility is compatible.
[0194] If the version number of the operating system in the first update information is greater than the version number of the operating system in the second update information; or, the version number of updatemodule in the first update information is greater than the version number of updatemodule in the second update information, return "false", that is, determine that the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, and return an incompatible judgment result. For example, if testinterfaceAPI.apiLevel() is 99 and apiLevel1 is 98; and testinterfaceAPI.extApiLevel() is 1 and apiLevelextApiLevel1 is 1, the judgment result of version compatibility is incompatible. For example, if testinterfaceAPI.apiLevel() is 99 and apiLevel1 is 99; and testinterfaceAPI.extApiLevel() is 1 and apiLevelextApiLevel1 is 0, the judgment result of version compatibility is incompatible. For example, if testinterfaceAPI.apiLevel() is 99 and apiLevel1 is 98; and testinterfaceAPI.extApiLevel() is 1 and apiLevelextApiLevel1 is 0, the judgment result of version compatibility is incompatible.
[0195] When the electronic device is running the test interface of an object, the judgment result of version compatibility or incompatibility can be obtained through the preset version management method class testcompat(). Based on the judgment result, when the version is compatible, the electronic device continues to respond to the call request of the test interface of the object and continues to run the object. When the version is incompatible, the electronic device intercepts the call request of the test interface of the object.
[0196] In this embodiment, the preset version management method class can be called by any object in the operating system to judge the version compatibility between the version of the object-supported operating system and the current operating system. There is no need to define a corresponding reflection interface for each object to identify version compatibility, which reduces the development cost of version compatibility judgment and improves the performance of the electronic device in identifying and judging the version compatibility of the operating system in the object.
[0197] In some embodiments, when the electronic device identifies that the version of the current operating system is incompatible with the version of the operating system supported by the object, that is, the current operating system cannot implement the functions of the object called by the user. In this case, the electronic device can also output some prompt messages to prompt the user about information such as the low operating system version, so that the user can perceive the incompatible result and then perform operations such as updating the operating system version.
[0198] In some embodiments, after the electronic device intercepts an interface call request, the method further includes:
[0199] The electronic device outputs a prompt message, which is used to prompt the user that the version of the operating system of the electronic device does not support the implementation of the object.
[0200] In this embodiment, the electronic device intercepting the interface call request is an internal implementation behavior that is not perceptible or weakly perceptible to the user. In order to enable the user to perceive that the version of the operating system supported by the object triggered by the user is incompatible with the current operating system version of the electronic device, the electronic device may also output a prompt message. Refer to Figure 9 , Figure 9 shows a schematic diagram of a prompt message being displayed on the display screen when the electronic device is a mobile phone. Among them, the prompt message is used to prompt the user that the version of the operating system of the electronic device does not support the implementation of the object. Exemplarily, referring to Figure 9 in (a), the prompt message 901 may include content such as "The current operating system version is too low. Please update the system in time".
[0201] In some embodiments, the electronic device may display the prompt message in the form of a pop-up window on the current display interface of the display screen. For example, the current display interface may be the main interface of Application 1, the main interface of the desktop, etc. Or, the electronic device may also display the prompt message in the form of a floating window on the display screen. Or, the electronic device may also output a voice prompt message through voice broadcast.
[0202] In some embodiments, after the electronic device outputs the prompt message, it may also display guiding information on the display screen. The guiding information is used to guide the user to perform an upgrade operation on the operating system of the electronic device. Exemplarily, referring to Figure 9 in (b), the guiding information 902 may include content such as "Do you want to perform an upgrade operation on the operating system now", a "Confirm" button, and a "Cancel" button, etc.
[0203] In this embodiment, the electronic device can interact with the user by outputting the prompt message, enabling the user to perceive that the version of the operating system supported by the object triggered by the user is incompatible with the current operating system version of the electronic device, and then the user can perform operations such as updating the operating system version, improving the user experience of using the electronic device.
[0204] The embodiments of the present application further provide a computer-readable storage medium, which includes computer instructions. When the computer instructions run on the above-mentioned electronic device, the electronic device is enabled to execute each function or step performed by the electronic device 100 in the above-mentioned method embodiments.
[0205] The embodiments of the present application also provide a computer program product. When the computer program product runs on a computer, it causes the computer to execute each function or step performed by the electronic device 100 in the above method embodiments. For example, the computer may be the above-mentioned electronic device 100.
[0206] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above function modules is used as an example. In actual applications, the above functions can be allocated to different function modules according to needs, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above.
[0207] In several embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.
[0208] The unit described as a separated component may or may not be physically separated. The component displayed as a unit may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0209] In addition, each functional unit in the various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0210] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0211] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claimed rights.
Claims
1. A method for identifying version compatibility, characterized in that, Applied to an electronic device, the electronic device includes a system image file and an updatable program block; the system image file is used to update the version of the operating system of the electronic device; the updatable program block is used to update the version of some objects of the operating system, and the objects include application services and / or system services. The update of the system image file is independent of the update of the updatable program block; an annotation is marked in the script file of the object, and the annotation indicates the first update information supported by the object. The annotation includes the version data of the operating system supported by the object and the update data of the updatable program block supported by the object; The update data represents the number of updates of the updatable program block; The updatable program block includes script files of at least one of the objects; The method includes: In response to an interface call request for the object, the electronic device obtains the first update information of the operating system supported by the object based on the annotation in the script file of the object; the first update information includes the version data of the operating system supported by the object and the update data of the updatable program block supported by the object; The electronic device obtains the second update information of the current operating system; the second update information includes the version data of the current operating system and the update data of the current operating system based on at least one of the updatable program blocks; In the case where the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, the electronic device intercepts the interface call request.
2. The method according to claim 1, characterized in that, The obtaining of the first update information of the operating system supported by the object includes: The electronic device scans the annotation in the script file of at least one object in the updatable program block to obtain the first update information of the operating system supported by the object.
3. The method according to claim 1 or 2, characterized in that, The update information includes the version data of the operating system and the update data of the operating system based on at least one of the updatable program blocks.
4. The method according to claim 1 or 2, characterized in that, The method further includes: The electronic device obtains the initial update information of the operating system. The initial update information includes the version data of the operating system and the initial update data of the updatable program block. The initial update data is a first value; The electronic device periodically scans the update information of the operating system; If the electronic device detects a version update of at least one of the objects based on the updatable program block in the first period, the electronic device updates the update data of the updatable program block to a second value in the second period. The difference between the second value and the first value is the number of times of version update of at least one of the objects by the updatable program block in the first period. The second period is the next period in the adjacent time sequence of the first period; The electronic device obtains the second update information according to the updated update data of the updatable program block and the version data of the operating system.
5. The method according to claim 1 or 2, characterized in that, The method further includes: The electronic device obtains initial update information of the operating system. The initial update information includes version data of the operating system and initial update data of the updatable program block, and the initial update data is a first value; If the electronic device detects a version update of the object based on the updatable program block each time, the electronic device updates the update data of the updatable program block to a second value, and the difference between the second value and the first value is 1; The electronic device obtains the second update information according to the updated update data of the updatable program block and the version data of the operating system.
6. The method according to claim 1 or 2, characterized in that, The method further includes: When the electronic device detects that the operating system is powered on, the electronic device obtains the second update information of the operating system; The electronic device stores the second update information in the version information management space of the electronic device; The electronic device obtains the second update information of the current operating system, including: The electronic device obtains the second update information from the version information management space; Wherein, the situation of the operating system being powered on includes that the electronic device performs a version update of the operating system based on the system image file, and / or the electronic device performs a version update of some objects of the operating system based on the updatable program block.
7. The method according to claim 1 or 2, characterized in that, The method further includes: The electronic device executes the step of obtaining the second update information of the current operating system of the electronic device by calling a preset version management method class. In the case that the operating system version indicated by the first update information does not support the operating system version indicated by the second update information, the electronic device intercepts the interface call request; the object of the operating system has the calling permission of the preset version management method class.
8. The method according to claim 1 or 2, characterized in that, After the electronic device intercepts the interface call request, the method further includes: The electronic device outputs a prompt message, and the prompt message is used to prompt the user that the version of the operating system of the electronic device does not support the implementation of the object.
9. An electronic device, characterized in that, The electronic device includes a memory and one or more processors; the memory is coupled to the processor; computer program code is stored in the memory, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method according to any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, It includes computer instructions. When the computer instructions run on an electronic device, the electronic device executes the method according to any one of claims 1-8.
Citation Information
Patent Citations
Software identification method and device, storage medium and electronic equipment
CN113986602A
Federated services to dynamically switch features in applications
US9268561B1