Log translate action's views and clicks.
This logs a "view" event for the translate action *once* for each
selection session that involves a foreign language. It logs a "click"
action when the translate action is clicked.
The logged action index will give an indication of whether the translate
action was the primary action (index 0) and thus immediately visible to the
user or whether it was one of the secondary actions (index > 0) and
possibly in the selection toolbar's overflow.
Bug: 123414932
Bug: 120837847
Test: atest core/tests/coretests/src/android/view/textclassifier
Test: atest cts/tests/tests/view/src/android/view/textclassifier
Test: atest android.widget.TextViewTest
Test: atest android.widget.cts.TextViewTest
Test: (MANUAL):
1. Ensure device has an app that supports Intent.ACTION_TRANSLATE
2. Run the following command on the shell: adb logcat -c "TCEventTronLogger"
3. Select some foreign lanugage text in a TextView
4. Click on "Translate" item on the toolbar
5. Observe that the device logs a "view" and a "click" event
6. Repeat 3
7. Click on a different menu item, e.g. "Copy"
8. Observe that the device logs only a "view" event
Change-Id: I36f32459c577cf8f8bcf1e65960c4e6d7ffa5e01
11 files changed