docs/doc/reference/com/google/android/exoplayer2/util/Util.html
Package com.google.android.exoplayer2.util
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classUtilextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Miscellaneous utility methods.
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static String | DEVICE |
Deprecated.
Like Build.DEVICE, but in a place where it can be conveniently overridden for local testing.
|
| static String | DEVICE_DEBUG_INFO |
Deprecated.
A concise description of the device that it can be useful to log for debugging purposes.
|
| static byte[] | EMPTY_BYTE_ARRAY |
Deprecated.
An empty byte array.
|
| static String | MANUFACTURER |
Deprecated.
Like Build.MANUFACTURER, but in a place where it can be conveniently overridden for local testing.
|
| static String | MODEL |
Deprecated.
Like Build.MODEL, but in a place where it can be conveniently overridden for local testing.
|
| static int | SDK_INT |
Deprecated.
Like Build.VERSION.SDK_INT, but in a place where it can be conveniently overridden for local testing.
|
All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| static long | addWithOverflowDefault(long x, long y, long overflowResult) |
Deprecated.
Returns the sum of two arguments, or a third argument if the result overflows.
|
| static boolean | areEqual(Object o1, Object o2) |
Deprecated.
Tests two objects for Object.equals(Object) equality, handling the case where one or both may be null.
|
| static int | binarySearchCeil(int[] array, int value, boolean inclusive, boolean stayInBounds) |
Deprecated.
Returns the index of the smallest element in array that is greater than (or optionally equal to) a specified value.
|
| static int | binarySearchCeil(long[] array, long value, boolean inclusive, boolean stayInBounds) |
Deprecated.
Returns the index of the smallest element in array that is greater than (or optionally equal to) a specified value.
|
| static <T extends Comparable<? super T>>int | binarySearchCeil(List<? extends Comparable<? super T>> list, T value, boolean inclusive, boolean stayInBounds) |
Deprecated.
Returns the index of the smallest element in list that is greater than (or optionally equal to) a specified value.
|
| static int | binarySearchFloor(int[] array, int value, boolean inclusive, boolean stayInBounds) |
Deprecated.
Returns the index of the largest element in array that is less than (or optionally equal to) a specified value.
|
| static int | binarySearchFloor(long[] array, long value, boolean inclusive, boolean stayInBounds) |
Deprecated.
Returns the index of the largest element in array that is less than (or optionally equal to) a specified value.
|
| static int | binarySearchFloor(LongArray longArray, long value, boolean inclusive, boolean stayInBounds) |
Deprecated.
Returns the index of the largest element in longArray that is less than (or optionally equal to) a specified value.
|
| static <T extends Comparable<? super T>>int | binarySearchFloor(List<? extends Comparable<? super T>> list, T value, boolean inclusive, boolean stayInBounds) |
Deprecated.
Returns the index of the largest element in list that is less than (or optionally equal to) a specified value.
|
| static <T> T | castNonNull(T value) |
Deprecated.
Casts a nullable variable to a non-null variable without runtime null check.
|
| static <T> T[] | castNonNullTypeArray(@NullableType T[] value) |
Deprecated.
Casts a nullable type array to a non-null type array without runtime null check.
|
| static int | ceilDivide(int numerator, int denominator) |
Deprecated.
Divides a numerator by a denominator, returning the ceiled result.
|
| static long | ceilDivide(long numerator, long denominator) |
Deprecated.
Divides a numerator by a denominator, returning the ceiled result.
|
| static boolean | checkCleartextTrafficPermitted(MediaItem... mediaItems) |
Deprecated.
Returns whether it may be possible to load the URIs of the given media items based on the network security policy's cleartext traffic permissions.
|
| static void | closeQuietly(Closeable closeable) |
Deprecated.
Closes a Closeable, suppressing any IOException that may occur.
|
| static int | compareLong(long left, long right) |
Deprecated.
Compares two long values and returns the same value as Long.compare(long, long).
|
| static float | constrainValue(float value, float min, float max) |
Deprecated.
Constrains a value to the specified bounds.
|
| static int | constrainValue(int value, int min, int max) |
Deprecated.
Constrains a value to the specified bounds.
|
| static long | constrainValue(long value, long min, long max) |
Deprecated.
Constrains a value to the specified bounds.
|
| static boolean | contains(@NullableType Object[] items, Object item) |
Deprecated.
Tests whether an items array contains an object equal to item, according to Object.equals(Object).
|
| static int | crc32(byte[] bytes, int start, int end, int initialValue) |
Deprecated.
Returns the result of updating a CRC-32 with the specified bytes in a "most significant bit first" order.
|
| static int | crc8(byte[] bytes, int start, int end, int initialValue) |
Deprecated.
Returns the result of updating a CRC-8 with the specified bytes in a "most significant bit first" order.
|
| static Handler | createHandler(Looper looper, @UnknownInitialization Handler.Callback callback) |
Deprecated.
Creates a Handler with the specified Handler.Callback on the specified Looper thread.
|
| static Handler | createHandlerForCurrentLooper() |
Deprecated.
Creates a Handler on the current Looper thread.
|
| static Handler | createHandlerForCurrentLooper(@UnknownInitialization Handler.Callback callback) |
Deprecated.
Creates a Handler with the specified Handler.Callback on the current Looper thread.
|
| static Handler | createHandlerForCurrentOrMainLooper() |
Deprecated.
Creates a Handler on the current Looper thread.
|
| static Handler | createHandlerForCurrentOrMainLooper(@UnknownInitialization Handler.Callback callback) |
Deprecated.
Creates a Handler with the specified Handler.Callback on the current Looper thread.
|
| static File | createTempDirectory(Context context, String prefix) |
Deprecated.
Creates an empty directory in the directory returned by Context.getCacheDir().
|
| static File | createTempFile(Context context, String prefix) |
Deprecated.
Creates a new empty file in the directory returned by Context.getCacheDir().
|
| static long | durationUsToSampleCount(long durationUs, int sampleRate) |
Deprecated.
Returns the number of samples required to represent durationUs of media at sampleRate, assuming all samples are equal duration except the last one which may be shorter.
|
| static String | escapeFileName(String fileName) |
Deprecated.
Escapes a string so that it's safe for use as a file or directory name on at least FAT32 filesystems.
|
| static Uri | fixSmoothStreamingIsmManifestUri(Uri uri) |
Deprecated.
If the provided URI is an ISM Presentation URI, returns the URI with "Manifest" appended to its path (i.e., the corresponding default manifest URI).
|
| static String | formatInvariant(String format, Object... args) |
Deprecated.
Formats a string using Locale.US.
|
| static String | fromUtf8Bytes(byte[] bytes) |
Deprecated.
Returns a new String constructed by decoding UTF-8 encoded bytes.
|
| static String | fromUtf8Bytes(byte[] bytes, int offset, int length) |
Deprecated.
Returns a new String constructed by decoding UTF-8 encoded bytes in a subarray.
|
| static int | generateAudioSessionIdV21(Context context) |
Deprecated.
Returns a newly generated audio session identifier, or AudioManager.ERROR if an error occurred in which case audio playback may fail.
|
| static String | getAdaptiveMimeTypeForContentType(@com.google.android.exoplayer2.C.ContentType int contentType) |
Deprecated.
Returns the MIME type corresponding to the given adaptive C.ContentType, or null if the content type is not adaptive.
|
| static @com.google.android.exoplayer2.C.AudioContentType int | getAudioContentTypeForStreamType(@com.google.android.exoplayer2.C.StreamType int streamType) |
Deprecated.
Returns the C.AudioContentType corresponding to the specified C.StreamType.
|
| static int | getAudioTrackChannelConfig(int channelCount) |
Deprecated.
Returns the audio track channel configuration for the given channel count, or AudioFormat.CHANNEL_INVALID if output is not possible.
|
| static @com.google.android.exoplayer2.C.AudioUsage int | getAudioUsageForStreamType(@com.google.android.exoplayer2.C.StreamType int streamType) |
Deprecated.
Returns the C.AudioUsage corresponding to the specified C.StreamType.
|
| static Player.Commands | getAvailableCommands(Player player, Player.Commands permanentAvailableCommands) |
Deprecated.
Returns the Player.Commands available in the Player.
|
| static int | getBigEndianInt(ByteBuffer buffer, int index) |
Deprecated.
Absolute get method for reading an int value in ByteOrder.BIG_ENDIAN in a ByteBuffer.
|
| static byte[] | getBytesFromHexString(String hexString) |
Deprecated.
Returns a byte array containing values parsed from the hex string provided.
|
| static int | getCodecCountOfType(String codecs, @com.google.android.exoplayer2.C.TrackType int trackType) |
Deprecated.
Returns the number of codec strings in codecs whose type matches trackType.
|
| static String | getCodecsOfType(String codecs, @com.google.android.exoplayer2.C.TrackType int trackType) |
Deprecated.
Returns a copy of codecs without the codecs whose track type doesn't match trackType.
|
| static String | getCommaDelimitedSimpleClassNames(Object[] objects) |
Deprecated.
Returns a string with comma delimited simple names of each object's class.
|
| static String | getCountryCode(Context context) |
Deprecated.
Returns the upper-case ISO 3166-1 alpha-2 country code of the current registered operator's MCC (Mobile Country Code), or the country code of the default Locale if not available.
|
| static Point | getCurrentDisplayModeSize(Context context) |
Deprecated.
Gets the size of the current mode of the default display, in pixels.
|
| static Point | getCurrentDisplayModeSize(Context context, Display display) |
Deprecated.
Gets the size of the current mode of the specified display, in pixels.
|
| static Looper | getCurrentOrMainLooper() |
Deprecated.
Returns the Looper associated with the current thread, or the Looper of the application's main thread if the current thread doesn't have a Looper.
|
| static Uri | getDataUriForString(String mimeType, String data) |
Deprecated.
Returns a data URI with the specified MIME type and data.
|
| static Locale | getDefaultDisplayLocale() |
Deprecated.
Returns the default DISPLAY Locale.
|
| static Drawable | getDrawable(Context context, Resources resources, int drawableRes) |
Deprecated.
Returns a Drawable for the given resource or throws a Resources.NotFoundException if not found.
|
| static UUID | getDrmUuid(String drmScheme) |
Deprecated.
Derives a DRM UUID from drmScheme.
|
| static @com.google.android.exoplayer2.PlaybackException.ErrorCode int | getErrorCodeForMediaDrmErrorCode(int mediaDrmErrorCode) |
Deprecated.
Returns a PlaybackException.ErrorCode value that corresponds to the provided MediaDrm.ErrorCodes value.
|
| static int | getErrorCodeFromPlatformDiagnosticsInfo(String diagnosticsInfo) |
Deprecated.
Attempts to parse an error code from a diagnostic string found in framework media exceptions.
|
| static String | getFormatSupportString(@com.google.android.exoplayer2.C.FormatSupport int formatSupport) |
Deprecated.
Returns string representation of a C.FormatSupport flag.
|
| static int | getIntegerCodeForString(String string) |
Deprecated.
Returns the integer equal to the big-endian concatenation of the characters in string as bytes.
|
| static String | getLocaleLanguageTag(Locale locale) |
Deprecated.
Returns the language tag for a Locale.
|
| static int | getMaxPendingFramesCountForMediaCodecDecoders(Context context, String codecName, boolean requestedHdrToneMapping) |
Deprecated.
Returns the number of maximum pending output frames that are allowed on a MediaCodec decoder.
|
| static long | getMediaDurationForPlayoutDuration(long playoutDuration, float speed) |
Deprecated.
Returns the duration of media that will elapse in playoutDuration.
|
| static long | getNowUnixTimeMs(long elapsedRealtimeEpochOffsetMs) |
Deprecated.
Returns the current time in milliseconds since the epoch.
|
| static @com.google.android.exoplayer2.C.PcmEncoding int | getPcmEncoding(int bitDepth) |
Deprecated.
Converts a sample bit depth to a corresponding PCM encoding constant.
|
| static Format | getPcmFormat(@com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding, int channels, int sampleRate) |
Deprecated.
Gets a PCM Format with the specified parameters.
|
| static int | getPcmFrameSize(@com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding, int channelCount) |
Deprecated.
Returns the frame size for audio with channelCount channels in the specified encoding.
|
| static long | getPlayoutDurationForMediaDuration(long mediaDuration, float speed) |
Deprecated.
Returns the playout duration of mediaDuration of media.
|
| static @com.google.android.exoplayer2.C.StreamType int | getStreamTypeForAudioUsage(@com.google.android.exoplayer2.C.AudioUsage int usage) |
Deprecated.
Returns the C.StreamType corresponding to the specified C.AudioUsage.
|
| static String | getStringForTime(StringBuilder builder, Formatter formatter, long timeMs) |
Deprecated.
Returns the specified millisecond time formatted as a string.
|
| static String[] | getSystemLanguageCodes() |
Deprecated.
Returns a non-empty array of normalized IETF BCP 47 language tags for the system languages ordered by preference.
|
| static String | getTrackTypeString(@com.google.android.exoplayer2.C.TrackType int trackType) |
Deprecated.
Returns a string representation of a C.TrackType.
|
| static String | getUserAgent(Context context, String applicationName) |
Deprecated.
Returns a user agent string based on the given application name and the library version.
|
| static byte[] | getUtf8Bytes(String value) |
Deprecated.
Returns a new byte array containing the code points of a String encoded using UTF-8.
|
| static byte[] | gzip(byte[] input) |
Deprecated.
Compresses input using gzip and returns the result in a newly allocated byte array.
|
| static boolean | handlePauseButtonAction(Player player) |
Deprecated.
Updates the player to handle an interaction with a pause button.
|
| static boolean | handlePlayButtonAction(Player player) |
Deprecated.
Updates the player to handle an interaction with a play button.
|
| static boolean | handlePlayPauseButtonAction(Player player) |
Deprecated.
Updates the player to handle an interaction with a play or pause button.
|
| static @com.google.android.exoplayer2.C.ContentType int | inferContentType(Uri uri) |
Deprecated.
Makes a best guess to infer the C.ContentType from a Uri.
|
| static @com.google.android.exoplayer2.C.ContentType int | inferContentType(Uri uri, String overrideExtension) |
Deprecated.
Use inferContentTypeForExtension(String) when overrideExtension is non-empty, and inferContentType(Uri) otherwise.
|
| static @com.google.android.exoplayer2.C.ContentType int | inferContentType(String fileName) |
Deprecated.
Use Uri.parse(String) and inferContentType(Uri) for full file paths or inferContentTypeForExtension(String) for extensions.
|
| static @com.google.android.exoplayer2.C.ContentType int | inferContentTypeForExtension(String fileExtension) |
Deprecated.
Makes a best guess to infer the C.ContentType from a file extension.
|
| static @com.google.android.exoplayer2.C.ContentType int | inferContentTypeForUriAndMimeType(Uri uri, String mimeType) |
Deprecated.
Makes a best guess to infer the C.ContentType from a Uri and optional MIME type.
|
| static boolean | inflate(ParsableByteArray input, ParsableByteArray output, Inflater inflater) |
Deprecated.
Uncompresses the data in input.
|
| static String | intToStringMaxRadix(int i) |
Deprecated.
Returns a string representation of the integer using radix value Character.MAX_RADIX.
|
| static boolean | isAutomotive(Context context) |
Deprecated.
Returns whether the app is running on an automotive device.
|
| static boolean | isEncodingHighResolutionPcm(@com.google.android.exoplayer2.C.PcmEncoding int encoding) |
Deprecated.
Returns whether encoding is high resolution (> 16-bit) PCM.
|
| static boolean | isEncodingLinearPcm(@com.google.android.exoplayer2.C.Encoding int encoding) |
Deprecated.
Returns whether encoding is one of the linear PCM encodings.
|
| static boolean | isLinebreak(int c) |
Deprecated.
Returns whether the given character is a carriage return ('\r') or a line feed ('\n').
|
| static boolean | isLocalFileUri(Uri uri) |
Deprecated.
Returns true if the URI is a path to a local file or a reference to a local file.
|
| static boolean | isTv(Context context) |
Deprecated.
Returns whether the app is running on a TV device.
|
| static int | linearSearch(int[] array, int value) |
Deprecated.
Returns the index of the first occurrence of value in array, or C.INDEX_UNSET if value is not contained in array.
|
| static int | linearSearch(long[] array, long value) |
Deprecated.
Returns the index of the first occurrence of value in array, or C.INDEX_UNSET if value is not contained in array.
|
| static long | maxValue(SparseLongArray sparseLongArray) |
Deprecated.
Returns the maximum value in the given SparseLongArray.
|
| static boolean | maybeRequestReadExternalStoragePermission(Activity activity, Uri... uris) |
Deprecated.
Checks whether it's necessary to request the Manifest.permission.READ_EXTERNAL_STORAGE permission read the specified Uris, requesting the permission if necessary.
|
| static boolean | maybeRequestReadExternalStoragePermission(Activity activity, MediaItem... mediaItems) |
Deprecated.
Checks whether it's necessary to request the Manifest.permission.READ_EXTERNAL_STORAGE permission for the specified media items, requesting the permission if necessary.
|
| static long | minValue(SparseLongArray sparseLongArray) |
Deprecated.
Returns the minimum value in the given SparseLongArray.
|
| static <T> void | moveItems(List<T> items, int fromIndex, int toIndex, int newFromIndex) |
Deprecated.
Moves the elements starting at fromIndex to newFromIndex.
|
| static long | msToUs(long timeMs) |
Deprecated.
Converts a time in milliseconds to the corresponding time in microseconds, preserving C.TIME_UNSET values and C.TIME_END_OF_SOURCE values.
|
| static ExecutorService | newSingleThreadExecutor(String threadName) |
Deprecated.
Instantiates a new single threaded executor whose thread has the specified name.
|
| static ScheduledExecutorService | newSingleThreadScheduledExecutor(String threadName) |
Deprecated.
Instantiates a new single threaded scheduled executor whose thread has the specified name.
|
| static @PolyNull String | normalizeLanguageCode(@PolyNull String language) |
Deprecated.
Returns a normalized IETF BCP 47 language tag for language.
|
| static <T> T[] | nullSafeArrayAppend(T[] original, T newElement) |
Deprecated.
Creates a new array containing original with newElement appended.
|
| static <T> T[] | nullSafeArrayConcatenation(T[] first, T[] second) |
Deprecated.
Creates a new array containing the concatenation of two non-null type arrays.
|
| static <T> T[] | nullSafeArrayCopy(T[] input, int length) |
Deprecated.
Copies and optionally truncates an array.
|
| static <T> T[] | nullSafeArrayCopyOfRange(T[] input, int from, int to) |
Deprecated.
Copies a subset of an array.
|
| static <T> void | nullSafeListToArray(List<T> list, T[] array) |
Deprecated.
Copies the contents of list into array.
|
| static long | parseXsDateTime(String value) |
Deprecated.
Parses an xs:dateTime attribute value, returning the parsed timestamp in milliseconds since the epoch.
|
| static long | parseXsDuration(String value) |
Deprecated.
Parses an xs:duration attribute value, returning the parsed duration in milliseconds.
|
| static boolean | postOrRun(Handler handler, Runnable runnable) |
Deprecated.
Posts the Runnable if the calling thread differs with the Looper of the Handler.
|
| static <T> ListenableFuture<T> | postOrRunWithCompletion(Handler handler, Runnable runnable, T successValue) |
Deprecated.
Posts the Runnable if the calling thread differs with the Looper of the Handler.
|
| static boolean | readBoolean(Parcel parcel) |
Deprecated.
Reads an integer from a Parcel and interprets it as a boolean, with 0 mapping to false and all other values mapping to true.
|
| static void | recursiveDelete(File fileOrDirectory) |
Deprecated.
Recursively deletes a directory and its content.
|
| static Intent | registerReceiverNotExported(Context context, BroadcastReceiver receiver, IntentFilter filter) |
Deprecated.
Registers a BroadcastReceiver that's not intended to receive broadcasts from other apps.
|
| static <T> void | removeRange(List<T> list, int fromIndex, int toIndex) |
Deprecated.
Removes an indexed range from a List.
|
| static long | sampleCountToDurationUs(long sampleCount, int sampleRate) |
Deprecated.
Returns the total duration (in microseconds) of sampleCount samples of equal duration at sampleRate.
|
| static long | scaleLargeTimestamp(long timestamp, long multiplier, long divisor) |
Deprecated.
Scales a large timestamp.
|
| static long[] | scaleLargeTimestamps(List<Long> timestamps, long multiplier, long divisor) |
Deprecated.
Applies scaleLargeTimestamp(long, long, long) to a list of unscaled timestamps.
|
| static void | scaleLargeTimestampsInPlace(long[] timestamps, long multiplier, long divisor) |
Deprecated.
Applies scaleLargeTimestamp(long, long, long) to an array of unscaled timestamps.
|
| static boolean | shouldShowPlayButton(Player player) |
Deprecated.
Returns whether a play button should be presented on a UI element for playback control.
|
| static void | sneakyThrow(Throwable t) |
Deprecated.
A hacky method that always throws t even if t is a checked exception, and is not declared to be thrown.
|
| static String[] | split(String value, String regex) |
Deprecated.
Splits a string using value.split(regex, -1).
|
| static String[] | splitAtFirst(String value, String regex) |
Deprecated.
Splits the string at the first occurrence of the delimiter regex.
|
| static String[] | splitCodecs(String codecs) |
Deprecated.
Splits a codecs sequence string, as defined in RFC 6381, into individual codec strings.
|
| static ComponentName | startForegroundService(Context context, Intent intent) |
Deprecated.
Calls Context.startForegroundService(Intent) if SDK_INT is 26 or higher, or Context.startService(Intent) otherwise.
|
| static long | subtractWithOverflowDefault(long x, long y, long overflowResult) |
Deprecated.
Returns the difference between two arguments, or a third argument if the result overflows.
|
| static long | sum(long... summands) |
Deprecated.
Returns the sum of all summands of the given array.
|
| static boolean | tableExists(SQLiteDatabase database, String tableName) |
Deprecated.
Returns whether the table exists in the database.
|
| static byte[] | toByteArray(float value) |
Deprecated.
Converts a float into an equivalent byte array.
|
| static byte[] | toByteArray(int value) |
Deprecated.
Converts an integer into an equivalent byte array.
|
| static byte[] | toByteArray(int... values) |
Deprecated.
Converts an array of integers into an equivalent byte array.
|
| static byte[] | toByteArray(InputStream inputStream) |
Deprecated.
Converts the entirety of an InputStream to a byte array.
|
| static float | toFloat(byte[] bytes) |
Deprecated.
Converts a byte array into a float.
|
| static String | toHexString(byte[] bytes) |
Deprecated.
Returns a string containing a lower-case hex representation of the bytes provided.
|
| static int | toInteger(byte[] bytes) |
Deprecated.
Converts a byte array into an integer.
|
| static long | toLong(int mostSignificantBits, int leastSignificantBits) |
Deprecated.
Returns the long that is composed of the bits of the 2 specified integers.
|
| static long | toUnsignedLong(int x) |
Deprecated.
Converts an integer to a long by unsigned conversion.
|
| static <T,U>ListenableFuture<T> | transformFutureAsync(ListenableFuture<U> future, AsyncFunction<U,T> transformFunction) |
Deprecated.
Asynchronously transforms the result of a ListenableFuture.
|
| static String | unescapeFileName(String fileName) |
Deprecated.
Unescapes an escaped file or directory name back to its original value.
|
| static long | usToMs(long timeUs) |
Deprecated.
Converts a time in microseconds to the corresponding time in milliseconds, preserving C.TIME_UNSET and C.TIME_END_OF_SOURCE values.
|
| static void | writeBoolean(Parcel parcel, boolean value) |
Deprecated.
Writes a boolean to a Parcel.
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final int SDK_INT
Deprecated.
Like Build.VERSION.SDK_INT, but in a place where it can be conveniently overridden for local testing.
-
public static final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")DEVICE
Deprecated.
Like Build.DEVICE, but in a place where it can be conveniently overridden for local testing.
-
public static final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")MANUFACTURER
Deprecated.
Like Build.MANUFACTURER, but in a place where it can be conveniently overridden for local testing.
-
public static final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")MODEL
Deprecated.
Like Build.MODEL, but in a place where it can be conveniently overridden for local testing.
-
public static final[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")DEVICE_DEBUG_INFO
Deprecated.
A concise description of the device that it can be useful to log for debugging purposes.
-
public static final byte[] EMPTY_BYTE_ARRAY
Deprecated.
An empty byte array.
-
public static byte[] toByteArray([InputStream](https://developer.android.com/reference/java/io/InputStream.html "class or interface in java.io")inputStream)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Converts the entirety of an InputStream to a byte array.
Parameters:inputStream - the InputStream to be read. The input stream is not closed by this method.Returns:a byte array containing all of the inputStream's bytes.Throws:IOException - if an error occurs reading from the stream.
-
public static byte[] toByteArray(int value)
Deprecated.
Converts an integer into an equivalent byte array.
-
public static byte[] toByteArray(int... values)
Deprecated.
Converts an array of integers into an equivalent byte array.
Each integer is converted into 4 sequential bytes.
-
public static byte[] toByteArray(float value)
Deprecated.
Converts a float into an equivalent byte array.
-
public static float toFloat(byte[] bytes)
Deprecated.
Converts a byte array into a float.
-
public static int toInteger(byte[] bytes)
Deprecated.
Converts a byte array into an integer.
-
@Nullable
public static[Intent](https://developer.android.com/reference/android/content/Intent.html "class or interface in android.content")registerReceiverNotExported([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,
@Nullable[BroadcastReceiver](https://developer.android.com/reference/android/content/BroadcastReceiver.html "class or interface in android.content")receiver,[IntentFilter](https://developer.android.com/reference/android/content/IntentFilter.html "class or interface in android.content")filter)
Deprecated.
Registers a BroadcastReceiver that's not intended to receive broadcasts from other apps. This will be enforced by specifying Context.RECEIVER_NOT_EXPORTED if SDK_INT is 33 or above.
Do not use this method if registering a receiver for a protected system broadcast.
Parameters:context - The context on which Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter) will be called.receiver - The BroadcastReceiver to register. This value may be null.filter - Selects the Intent broadcasts to be received.Returns:The first sticky intent found that matches filter, or null if there are none.
-
@Nullable
public static[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html "class or interface in android.content")startForegroundService([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[Intent](https://developer.android.com/reference/android/content/Intent.html "class or interface in android.content")intent)
Deprecated.
Calls Context.startForegroundService(Intent) if SDK_INT is 26 or higher, or Context.startService(Intent) otherwise.
Parameters:context - The context to call.intent - The intent to pass to the called method.Returns:The result of the called method.
-
public static boolean maybeRequestReadExternalStoragePermission([Activity](https://developer.android.com/reference/android/app/Activity.html "class or interface in android.app")activity,[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")... uris)
Deprecated.
Checks whether it's necessary to request the Manifest.permission.READ_EXTERNAL_STORAGE permission read the specified Uris, requesting the permission if necessary.
Parameters:activity - The host activity for checking and requesting the permission.uris - Uris that may require Manifest.permission.READ_EXTERNAL_STORAGE to read.Returns:Whether a permission request was made.
-
public static boolean maybeRequestReadExternalStoragePermission([Activity](https://developer.android.com/reference/android/app/Activity.html "class or interface in android.app")activity,[MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")... mediaItems)
Deprecated.
Checks whether it's necessary to request the Manifest.permission.READ_EXTERNAL_STORAGE permission for the specified media items, requesting the permission if necessary.
Parameters:activity - The host activity for checking and requesting the permission.mediaItems - Media itemss that may require Manifest.permission.READ_EXTERNAL_STORAGE to read.Returns:Whether a permission request was made.
-
public static boolean checkCleartextTrafficPermitted([MediaItem](../MediaItem.html "class in com.google.android.exoplayer2")... mediaItems)
Deprecated.
Returns whether it may be possible to load the URIs of the given media items based on the network security policy's cleartext traffic permissions.
Parameters:mediaItems - A list of media items.Returns:Whether it may be possible to load the URIs of the given media items.
-
public static boolean isLocalFileUri([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri)
Deprecated.
Returns true if the URI is a path to a local file or a reference to a local file.
Parameters:uri - The uri to test.
-
public static boolean areEqual(@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")o1,
@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")o2)
Deprecated.
Tests two objects for Object.equals(Object) equality, handling the case where one or both may be null.
Parameters:o1 - The first object.o2 - The second object.Returns:o1 == null ? o2 == null : o1.equals(o2).
-
public static boolean contains(@NullableType[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")[] items,
@Nullable[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")item)
Deprecated.
Tests whether an items array contains an object equal to item, according to Object.equals(Object).
If item is null then true is returned if and only if items contains null.
Parameters:items - The array of items to search.item - The item to search for.Returns:True if the array contains an object equal to the item being searched for.
-
public static <T> void removeRange([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<T> list,
int fromIndex,
int toIndex)
Deprecated.
Removes an indexed range from a List.
Does nothing if the provided range is valid and fromIndex == toIndex.
Parameters:list - The List to remove the range from.fromIndex - The first index to be removed (inclusive).toIndex - The last index to be removed (exclusive).Throws:IllegalArgumentException - If fromIndex < 0, toIndex > list.size(), or fromIndex > toIndex.
-
@EnsuresNonNull("#1")
public static <T> T castNonNull(@Nullable
T value)
Deprecated.
Casts a nullable variable to a non-null variable without runtime null check.
Use Assertions.checkNotNull(Object) to throw if the value is null.
-
@EnsuresNonNull("#1")
public static <T> T[] castNonNullTypeArray(@NullableType T[] value)
Deprecated.
Casts a nullable type array to a non-null type array without runtime null check.
-
public static <T> T[] nullSafeArrayCopy(T[] input,
int length)
Deprecated.
Copies and optionally truncates an array. Prevents null array elements created by Arrays.copyOf(Object[], int) by ensuring the new length does not exceed the current length.
Parameters:input - The input array.length - The output array length. Must be less or equal to the length of the input array.Returns:The copied array.
-
public static <T> T[] nullSafeArrayCopyOfRange(T[] input,
int from,
int to)
Deprecated.
Copies a subset of an array.
Parameters:input - The input array.from - The start the range to be copied, inclusiveto - The end of the range to be copied, exclusive.Returns:The copied array.
-
public static <T> T[] nullSafeArrayAppend(T[] original,
T newElement)
Deprecated.
Creates a new array containing original with newElement appended.
Parameters:original - The input array.newElement - The element to append.Returns:The new array.
-
public static <T> T[] nullSafeArrayConcatenation(T[] first,
T[] second)
Deprecated.
Creates a new array containing the concatenation of two non-null type arrays.
Parameters:first - The first array.second - The second array.Returns:The concatenated result.
-
public static <T> void nullSafeListToArray([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<T> list,
T[] array)
Deprecated.
Copies the contents of list into array.
list.size() must be the same as array.length to ensure the contents can be copied into array without leaving any nulls at the end.
Parameters:list - The list to copy items from.array - The array to copy items to.
-
public static[Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")createHandlerForCurrentLooper()
Deprecated.
Creates a Handler on the current Looper thread.
Throws:IllegalStateException - If the current thread doesn't have a Looper.
-
public static[Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")createHandlerForCurrentLooper(@Nullable
@UnknownInitialization[Handler.Callback](https://developer.android.com/reference/android/os/Handler.Callback.html "class or interface in android.os")callback)
Deprecated.
Creates a Handler with the specified Handler.Callback on the current Looper thread.
The method accepts partially initialized objects as callback under the assumption that the Handler won't be used to send messages until the callback is fully initialized.
Parameters:callback - A Handler.Callback. May be a partially initialized class, or null if no callback is required.Returns:A Handler with the specified callback on the current Looper thread.Throws:IllegalStateException - If the current thread doesn't have a Looper.
-
public static[Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")createHandlerForCurrentOrMainLooper()
Deprecated.
Creates a Handler on the current Looper thread.
If the current thread doesn't have a Looper, the application's main thread Looper is used.
-
public static[Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")createHandlerForCurrentOrMainLooper(@Nullable
@UnknownInitialization[Handler.Callback](https://developer.android.com/reference/android/os/Handler.Callback.html "class or interface in android.os")callback)
Deprecated.
Creates a Handler with the specified Handler.Callback on the current Looper thread.
The method accepts partially initialized objects as callback under the assumption that the Handler won't be used to send messages until the callback is fully initialized.
If the current thread doesn't have a Looper, the application's main thread Looper is used.
Parameters:callback - A Handler.Callback. May be a partially initialized class, or null if no callback is required.Returns:A Handler with the specified callback on the current Looper thread.
-
public static[Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")createHandler([Looper](https://developer.android.com/reference/android/os/Looper.html?is-external=true "class or interface in android.os")looper,
@Nullable
@UnknownInitialization[Handler.Callback](https://developer.android.com/reference/android/os/Handler.Callback.html "class or interface in android.os")callback)
Deprecated.
Creates a Handler with the specified Handler.Callback on the specified Looper thread.
The method accepts partially initialized objects as callback under the assumption that the Handler won't be used to send messages until the callback is fully initialized.
Parameters:looper - A Looper to run the callback on.callback - A Handler.Callback. May be a partially initialized class, or null if no callback is required.Returns:A Handler with the specified callback on the current Looper thread.
-
public static boolean postOrRun([Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")handler,[Runnable](https://developer.android.com/reference/java/lang/Runnable.html "class or interface in java.lang")runnable)
Deprecated.
Posts the Runnable if the calling thread differs with the Looper of the Handler. Otherwise, runs the Runnable directly.
Parameters:handler - The handler to which the Runnable will be posted.runnable - The runnable to either post or run.Returns:true if the Runnable was successfully posted to the Handler or run. false otherwise.
-
public static <T>[ListenableFuture](https://guava.dev/releases/31.1-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html?is-external=true "class or interface in com.google.common.util.concurrent")<T> postOrRunWithCompletion([Handler](https://developer.android.com/reference/android/os/Handler.html "class or interface in android.os")handler,[Runnable](https://developer.android.com/reference/java/lang/Runnable.html "class or interface in java.lang")runnable,
T successValue)
Deprecated.
Posts the Runnable if the calling thread differs with the Looper of the Handler. Otherwise, runs the Runnable directly. Also returns a ListenableFuture for when the Runnable has run.
Type Parameters:T - The type of successValue.Parameters:handler - The handler to which the Runnable will be posted.runnable - The runnable to either post or run.successValue - The value to set in the ListenableFuture once the runnable completes.Returns:A ListenableFuture for when the Runnable has run.
-
public static <T,U>[ListenableFuture](https://guava.dev/releases/31.1-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html?is-external=true "class or interface in com.google.common.util.concurrent")<T> transformFutureAsync([ListenableFuture](https://guava.dev/releases/31.1-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html?is-external=true "class or interface in com.google.common.util.concurrent")<U> future,[AsyncFunction](https://guava.dev/releases/31.1-android/api/docs/com/google/common/util/concurrent/AsyncFunction.html?is-external=true "class or interface in com.google.common.util.concurrent")<U,T> transformFunction)
Deprecated.
Asynchronously transforms the result of a ListenableFuture.
The transformation function is called using a direct executor.
The returned Future attempts to keep its cancellation state in sync with that of the input future and that of the future returned by the transform function. That is, if the returned Future is cancelled, it will attempt to cancel the other two, and if either of the other two is cancelled, the returned Future will also be cancelled. All forwarded cancellations will not attempt to interrupt.
Type Parameters:T - The result type of the input future.U - The result type of the transformation function.Parameters:future - The input ListenableFuture.transformFunction - The function transforming the result of the input future.Returns:A ListenableFuture for the transformed result.
-
public static[Looper](https://developer.android.com/reference/android/os/Looper.html "class or interface in android.os")getCurrentOrMainLooper()
Deprecated.
Returns the Looper associated with the current thread, or the Looper of the application's main thread if the current thread doesn't have a Looper.
-
public static[ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService.html "class or interface in java.util.concurrent")newSingleThreadExecutor([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")threadName)
Deprecated.
Instantiates a new single threaded executor whose thread has the specified name.
Parameters:threadName - The name of the thread.Returns:The executor.
-
public static[ScheduledExecutorService](https://developer.android.com/reference/java/util/concurrent/ScheduledExecutorService.html "class or interface in java.util.concurrent")newSingleThreadScheduledExecutor([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")threadName)
Deprecated.
Instantiates a new single threaded scheduled executor whose thread has the specified name.
Parameters:threadName - The name of the thread.Returns:The executor.
-
public static void closeQuietly(@Nullable[Closeable](https://developer.android.com/reference/java/io/Closeable.html "class or interface in java.io")closeable)
Deprecated.
Closes a Closeable, suppressing any IOException that may occur. Both OutputStream and InputStream are Closeable.
Parameters:closeable - The Closeable to close.
-
public static boolean readBoolean([Parcel](https://developer.android.com/reference/android/os/Parcel.html "class or interface in android.os")parcel)
Deprecated.
Reads an integer from a Parcel and interprets it as a boolean, with 0 mapping to false and all other values mapping to true.
Parameters:parcel - The Parcel to read from.Returns:The read value.
-
public static void writeBoolean([Parcel](https://developer.android.com/reference/android/os/Parcel.html "class or interface in android.os")parcel,
boolean value)
Deprecated.
Writes a boolean to a Parcel. The boolean is written as an integer with value 1 (true) or 0 (false).
Parameters:parcel - The Parcel to write to.value - The value to write.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getLocaleLanguageTag([Locale](https://developer.android.com/reference/java/util/Locale.html?is-external=true "class or interface in java.util")locale)
Deprecated.
Returns the language tag for a Locale.
For API levels ≥ 21, this tag is IETF BCP 47 compliant. Use normalizeLanguageCode(String) to retrieve a normalized IETF BCP 47 language tag for all API levels if needed.
Parameters:locale - A Locale.Returns:The language tag.
-
public static @PolyNull[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")normalizeLanguageCode(@PolyNull[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")language)
Deprecated.
Returns a normalized IETF BCP 47 language tag for language.
Parameters:language - A case-insensitive language code supported by Locale.forLanguageTag(String).Returns:The all-lowercase normalized code, or null if the input was null, or language.toLowerCase() if the language could not be normalized.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")fromUtf8Bytes(byte[] bytes)
Deprecated.
Returns a new String constructed by decoding UTF-8 encoded bytes.
Parameters:bytes - The UTF-8 encoded bytes to decode.Returns:The string.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")fromUtf8Bytes(byte[] bytes,
int offset,
int length)
Deprecated.
Returns a new String constructed by decoding UTF-8 encoded bytes in a subarray.
Parameters:bytes - The UTF-8 encoded bytes to decode.offset - The index of the first byte to decode.length - The number of bytes to decode.Returns:The string.
-
public static byte[] getUtf8Bytes([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")value)
Deprecated.
Returns a new byte array containing the code points of a String encoded using UTF-8.
Parameters:value - The String whose bytes should be obtained.Returns:The code points encoding using UTF-8.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")[] split([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")value,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")regex)
Deprecated.
Splits a string using value.split(regex, -1). Note: this is is similar to String.split(String) but empty matches at the end of the string will not be omitted from the returned array.
Parameters:value - The string to split.regex - A delimiting regular expression.Returns:The array of strings resulting from splitting the string.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")[] splitAtFirst([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")value,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")regex)
Deprecated.
Splits the string at the first occurrence of the delimiter regex. If the delimiter does not match, returns an array with one element which is the input string. If the delimiter does match, returns an array with the portion of the string before the delimiter and the rest of the string.
Parameters:value - The string.regex - A delimiting regular expression.Returns:The string split by the first occurrence of the delimiter.
-
public static boolean isLinebreak(int c)
Deprecated.
Returns whether the given character is a carriage return ('\r') or a line feed ('\n').
Parameters:c - The character.Returns:Whether the given character is a linebreak.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")formatInvariant([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")format,[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")... args)
Deprecated.
Formats a string using Locale.US.
See Also:String.format(String, Object...)
-
public static int ceilDivide(int numerator,
int denominator)
Deprecated.
Divides a numerator by a denominator, returning the ceiled result.
Parameters:numerator - The numerator to divide.denominator - The denominator to divide by.Returns:The ceiled result of the division.
-
public static long ceilDivide(long numerator,
long denominator)
Deprecated.
Divides a numerator by a denominator, returning the ceiled result.
Parameters:numerator - The numerator to divide.denominator - The denominator to divide by.Returns:The ceiled result of the division.
-
public static int constrainValue(int value,
int min,
int max)
Deprecated.
Constrains a value to the specified bounds.
Parameters:value - The value to constrain.min - The lower bound.max - The upper bound.Returns:The constrained value Math.max(min, Math.min(value, max)).
-
public static long constrainValue(long value,
long min,
long max)
Deprecated.
Constrains a value to the specified bounds.
Parameters:value - The value to constrain.min - The lower bound.max - The upper bound.Returns:The constrained value Math.max(min, Math.min(value, max)).
-
public static float constrainValue(float value,
float min,
float max)
Deprecated.
Constrains a value to the specified bounds.
Parameters:value - The value to constrain.min - The lower bound.max - The upper bound.Returns:The constrained value Math.max(min, Math.min(value, max)).
-
public static long addWithOverflowDefault(long x,
long y,
long overflowResult)
Deprecated.
Returns the sum of two arguments, or a third argument if the result overflows.
Parameters:x - The first value.y - The second value.overflowResult - The return value if x + y overflows.Returns:x + y, or overflowResult if the result overflows.
-
public static long subtractWithOverflowDefault(long x,
long y,
long overflowResult)
Deprecated.
Returns the difference between two arguments, or a third argument if the result overflows.
Parameters:x - The first value.y - The second value.overflowResult - The return value if x - y overflows.Returns:x - y, or overflowResult if the result overflows.
-
public static int linearSearch(int[] array,
int value)
Deprecated.
Returns the index of the first occurrence of value in array, or C.INDEX_UNSET if value is not contained in array.
Parameters:array - The array to search.value - The value to search for.Returns:The index of the first occurrence of value in array, or C.INDEX_UNSET if value is not contained in array.
-
public static int linearSearch(long[] array,
long value)
Deprecated.
Returns the index of the first occurrence of value in array, or C.INDEX_UNSET if value is not contained in array.
Parameters:array - The array to search.value - The value to search for.Returns:The index of the first occurrence of value in array, or C.INDEX_UNSET if value is not contained in array.
-
public static int binarySearchFloor(int[] array,
int value,
boolean inclusive,
boolean stayInBounds)
Deprecated.
Returns the index of the largest element in array that is less than (or optionally equal to) a specified value.
The search is performed using a binary search algorithm, so the array must be sorted. If the array contains multiple elements equal to value and inclusive is true, the index of the first one will be returned.
Parameters:array - The array to search.value - The value being searched for.inclusive - If the value is present in the array, whether to return the corresponding index. If false then the returned index corresponds to the largest element strictly less than the value.stayInBounds - If true, then 0 will be returned in the case that the value is smaller than the smallest element in the array. If false then -1 will be returned.Returns:The index of the largest element in array that is less than (or optionally equal to) value.
-
public static int binarySearchFloor(long[] array,
long value,
boolean inclusive,
boolean stayInBounds)
Deprecated.
Returns the index of the largest element in array that is less than (or optionally equal to) a specified value.
The search is performed using a binary search algorithm, so the array must be sorted. If the array contains multiple elements equal to value and inclusive is true, the index of the first one will be returned.
Parameters:array - The array to search.value - The value being searched for.inclusive - If the value is present in the array, whether to return the corresponding index. If false then the returned index corresponds to the largest element strictly less than the value.stayInBounds - If true, then 0 will be returned in the case that the value is smaller than the smallest element in the array. If false then -1 will be returned.Returns:The index of the largest element in array that is less than (or optionally equal to) value.
-
public static <T extends[Comparable](https://developer.android.com/reference/java/lang/Comparable.html "class or interface in java.lang")<? super T>> int binarySearchFloor([List](https://developer.android.com/reference/java/util/List.html?is-external=true "class or interface in java.util")<? extends[Comparable](https://developer.android.com/reference/java/lang/Comparable.html?is-external=true "class or interface in java.lang")<? super T>> list,
T value,
boolean inclusive,
boolean stayInBounds)
Deprecated.
Returns the index of the largest element in list that is less than (or optionally equal to) a specified value.
The search is performed using a binary search algorithm, so the list must be sorted. If the list contains multiple elements equal to value and inclusive is true, the index of the first one will be returned.
Type Parameters:T - The type of values being searched.Parameters:list - The list to search.value - The value being searched for.inclusive - If the value is present in the list, whether to return the corresponding index. If false then the returned index corresponds to the largest element strictly less than the value.stayInBounds - If true, then 0 will be returned in the case that the value is smaller than the smallest element in the list. If false then -1 will be returned.Returns:The index of the largest element in list that is less than (or optionally equal to) value.
-
public static int binarySearchFloor([LongArray](LongArray.html "class in com.google.android.exoplayer2.util")longArray,
long value,
boolean inclusive,
boolean stayInBounds)
Deprecated.
Returns the index of the largest element in longArray that is less than (or optionally equal to) a specified value.
The search is performed using a binary search algorithm, so the array must be sorted. If the array contains multiple elements equal to value and inclusive is true, the index of the first one will be returned.
Parameters:longArray - The array to search.value - The value being searched for.inclusive - If the value is present in the array, whether to return the corresponding index. If false then the returned index corresponds to the largest element strictly less than the value.stayInBounds - If true, then 0 will be returned in the case that the value is smaller than the smallest element in the array. If false then -1 will be returned.Returns:The index of the largest element in array that is less than (or optionally equal to) value.
-
public static int binarySearchCeil(int[] array,
int value,
boolean inclusive,
boolean stayInBounds)
Deprecated.
Returns the index of the smallest element in array that is greater than (or optionally equal to) a specified value.
The search is performed using a binary search algorithm, so the array must be sorted. If the array contains multiple elements equal to value and inclusive is true, the index of the last one will be returned.
Parameters:array - The array to search.value - The value being searched for.inclusive - If the value is present in the array, whether to return the corresponding index. If false then the returned index corresponds to the smallest element strictly greater than the value.stayInBounds - If true, then (a.length - 1) will be returned in the case that the value is greater than the largest element in the array. If false then a.length will be returned.Returns:The index of the smallest element in array that is greater than (or optionally equal to) value.
-
public static int binarySearchCeil(long[] array,
long value,
boolean inclusive,
boolean stayInBounds)
Deprecated.
Returns the index of the smallest element in array that is greater than (or optionally equal to) a specified value.
The search is performed using a binary search algorithm, so the array must be sorted. If the array contains multiple elements equal to value and inclusive is true, the index of the last one will be returned.
Parameters:array - The array to search.value - The value being searched for.inclusive - If the value is present in the array, whether to return the corresponding index. If false then the returned index corresponds to the smallest element strictly greater than the value.stayInBounds - If true, then (a.length - 1) will be returned in the case that the value is greater than the largest element in the array. If false then a.length will be returned.Returns:The index of the smallest element in array that is greater than (or optionally equal to) value.
-
public static <T extends[Comparable](https://developer.android.com/reference/java/lang/Comparable.html "class or interface in java.lang")<? super T>> int binarySearchCeil([List](https://developer.android.com/reference/java/util/List.html?is-external=true "class or interface in java.util")<? extends[Comparable](https://developer.android.com/reference/java/lang/Comparable.html?is-external=true "class or interface in java.lang")<? super T>> list,
T value,
boolean inclusive,
boolean stayInBounds)
Deprecated.
Returns the index of the smallest element in list that is greater than (or optionally equal to) a specified value.
The search is performed using a binary search algorithm, so the list must be sorted. If the list contains multiple elements equal to value and inclusive is true, the index of the last one will be returned.
Type Parameters:T - The type of values being searched.Parameters:list - The list to search.value - The value being searched for.inclusive - If the value is present in the list, whether to return the corresponding index. If false then the returned index corresponds to the smallest element strictly greater than the value.stayInBounds - If true, then (list.size() - 1) will be returned in the case that the value is greater than the largest element in the list. If false then list.size() will be returned.Returns:The index of the smallest element in list that is greater than (or optionally equal to) value.
-
public static int compareLong(long left,
long right)
Deprecated.
Compares two long values and returns the same value as Long.compare(long, long).
Parameters:left - The left operand.right - The right operand.Returns:0, if left == right, a negative value if left < right, or a positive value if left > right.
-
@RequiresApi(18)
public static long minValue([SparseLongArray](https://developer.android.com/reference/android/util/SparseLongArray.html "class or interface in android.util")sparseLongArray)
Deprecated.
Returns the minimum value in the given SparseLongArray.
Parameters:sparseLongArray - The SparseLongArray.Returns:The minimum value.Throws:NoSuchElementException - If the array is empty.
-
@RequiresApi(18)
public static long maxValue([SparseLongArray](https://developer.android.com/reference/android/util/SparseLongArray.html "class or interface in android.util")sparseLongArray)
Deprecated.
Returns the maximum value in the given SparseLongArray.
Parameters:sparseLongArray - The SparseLongArray.Returns:The maximum value.Throws:NoSuchElementException - If the array is empty.
-
public static long usToMs(long timeUs)
Deprecated.
Converts a time in microseconds to the corresponding time in milliseconds, preserving C.TIME_UNSET and C.TIME_END_OF_SOURCE values.
Parameters:timeUs - The time in microseconds.Returns:The corresponding time in milliseconds.
-
public static long msToUs(long timeMs)
Deprecated.
Converts a time in milliseconds to the corresponding time in microseconds, preserving C.TIME_UNSET values and C.TIME_END_OF_SOURCE values.
Parameters:timeMs - The time in milliseconds.Returns:The corresponding time in microseconds.
-
public static long sampleCountToDurationUs(long sampleCount,
int sampleRate)
Deprecated.
Returns the total duration (in microseconds) of sampleCount samples of equal duration at sampleRate.
If sampleRate is less than C.MICROS_PER_SECOND, the duration produced by this method can be reversed to the original sample count using durationUsToSampleCount(long, int).
Parameters:sampleCount - The number of samples.sampleRate - The sample rate, in samples per second.Returns:The total duration, in microseconds, of sampleCount samples.
-
public static long durationUsToSampleCount(long durationUs,
int sampleRate)
Deprecated.
Returns the number of samples required to represent durationUs of media at sampleRate, assuming all samples are equal duration except the last one which may be shorter.
The result of this method cannot be generally reversed to the original duration with sampleCountToDurationUs(long, int), due to information lost when rounding to a whole number of samples.
Parameters:durationUs - The duration in microseconds.sampleRate - The sample rate in samples per second.Returns:The number of samples required to represent durationUs.
-
public static long parseXsDuration([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")value)
Deprecated.
Parses an xs:duration attribute value, returning the parsed duration in milliseconds.
Parameters:value - The attribute value to decode.Returns:The parsed duration in milliseconds.
-
public static long parseXsDateTime([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")value)
throws[ParserException](../ParserException.html "class in com.google.android.exoplayer2")
Deprecated.
Parses an xs:dateTime attribute value, returning the parsed timestamp in milliseconds since the epoch.
Parameters:value - The attribute value to decode.Returns:The parsed timestamp in milliseconds since the epoch.Throws:ParserException - if an error occurs parsing the dateTime attribute value.
-
public static long scaleLargeTimestamp(long timestamp,
long multiplier,
long divisor)
Deprecated.
Scales a large timestamp.
Logically, scaling consists of a multiplication followed by a division. The actual operations performed are designed to minimize the probability of overflow.
Parameters:timestamp - The timestamp to scale.multiplier - The multiplier.divisor - The divisor.Returns:The scaled timestamp.
-
public static long[] scaleLargeTimestamps([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[Long](https://developer.android.com/reference/java/lang/Long.html?is-external=true "class or interface in java.lang")> timestamps,
long multiplier,
long divisor)
Deprecated.
Applies scaleLargeTimestamp(long, long, long) to a list of unscaled timestamps.
Parameters:timestamps - The timestamps to scale.multiplier - The multiplier.divisor - The divisor.Returns:The scaled timestamps.
-
public static void scaleLargeTimestampsInPlace(long[] timestamps,
long multiplier,
long divisor)
Deprecated.
Applies scaleLargeTimestamp(long, long, long) to an array of unscaled timestamps.
Parameters:timestamps - The timestamps to scale.multiplier - The multiplier.divisor - The divisor.
-
public static long getMediaDurationForPlayoutDuration(long playoutDuration,
float speed)
Deprecated.
Returns the duration of media that will elapse in playoutDuration.
Parameters:playoutDuration - The duration to scale.speed - The factor by which playback is sped up.Returns:The scaled duration, in the same units as playoutDuration.
-
public static long getPlayoutDurationForMediaDuration(long mediaDuration,
float speed)
Deprecated.
Returns the playout duration of mediaDuration of media.
Parameters:mediaDuration - The duration to scale.speed - The factor by which playback is sped up.Returns:The scaled duration, in the same units as mediaDuration.
-
public static int getIntegerCodeForString([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")string)
Deprecated.
Returns the integer equal to the big-endian concatenation of the characters in string as bytes. The string must be no more than four characters long.
Parameters:string - A string no more than four characters long.
-
public static long toUnsignedLong(int x)
Deprecated.
Converts an integer to a long by unsigned conversion.
This method is equivalent to Integer.toUnsignedLong(int) for API 26+.
-
public static long toLong(int mostSignificantBits,
int leastSignificantBits)
Deprecated.
Returns the long that is composed of the bits of the 2 specified integers.
Parameters:mostSignificantBits - The 32 most significant bits of the long to return.leastSignificantBits - The 32 least significant bits of the long to return.Returns:a long where its 32 most significant bits are mostSignificantBits bits and its 32 least significant bits are leastSignificantBits.
-
public static byte[] getBytesFromHexString([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")hexString)
Deprecated.
Returns a byte array containing values parsed from the hex string provided.
Parameters:hexString - The hex string to convert to bytes.Returns:A byte array containing values parsed from the hex string provided.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")toHexString(byte[] bytes)
Deprecated.
Returns a string containing a lower-case hex representation of the bytes provided.
Parameters:bytes - The byte data to convert to hex.Returns:A String containing the hex representation of bytes.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getCommaDelimitedSimpleClassNames([Object](https://developer.android.com/reference/java/lang/Object.html?is-external=true "class or interface in java.lang")[] objects)
Deprecated.
Returns a string with comma delimited simple names of each object's class.
Parameters:objects - The objects whose simple class names should be comma delimited and returned.Returns:A string with comma delimited simple names of each object's class.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getUserAgent([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")applicationName)
Deprecated.
Returns a user agent string based on the given application name and the library version.
Parameters:context - A valid context of the calling application.applicationName - String that will be prefix'ed to the generated user agent.Returns:A user agent string generated using the applicationName and the library version.
-
public static int getCodecCountOfType(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")codecs,
@com.google.android.exoplayer2.C.TrackType int trackType)
Deprecated.
Returns the number of codec strings in codecs whose type matches trackType.
-
@Nullable
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getCodecsOfType(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")codecs,
@com.google.android.exoplayer2.C.TrackType int trackType)
Deprecated.
Returns a copy of codecs without the codecs whose track type doesn't match trackType.
Parameters:codecs - A codec sequence string, as defined in RFC 6381.trackType - The track type.Returns:A copy of codecs without the codecs whose track type doesn't match trackType. If this ends up empty, or codecs is null, returns null.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")[] splitCodecs(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")codecs)
Deprecated.
Splits a codecs sequence string, as defined in RFC 6381, into individual codec strings.
Parameters:codecs - A codec sequence string, as defined in RFC 6381.Returns:The split codecs, or an array of length zero if the input was empty or null.
-
public static[Format](../Format.html "class in com.google.android.exoplayer2")getPcmFormat(@com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding,
int channels,
int sampleRate)
Deprecated.
Gets a PCM Format with the specified parameters.
Parameters:pcmEncoding - The C.PcmEncoding.channels - The number of channels, or Format.NO_VALUE if unknown.sampleRate - The sample rate in Hz, or Format.NO_VALUE if unknown.Returns:The PCM format.
-
public static @com.google.android.exoplayer2.C.PcmEncoding int getPcmEncoding(int bitDepth)
Deprecated.
Converts a sample bit depth to a corresponding PCM encoding constant.
Parameters:bitDepth - The bit depth. Supported values are 8, 16, 24 and 32.Returns:The corresponding encoding. One of C.ENCODING_PCM_8BIT, C.ENCODING_PCM_16BIT, C.ENCODING_PCM_24BIT and C.ENCODING_PCM_32BIT. If the bit depth is unsupported then C.ENCODING_INVALID is returned.
-
public static boolean isEncodingLinearPcm(@com.google.android.exoplayer2.C.Encoding int encoding)
Deprecated.
Returns whether encoding is one of the linear PCM encodings.
Parameters:encoding - The encoding of the audio data.Returns:Whether the encoding is one of the PCM encodings.
-
public static boolean isEncodingHighResolutionPcm(@com.google.android.exoplayer2.C.PcmEncoding int encoding)
Deprecated.
Returns whether encoding is high resolution (> 16-bit) PCM.
Parameters:encoding - The encoding of the audio data.Returns:Whether the encoding is high resolution PCM.
-
public static int getAudioTrackChannelConfig(int channelCount)
Deprecated.
Returns the audio track channel configuration for the given channel count, or AudioFormat.CHANNEL_INVALID if output is not possible.
Parameters:channelCount - The number of channels in the input audio.Returns:The channel configuration or AudioFormat.CHANNEL_INVALID if output is not possible.
-
public static int getPcmFrameSize(@com.google.android.exoplayer2.C.PcmEncoding int pcmEncoding,
int channelCount)
Deprecated.
Returns the frame size for audio with channelCount channels in the specified encoding.
Parameters:pcmEncoding - The encoding of the audio data.channelCount - The channel count.Returns:The size of one audio frame in bytes.
-
[@AudioUsage](../C.AudioUsage.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.AudioUsage int getAudioUsageForStreamType([@StreamType](../C.StreamType.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.StreamType int streamType)
Deprecated.
Returns the C.AudioUsage corresponding to the specified C.StreamType.
-
[@AudioContentType](../C.AudioContentType.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.AudioContentType int getAudioContentTypeForStreamType([@StreamType](../C.StreamType.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.StreamType int streamType)
Deprecated.
Returns the C.AudioContentType corresponding to the specified C.StreamType.
-
[@StreamType](../C.StreamType.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.StreamType int getStreamTypeForAudioUsage([@AudioUsage](../C.AudioUsage.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.AudioUsage int usage)
Deprecated.
Returns the C.StreamType corresponding to the specified C.AudioUsage.
-
@RequiresApi(21)
public static int generateAudioSessionIdV21([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
Deprecated.
Returns a newly generated audio session identifier, or AudioManager.ERROR if an error occurred in which case audio playback may fail.
See Also:AudioManager.generateAudioSessionId()
-
@Nullable
public static[UUID](https://developer.android.com/reference/java/util/UUID.html "class or interface in java.util")getDrmUuid([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")drmScheme)
Deprecated.
Derives a DRM UUID from drmScheme.
Parameters:drmScheme - A UUID string, or "widevine", "playready" or "clearkey".Returns:The derived UUID, or null if one could not be derived.
-
[@ErrorCode](../PlaybackException.ErrorCode.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.PlaybackException.ErrorCode int getErrorCodeForMediaDrmErrorCode(int mediaDrmErrorCode)
Deprecated.
Returns a PlaybackException.ErrorCode value that corresponds to the provided MediaDrm.ErrorCodes value. Returns PlaybackException.ERROR_CODE_DRM_SYSTEM_ERROR if the provided error code isn't recognised.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[@ContentType](../C.ContentType.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.ContentType int inferContentType([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri,
@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")overrideExtension)
Deprecated.
Use inferContentTypeForExtension(String) when overrideExtension is non-empty, and inferContentType(Uri) otherwise.
-
[@ContentType](../C.ContentType.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.ContentType int inferContentType([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri)
Deprecated.
Makes a best guess to infer the C.ContentType from a Uri.
Parameters:uri - The Uri.Returns:The content type.
-
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")[@ContentType](../C.ContentType.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.ContentType int inferContentType([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")fileName)
Deprecated.
Use Uri.parse(String) and inferContentType(Uri) for full file paths or inferContentTypeForExtension(String) for extensions.
-
[@ContentType](../C.ContentType.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.ContentType int inferContentTypeForExtension([String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")fileExtension)
Deprecated.
Makes a best guess to infer the C.ContentType from a file extension.
Parameters:fileExtension - The extension of the file (excluding the '.').Returns:The content type.
-
[@ContentType](../C.ContentType.html "annotation in com.google.android.exoplayer2")public static @com.google.android.exoplayer2.C.ContentType int inferContentTypeForUriAndMimeType([Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")uri,
@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Makes a best guess to infer the C.ContentType from a Uri and optional MIME type.
Parameters:uri - The Uri.mimeType - If MIME type, or null.Returns:The content type.
-
@Nullable
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getAdaptiveMimeTypeForContentType([@ContentType](../C.ContentType.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.ContentType int contentType)
Deprecated.
Returns the MIME type corresponding to the given adaptive C.ContentType, or null if the content type is not adaptive.
-
public static[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")fixSmoothStreamingIsmManifestUri([Uri](https://developer.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri)
Deprecated.
If the provided URI is an ISM Presentation URI, returns the URI with "Manifest" appended to its path (i.e., the corresponding default manifest URI). Else returns the provided URI without modification. See [MS-SSTR] v20180912, section 2.2.1.
Parameters:uri - The original URI.Returns:The fixed URI.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getStringForTime([StringBuilder](https://developer.android.com/reference/java/lang/StringBuilder.html?is-external=true "class or interface in java.lang")builder,[Formatter](https://developer.android.com/reference/java/util/Formatter.html "class or interface in java.util")formatter,
long timeMs)
Deprecated.
Returns the specified millisecond time formatted as a string.
Parameters:builder - The builder that formatter will write to.formatter - The formatter.timeMs - The time to format as a string, in milliseconds.Returns:The time formatted as a string.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")escapeFileName([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")fileName)
Deprecated.
Escapes a string so that it's safe for use as a file or directory name on at least FAT32 filesystems. FAT32 is the most restrictive of all filesystems still commonly used today.
For simplicity, this only handles common characters known to be illegal on FAT32: <, >, :, ", /, , |, ?, and *. % is also escaped since it is used as the escape character. Escaping is performed in a consistent way so that no collisions occur and unescapeFileName(String) can be used to retrieve the original file name.
Parameters:fileName - File name to be escaped.Returns:An escaped file name which will be safe for use on at least FAT32 filesystems.
-
@Nullable
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")unescapeFileName([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")fileName)
Deprecated.
Unescapes an escaped file or directory name back to its original value.
See escapeFileName(String) for more information.
Parameters:fileName - File name to be unescaped.Returns:The original value of the file name before it was escaped, or null if the escaped fileName seems invalid.
-
public static[Uri](https://developer.android.com/reference/android/net/Uri.html "class or interface in android.net")getDataUriForString([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")mimeType,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")data)
Deprecated.
Returns a data URI with the specified MIME type and data.
-
public static void sneakyThrow([Throwable](https://developer.android.com/reference/java/lang/Throwable.html "class or interface in java.lang")t)
Deprecated.
A hacky method that always throws t even if t is a checked exception, and is not declared to be thrown.
-
public static void recursiveDelete([File](https://developer.android.com/reference/java/io/File.html "class or interface in java.io")fileOrDirectory)
Deprecated.
Recursively deletes a directory and its content.
-
public static[File](https://developer.android.com/reference/java/io/File.html "class or interface in java.io")createTempDirectory([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")prefix)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Creates an empty directory in the directory returned by Context.getCacheDir().
Throws:IOException
-
public static[File](https://developer.android.com/reference/java/io/File.html "class or interface in java.io")createTempFile([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")prefix)
throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Creates a new empty file in the directory returned by Context.getCacheDir().
Throws:IOException
-
public static int crc32(byte[] bytes,
int start,
int end,
int initialValue)
Deprecated.
Returns the result of updating a CRC-32 with the specified bytes in a "most significant bit first" order.
Parameters:bytes - Array containing the bytes to update the crc value with.start - The index to the first byte in the byte range to update the crc with.end - The index after the last byte in the byte range to update the crc with.initialValue - The initial value for the crc calculation.Returns:The result of updating the initial value with the specified bytes.
-
public static int crc8(byte[] bytes,
int start,
int end,
int initialValue)
Deprecated.
Returns the result of updating a CRC-8 with the specified bytes in a "most significant bit first" order.
Parameters:bytes - Array containing the bytes to update the crc value with.start - The index to the first byte in the byte range to update the crc with.end - The index after the last byte in the byte range to update the crc with.initialValue - The initial value for the crc calculation.Returns:The result of updating the initial value with the specified bytes.
-
public static byte[] gzip(byte[] input)
Deprecated.
Compresses input using gzip and returns the result in a newly allocated byte array.
-
public static int getBigEndianInt([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")buffer,
int index)
Deprecated.
Absolute get method for reading an int value in ByteOrder.BIG_ENDIAN in a ByteBuffer. Same as ByteBuffer.getInt(int) except the buffer's order as returned by ByteBuffer.order() is ignored and ByteOrder.BIG_ENDIAN is used instead.
Parameters:buffer - The buffer from which to read an int in big endian.index - The index from which the bytes will be read.Returns:The int value at the given index with the buffer bytes ordered most significant to least significant.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getCountryCode(@Nullable[Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
Deprecated.
Returns the upper-case ISO 3166-1 alpha-2 country code of the current registered operator's MCC (Mobile Country Code), or the country code of the default Locale if not available.
Parameters:context - A context to access the telephony service. If null, only the Locale can be used.Returns:The upper-case ISO 3166-1 alpha-2 country code, or an empty String if unavailable.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")[] getSystemLanguageCodes()
Deprecated.
Returns a non-empty array of normalized IETF BCP 47 language tags for the system languages ordered by preference.
-
public static[Locale](https://developer.android.com/reference/java/util/Locale.html "class or interface in java.util")getDefaultDisplayLocale()
Deprecated.
Returns the default DISPLAY Locale.
-
public static boolean inflate([ParsableByteArray](ParsableByteArray.html "class in com.google.android.exoplayer2.util")input,[ParsableByteArray](ParsableByteArray.html "class in com.google.android.exoplayer2.util")output,
@Nullable[Inflater](https://developer.android.com/reference/java/util/zip/Inflater.html "class or interface in java.util.zip")inflater)
Deprecated.
Uncompresses the data in input.
Parameters:input - Wraps the compressed input data.output - Wraps an output buffer to be used to store the uncompressed data. If output.data isn't big enough to hold the uncompressed data, a new array is created. If true is returned then the output's position will be set to 0 and its limit will be set to the length of the uncompressed data.inflater - If not null, used to uncompressed the input. Otherwise a new Inflater is created.Returns:Whether the input is uncompressed successfully.
-
public static boolean isTv([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
Deprecated.
Returns whether the app is running on a TV device.
Parameters:context - Any context.Returns:Whether the app is running on a TV device.
-
public static boolean isAutomotive([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context)
Deprecated.
Returns whether the app is running on an automotive device.
Parameters:context - Any context.Returns:Whether the app is running on an automotive device.
-
public static[Point](https://developer.android.com/reference/android/graphics/Point.html "class or interface in android.graphics")getCurrentDisplayModeSize([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context)
Deprecated.
Gets the size of the current mode of the default display, in pixels.
Note that due to application UI scaling, the number of pixels made available to applications (as reported by Display.getSize(Point) may differ from the mode's actual resolution (as reported by this function). For example, applications running on a display configured with a 4K mode may have their UI laid out and rendered in 1080p and then scaled up. Applications can take advantage of the full mode resolution through a SurfaceView using full size buffers.
Parameters:context - Any context.Returns:The size of the current mode, in pixels.
-
public static[Point](https://developer.android.com/reference/android/graphics/Point.html "class or interface in android.graphics")getCurrentDisplayModeSize([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[Display](https://developer.android.com/reference/android/view/Display.html "class or interface in android.view")display)
Deprecated.
Gets the size of the current mode of the specified display, in pixels.
Note that due to application UI scaling, the number of pixels made available to applications (as reported by Display.getSize(Point) may differ from the mode's actual resolution (as reported by this function). For example, applications running on a display configured with a 4K mode may have their UI laid out and rendered in 1080p and then scaled up. Applications can take advantage of the full mode resolution through a SurfaceView using full size buffers.
Parameters:context - Any context.display - The display whose size is to be returned.Returns:The size of the current mode, in pixels.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getTrackTypeString(@com.google.android.exoplayer2.C.TrackType int trackType)
Deprecated.
Returns a string representation of a C.TrackType.
Parameters:trackType - A C.TrackType constant,Returns:A string representation of this constant.
-
public static long getNowUnixTimeMs(long elapsedRealtimeEpochOffsetMs)
Deprecated.
Returns the current time in milliseconds since the epoch.
Parameters:elapsedRealtimeEpochOffsetMs - The offset between SystemClock.elapsedRealtime() and the time since the Unix epoch, or C.TIME_UNSET if unknown.Returns:The Unix time in milliseconds since the epoch.
-
public static <T> void moveItems([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<T> items,
int fromIndex,
int toIndex,
int newFromIndex)
Deprecated.
Moves the elements starting at fromIndex to newFromIndex.
Parameters:items - The list of which to move elements.fromIndex - The index at which the items to move start.toIndex - The index up to which elements should be moved (exclusive).newFromIndex - The new from index.
-
public static boolean tableExists([SQLiteDatabase](https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html "class or interface in android.database.sqlite")database,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")tableName)
Deprecated.
Returns whether the table exists in the database.
-
public static int getErrorCodeFromPlatformDiagnosticsInfo(@Nullable[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")diagnosticsInfo)
Deprecated.
Attempts to parse an error code from a diagnostic string found in framework media exceptions.
For example: android.media.MediaCodec.error_1 or android.media.MediaDrm.error_neg_2.
Parameters:diagnosticsInfo - A string from which to parse the error code.Returns:The parser error code, or 0 if an error code could not be parsed.
-
public static int getMaxPendingFramesCountForMediaCodecDecoders([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")codecName,
boolean requestedHdrToneMapping)
Deprecated.
Returns the number of maximum pending output frames that are allowed on a MediaCodec decoder.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getFormatSupportString([@FormatSupport](../C.FormatSupport.html "annotation in com.google.android.exoplayer2")@com.google.android.exoplayer2.C.FormatSupport int formatSupport)
Deprecated.
Returns string representation of a C.FormatSupport flag.
Parameters:formatSupport - A C.FormatSupport flag.Returns:A string representation of the flag.
-
public static[Player.Commands](../Player.Commands.html "class in com.google.android.exoplayer2")getAvailableCommands([Player](../Player.html "interface in com.google.android.exoplayer2")player,[Player.Commands](../Player.Commands.html "class in com.google.android.exoplayer2")permanentAvailableCommands)
Deprecated.
Returns the Player.Commands available in the Player.
Parameters:player - The Player.permanentAvailableCommands - The commands permanently available in the player.Returns:The available Player.Commands.
-
public static long sum(long... summands)
Deprecated.
Returns the sum of all summands of the given array.
Parameters:summands - The summands to calculate the sum from.Returns:The sum of all summands.
-
public static[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html "class or interface in android.graphics.drawable")getDrawable([Context](https://developer.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[Resources](https://developer.android.com/reference/android/content/res/Resources.html "class or interface in android.content.res")resources,
@DrawableRes
int drawableRes)
Deprecated.
Returns a Drawable for the given resource or throws a Resources.NotFoundException if not found.
Parameters:context - The context to get the theme from starting with API 21.resources - The resources to load the drawable from.drawableRes - The drawable resource int.Returns:The loaded Drawable.
-
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")intToStringMaxRadix(int i)
Deprecated.
Returns a string representation of the integer using radix value Character.MAX_RADIX.
Parameters:i - An integer to be converted to String.
-
@EnsuresNonNullIf(result=false,
expression="#1")
public static boolean shouldShowPlayButton(@Nullable[Player](../Player.html "interface in com.google.android.exoplayer2")player)
Deprecated.
Returns whether a play button should be presented on a UI element for playback control. If false, a pause button should be shown instead.
Use handlePlayPauseButtonAction(com.google.android.exoplayer2.Player), handlePlayButtonAction(com.google.android.exoplayer2.Player) or handlePauseButtonAction(com.google.android.exoplayer2.Player) to handle the interaction with the play or pause button UI element.
Parameters:player - The Player. May be null.
-
public static boolean handlePlayButtonAction(@Nullable[Player](../Player.html "interface in com.google.android.exoplayer2")player)
Deprecated.
Updates the player to handle an interaction with a play button.
This method assumes the play button is enabled if shouldShowPlayButton(com.google.android.exoplayer2.Player) returns true.
Parameters:player - The Player. May be null.Returns:Whether a player method was triggered to handle this action.
-
public static boolean handlePauseButtonAction(@Nullable[Player](../Player.html "interface in com.google.android.exoplayer2")player)
Deprecated.
Updates the player to handle an interaction with a pause button.
This method assumes the pause button is enabled if shouldShowPlayButton(com.google.android.exoplayer2.Player) returns false.
Parameters:player - The Player. May be null.Returns:Whether a player method was triggered to handle this action.
-
public static boolean handlePlayPauseButtonAction(@Nullable[Player](../Player.html "interface in com.google.android.exoplayer2")player)
Deprecated.
Updates the player to handle an interaction with a play or pause button.
This method assumes that the UI element enables a play button if shouldShowPlayButton(com.google.android.exoplayer2.Player) returns true and a pause button otherwise.
Parameters:player - The Player. May be null.Returns:Whether a player method was triggered to handle this action.