summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/dialer/assisteddialing/AssistedDialingMediator.java12
-rw-r--r--java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java8
-rw-r--r--java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java6
-rw-r--r--java/com/android/dialer/assisteddialing/ConcreteCreator.java10
-rw-r--r--java/com/android/dialer/assisteddialing/Constraints.java8
-rw-r--r--java/com/android/dialer/assisteddialing/CountryCodeProvider.java4
-rw-r--r--java/com/android/dialer/assisteddialing/LocationDetector.java12
-rw-r--r--java/com/android/dialer/assisteddialing/NumberTransformer.java23
-rw-r--r--java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java4
9 files changed, 13 insertions, 74 deletions
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
index 756fd6125..6715e2b21 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import java.util.Optional;
@@ -25,14 +23,10 @@ import java.util.Optional;
public interface AssistedDialingMediator {
/** Returns {@code true} if the current client platform supports Assisted Dialing. */
- public boolean isPlatformEligible();
+ boolean isPlatformEligible();
/** Returns the country code in which the library thinks the user typically resides. */
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<String> userHomeCountryCode();
+ Optional<String> userHomeCountryCode();
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform);
+ Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform);
}
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
index 7214437ab..7fdb8dafc 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java
@@ -16,10 +16,7 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
-import android.support.annotation.RequiresApi;
import com.android.dialer.common.LogUtil;
import java.util.Optional;
@@ -30,7 +27,6 @@ import java.util.Optional;
* call is eligible for assisted dialing, and performing the transformation of numbers eligible for
* assisted dialing.
*/
-@RequiresApi(VERSION_CODES.N)
final class AssistedDialingMediatorImpl implements AssistedDialingMediator {
private final LocationDetector locationDetector;
@@ -58,8 +54,6 @@ final class AssistedDialingMediatorImpl implements AssistedDialingMediator {
/** Returns the country code in which the library thinks the user typically resides. */
@Override
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
public Optional<String> userHomeCountryCode() {
return locationDetector.getUpperCaseUserHomeCountry();
}
@@ -69,8 +63,6 @@ final class AssistedDialingMediatorImpl implements AssistedDialingMediator {
* transformed number should be capable of dialing out of the User's current country and
* successfully connecting with a contact in the User's home country.
*/
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
@Override
public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform) {
Optional<String> userHomeCountryCode = locationDetector.getUpperCaseUserHomeCountry();
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
index 9a40e0576..cb3ca79f9 100644
--- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
+++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import java.util.Optional;
@@ -26,16 +24,12 @@ public final class AssistedDialingMediatorStub implements AssistedDialingMediato
/** Always returns an empty Optional. */
@Override
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
public Optional<TransformationInfo> attemptAssistedDial(@NonNull String numberToTransform) {
return Optional.empty();
}
/** Always returns an empty Optional. */
@Override
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
public Optional<String> userHomeCountryCode() {
return Optional.empty();
}
diff --git a/java/com/android/dialer/assisteddialing/ConcreteCreator.java b/java/com/android/dialer/assisteddialing/ConcreteCreator.java
index 050774340..ab8ea70a7 100644
--- a/java/com/android/dialer/assisteddialing/ConcreteCreator.java
+++ b/java/com/android/dialer/assisteddialing/ConcreteCreator.java
@@ -16,13 +16,11 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
-import android.support.annotation.VisibleForTesting;
import android.support.v4.os.UserManagerCompat;
import android.telephony.TelephonyManager;
import com.android.dialer.common.LogUtil;
@@ -36,13 +34,10 @@ import com.android.dialer.strictmode.StrictModeUtils;
* <p>This helps keep the dependencies required by AssistedDialingMediator for assisted dialing
* explicit.
*/
-@TargetApi(VERSION_CODES.N)
public final class ConcreteCreator {
- // Floor set at N due to use of Optional.
- @VisibleForTesting public static final int BUILD_CODE_FLOOR = Build.VERSION_CODES.N;
// Ceiling set at P because this feature will ship as part of the framework in Q.
- @VisibleForTesting public static final int BUILD_CODE_CEILING = 28;
+ public static final int BUILD_CODE_CEILING = VERSION_CODES.P;
/**
* Creates a new AssistedDialingMediator
@@ -105,8 +100,7 @@ public final class ConcreteCreator {
throw new NullPointerException("Provided configProvider was null");
}
- return (Build.VERSION.SDK_INT >= BUILD_CODE_FLOOR
- && Build.VERSION.SDK_INT <= BUILD_CODE_CEILING)
+ return Build.VERSION.SDK_INT <= BUILD_CODE_CEILING
&& configProvider.getBoolean("assisted_dialing_enabled", false);
}
diff --git a/java/com/android/dialer/assisteddialing/Constraints.java b/java/com/android/dialer/assisteddialing/Constraints.java
index cae3734be..41a3e92b2 100644
--- a/java/com/android/dialer/assisteddialing/Constraints.java
+++ b/java/com/android/dialer/assisteddialing/Constraints.java
@@ -16,9 +16,7 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
import android.content.Context;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -35,8 +33,6 @@ import java.util.Locale;
import java.util.Optional;
/** Ensures that a number is eligible for Assisted Dialing */
-@TargetApi(VERSION_CODES.N)
-@SuppressWarnings("AndroidApiChecker") // Use of optional
final class Constraints {
private final PhoneNumberUtil phoneNumberUtil;
private final Context context;
@@ -46,7 +42,7 @@ final class Constraints {
* Create a new instance of Constraints.
*
* @param context The context used to determine whether or not a number is an emergency number.
- * @param configProviderCountryCodes A csv of supported country codes, e.g. "US,CA"
+ * @param countryCodeProvider A csv of supported country codes, e.g. "US,CA"
*/
public Constraints(@NonNull Context context, @NonNull CountryCodeProvider countryCodeProvider) {
if (context == null) {
@@ -73,7 +69,7 @@ final class Constraints {
* @return A boolean indicating whether or not the provided values are eligible for assisted
* dialing.
*/
- public boolean meetsPreconditions(
+ boolean meetsPreconditions(
@NonNull String numberToCheck,
@NonNull String userHomeCountryCode,
@NonNull String userRoamingCountryCode) {
diff --git a/java/com/android/dialer/assisteddialing/CountryCodeProvider.java b/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
index 118696e9b..04b229150 100644
--- a/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
+++ b/java/com/android/dialer/assisteddialing/CountryCodeProvider.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.ArraySet;
@@ -32,8 +30,6 @@ import java.util.StringTokenizer;
import java.util.stream.Collectors;
/** A class to provide the appropriate country codes related to assisted dialing. */
-@TargetApi(VERSION_CODES.N)
-@SuppressWarnings("AndroidApiChecker") // Java 8 APIs
public final class CountryCodeProvider {
// TODO(erfanian): Ensure the below standard is consistent between libphonenumber and the
diff --git a/java/com/android/dialer/assisteddialing/LocationDetector.java b/java/com/android/dialer/assisteddialing/LocationDetector.java
index 8e7535c1b..9fa944125 100644
--- a/java/com/android/dialer/assisteddialing/LocationDetector.java
+++ b/java/com/android/dialer/assisteddialing/LocationDetector.java
@@ -16,8 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.telephony.TelephonyManager;
@@ -36,7 +34,7 @@ final class LocationDetector {
private final TelephonyManager telephonyManager;
private final String userProvidedHomeCountry;
- public LocationDetector(
+ LocationDetector(
@NonNull TelephonyManager telephonyManager, @Nullable String userProvidedHomeCountry) {
if (telephonyManager == null) {
throw new NullPointerException("Provided TelephonyManager was null");
@@ -53,9 +51,7 @@ final class LocationDetector {
* Returns what we believe to be the User's home country. This should resolve to
* PROPERTY_ICC_OPERATOR_ISO_COUNTRY
*/
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<String> getUpperCaseUserHomeCountry() {
+ Optional<String> getUpperCaseUserHomeCountry() {
if (!TextUtils.isEmpty(userProvidedHomeCountry)) {
LogUtil.i(
@@ -73,9 +69,7 @@ final class LocationDetector {
}
/** Returns what we believe to be the User's current (roaming) country */
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<String> getUpperCaseUserRoamingCountry() {
+ Optional<String> getUpperCaseUserRoamingCountry() {
// TODO Increase coverage of location resolution??
String networkCountryIso = telephonyManager.getNetworkCountryIso();
if (networkCountryIso != null) {
diff --git a/java/com/android/dialer/assisteddialing/NumberTransformer.java b/java/com/android/dialer/assisteddialing/NumberTransformer.java
index 8bbad329d..eabf8564e 100644
--- a/java/com/android/dialer/assisteddialing/NumberTransformer.java
+++ b/java/com/android/dialer/assisteddialing/NumberTransformer.java
@@ -16,9 +16,6 @@
package com.android.dialer.assisteddialing;
-import android.annotation.TargetApi;
-import android.os.Build.VERSION_CODES;
-import android.support.annotation.NonNull;
import android.text.TextUtils;
import com.android.dialer.common.LogUtil;
import com.android.dialer.strictmode.StrictModeUtils;
@@ -33,21 +30,9 @@ final class NumberTransformer {
private final PhoneNumberUtil phoneNumberUtil;
private final Constraints constraints;
- public NumberTransformer(Constraints constraints) {
+ NumberTransformer(Constraints constraints) {
this.constraints = constraints;
- this.phoneNumberUtil = StrictModeUtils.bypass(() -> PhoneNumberUtil.getInstance());
- }
-
- /**
- * Returns a boolean for callers to quickly determine whether or not the AssistedDialingMediator
- * thinks an attempt at assisted dialing is likely to succeed.
- */
- public boolean canDoAssistedDialingTransformation(
- @NonNull String numberToCheck,
- @NonNull String userHomeCountryCode,
- @NonNull String userRoamingCountryCode) {
- return constraints.meetsPreconditions(
- numberToCheck, userHomeCountryCode, userRoamingCountryCode);
+ this.phoneNumberUtil = StrictModeUtils.bypass(PhoneNumberUtil::getInstance);
}
/**
@@ -57,9 +42,7 @@ final class NumberTransformer {
* transformation fails, we return an empty optional. The operation can be considered a success
* when the Optional we return has a value set.
*/
- @SuppressWarnings("AndroidApiChecker") // Use of optional
- @TargetApi(VERSION_CODES.N)
- public Optional<TransformationInfo> doAssistedDialingTransformation(
+ Optional<TransformationInfo> doAssistedDialingTransformation(
String numbertoTransform, String userHomeCountryCode, String userRoamingCountryCode) {
if (!constraints.meetsPreconditions(
diff --git a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
index 965a16975..2da25287e 100644
--- a/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
+++ b/java/com/android/dialer/assisteddialing/ui/AssistedDialingSettingFragment.java
@@ -15,10 +15,8 @@
*/
package com.android.dialer.assisteddialing.ui;
-import android.annotation.TargetApi;
import android.icu.util.ULocale;
import android.icu.util.ULocale.Builder;
-import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -38,8 +36,6 @@ import java.util.List;
import java.util.Optional;
/** The setting for Assisted Dialing */
-@TargetApi(VERSION_CODES.N)
-@SuppressWarnings("AndroidApiChecker") // Java 8 APIs
public class AssistedDialingSettingFragment extends PreferenceFragment {
private CountryCodeProvider countryCodeProvider;