From a1803fe7473152834c1e0f21c52d6025705f28d8 Mon Sep 17 00:00:00 2001 From: ConcurrentCrab Date: Wed, 6 Dec 2023 00:03:17 +0530 Subject: [PATCH 1/2] AndroidManifest.xml: put PROCESS_TEXT in an activity-alias --- app/src/main/AndroidManifest.xml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 864198699e..f914eff576 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -192,7 +192,6 @@ - @@ -1080,6 +1079,22 @@ + + + + + + + + + + + From 4f6a7e9cc93cc781cd01ad9233425e92f5c8245d Mon Sep 17 00:00:00 2001 From: ConcurrentCrab Date: Wed, 6 Dec 2023 00:00:06 +0530 Subject: [PATCH 2/2] PROCESS_TEXT: link activity state to "open special documents" settings It's now disabled by default. --- app/src/main/AndroidManifest.xml | 2 +- .../net/gsantner/markor/util/MarkorContextUtils.java | 1 + .../main/java/net/gsantner/opoc/util/GsContextUtils.java | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f914eff576..1bd5ac72fd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1085,7 +1085,7 @@ android:label="@string/app_name" android:exported="true" android:targetActivity=".activity.DocumentActivity" - android:enabled="true"> + android:enabled="false"> diff --git a/app/src/main/java/net/gsantner/markor/util/MarkorContextUtils.java b/app/src/main/java/net/gsantner/markor/util/MarkorContextUtils.java index f7386f52a1..c9fd835824 100644 --- a/app/src/main/java/net/gsantner/markor/util/MarkorContextUtils.java +++ b/app/src/main/java/net/gsantner/markor/util/MarkorContextUtils.java @@ -42,6 +42,7 @@ public T applySpecialLaunchersVisibility(final Contex setLauncherActivityEnabled(context, OpenEditorQuickNoteActivity.class, extraLaunchersEnabled); setLauncherActivityEnabled(context, OpenEditorTodoActivity.class, extraLaunchersEnabled); setLauncherActivityEnabled(context, OpenShareIntoActivity.class, extraLaunchersEnabled); + setLauncherActivityEnabledFromString(context, "net.gsantner.markor.AliasDocumentProcessText", extraLaunchersEnabled); return thisp(); } diff --git a/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java b/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java index 57b2255193..134bbc84ce 100644 --- a/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java +++ b/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java @@ -1148,6 +1148,15 @@ public T setLauncherActivityEnabled(final Context con return thisp(); } + public T setLauncherActivityEnabledFromString(final Context context, String activityClass, boolean enable) { + try { + ComponentName component = new ComponentName(context, activityClass); + context.getPackageManager().setComponentEnabledSetting(component, enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); + } catch (Exception ignored) { + } + return thisp(); + } + /** * Try to create a new desktop shortcut on the launcher. Add permissions: *