diff options
Diffstat (limited to 'java/com/android')
3 files changed, 21 insertions, 0 deletions
diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java index 004d2f7da..756fd6125 100644 --- a/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java +++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediator.java @@ -27,6 +27,11 @@ public interface AssistedDialingMediator { /** Returns {@code true} if the current client platform supports Assisted Dialing. */ public 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(); + @SuppressWarnings("AndroidApiChecker") // Use of optional @TargetApi(VERSION_CODES.N) public 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 1cc9732bb..7214437ab 100644 --- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java +++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java @@ -56,6 +56,14 @@ final class AssistedDialingMediatorImpl implements AssistedDialingMediator { return true; } + /** 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(); + } + /** * Returns an Optional of type String containing the transformed number that was provided. The * transformed number should be capable of dialing out of the User's current country and diff --git a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java index fe32e2c9a..9a40e0576 100644 --- a/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java +++ b/java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java @@ -32,6 +32,14 @@ public final class AssistedDialingMediatorStub implements AssistedDialingMediato 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(); + } + @Override public boolean isPlatformEligible() { return false; |