Background
Under the condition that the set-top box basically adopts an android system, the set-top box continuously faces some special requirements of customers, scattered system development is carried out, the pure positive of a source code is damaged, meanwhile, great difficulty is increased for version updating, work handover and maintenance work, therefore, a service built in the android system needs to be developed to greatly concentrate the scattered requirements, external interfaces of secondary developers are unified, the integrity of the system can be greatly improved, and meanwhile, a reliable foundation is provided for long-distance development.
Disclosure of Invention
In order to overcome the defects of the technology, the invention provides a method for managing Service of the Android set top box system built-in system, which can improve the expansibility and is universal between each version and each platform.
The technical scheme adopted by the invention for overcoming the technical problems is as follows:
a method for managing Service by an Android set top box system built-in system comprises the following steps:
a) establishing a service as a manager in the Android system of the set top box, and enabling the established service to have the internal authority of the Android system and expose an interface customized for the service;
b) respectively arranging a system control module, a ModuleControl module and an InspurAdapter module in the service;
c) the system control module monitors and reads the resolution of the Android system by using a uevent mechanism and an Android file monitoring mechanism, monitors system attributes in real time by using different paths for different nodes, and provides a system-wide notification by using broadcasting or a system database;
d) the ModuleControll module is provided with a plurality of independent service processes for managing a third-party module, the plurality of independent service processes are started when the Android system is started by utilizing an ActivitManager, and the plurality of independent service processes are called back to the ModuleControll registration state;
e) the InspurAdapter module uses a MulticastSocket to detect equipment in a local area network in an Android system, uses a Bluetooth ToothAdpt to discover and call back a Bluetooth state of the Bluetooth equipment, uses a Nature layer SurfaceFlinger and a MediaCodec of the Android system to record current screen content without permission application, and obtains a virtual DisplaySurface of the SurfaceFlinger as an InputSurface of the MediaCodec.
Further, in the step a), a service inheriting the BindService is established in a frame layer of the Android system, the service is registered into the SystemService, and a service object is obtained from the whole situation.
Preferably, a service allows access to other services, which are also frame layers.
Further, the systemcontrol module in the step c) writes a corresponding value into the hdr _ mode in the Android system to change the sdr image quality mode and the hdr image quality mode.
The invention has the beneficial effects that: the scattered requirements are greatly concentrated by establishing the service built in the Android system, external interfaces for secondary developers are unified, the integrity of the system can be greatly improved, and meanwhile, a reliable foundation is provided for long-term development. Meanwhile, the customized set top box needs to be brought into software products of other third-party companies, such as the love art, the Tencent video and the like, a mode of separating a front section and a rear section can be adopted in a set top box system to develop a set top box display interface, the front section is focused on UI interface development, the rear end (a manager system) is responsible for managing the third-party services, and available interfaces are summarized for calling the front section UI, so that the front end and the rear end are developed in parallel, the development speed is improved, and the project period is shortened.
Detailed Description
The present invention is further explained below.
A method for managing Service by an Android set top box system built-in system comprises the following steps:
a) and establishing a service as a manager in the Android system of the set top box, and enabling the established service to have the internal authority of the Android system and expose an interface customized for the service.
b) A systemcontrol module, a ModuleControl module and an InspurAdapter module are respectively arranged in the service.
c) The system control module monitors and reads the resolution of the Android system by using a uevent mechanism and an Android file monitoring mechanism, monitors system attributes in real time by using different paths for different nodes, and provides system-wide notification by using broadcasting or a system database. The system control is used for managing and relating to the system, and comprises the acquisition of system attributes of the android system, the reading and writing of system nodes, the storage of system logs and other system-related matters. For example, acquiring the constantly changing resolution of the box, creating a FileObserver, and reading the related node information through callback; the current sdr mode is adjusted to change the picture quality. These interfaces, which do not appear in standard systems, can be implemented in a systemcontrol, including the now specially-made bluetooth fallback module, we can concentrate a large number of sporadic modifications to reduce the difficulty of upgrading versions, and the same series of products can continue to reuse this systemcontrol.
d) The ModuleControl module is mainly used for managing a third-party module, managing life processes and integrating functions of the third-party module, the third-party module is basically an independent service process and follows the service specification of an Android system, the ModuleControl module is provided with a plurality of independent service processes for managing the third-party module, the plurality of independent service processes are started when the Android system is started by utilizing an ActivatyManager, the plurality of independent service processes are called back to the ModuleControl registration state, management of the ModuleControl is facilitated, and functions of abnormity monitoring, death restarting and the like are achieved. The ModuleControl module is used for managing some modules which can be modified and customized, such as Emhi skill sdk, home monitoring service and the like, and the modules are packaged in service modes of ModuleControl, such as starting entry, Log collection and Crash monitoring, so that the modules can be thoroughly monitored, the functions of starting up, ensuring survival, reporting exception and the like are realized, and therefore, the realization of a plurality of special functions and effects is not limited by an android mechanism any more, and more modes are provided.
e) The InspurAdapter is mainly used for carrying numerous functional modules to realize flexible and changeable function expansion, and a code structure is designed in a factory mode or a bridge mode to facilitate calling and expanding functions. In order to guide the internet of things and increase the connection capacity with other equipment, an InspurAdapter module uses a MulticastSocket to detect equipment in a local area network in an Android system, a Bluetooth device is discovered by using a Bluetooth ToothAdptator, the Bluetooth state is recalled, the use frequency of Bluetooth is higher and higher, many customized set-top boxes need related functions and are modules which can be frequently reused, recording current screen content without permission application is realized by using a Nature layer Surfaceflunger and a MediaCodec of the Android system, and a VirtualDisplaySurface of Surfaceflunger is obtained as an InputSurface of the MediaCodec. The InspurAdapter module is a functional supplement for the InspurManager, if linkage between products of the Inspur needs to be realized, devicedetector Adapter can be connected to devices connected to the same network through wifi multicast, for example, a device DetecttorAdapter can be added, Bluetooth Adapter can be added by matching Bluetooth remote controllers, the use is convenient, and the Adapter can be accumulated with strong practical technologies by continuously iterating the Adapter.
The scattered requirements are greatly concentrated by establishing the service built in the Android system, external interfaces for secondary developers are unified, the integrity of the system can be greatly improved, and meanwhile, a reliable foundation is provided for long-term development. Meanwhile, the customized set top box needs to be brought into software products of other third-party companies, such as the love art, the Tencent video and the like, a mode of separating a front section and a rear section can be adopted in a set top box system to develop a set top box display interface, the front section is focused on UI interface development, the rear end (a manager system) is responsible for managing the third-party services, and available interfaces are summarized for calling the front section UI, so that the front end and the rear end are developed in parallel, the development speed is improved, and the project period is shortened.
A reliable system is established, functions with high reusability (such as system attribute extraction and node control) are extracted by adopting a modular design mode, functional modules with high technical performance are reserved, and through continuous accumulation and development of generation versions, the difficulty of redevelopment can be greatly reduced, and the time and the technical cost are reduced.
Example 1:
in the step a), a service inheriting the BindService is established in a frame layer of the Android system, the service is registered into the SystemService, and a service object is obtained globally. Providing services for the customized interface.
Example 2:
a service allows access to other services, also known as framework layers, with a higher privilege than apk for some defined operations.
Example 3:
the systemcontrol module in the step c) writes corresponding values into/system/module/am _ vecm/parameters/hdr _ mode in the Android system to change the sdr picture quality mode and the hdr picture quality mode. According to the characteristics of the android system, many similar characteristics can be controlled by writing in nodes, the only thing to be noticed is written values and node paths, and therefore the android system can operate on different platforms with different versions by uniformly adapting the similar modes to parameters of different platforms.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that changes may be made in the embodiments and/or equivalents thereof without departing from the spirit and scope of the invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.