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

Commit dafae2b3 authored by pioush.kumar-IN009423's avatar pioush.kumar-IN009423
Browse files

Pause is getting scheduled 2 times



Problem: {
    1. open sony liv app.
    2. Play any video.
    3. Press home. Observe app is going to PIP
    4. Now in logs we can see. am_pause_activity 2 times.
    5. erforming pause of activity that is not resumed: {com.jio.jioplay.tv/com.jio.jioplay.tv.activities.HomeActivity}
       02-21 23:47:01.705 18593 18593 E ActivityThread: java.lang.RuntimeException: Performing pause of activity that is not resumed: {com.jio.jioplay.tv/com.jio.jioplay.tv.activities.HomeActivity}
       02-21 23:47:01.705 18593 18593 E ActivityThread: 	at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5342)
       02-21 23:47:01.705 18593 18593 E ActivityThread: 	at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5302)
       02-21 23:47:01.705 18593 18593 E ActivityThread: 	at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:53)
}

Solution: {
    1. Need to define a variable to signify is pauseScheduled. If it is scheduled then do not schedule again for PIP.
}

Bug: 271360298

Signed-off-by: default avatarpioush.kumar-IN009423 <pioush.kumar@oppo.com>
Change-Id: I033acec4e290875652196506f3c998d9f8c68f7f
Signed-off-by: default avatarpioush.kumar-IN009423 <pioush.kumar@oppo.com>
parent 5cd5d98e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -557,6 +557,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    Drawable mEnterpriseThumbnailDrawable;

    boolean mPauseSchedulePendingForPip = false;

    private void updateEnterpriseThumbnailDrawable(Context context) {
        DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
        mEnterpriseThumbnailDrawable = dpm.getResources().getDrawable(
+1 −1
Original line number Diff line number Diff line
@@ -3583,7 +3583,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                        null /* launchIntoPipHostActivity */, "enterPictureInPictureMode",
                        transition);
                // Continue the pausing process after entering pip.
                if (r.isState(PAUSING)) {
                if (r.isState(PAUSING) && r.mPauseSchedulePendingForPip) {
                    r.getTask().schedulePauseActivity(r, false /* userLeaving */,
                            false /* pauseImmediately */, true /* autoEnteringPip */, "auto-pip");
                }
+2 −0
Original line number Diff line number Diff line
@@ -1619,6 +1619,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {

        if (prev.attachedToProcess()) {
            if (shouldAutoPip) {
                prev.mPauseSchedulePendingForPip = true;
                boolean didAutoPip = mAtmService.enterPictureInPictureMode(
                        prev, prev.pictureInPictureArgs, false /* fromClient */);
                ProtoLog.d(WM_DEBUG_STATES, "Auto-PIP allowed, entering PIP mode "
@@ -1682,6 +1683,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
            boolean pauseImmediately, boolean autoEnteringPip, String reason) {
        ProtoLog.v(WM_DEBUG_STATES, "Enqueueing pending pause: %s", prev);
        try {
            prev.mPauseSchedulePendingForPip = false;
            EventLogTags.writeWmPauseActivity(prev.mUserId, System.identityHashCode(prev),
                    prev.shortComponentName, "userLeaving=" + userLeaving, reason);