From 57fdc2b9ab68bff217d4c9c605ef89cefd66f678 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Thu, 22 Mar 2018 01:06:19 -0700 Subject: Increase minSdk to 24. Manually set to M - MissedCallNotifierTest (not sure what the issue is here...) - CallLogGroupBuilderTest (because a check was removed, some NPEs are thrown) - MainSearchControllerTest (/system/etc/fonts.xml (No such file or directory)) Ignore Tests - a few random ones in incallui/answer/impl/hint (shared prefs aren't working for some reason) - VisualVoicemailUpdateTaskTest (disabled the whole test, issue unclear) Bug: 73902692 Test: tap PiperOrigin-RevId: 190030202 Change-Id: I1e9b61d758a61582c5a183ee884dd2181d1c10de --- AndroidManifest.xml | 2 +- .../contacts/common/dialog/CallSubjectDialog.java | 8 ---- java/com/android/dialer/app/AndroidManifest.xml | 2 +- .../dialer/app/calllog/CallLogAsyncTaskUtil.java | 4 +- .../calllog/CallLogNotificationsQueryHelper.java | 6 +-- .../app/calllog/VisualVoicemailNotifier.java | 6 --- .../calllog/VoicemailNotificationJobService.java | 9 +---- .../dialer/assisteddialing/AndroidManifest.xml | 2 +- .../dialer/assisteddialing/ui/AndroidManifest.xml | 2 +- .../dialer/binary/google/AndroidManifest.xml | 2 +- .../dialer/blocking/BlockedNumbersMigrator.java | 2 +- .../blocking/FilteredNumberAsyncQueryHandler.java | 7 +++- .../dialer/blocking/FilteredNumberCompat.java | 26 ++----------- .../callcomposer/CopyAndResizeImageWorker.java | 2 +- .../callcomposer/camera/ImagePersistWorker.java | 2 +- .../com/android/dialer/calllog/AndroidManifest.xml | 2 +- .../database/AnnotatedCallLogContentProvider.java | 2 +- .../systemcalllog/SystemCallLogDataSource.java | 6 +-- .../android/dialer/calllogutils/CallLogDates.java | 8 ---- java/com/android/dialer/compat/CompatUtils.java | 13 +++---- .../android/dialer/compat/SdkVersionOverride.java | 43 ---------------------- .../compat/telephony/TelephonyManagerCompat.java | 13 +------ .../dialer/database/CallLogQueryHandler.java | 6 +-- .../android/dialer/oem/CequintCallerIdManager.java | 2 +- .../SystemBlockedNumberPhoneLookup.java | 12 +----- .../dialer/phonenumbercache/ContactInfoHelper.java | 22 +---------- .../preferredsim/PreferredAccountWorker.java | 5 --- .../android/dialer/shortcuts/AndroidManifest.xml | 2 +- .../android/dialer/spannable/AndroidManifest.xml | 2 +- .../listui/error/VoicemailStatusWorker.java | 2 +- java/com/android/incallui/AndroidManifest.xml | 2 +- .../com/android/incallui/CallerInfoAsyncQuery.java | 2 +- .../answer/impl/hint/PawImageLoaderImpl.java | 2 +- .../incallui/autoresizetext/AndroidManifest.xml | 2 +- .../legacyblocking/DeleteBlockedCallTask.java | 2 +- .../incallui/rtt/protocol/AndroidManifest.xml | 2 +- .../incallui/spam/SpamCallListListener.java | 2 +- .../incallui/video/protocol/AndroidManifest.xml | 2 +- .../incallui/videotech/ims/ImsVideoTech.java | 5 --- java/com/android/voicemail/AndroidManifest.xml | 2 +- .../voicemail/impl/PackageReplacedReceiver.java | 2 +- .../voicemail/impl/sync/VoicemailsQueryHelper.java | 2 +- .../impl/transcribe/TranscriptionUtils.java | 2 +- 43 files changed, 58 insertions(+), 193 deletions(-) delete mode 100644 java/com/android/dialer/compat/SdkVersionOverride.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 164dbc907..26fed40c5 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -20,7 +20,7 @@ android:versionName="19.0"> diff --git a/java/com/android/contacts/common/dialog/CallSubjectDialog.java b/java/com/android/contacts/common/dialog/CallSubjectDialog.java index 48f292cfa..bbf31e844 100644 --- a/java/com/android/contacts/common/dialog/CallSubjectDialog.java +++ b/java/com/android/contacts/common/dialog/CallSubjectDialog.java @@ -23,8 +23,6 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.preference.PreferenceManager; import android.telecom.PhoneAccount; @@ -519,12 +517,6 @@ public class CallSubjectDialog extends Activity { * current phone account. */ private void loadConfiguration() { - // Only attempt to load configuration from the phone account extras if the SDK is N or - // later. If we've got a prior SDK the default encoding and message length will suffice. - if (VERSION.SDK_INT < VERSION_CODES.N) { - return; - } - if (mPhoneAccountHandle == null) { return; } diff --git a/java/com/android/dialer/app/AndroidManifest.xml b/java/com/android/dialer/app/AndroidManifest.xml index 0c1a362bb..e77bbe250 100644 --- a/java/com/android/dialer/app/AndroidManifest.xml +++ b/java/com/android/dialer/app/AndroidManifest.xml @@ -55,7 +55,7 @@ diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java index 08f5585b0..b306e756a 100644 --- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java +++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java @@ -34,7 +34,8 @@ import com.android.dialer.common.concurrent.AsyncTaskExecutors; import com.android.dialer.util.PermissionsUtil; import com.android.voicemail.VoicemailClient; -@TargetApi(VERSION_CODES.M) +/** TODO(calderwoodra): documentation */ +@TargetApi(VERSION_CODES.N) public class CallLogAsyncTaskUtil { private static final String TAG = "CallLogAsyncTaskUtil"; @@ -155,6 +156,7 @@ public class CallLogAsyncTaskUtil { UPDATE_DURATION, } + /** TODO(calderwoodra): documentation */ public interface CallLogAsyncTaskListener { void onDeleteVoicemail(); } diff --git a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java index 3afb6bb87..ce6e5baf4 100644 --- a/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java +++ b/java/com/android/dialer/app/calllog/CallLogNotificationsQueryHelper.java @@ -51,7 +51,7 @@ import java.util.List; import java.util.concurrent.TimeUnit; /** Helper class operating on call log notifications. */ -@TargetApi(Build.VERSION_CODES.M) +@TargetApi(Build.VERSION_CODES.N) public class CallLogNotificationsQueryHelper { @VisibleForTesting @@ -341,14 +341,14 @@ public class CallLogNotificationsQueryHelper { @Override @Nullable - @TargetApi(Build.VERSION_CODES.M) + @TargetApi(Build.VERSION_CODES.N) public List query(int type) { return query(type, NO_THRESHOLD); } @Override @Nullable - @TargetApi(Build.VERSION_CODES.M) + @TargetApi(Build.VERSION_CODES.N) @SuppressWarnings("MissingPermission") public List query(int type, long thresholdMillis) { if (!PermissionsUtil.hasPermission(context, Manifest.permission.READ_CALL_LOG)) { diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java index 78d307521..cba389cc3 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java @@ -233,9 +233,6 @@ final class VisualVoicemailNotifier { @Nullable private static Uri getVoicemailRingtoneUri( @NonNull Context context, @Nullable PhoneAccountHandle handle) { - if (VERSION.SDK_INT < VERSION_CODES.N) { - return null; - } if (handle == null) { LogUtil.i("VisualVoicemailNotifier.getVoicemailRingtoneUri", "null handle, getting fallback"); handle = getFallbackAccount(context); @@ -251,9 +248,6 @@ final class VisualVoicemailNotifier { private static int getNotificationDefaultFlags( @NonNull Context context, @Nullable PhoneAccountHandle handle) { - if (VERSION.SDK_INT < VERSION_CODES.N) { - return Notification.DEFAULT_ALL; - } if (handle == null) { LogUtil.i( "VisualVoicemailNotifier.getNotificationDefaultFlags", "null handle, getting fallback"); diff --git a/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java b/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java index ba61601ae..754ab2727 100644 --- a/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java +++ b/java/com/android/dialer/app/calllog/VoicemailNotificationJobService.java @@ -22,7 +22,6 @@ import android.app.job.JobScheduler; import android.app.job.JobService; import android.content.ComponentName; import android.content.Context; -import android.os.Build; import android.provider.VoicemailContract; import com.android.dialer.common.LogUtil; import com.android.dialer.constants.ScheduledJobIds; @@ -37,12 +36,8 @@ public class VoicemailNotificationJobService extends JobService { * notification is visible. */ public static void scheduleJob(Context context) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { - LogUtil.i("VoicemailNotificationJobService.scheduleJob", "not supported"); - } else { - context.getSystemService(JobScheduler.class).schedule(getJobInfo(context)); - LogUtil.i("VoicemailNotificationJobService.scheduleJob", "job scheduled"); - } + context.getSystemService(JobScheduler.class).schedule(getJobInfo(context)); + LogUtil.i("VoicemailNotificationJobService.scheduleJob", "job scheduled"); } /** diff --git a/java/com/android/dialer/assisteddialing/AndroidManifest.xml b/java/com/android/dialer/assisteddialing/AndroidManifest.xml index a19af3b72..0a5b613d7 100644 --- a/java/com/android/dialer/assisteddialing/AndroidManifest.xml +++ b/java/com/android/dialer/assisteddialing/AndroidManifest.xml @@ -16,7 +16,7 @@ package="com.android.dialer.assisteddialing"> diff --git a/java/com/android/dialer/assisteddialing/ui/AndroidManifest.xml b/java/com/android/dialer/assisteddialing/ui/AndroidManifest.xml index 3e79de38a..d59056eb0 100644 --- a/java/com/android/dialer/assisteddialing/ui/AndroidManifest.xml +++ b/java/com/android/dialer/assisteddialing/ui/AndroidManifest.xml @@ -16,7 +16,7 @@ package="com.android.dialer.assisteddialing.ui"> diff --git a/java/com/android/dialer/binary/google/AndroidManifest.xml b/java/com/android/dialer/binary/google/AndroidManifest.xml index c1f1a59bf..f6ac430b3 100644 --- a/java/com/android/dialer/binary/google/AndroidManifest.xml +++ b/java/com/android/dialer/binary/google/AndroidManifest.xml @@ -20,7 +20,7 @@ android:versionName="19.0"> diff --git a/java/com/android/dialer/blocking/BlockedNumbersMigrator.java b/java/com/android/dialer/blocking/BlockedNumbersMigrator.java index 88f474a84..61ebf2f56 100644 --- a/java/com/android/dialer/blocking/BlockedNumbersMigrator.java +++ b/java/com/android/dialer/blocking/BlockedNumbersMigrator.java @@ -35,7 +35,7 @@ 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.M) +@TargetApi(VERSION_CODES.N) public class BlockedNumbersMigrator { private final Context context; diff --git a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java index 09fd5f0a8..8be479c99 100644 --- a/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java +++ b/java/com/android/dialer/blocking/FilteredNumberAsyncQueryHandler.java @@ -37,6 +37,7 @@ import com.android.dialer.database.FilteredNumberContract.FilteredNumberTypes; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +/** TODO(calderwoodra): documentation */ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { public static final int INVALID_ID = -1; @@ -199,7 +200,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { * * @return blocked id. */ - @TargetApi(VERSION_CODES.M) + @TargetApi(VERSION_CODES.N) @Nullable public Integer getBlockedIdSynchronous(@Nullable String number, String countryIso) { Assert.isWorkerThread(); @@ -382,6 +383,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { null); } + /** TODO(calderwoodra): documentation */ public interface OnCheckBlockedListener { /** @@ -392,6 +394,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { void onCheckComplete(Integer id); } + /** TODO(calderwoodra): documentation */ public interface OnBlockNumberListener { /** @@ -402,6 +405,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { void onBlockComplete(Uri uri); } + /** TODO(calderwoodra): documentation */ public interface OnUnblockNumberListener { /** @@ -413,6 +417,7 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { void onUnblockComplete(int rows, ContentValues values); } + /** TODO(calderwoodra): documentation */ interface OnHasBlockedNumbersListener { /** diff --git a/java/com/android/dialer/blocking/FilteredNumberCompat.java b/java/com/android/dialer/blocking/FilteredNumberCompat.java index bea84e8db..b0af45c97 100644 --- a/java/com/android/dialer/blocking/FilteredNumberCompat.java +++ b/java/com/android/dialer/blocking/FilteredNumberCompat.java @@ -16,16 +16,12 @@ package com.android.dialer.blocking; -import android.annotation.TargetApi; import android.app.FragmentManager; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.os.UserManager; import android.preference.PreferenceManager; import android.provider.BlockedNumberContract; import android.provider.BlockedNumberContract.BlockedNumbers; @@ -110,7 +106,7 @@ public class FilteredNumberCompat { * otherwise. */ public static boolean canUseNewFiltering() { - return VERSION.SDK_INT >= VERSION_CODES.N; + return true; } /** @@ -162,16 +158,14 @@ public class FilteredNumberCompat { private static Uri getBaseUri(Context context) { // Explicit version check to aid static analysis - return useNewFiltering(context) && VERSION.SDK_INT >= VERSION_CODES.N - ? BlockedNumbers.CONTENT_URI - : FilteredNumber.CONTENT_URI; + return useNewFiltering(context) ? BlockedNumbers.CONTENT_URI : FilteredNumber.CONTENT_URI; } /** * Removes any null column names from the given projection array. This method is intended to be * used to strip out any column names that aren't available in every version of number blocking. * Example: {@literal getContext().getContentResolver().query( someUri, // Filtering ensures that - * no non-existant columns are queried FilteredNumberCompat.filter(new String[] + * no non-existent columns are queried FilteredNumberCompat.filter(new String[] * {FilteredNumberCompat.getIdColumnName(), FilteredNumberCompat.getTypeColumnName()}, * FilteredNumberCompat.getE164NumberColumnName() + " = ?", new String[] {e164Number}); } * @@ -249,9 +243,7 @@ public class FilteredNumberCompat { */ public static Intent createManageBlockedNumbersIntent(Context context) { // Explicit version check to aid static analysis - if (canUseNewFiltering() - && hasMigratedToNewBlocking(context) - && VERSION.SDK_INT >= VERSION_CODES.N) { + if (canUseNewFiltering() && hasMigratedToNewBlocking(context)) { return context.getSystemService(TelecomManager.class).createManageBlockedNumbersIntent(); } Intent intent = new Intent("com.android.dialer.action.BLOCKED_NUMBERS_SETTINGS"); @@ -270,11 +262,6 @@ public class FilteredNumberCompat { return canAttemptBlockOperationsForTest; } - if (VERSION.SDK_INT < VERSION_CODES.N) { - // Dialer blocking, must be primary user - return context.getSystemService(UserManager.class).isSystemUser(); - } - // Great Wall blocking, must be primary user and the default or system dialer // TODO(maxwelb): check that we're the system Dialer return TelecomUtil.isDefaultDialer(context) @@ -294,10 +281,6 @@ public class FilteredNumberCompat { * otherwise. */ public static boolean canCurrentUserOpenBlockSettings(Context context) { - if (VERSION.SDK_INT < VERSION_CODES.N) { - // Dialer blocking, must be primary user - return context.getSystemService(UserManager.class).isSystemUser(); - } // BlockedNumberContract blocking, verify through Contract API return TelecomUtil.isDefaultDialer(context) && safeBlockedNumbersContractCanCurrentUserBlockNumbers(context); @@ -312,7 +295,6 @@ public class FilteredNumberCompat { * @return the result of BlockedNumberContract#canCurrentUserBlockNumbers, or {@code false} if an * exception was thrown. */ - @TargetApi(VERSION_CODES.N) private static boolean safeBlockedNumbersContractCanCurrentUserBlockNumbers(Context context) { try { return BlockedNumberContract.canCurrentUserBlockNumbers(context); diff --git a/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java b/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java index 725cea723..0f1ab5f25 100644 --- a/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java +++ b/java/com/android/dialer/callcomposer/CopyAndResizeImageWorker.java @@ -37,7 +37,7 @@ import java.io.InputStream; import java.io.OutputStream; /** Task for copying and resizing images to be shared with RCS process. */ -@TargetApi(VERSION_CODES.M) +@TargetApi(VERSION_CODES.N) class CopyAndResizeImageWorker implements Worker> { 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 69f546929..c18e22d56 100644 --- a/java/com/android/dialer/callcomposer/camera/ImagePersistWorker.java +++ b/java/com/android/dialer/callcomposer/camera/ImagePersistWorker.java @@ -38,7 +38,7 @@ import java.io.IOException; import java.io.OutputStream; /** Persisting image routine. */ -@TargetApi(VERSION_CODES.M) +@TargetApi(VERSION_CODES.N) public class ImagePersistWorker implements Worker { private int width; private int height; diff --git a/java/com/android/dialer/calllog/AndroidManifest.xml b/java/com/android/dialer/calllog/AndroidManifest.xml index 69731fe39..7c904d993 100644 --- a/java/com/android/dialer/calllog/AndroidManifest.xml +++ b/java/com/android/dialer/calllog/AndroidManifest.xml @@ -17,7 +17,7 @@ package="com.android.dialer.calllog"> diff --git a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java index 9a80af2f7..7fc474a98 100644 --- a/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java +++ b/java/com/android/dialer/calllog/database/AnnotatedCallLogContentProvider.java @@ -92,7 +92,7 @@ public class AnnotatedCallLogContentProvider extends ContentProvider { return true; } - @TargetApi(Build.VERSION_CODES.M) // Uses try-with-resources + @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 6fd19dd17..dce51b750 100644 --- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java +++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java @@ -256,7 +256,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { } } - @TargetApi(Build.VERSION_CODES.M) // Uses try-with-resources + @TargetApi(Build.VERSION_CODES.N) // Uses try-with-resources private void handleInsertsAndUpdates( Context appContext, CallLogMutations mutations, Set existingAnnotatedCallLogIds) { long previousTimestampProcessed = sharedPreferences.getLong(PREF_LAST_TIMESTAMP_PROCESSED, 0L); @@ -481,7 +481,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { } } - @TargetApi(Build.VERSION_CODES.M) // Uses try-with-resources + @TargetApi(Build.VERSION_CODES.N) // Uses try-with-resources private static Set getAnnotatedCallLogIds(Context appContext) { ArraySet ids = new ArraySet<>(); @@ -510,7 +510,7 @@ public class SystemCallLogDataSource implements CallLogDataSource { return ids; } - @TargetApi(Build.VERSION_CODES.M) // Uses try-with-resources + @TargetApi(Build.VERSION_CODES.N) // Uses try-with-resources private static Set getIdsFromSystemCallLogThatMatch( Context appContext, Set matchingIds) { ArraySet ids = new ArraySet<>(); diff --git a/java/com/android/dialer/calllogutils/CallLogDates.java b/java/com/android/dialer/calllogutils/CallLogDates.java index fe3c0c3ad..5a63c3c8d 100644 --- a/java/com/android/dialer/calllogutils/CallLogDates.java +++ b/java/com/android/dialer/calllogutils/CallLogDates.java @@ -19,8 +19,6 @@ package com.android.dialer.calllogutils; import android.content.Context; import android.icu.lang.UCharacter; import android.icu.text.BreakIterator; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; import android.text.format.DateUtils; import java.util.Calendar; import java.util.Locale; @@ -145,12 +143,6 @@ public final class CallLogDates { // of the string is not usually capitalized. For example, "Wednesdsay" in Uzbek is "chorshanba” // (not capitalized). To handle this issue we apply title casing to the start of the sentence so // that "chorshanba, 2016 may 25,20:02" becomes "Chorshanba, 2016 may 25,20:02". - // - // The ICU library was not available in Android until N, so we can only do this in N+ devices. - // Pre-N devices will still see incorrect capitalization in some languages. - if (VERSION.SDK_INT < VERSION_CODES.N) { - return value; - } // Using the ICU library is safer than just applying toUpperCase() on the first letter of the // word because in some languages, there can be multiple starting characters which should be diff --git a/java/com/android/dialer/compat/CompatUtils.java b/java/com/android/dialer/compat/CompatUtils.java index 584f20549..d09f8b0e1 100644 --- a/java/com/android/dialer/compat/CompatUtils.java +++ b/java/com/android/dialer/compat/CompatUtils.java @@ -16,17 +16,17 @@ package com.android.dialer.compat; import android.content.Context; -import android.os.Build; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.os.LocaleList; import java.util.Locale; +/** TODO(calderwoodra): documentation */ public final class CompatUtils { /** PrioritizedMimeType is added in API level 23. */ public static boolean hasPrioritizedMimeType() { - return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) >= Build.VERSION_CODES.M; + return true; } /** @@ -36,8 +36,7 @@ public final class CompatUtils { * @return {@code true} if multi-SIM capability is available, {@code false} otherwise. */ public static boolean isMSIMCompatible() { - return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) - >= Build.VERSION_CODES.LOLLIPOP_MR1; + return true; } /** @@ -47,7 +46,7 @@ public final class CompatUtils { * @return {@code true} if video calling is allowed, {@code false} otherwise. */ public static boolean isVideoCompatible() { - return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) >= Build.VERSION_CODES.M; + return true; } /** @@ -57,7 +56,7 @@ public final class CompatUtils { * @return {@code true} if video presence checking is allowed, {@code false} otherwise. */ public static boolean isVideoPresenceCompatible() { - return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) > Build.VERSION_CODES.M; + return true; } /** @@ -67,7 +66,7 @@ public final class CompatUtils { * @return {@code true} if call subject is a feature on this device, {@code false} otherwise. */ public static boolean isCallSubjectCompatible() { - return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP) >= Build.VERSION_CODES.M; + return true; } /** Returns locale of the device. */ diff --git a/java/com/android/dialer/compat/SdkVersionOverride.java b/java/com/android/dialer/compat/SdkVersionOverride.java deleted file mode 100644 index 1d253a355..000000000 --- a/java/com/android/dialer/compat/SdkVersionOverride.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package com.android.dialer.compat; - -import android.os.Build.VERSION; - -/** - * Class used to override the current sdk version to test specific branches of compatibility logic. - * When such branching occurs, use {@link #getSdkVersion(int)} rather than explicitly calling {@link - * VERSION#SDK_INT}. This allows the sdk version to be forced to a specific value. - */ -public class SdkVersionOverride { - - /** Flag used to determine if override sdk versions are returned. */ - private static final boolean ALLOW_OVERRIDE_VERSION = false; - - private SdkVersionOverride() {} - - /** - * Gets the sdk version - * - * @param overrideVersion the version to attempt using - * @return overrideVersion if the {@link #ALLOW_OVERRIDE_VERSION} flag is set to {@code true}, - * otherwise the current version - */ - public static int getSdkVersion(int overrideVersion) { - return ALLOW_OVERRIDE_VERSION ? overrideVersion : VERSION.SDK_INT; - } -} diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index c4ed6e6ed..655540bba 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -25,7 +25,6 @@ import android.support.annotation.Nullable; import android.support.v4.os.BuildCompat; import android.telecom.PhoneAccountHandle; import android.telephony.TelephonyManager; -import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.telecom.TelecomUtil; import java.lang.reflect.InvocationTargetException; @@ -133,9 +132,6 @@ public class TelephonyManagerCompat { @Nullable public static Uri getVoicemailRingtoneUri( TelephonyManager telephonyManager, PhoneAccountHandle accountHandle) { - if (VERSION.SDK_INT < VERSION_CODES.N) { - return null; - } return telephonyManager.getVoicemailRingtoneUri(accountHandle); } @@ -149,8 +145,7 @@ public class TelephonyManagerCompat { */ public static boolean isVoicemailVibrationEnabled( TelephonyManager telephonyManager, PhoneAccountHandle accountHandle) { - return VERSION.SDK_INT < VERSION_CODES.N - || telephonyManager.isVoicemailVibrationEnabled(accountHandle); + return telephonyManager.isVoicemailVibrationEnabled(accountHandle); } /** @@ -159,9 +154,6 @@ public class TelephonyManagerCompat { */ public static void setVisualVoicemailEnabled( TelephonyManager telephonyManager, PhoneAccountHandle handle, boolean enabled) { - if (VERSION.SDK_INT < VERSION_CODES.N_MR1) { - Assert.fail("setVisualVoicemailEnabled called on pre-NMR1"); - } try { TelephonyManager.class .getMethod("setVisualVoicemailEnabled", PhoneAccountHandle.class, boolean.class) @@ -177,9 +169,6 @@ public class TelephonyManagerCompat { */ public static boolean isVisualVoicemailEnabled( TelephonyManager telephonyManager, PhoneAccountHandle handle) { - if (VERSION.SDK_INT < VERSION_CODES.N_MR1) { - Assert.fail("isVisualVoicemailEnabled called on pre-NMR1"); - } try { return (boolean) TelephonyManager.class diff --git a/java/com/android/dialer/database/CallLogQueryHandler.java b/java/com/android/dialer/database/CallLogQueryHandler.java index 92c49a09e..e974cc48f 100644 --- a/java/com/android/dialer/database/CallLogQueryHandler.java +++ b/java/com/android/dialer/database/CallLogQueryHandler.java @@ -26,7 +26,6 @@ import android.database.sqlite.SQLiteDiskIOException; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteFullException; import android.net.Uri; -import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -36,7 +35,6 @@ import android.provider.VoicemailContract.Voicemails; import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.AppCompatConstants; -import com.android.dialer.compat.SdkVersionOverride; import com.android.dialer.phonenumbercache.CallLogQuery; import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.PermissionsUtil; @@ -157,9 +155,7 @@ public class CallLogQueryHandler extends NoNullCursorAsyncQueryHandler { selectionArgs.add(Integer.toString(AppCompatConstants.CALLS_BLOCKED_TYPE)); // Ignore voicemails marked as deleted - if (SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) >= Build.VERSION_CODES.M) { - where.append(" AND (").append(Voicemails.DELETED).append(" = 0)"); - } + where.append(" AND (").append(Voicemails.DELETED).append(" = 0)"); if (newOnly) { where.append(" AND (").append(Calls.NEW).append(" = 1)"); diff --git a/java/com/android/dialer/oem/CequintCallerIdManager.java b/java/com/android/dialer/oem/CequintCallerIdManager.java index 48a5985ce..ee865bc14 100644 --- a/java/com/android/dialer/oem/CequintCallerIdManager.java +++ b/java/com/android/dialer/oem/CequintCallerIdManager.java @@ -41,7 +41,7 @@ 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.M) +@TargetApi(VERSION_CODES.N) public class CequintCallerIdManager { private static final String CONFIG_CALLER_ID_ENABLED = "config_caller_id_enabled"; diff --git a/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java b/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java index a3d51a78f..fe6642eef 100644 --- a/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java @@ -16,11 +16,8 @@ package com.android.dialer.phonelookup.blockednumber; -import android.annotation.TargetApi; import android.content.Context; import android.database.Cursor; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; import android.provider.BlockedNumberContract.BlockedNumbers; import android.support.annotation.NonNull; import android.support.annotation.WorkerThread; @@ -72,10 +69,7 @@ public class SystemBlockedNumberPhoneLookup implements PhoneLookup { - return queryNumbers(ImmutableSet.of(number)).get(number); - }); + return executorService.submit(() -> queryNumbers(ImmutableSet.of(number)).get(number)); } @Override @@ -96,7 +90,6 @@ public class SystemBlockedNumberPhoneLookup implements PhoneLookup queryNumbers( ImmutableSet numbers) { Assert.isWorkerThread(); @@ -171,9 +164,6 @@ public class SystemBlockedNumberPhoneLookup implements PhoneLookup= VERSION_CODES.N) ? c.getString(CallLogQuery.POST_DIAL_DIGITS) : ""; + String postDialDigits = c.getString(CallLogQuery.POST_DIAL_DIGITS); info.number = (matchedNumber == null) ? c.getString(CallLogQuery.NUMBER) + postDialDigits : matchedNumber; @@ -294,10 +279,7 @@ public class ContactInfoHelper { private List getRemoteDirectories(Context context) { List remoteDirectories = new ArrayList<>(); - Uri uri = - VERSION.SDK_INT >= VERSION_CODES.N - ? Directory.ENTERPRISE_CONTENT_URI - : Directory.CONTENT_URI; + Uri uri = Directory.ENTERPRISE_CONTENT_URI; Cursor cursor = context.getContentResolver().query(uri, new String[] {Directory._ID}, null, null, null); if (cursor == null) { diff --git a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java index bfaaa7cde..aa617889e 100644 --- a/java/com/android/dialer/preferredsim/PreferredAccountWorker.java +++ b/java/com/android/dialer/preferredsim/PreferredAccountWorker.java @@ -24,8 +24,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.Cursor; import android.net.Uri; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.PhoneLookup; @@ -130,9 +128,6 @@ public class PreferredAccountWorker implements Worker { private static Optional getDataId( @NonNull Context context, @Nullable String phoneNumber) { Assert.isWorkerThread(); - if (VERSION.SDK_INT < VERSION_CODES.N) { - return Optional.absent(); - } try (Cursor cursor = context .getContentResolver() diff --git a/java/com/android/dialer/shortcuts/AndroidManifest.xml b/java/com/android/dialer/shortcuts/AndroidManifest.xml index 117005841..36f61feff 100644 --- a/java/com/android/dialer/shortcuts/AndroidManifest.xml +++ b/java/com/android/dialer/shortcuts/AndroidManifest.xml @@ -17,7 +17,7 @@ package="com.android.dialer.shortcuts"> diff --git a/java/com/android/dialer/spannable/AndroidManifest.xml b/java/com/android/dialer/spannable/AndroidManifest.xml index e256dc1bb..5fa6407f7 100644 --- a/java/com/android/dialer/spannable/AndroidManifest.xml +++ b/java/com/android/dialer/spannable/AndroidManifest.xml @@ -17,6 +17,6 @@ package="com.android.dialer.spannable"> diff --git a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java index df58d419f..e87dee3b0 100644 --- a/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java +++ b/java/com/android/dialer/voicemail/listui/error/VoicemailStatusWorker.java @@ -32,7 +32,7 @@ import java.util.List; /** * Worker for {@link com.android.dialer.common.concurrent.DialerExecutors} to fetch voicemail status */ -@TargetApi(VERSION_CODES.M) +@TargetApi(VERSION_CODES.N) public class VoicemailStatusWorker implements Worker> { @Nullable diff --git a/java/com/android/incallui/AndroidManifest.xml b/java/com/android/incallui/AndroidManifest.xml index 24177979e..9a762feea 100644 --- a/java/com/android/incallui/AndroidManifest.xml +++ b/java/com/android/incallui/AndroidManifest.xml @@ -18,7 +18,7 @@ package="com.android.incallui"> diff --git a/java/com/android/incallui/CallerInfoAsyncQuery.java b/java/com/android/incallui/CallerInfoAsyncQuery.java index 87dcc4f40..4170cc318 100644 --- a/java/com/android/incallui/CallerInfoAsyncQuery.java +++ b/java/com/android/incallui/CallerInfoAsyncQuery.java @@ -53,7 +53,7 @@ import java.util.Arrays; * * @see CallerInfo */ -@TargetApi(VERSION_CODES.M) +@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 31b17112b..aef56872a 100644 --- a/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java +++ b/java/com/android/incallui/answer/impl/hint/PawImageLoaderImpl.java @@ -29,7 +29,7 @@ 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.M) +@TargetApi(VERSION_CODES.N) public final class PawImageLoaderImpl implements PawImageLoader { @Override diff --git a/java/com/android/incallui/autoresizetext/AndroidManifest.xml b/java/com/android/incallui/autoresizetext/AndroidManifest.xml index e26670e52..1ba8b7c04 100644 --- a/java/com/android/incallui/autoresizetext/AndroidManifest.xml +++ b/java/com/android/incallui/autoresizetext/AndroidManifest.xml @@ -18,7 +18,7 @@ package="com.android.incallui.autoresizetext"> diff --git a/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java b/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java index a3f2dfa4d..f9fe6a68a 100644 --- a/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java +++ b/java/com/android/incallui/legacyblocking/DeleteBlockedCallTask.java @@ -34,7 +34,7 @@ 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.M) +@TargetApi(VERSION_CODES.N) public class DeleteBlockedCallTask extends AsyncTask { public static final String IDENTIFIER = "DeleteBlockedCallTask"; diff --git a/java/com/android/incallui/rtt/protocol/AndroidManifest.xml b/java/com/android/incallui/rtt/protocol/AndroidManifest.xml index 52514a501..c0d39b091 100644 --- a/java/com/android/incallui/rtt/protocol/AndroidManifest.xml +++ b/java/com/android/incallui/rtt/protocol/AndroidManifest.xml @@ -17,6 +17,6 @@ \ No newline at end of file diff --git a/java/com/android/incallui/spam/SpamCallListListener.java b/java/com/android/incallui/spam/SpamCallListListener.java index 22b383332..9ef65d877 100644 --- a/java/com/android/incallui/spam/SpamCallListListener.java +++ b/java/com/android/incallui/spam/SpamCallListListener.java @@ -87,7 +87,7 @@ public class SpamCallListListener implements CallList.Listener { } /** Checks if the number is in the call history. */ - @TargetApi(VERSION_CODES.M) + @TargetApi(VERSION_CODES.N) private static final class NumberInCallHistoryWorker implements Worker { private final Context appContext; diff --git a/java/com/android/incallui/video/protocol/AndroidManifest.xml b/java/com/android/incallui/video/protocol/AndroidManifest.xml index 6f6558278..f059b191f 100644 --- a/java/com/android/incallui/video/protocol/AndroidManifest.xml +++ b/java/com/android/incallui/video/protocol/AndroidManifest.xml @@ -17,6 +17,6 @@ diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index a2fb73bd2..d9660e192 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -17,7 +17,6 @@ package com.android.incallui.videotech.ims; import android.content.Context; -import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; @@ -61,10 +60,6 @@ public class ImsVideoTech implements VideoTech { @Override public boolean isAvailable(Context context, PhoneAccountHandle phoneAccountHandle) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { - return false; - } - if (call.getVideoCall() == null) { return false; } diff --git a/java/com/android/voicemail/AndroidManifest.xml b/java/com/android/voicemail/AndroidManifest.xml index d64fb2504..23c746a80 100644 --- a/java/com/android/voicemail/AndroidManifest.xml +++ b/java/com/android/voicemail/AndroidManifest.xml @@ -17,7 +17,7 @@ package="com.android.voicemail"> diff --git a/java/com/android/voicemail/impl/PackageReplacedReceiver.java b/java/com/android/voicemail/impl/PackageReplacedReceiver.java index bc56286fb..9fa9f75c7 100644 --- a/java/com/android/voicemail/impl/PackageReplacedReceiver.java +++ b/java/com/android/voicemail/impl/PackageReplacedReceiver.java @@ -91,7 +91,7 @@ public class PackageReplacedReceiver extends BroadcastReceiver { this.context = context; } - @TargetApi(android.os.Build.VERSION_CODES.M) // used for try with resources + @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/sync/VoicemailsQueryHelper.java b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java index c47b40dab..be11c4453 100644 --- a/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java +++ b/java/com/android/voicemail/impl/sync/VoicemailsQueryHelper.java @@ -256,7 +256,7 @@ public class VoicemailsQueryHelper { } /** Find the oldest voicemails that are on the device, and also on the server. */ - @TargetApi(VERSION_CODES.M) // used for try with resources + @TargetApi(VERSION_CODES.N) // used for try with resources public List oldestVoicemailsOnServer(int numVoicemails) { if (numVoicemails <= 0) { Assert.fail("Query for remote voicemails cannot be <= 0"); diff --git a/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java b/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java index 3bd14731f..d8c00ed91 100644 --- a/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java +++ b/java/com/android/voicemail/impl/transcribe/TranscriptionUtils.java @@ -34,7 +34,7 @@ public class TranscriptionUtils { static final String AMR_PREFIX = "#!AMR\n"; // Uses try-with-resource - @TargetApi(android.os.Build.VERSION_CODES.M) + @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); -- cgit v1.2.3