A kind of implementation method of Android device folding lid and system
Technical field
The present invention relates to Android device technical field of power management, particularly relate to a kind of implementation method and system of Android device folding lid.
Background technology
Along with the acceleration of Android device updates, the use of attached device is of a great variety.Hall device is exactly wherein a kind of important device, utilizes hall device to be a kind of common use-pattern to realize the folding lid function of Android device.
As Samsung, the Android device that the equipment vendors such as Huawei dispatch from the factory also is band Hull device, and external basic function is all similar, is all that screen of uncapping is bright, unlocks slip screen locking.Closing lid screen goes out, screen locking.
What Android device on the market adopted the realization of hall device is analogue-key mode.Hull device leave and near being modeled to pressing and unclamping of a button, namely specific be that closing lid is modeled to closedown button (KEY_DOWN), uncap and be modeled to unlatching button (KEY_UP), follow-up various functions is all realize in the response of key-press event.This mode implements more loaded down with trivial details, relate to JNI (JavaNativeInterface, Java local interface) layer process, the process of framework (Framework) layer, and the finger daemon of key-press event process will monitor analogue-key, forever can not dormancy, waste electricity, energy consumption is higher.
Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of implementation method and system of Android device folding lid, for solving in prior art, adopts to the realization of hall device the problem that simulation case mode energy consumption is higher.
For achieving the above object and other relevant objects, the invention provides a kind of implementation method of Android device folding lid, the folding lid of described Android device is completed by hall device event, when described Android device is in deep sleep state, the implementation method of described Android device folding lid comprises: step S10, detect and judge whether described hall device event occurs: if so, then waking the system service process in described Android device up, and jump to step S20; If not, then continue to detect; Step S20, described system service process transfers run mode to, and starts power management services; Step S30, monitors described hall device event by described power management services, and carries out Logic judgment: when judging that described hall device event is that hall device is opened, then calling system awakening method wakes described Android device up; When judging that described hall device event is that described hall device is closed, then calling system dormancy method, allows described Android device enter dormant state.
In one embodiment of the invention, described hall device is opened, and represents that described Android device is uncapped; Described hall device is closed, and represents described Android device closing lid.
In one embodiment of the invention, system service process described in described step S10 is waken up and is realized by linux kernel.
In one embodiment of the invention, in described step S30, in described power management services before the described hall device event of monitoring, arrange as follows: instantiation sensor manager object in described power management services; The hall device object that described hall device is corresponding is obtained, instantiation hall device action listener class from described sensor manager object; Described Android system is registered the monitoring to described hall device event.
In one embodiment of the invention, the registration of the monitoring of described hall device event has been come by the registerListener function of described sensor manager object.
In one embodiment of the invention, the described power management services of described step S30 is monitored described hall device event and carries out Logic judgment, specifically comprise: when described Hall action listener class listens to and there occurs described hall device event, call onSensorChanged function; By described onSensorChanged function, judge the state of described hall device; The state of wherein said hall device comprises opening and closing; According to the condition adjudgement of described hall device, Android device uncaps and closing lid.
In one embodiment of the invention, in described step S30, wake described Android device up and comprise: the screen lighting described Android device; Untie the screen protection lock of described Android device; Enter interface during described Android device closing lid last time.
In one embodiment of the invention, in described step S30, described Android device enters dormant state and comprises: close the screen of described Android device and screen locking.
Android device folding lid realize a system, the folding lid of described Android device is completed by hall device event, and the system that realizes of described Android device folding lid comprises: detect judge module, for detect and judge whether described hall device event occurs; Wake module, for waking the system service process in described Android device up, and transfers described system service process to run mode; Power management services starts module, for starting described power management services; Monitoring and logic judgment module, for monitoring described hall device event by described power management services, and carrying out Logic judgment, thus wake up or the system of Android device described in dormancy.
In one embodiment of the invention, described monitoring and logic judgment module are by described power management services instantiation sensor manager object; And from described sensor manager object, obtain hall device object corresponding to described hall device, realize hall device action listener class, and the monitoring of registering on described Android system described hall device event, so that hall device action listener class is to the monitoring of described hall device event.
As mentioned above, the implementation method of a kind of Android device folding lid of the present invention and system, the mode of the analogue-key of traditional hall device is not adopted to realize the folding lid of Android device, but adopt the response process increased in power management services for hall device, simplify treatment scheme, and need not guard the analogue-key time, the system of Android device can directly penetration depth dormancy, reduce the energy consumption of Android device, improve the efficiency of Android device.
Accompanying drawing explanation
Fig. 1 is shown as the schematic flow sheet of a kind of Android device folding lid implementation method disclosed in the embodiment of the present invention.
Fig. 2 is shown as a kind of Android device folding lid disclosed in the embodiment of the present invention and realizes the structural representation of system.
Element numbers explanation
S10 ~ S30 step
200 Android device folding lids realize system
210 detect judge module
220 wake module
230 power management services start module
240 monitor and logic judgment module
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this instructions can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this instructions also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.It should be noted that, when not conflicting, the feature in following examples and embodiment can combine mutually.
Refer to accompanying drawing.It should be noted that, the diagram provided in following examples only illustrates basic conception of the present invention in a schematic way, then only the assembly relevant with the present invention is shown in graphic but not component count, shape and size when implementing according to reality is drawn, it is actual when implementing, and the kenel of each assembly, quantity and ratio can be a kind of change arbitrarily, and its assembly layout kenel also may be more complicated.
Embodiment 1
Present embodiment discloses a kind of implementation method of Android device folding lid, have employed the induction of hall device to realize the folding lid of Android device.Further, it is varied that Android device utilizes the induction of hall device to realize the mode of folding lid, what the present embodiment adopted is the response process increased in the power management services (PowerManagerService) of Android device hall device, thus realizes the folding lid of Android device.
Further, Android device refers to the equipment using Android operation system, equipment comprises storer, Memory Controller, one or more processor (CPU), interface circuit, RF (radio frequency) circuit, voicefrequency circuit, loudspeaker, microphone, I/O (I/O) subsystem, touch display screen, other output or opertaing devices, and outside port.These assemblies are communicated by one or more communication bus or signal wire.Equipment can be any portable electric appts, includes but not limited to notebook computer, panel computer, smart mobile phone, multimedia player, personal digital assistant (PDA) etc., also may comprise wherein two or multinomial combination.Should be appreciated that the equipment enumerated in the present embodiment is one of them example.Further, various assembly can realize with the combination of hardware, software or software and hardware, comprises one or more signal transacting and/or special IC.
As shown in Figure 1, when Android device is in deep sleep state, the implementation method of Android device folding lid comprises:
Step S10, detects and judges whether hall device event occurs:
If so, then wake the system service process in described Android device up, and jump to step S20;
If not, then continue to detect;
Increase bottom hall device and wake Android system mechanism up, that is, when Android system dormancy, when there being hall device event to occur, when also namely folding lid operates, by linux kernel, the system service process in Android device is waken up.Because Android system is a kind of based on the freedom of Linux and the operating system of open source code, therefore by linux kernel, the system service process in Android device is waken up, be equivalent to from the bottom, Android system be waken up.
Step S20, the system service process of described Android device transfers run mode to, and starts power management services:
System process (SystemServerprocess) transfers run mode to, and the power management services (PowerManagerService) operated in this process is activated.
Step S30, monitors described hall device event by described power management services, and carries out Logic judgment:
When judging that described hall device event is that hall device is opened, then calling system awakening method wakes described Android device up;
When judging that described hall device event is that described hall device is closed, then calling system dormancy method, allows described Android device enter dormant state.
Before the described hall device event of monitoring, need in the constructed fuction of power management services to add the monitoring to hall device event, namely add the processing logic to hall device event.Namely need according to arranging as follows:
Instantiation sensor manager object in described power management services:
In the systemReady method of power management services PowerManagerService class, add processing logic, obtain the sensor manager object mSensorManager of Android system.
From described sensor manager object mSensorManager, obtain hall device object corresponding to described hall device, realize hall device action listener class myHallListener.
Described Android system is registered the monitoring to described hall device event:
Call the registerListener function registration of the sensor manager object mSensorManager of Android system to the monitoring of hall device event.That is, registration is completed by following form:
mSensorManager.registerListener(mHallListener,mHallSensor,500)。
Listen to when there occurs described hall device event, Hall action listener class myHallListener calls onSensorChanged function;
By described onSensorChanged function, judge the state of described hall device; The state of wherein said hall device comprises opening and closing; The opening and closing of hall device, correspond to uncapping and closing lid of Android device.
The uncapping and closing lid of Android device according to the condition adjudgement of described hall device:
In the present embodiment, be the value being dependent on hall device event by the judgement of power management services PowerManagerService to the state of hall device.
Further, when judging that hall device is opened, then calling system awakening method wakes described Android device up.Wherein, wake Android device up to comprise:
Light the screen of described Android device;
Untie the screen protection lock of described Android device;
Enter interface during described Android device closing lid last time.
When judging that hall device is closed, then calling system dormancy method, allows described Android device enter dormant state.Wherein, wake Android device up to comprise: close the screen of described Android device and screen locking.
The processing logic of hall device event is just arranged in power management services by the implementation method of the Android device folding lid of the present embodiment, so just can simply again efficiently resolution system process when deep-sleep hall device event problem.
It should be noted that, above the step of various method divide, just in order to be described clearly, a step can be merged into when realizing or some step is split, be decomposed into multiple step, as long as comprise identical logical relation, all in the protection domain of this patent; To adding inessential amendment in algorithm or in flow process or introducing inessential design, but the core design not changing its algorithm and flow process is all in the protection domain of this patent.
Embodiment 2
What present embodiment discloses a kind of Android device folding lid realizes system, adopts the response process of increase to hall device in the power management services (PowerManagerService) of Android device, thus realizes the folding lid of Android device.
Further, Android device refers to the equipment using Android operation system, equipment comprises storer, Memory Controller, one or more processor (CPU), interface circuit, RF (radio frequency) circuit, voicefrequency circuit, loudspeaker, microphone, I/O (I/O) subsystem, touch display screen, other output or opertaing devices, and outside port.These assemblies are communicated by one or more communication bus or signal wire.Equipment can be any portable electric appts, includes but not limited to notebook computer, panel computer, smart mobile phone, multimedia player, personal digital assistant (PDA) etc., also may comprise wherein two or multinomial combination.Should be appreciated that the equipment enumerated in the present embodiment is one of them example.Further, various assembly can realize with the combination of hardware, software or software and hardware, comprises one or more signal transacting and/or special IC.
As shown in Figure 2, the system that realizes 200 of the Android device folding lid of the present embodiment comprises:
Detect judge module 210, for detecting and judging whether described hall device event occurs;
Wake module 220, for waking the system service process in described Android device up, and transfers system service process to run mode;
Power management services starts module 230, for starting described power management services;
Monitoring and logic judgment module 240, for monitoring described hall device event by described power management services, and carrying out Logic judgment, thus wake up or the system of Android device described in dormancy.
Further, monitoring and logic judgment module 240 are by described power management services instantiation sensor manager object; And from described sensor manager object, obtain hall device object corresponding to described hall device, realize hall device action listener class, and the monitoring of registering on described Android system described hall device event, so that hall device action listener class is to the monitoring of described hall device event.
In addition, in order to outstanding innovative part of the present invention, the module not too close with solving technical matters relation proposed by the invention is not introduced in the present embodiment, but this does not show the module that there is not other in the present embodiment.
Be not difficult to find, the present embodiment is system embodiment corresponding to those in the first embodiment, and the present embodiment can be worked in coordination with the first embodiment and be implemented.The relevant technical details mentioned in first embodiment is still effective in the present embodiment, in order to reduce repetition, repeats no more here.Correspondingly, the relevant technical details mentioned in the present embodiment also can be applicable in the first embodiment.
In sum, the implementation method of a kind of Android device folding lid of the present invention and system, the implementation method of a kind of Android device folding lid of the present invention and system, the mode of the analogue-key of traditional hall device is not adopted to realize the folding lid of Android device, but adopt the response process increased in power management services for hall device, simplify treatment scheme, and need not guard the analogue-key time, the system of Android device can directly penetration depth dormancy, reduce the energy consumption of Android device, improve the efficiency of Android device, there is good using value.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.