summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2012-08-30 16:44:32 +0800
committerWu-cheng Li <wuchengli@google.com>2012-08-31 15:13:42 +0800
commitb02977e128c7b85ad964c3ed90a6c5ed26ac682d (patch)
treef9a83d0be7f1873129f8067dbeccf0a853db3917 /src
parentafebbfa1b19f70f5c197e781071fadaf560d778d (diff)
downloadandroid_packages_apps_Snap-b02977e128c7b85ad964c3ed90a6c5ed26ac682d.tar.gz
android_packages_apps_Snap-b02977e128c7b85ad964c3ed90a6c5ed26ac682d.tar.bz2
android_packages_apps_Snap-b02977e128c7b85ad964c3ed90a6c5ed26ac682d.zip
Use FLAG_SHOW_WHEN_LOCKED for secure album.
The activity needs this flag to be on top of the lock screen when the camera is started from the secure lock screen. bug:5955016 Change-Id: If554a3f7fef4c03a981c83afe22b8c4980b954d1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/ActivityState.java30
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java2
-rw-r--r--src/com/android/gallery3d/app/SlideshowPage.java3
3 files changed, 22 insertions, 13 deletions
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java
index aef1ee1a6..2eb480a20 100644
--- a/src/com/android/gallery3d/app/ActivityState.java
+++ b/src/com/android/gallery3d/app/ActivityState.java
@@ -44,12 +44,8 @@ abstract public class ActivityState {
protected static final int FLAG_HIDE_STATUS_BAR = 2;
protected static final int FLAG_SCREEN_ON_WHEN_PLUGGED = 4;
protected static final int FLAG_SCREEN_ON_ALWAYS = 8;
-
- 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
- );
+ protected static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 16;
+ protected static final int FLAG_SHOW_WHEN_LOCKED = 32;
protected AbstractGalleryActivity mActivity;
protected Bundle mData;
@@ -134,20 +130,30 @@ abstract public class ActivityState {
if (plugged != mPlugged) {
mPlugged = plugged;
- setScreenOnFlags();
+ setScreenFlags();
}
}
}
};
- void setScreenOnFlags() {
- final Window win = ((Activity) mActivity).getWindow();
+ private void setScreenFlags() {
+ final Window win = mActivity.getWindow();
final WindowManager.LayoutParams params = win.getAttributes();
if ((0 != (mFlags & FLAG_SCREEN_ON_ALWAYS)) ||
(mPlugged && 0 != (mFlags & FLAG_SCREEN_ON_WHEN_PLUGGED))) {
- params.flags |= SCREEN_ON_FLAGS;
+ params.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
+ } else {
+ params.flags &= ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
+ }
+ if (0 != (mFlags & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON)) {
+ params.flags |= WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON;
+ } else {
+ params.flags &= ~WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON;
+ }
+ if (0 != (mFlags & FLAG_SHOW_WHEN_LOCKED)) {
+ params.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
} else {
- params.flags &= ~SCREEN_ON_FLAGS;
+ params.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
}
win.setAttributes(params);
}
@@ -176,7 +182,7 @@ abstract public class ActivityState {
activity.invalidateOptionsMenu();
- setScreenOnFlags();
+ setScreenFlags();
boolean lightsOut = ((mFlags & FLAG_HIDE_STATUS_BAR) != 0);
mActivity.getGLRoot().setLightsOutMode(lightsOut);
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 3354c919d..b9726e786 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -255,6 +255,8 @@ public class PhotoPage extends ActivityState implements
if (SecureSource.isSecurePath(mSetPathString)) {
mSecureAlbum = (SecureAlbum) mActivity.getDataManager()
.getMediaSet(mSetPathString);
+ // Set the flag to be on top of the lock screen.
+ mFlags |= FLAG_SHOW_WHEN_LOCKED;
}
// Combine the original MediaSet with the one for ScreenNail
diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java
index 9c52b9106..80edb367e 100644
--- a/src/com/android/gallery3d/app/SlideshowPage.java
+++ b/src/com/android/gallery3d/app/SlideshowPage.java
@@ -112,7 +112,8 @@ public class SlideshowPage extends ActivityState {
@Override
public void onCreate(Bundle data, Bundle restoreState) {
super.onCreate(data, restoreState);
- mFlags |= (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR);
+ mFlags |= (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR
+ | FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | FLAG_SHOW_WHEN_LOCKED);
if (data.getBoolean(KEY_DREAM)) {
// Dream screensaver only keeps screen on for plugged devices.
mFlags |= FLAG_SCREEN_ON_WHEN_PLUGGED;