Skip to content

Commit de7057a

Browse files
devlearnerStypox
authored andcommitted
Skip REORDER_TO_FRONT trick which doesn't seem to work on newer Androids
probably due to background restrictions on Android 10+
1 parent 585bfff commit de7057a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/src/main/java/org/schabi/newpipe/RouterActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.content.Intent;
1111
import android.content.SharedPreferences;
1212
import android.content.pm.PackageManager;
13+
import android.os.Build;
1314
import android.os.Bundle;
1415
import android.text.TextUtils;
1516
import android.view.ContextThemeWrapper;
@@ -776,7 +777,10 @@ private void runOnVisible(final ResultRunnable runnable) {
776777
}
777778
if (isPaused) {
778779
buffer.add(runnable);
779-
if (!getActivityContext().isChangingConfigurations()) {
780+
// this trick doesn't seem to work on Android 10+ (API 29)
781+
// which places restrictions on starting activities from the background
782+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
783+
&& !getActivityContext().isChangingConfigurations()) {
780784
// try to bring the activity back to front if minimised
781785
final Intent i = new Intent(getActivityContext(), RouterActivity.class);
782786
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

0 commit comments

Comments
 (0)