diff options
-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); + } } |