Replace Util.MANUFACTURER with Build.MANUFACTURER

This commit is contained in:
Gaëtan Muller 2025-02-04 15:04:08 +01:00
parent d0a3d31e56
commit 2aab921aa2
No known key found for this signature in database
GPG Key ID: 928605644A8CA2A7
10 changed files with 18 additions and 17 deletions

View File

@ -33,6 +33,7 @@ import android.opengl.GLES20;
import android.opengl.GLES30; import android.opengl.GLES30;
import android.opengl.GLUtils; import android.opengl.GLUtils;
import android.opengl.Matrix; import android.opengl.Matrix;
import android.os.Build;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
@ -170,7 +171,8 @@ public final class GlUtil {
if (Util.SDK_INT < 24) { if (Util.SDK_INT < 24) {
return false; return false;
} }
if (Util.SDK_INT < 26 && ("samsung".equals(Util.MANUFACTURER) || "XT1650".equals(Util.MODEL))) { if (Util.SDK_INT < 26
&& ("samsung".equals(Build.MANUFACTURER) || "XT1650".equals(Util.MODEL))) {
// Samsung devices running Nougat are known to be broken. See // Samsung devices running Nougat are known to be broken. See
// https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802]. // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802].
// Moto Z XT1650 is also affected. See // Moto Z XT1650 is also affected. See

View File

@ -165,12 +165,9 @@ public final class Util {
@UnstableApi @Deprecated public static final String DEVICE = Build.DEVICE; @UnstableApi @Deprecated public static final String DEVICE = Build.DEVICE;
/** /**
* Like {@link Build#MANUFACTURER}, but in a place where it can be conveniently overridden for * @deprecated Use {@link Build#MANUFACTURER} instead.
* local testing.
*/ */
// TODO: b/384699964 - Deprecate this and migrate usages to Build.MANUFACTURER which works better @UnstableApi @Deprecated public static final String MANUFACTURER = Build.MANUFACTURER;
// with Robolectric's ShadowBuild.setManufacturer().
@UnstableApi public static final String MANUFACTURER = Build.MANUFACTURER;
/** /**
* Like {@link Build#MODEL}, but in a place where it can be conveniently overridden for local * Like {@link Build#MODEL}, but in a place where it can be conveniently overridden for local
@ -183,7 +180,7 @@ public final class Util {
/** A concise description of the device that it can be useful to log for debugging purposes. */ /** A concise description of the device that it can be useful to log for debugging purposes. */
@UnstableApi @UnstableApi
public static final String DEVICE_DEBUG_INFO = public static final String DEVICE_DEBUG_INFO =
Build.DEVICE + ", " + MODEL + ", " + MANUFACTURER + ", " + SDK_INT; Build.DEVICE + ", " + MODEL + ", " + Build.MANUFACTURER + ", " + SDK_INT;
/** An empty byte array. */ /** An empty byte array. */
@UnstableApi public static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; @UnstableApi public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
@ -3242,7 +3239,7 @@ public final class Util {
} }
// Sony Android TVs advertise support for 4k output via a system feature. // Sony Android TVs advertise support for 4k output via a system feature.
if ("Sony".equals(MANUFACTURER) if ("Sony".equals(Build.MANUFACTURER)
&& MODEL.startsWith("BRAVIA") && MODEL.startsWith("BRAVIA")
&& context.getPackageManager().hasSystemFeature("com.sony.dtv.hardware.panel.qfhd")) { && context.getPackageManager().hasSystemFeature("com.sony.dtv.hardware.panel.qfhd")) {
return new Point(3840, 2160); return new Point(3840, 2160);

View File

@ -1072,7 +1072,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
// The workaround applies to Samsung Galaxy S6 and Samsung Galaxy S7. // The workaround applies to Samsung Galaxy S6 and Samsung Galaxy S7.
return Util.SDK_INT < 24 return Util.SDK_INT < 24
&& "OMX.SEC.aac.dec".equals(codecName) && "OMX.SEC.aac.dec".equals(codecName)
&& "samsung".equals(Util.MANUFACTURER) && "samsung".equals(Build.MANUFACTURER)
&& (Build.DEVICE.startsWith("zeroflte") && (Build.DEVICE.startsWith("zeroflte")
|| Build.DEVICE.startsWith("herolte") || Build.DEVICE.startsWith("herolte")
|| Build.DEVICE.startsWith("heroqlte")); || Build.DEVICE.startsWith("heroqlte"));

View File

@ -17,6 +17,7 @@ package androidx.media3.exoplayer.drm;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.media.MediaCrypto; import android.media.MediaCrypto;
import android.os.Build;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
@ -36,7 +37,7 @@ public final class FrameworkCryptoConfig implements CryptoConfig {
* configuration. * configuration.
*/ */
public static final boolean WORKAROUND_DEVICE_NEEDS_KEYS_TO_CONFIGURE_CODEC = public static final boolean WORKAROUND_DEVICE_NEEDS_KEYS_TO_CONFIGURE_CODEC =
"Amazon".equals(Util.MANUFACTURER) "Amazon".equals(Build.MANUFACTURER)
&& ("AFTM".equals(Util.MODEL) // Fire TV Stick Gen 1 && ("AFTM".equals(Util.MODEL) // Fire TV Stick Gen 1
|| "AFTB".equals(Util.MODEL)); // Fire TV Gen 1 || "AFTB".equals(Util.MODEL)); // Fire TV Gen 1

View File

@ -26,6 +26,7 @@ import android.media.MediaDrmException;
import android.media.NotProvisionedException; import android.media.NotProvisionedException;
import android.media.UnsupportedSchemeException; import android.media.UnsupportedSchemeException;
import android.media.metrics.LogSessionId; import android.media.metrics.LogSessionId;
import android.os.Build;
import android.os.PersistableBundle; import android.os.PersistableBundle;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -499,7 +500,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
// Some Amazon devices also require data to be extracted from the PSSH atom for PlayReady. // Some Amazon devices also require data to be extracted from the PSSH atom for PlayReady.
if ((Util.SDK_INT < 23 && C.WIDEVINE_UUID.equals(uuid)) if ((Util.SDK_INT < 23 && C.WIDEVINE_UUID.equals(uuid))
|| (C.PLAYREADY_UUID.equals(uuid) || (C.PLAYREADY_UUID.equals(uuid)
&& "Amazon".equals(Util.MANUFACTURER) && "Amazon".equals(Build.MANUFACTURER)
&& ("AFTB".equals(Util.MODEL) // Fire TV Gen 1 && ("AFTB".equals(Util.MODEL) // Fire TV Gen 1
|| "AFTS".equals(Util.MODEL) // Fire TV Gen 2 || "AFTS".equals(Util.MODEL) // Fire TV Gen 2
|| "AFTM".equals(Util.MODEL) // Fire TV Stick Gen 1 || "AFTM".equals(Util.MODEL) // Fire TV Stick Gen 1

View File

@ -2617,7 +2617,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|| "OMX.bcm.vdec.avc.tunnel.secure".equals(name) || "OMX.bcm.vdec.avc.tunnel.secure".equals(name)
|| "OMX.bcm.vdec.hevc.tunnel".equals(name) || "OMX.bcm.vdec.hevc.tunnel".equals(name)
|| "OMX.bcm.vdec.hevc.tunnel.secure".equals(name))) || "OMX.bcm.vdec.hevc.tunnel.secure".equals(name)))
|| ("Amazon".equals(Util.MANUFACTURER) && "AFTS".equals(Util.MODEL) && codecInfo.secure); || ("Amazon".equals(Build.MANUFACTURER) && "AFTS".equals(Util.MODEL) && codecInfo.secure);
} }
/** /**

View File

@ -559,7 +559,7 @@ public final class MediaCodecUtil {
// Work around https://github.com/google/ExoPlayer/issues/3249. // Work around https://github.com/google/ExoPlayer/issues/3249.
if (Util.SDK_INT < 24 if (Util.SDK_INT < 24
&& ("OMX.SEC.aac.dec".equals(name) || "OMX.Exynos.AAC.Decoder".equals(name)) && ("OMX.SEC.aac.dec".equals(name) || "OMX.Exynos.AAC.Decoder".equals(name))
&& "samsung".equals(Util.MANUFACTURER) && "samsung".equals(Build.MANUFACTURER)
&& (Build.DEVICE.startsWith("zeroflte") // Galaxy S6 && (Build.DEVICE.startsWith("zeroflte") // Galaxy S6
|| Build.DEVICE.startsWith("zerolte") // Galaxy S6 Edge || Build.DEVICE.startsWith("zerolte") // Galaxy S6 Edge
|| Build.DEVICE.startsWith("zenlte") // Galaxy S6 Edge+ || Build.DEVICE.startsWith("zenlte") // Galaxy S6 Edge+

View File

@ -1265,7 +1265,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
getMaxSampleSize(/* pixelCount= */ width * height, /* minCompressionRatio= */ 2)); getMaxSampleSize(/* pixelCount= */ width * height, /* minCompressionRatio= */ 2));
case MimeTypes.VIDEO_H264: case MimeTypes.VIDEO_H264:
if ("BRAVIA 4K 2015".equals(Util.MODEL) // Sony Bravia 4K if ("BRAVIA 4K 2015".equals(Util.MODEL) // Sony Bravia 4K
|| ("Amazon".equals(Util.MANUFACTURER) || ("Amazon".equals(Build.MANUFACTURER)
&& ("KFSOWI".equals(Util.MODEL) // Kindle Soho && ("KFSOWI".equals(Util.MODEL) // Kindle Soho
|| ("AFTS".equals(Util.MODEL) && codecInfo.secure)))) { // Fire TV Gen 2 || ("AFTS".equals(Util.MODEL) && codecInfo.secure)))) { // Fire TV Gen 2
// Use the default value for cases where platform limitations may prevent buffers of the // Use the default value for cases where platform limitations may prevent buffers of the
@ -2294,7 +2294,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
// also lose sync [Internal: b/26453592]. Even after M, the devices may apply post processing // also lose sync [Internal: b/26453592]. Even after M, the devices may apply post processing
// operations that can modify frame output timestamps, which is incompatible with ExoPlayer's // operations that can modify frame output timestamps, which is incompatible with ExoPlayer's
// logic for skipping decode-only frames. // logic for skipping decode-only frames.
return "NVIDIA".equals(Util.MANUFACTURER); return "NVIDIA".equals(Build.MANUFACTURER);
} }
/* /*

View File

@ -381,7 +381,7 @@ public class ExportTest {
public void exportTranscodeBt2020Sdr() throws Exception { public void exportTranscodeBt2020Sdr() throws Exception {
Context context = ApplicationProvider.getApplicationContext(); Context context = ApplicationProvider.getApplicationContext();
// Reference: b/262732842#comment51 // Reference: b/262732842#comment51
if (SDK_INT <= 27 && Util.MANUFACTURER.equals("samsung")) { if (SDK_INT <= 27 && Build.MANUFACTURER.equals("samsung")) {
String reason = "Some older Samsung encoders report a non-specified error code"; String reason = "Some older Samsung encoders report a non-specified error code";
recordTestSkipped(context, testId, reason); recordTestSkipped(context, testId, reason);
throw new AssumptionViolatedException(reason); throw new AssumptionViolatedException(reason);

View File

@ -427,7 +427,7 @@ public final class DefaultDecoderFactory implements Codec.DecoderFactory {
private static boolean deviceNeedsDisableToneMappingWorkaround( private static boolean deviceNeedsDisableToneMappingWorkaround(
@C.ColorTransfer int colorTransfer) { @C.ColorTransfer int colorTransfer) {
if (Util.MANUFACTURER.equals("Google") && Build.ID.startsWith("TP1A")) { if (Build.MANUFACTURER.equals("Google") && Build.ID.startsWith("TP1A")) {
// Some Pixel 6 builds report support for tone mapping but the feature doesn't work // Some Pixel 6 builds report support for tone mapping but the feature doesn't work
// (see b/249297370#comment8). // (see b/249297370#comment8).
return true; return true;