Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd5228be authored by Android Dialer's avatar Android Dialer Committed by android-build-merger
Browse files

Merge changes I0f1ed20a,Ia68d3b13,I72047d59,Ieff3c7fb,I53c3896a, ...

am: 1b4ec7b9

Change-Id: I64dc696d2a569446490840a4c449c3764a3ce61e
parents 05d055fe 1b4ec7b9
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -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);
}
+0 −8
Original line number Diff line number Diff line
@@ -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();
+0 −6
Original line number Diff line number Diff line
@@ -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();
  }
+4 −10
Original line number Diff line number Diff line
@@ -16,13 +16,10 @@

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 +33,11 @@ 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;
  // Ceiling set at P (version code 28) because this feature will ship as part of the framework in
  // Q.
  public static final int BUILD_CODE_CEILING = 28;

  /**
   * 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);
  }

+2 −6
Original line number Diff line number Diff line
@@ -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) {
Loading