Deprecated onTransformationError methods are not called.

When a listener method is deprecated, the new method should (by
default) called through to the deprecated one. This is because any
class that implements the method that is now deprecated needs to still
receive that callback.

It appears when onTransformationError(MediaItem, Exception) was
deprecated in favour of onTransformationError(MediaItem,
TransformationException), this deprecation was the wrong way round, and
the newer callback - onTransformationError(MediaItem,
TransformationResult, TransformationException) continued this mistake.

This CL now corrects this.

PiperOrigin-RevId: 498221504
This commit is contained in:
samrobinson 2022-12-28 19:40:51 +00:00 committed by Marc Baechinger
parent 310434a8f9
commit 4541db3541

View File

@ -498,10 +498,9 @@ public final class Transformer {
* Called when the transformation is completed successfully.
*
* @param inputMediaItem The {@link MediaItem} for which the transformation is completed.
* @param transformationResult The {@link TransformationResult} of the transformation.
* @param result The {@link TransformationResult} of the transformation.
*/
default void onTransformationCompleted(
MediaItem inputMediaItem, TransformationResult transformationResult) {
default void onTransformationCompleted(MediaItem inputMediaItem, TransformationResult result) {
onTransformationCompleted(inputMediaItem);
}
@ -510,9 +509,7 @@ public final class Transformer {
* TransformationException)}.
*/
@Deprecated
default void onTransformationError(MediaItem inputMediaItem, Exception exception) {
onTransformationError(inputMediaItem, (TransformationException) exception);
}
default void onTransformationError(MediaItem inputMediaItem, Exception exception) {}
/**
* @deprecated Use {@link #onTransformationError(MediaItem, TransformationResult,
@ -521,7 +518,7 @@ public final class Transformer {
@Deprecated
default void onTransformationError(
MediaItem inputMediaItem, TransformationException exception) {
onTransformationError(inputMediaItem, new TransformationResult.Builder().build(), exception);
onTransformationError(inputMediaItem, (Exception) exception);
}
/**
@ -532,7 +529,9 @@ public final class Transformer {
* @param exception The {@link TransformationException} describing the exception.
*/
default void onTransformationError(
MediaItem inputMediaItem, TransformationResult result, TransformationException exception) {}
MediaItem inputMediaItem, TransformationResult result, TransformationException exception) {
onTransformationError(inputMediaItem, exception);
}
/**
* Called when fallback to an alternative {@link TransformationRequest} is necessary to comply