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>
This commit is contained in:
Harsh Shandilya 2019-09-27 13:07:43 +05:30
parent 1a6a8789c1
commit 1ee1368e18

View File

@ -53,8 +53,17 @@ public class MainActivity extends BaseActivity
setSelectedTunnel(null); setSelectedTunnel(null);
return; return;
} }
if (isTaskRoot()) {
// @{link TunnelDetailFragment} is in foreground
if (backStackEntries == 2) {
getSupportFragmentManager().popBackStack();
} else if (backStackEntries == 0) {
finishAfterTransition();
}
} else {
super.onBackPressed(); super.onBackPressed();
} }
}
@Override public void onBackStackChanged() { @Override public void onBackStackChanged() {
if (actionBar == null) if (actionBar == null)