图库在播放幻灯片时,按power键灭屏,然后再亮屏,会发现幻灯片继续在播放,没有显示keyguard。如何在亮屏后显示解锁界面。
修改方法是去掉FLAG_SHOW_WHEN_LOCKED标志位,在ICS2、JB和JB2上的修改位置略有不同。
1、在ICS2和JB版本上,修改Gallery2\src\com\android\gallery3d\app\ActivityState.java文件中SCREEN_ON_FLAGS ,如下:
private static final int SCREEN_ON_FLAGS = (
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
//
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
2、在JB2版本上,修改alps\packages\apps\gallery2\src\com\android\gallery3d\app\SlideshowPage.java的onCreate()方法:
public void onCreate(Bundle data, Bundle restoreState) {
super.onCreate(data, restoreState);
// mFlags |= (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR
// | FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | FLAG_SHOW_WHEN_LOCKED);
mFlags |= (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR
| FLAG_ALLOW_LOCK_WHILE_SCREEN_ON );
...
}
标签:BAR,SCREEN,再亮,WindowManager,时灭,WHILE,FLAG,HIDE,android From: https://blog.51cto.com/u_15170706/6114562