diff options
author | erfanian <erfanian@google.com> | 2017-08-09 16:09:45 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-09 17:36:46 -0700 |
commit | 4e0d3bcc3b9e962ee5b8cb9614a9a545d50b8882 (patch) | |
tree | 165cace32991b7cc0883df0c32af7bb556d211ba /java/com/android | |
parent | dee030fa20b4f659a2970680554ee5c264552b21 (diff) |
Add Assisted Dialing iconography to the incallui.
* Abstracts reference to telecom constant until available in the platform.
* Implements a new "Assisted Dialing" token/icon until final UX mocks are available.
* Adds unit test for outgoing call.
In a subsequent, related change:
* Modifications to fragments that contain contacts, the extra key will be inserted via call details to indicate the outgoing intent should use assisted dialing.
Bug: 64205446
Test: New Unit Test
PiperOrigin-RevId: 164788082
Change-Id: I5d388f7b6c4e55c42773d314d2417b6dbc38b972
Diffstat (limited to 'java/com/android')
7 files changed, 63 insertions, 6 deletions
diff --git a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java index cea137c77..22ec70cba 100644 --- a/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java +++ b/java/com/android/dialer/compat/telephony/TelephonyManagerCompat.java @@ -50,6 +50,23 @@ public class TelephonyManagerCompat { private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE"; + // TODO(erfanian): b/63995261 Replace with the platform/telecom constant when available. + /** + * Indicates that the call being placed originated from a known contact. + * + * <p>This signals to the telephony platform that an outgoing call qualifies for assisted dialing. + */ + public static final String ALLOW_ASSISTED_DIAL = "android.telecom.extra.ALLOW_ASSISTED_DIAL"; + + // TODO(erfanian): b/63995261 Replace with the platform/telecom constant when available. + /** + * Indicates that an outgoing call has undergone assisted dialing. + * + * <p>Unlike {@link ALLOW_ASSISTED_DIAL}, the presence of this key further indicates that a call + * has undergone Assisted Dialing -- not just that it qualified for Assisted Dialing. + */ + public static final String IS_ASSISTED_DIALED = "android.telecom.extra.IS_ASSISTED_DIALED"; + /** * Returns the number of phones available. Returns 1 for Single standby mode (Single SIM * functionality) Returns 2 for Dual standby mode.(Dual SIM functionality) diff --git a/java/com/android/incallui/CallCardPresenter.java b/java/com/android/incallui/CallCardPresenter.java index b02c989fc..824d87554 100644 --- a/java/com/android/incallui/CallCardPresenter.java +++ b/java/com/android/incallui/CallCardPresenter.java @@ -480,7 +480,8 @@ public class CallCardPresenter mPrimary.isRemotelyHeld(), isBusiness, supports2ndCallOnHold(), - getSwapToSecondaryButtonState())); + getSwapToSecondaryButtonState(), + mPrimary.isAssistedDialed())); InCallActivity activity = (InCallActivity) (mInCallScreen.getInCallScreenFragment().getActivity()); diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 7ef8ad270..4d8068846 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -1005,6 +1005,13 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa return mLogState.isIncoming; } + public boolean isAssistedDialed() { + if (getIntentExtras() != null) { + return getIntentExtras().getBoolean(TelephonyManagerCompat.IS_ASSISTED_DIALED, false); + } + return false; + } + public LatencyReport getLatencyReport() { return mLatencyReport; } diff --git a/java/com/android/incallui/contactgrid/BottomRow.java b/java/com/android/incallui/contactgrid/BottomRow.java index 76e0289a5..6068cc0e5 100644 --- a/java/com/android/incallui/contactgrid/BottomRow.java +++ b/java/com/android/incallui/contactgrid/BottomRow.java @@ -49,6 +49,7 @@ public class BottomRow { public final boolean isForwardIconVisible; public final boolean isSpamIconVisible; public final boolean shouldPopulateAccessibilityEvent; + public final boolean isAssistedDialedVisisble; public Info( @Nullable CharSequence label, @@ -58,7 +59,8 @@ public class BottomRow { boolean isHdIconVisible, boolean isForwardIconVisible, boolean isSpamIconVisible, - boolean shouldPopulateAccessibilityEvent) { + boolean shouldPopulateAccessibilityEvent, + boolean isAssistedDialedVisisble) { this.label = label; this.isTimerVisible = isTimerVisible; this.isWorkIconVisible = isWorkIconVisible; @@ -67,6 +69,7 @@ public class BottomRow { this.isForwardIconVisible = isForwardIconVisible; this.isSpamIconVisible = isSpamIconVisible; this.shouldPopulateAccessibilityEvent = shouldPopulateAccessibilityEvent; + this.isAssistedDialedVisisble = isAssistedDialedVisisble; } } @@ -81,6 +84,7 @@ public class BottomRow { boolean isHdAttemptingIconVisible = state.isHdAttempting; boolean isSpamIconVisible = false; boolean shouldPopulateAccessibilityEvent = true; + boolean isAssistedDialedVisisble = state.isAssistedDialed; if (isIncoming(state) && primaryInfo.isSpam) { label = context.getString(R.string.contact_grid_incoming_suspected_spam); @@ -117,7 +121,8 @@ public class BottomRow { isHdIconVisible, isForwardIconVisible, isSpamIconVisible, - shouldPopulateAccessibilityEvent); + shouldPopulateAccessibilityEvent, + isAssistedDialedVisisble); } private static CharSequence getLabelForPhoneNumber(PrimaryInfo primaryInfo) { diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java index e4a8a1cc4..ddf16e340 100644 --- a/java/com/android/incallui/contactgrid/ContactGridManager.java +++ b/java/com/android/incallui/contactgrid/ContactGridManager.java @@ -60,7 +60,7 @@ public class ContactGridManager { @Nullable private ImageView avatarImageView; // Row 2: Mobile +1 (650) 253-0000 - // Row 2: [HD attempting icon]/[HD icon] 00:15 + // Row 2: [HD attempting icon]/[HD icon] [Assisted Dialing Icon] 00:15 // Row 2: Call ended // Row 2: Hanging up // Row 2: [Alert sign] Suspected spam caller @@ -68,6 +68,7 @@ public class ContactGridManager { private final ImageView workIconImageView; private final ImageView hdIconImageView; private final ImageView forwardIconImageView; + private final ImageView assistedDialingImageView; private final TextView forwardedNumberView; private final ImageView spamIconImageView; private final ViewAnimator bottomTextSwitcher; @@ -98,6 +99,7 @@ public class ContactGridManager { hdIconImageView = view.findViewById(R.id.contactgrid_hdIcon); forwardIconImageView = view.findViewById(R.id.contactgrid_forwardIcon); forwardedNumberView = view.findViewById(R.id.contactgrid_forwardNumber); + assistedDialingImageView = view.findViewById(R.id.contactgrid_assistedDialingIcon); spamIconImageView = view.findViewById(R.id.contactgrid_spamIcon); bottomTextSwitcher = view.findViewById(R.id.contactgrid_bottom_text_switcher); bottomTextView = view.findViewById(R.id.contactgrid_bottom_text); @@ -309,6 +311,8 @@ public class ContactGridManager { bottomTextView.setText(info.label); bottomTextView.setAllCaps(info.isSpamIconVisible); workIconImageView.setVisibility(info.isWorkIconVisible ? View.VISIBLE : View.GONE); + assistedDialingImageView.setVisibility( + info.isAssistedDialedVisisble ? View.VISIBLE : View.GONE); if (hdIconImageView.getVisibility() == View.GONE) { if (info.isHdAttemptingIconVisible) { hdIconImageView.setVisibility(View.VISIBLE); diff --git a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml index c74017e5d..8850dd856 100644 --- a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml +++ b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_bottom_row.xml @@ -1,4 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2017 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 + --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" @@ -17,6 +32,10 @@ android:src="@drawable/asd_hd_icon" android:visibility="gone"/> <ImageView + android:id="@+id/contactgrid_assistedDialingIcon" + style="@style/BottomRowIcon" + android:src="@drawable/quantum_ic_language_vd_theme_24"/> + <ImageView android:id="@id/contactgrid_forwardIcon" style="@style/BottomRowIcon" android:src="@drawable/quantum_ic_forward_vd_theme_24"/> diff --git a/java/com/android/incallui/incall/protocol/PrimaryCallState.java b/java/com/android/incallui/incall/protocol/PrimaryCallState.java index aac6ff96b..791f22ea7 100644 --- a/java/com/android/incallui/incall/protocol/PrimaryCallState.java +++ b/java/com/android/incallui/incall/protocol/PrimaryCallState.java @@ -62,6 +62,7 @@ public class PrimaryCallState { public final boolean isBusinessNumber; public final boolean supportsCallOnHold; public final @ButtonState int swapToSecondaryButtonState; + public final boolean isAssistedDialed; // TODO: Convert to autovalue. b/34502119 public static PrimaryCallState createEmptyPrimaryCallState() { @@ -87,7 +88,8 @@ public class PrimaryCallState { false /* isRemotelyHeld */, false /* isBusinessNumber */, true /* supportsCallOnHold */, - ButtonState.NOT_SUPPORT /* swapToSecondaryButtonState */); + ButtonState.NOT_SUPPORT /* swapToSecondaryButtonState */, + false /* isAssistedDialed */); } public PrimaryCallState( @@ -112,7 +114,8 @@ public class PrimaryCallState { boolean isRemotelyHeld, boolean isBusinessNumber, boolean supportsCallOnHold, - @ButtonState int swapToSecondaryButtonState) { + @ButtonState int swapToSecondaryButtonState, + boolean isAssistedDialed) { this.state = state; this.isVideoCall = isVideoCall; this.sessionModificationState = sessionModificationState; @@ -135,6 +138,7 @@ public class PrimaryCallState { this.isBusinessNumber = isBusinessNumber; this.supportsCallOnHold = supportsCallOnHold; this.swapToSecondaryButtonState = swapToSecondaryButtonState; + this.isAssistedDialed = isAssistedDialed; } @Override |