Commit 20fb153c by huangdarwin Committed by tonihei

Use static asserts more often.

PiperOrigin-RevId: 415529751
parent 6cc7d058
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package androidx.media3.transformer.mh; package androidx.media3.transformer.mh;
import static androidx.media3.common.util.Assertions.checkState;
import static com.google.common.truth.Truth.assertWithMessage; import static com.google.common.truth.Truth.assertWithMessage;
import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.concurrent.TimeUnit.SECONDS;
...@@ -23,7 +24,6 @@ import android.net.Uri; ...@@ -23,7 +24,6 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.media3.common.MediaItem; import androidx.media3.common.MediaItem;
import androidx.media3.common.util.Assertions;
import androidx.media3.transformer.Transformer; import androidx.media3.transformer.Transformer;
import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.platform.app.InstrumentationRegistry;
import java.io.File; import java.io.File;
...@@ -135,9 +135,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; ...@@ -135,9 +135,8 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
private static File createExternalCacheFile(Context context, String fileName) throws IOException { private static File createExternalCacheFile(Context context, String fileName) throws IOException {
File file = new File(context.getExternalCacheDir(), fileName); File file = new File(context.getExternalCacheDir(), fileName);
Assertions.checkState( checkState(!file.exists() || file.delete(), "Could not delete file: " + file.getAbsolutePath());
!file.exists() || file.delete(), "Could not delete file: " + file.getAbsolutePath()); checkState(file.createNewFile(), "Could not create file: " + file.getAbsolutePath());
Assertions.checkState(file.createNewFile(), "Could not create file: " + file.getAbsolutePath());
return file; return file;
} }
......
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