diff options
author | linyuh <linyuh@google.com> | 2018-06-28 20:13:52 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-28 20:14:43 -0700 |
commit | 60c1e5732085d36bdf5b49055add832222c75839 (patch) | |
tree | 4b18ade57cdb2100cbd4acec0a1d42163b3c21ef | |
parent | e479c7d417573ac142b336c904ce0643e010f7dd (diff) |
Remove redundant @TargetApi, @RequiresApi and @SuppressWarnings
Test: Existing tests
PiperOrigin-RevId: 202589482
Change-Id: I6982e4069d30032bf46caf3c9984dfc0e7196f6f
41 files changed, 6 insertions, 113 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java index b306e756a..f54ea79dc 100644 --- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java +++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java @@ -16,13 +16,11 @@ package com.android.dialer.app.calllog; -import android.annotation.TargetApi; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; -import android.os.Build.VERSION_CODES; import android.provider.CallLog; import android.provider.VoicemailContract.Voicemails; import android.support.annotation.NonNull; @@ -35,7 +33,6 @@ import com.android.dialer.util.PermissionsUtil; import com.android.voicemail.VoicemailClient; /** TODO(calderwoodra): documentation */ -@TargetApi(VERSION_CODES.N) public class CallLogAsyncTaskUtil { private static final String TAG = "CallLogAsyncTaskUtil"; diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java index 152a3b837..03b824eb6 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java @@ -17,7 +17,6 @@ package com.android.dialer.app.calllog; import android.Manifest; -import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; @@ -51,7 +50,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; /** Helper class operating on call log notifications. */ -@TargetApi(Build.VERSION_CODES.N) public class CallLogNotificationsQueryHelper { @VisibleForTesting @@ -349,14 +347,12 @@ public class CallLogNotificationsQueryHelper { @Override @Nullable - @TargetApi(Build.VERSION_CODES.N) public List<NewCall> query(int type) { return query(type, NO_THRESHOLD); } @Override @Nullable - @TargetApi(Build.VERSION_CODES.N) @SuppressWarnings("MissingPermission") public List<NewCall> query(int type, long thresholdMillis) { if (!PermissionsUtil.hasPermission(context, Manifest.permission.READ_CALL_LOG)) { diff --git a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java index 6fc8d23e3..95662a1f6 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java +++ b/java/com/android/dialer/app/voicemail/VoicemailPlaybackPresenter.java @@ -16,7 +16,6 @@ package com.android.dialer.app.voicemail; -import android.annotation.TargetApi; import android.app.Activity; import android.content.ContentResolver; import android.content.ContentUris; @@ -28,7 +27,6 @@ import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.AsyncTask; -import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Handler; import android.os.PowerManager; @@ -90,7 +88,6 @@ import javax.annotation.concurrent.ThreadSafe; * calls into this class from outside must be done from the main UI thread. */ @NotThreadSafe -@TargetApi(VERSION_CODES.N) public class VoicemailPlaybackPresenter implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener, diff --git a/java/com/android/dialer/blocking/BlockedNumbersMigrator.java b/java/com/android/dialer/blocking/BlockedNumbersMigrator.java index 101a04b2f..ef047a036 100644 --- a/java/com/android/dialer/blocking/BlockedNumbersMigrator.java +++ b/java/com/android/dialer/blocking/BlockedNumbersMigrator.java @@ -16,15 +16,12 @@ package com.android.dialer.blocking; -import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.os.AsyncTask; -import android.os.Build.VERSION_CODES; import android.provider.BlockedNumberContract.BlockedNumbers; -import android.support.annotation.RequiresApi; import com.android.dialer.common.LogUtil; import com.android.dialer.database.FilteredNumberContract; import com.android.dialer.database.FilteredNumberContract.FilteredNumber; @@ -35,7 +32,6 @@ import java.util.Objects; * Class which should be used to migrate numbers from {@link FilteredNumberContract} blocking to * {@link android.provider.BlockedNumberContract} blocking. */ -@TargetApi(VERSION_CODES.N) @Deprecated public class BlockedNumbersMigrator { @@ -49,8 +45,6 @@ public class BlockedNumbersMigrator { this.context = Objects.requireNonNull(context); } - @RequiresApi(VERSION_CODES.N) - @TargetApi(VERSION_CODES.N) private static boolean migrateToNewBlockingInBackground(ContentResolver resolver) { try (Cursor cursor = resolver.query( @@ -91,8 +85,6 @@ public class BlockedNumbersMigrator { } } - @RequiresApi(VERSION_CODES.N) - @TargetApi(VERSION_CODES.N) private static boolean isNumberInNewBlocking(ContentResolver resolver, String originalNumber) { try (Cursor cursor = resolver.query( @@ -134,7 +126,6 @@ public class BlockedNumbersMigrator { void onComplete(); } - @TargetApi(VERSION_CODES.N) private class MigratorTask extends AsyncTask<Void, Void, Boolean> { private final Listener listener; diff --git a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java index b41759259..08526ef76 100644 --- a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java +++ b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java @@ -16,7 +16,6 @@ package com.android.dialer.blocking; -import android.annotation.TargetApi; import android.content.AsyncQueryHandler; import android.content.ContentValues; import android.content.Context; @@ -24,7 +23,6 @@ import android.database.Cursor; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabaseCorruptException; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.v4.os.UserManagerCompat; @@ -201,7 +199,6 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { * * @return blocked id. */ - @TargetApi(VERSION_CODES.N) @Nullable public Integer getBlockedIdSynchronous(@Nullable String number, String countryIso) { Assert.isWorkerThread(); diff --git a/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java b/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java index 0f1ab5f25..540ef0fe6 100644 --- a/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java +++ b/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java @@ -16,14 +16,12 @@ package com.android.dialer.callcomposer; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.graphics.BitmapFactory; import android.media.ExifInterface; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.util.Pair; @@ -37,7 +35,6 @@ import java.io.InputStream; import java.io.OutputStream; /** Task for copying and resizing images to be shared with RCS process. */ -@TargetApi(VERSION_CODES.N) class CopyAndResizeImageWorker implements Worker<Uri, Pair<File, String>> { private static final String MIME_TYPE = "image/jpeg"; diff --git a/java/com/android/dialer/callcomposer/camera/ImagePersistWorker.java b/java/com/android/dialer/callcomposer/camera/ImagePersistWorker.java index c18e22d56..27ad06899 100644 --- a/java/com/android/dialer/callcomposer/camera/ImagePersistWorker.java +++ b/java/com/android/dialer/callcomposer/camera/ImagePersistWorker.java @@ -16,12 +16,10 @@ package com.android.dialer.callcomposer.camera; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.support.annotation.NonNull; import android.support.v4.content.FileProvider; import com.android.dialer.callcomposer.camera.ImagePersistWorker.Result; @@ -38,7 +36,6 @@ import java.io.IOException; import java.io.OutputStream; /** Persisting image routine. */ -@TargetApi(VERSION_CODES.N) public class ImagePersistWorker implements Worker<Void, Result> { private int width; private int height; diff --git a/java/com/android/dialer/callintent/CallIntent.java b/java/com/android/dialer/callintent/CallIntent.java index ba61d5619..ef7aff672 100644 --- a/java/com/android/dialer/callintent/CallIntent.java +++ b/java/com/android/dialer/callintent/CallIntent.java @@ -198,7 +198,6 @@ public abstract class CallIntent implements Parcelable { return intent; } - @SuppressWarnings("AndroidApiChecker") // Use of Java 8 APIs. private Bundle createInCallUiIntentExtras() { Bundle bundle = new Bundle(); stringInCallUiIntentExtras().forEach(bundle::putString); @@ -207,7 +206,6 @@ public abstract class CallIntent implements Parcelable { return bundle; } - @SuppressWarnings("AndroidApiChecker") // Use of Java 8 APIs. private Bundle createPlaceCallExtras() { Bundle bundle = new Bundle(); stringPlaceCallExtras().forEach(bundle::putString); @@ -255,7 +253,6 @@ public abstract class CallIntent implements Parcelable { return 0; } - @SuppressWarnings("AndroidApiChecker") // Use of Java 8 APIs. @Override public void writeToParcel(Parcel dest, int flags) { dest.writeParcelable(number(), flags); diff --git a/java/com/android/dialer/calllog/CallLogCacheUpdater.java b/java/com/android/dialer/calllog/CallLogCacheUpdater.java index b3130e964..008e2ccda 100644 --- a/java/com/android/dialer/calllog/CallLogCacheUpdater.java +++ b/java/com/android/dialer/calllog/CallLogCacheUpdater.java @@ -46,7 +46,6 @@ import javax.inject.Inject; * Update {@link Calls#CACHED_NAME} and other cached columns after the annotated call log has been * updated. Dialer does not read these columns but other apps relies on it. */ -@SuppressWarnings("AndroidApiChecker") public final class CallLogCacheUpdater { private final Context appContext; diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java index 36fa5ff26..ce41a2ab2 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java @@ -16,7 +16,6 @@ package com.android.dialer.calllog.database; -import android.annotation.TargetApi; import android.content.ContentProvider; import android.content.ContentProviderOperation; import android.content.ContentProviderResult; @@ -28,7 +27,6 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; -import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.android.dialer.calllog.database.AnnotatedCallLogConstraints.Operation; @@ -82,7 +80,6 @@ public class AnnotatedCallLogContentProvider extends ContentProvider { return true; } - @TargetApi(Build.VERSION_CODES.N) // Uses try-with-resources @Nullable @Override public Cursor query( diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java index 7a12bc4ba..3e123c962 100644 --- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java +++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java @@ -17,12 +17,10 @@ package com.android.dialer.calllog.datasources.systemcalllog; import android.Manifest.permission; -import android.annotation.TargetApi; import android.content.ContentValues; import android.content.Context; import android.content.SharedPreferences; import android.database.Cursor; -import android.os.Build; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.provider.CallLog; @@ -230,7 +228,6 @@ public class SystemCallLogDataSource implements CallLogDataSource { return null; } - @TargetApi(Build.VERSION_CODES.N) // Uses try-with-resources private void handleInsertsAndUpdates( Context appContext, CallLogMutations mutations, Set<Long> existingAnnotatedCallLogIds) { long previousTimestampProcessed = sharedPreferences.getLong(PREF_LAST_TIMESTAMP_PROCESSED, 0L); @@ -453,7 +450,6 @@ public class SystemCallLogDataSource implements CallLogDataSource { } } - @TargetApi(Build.VERSION_CODES.N) // Uses try-with-resources private static Set<Long> getAnnotatedCallLogIds(Context appContext) { ArraySet<Long> ids = new ArraySet<>(); @@ -482,7 +478,6 @@ public class SystemCallLogDataSource implements CallLogDataSource { return ids; } - @TargetApi(Build.VERSION_CODES.N) // Uses try-with-resources private static Set<Long> getIdsFromSystemCallLogThatMatch( Context appContext, Set<Long> matchingIds) { ArraySet<Long> ids = new ArraySet<>(); diff --git a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java index 5e72a1af3..62f99b6e6 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java @@ -293,7 +293,6 @@ public final class NewCallLogFragment extends Fragment implements LoaderCallback return new AnnotatedCallLogCursorLoader(Assert.isNotNull(getContext())); } - @SuppressWarnings("AndroidApiChecker") // Use of optional @Override public void onLoadFinished(Loader<Cursor> loader, Cursor newCursor) { LogUtil.enterBlock("NewCallLogFragment.onLoadFinished"); diff --git a/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java b/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java index 378d487e2..0819d52f6 100644 --- a/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java +++ b/java/com/android/dialer/databasepopulator/BlockedBumberPopulator.java @@ -16,12 +16,10 @@ package com.android.dialer.databasepopulator; -import android.annotation.TargetApi; import android.content.ContentProviderOperation; import android.content.ContentValues; import android.content.Context; import android.content.OperationApplicationException; -import android.os.Build.VERSION_CODES; import android.os.RemoteException; import android.provider.BlockedNumberContract; import android.provider.BlockedNumberContract.BlockedNumbers; @@ -38,7 +36,6 @@ public class BlockedBumberPopulator { Arrays.asList( createContentValuesWithNumber("123456789"), createContentValuesWithNumber("987654321")); - @TargetApi(VERSION_CODES.N) public static void populateBlockedNumber(@NonNull Context context) { ArrayList<ContentProviderOperation> operations = new ArrayList<>(); for (ContentValues value : values) { @@ -55,7 +52,6 @@ public class BlockedBumberPopulator { } } - @TargetApi(VERSION_CODES.N) public static void deleteBlockedNumbers(@NonNull Context context) { // clean BlockedNumbers db context.getContentResolver().delete(BlockedNumbers.CONTENT_URI, null, null); diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index 73bb4f81a..feb76acd7 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -1371,7 +1371,6 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen showPromotionBottomSheet(activity, bottomSheet); } - @SuppressWarnings("AndroidApiChecker") // Use of optional private static void showPromotionBottomSheet(Context context, View view) { BottomSheetBehavior<View> bottomSheetBehavior = BottomSheetBehavior.from(view); Optional<Promotion> promotionOptional = diff --git a/java/com/android/dialer/oem/CequintCallerIdManager.java b/java/com/android/dialer/oem/CequintCallerIdManager.java index ea6cbb8cb..da217c883 100644 --- a/java/com/android/dialer/oem/CequintCallerIdManager.java +++ b/java/com/android/dialer/oem/CequintCallerIdManager.java @@ -15,12 +15,10 @@ */ package com.android.dialer.oem; -import android.annotation.TargetApi; import android.content.Context; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.support.annotation.AnyThread; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -43,7 +41,6 @@ import java.util.concurrent.ConcurrentHashMap; * Cequint Caller ID. It also caches any information fetched in static map, which lives through * whole application lifecycle. */ -@TargetApi(VERSION_CODES.N) public class CequintCallerIdManager { @VisibleForTesting diff --git a/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java b/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java index a6067d368..5f3922265 100644 --- a/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java +++ b/java/com/android/dialer/persistentlog/PersistentLogFileHandler.java @@ -16,10 +16,8 @@ package com.android.dialer.persistentlog; -import android.annotation.TargetApi; import android.content.Context; import android.content.SharedPreferences; -import android.os.Build.VERSION_CODES; import android.preference.PreferenceManager; import android.support.annotation.AnyThread; import android.support.annotation.MainThread; @@ -52,8 +50,6 @@ import java.util.List; * <p>This class is NOT thread safe. All methods expect the constructor must be called on the same * worker thread. */ -@SuppressWarnings("AndroidApiChecker") // lambdas -@TargetApi(VERSION_CODES.N) final class PersistentLogFileHandler { private static final String LOG_DIRECTORY = "persistent_log"; @@ -67,7 +63,7 @@ final class PersistentLogFileHandler { public LogCorruptionException(String message) { super(message); } - }; + } private File logDirectory; private final String subfolder; diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java index 2e6bcde51..7f2d91a5d 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java @@ -64,7 +64,6 @@ import java.util.function.Predicate; import javax.inject.Inject; /** PhoneLookup implementation for contacts in the default directory. */ -@SuppressWarnings("AndroidApiChecker") // Use of Java 8 APIs. public final class Cp2DefaultDirectoryPhoneLookup implements PhoneLookup<Cp2Info> { private static final String PREF_LAST_TIMESTAMP_PROCESSED = diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java index bbbd18664..237ae5eb0 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java @@ -55,7 +55,6 @@ import javax.inject.Inject; * * <p>Contacts in these directories are accessible only by specifying a directory ID. */ -@SuppressWarnings("AndroidApiChecker") // Use of Java 8 APIs. public final class Cp2ExtendedDirectoryPhoneLookup implements PhoneLookup<Cp2Info> { /** Config flag for timeout (in ms). */ diff --git a/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java b/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java index e7776108e..a241368e9 100644 --- a/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java +++ b/java/com/android/dialer/phonelookup/cp2/MissingPermissionsOperations.java @@ -36,7 +36,6 @@ import java.util.function.Predicate; import javax.inject.Inject; /** Shared logic for handling missing permissions in CP2 lookups. */ -@SuppressWarnings("AndroidApiChecker") // Use of Java 8 APIs. final class MissingPermissionsOperations { private final Context appContext; diff --git a/java/com/android/dialer/phonenumbercache/CallLogQuery.java b/java/com/android/dialer/phonenumbercache/CallLogQuery.java index 488aa26e5..2f2758a40 100644 --- a/java/com/android/dialer/phonenumbercache/CallLogQuery.java +++ b/java/com/android/dialer/phonenumbercache/CallLogQuery.java @@ -53,11 +53,7 @@ public final class CallLogQuery { public static final int DATA_USAGE = 21; public static final int TRANSCRIPTION = 22; public static final int CACHED_PHOTO_URI = 23; - - @RequiresApi(VERSION_CODES.N) public static final int POST_DIAL_DIGITS = 24; - - @RequiresApi(VERSION_CODES.N) public static final int VIA_NUMBER = 25; @RequiresApi(VERSION_CODES.O) diff --git a/java/com/android/dialer/precall/impl/AssistedDialAction.java b/java/com/android/dialer/precall/impl/AssistedDialAction.java index 40a810b5b..0e38231af 100644 --- a/java/com/android/dialer/precall/impl/AssistedDialAction.java +++ b/java/com/android/dialer/precall/impl/AssistedDialAction.java @@ -16,9 +16,7 @@ package com.android.dialer.precall.impl; -import android.annotation.TargetApi; import android.content.Context; -import android.os.Build; import android.os.Bundle; import android.telecom.PhoneAccount; import android.telephony.SubscriptionInfo; @@ -46,8 +44,6 @@ public class AssistedDialAction implements PreCallAction { return false; } - @SuppressWarnings("AndroidApiChecker") // Use of optional - @TargetApi(Build.VERSION_CODES.N) @Override public void runWithoutUi(Context context, CallIntentBuilder builder) { if (!builder.isAssistedDialAllowed()) { @@ -85,8 +81,6 @@ public class AssistedDialAction implements PreCallAction { /** * A convenience method to return the proper TelephonyManager in possible multi-sim environments. */ - @SuppressWarnings("AndroidApiChecker") // Use of createForSubscriptionId - @TargetApi(Build.VERSION_CODES.N) private TelephonyManager getAssistedDialingTelephonyManager( Context context, CallIntentBuilder builder) { diff --git a/java/com/android/dialer/promotion/PromotionManager.java b/java/com/android/dialer/promotion/PromotionManager.java index a86a745ad..24830defd 100644 --- a/java/com/android/dialer/promotion/PromotionManager.java +++ b/java/com/android/dialer/promotion/PromotionManager.java @@ -49,7 +49,6 @@ public final class PromotionManager { * * <p>TODO(wangqi): add support for other tabs. */ - @SuppressWarnings("AndroidApiChecker") // Use of optional public Optional<Promotion> getHighestPriorityPromotion(@PromotionType int type) { for (Promotion promotion : priorityPromotionList) { if (promotion.isEligibleToBeShown()) { diff --git a/java/com/android/dialer/speeddial/SpeedDialAdapter.java b/java/com/android/dialer/speeddial/SpeedDialAdapter.java index 4a48b6504..1bc072b5b 100644 --- a/java/com/android/dialer/speeddial/SpeedDialAdapter.java +++ b/java/com/android/dialer/speeddial/SpeedDialAdapter.java @@ -16,9 +16,7 @@ package com.android.dialer.speeddial; -import android.annotation.TargetApi; import android.content.Context; -import android.os.Build.VERSION_CODES; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -57,8 +55,6 @@ import java.util.Map; * <li>Suggested contacts * </ol> */ -@SuppressWarnings("AndroidApiChecker") -@TargetApi(VERSION_CODES.N) public final class SpeedDialAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements ItemTouchHelperAdapter { diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java index e87dee3b0..08fef8e47 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java @@ -16,10 +16,8 @@ package com.android.dialer.voicemail.listui.error; -import android.annotation.TargetApi; import android.content.Context; import android.database.Cursor; -import android.os.Build.VERSION_CODES; import android.provider.VoicemailContract.Status; import android.support.annotation.Nullable; import com.android.dialer.common.concurrent.DialerExecutor.Worker; @@ -32,7 +30,6 @@ import java.util.List; /** * Worker for {@link com.android.dialer.common.concurrent.DialerExecutors} to fetch voicemail status */ -@TargetApi(VERSION_CODES.N) public class VoicemailStatusWorker implements Worker<Context, List<VoicemailStatus>> { @Nullable diff --git a/java/com/android/dialer/voicemailstatus/VoicemailStatusQuery.java b/java/com/android/dialer/voicemailstatus/VoicemailStatusQuery.java index 8923f7411..7264afee1 100644 --- a/java/com/android/dialer/voicemailstatus/VoicemailStatusQuery.java +++ b/java/com/android/dialer/voicemailstatus/VoicemailStatusQuery.java @@ -34,11 +34,7 @@ public class VoicemailStatusQuery { public static final int CONFIGURATION_STATE_INDEX = 3; public static final int DATA_CHANNEL_STATE_INDEX = 4; public static final int NOTIFICATION_CHANNEL_STATE_INDEX = 5; - - @RequiresApi(VERSION_CODES.N) public static final int QUOTA_OCCUPIED_INDEX = 6; - - @RequiresApi(VERSION_CODES.N) public static final int QUOTA_TOTAL_INDEX = 7; @RequiresApi(VERSION_CODES.N_MR1) diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java index 274071a19..be803430b 100644 --- a/java/com/android/incallui/CallButtonPresenter.java +++ b/java/com/android/incallui/CallButtonPresenter.java @@ -16,9 +16,7 @@ package com.android.incallui; -import android.annotation.TargetApi; import android.content.Context; -import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Trace; import android.support.v4.app.Fragment; @@ -445,8 +443,7 @@ public class CallButtonPresenter * * @param call The active call. */ - @TargetApi(VERSION_CODES.N) - @SuppressWarnings(value = {"MissingPermission", "AndroidApiChecker"}) // Java 8 APIs. + @SuppressWarnings(value = {"MissingPermission"}) private void updateButtonsState(DialerCall call) { LogUtil.v("CallButtonPresenter.updateButtonsState", ""); final boolean isVideo = call.isVideoCall(); diff --git a/java/com/android/incallui/CallerInfo.java b/java/com/android/incallui/CallerInfo.java index 817535f52..3ab3a77d1 100644 --- a/java/com/android/incallui/CallerInfo.java +++ b/java/com/android/incallui/CallerInfo.java @@ -21,14 +21,12 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.PhoneLookup; import android.provider.ContactsContract.RawContacts; -import android.support.annotation.RequiresApi; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import com.android.contacts.common.ContactsUtils; @@ -46,7 +44,6 @@ public class CallerInfo { private static final String TAG = "CallerInfo"; - @RequiresApi(VERSION_CODES.N) private static final String[] DEFAULT_PHONELOOKUP_PROJECTION = new String[] { PhoneLookup.CONTACT_ID, diff --git a/java/com/android/incallui/CallerInfoAsyncQuery.java b/java/com/android/incallui/CallerInfoAsyncQuery.java index 0ac252acf..35011cb67 100644 --- a/java/com/android/incallui/CallerInfoAsyncQuery.java +++ b/java/com/android/incallui/CallerInfoAsyncQuery.java @@ -17,14 +17,12 @@ package com.android.incallui; import android.Manifest; -import android.annotation.TargetApi; import android.content.AsyncQueryHandler; import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -51,7 +49,6 @@ import java.util.Arrays; * * @see CallerInfo */ -@TargetApi(VERSION_CODES.N) public class CallerInfoAsyncQuery { /** Interface for a CallerInfoAsyncQueryHandler result return. */ diff --git a/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java b/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java index aef56872a..6e91307f9 100644 --- a/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java +++ b/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java @@ -16,11 +16,9 @@ package com.android.incallui.answer.impl.hint; -import android.annotation.TargetApi; import android.content.Context; import android.content.SharedPreferences; import android.graphics.drawable.Drawable; -import android.os.Build.VERSION_CODES; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.android.dialer.common.Assert; @@ -29,7 +27,6 @@ import com.android.dialer.storage.StorageComponent; import com.android.incallui.answer.impl.hint.PawSecretCodeListener.PawType; /** Decrypt the event payload to be shown if in a specific time range and the key is received. */ -@TargetApi(VERSION_CODES.N) public final class PawImageLoaderImpl implements PawImageLoader { @Override diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 94724e6b2..1f4e49ad8 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -1022,7 +1022,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa * the same time that is logged as the start time in the Call Log (see {@link * android.provider.CallLog.Calls#DATE}). */ - @TargetApi(26) + @TargetApi(VERSION_CODES.O) public long getCreationTimeMillis() { return telecomCall.getDetails().getCreationTimeMillis(); } diff --git a/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java b/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java index f9fe6a68a..309e99405 100644 --- a/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java +++ b/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java @@ -17,12 +17,10 @@ package com.android.incallui.legacyblocking; import android.Manifest.permission; -import android.annotation.TargetApi; import android.content.Context; import android.content.pm.PackageManager; import android.database.Cursor; import android.os.AsyncTask; -import android.os.Build.VERSION_CODES; import android.provider.CallLog; import android.support.v4.content.ContextCompat; import com.android.dialer.common.LogUtil; @@ -34,7 +32,6 @@ import java.util.Objects; * versions of the OS, call blocking is implemented in the system and there's no need to mess with * the call log. */ -@TargetApi(VERSION_CODES.N) public class DeleteBlockedCallTask extends AsyncTask<Void, Void, Long> { public static final String IDENTIFIER = "DeleteBlockedCallTask"; diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java index 3b2f1c519..7fd41f971 100644 --- a/java/com/android/incallui/spam/SpamCallListListener.java +++ b/java/com/android/incallui/spam/SpamCallListListener.java @@ -16,7 +16,6 @@ package com.android.incallui.spam; -import android.annotation.TargetApi; import android.app.Notification; import android.app.Notification.Builder; import android.app.PendingIntent; @@ -25,7 +24,6 @@ import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.graphics.drawable.Icon; -import android.os.Build.VERSION_CODES; import android.provider.CallLog; import android.provider.CallLog.Calls; import android.support.annotation.NonNull; @@ -88,7 +86,6 @@ public class SpamCallListListener implements CallList.Listener { } /** Checks if the number is in the call history. */ - @TargetApi(VERSION_CODES.N) private static final class NumberInCallHistoryWorker implements Worker<Void, Integer> { private final Context appContext; diff --git a/java/com/android/voicemail/impl/CarrierIdentifier.java b/java/com/android/voicemail/impl/CarrierIdentifier.java index 76576e7ad..7788b7d66 100644 --- a/java/com/android/voicemail/impl/CarrierIdentifier.java +++ b/java/com/android/voicemail/impl/CarrierIdentifier.java @@ -28,7 +28,7 @@ import java.util.Optional; /** Identifies a carrier. */ @AutoValue @TargetApi(VERSION_CODES.O) -@SuppressWarnings({"missingpermission", "AndroidApiChecker"}) +@SuppressWarnings({"missingpermission"}) public abstract class CarrierIdentifier { public abstract String mccMnc(); diff --git a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java index 5185b8fd4..e5263f497 100644 --- a/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java +++ b/java/com/android/voicemail/impl/OmtpVvmCarrierConfigHelper.java @@ -56,7 +56,7 @@ import java.util.Set; * <p>TODO(twyen): refactor this to an interface. */ @TargetApi(VERSION_CODES.O) -@SuppressWarnings({"missingpermission", "AndroidApiChecker"}) +@SuppressWarnings({"missingpermission"}) public class OmtpVvmCarrierConfigHelper { private static final String TAG = "OmtpVvmCarrierCfgHlpr"; diff --git a/java/com/android/voicemail/impl/PackageReplacedReceiver.java b/java/com/android/voicemail/impl/PackageReplacedReceiver.java index 9fa9f75c7..c60fbe722 100644 --- a/java/com/android/voicemail/impl/PackageReplacedReceiver.java +++ b/java/com/android/voicemail/impl/PackageReplacedReceiver.java @@ -16,7 +16,6 @@ package com.android.voicemail.impl; -import android.annotation.TargetApi; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -91,7 +90,6 @@ public class PackageReplacedReceiver extends BroadcastReceiver { this.context = context; } - @TargetApi(android.os.Build.VERSION_CODES.N) // used for try with resources @Override public Void doInBackground(Void arg) throws Throwable { LogUtil.i("PackageReplacedReceiver.ExistingVoicemailCheck.doInBackground", ""); diff --git a/java/com/android/voicemail/impl/VvmPackageInstallHandler.java b/java/com/android/voicemail/impl/VvmPackageInstallHandler.java index 276b7889a..ee8b722de 100644 --- a/java/com/android/voicemail/impl/VvmPackageInstallHandler.java +++ b/java/com/android/voicemail/impl/VvmPackageInstallHandler.java @@ -16,7 +16,6 @@ package com.android.voicemail.impl; -import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.content.Context; import android.os.Build.VERSION_CODES; @@ -34,7 +33,6 @@ import com.android.voicemail.impl.settings.VisualVoicemailSettingsUtil; * when a VVM SMS is received instead, as it can be a result of the carrier VVM app trying to run * activation. */ -@SuppressLint("AndroidApiChecker") // forEach @TargetApi(VERSION_CODES.O) public final class VvmPackageInstallHandler { diff --git a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java index aa2886812..66071609c 100644 --- a/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java +++ b/java/com/android/voicemail/impl/mail/store/imap/DigestMd5Utils.java @@ -32,7 +32,7 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Map; -@SuppressWarnings("AndroidApiChecker") // Map.getOrDefault() is java8 +/** Utilities for DIGEST-MD5. */ @TargetApi(VERSION_CODES.O) public class DigestMd5Utils { diff --git a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java index 73e0c7f3c..7ddf64607 100644 --- a/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java +++ b/java/com/android/voicemail/impl/sms/StatusSmsFetcher.java @@ -46,7 +46,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** Intercepts a incoming STATUS SMS with a blocking call. */ -@SuppressWarnings("AndroidApiChecker") /* CompletableFuture is java8*/ @TargetApi(VERSION_CODES.O) public class StatusSmsFetcher extends BroadcastReceiver implements Closeable { diff --git a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java index be11c4453..d0c2ccf47 100644 --- a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java +++ b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java @@ -15,14 +15,12 @@ */ package com.android.voicemail.impl.sync; -import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; -import android.os.Build.VERSION_CODES; import android.provider.VoicemailContract; import android.provider.VoicemailContract.Voicemails; import android.support.annotation.NonNull; @@ -256,7 +254,6 @@ public class VoicemailsQueryHelper { } /** Find the oldest voicemails that are on the device, and also on the server. */ - @TargetApi(VERSION_CODES.N) // used for try with resources public List<Voicemail> oldestVoicemailsOnServer(int numVoicemails) { if (numVoicemails <= 0) { Assert.fail("Query for remote voicemails cannot be <= 0"); diff --git a/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java b/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java index e7517363c..86d645215 100644 --- a/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java +++ b/java/com/android/voicemail/impl/sync/VvmNetworkRequest.java @@ -33,7 +33,6 @@ import java.util.concurrent.Future; * Class to retrieve a {@link Network} synchronously. {@link #getNetwork(OmtpVvmCarrierConfigHelper, * PhoneAccountHandle)} will block until a suitable network is retrieved or it has failed. */ -@SuppressWarnings("AndroidApiChecker") /* CompletableFuture is java8*/ @TargetApi(VERSION_CODES.O) public class VvmNetworkRequest { diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java b/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java index d8c00ed91..8611e8022 100644 --- a/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java +++ b/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java @@ -33,8 +33,6 @@ import java.security.NoSuchAlgorithmException; public class TranscriptionUtils { static final String AMR_PREFIX = "#!AMR\n"; - // Uses try-with-resource - @TargetApi(android.os.Build.VERSION_CODES.N) static ByteString getAudioData(Context context, Uri voicemailUri) { try (InputStream in = context.getContentResolver().openInputStream(voicemailUri)) { return ByteString.readFrom(in); |