This application relates to computer technologies, and in particular, to a mobile service upgrade method and apparatus, a terminal, and the like.
In recent years, mobile terminal devices, such as a smartphone, a tablet computer, and a wearable device, develop rapidly, users have increasingly diversified requirements for the mobile terminal devices, and there are increasingly more types of applications on the application terminal devices. To facilitate development of a plurality of types of applications, a mobile service provider provides a mobile service, for example, a Google mobile service (GMS) provided by Google. The GMS includes a plurality of components such as a public framework and a plurality of types of services (or referred to as sub-applications or kits), and provides an invocation interface for an application developer. In this way, the application developer can directly use any one or more of the plurality of types of services through the invocation interface in a development process without re-development. The plurality of types of services herein are, for example, a map service, an advertisement service, a positioning service, a sports and health service, and a machine learning service.
The mobile service provider integrates the mobile service into an operating system, and provides the operating system for a mobile device manufacturer to preset the operating system on a mobile device. After being developed, each application is also preset on the mobile device or is installed by a user on the mobile device. The software collaborates to meet various requirements of the user in daily life. However, currently an upgrade of a mobile service on a mobile device causes all components in the mobile service to be upgraded together. The upgrade takes a relatively long time, and the mobile device needs to be restarted after the upgrade. This upgrade manner is not only inefficient, but also is inflexible. For example, because the device needs to be restarted after the upgrade, the upgrade on the mobile device is set to a silent upgrade in the background, for example, the upgrade is performed at night when a battery is sufficient or the mobile device is charged, so as to avoid affecting use of a user.
This application provides a mobile service upgrade method, to enable each component in a mobile service to be independently upgraded. Further, a mobile device does not need to be restarted after upgrading. In this way, upgrade duration of the mobile service is shortened, and flexibility of upgrading the mobile service is improved. For example, an application is upgraded in real time as required, and a component that needs to be upgraded by the application is independently upgraded without restarting a device. The application can use an upgraded component in real time.
In addition, this application further provides various apparatuses, a computer program product (for example, mobile service software or operating system software), a storage medium, a computer device, and the like that implement the foregoing method.
The following describes this application from a plurality of aspects. It is easy to understand that the following plurality of aspects may be separately implemented, or a combination of any two or more aspects may be implemented. For specific implementations and beneficial effects of the following plurality of aspects, refer to each other.
According to a first aspect, this application provides a mobile service upgrade method. The method includes: receiving a target service invocation request sent by an application, where a target service is one of a plurality of services included in a mobile service; downloading a new version of the target service from a remote computer when determining, based on the service invocation request, that the target service needs to be upgraded, where the new version is a version that meets a requirement of the invocation request; and loading and running the new version of the target service.
It should be understood that the foregoing method is also applicable to upgrading a plurality of services.
The service may be understood as a kit in the following embodiments. Certainly, the kit may also include a plurality of components, and the plurality of components may also be considered as the kit. A kit may invoke other kits. A subsequent method may be used to upgrade dependent upgrading.
According to the foregoing method, one or more services in a mobile service can be upgraded based on an invocation requirement of an application when triggered by the application. An upgrade takes less time, is more flexible than a pure silent upgrade in the background, and can meet a requirement of a user in a more timely manner.
The foregoing method may also be applied to a silent upgrade scenario. During a silent upgrade, the one or more services in the mobile service are independently upgraded instead of upgrading the entire mobile service, thereby shortening upgrade duration.
In some implementations, the downloading a new version of the target service from a remote computer when determining, based on the service invocation request, that the target service needs to be upgraded includes: downloading the new version of the target service and a new version of the another service from the remote computer when determining, based on dependency information stored in an application package of the target service, that the target service depends on the another service, and when determining that the another service needs to be upgraded, where the dependency information includes a dependency relationship between the target service and one or more other services.
In some implementations, the dependency information is stored in a manifest file, and the dependency information is added to the manifest file at a phase of compiling the application package of the target service.
In the foregoing manner, when a service is upgraded, another service on which the service depends may be upgraded (upgraded based on a requirement, or not upgraded if there is no requirement) based on dependency information included in an APK of the service. This avoids an application invocation failure caused because a version of the dependent service does not meet a requirement.
In some implementations, the loading the new version of the target service includes: searching a class loader routing table to determine a class loader, and loading a class file of the target service or a class file of a sub-service of the target service by using the found class loader, where the class loader routing table includes a correspondence between a service name, a package name, and a class loader.
In some implementations, the searching a class loader routing table to determine a class loader, and loading a class file of a sub-service of the target service by using the found class loader includes: creating a first class loader and a second class loader of the target service, and storing correspondence information between the target service and the first class loader in the class loader routing table, where the class loader routing table includes a correspondence between a package name and a service name, and a service stored in the class loader routing table includes the sub-service; invoking a loadClass method of the second class loader by using a loadClass method of the first class loader, to extract a package name of the sub-service and search the class loader routing table for a sub-service name and a class loader that match the package name; and loading the class file of the sub-service by using the found class loader.
It should be understood that loadClass is merely a name of an implementation method commonly used in the art herein, and the name may not be used in other embodiments of this application.
A Java (a high-level programming language) program usually uses a parents delegation model to load a class file. However, in a mobile service framework, there are many class loaders. The parents delegation model may cause incorrect class loading versions, which is inconvenient for management. This application proposes a routing table. A correspondence between a service name, a package name, and a class loader is recorded by using the routing table. Then, the routing table is queried when a class file is loaded, to obtain a corresponding class loader, instead of using the conventional parents delegation model. In this way, a plurality of class loaders are centrally assigned according to the routing table, so that management is more convenient, search becomes flattened, decoupling between applications can be implemented, class routes are centrally managed and controlled, and dependency is clearer.
It should be understood that the foregoing class loader selection method may also be used during a silent upgrade in the background.
In some implementations, the running the new version of the target service includes: querying a configuration file of the target service, and selecting, from a plurality of processes with different priorities, a target process indicated by the configuration file to run the target service.
Because each kit has its own service requirement, this embodiment provides a process pool with different priorities. A process with a priority that matches the service requirement is selected according to an indication of a configuration file of the kit to run the kit. This improves flexibility of process selection and meets the service requirement.
In some implementations, the running the new version of the target service includes: selecting, based on a process load condition, a target process from a plurality of processes with a same priority to run the target service, where a load of the target process is less than or equal to that of another process in the plurality of processes with the same priority.
In this method, a process with a lower load is selected based on a load status to run a current kit. In this way, running efficiency of the kit can be improved.
In both the foregoing priority method and selection of the process with a lower load, it may be considered that a process pool is established, and a proper process is selected from the process pool to run the kit. This avoids a problem that a quantity of processes is excessively large because one kit starts an independent process. The foregoing priority-related method may alternatively be used together with the loading method. For example, a proper priority is first selected based on priorities, and then a process with a lower load is selected from processes with a same priority based on loads.
In addition to the method, this application further provides an apparatus, a computer storage medium, a computer program product, and the like for implementing the method.
According to a second aspect, this application further provides a mobile service upgrade apparatus. The apparatus includes one or more modules, configured to implement the method according to any implementation of the first aspect. It should be understood that the modules may one-to-one correspond to the method steps, or may not one-to-one correspond to the method steps. A name of the module is not limited. The upgrade apparatus may be, for example, an HMS framework described in embodiments.
According to a third aspect, this application further provides a terminal device. The terminal device includes a processor and a memory. The memory is configured to store computer-readable instructions, and the processor is configured to execute the computer-readable instructions to implement the method according to any one of the foregoing aspects.
According to a fourth aspect, this application further provides a computer program medium. The computer program medium includes computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the method according to any one of the foregoing methods is implemented.
According to a fifth aspect, this application further provides a computer program product (or referred to as a computer program). The computer program product includes computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the method according to any one of the foregoing aspects is implemented.
The following briefly describes accompanying drawings of this application. It is clear that the accompanying drawings in the following description show only some embodiments of this application.
A mobile service (MS) includes an MS core and a plurality of applications (Apps). To distinguish from an existing mobile service for ease of description, the MS provided in the embodiments is named an HMS, and correspondingly, the MS core is named an HMS core. The HMS core includes an HMS framework and a sub-application. The sub-application is a general name of a function or capability module that can be invoked or integrated by a third-party application, and may also be referred to as a kit in the following embodiments. The HMS framework may also exist as a kit, which is referred to as an HMS framework kit. When the third-party application invokes a kit, some modules such as libraries need to be integrated. These modules include invocation interfaces, and these modules are referred to as software development kits (SDKs) of the kit. A collection of SDKs of all kits and some public modules is referred to as an HMS SDK. One kit may include a plurality of components, and each component may also be referred to as a kit. One kit can integrate SDKs of other kits to invoke the other kits.
It should be noted that, for ease of application and understanding, some systems, modules, devices, elements, data structures, instructions, and the like that are mentioned are named in English in the embodiments of this application. Uppercase and lowercase of these names have same meanings unless otherwise specified. In addition, these names may be changed as required, and should not constitute any limitation on the solution provided in this application.
The solution provided in this embodiment is mainly implemented in the HMS framework. Certainly, some functions also need to be completed by another module such as the HMS SDK in cooperation with the HMS framework. In this embodiment, each kit in the HMS is designed in a plugin-based idea. To be specific, each kit is independently packaged into an Android application package (APK) and independently released. These independently released kits may also be considered as independent Apps. Further, according to the method provided in this embodiment, these APKs are installation-free in an Android system, and it can be ensured that an application accesses these APKs. This further implements a function such as not restarting a terminal device when a kit is upgraded. In other embodiments, one APK may also include a plurality of kits. This is not limited in this application.
As mentioned above, in the embodiments, one or more kits are packaged into an independent APK, to support independent release and upgrading of the kit.
Based on the foregoing HMS framework, the following describes a kit upgrade method provided in this embodiment. In this method, when an application invokes a kit, the kit can be independently upgraded, and subsequently independently loaded and run without waiting for a silent upgrade in the background. Further, if the kit depends on another kit, the method provided in this embodiment may further detect dependency, and upgrade the another kit when the another kit needs to be upgraded. Further, after all kits are upgraded, a system does not need to be restarted, and an execution function of an upgraded kit can continue to be used only after an application is restarted. In addition, to reduce interference to a user in a kit upgrade process, this embodiment provides a unified interface.
A main idea of this upgrade method is to sort out a dependent kit set in an application compilation phase, extend a manifest file of a kit to store the dependent kit set, search for a nested dependent kit of the kit during running, and manage upgrade of all kits on a unified UI interface to solve a problem that a user cannot experience a new function of the kit in a timely manner.
For ease of understanding of this method, a concept of an API level is introduced first. As shown in
Each kit and the framework release their own APKs and corresponding SDKs (the SDKs are provided in .aar format, which is a packaging mode of an Android SDK library). Before an APK or an SDK is compiled, meta-data (namely, meta-data, same below) is configured in manifest.xml. When SDKs provided by other dependent APKs are compiled through implementation, the APK automatically adds the meta-data configured by the SDK to the manifest.xml of the APK. That is, the APK automatically generates a dependency relationship on the other APKs. After the APK is downloaded from an application store, a list of dependent modules of the APK can be obtained by parsing the manifest.xml of the APK. A corresponding package name can be queried based on a name of a dependent module. Then, a latest APK can be downloaded from the application store based on the package name. All dependent APKs can be downloaded by cyclically parsing the list of the dependent modules of the APK. After these APKs are installed, an upgrade process of this kit is complete.
1. The third-party application integrates SDKs provided by a framework and fido. Manifest.xml of an APK of the third-party application automatically carries API levels on which a fido APK and a framework APK depend. The third-party application invokes an API provided by the fido SDK through a user operation, as shown in (1) in
2. After receiving an API invocation request from the third-party application, the framework queries a local database for a module that meets a condition based on a module name and a corresponding API level. If the module does not meet the condition, the framework triggers an upgrade dialog box, as shown in (2) in
3. After a user clicks “confirm” in the upgrade dialog box, meta-data information of the third-party APK is parsed based on a third-party application package name transferred by the framework, to obtain all dependent module names and corresponding API levels. All package names that do not meet the condition are queried from the local database, and a next upgrade operation is proceeded, as shown in (3) in
4. For each package that needs to be upgraded, whether a new version of the corresponding package is available is checked in the application store. As shown in (4) in
5. The latest version of the corresponding package is downloaded from the application store, as shown in (5) in
6. Whether the module that meets the condition exists in the local database is queried based on the module name and the API level that are parsed in the previous step. If the module that meets the requirement does not exist, an APK package corresponding to the module is upgraded.
7. Steps 4 to 6 are repeated until all dependency conditions for upgrading the APK are met locally.
8. After all APK packages are downloaded, an installation step is proceeded. During installation, a module name and an API level in meta-data of each APK are parsed and stored to the local database, as shown in (7) in
To implement the foregoing upgrade process, the following operations may be performed during kit development and configuration phases:
1. Each kit and the framework respectively configure meta-data in manifest.xml of an APK and a corresponding SDK. For the APK, a module name and a currently provided API level (API capability) of the APK need to be configured in manifest.xml.
For the SDK, a minimum API level of the corresponding APK required by the SDK needs to be configured. Therefore, the SDK may be provided in a.aar format because another APK can depend on and compile .aar through implementation.
The SDK provided by fido is used as an example:
2. When the APK of the kit or the third-party application (also referred to as a content provider, CP, same below) integrates an SDK provided by the another kit or the framework in a compilation phase, a dependency relationship is automatically generated.
The kit may depend on the SDK provided by the framework, or may depend on the another kit. In this way, the APK of the kit needs to integrate the SDKs provided by the framework and the another kit in the compilation phase. During integration, dependency is compiled through implementation. In this way, the meta-data configured by the SDK is automatically inserted into manifest.xml of the APK when the APK is generated through packaging, and the dependency relationship between the framework and the other kit is generated.
For example, it is assumed that there are three kits. Corresponding module names are respectively fido, map, and framework, where fido depends on map and framework, APKs corresponding to fido, map, and framework are fido.apk, map.apk, and framework.apk, and SDKs provided by map and framework are respectively com.huawei.android.hms:map:1.0.0.1 and com.huawei.android.hms:framework:1.1.0.2.
As described in 1, the following meta-data is configured in manifest.xml of map.aar and framework.aar:
Meta-data configuration of com.huawei.android.hms:map:1.0.0.1.aar:
Meta-data configuration of com.huawei.android.hms:framework:1.1.0.2.aar:
Meta-data configuration of fido.apk:
In build.gradle of fido.apk, dependencies on map and framework are configured through implementation.
fido.apk generated after compilation automatically generates the dependencies on map and framework. As shown in the following figure, an API level provided by fido.apk is 3, and fido.apk requires that an API level of map.apk be at least 2 and that an API level of framwork.apk be at least 3.
Similarly, the CP also integrates the SDK provided by the kit or the framework. After the CP compiles and generates the APK, the manifest.xml in the APK also automatically carries the meta-data information configured for the kit SDK and the framework SDK, including all the module names and the corresponding API levels that the kit APK and the framework APK depend on.
3. When the user invokes an API to trigger an upgrade through the CP, all dependencies are parsed from the CP and a package that needs to be upgraded is obtained.
To reduce impact of a plurality of upgrade dialog boxes on user experience, API levels of all modules and the framework on which a current CP depends need to be obtained when the user invokes the API to trigger the upgrade through the CP. Specific steps are as follows:
(1) When the framework starts for the first time, the framework installs all kits and dynamically loads APKs corresponding to the framework, parses module names and API levels that correspond to all the APKs, and stores the module names and the API levels to the local database.
(2) When the CP invokes an API of a kit through a kit SDK, the following information is transferred to the framework: a module name, a required API level, and a package name of a third-party invoker.
(3) The framework queries whether the module that meets the condition exists in the local database based on the module name and the API level. If no module meets the condition, an upgrade dialog box is triggered for the user for confirmation.
(4) If the user confirms the upgrade, the framework parses meta-data information of the third-party invoker from a system based on the package name of the third-party invoker, that is, all module names and corresponding API levels on which the CP depends.
(5) The local database is queried for the module that meets the condition based on all the parsed module names and the parsed API levels. If the module does not meet the condition, a package corresponding to the module is upgraded to obtain names of all packages that need to be upgraded.
4. Updates, downloads, and de-dependencies of the packages that need to be upgraded are cyclically checked until all the dependencies are met locally. After step 3 is performed, the names of all the packages that need to be upgraded are obtained. Steps for performing upgrade based on the package names are as follows:
(1) A latest version number of the APK corresponding to the package name is detected in the application store. If the latest version number is later than a locally installed version number of the APK, the latest version number needs to be downloaded from the application store.
(2) A latest APK is downloaded from the application store based on the package name.
(3) After download is complete, the downloaded APK is parsed to obtain names of all modules on which the APK depends and corresponding API levels.
(4) The local database is queried for a package that meets a condition based on all the parsed module names and the parsed API levels. If the package does not meet the condition, the package is upgraded, to obtain a package to be upgraded based on a dependency.
(5) Steps (1) to (4) are repeated until all dependency conditions for upgrading the APK are met locally.
5. All downloaded packages are installed.
After step 4 is performed, all upgraded APKs are downloaded and installed. Module names and API levels that correspond to the APKs are parsed and stored to the local database.
To sum up, an APK automatically adds meta-data configured by an SDK to manifest.xml of the APK during compilation through implementation. That is, the APK automatically generates a dependency relationship on other APKs. After the APK is downloaded from the application store, the APK parses manifest.xml to obtain a list of modules that the APK depends on, queries a corresponding package name based on a name of a dependent module, and downloads a latest APK from the application store based on the package name. All dependent APKs can be downloaded by cyclically parsing the list of dependent modules of the APK. After these APKs are installed, an upgrade process of this kit is complete.
After the kit is upgraded, an upgraded kit is loaded and run. The following problem may occur during kit loading or running:
An application accesses the kit through an integrated kit SDK. The application may be considered as a host application of the kit. When the host application and the kit invoke different versions of a library at the same time, for example, the host application invokes the json library 1.0, and the kit application invokes the JSON library 2.0, the kit application cannot load a correct JSON version during class loading.
To facilitate understanding of this problem, a common class loading mechanism in Java, namely, a parents delegation model is first described. A main loading principle of the parents delegation model is as follows: When a class loader needs to load a class, the class loader first checks whether the class has been loaded from a loading cache of the class loader. If the class has been loaded, the class is returned. If the class has not been loaded, a father class loader is delegated to load the class. The father class loader uses a same policy. If the class is not loaded by an ancestor loader (Bootstrap ClassLoader), a current class loader loads the class and puts the class in its own loading cache, so that the class can be directly returned when a loading request is received next time.
After the kit is integrated by the host application, the kit and the host application form a father-child relationship for the HMS framework. The host application is the father of the kit. According to an operation mechanism of a parents delegation manner, if the kit has not loaded the JSON class, whether the JSON class exists in the host application is checked. If the kit has loaded the JSON class, the JSON 1.0 version in the host application is returned. However, the kit actually wants to load the JSON 2.0 version. This results in inconsistency between a requirement and a result. It should be understood that, when an application is implemented by using a Java language, the application is essentially a software program including one or more classes.
To resolve this problem, this embodiment provides a class loader selection method. A core idea of this solution is to actively create a class loader and a father class loader of a kit during kit loading, and store a name and the class loader of the kit in a class loading routing table. When a class is loaded, a package name is extracted based on a class name. Then, the kit name is found based on the package name. Finally, the corresponding class loader is found based on the kit name.
The ContainerService module is a standard Android service class, and provides proxy support for an application to invoke a service component in a kit application. The application invokes each interface function in the service class by using an SDK provided by an HMS framework. The SDK of the framework uses a standard API function StartService of an Android system to interact with a ContainerService class. The system invokes OnCreate and onStartCommand functions in the ContainerService class in sequence. This module further defines other standard interface functions of the service class in the Android system.
ServiceDelegateImpl module: Specific service logic of each interface function of a service class proxy is implemented in this module, mainly including loading the kit application package and selecting a stub.
The ClassLoaderManager module is configured to: manage creation and routing of class loading, read existing class loader routing information from a database or file during initialization, create a class loader for a key module (for example, manager or runtime) of the HMS framework, and dynamically generate a father class loader and a proxy class loader of the kit.
The ProxyClassLoader module is configured to: inherit a ClassLoader class of the Android system, extend a loadClass method, extract a package name from a name of a class to be loaded, and find a corresponding class loader from a class loader routing table based on the package name.
The ClassLoaderRouter module is configured to provide initialization, query, and update of class loading routing information. The class loading routing information includes a correspondence between a package name, a kit name, and a class loader. Example:
It should be understood that the foregoing example may alternatively be implemented by using a table or a data structure, or may alternatively be implemented in a kit.
A specific working procedure is as follows:
(1) When an application needs to start a sub-service (also referred to as a sub-kit) of a kit, for example, LocationService, the application invokes a StartService function of the system through the SDK of the framework, and invokes each function of the runtime module in the framework.
It should be understood that the sub-service in this embodiment is a service invoked in the kit, but the sub-service may alternatively be used as an independent service and directly invoked by the application.
(2) After OnStartCommand of the ContainerService module is invoked by the system, a newKitClassLoader function of ClassLoaderManager is invoked. The newKitClassLoader function is used to create a class loader, a father class loader, and a proxy class loader of the kit.
(3) A name and the corresponding class loader of the kit are stored in the class loader routing table of the ClassLoaderRouter module.
(4) After creating the class loader of the kit, the ContainerService module transfers the class loader to the ServiceDelegateImpl module, and then invokes a method of the ServiceDelegateImpl module to start loading of the service class LocationService.
(5) The ServiceDelegateImpl module obtains a name of the to-be-started service class, namely, LocationService, and then invokes a loadClass method of the class loader of the kit. This loadClass method invokes a loadClass method of the father class loader, and the loadClass method of the father class loader invokes a loadClass method of ProxyClassLoader. In the loadClass method of ProxyClassLoader, a package name of the LocationService service class is extracted and a name of the kit corresponding to the package name (the kit can be understood as the sub-kit of the kit in step (1) is found, and is a kit that provides a LocationService service). Then, the class loader is selected from the class loading routing table based on the kit name. If the name of the kit corresponding to the package name is found, the class loader is returned and used to load a class file. If the name of the kit corresponding to the package name is not found, a parents delegation model of the Android system continues to be used to select the class loader.
In the conventional technology, during kit loading, an independent process is started each time a kit is started. When a quantity of kits increases, a quantity of processes increases, and more system resources are consumed. In addition, scheduling of the kit process is not differentiated, which cannot meet response requirements of different services.
To resolve this problem, this embodiment provides a kit process management method. In the method, process pools at a plurality of levels are distinguished based on a response speed requirement of a service. When a kit is loaded, an appropriate process is selected from process pools at different priorities based on a cloud configuration rule and a local load balancing principle, to resolve a problem of poor user experience caused by undifferentiated processing of the response requirements of the different services.
In this embodiment, a process is classified into three types: a persist process which is not likely to be actively ended by a system according to an existing rule, and is also not likely to be ended by an LMK (low memory killer); an HP process which is not likely to be actively ended by the system according to the existing rule, but may be ended by the LMK; and a Normal process which may be actively ended by the system according to the existing rule, and may be ended by the LMK.
To prevent the system from actively ending the HP process, a priority of the HP process needs to be increased, so that the priority of the HP process is not lower than that of some foreground processes. This embodiment provides a method for increasing a priority of an HP process: A bidirectional Binder is established between the HP process and a persist process, so that the persist process synchronizes the binder and depends on the HP process.
a. A running component that belongs to a same kit as the to-be-allocated component and has a same configured process attribute is searched in the Normal process. If the component is found, the to-be-allocated component runs in the process to avoid too many processes.
b. If the rule a is not met, a running component that belongs to the same kit as the to-be-allocated component but has a different process attribute from the to-be-allocated component is searched in various processes. If the component is found, the process is excluded from current available processes.
c. A process with a relatively light load is searched in the available processes based on a process load, and the to-be-allocated component runs in the process. Load calculation is determined based on a quantity of actually running components and memory usage. A specific combination rule may be as follows:
(1) The memory usage is divided into several levels. Each level is 200 MB. A load is considered high when the memory usage is higher than 200 MB.
(2) In a same level, a quantity of active components is checked. If the quantity of active components is larger, a load is higher.
In the foregoing solution, processes are classified into three different types, and an important kit with a high service requirement is scheduled to a process with a relatively high priority by using a kit configuration file. For another kit, a process may be further selected based on a load. This improves process selection flexibility while ensuring a service requirement, and avoids an excessive quantity of processes.
It should be noted that the application mentioned above may be a third-party application, or may be a Huawei-developed application, or may be a combination of the third party application and the Huawei-developed application.
The solution provided in the embodiments may be applied to a terminal device, a server, or the like. The terminal device herein includes but is not limited to a smartphone, an in-vehicle apparatus, a personal computer, an artificial intelligence device, a tablet computer, a personal digital assistant, an intelligent wearable device (for example, a smart watch or band or smart glasses), an intelligent voice device (for example, a smart speaker), a virtual reality/mixed reality/enhanced display device or a network access device (for example, a gateway), or the like. The server may include a storage server, a computing server, or the like.
The communication module 510 includes a Wi-Fi module and a Wi-Fi P2P module. The two modules may be integrated into one piece of hardware, or may be disposed independently. The communication module 510 may further include other modules that enable the computer system to communicate with a communication system or another computer system. For example, the communication module 510 may further include one or more of a wired network interface, a broadcast receiving module, a mobile communication module, a wireless internet module, a local area communication module, and a location (or positioning) information module. The plurality of modules are all implemented in a plurality of ways in a conventional technology, and are not described one by one in this embodiment.
The sensor 520 may sense a current state of a system, for example, an open/closed state, a location, whether the system is in contact with a user, a direction, and acceleration/deceleration. In addition, the sensor 520 may generate a sensing signal used to control an operation of the system.
The user input module 530 is configured to: receive input digital information or characteristic information or a contact touch operation/contactless gesture, and receive signal input related to user settings and function control of the system, and the like. The user input module 530 includes a touch panel and/or another input device.
The output module 540 includes a display panel, configured to display information entered by the user, information provided for the user, various menu interfaces of the system, or the like. Optionally, the display panel may be configured in a form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. In some other embodiments, the touch panel may cover the display panel, to form a touch display screen. In addition, the output module 540 may further include an audio output module, an alarm, a tactile module, and the like.
The audio/video input module 560 is configured to input an audio signal or a video signal. The audio/video input module 560 may include a camera and a microphone. In addition, the computer system may further include an audio/video output module, configured to output an audio signal or a video signal.
The power supply 580 may receive external power and internal power under control of the processor 550, and provide power required for operating each component of the computer system.
The processor 550 may indicate one or more processors. For example, the processor 550 may include one or more central processing units, or include one central processing unit and one graphics processing unit, or include one application processor and one coprocessor (for example, a micro control unit or a neural network processor). When the processor 550 includes a plurality of processors, the plurality of processors may be integrated on a same chip, or may be independent chips. One processor may include one or more physical cores, where the physical core is a smallest processing unit.
The memory 570 stores a computer program (or referred to as a computer-readable instruction), and the computer program includes an operating system program 572, an application program 571, and the like. A typical operating system is a system used for a desktop computer or a laptop, for example, a Windows system of Microsoft and a MacOS system of Apple, or a system used for a mobile terminal, for example, a Linux®-based Android (Android®) system, developed by Google.
The memory 570 may be one or more of the following types: a flash memory, a hard disk type memory, a micro multimedia card type memory, a card type memory (for example, an SD or XD memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory PROM), a magnetic memory, a magnetic disk, or an optical disc. In some other embodiments, the memory 570 may alternatively be a network storage device on the internet, and the system may perform an operation such as updating or reading the memory 570 on the internet.
The processor 550 is configured to read the computer program in the memory 570, and then perform a method defined by the computer program. The device discovery solution provided in this application is mainly implemented in the operating system program 572, and some functions may also be integrated by the application program 571.
The memory 570 further stores other data 573 in addition to the computer program.
A connection relationship among the modules is only an example. A method provided in any embodiment of this application may also be applied to a terminal device in another connection manner. For example, all modules are connected through a bus. Division into each module is only logical division, and does not necessarily mean that the modules are separated in terms of hardware. The modules are not necessarily essential to some embodiments of this application.
In addition, this application further provides a mobile service upgrade apparatus. The apparatus includes one or more modules, configured to implement the method in any implementation of the first aspect. It should be understood that the modules may one-to-one correspond to the method steps, or may not one-to-one correspond to the method steps. A name of the module is not limited. The upgrade apparatus may be, for example, an HMS framework described in embodiments. This application further provides a computer program medium. The computer program medium includes computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the foregoing method is implemented. This application further provides a computer program product (or referred to as a computer program). The computer program product includes computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the foregoing method is implemented.
It should be noted that division into modules or units provided in the foregoing embodiments is merely an example, functions of the described modules are merely used as examples for description, and this application is not limited thereto. A person of ordinary skill in the art can converge functions of two or more modules thereof as required, or divide a function of one module to obtain more modules at a finer granularity and other variants.
Same or similar parts between the embodiments described above may be cross-referenced. “A plurality of” in this application means two or more or “at least two” unless otherwise specified. “A/B” in this application includes three cases: “A”, “B”, and “A and B”. In this application, “first”, “second”, “third”, and the like are merely used for distinguishing expressions, and are not intended to limit a sequence. In addition, a first object and a second object may be combined or refer to a same object in some cases. Further, because there is no limited sequence, there may be not first, and there may be second or third.
The described apparatus embodiment is merely an example. The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one position, or may be distributed on a plurality of network modules. Some or all the modules may be selected based on an actual requirement to achieve the objectives of the solutions of the embodiments. In addition, in the accompanying drawings of the apparatus embodiments provided in this application, connection relationships between modules indicate that the modules have communication connections with each other, which may be specifically implemented as one or more communication buses or signal cables. A person of ordinary skill in the art may understand and implement embodiments without creative efforts.
The foregoing descriptions are merely some specific embodiments of this application, but the protection scope of this application is not limited thereto.
Number | Date | Country | Kind |
---|---|---|---|
201911382884.0 | Dec 2019 | CN | national |
This application is a continuation of U.S. patent application Ser. No. 17/848,737, filed on Jun. 24, 2022, which is a continuation of International Application No. PCT/CN2020/139856, filed on Dec. 28, 2020, which claims priority to Chinese Patent Application No. 201911382884.0, filed on Dec. 27, 2019. All of the aforementioned patent applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | 17848737 | Jun 2022 | US |
Child | 18753164 | US | |
Parent | PCT/CN2020/139856 | Dec 2020 | WO |
Child | 17848737 | US |