diff options
author | Yorke Lee <yorkelee@google.com> | 2013-09-20 15:08:29 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-09-20 15:10:51 -0700 |
commit | cd72227f331b862d70c1271b1c9a5f3a1ab30bee (patch) | |
tree | 7d517d55333952ce2928f494d84eee320b881881 /InCallUI/src | |
parent | d9ba6ebfeb47fa94e19271179fbe295b381cc7bc (diff) |
Read back contact information in in-call screen
This changes talkback behavior so that it behaves the same way
as in 4.3, other than reading the unnecessary description of the
contact's photo
Bug: 10844641
Change-Id: I2a2829d1a9650bf18d3b1d98d6ddc860fe9f8d27
Diffstat (limited to 'InCallUI/src')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 29 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 9 |
2 files changed, 38 insertions, 0 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index e6c5bce2b..5ea6e918f 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -29,11 +29,14 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewStub; +import android.view.accessibility.AccessibilityEvent; import android.widget.ImageView; import android.widget.TextView; import com.android.services.telephony.common.Call; +import java.util.List; + /** * Fragment for call card. */ @@ -494,4 +497,30 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr }); } } + + public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { + if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) { + dispatchPopulateAccessibilityEvent(event, mPrimaryName); + dispatchPopulateAccessibilityEvent(event, mPhoneNumber); + return; + } + dispatchPopulateAccessibilityEvent(event, mCallStateLabel); + dispatchPopulateAccessibilityEvent(event, mPrimaryName); + dispatchPopulateAccessibilityEvent(event, mPhoneNumber); + dispatchPopulateAccessibilityEvent(event, mCallTypeLabel); + dispatchPopulateAccessibilityEvent(event, mSecondaryCallName); + + return; + } + + private void dispatchPopulateAccessibilityEvent(AccessibilityEvent event, View view) { + if (view == null) return; + final List<CharSequence> eventText = event.getText(); + int size = eventText.size(); + view.dispatchPopulateAccessibilityEvent(event); + // if no text added write null to keep relative position + if (size == eventText.size()) { + eventText.add(null); + } + } } diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index d2a7f21ab..c3793ad2e 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -27,6 +27,7 @@ import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; +import android.view.accessibility.AccessibilityEvent; import android.widget.Toast; /** @@ -343,4 +344,12 @@ public class InCallActivity extends Activity { final PostCharDialogFragment fragment = new PostCharDialogFragment(callId, chars); fragment.show(getFragmentManager(), "postCharWait"); } + + @Override + public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { + if (mCallCardFragment != null) { + mCallCardFragment.dispatchPopulateAccessibilityEvent(event); + } + return super.dispatchPopulateAccessibilityEvent(event); + } } |