summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeff Hamilton <jham@android.com>2010-11-03 19:37:58 -0500
committerJeff Hamilton <jham@android.com>2010-11-03 19:37:58 -0500
commit39523c7c2e4df38d674a33c4c4631ed908ad3c9e (patch)
treec2a19a827b9d713320c282b327d24a9552219fb1 /src
parent52d880daa43a4f587107a6b8a0197afd3092200a (diff)
downloadandroid_packages_apps_Tag-39523c7c2e4df38d674a33c4c4631ed908ad3c9e.tar.gz
android_packages_apps_Tag-39523c7c2e4df38d674a33c4c4631ed908ad3c9e.tar.bz2
android_packages_apps_Tag-39523c7c2e4df38d674a33c4c4631ed908ad3c9e.zip
Don't show the tag scanned activity over the lockscreen.
Bug: 3163663 Change-Id: I5ad704030b1d0ecdcf49551831d9bcc2af646aa1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/apps/tag/TagViewer.java38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/com/android/apps/tag/TagViewer.java b/src/com/android/apps/tag/TagViewer.java
index e139fda..fe30af1 100644
--- a/src/com/android/apps/tag/TagViewer.java
+++ b/src/com/android/apps/tag/TagViewer.java
@@ -66,6 +66,8 @@ public class TagViewer extends Activity implements OnClickListener {
static final String EXTRA_MESSAGE = "msg";
static final String EXTRA_KEEP_TITLE = "keepTitle";
+ static final boolean SHOW_OVER_LOCK_SCREEN = false;
+
/** This activity will finish itself in this amount of time if the user doesn't do anything. */
static final int ACTIVITY_TIMEOUT_MS = 7 * 1000;
@@ -95,7 +97,9 @@ public class TagViewer extends Activity implements OnClickListener {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+ if (SHOW_OVER_LOCK_SCREEN) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
+ }
setContentView(R.layout.tag_viewer);
@@ -154,21 +158,23 @@ public class TagViewer extends Activity implements OnClickListener {
// Parse the intent
String action = intent.getAction();
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
- // A tag was just scanned so poke the user activity wake lock to keep
- // the screen on a bit longer in the event that the activity has
- // hidden the lock screen.
- PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, TAG);
- // This lock CANNOT be manually released in onStop() since that may
- // cause a lock under run exception to be thrown when the timeout
- // hits.
- wakeLock.acquire(ACTIVITY_TIMEOUT_MS);
-
- if (mReceiver == null) {
- mReceiver = new ScreenOffReceiver();
- IntentFilter filter = new IntentFilter();
- filter.addAction(Intent.ACTION_SCREEN_OFF);
- registerReceiver(mReceiver, filter);
+ if (SHOW_OVER_LOCK_SCREEN) {
+ // A tag was just scanned so poke the user activity wake lock to keep
+ // the screen on a bit longer in the event that the activity has
+ // hidden the lock screen.
+ PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
+ WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, TAG);
+ // This lock CANNOT be manually released in onStop() since that may
+ // cause a lock under run exception to be thrown when the timeout
+ // hits.
+ wakeLock.acquire(ACTIVITY_TIMEOUT_MS);
+
+ if (mReceiver == null) {
+ mReceiver = new ScreenOffReceiver();
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(Intent.ACTION_SCREEN_OFF);
+ registerReceiver(mReceiver, filter);
+ }
}
// When a tag is discovered we send it to the service to be save. We