开发者

long press and normal pressing of power button in android

HIe all i was trying to understand the power down sequence of the android phone. i am almost thru with the top to bottom except the one thing i,e on long press of the power button the dialog box is launched showing three options 1. silent mode 2. airplane mode and 3.开发者_如何转开发 power off. i am unable to understand where from this UI is launched and where the action written for the handling the long press and normal press of the power button.

long press and normal pressing of power button in android

i am having access to the mydroid file system.


As mentioned here https://stackoverflow.com/a/15828673/1065357

if you override this method in activity or in view that has focus then user cannot long press power button

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if(!hasFocus) {
       Intent closeDialog = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        sendBroadcast(closeDialog);
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜