Packageorg.zengrong.ane.tool
Classpublic class PowerCont
InheritancePowerCont Inheritance ToolBase Inheritance flash.events.EventDispatcher

振动功能



Public Properties
 PropertyDefined By
 Inheritedextension : ExtensionContext
[read-only]
ToolBase
Protected Properties
 PropertyDefined By
 Inherited_extension : ExtensionContext
ToolBase
Public Methods
 MethodDefined By
  
PowerCont($context:ExtensionContext)
PowerCont
  
acquire($flags:int, $timeout:int = 0, $counted:Boolean = true):void
执行对电源的设置
PowerCont
 Inherited
dispose():void
ToolBase
  
使用WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON来保持当前Activity常亮
PowerCont
  
goToSleep($time:int):void
切换到睡眠状态
PowerCont
  
isScreenOn():Boolean
屏幕是否是亮的 需要DEVICE_POWER权限
PowerCont
  
reboot($reason:String):void
重启设备
PowerCont
  
release($flags:int):void
释放对电源的设置
PowerCont
  
userActivity($when:int, $noChangeLights:Boolean):void
模拟用户激活设备
PowerCont
Protected Methods
 MethodDefined By
 Inherited
handler_status($evt:StatusEvent):void
ToolBase
Constructor Detail
PowerCont()Constructor
public function PowerCont($context:ExtensionContext)



Parameters
$context:ExtensionContext
Method Detail
acquire()method
public function acquire($flags:int, $timeout:int = 0, $counted:Boolean = true):void

执行对电源的设置

Parameters

$flags:int — 要设置的电源模式,具体使用方法见:http://developer.android.com/reference/android/os/PowerManager.html
 
$timeout:int (default = 0) — 如果为大于0,则为超时锁,否则为永久锁。
 
$counted:Boolean (default = true) — 如果值为true,则为计数锁,否则为不计数锁。

See also

flagKeepScreenOn()method 
public function flagKeepScreenOn():void

使用WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON来保持当前Activity常亮

See also

goToSleep()method 
public function goToSleep($time:int):void

切换到睡眠状态

Parameters

$time:int — 持续时间

isScreenOn()method 
public function isScreenOn():Boolean

屏幕是否是亮的 需要DEVICE_POWER权限

Returns
Boolean

See also

reboot()method 
public function reboot($reason:String):void

重启设备

Parameters

$reason:String — 重启的原因 重启需要REBOOT权限

See also

release()method 
public function release($flags:int):void

释放对电源的设置

Parameters

$flags:int

userActivity()method 
public function userActivity($when:int, $noChangeLights:Boolean):void

模拟用户激活设备

Parameters

$when:int — 何时激活
 
$noChangeLights:Boolean — 是否改变电源灯的状态