diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2019-09-27 13:07:43 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2019-09-27 13:18:27 +0530 |
commit | 1ee1368e18f5264704cbe58ad36408394c867ab9 (patch) | |
tree | 4ebf259609e8c1d8b03dc55f99d7448ae09fdd50 /app | |
parent | 1a6a8789c1915cd578b852bb31f05fa4773f08fe (diff) |
Fix activity leak on Android Q
This workaround was discussed at https://twitter.com/Piwai/status/1169274622614704129 after
Google had closed the issuetracker with a WONTFIX at https://issuetracker.google.com/issues/139738913.
The situation has since changed with Google promising a fix on October's ASB but since we can't really
know, patch this ourselves for the timebeing.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/wireguard/android/activity/MainActivity.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/activity/MainActivity.java b/app/src/main/java/com/wireguard/android/activity/MainActivity.java index ab9a4f8a..0a1dc0be 100644 --- a/app/src/main/java/com/wireguard/android/activity/MainActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/MainActivity.java @@ -53,7 +53,16 @@ public class MainActivity extends BaseActivity setSelectedTunnel(null); return; } - super.onBackPressed(); + if (isTaskRoot()) { + // @{link TunnelDetailFragment} is in foreground + if (backStackEntries == 2) { + getSupportFragmentManager().popBackStack(); + } else if (backStackEntries == 0) { + finishAfterTransition(); + } + } else { + super.onBackPressed(); + } } @Override public void onBackStackChanged() { |