summaryrefslogtreecommitdiff
path: root/src/com/android/deskclock/Utils.java
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2022-03-18 20:23:26 +0100
committerMichael W <baddaemon87@gmail.com>2022-04-18 10:03:08 +0200
commitfa6047db25729eebf26826f738d4a4ab2327a512 (patch)
treee94535bf44d25673adbf26f9262c5a56413f8280 /src/com/android/deskclock/Utils.java
parent23d7064d1abf2feb41d3d1a1812038a26e836181 (diff)
DeskClock: Remove compatibility to old APIsHEADsugisawa-mr1
* We never build on these, so the code and annotations are useless Change-Id: I791370b531ecadcbddb63ca04d5c4c51aafe1bc1
Diffstat (limited to 'src/com/android/deskclock/Utils.java')
-rw-r--r--src/com/android/deskclock/Utils.java97
1 files changed, 9 insertions, 88 deletions
diff --git a/src/com/android/deskclock/Utils.java b/src/com/android/deskclock/Utils.java
index ef19131b0..3643d0747 100644
--- a/src/com/android/deskclock/Utils.java
+++ b/src/com/android/deskclock/Utils.java
@@ -17,7 +17,6 @@
package com.android.deskclock;
import android.annotation.SuppressLint;
-import android.annotation.TargetApi;
import android.app.AlarmManager;
import android.app.AlarmManager.AlarmClockInfo;
import android.app.PendingIntent;
@@ -37,14 +36,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.provider.Settings;
-import androidx.annotation.AnyRes;
-import androidx.annotation.DrawableRes;
-import androidx.annotation.StringRes;
-import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
-import androidx.core.os.BuildCompat;
-import androidx.core.view.AccessibilityDelegateCompat;
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
-import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
@@ -58,6 +49,15 @@ import android.view.View;
import android.widget.TextClock;
import android.widget.TextView;
+import androidx.annotation.AnyRes;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.StringRes;
+import androidx.core.os.BuildCompat;
+import androidx.core.view.AccessibilityDelegateCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
+import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
+import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
+
import com.android.deskclock.data.DataModel;
import com.android.deskclock.provider.AlarmInstance;
import com.android.deskclock.uidata.UiDataModel;
@@ -107,71 +107,6 @@ public class Utils {
}
/**
- * @return {@code true} if the device is prior to {@link Build.VERSION_CODES#LOLLIPOP}
- */
- public static boolean isPreL() {
- return Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP;
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#LOLLIPOP} or
- * {@link Build.VERSION_CODES#LOLLIPOP_MR1}
- */
- public static boolean isLOrLMR1() {
- final int sdkInt = Build.VERSION.SDK_INT;
- return sdkInt == Build.VERSION_CODES.LOLLIPOP || sdkInt == Build.VERSION_CODES.LOLLIPOP_MR1;
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#LOLLIPOP} or later
- */
- public static boolean isLOrLater() {
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#LOLLIPOP_MR1} or later
- */
- public static boolean isLMR1OrLater() {
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1;
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#M} or later
- */
- public static boolean isMOrLater() {
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#N} or later
- */
- public static boolean isNOrLater() {
- return BuildCompat.isAtLeastN();
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#N_MR1} or later
- */
- public static boolean isNMR1OrLater() {
- return BuildCompat.isAtLeastNMR1();
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#O} or later
- */
- public static boolean isOOrLater() {
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
- }
-
- /**
- * @return {@code true} if the device is {@link Build.VERSION_CODES#P} or later
- */
- public static boolean isPOrLater() {
- return Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
- }
-
- /**
* @param resourceId identifies an application resource
* @return the Uri by which the application resource is accessed
*/
@@ -299,18 +234,6 @@ public class Utils {
* @return The next alarm from {@link AlarmManager}
*/
public static String getNextAlarm(Context context) {
- return isPreL() ? getNextAlarmPreL(context) : getNextAlarmLOrLater(context);
- }
-
- @SuppressWarnings("deprecation")
- @TargetApi(Build.VERSION_CODES.KITKAT)
- private static String getNextAlarmPreL(Context context) {
- final ContentResolver cr = context.getContentResolver();
- return Settings.System.getString(cr, Settings.System.NEXT_ALARM_FORMATTED);
- }
-
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
- private static String getNextAlarmLOrLater(Context context) {
final AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
final AlarmClockInfo info = getNextAlarmClock(am);
if (info != null) {
@@ -323,12 +246,10 @@ public class Utils {
return null;
}
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static AlarmClockInfo getNextAlarmClock(AlarmManager am) {
return am.getNextAlarmClock();
}
- @TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void updateNextAlarm(AlarmManager am, AlarmClockInfo info, PendingIntent op) {
am.setAlarmClock(info, op);
}