Commit 6157c615 by ibaker Committed by Christos Tsilopoulos

Standardise API-level specific nested classes

This change aligns all the names for classes that are 'holders of static
methods' to be `ApiNN`. Classes that hold state are named meaningfully
based on that state.

PiperOrigin-RevId: 388641064
parent 5e4cd129
......@@ -93,7 +93,7 @@ public final class AudioCapabilities {
// it on TV devices, which generally shouldn't support audio offload for surround encodings.
if (Util.SDK_INT >= 29 && Util.isTv(context)) {
return new AudioCapabilities(
Api29.getDirectPlaybackSupportedEncodingsV29(), DEFAULT_MAX_CHANNEL_COUNT);
Api29.getDirectPlaybackSupportedEncodings(), DEFAULT_MAX_CHANNEL_COUNT);
}
if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) {
return DEFAULT_AUDIO_CAPABILITIES;
......@@ -190,7 +190,7 @@ public final class AudioCapabilities {
@RequiresApi(29)
private static final class Api29 {
@DoNotInline
public static int[] getDirectPlaybackSupportedEncodingsV29() {
public static int[] getDirectPlaybackSupportedEncodings() {
ImmutableList.Builder<Integer> supportedEncodingsListBuilder = ImmutableList.builder();
for (int encoding : ALL_SURROUND_ENCODINGS) {
if (AudioTrack.isDirectPlaybackSupported(
......
......@@ -64,16 +64,13 @@ public final class DrmUtil {
@PlaybackException.ErrorCode
public static int getErrorCodeForMediaDrmException(
Exception exception, @ErrorSource int errorSource) {
if (Util.SDK_INT >= 21 && PlatformOperationsWrapperV21.isMediaDrmStateException(exception)) {
return PlatformOperationsWrapperV21.mediaDrmStateExceptionToErrorCode(exception);
} else if (Util.SDK_INT >= 23
&& PlatformOperationsWrapperV23.isMediaDrmResetException(exception)) {
if (Util.SDK_INT >= 21 && Api21.isMediaDrmStateException(exception)) {
return Api21.mediaDrmStateExceptionToErrorCode(exception);
} else if (Util.SDK_INT >= 23 && Api23.isMediaDrmResetException(exception)) {
return PlaybackException.ERROR_CODE_DRM_SYSTEM_ERROR;
} else if (Util.SDK_INT >= 18
&& PlatformOperationsWrapperV18.isNotProvisionedException(exception)) {
} else if (Util.SDK_INT >= 18 && Api18.isNotProvisionedException(exception)) {
return PlaybackException.ERROR_CODE_DRM_PROVISIONING_FAILED;
} else if (Util.SDK_INT >= 18
&& PlatformOperationsWrapperV18.isDeniedByServerException(exception)) {
} else if (Util.SDK_INT >= 18 && Api18.isDeniedByServerException(exception)) {
return PlaybackException.ERROR_CODE_DRM_DEVICE_REVOKED;
} else if (exception instanceof UnsupportedDrmException) {
return PlaybackException.ERROR_CODE_DRM_SCHEME_UNSUPPORTED;
......@@ -98,7 +95,7 @@ public final class DrmUtil {
// Internal classes.
@RequiresApi(18)
private static final class PlatformOperationsWrapperV18 {
private static final class Api18 {
@DoNotInline
public static boolean isNotProvisionedException(@Nullable Throwable throwable) {
......@@ -112,7 +109,7 @@ public final class DrmUtil {
}
@RequiresApi(21)
private static final class PlatformOperationsWrapperV21 {
private static final class Api21 {
@DoNotInline
public static boolean isMediaDrmStateException(@Nullable Throwable throwable) {
......@@ -130,7 +127,7 @@ public final class DrmUtil {
}
@RequiresApi(23)
private static final class PlatformOperationsWrapperV23 {
private static final class Api23 {
@DoNotInline
public static boolean isMediaDrmResetException(@Nullable Throwable throwable) {
......
......@@ -192,7 +192,7 @@ public final class FileDataSource extends BaseDataSource {
// different SDK versions.
throw new FileDataSourceException(
e,
Util.SDK_INT >= 21 && PlatformOperationsWrapperV21.isPermissionError(e.getCause())
Util.SDK_INT >= 21 && Api21.isPermissionError(e.getCause())
? PlaybackException.ERROR_CODE_IO_NO_PERMISSION
: PlaybackException.ERROR_CODE_IO_FILE_NOT_FOUND);
} catch (SecurityException e) {
......@@ -203,7 +203,7 @@ public final class FileDataSource extends BaseDataSource {
}
@RequiresApi(21)
private static final class PlatformOperationsWrapperV21 {
private static final class Api21 {
@DoNotInline
private static boolean isPermissionError(@Nullable Throwable e) {
return e instanceof ErrnoException && ((ErrnoException) e).errno == OsConstants.EACCES;
......
......@@ -347,7 +347,7 @@ public final class VideoFrameReleaseHelper {
return;
}
this.surfacePlaybackFrameRate = surfacePlaybackFrameRate;
SurfaceApi30.setFrameRate(surface, surfacePlaybackFrameRate);
Api30.setSurfaceFrameRate(surface, surfacePlaybackFrameRate);
}
/** Clears the frame-rate of the current {@link #surface}. */
......@@ -356,7 +356,7 @@ public final class VideoFrameReleaseHelper {
return;
}
surfacePlaybackFrameRate = 0;
SurfaceApi30.setFrameRate(surface, /* frameRate= */ 0);
Api30.setSurfaceFrameRate(surface, /* frameRate= */ 0);
}
// Display refresh rate and vsync logic.
......@@ -408,9 +408,9 @@ public final class VideoFrameReleaseHelper {
// Nested classes.
@RequiresApi(30)
private static final class SurfaceApi30 {
private static final class Api30 {
@DoNotInline
public static void setFrameRate(Surface surface, float frameRate) {
public static void setSurfaceFrameRate(Surface surface, float frameRate) {
int compatibility =
frameRate == 0
? Surface.FRAME_RATE_COMPATIBILITY_DEFAULT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment