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