Skip to content

Commit

Permalink
Cleanup: Remove unnecessary self-refs in Util
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 455121899
  • Loading branch information
ojw28 authored and marcbaechinger committed Jun 15, 2022
1 parent 10050a1 commit 545cd1e
Showing 1 changed file with 18 additions and 18 deletions.
Expand Up @@ -196,7 +196,7 @@ public static byte[] toByteArray(InputStream inputStream) throws IOException {
*/
@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);
Expand All @@ -212,7 +212,7 @@ public static ComponentName startForegroundService(Context context, Intent inten
* @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) {
Expand All @@ -235,7 +235,7 @@ public static boolean maybeRequestReadExternalStoragePermission(Activity activit
*/
public static boolean maybeRequestReadExternalStoragePermission(
Activity activity, MediaItem... mediaItems) {
if (Util.SDK_INT < 23) {
if (SDK_INT < 23) {
return false;
}
for (MediaItem mediaItem : mediaItems) {
Expand All @@ -257,7 +257,7 @@ public static boolean maybeRequestReadExternalStoragePermission(
}

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;
}
Expand All @@ -283,7 +283,7 @@ private static boolean isMediaStoreExternalContentUri(Uri uri) {
* @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;
}
Expand Down Expand Up @@ -644,7 +644,7 @@ public static String getLocaleLanguageTag(Locale locale) {
normalizedTag = language;
}
normalizedTag = Ascii.toLowerCase(normalizedTag);
String mainLanguage = Util.splitAtFirst(normalizedTag, "-")[0];
String mainLanguage = splitAtFirst(normalizedTag, "-")[0];
if (languageTagReplacementMap == null) {
languageTagReplacementMap = createIsoLanguageReplacementMap();
}
Expand Down Expand Up @@ -1655,9 +1655,9 @@ public static int getAudioTrackChannelConfig(int channelCount) {
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
Expand Down Expand Up @@ -1940,7 +1940,7 @@ public static UUID getDrmUuid(String drmScheme) {
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:
Expand Down Expand Up @@ -2264,7 +2264,7 @@ public static String[] getSystemLanguageCodes() {

/** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */
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();
}

/**
Expand Down Expand Up @@ -2336,7 +2336,7 @@ public static boolean isTv(Context context) {
* @return Whether the app is running on an automotive device.
*/
public static boolean isAutomotive(Context context) {
return Util.SDK_INT >= 23
return SDK_INT >= 23
&& context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
}

Expand All @@ -2354,7 +2354,7 @@ public static boolean isAutomotive(Context context) {
*/
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);
Expand Down Expand Up @@ -2402,7 +2402,7 @@ public static Point getCurrentDisplayModeSize(Context context, Display display)
// 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.
Expand All @@ -2423,17 +2423,17 @@ public static Point getCurrentDisplayModeSize(Context context, Display display)
}

// 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);
Expand Down Expand Up @@ -2652,7 +2652,7 @@ private static String[] getSystemLocales() {

@RequiresApi(24)
private static String[] getSystemLocalesV24(Configuration config) {
return Util.split(config.getLocales().toLanguageTags(), ",");
return split(config.getLocales().toLanguageTags(), ",");
}

@RequiresApi(21)
Expand Down

0 comments on commit 545cd1e

Please sign in to comment.