This is slightly out of sync with the version in AOSP (32.1.2) but the
diff is minimal, and we need 32.1.3 here as it contains the fix for
https://github.com/google/guava/issues/6657.
PiperOrigin-RevId: 578572893
This picks up a fix to ensure Android Studio puts the `@OptIn`
annotation in the correct place:
https://issuetracker.google.com/251172715
This also introduces a transitive dependency from `media3-common` on
the Kotlin standard library, so this CL also includes some updates to
the dev guide to document how apps can avoid including this dep if
they want.
PiperOrigin-RevId: 558821673
The main demo app was still targeting API 29 to avoid scoped storage
restrictions. It is now updated to 34 (like the rest of the demo apps)
and handles scoped storage as it should handle it.
More specifically:
- We need to request READ_MEDIA_... permissions instead of
READ_EXTERNAL_STORAGE from API33.
- The legacy scoped storage opt-out can be removed
- READ_MEDIA_... permissions don't allow arbitrary file access
if the file doesn't end in a typical media file extension, so
this change adds a remark on the guide page to place samples
in the app-specific directory.
- We also don't have to request permissions for the app-specific
directories.
- Custom json files can't be placed in arbitray local locations
because they don't end in a media file extension, as there is
no way we can request a permission to load them. This means we
can remove the storage request logic in SampleChooserActivity.
Issue: google/ExoPlayer#6045
PiperOrigin-RevId: 549252474
This helps to highlight and document new requirements for apps,
e.g. to add the FOREGROUND_SERVICE_MEDIA_PLAYBACK permission for
background playback.
Issue: google/ExoPlayer#11239
PiperOrigin-RevId: 548666056
FakeClock currently doesn't work well with Espresso and Compose UI
tests because view interactions in both frameworks intentionally idle
the main looper to handle pending UI effects. However, this also
advances playback progress even though we want to deterministically
trigger progress from the test itself.
To solve this problem, we can detect the idling Robolectric call and
postpone any further updates until we leave this state.
PiperOrigin-RevId: 541831050
The existing NullableType has been deprecated 5 years ago and causes
crashes in Kotlin apps because Kotlin doesn't recognize this annotation
as a nullable type annotation.
While we can't align on a single @Nullable annotation yet, we can at
least replace this one by JSR305's @Nonnull(MAYBE) as it fulfils all
requirements, including full Kotlin compatiblity. To avoid the
cumbersome name, we can redefine it as our own @NullableType
annotation. (We can't use @Nullable to avoid name clashes with the main
@Nullable annotation from AndroidX)
Issue: google/ExoPlayer#6792
PiperOrigin-RevId: 540497469
We originally upgraded to 4.10 in 889f435a49
However I saw `ShadowActivityThread.reset: ActivityThread not set`
errors when running any Robolectric test, so I downgraded to 4.8.1:
85e449cd87
Nobody else on the team was seeing the same error with 4.10, so it was
something different about my local setup.
The error was actually masking a different problem (see discussion:
https://github.com/robolectric/robolectric/issues/8160). Upgrading to
4.10.1 made the underlying error clear:
```
java.lang.UnsatisfiedLinkError: /tmp/libconscrypt_openjdk_jni-linux-x86_6416831044223480000.so: libstdc++.so.6: cannot open shared object file: No such file or directory
```
This was then fixed by changing my 'Gradle JDK' value in Android Studio
from a JDK 11-based value to a 17-based one. If others see the same
`UnsatisfiedLinkError` when running the tests locally they should check
their Gradle JDK setting in Android Studio.
However there was **another** problem with 4.10 that **did** affect
everyone: some tests in `ExoPlayerTest` would fail with time outs or
assertion failures related to clock advancement.
After some investigation in https://github.com/robolectric/robolectric/issues/8187
it turns out this is because there's lots of unrelease `Player`
instances in `ExoPlayerTest`, which keep lots of active `HandlerThreads`
that then have to all be woken up by Robolectric. 4.10.3 has a fix that
mitigates this, so we can upgrade immediately - but we should also
release all the `Player` instances in `ExoPlayerTest` (it might speed
up test execution too).
PiperOrigin-RevId: 533068395
This partially reverts 889f435a49
because our tests fail with 4.10 with an error like:
```
ShadowActivityThread.reset: ActivityThread not set
java.lang.NullPointerException: ShadowActivityThread.reset: ActivityThread not set
at java.base/java.util.Objects.requireNonNull(Objects.java:246)
at org.robolectric.shadows.ShadowActivityThread.reset(ShadowActivityThread.java:284)
at org.robolectric.Shadows.reset(Shadows.java:2665)
at org.robolectric.android.internal.AndroidTestEnvironment.resetState(AndroidTestEnvironment.java:657)
at org.robolectric.RobolectricTestRunner.lambda$finallyAfterTest$0(RobolectricTestRunner.java:370)
at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:86)
at org.robolectric.RobolectricTestRunner.finallyAfterTest(RobolectricTestRunner.java:368)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:298)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:99)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:830)
```
It looks like the code throwing this exception is new in Robolectric
4.10:
65654a76ce
PiperOrigin-RevId: 527290033
The only dependencies that are not updated are the ones that need
to be kept in sync with other system (like Android source tree) or
would require a Kotlin dependency in common or exoplayer modules.
As a side effect, some demo apps now need a Kotlin config and some
additional modules require desugaring/multidex logic. To simplify
the setup, the desugaring and multidex steps are added to the common
config.
PiperOrigin-RevId: 527243950
Adds root extras and metadata extras to MockMediaLibraryService and MockMediaBrowserCompatService and completed test cases for asserting
interoperability with a media1 or Media3 browser.
PiperOrigin-RevId: 480854842