When playing the slideshow in the gallery, press the power key to turn off the screen, and then turn on the screen. You will find that the slideshow continues to play, and no keyguard is displayed. How to display the unlock interface after the screen is on.
The modification method is to remove the FLAG_SHOW_WHEN_LOCKED flag bit, and the modification positions on ICS2, JB and JB2 are slightly different.
1. On ICS2 and JB versions, modify SCREEN_ON_FLAGS in the Gallery2\src\com\android\gallery3d\app\file, as follows:
private static final int SCREEN_ON_FLAGS = (
.FLAG_KEEP_SCREEN_ON
| .FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
// | .FLAG_SHOW_WHEN_LOCKED
);
2. On the JB2 version, modify the onCreate() method of alps\packages\apps\gallery2\src\com\android\gallery3d\app\:
public void onCreate(Bundle data, Bundle restoreState) {
(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 );
...
}
The modification method is to remove the FLAG_SHOW_WHEN_LOCKED flag bit, and the modification positions on ICS2, JB and JB2 are slightly different.
1. On ICS2 and JB versions, modify SCREEN_ON_FLAGS in the Gallery2\src\com\android\gallery3d\app\file, as follows:
Copy the codeThe code is as follows:
private static final int SCREEN_ON_FLAGS = (
.FLAG_KEEP_SCREEN_ON
| .FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
// | .FLAG_SHOW_WHEN_LOCKED
);
2. On the JB2 version, modify the onCreate() method of alps\packages\apps\gallery2\src\com\android\gallery3d\app\:
Copy the codeThe code is as follows:
public void onCreate(Bundle data, Bundle restoreState) {
(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 );
...
}