diff options
author | Michael W <baddaemon87@gmail.com> | 2020-04-09 13:40:42 +0200 |
---|---|---|
committer | Bruno Martins <bgcngm@gmail.com> | 2020-04-15 23:27:55 +0200 |
commit | a0a120be985bc1fe8c77e01feccb9f8b61ac5722 (patch) | |
tree | aeafa19a090caa5221ac335496e6cbd8ac363e32 /quickReader/src | |
parent | dde443e3b6188a7493f7b754bd419c06876d284c (diff) | |
download | android_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/src')
-rw-r--r-- | quickReader/src/org/lineageos/quickreader/ScannerActivity.java | 22 |
1 files changed, 18 insertions, 4 deletions
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 +} |