diff options
| author | 2021-09-17 17:06:44 +0800 | |
|---|---|---|
| committer | 2021-09-17 09:29:44 +0000 | |
| commit | ec3f41e70e779666ff8a75b481390d1fef6b0168 (patch) | |
| tree | 4d12a3509bbcc23649113f8fb2db0b97ff8b6c5a | |
| parent | 2e2e4b3ac4c6f915266814e42b7ef50c25cc2c5b (diff) | |
Fix translation doesn't work on ViewGroup
The system will add requested view reference into cache but it is
possible the requested translation view is a viewgroup, we don't add
this into view reference list that cause the translation doesn't work
on ViewGroup.
Bug: 200233857
Test: atest CtsTranslationTestCases
Test: manual. Use a sample code to request translation for a
viewgroup and make sure it is added into view reference list.
Test: manual verify with issue client app, it works.
Change-Id: Ie593a1a436fd046373412ae2955a78057d22b892
| -rw-r--r-- | core/java/android/view/translation/UiTranslationController.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/java/android/view/translation/UiTranslationController.java b/core/java/android/view/translation/UiTranslationController.java index 442d099f0678..f1c5a080a77b 100644 --- a/core/java/android/view/translation/UiTranslationController.java +++ b/core/java/android/view/translation/UiTranslationController.java @@ -598,9 +598,8 @@ public class UiTranslationController { final View rootView = roots.get(rootNum).getView(); if (rootView instanceof ViewGroup) { findViewsTraversalByAutofillIds((ViewGroup) rootView, sourceViewIds); - } else { - addViewIfNeeded(sourceViewIds, rootView); } + addViewIfNeeded(sourceViewIds, rootView); } } @@ -611,9 +610,8 @@ public class UiTranslationController { final View child = viewGroup.getChildAt(i); if (child instanceof ViewGroup) { findViewsTraversalByAutofillIds((ViewGroup) child, sourceViewIds); - } else { - addViewIfNeeded(sourceViewIds, child); } + addViewIfNeeded(sourceViewIds, child); } } |