From 3acb5d449ed42e57b864cced9a7950ade3ab17bf Mon Sep 17 00:00:00 2001 From: Alessandro Caputo Date: Sun, 25 Aug 2019 10:50:05 +0200 Subject: [PATCH 1/3] Set intent flags when asking for permissions Fixes #285 and #286 --- app/src/main/java/com/termux/api/FingerprintAPI.java | 1 + app/src/main/java/com/termux/api/StorageGetAPI.java | 1 + app/src/main/java/com/termux/api/TermuxApiReceiver.java | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/termux/api/FingerprintAPI.java b/app/src/main/java/com/termux/api/FingerprintAPI.java index ab0cc2c..8789663 100644 --- a/app/src/main/java/com/termux/api/FingerprintAPI.java +++ b/app/src/main/java/com/termux/api/FingerprintAPI.java @@ -77,6 +77,7 @@ public class FingerprintAPI { if (validateFingerprintSensor(context, fingerprintManager)) { Intent fingerprintIntent = new Intent(context, FingerprintActivity.class); fingerprintIntent.putExtras(intent.getExtras()); + fingerprintIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(fingerprintIntent); } else { postFingerprintResult(context, intent, fingerprintResult); diff --git a/app/src/main/java/com/termux/api/StorageGetAPI.java b/app/src/main/java/com/termux/api/StorageGetAPI.java index b44f665..2cd7699 100644 --- a/app/src/main/java/com/termux/api/StorageGetAPI.java +++ b/app/src/main/java/com/termux/api/StorageGetAPI.java @@ -28,6 +28,7 @@ public class StorageGetAPI { Intent intent1 = new Intent(context, StorageActivity.class); intent1.putExtra(FILE_EXTRA, fileExtra); + intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent1); }); } diff --git a/app/src/main/java/com/termux/api/TermuxApiReceiver.java b/app/src/main/java/com/termux/api/TermuxApiReceiver.java index 83cd19c..f790bee 100644 --- a/app/src/main/java/com/termux/api/TermuxApiReceiver.java +++ b/app/src/main/java/com/termux/api/TermuxApiReceiver.java @@ -119,7 +119,7 @@ public class TermuxApiReceiver extends BroadcastReceiver { final boolean NotificationServiceEnabled = flat != null && flat.contains(cn.flattenToString()); if (!NotificationServiceEnabled) { Toast.makeText(context,"Please give Termux:API Notification Access", Toast.LENGTH_LONG).show(); - context.startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS")); + context.startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } else { NotificationListAPI.onReceive(this, context, intent); } From ffa002d85f5adabc22b96a43a1f463e28d842dbb Mon Sep 17 00:00:00 2001 From: Alessandro Caputo Date: Sun, 25 Aug 2019 20:39:33 +0200 Subject: [PATCH 2/3] NotificationAPI: set default alertOnce to false Because the default should be false, and in termux-api-package the --alert-once flag can be used to set it to true. Thanks to AgentConDier for spotting this. Fixes termux/termux-api-package#83 --- app/src/main/java/com/termux/api/NotificationAPI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/termux/api/NotificationAPI.java b/app/src/main/java/com/termux/api/NotificationAPI.java index b05bb92..55fb0c4 100644 --- a/app/src/main/java/com/termux/api/NotificationAPI.java +++ b/app/src/main/java/com/termux/api/NotificationAPI.java @@ -77,7 +77,7 @@ public class NotificationAPI { long[] vibratePattern = intent.getLongArrayExtra("vibrate"); boolean useSound = intent.getBooleanExtra("sound", false); boolean ongoing = intent.getBooleanExtra("ongoing", false); - boolean alertOnce = intent.getBooleanExtra("alert-once", true); + boolean alertOnce = intent.getBooleanExtra("alert-once", false); String actionExtra = intent.getStringExtra("action"); From 66ac3cd40d2fbc8f479160ff04fbbcace1166fdc Mon Sep 17 00:00:00 2001 From: Alessandro Caputo Date: Sun, 25 Aug 2019 21:38:46 +0200 Subject: [PATCH 3/3] Bump version to 0.36 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 0c8b3b1..5bba059 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,7 +7,7 @@ android { applicationId "com.termux.api" minSdkVersion 21 targetSdkVersion 28 - versionCode 35 + versionCode 36 versionName "0.${versionCode}" }