Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
This commit is contained in:
parent
21d4e85817
commit
99cdc515ae
@ -200,7 +200,7 @@ public final class Util {
|
||||
@UnstableApi
|
||||
@Nullable
|
||||
public static ComponentName startForegroundService(Context context, Intent intent) {
|
||||
if (Util.SDK_INT >= 26) {
|
||||
if (SDK_INT >= 26) {
|
||||
return context.startForegroundService(intent);
|
||||
} else {
|
||||
return context.startService(intent);
|
||||
@ -216,7 +216,7 @@ public final class Util {
|
||||
* @return Whether a permission request was made.
|
||||
*/
|
||||
public static boolean maybeRequestReadExternalStoragePermission(Activity activity, Uri... uris) {
|
||||
if (Util.SDK_INT < 23) {
|
||||
if (SDK_INT < 23) {
|
||||
return false;
|
||||
}
|
||||
for (Uri uri : uris) {
|
||||
@ -239,7 +239,7 @@ public final class Util {
|
||||
*/
|
||||
public static boolean maybeRequestReadExternalStoragePermission(
|
||||
Activity activity, MediaItem... mediaItems) {
|
||||
if (Util.SDK_INT < 23) {
|
||||
if (SDK_INT < 23) {
|
||||
return false;
|
||||
}
|
||||
for (MediaItem mediaItem : mediaItems) {
|
||||
@ -261,7 +261,7 @@ public final class Util {
|
||||
}
|
||||
|
||||
private static boolean maybeRequestReadExternalStoragePermission(Activity activity, Uri uri) {
|
||||
return Util.SDK_INT >= 23 && (isLocalFileUri(uri) || isMediaStoreExternalContentUri(uri))
|
||||
return SDK_INT >= 23 && (isLocalFileUri(uri) || isMediaStoreExternalContentUri(uri))
|
||||
? requestExternalStoragePermission(activity)
|
||||
: false;
|
||||
}
|
||||
@ -287,7 +287,7 @@ public final class Util {
|
||||
* @return Whether it may be possible to load the URIs of the given media items.
|
||||
*/
|
||||
public static boolean checkCleartextTrafficPermitted(MediaItem... mediaItems) {
|
||||
if (Util.SDK_INT < 24) {
|
||||
if (SDK_INT < 24) {
|
||||
// We assume cleartext traffic is permitted.
|
||||
return true;
|
||||
}
|
||||
@ -672,7 +672,7 @@ public final class Util {
|
||||
normalizedTag = language;
|
||||
}
|
||||
normalizedTag = Ascii.toLowerCase(normalizedTag);
|
||||
String mainLanguage = Util.splitAtFirst(normalizedTag, "-")[0];
|
||||
String mainLanguage = splitAtFirst(normalizedTag, "-")[0];
|
||||
if (languageTagReplacementMap == null) {
|
||||
languageTagReplacementMap = createIsoLanguageReplacementMap();
|
||||
}
|
||||
@ -1734,9 +1734,9 @@ public final class Util {
|
||||
case 7:
|
||||
return AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER;
|
||||
case 8:
|
||||
if (Util.SDK_INT >= 23) {
|
||||
if (SDK_INT >= 23) {
|
||||
return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
|
||||
} else if (Util.SDK_INT >= 21) {
|
||||
} else if (SDK_INT >= 21) {
|
||||
// Equal to AudioFormat.CHANNEL_OUT_7POINT1_SURROUND, which is hidden before Android M.
|
||||
return AudioFormat.CHANNEL_OUT_5POINT1
|
||||
| AudioFormat.CHANNEL_OUT_SIDE_LEFT
|
||||
@ -2027,7 +2027,7 @@ public final class Util {
|
||||
public static @ContentType int inferContentTypeForUriAndMimeType(
|
||||
Uri uri, @Nullable String mimeType) {
|
||||
if (mimeType == null) {
|
||||
return Util.inferContentType(uri);
|
||||
return inferContentType(uri);
|
||||
}
|
||||
switch (mimeType) {
|
||||
case MimeTypes.APPLICATION_MPD:
|
||||
@ -2367,7 +2367,7 @@ public final class Util {
|
||||
/** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */
|
||||
@UnstableApi
|
||||
public static Locale getDefaultDisplayLocale() {
|
||||
return Util.SDK_INT >= 24 ? Locale.getDefault(Locale.Category.DISPLAY) : Locale.getDefault();
|
||||
return SDK_INT >= 24 ? Locale.getDefault(Locale.Category.DISPLAY) : Locale.getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2442,7 +2442,7 @@ public final class Util {
|
||||
*/
|
||||
@UnstableApi
|
||||
public static boolean isAutomotive(Context context) {
|
||||
return Util.SDK_INT >= 23
|
||||
return SDK_INT >= 23
|
||||
&& context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
|
||||
}
|
||||
|
||||
@ -2461,7 +2461,7 @@ public final class Util {
|
||||
@UnstableApi
|
||||
public static Point getCurrentDisplayModeSize(Context context) {
|
||||
@Nullable Display defaultDisplay = null;
|
||||
if (Util.SDK_INT >= 17) {
|
||||
if (SDK_INT >= 17) {
|
||||
@Nullable
|
||||
DisplayManager displayManager =
|
||||
(DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
|
||||
@ -2510,7 +2510,7 @@ public final class Util {
|
||||
// vendor.display-size instead.
|
||||
@Nullable
|
||||
String displaySize =
|
||||
Util.SDK_INT < 28
|
||||
SDK_INT < 28
|
||||
? getSystemProperty("sys.display-size")
|
||||
: getSystemProperty("vendor.display-size");
|
||||
// If we managed to read the display size, attempt to parse it.
|
||||
@ -2531,17 +2531,17 @@ public final class Util {
|
||||
}
|
||||
|
||||
// Sony Android TVs advertise support for 4k output via a system feature.
|
||||
if ("Sony".equals(Util.MANUFACTURER)
|
||||
&& Util.MODEL.startsWith("BRAVIA")
|
||||
if ("Sony".equals(MANUFACTURER)
|
||||
&& MODEL.startsWith("BRAVIA")
|
||||
&& context.getPackageManager().hasSystemFeature("com.sony.dtv.hardware.panel.qfhd")) {
|
||||
return new Point(3840, 2160);
|
||||
}
|
||||
}
|
||||
|
||||
Point displaySize = new Point();
|
||||
if (Util.SDK_INT >= 23) {
|
||||
if (SDK_INT >= 23) {
|
||||
getDisplaySizeV23(display, displaySize);
|
||||
} else if (Util.SDK_INT >= 17) {
|
||||
} else if (SDK_INT >= 17) {
|
||||
getDisplaySizeV17(display, displaySize);
|
||||
} else {
|
||||
getDisplaySizeV16(display, displaySize);
|
||||
@ -2768,7 +2768,7 @@ public final class Util {
|
||||
|
||||
@RequiresApi(24)
|
||||
private static String[] getSystemLocalesV24(Configuration config) {
|
||||
return Util.split(config.getLocales().toLanguageTags(), ",");
|
||||
return split(config.getLocales().toLanguageTags(), ",");
|
||||
}
|
||||
|
||||
@RequiresApi(21)
|
||||
|
Loading…
x
Reference in New Issue
Block a user