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

Commit 5cbdad41 authored by Wei Jia's avatar Wei Jia
Browse files

MediaPlayer2: skip consecutive seeks except last one

Test: cts
Bug: 112549021
Change-Id: I2a899f399956e14ffcde886156da1347c500d4b0
parent 1929a72d
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -3620,6 +3620,17 @@ public final class MediaPlayer2Impl extends MediaPlayer2 {
                        && getState() == PLAYER_STATE_ERROR) {
                        && getState() == PLAYER_STATE_ERROR) {
                    status = CALL_STATUS_INVALID_OPERATION;
                    status = CALL_STATUS_INVALID_OPERATION;
                } else {
                } else {
                    if (mMediaCallType == CALL_COMPLETED_SEEK_TO) {
                        synchronized (mTaskLock) {
                            if (!mPendingTasks.isEmpty()) {
                                Task nextTask = mPendingTasks.get(0);
                                if (nextTask.mMediaCallType == mMediaCallType) {
                                    throw new CommandSkippedException(
                                            "consecutive seekTo is skipped except last one");
                                }
                            }
                        }
                    }
                    process();
                    process();
                }
                }
            } catch (IllegalStateException e) {
            } catch (IllegalStateException e) {