Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ebc1e3f authored by Jaewan Kim's avatar Jaewan Kim Committed by Dongwon Kang
Browse files

PIP: Show recents again when PIP menu is closed

Framework enforces that an app cannot go back to Recents.
So launches the Recents again for the PIP menu.

Change-Id: I7526edfe7dd38c7eb1befe6a8b2b5f4ea30aa84e
parent 8326e38b
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import android.widget.ImageView;
import android.widget.TextView;

import com.android.systemui.R;
import com.android.systemui.SystemUI;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.recents.Recents;

import static android.content.pm.PackageManager.FEATURE_LEANBACK;
import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;
@@ -214,4 +217,18 @@ public class PipMenuActivity extends Activity implements PipManager.Listener {
        mPipManager.suspendPipResizing(
                PipManager.SUSPEND_PIP_RESIZE_REASON_WAITING_FOR_MENU_ACTIVITY_FINISH);
    }

    @Override
    public void finish() {
        super.finish();
        if (mPipManager.isRecentsShown()) {
            SystemUI[] services = ((SystemUIApplication) getApplication()).getServices();
            for (int i = services.length - 1; i >= 0; i--) {
                if (services[i] instanceof Recents) {
                    ((Recents) services[i]).showRecents(false, null);
                    break;
                }
            }
        }
    }
}