Loading java/com/android/dialer/assisteddialing/AssistedDialingMediator.java +5 −0 Original line number Diff line number Diff line Loading @@ -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); Loading java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java +8 −0 Original line number Diff line number Diff line Loading @@ -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 Loading java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java +8 −0 Original line number Diff line number Diff line Loading @@ -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; Loading java/com/android/dialer/assisteddialing/ui/res/values/strings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ <string name="assisted_dialing_setting_title">Assisted dialing</string> <!-- Label for a setting enabling assisted dialing switch preference--> <string name="assisted_dialing_setting_summary">Automatically correct the phone number prefix when traveling and calling international numbers</string> <string name="assisted_dialing_setting_summary">Predict and add a country code when you call while traveling abroad</string> <!-- Key for the assisted dialing setting toggle--> <string name="assisted_dialing_setting_toggle_key" translatable="false">assisted_dialing_setting_toggle_key</string> Loading java/com/android/dialer/contactsfragment/ContactsAdapter.java +10 −7 Original line number Diff line number Diff line Loading @@ -49,22 +49,24 @@ final class ContactsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder private final ArrayMap<ContactViewHolder, Integer> holderMap = new ArrayMap<>(); private final Context context; private final Cursor cursor; private final @Header int header; private final @ClickAction int clickAction; // List of contact sublist headers private final String[] headers; private String[] headers = new String[0]; // Number of contacts that correspond to each header in {@code headers}. private final int[] counts; private int[] counts = new int[0]; // Cursor with list of contacts private Cursor cursor; ContactsAdapter( Context context, Cursor cursor, @Header int header, @ClickAction int clickAction) { ContactsAdapter(Context context, @Header int header, @ClickAction int clickAction) { this.context = context; this.cursor = cursor; this.header = header; this.clickAction = clickAction; } void updateCursor(Cursor cursor) { this.cursor = cursor; headers = cursor.getExtras().getStringArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_TITLES); counts = cursor.getExtras().getIntArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS); if (counts != null) { Loading @@ -78,6 +80,7 @@ final class ContactsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder "ContactsAdapter", "Count sum (%d) != cursor count (%d).", sum, cursor.getCount()); } } notifyDataSetChanged(); } @Override Loading Loading
java/com/android/dialer/assisteddialing/AssistedDialingMediator.java +5 −0 Original line number Diff line number Diff line Loading @@ -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); Loading
java/com/android/dialer/assisteddialing/AssistedDialingMediatorImpl.java +8 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
java/com/android/dialer/assisteddialing/AssistedDialingMediatorStub.java +8 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
java/com/android/dialer/assisteddialing/ui/res/values/strings.xml +2 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ <string name="assisted_dialing_setting_title">Assisted dialing</string> <!-- Label for a setting enabling assisted dialing switch preference--> <string name="assisted_dialing_setting_summary">Automatically correct the phone number prefix when traveling and calling international numbers</string> <string name="assisted_dialing_setting_summary">Predict and add a country code when you call while traveling abroad</string> <!-- Key for the assisted dialing setting toggle--> <string name="assisted_dialing_setting_toggle_key" translatable="false">assisted_dialing_setting_toggle_key</string> Loading
java/com/android/dialer/contactsfragment/ContactsAdapter.java +10 −7 Original line number Diff line number Diff line Loading @@ -49,22 +49,24 @@ final class ContactsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder private final ArrayMap<ContactViewHolder, Integer> holderMap = new ArrayMap<>(); private final Context context; private final Cursor cursor; private final @Header int header; private final @ClickAction int clickAction; // List of contact sublist headers private final String[] headers; private String[] headers = new String[0]; // Number of contacts that correspond to each header in {@code headers}. private final int[] counts; private int[] counts = new int[0]; // Cursor with list of contacts private Cursor cursor; ContactsAdapter( Context context, Cursor cursor, @Header int header, @ClickAction int clickAction) { ContactsAdapter(Context context, @Header int header, @ClickAction int clickAction) { this.context = context; this.cursor = cursor; this.header = header; this.clickAction = clickAction; } void updateCursor(Cursor cursor) { this.cursor = cursor; headers = cursor.getExtras().getStringArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_TITLES); counts = cursor.getExtras().getIntArray(Contacts.EXTRA_ADDRESS_BOOK_INDEX_COUNTS); if (counts != null) { Loading @@ -78,6 +80,7 @@ final class ContactsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder "ContactsAdapter", "Count sum (%d) != cursor count (%d).", sum, cursor.getCount()); } } notifyDataSetChanged(); } @Override Loading