diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index 5c7b9f7b6c..206dda73aa 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -1066,16 +1066,6 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc performBack(); } - @Override - public boolean shouldUpRecreateTask(Intent targetIntent) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - ComponentName cn = targetIntent.getComponent(); - if (cn != null && BuildConfig.APPLICATION_ID.equals(cn.getPackageName())) - return false; - } - return super.shouldUpRecreateTask(targetIntent); - } - Handler getMainHandler() { return ApplicationEx.getMainHandler(); } diff --git a/app/src/main/java/eu/faircode/email/ActivityCompose.java b/app/src/main/java/eu/faircode/email/ActivityCompose.java index de2103a8f1..7a2f6e5aec 100644 --- a/app/src/main/java/eu/faircode/email/ActivityCompose.java +++ b/app/src/main/java/eu/faircode/email/ActivityCompose.java @@ -21,6 +21,7 @@ package eu.faircode.email; import android.app.NotificationManager; import android.content.ClipData; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -92,10 +93,16 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB startActivity(setup); } else if (!shared && !widget) { Intent parent = getParentActivityIntent(); - Log.i("Compose exit parent=" + parent + - " recreate=" + (parent == null ? null : shouldUpRecreateTask(parent))); - if (parent != null) - if (shouldUpRecreateTask(parent)) + if (parent != null) { + boolean recreate; + ComponentName cn = parent.getComponent(); + if (cn != null && BuildConfig.APPLICATION_ID.equals(cn.getPackageName())) + recreate = false; + else + recreate = shouldUpRecreateTask(parent); + + Log.i("Compose exit parent=" + parent + " recreate=" + recreate); + if (recreate) TaskStackBuilder.create(this) .addNextIntentWithParentStack(parent) .startActivities(); @@ -103,6 +110,7 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB parent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(parent); } + } } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);