Opt uncontroversial bits of the main demo app into unstable APIs
None of these components/features are planned to be part of the initial stable API, so these suppressions will need to be in place when we enable the warnings. PiperOrigin-RevId: 437256731
This commit is contained in:
parent
92eb09fa6f
commit
a5330d43d4
@ -20,6 +20,7 @@ import static androidx.media3.demo.main.DemoUtil.DOWNLOAD_NOTIFICATION_CHANNEL_I
|
|||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.OptIn;
|
||||||
import androidx.media3.common.util.NotificationUtil;
|
import androidx.media3.common.util.NotificationUtil;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
import androidx.media3.exoplayer.offline.Download;
|
import androidx.media3.exoplayer.offline.Download;
|
||||||
@ -32,6 +33,7 @@ import androidx.media3.exoplayer.scheduler.Scheduler;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** A service for downloading media. */
|
/** A service for downloading media. */
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
public class DemoDownloadService extends DownloadService {
|
public class DemoDownloadService extends DownloadService {
|
||||||
|
|
||||||
private static final int JOB_ID = 1;
|
private static final int JOB_ID = 1;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package androidx.media3.demo.main;
|
package androidx.media3.demo.main;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import androidx.annotation.OptIn;
|
||||||
import androidx.media3.database.DatabaseProvider;
|
import androidx.media3.database.DatabaseProvider;
|
||||||
import androidx.media3.database.StandaloneDatabaseProvider;
|
import androidx.media3.database.StandaloneDatabaseProvider;
|
||||||
import androidx.media3.datasource.DataSource;
|
import androidx.media3.datasource.DataSource;
|
||||||
@ -71,6 +72,7 @@ public final class DemoUtil {
|
|||||||
return BuildConfig.USE_DECODER_EXTENSIONS;
|
return BuildConfig.USE_DECODER_EXTENSIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
public static RenderersFactory buildRenderersFactory(
|
public static RenderersFactory buildRenderersFactory(
|
||||||
Context context, boolean preferExtensionRenderer) {
|
Context context, boolean preferExtensionRenderer) {
|
||||||
@DefaultRenderersFactory.ExtensionRendererMode
|
@DefaultRenderersFactory.ExtensionRendererMode
|
||||||
@ -116,6 +118,7 @@ public final class DemoUtil {
|
|||||||
return dataSourceFactory;
|
return dataSourceFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
public static synchronized DownloadNotificationHelper getDownloadNotificationHelper(
|
public static synchronized DownloadNotificationHelper getDownloadNotificationHelper(
|
||||||
Context context) {
|
Context context) {
|
||||||
if (downloadNotificationHelper == null) {
|
if (downloadNotificationHelper == null) {
|
||||||
@ -135,6 +138,7 @@ public final class DemoUtil {
|
|||||||
return downloadTracker;
|
return downloadTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
private static synchronized Cache getDownloadCache(Context context) {
|
private static synchronized Cache getDownloadCache(Context context) {
|
||||||
if (downloadCache == null) {
|
if (downloadCache == null) {
|
||||||
File downloadContentDirectory =
|
File downloadContentDirectory =
|
||||||
@ -146,6 +150,7 @@ public final class DemoUtil {
|
|||||||
return downloadCache;
|
return downloadCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
private static synchronized void ensureDownloadManagerInitialized(Context context) {
|
private static synchronized void ensureDownloadManagerInitialized(Context context) {
|
||||||
if (downloadManager == null) {
|
if (downloadManager == null) {
|
||||||
downloadManager =
|
downloadManager =
|
||||||
@ -160,6 +165,7 @@ public final class DemoUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
private static synchronized DatabaseProvider getDatabaseProvider(Context context) {
|
private static synchronized DatabaseProvider getDatabaseProvider(Context context) {
|
||||||
if (databaseProvider == null) {
|
if (databaseProvider == null) {
|
||||||
databaseProvider = new StandaloneDatabaseProvider(context);
|
databaseProvider = new StandaloneDatabaseProvider(context);
|
||||||
@ -177,6 +183,7 @@ public final class DemoUtil {
|
|||||||
return downloadDirectory;
|
return downloadDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
private static CacheDataSource.Factory buildReadOnlyCacheDataSource(
|
private static CacheDataSource.Factory buildReadOnlyCacheDataSource(
|
||||||
DataSource.Factory upstreamFactory, Cache cache) {
|
DataSource.Factory upstreamFactory, Cache cache) {
|
||||||
return new CacheDataSource.Factory()
|
return new CacheDataSource.Factory()
|
||||||
|
@ -23,6 +23,7 @@ import android.net.Uri;
|
|||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.OptIn;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.media3.common.DrmInitData;
|
import androidx.media3.common.DrmInitData;
|
||||||
@ -53,6 +54,7 @@ import java.util.HashMap;
|
|||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
/** Tracks media that has been downloaded. */
|
/** Tracks media that has been downloaded. */
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
public class DownloadTracker {
|
public class DownloadTracker {
|
||||||
|
|
||||||
/** Listens for changes in the tracked downloads. */
|
/** Listens for changes in the tracked downloads. */
|
||||||
|
@ -41,6 +41,7 @@ import android.widget.ImageButton;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.OptIn;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
import androidx.media3.common.MediaItem.ClippingConfiguration;
|
import androidx.media3.common.MediaItem.ClippingConfiguration;
|
||||||
@ -120,6 +121,7 @@ public class SampleChooserActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Start the download service if it should be running but it's not currently. */
|
/** Start the download service if it should be running but it's not currently. */
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
private void startDownloadService() {
|
private void startDownloadService() {
|
||||||
// Starting the service in the foreground causes notification flicker if there is no scheduled
|
// Starting the service in the foreground causes notification flicker if there is no scheduled
|
||||||
// action. Starting it in the background throws an exception if the app is in the background too
|
// action. Starting it in the background throws an exception if the app is in the background too
|
||||||
@ -274,6 +276,7 @@ public class SampleChooserActivity extends AppCompatActivity
|
|||||||
|
|
||||||
private boolean sawError;
|
private boolean sawError;
|
||||||
|
|
||||||
|
@OptIn(markerClass = androidx.media3.common.util.UnstableApi.class)
|
||||||
@Override
|
@Override
|
||||||
protected List<PlaylistGroup> doInBackground(String... uris) {
|
protected List<PlaylistGroup> doInBackground(String... uris) {
|
||||||
List<PlaylistGroup> result = new ArrayList<>();
|
List<PlaylistGroup> result = new ArrayList<>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user