summaryrefslogtreecommitdiffstats
path: root/quickReader
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2020-04-09 13:40:42 +0200
committerBruno Martins <bgcngm@gmail.com>2020-04-15 23:27:55 +0200
commita0a120be985bc1fe8c77e01feccb9f8b61ac5722 (patch)
treeaeafa19a090caa5221ac335496e6cbd8ac363e32 /quickReader
parentdde443e3b6188a7493f7b754bd419c06876d284c (diff)
downloadandroid_packages_apps_Snap-a0a120be985bc1fe8c77e01feccb9f8b61ac5722.tar.gz
android_packages_apps_Snap-a0a120be985bc1fe8c77e01feccb9f8b61ac5722.tar.bz2
android_packages_apps_Snap-a0a120be985bc1fe8c77e01feccb9f8b61ac5722.zip
Snap: quickreader: Don't allow insecure actions
* In order to not allow any app to start in the background or website to be opened, do not allow click actions on quickreader when the device is locked Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/1747 Change-Id: I75486dfb4468405356172c6da51abfca733ec541
Diffstat (limited to 'quickReader')
-rw-r--r--quickReader/res/values/strings.xml3
-rw-r--r--quickReader/src/org/lineageos/quickreader/ScannerActivity.java22
2 files changed, 21 insertions, 4 deletions
diff --git a/quickReader/res/values/strings.xml b/quickReader/res/values/strings.xml
index 897483115..8633b7c73 100644
--- a/quickReader/res/values/strings.xml
+++ b/quickReader/res/values/strings.xml
@@ -47,4 +47,7 @@
<string name="quick_reader_share_title">Share with\u2026</string>
<!-- QuickReader: toast shown when the scanned text has been copied to the clipboard -->
<string name="quick_reader_copied_message">Copied to clipboard</string>
+
+ <!-- QuickReader: Action is only allowed when performed unlocked -->
+ <string name="quick_reader_only_unlocked">This action can only be performed with the device unlocked</string>
</resources>
diff --git a/quickReader/src/org/lineageos/quickreader/ScannerActivity.java b/quickReader/src/org/lineageos/quickreader/ScannerActivity.java
index 7ee6be2c6..e07cd584c 100644
--- a/quickReader/src/org/lineageos/quickreader/ScannerActivity.java
+++ b/quickReader/src/org/lineageos/quickreader/ScannerActivity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The LineageOS Project
+ * Copyright (C) 2019-2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,8 @@ public class ScannerActivity extends Activity implements ZXingScannerView.Result
super.onCreate(savedInstance);
Intent intent = getIntent();
- if (intent.getBooleanExtra(SECURE_CAMERA_EXTRA, false)) {
+ final boolean isSecure = intent.getBooleanExtra(SECURE_CAMERA_EXTRA, false);
+ if (isSecure) {
// Change the window flags so that secure camera can show when locked
Window win = getWindow();
WindowManager.LayoutParams params = win.getAttributes();
@@ -90,7 +91,13 @@ public class ScannerActivity extends Activity implements ZXingScannerView.Result
mFlashIcon = (ImageView) findViewById(R.id.action_flash);
ImageView closeIcon = (ImageView) findViewById(R.id.action_close);
- mIdentifyLayout.setOnClickListener(v -> sHelper.run(this));
+ mIdentifyLayout.setOnClickListener(v -> {
+ if (isSecure) {
+ showClickErrorDialog();
+ } else {
+ sHelper.run(this);
+ }
+ });
mFlashIcon.setOnClickListener(v -> toggleFlash());
closeIcon.setOnClickListener(v -> finish());
@@ -208,6 +215,13 @@ public class ScannerActivity extends Activity implements ZXingScannerView.Result
.show();
}
+ private void showClickErrorDialog() {
+ new AlertDialog.Builder(this)
+ .setMessage(R.string.quick_reader_only_unlocked)
+ .setPositiveButton(R.string.quick_reader_action_dismiss, null)
+ .show();
+ }
+
private void postAnalyze(int result) {
if (result == 0 || !sHelper.isValid()) {
return;
@@ -331,4 +345,4 @@ public class ScannerActivity extends Activity implements ZXingScannerView.Result
return null;
}
}
-} \ No newline at end of file
+}