summaryrefslogtreecommitdiff
path: root/core/java/android/view/View.java
diff options
context:
space:
mode:
authorJoanne Chung <joannechung@google.com>2021-03-30 19:11:03 +0800
committerJoanne Chung <joannechung@google.com>2021-03-31 01:02:01 +0800
commit8c8a14d4dfc7541089a1a56697be8d9e26195cc0 (patch)
tree6f7f6ff5bf77ad56cadf9bd8a709f6f5e2ab54cd /core/java/android/view/View.java
parentf3258c35c04114cfd72e8af0d8abd6210c94429b (diff)
Bug fix: allow to create ViewTranslationRequest for virtual AutofillId.
1. We provide virtual child list to View#onCreateTranslationRequests but we don't provide a method to allow developers to create ViewTranslationRequest for virtual AutofillId. Add a builder constructor to allow developer to use it for virtual AutofillId. 2. Fix some comments in ag/13982294(e1b23cd) Bug: 177789967 Test: manual on sample app Test: atest CtsTranslationTestCases Change-Id: I63e914b888b23cdb7a5169fc6931be93625ca8e4
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r--core/java/android/view/View.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 615dd82fb848..3fa50b6633df 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -30753,10 +30753,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* view.
* @param supportedFormats the supported translation formats. For now, the only possible value
* is the {@link android.view.translation.TranslationSpec#DATA_FORMAT_TEXT}.
- * @param requestsCollector a {@link ViewTranslationRequest} collector that will be called
+ * @param requestsCollector a {@link ViewTranslationRequest} collector that can be called
* multiple times to collect the information to be translated in the virtual view. One
* {@link ViewTranslationRequest} per virtual child. The {@link ViewTranslationRequest} must
- * contains the {@link AutofillId} corresponding to the virtualChildIds.
+ * contains the {@link AutofillId} corresponding to the virtualChildIds. Do not keep this
+ * Consumer after the method returns.
*/
@SuppressLint("NullableCollection")
public void onCreateTranslationRequests(@NonNull long[] virtualChildIds,
@@ -30829,7 +30830,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* ui translation, the system will call this method to traverse the view hierarchy to call
* {@link View#onCreateTranslationRequest} to build {@link ViewTranslationRequest}s and create a
* {@link android.view.translation.Translator} to translate the requests. All the
- * {@link ViewTranslationRequest}s will be added when the traversal is done.
+ * {@link ViewTranslationRequest}s must be added when the traversal is done.
*
* <p> The default implementation will call {@link View#onCreateTranslationRequest} to build
* {@link ViewTranslationRequest} if the view should be translated. </p>