Skip to content

Commit

Permalink
Disable invisible activity hacks on Android 12L+
Browse files Browse the repository at this point in the history
  • Loading branch information
farmerbb committed Sep 12, 2024
1 parent 739ca46 commit f475e15
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ public static boolean isImeVisible(View view) {
}

public static void grantNotificationPermissionIfNeeded(Activity activity) {}

public static boolean needsInvisibleActivityHacks() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ public static boolean isImeVisible(View view) {
}

public static void grantNotificationPermissionIfNeeded(Activity activity) {}

public static boolean needsInvisibleActivityHacks() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ public static boolean isImeVisible(View view) {
}

public static void grantNotificationPermissionIfNeeded(Activity activity) {}

public static boolean needsInvisibleActivityHacks() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ public static boolean isImeVisible(View view) {
}

public static void grantNotificationPermissionIfNeeded(Activity activity) {}

public static boolean needsInvisibleActivityHacks() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ private void startTaskbarService() {

if(U.hasFreeformSupport(this)
&& U.isFreeformModeEnabled(this)
&& !FreeformHackHelper.getInstance().isFreeformHackActive()) {
&& !FreeformHackHelper.getInstance().isFreeformHackActive()
&& CompatUtils.needsInvisibleActivityHacks()) {
U.startFreeformHack(this, true);
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/farmerbb/taskbar/util/U.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ private static void prepareToStartActivity(Context context, boolean openInNewWin
&& shouldLaunchTouchAbsorber(context)) {
startTouchAbsorberActivity(context);
newHandler().postDelayed(runnable, 100);
} else if(openInNewWindow) {
} else if(openInNewWindow && CompatUtils.needsInvisibleActivityHacks()) {
Intent intent = new Intent(context, DummyActivity.class);
intent.putExtra("finish_on_pause", true);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
Expand Down

0 comments on commit f475e15

Please sign in to comment.