diff options
author | Qi Wang <wangqi@google.com> | 2016-03-02 04:38:58 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-03-02 04:38:58 +0000 |
commit | da70d267ac39849a25efa9223f444795eecc85cb (patch) | |
tree | 48e315c4c387dd41310563beaf274b38e5410bee /InCallUI | |
parent | 161f6730b713e0bc49f877b2ab363355b44e0a46 (diff) | |
parent | c98bc9613ea8ac8e00400898338e802e536a9bce (diff) |
Merge "Accessibility: announce the active call after switching calls." into nyc-dev am: af5880f151
am: c98bc9613e
* commit 'c98bc9613ea8ac8e00400898338e802e536a9bce':
Accessibility: announce the active call after switching calls.
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 17 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 10 |
2 files changed, 20 insertions, 7 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 9ba4a2b70..785d3d3aa 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -1124,10 +1124,19 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { if (event.getEventType() == AccessibilityEvent.TYPE_ANNOUNCEMENT) { - dispatchPopulateAccessibilityEvent(event, mCallStateLabel); - dispatchPopulateAccessibilityEvent(event, mPrimaryName); - dispatchPopulateAccessibilityEvent(event, mCallTypeLabel); - dispatchPopulateAccessibilityEvent(event, mPhoneNumber); + // Indicate this call is in active if no label is provided. The label is empty when + // the call is in active, not in other status such as onhold or dialing etc. + if (!mCallStateLabel.isShown() || TextUtils.isEmpty(mCallStateLabel.getText())) { + event.getText().add( + TextUtils.expandTemplate( + getResources().getText(R.string.accessibility_call_is_active), + mPrimaryName.getText())); + } else { + dispatchPopulateAccessibilityEvent(event, mCallStateLabel); + dispatchPopulateAccessibilityEvent(event, mPrimaryName); + dispatchPopulateAccessibilityEvent(event, mCallTypeLabel); + dispatchPopulateAccessibilityEvent(event, mPhoneNumber); + } return; } dispatchPopulateAccessibilityEvent(event, mCallStateLabel); diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 8c22f92e1..0be9b1227 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -335,7 +335,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> getUi().setEndCallButtonEnabled(shouldShowEndCallButton(mPrimary, callState), callState != Call.State.INCOMING /* animate */); - maybeSendAccessibilityEvent(oldState, newState); + maybeSendAccessibilityEvent(oldState, newState, primaryChanged); } @Override @@ -1070,7 +1070,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> return true; } - private void maybeSendAccessibilityEvent(InCallState oldState, InCallState newState) { + private void maybeSendAccessibilityEvent(InCallState oldState, InCallState newState, + boolean primaryChanged) { if (mContext == null) { return; } @@ -1079,8 +1080,11 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> if (!am.isEnabled()) { return; } + // Announce the current call if it's new incoming/outgoing call or primary call is changed + // due to switching calls between two ongoing calls (one is on hold). if ((oldState != InCallState.OUTGOING && newState == InCallState.OUTGOING) - || (oldState != InCallState.INCOMING && newState == InCallState.INCOMING)) { + || (oldState != InCallState.INCOMING && newState == InCallState.INCOMING) + || primaryChanged) { if (getUi() != null) { getUi().sendAccessibilityAnnouncement(); } |