From b5ed17fb8eb81159b18fe1e6867ab439eded550e Mon Sep 17 00:00:00 2001 From: Braden Farmer Date: Wed, 11 Sep 2024 22:45:36 -0600 Subject: [PATCH] No need for CompatUtils to determine whether to use invisible activity hacks --- .../compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java | 4 ---- .../compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java | 4 ---- .../compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java | 4 ---- .../compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java | 4 ---- .../compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java | 4 ---- .../main/java/com/farmerbb/taskbar/activity/MainActivity.java | 2 +- app/src/main/java/com/farmerbb/taskbar/util/U.java | 2 +- 7 files changed, 2 insertions(+), 22 deletions(-) diff --git a/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java index 307c48c4..0c7ba784 100644 --- a/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-28/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -26,8 +26,4 @@ public static boolean isImeVisible(View view) { } public static void grantNotificationPermissionIfNeeded(Activity activity) {} - - public static boolean needsInvisibleActivityHacks() { - return true; - } } \ No newline at end of file diff --git a/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java index 307c48c4..0c7ba784 100644 --- a/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-29/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -26,8 +26,4 @@ public static boolean isImeVisible(View view) { } public static void grantNotificationPermissionIfNeeded(Activity activity) {} - - public static boolean needsInvisibleActivityHacks() { - return true; - } } \ No newline at end of file diff --git a/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java index bf58f014..31330f4b 100644 --- a/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-30/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -33,8 +33,4 @@ public static boolean isImeVisible(View view) { } public static void grantNotificationPermissionIfNeeded(Activity activity) {} - - public static boolean needsInvisibleActivityHacks() { - return true; - } } \ No newline at end of file diff --git a/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java index bf58f014..31330f4b 100644 --- a/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-31/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -33,8 +33,4 @@ public static boolean isImeVisible(View view) { } public static void grantNotificationPermissionIfNeeded(Activity activity) {} - - public static boolean needsInvisibleActivityHacks() { - return true; - } } \ No newline at end of file diff --git a/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java b/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java index c2bac9fb..3dcee136 100644 --- a/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java +++ b/app/src/compat-34/java/com/farmerbb/taskbar/util/CompatUtils.java @@ -41,8 +41,4 @@ public static void grantNotificationPermissionIfNeeded(Activity activity) { activity.requestPermissions(new String[]{Manifest.permission.POST_NOTIFICATIONS}, 42); } } - - public static boolean needsInvisibleActivityHacks() { - return Build.VERSION.SDK_INT < Build.VERSION_CODES.S_V2; - } } \ No newline at end of file diff --git a/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java b/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java index 5428cc86..4ec4d5f5 100644 --- a/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java +++ b/app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java @@ -394,7 +394,7 @@ private void startTaskbarService() { if(U.hasFreeformSupport(this) && U.isFreeformModeEnabled(this) && !FreeformHackHelper.getInstance().isFreeformHackActive() - && CompatUtils.needsInvisibleActivityHacks()) { + && U.getCurrentApiVersion() < 32.0f) { U.startFreeformHack(this, true); } diff --git a/app/src/main/java/com/farmerbb/taskbar/util/U.java b/app/src/main/java/com/farmerbb/taskbar/util/U.java index 82e9b690..86ceec33 100644 --- a/app/src/main/java/com/farmerbb/taskbar/util/U.java +++ b/app/src/main/java/com/farmerbb/taskbar/util/U.java @@ -606,7 +606,7 @@ private static void prepareToStartActivity(Context context, boolean openInNewWin && shouldLaunchTouchAbsorber(context)) { startTouchAbsorberActivity(context); newHandler().postDelayed(runnable, 100); - } else if(openInNewWindow && CompatUtils.needsInvisibleActivityHacks()) { + } else if(openInNewWindow && getCurrentApiVersion() < 32.0f) { Intent intent = new Intent(context, DummyActivity.class); intent.putExtra("finish_on_pause", true); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK