summaryrefslogtreecommitdiffstats
path: root/quickReader
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2018-05-25 00:00:26 +0200
committerMichael Bestas <mkbestas@lineageos.org>2019-11-09 22:15:24 +0200
commit60a285627fcce6fe2d677efde4ce924946a2ec25 (patch)
tree2da4b8173b9eb4d30e6131fd8f6a894cb9aa682d /quickReader
parente7b4d3ec56a6cdebd55882703d4b97fb9ba65809 (diff)
downloadandroid_packages_apps_Snap-60a285627fcce6fe2d677efde4ce924946a2ec25.zip
android_packages_apps_Snap-60a285627fcce6fe2d677efde4ce924946a2ec25.tar.gz
android_packages_apps_Snap-60a285627fcce6fe2d677efde4ce924946a2ec25.tar.bz2
Snap: Allow quickreader to work with secure device
* Mimic the behaviour from CameraActivity to allow using the quickreader activity with locked screen * Pass the value if mSecureCamera as SECURE_CAMERA_EXTRA flag to get knowledge if the WindowManager flags have to be modified * Also tested: Scanning an url doesn't allow bypassing the lockscreen, so it's only the reader itself which will work with a locked device Change-Id: Ia9da7b712f5e5aab32a49d272e3d42651dee412d
Diffstat (limited to 'quickReader')
-rw-r--r--quickReader/src/org/lineageos/quickreader/ScannerActivity.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/quickReader/src/org/lineageos/quickreader/ScannerActivity.java b/quickReader/src/org/lineageos/quickreader/ScannerActivity.java
index fb583a2..7ee6be2 100644
--- a/quickReader/src/org/lineageos/quickreader/ScannerActivity.java
+++ b/quickReader/src/org/lineageos/quickreader/ScannerActivity.java
@@ -27,6 +27,8 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
+import android.view.Window;
+import android.view.WindowManager;
import android.webkit.URLUtil;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -54,6 +56,8 @@ public class ScannerActivity extends Activity implements ZXingScannerView.Result
"(.*)"
);
+ public static final String SECURE_CAMERA_EXTRA = "secure_camera";
+
private static ScannerIntentHelper sHelper;
private AnalyzeTask task;
@@ -69,6 +73,15 @@ public class ScannerActivity extends Activity implements ZXingScannerView.Result
protected void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
+ Intent intent = getIntent();
+ if (intent.getBooleanExtra(SECURE_CAMERA_EXTRA, false)) {
+ // Change the window flags so that secure camera can show when locked
+ Window win = getWindow();
+ WindowManager.LayoutParams params = win.getAttributes();
+ params.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
+ win.setAttributes(params);
+ }
+
setContentView(R.layout.activity_scanner);
mScanView = (ZXingScannerView) findViewById(R.id.scanner_view);