mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Call callback future listeners on app handler
Calling maybeUpdateLegacyErrorState potentially creates a new legacy playback state which involves calling player methods. This change makes sure that the call sites of `maybeUpdateLegacyErrorState` are called on the app thread as enforced by the library. PiperOrigin-RevId: 476406282 (cherry picked from commit 74124f48ea838fcdb436726ba8337e82abc7552e)
This commit is contained in:
parent
e1b947ec92
commit
cc6c6aa62b
@ -18,6 +18,7 @@ package androidx.media3.session;
|
||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||
import static androidx.media3.common.util.Assertions.checkState;
|
||||
import static androidx.media3.common.util.Assertions.checkStateNotNull;
|
||||
import static androidx.media3.common.util.Util.postOrRun;
|
||||
import static androidx.media3.session.LibraryResult.RESULT_ERROR_SESSION_AUTHENTICATION_EXPIRED;
|
||||
import static androidx.media3.session.LibraryResult.RESULT_SUCCESS;
|
||||
import static androidx.media3.session.MediaConstants.ERROR_CODE_AUTHENTICATION_EXPIRED_COMPAT;
|
||||
@ -129,7 +130,7 @@ import java.util.concurrent.Future;
|
||||
maybeUpdateLegacyErrorState(result);
|
||||
}
|
||||
},
|
||||
MoreExecutors.directExecutor());
|
||||
(Runnable r) -> postOrRun(getApplicationHandler(), r));
|
||||
return future;
|
||||
}
|
||||
|
||||
@ -149,7 +150,7 @@ import java.util.concurrent.Future;
|
||||
verifyResultItems(result, pageSize);
|
||||
}
|
||||
},
|
||||
MoreExecutors.directExecutor());
|
||||
(Runnable r) -> postOrRun(getApplicationHandler(), r));
|
||||
return future;
|
||||
}
|
||||
|
||||
@ -164,7 +165,7 @@ import java.util.concurrent.Future;
|
||||
maybeUpdateLegacyErrorState(result);
|
||||
}
|
||||
},
|
||||
MoreExecutors.directExecutor());
|
||||
(Runnable r) -> postOrRun(getApplicationHandler(), r));
|
||||
return future;
|
||||
}
|
||||
|
||||
@ -226,7 +227,7 @@ import java.util.concurrent.Future;
|
||||
maybeUpdateLegacyErrorState(result);
|
||||
}
|
||||
},
|
||||
MoreExecutors.directExecutor());
|
||||
(Runnable r) -> postOrRun(getApplicationHandler(), r));
|
||||
return future;
|
||||
}
|
||||
|
||||
@ -246,7 +247,7 @@ import java.util.concurrent.Future;
|
||||
verifyResultItems(result, pageSize);
|
||||
}
|
||||
},
|
||||
MoreExecutors.directExecutor());
|
||||
(Runnable r) -> postOrRun(getApplicationHandler(), r));
|
||||
return future;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user