diff options
6 files changed, 13 insertions, 15 deletions
diff --git a/packages/SettingsLib/Utils/Android.bp b/packages/SettingsLib/Utils/Android.bp index d64fe7fb0009..7d5eb69190b6 100644 --- a/packages/SettingsLib/Utils/Android.bp +++ b/packages/SettingsLib/Utils/Android.bp @@ -15,7 +15,6 @@ android_library { static_libs: [ "androidx.annotation_annotation", - "modules-utils-build", ], sdk_version: "system_current", diff --git a/packages/SettingsLib/Utils/src/com/android/settingslib/utils/BuildCompatUtils.java b/packages/SettingsLib/Utils/src/com/android/settingslib/utils/BuildCompatUtils.java index fc945040fc83..ddbc907018c8 100644 --- a/packages/SettingsLib/Utils/src/com/android/settingslib/utils/BuildCompatUtils.java +++ b/packages/SettingsLib/Utils/src/com/android/settingslib/utils/BuildCompatUtils.java @@ -17,11 +17,10 @@ package com.android.settingslib.utils; import android.os.Build; +import android.os.Build.VERSION; import androidx.annotation.ChecksSdkIntAtLeast; -import com.android.modules.utils.build.SdkLevel; - /** * An util class to check whether the current OS version is higher or equal to sdk version of * device. @@ -35,7 +34,7 @@ public final class BuildCompatUtils { */ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.S) public static boolean isAtLeastS() { - return SdkLevel.isAtLeastS(); + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S; } /** @@ -45,7 +44,7 @@ public final class BuildCompatUtils { */ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.S_V2) public static boolean isAtLeastSV2() { - return SdkLevel.isAtLeastSv2(); + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2; } /** @@ -55,7 +54,7 @@ public final class BuildCompatUtils { */ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.TIRAMISU) public static boolean isAtLeastT() { - return SdkLevel.isAtLeastT(); + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU; } private BuildCompatUtils() {} diff --git a/packages/SettingsLib/src/com/android/settingslib/DeviceInfoUtils.java b/packages/SettingsLib/src/com/android/settingslib/DeviceInfoUtils.java index 5c9ec4b3e6f1..f627bcb5db95 100644 --- a/packages/SettingsLib/src/com/android/settingslib/DeviceInfoUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/DeviceInfoUtils.java @@ -37,7 +37,7 @@ import android.util.Log; import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; -import com.android.modules.utils.build.SdkLevel; +import com.android.settingslib.utils.BuildCompatUtils; import java.io.BufferedReader; import java.io.FileReader; @@ -221,7 +221,7 @@ public class DeviceInfoUtils { } private static String getRawPhoneNumber(Context context, int subscriptionId) { - if (SdkLevel.isAtLeastT()) { + if (BuildCompatUtils.isAtLeastT()) { return getRawPhoneNumberFromT(context, subscriptionId); } else { final TelephonyManager telephonyManager = context.getSystemService( diff --git a/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java b/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java index 08aeeaec8bb0..284da73efb6f 100644 --- a/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java +++ b/packages/SettingsLib/src/com/android/settingslib/RestrictedPreferenceHelper.java @@ -34,7 +34,7 @@ import androidx.annotation.RequiresApi; import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; -import com.android.modules.utils.build.SdkLevel; +import com.android.settingslib.utils.BuildCompatUtils; /** * Helper class for managing settings preferences that can be disabled @@ -106,7 +106,7 @@ public class RestrictedPreferenceHelper { if (mDisabledSummary) { final TextView summaryView = (TextView) holder.findViewById(android.R.id.summary); if (summaryView != null) { - final CharSequence disabledText = SdkLevel.isAtLeastT() + final CharSequence disabledText = BuildCompatUtils.isAtLeastT() ? getDisabledByAdminUpdatableString() : mContext.getString(R.string.disabled_by_admin_summary_text); if (mDisabledByAdmin) { diff --git a/packages/SettingsLib/src/com/android/settingslib/Utils.java b/packages/SettingsLib/src/com/android/settingslib/Utils.java index a7f12022e172..feb4212035bc 100644 --- a/packages/SettingsLib/src/com/android/settingslib/Utils.java +++ b/packages/SettingsLib/src/com/android/settingslib/Utils.java @@ -50,9 +50,9 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.UserIcons; import com.android.launcher3.icons.BaseIconFactory.IconOptions; import com.android.launcher3.icons.IconFactory; -import com.android.modules.utils.build.SdkLevel; import com.android.settingslib.drawable.UserIconDrawable; import com.android.settingslib.fuelgauge.BatteryStatus; +import com.android.settingslib.utils.BuildCompatUtils; import java.text.NumberFormat; @@ -130,7 +130,7 @@ public class Utils { String name = info != null ? info.name : null; if (info.isManagedProfile()) { // We use predefined values for managed profiles - return SdkLevel.isAtLeastT() + return BuildCompatUtils.isAtLeastT() ? getUpdatableManagedUserTitle(context) : context.getString(R.string.managed_user_title); } else if (info.isGuest()) { diff --git a/packages/SettingsLib/src/com/android/settingslib/drawable/UserIconDrawable.java b/packages/SettingsLib/src/com/android/settingslib/drawable/UserIconDrawable.java index 17ac4307d6a6..11fae24aa677 100644 --- a/packages/SettingsLib/src/com/android/settingslib/drawable/UserIconDrawable.java +++ b/packages/SettingsLib/src/com/android/settingslib/drawable/UserIconDrawable.java @@ -48,7 +48,7 @@ import android.os.UserHandle; import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; -import com.android.modules.utils.build.SdkLevel; +import com.android.settingslib.utils.BuildCompatUtils; /** * Converts the user avatar icon to a circularly clipped one with an optional badge and frame @@ -88,7 +88,7 @@ public class UserIconDrawable extends Drawable implements Drawable.Callback { * @return drawable containing just the badge */ public static Drawable getManagedUserDrawable(Context context) { - if (SdkLevel.isAtLeastT()) { + if (BuildCompatUtils.isAtLeastT()) { return getUpdatableManagedUserDrawable(context); } else { return getDrawableForDisplayDensity( @@ -227,7 +227,7 @@ public class UserIconDrawable extends Drawable implements Drawable.Callback { } private static Drawable getManagementBadge(Context context) { - if (SdkLevel.isAtLeastT()) { + if (BuildCompatUtils.isAtLeastT()) { return getUpdatableManagementBadge(context); } else { return getDrawableForDisplayDensity( |