translations.
Bug: 192331240
Test: atest android.translation.cts.UiTranslationManagerTest
Test: Manually on device:
1. Kill Gboard
2. Open translatable Chat conversation, wait for Live Translate
4. Focus on chat input
5. Auto-translate on Gboard is opened, and debug logs show
"TranslationManagerServiceImpl: Triggering callback for..."
Change-Id: Ida82a947491e8157fac5cd43939d6d358fbe6c7b
This will be used by clients such as Gboard to ensure they are
responding to translation events for the correct activity. Ideally we
would include the activity token, in case there are multiple activities
being translated in an app, but that isn't supported right now and it
requires changes to EditorInfo (in Input Method Framework) to get the
activity token.
Also fixed an issue where the callback methods are invoked twice when
the IME itself is the translated app is registering a callback for
itself. Note: This happens in UiTranslationManagerTest where the test
activity and IME have the same uid, but shouldn't happen outside of
tests.
Bug: 223979041
Test: atest CtsTranslationTestCases
Change-Id: Id99f501b065b92fe3358c2ae525175ad3ea4b119
These 3 options (--autofill, --contentcapture, and --tranlation)
are now available as '--dump-dumpable DUMPABLE' (where DUMPABLE is
AutofillManager, ContentCaptureManager, and UiTranslationController
respectively).
Test: adb shell am start com.android.settings && adb shell dumpsys activity com.android.settings --autofill
Test: m -j update-api
Bug: 149254050
Change-Id: Iaf9040a4afcd87d32c60e32d19aaca8e1d2c817a
Apps developers may track the translation usage on their apps, the
system provides UiTranslationStateCallback if the apps registered.
Bug: 184901144
Test: atest UiTranslationManagerTest
Change-Id: I3265d4b587c81b74c6beae881cd3ff3034de9852
When bugreport dumps Activity information, it will dump translation
related information. But it adds -v parameter, the bugreport will
only dump visible task's top Activity. If message apps go to the
background, we cannot find our expected information. We try to let
translation dumpsys to dump the last Activity information if the
Activity isn't destroyed yet, e.g. go to background.
Bug: 187889345
Test: open chat app and back home then dumpsys translation. Let
Activity destroyed and make sure no Activity dump.
Change-Id: Ie5b935696a74ca3f298c5e6e5994fa659389e198
The translation system service should verify the caller holds
Permission#DUMP before dumpping the log.
Bug: 186756551
Test: atest ServicePermissionsTest#testDumpProtected
Test: atest CtsTranslationTestCases
Test: manual dumpsys translation
Change-Id: Ic1ea90d9467d5ac25353f08374ce157c60976b8e
And use it to conditionally enable content padding for requested views.
Fix: 179693024
Test: atest android.translation.cts.UiTranslationManagerTest
Test: adb shell dumpsys activity <ACTIVITY> --translation
Change-Id: I23fb29a60525d736f2dcf9d11b548c62332c412c
- updates APIs naming and uses Consumer<TranslationCapability>
instead of PendingIntent
- Implements the propagating capability updates in the client side
Bug: 176208267
Test: manual.
Test: atest CtsTranslationTestCases
Change-Id: I171c908b529e2ef300e4bbd55c1565b33a25c1e5
This allows controlling the content padding behavior needed with some
apps for compatibility reasons.
(see I9d7db5d2bc200e4042baf3267796f00cfc298f19)
The flag is currently the only property in the new UiTranslationSpec
value type, but more properties can be added in the future (such as
animation specifications).
Bug: 179693024
Test: manual
CTS-Coverage-Bug: 182990474
Change-Id: I11052cddb59c928b22ad9ad16e3c9b092da4b907
This change adda the apia in the TranslationService that allows to
update the TranslationCapability to the registered clients. This
change doesn't contain the register part in the TranslationManager,
the change will be done on the next change.
Bug: 176208267
Test: atest CtsTranslationTestCases
Test: manual verification
CTS-Coverage-Bug: 182990474
Change-Id: Iec7b3dc30f99985415162394d0e64d8e825ea5d9
We introduced some APIs for initial demo but we dropped these APIs.
To avoid to break the client app, we keep the API until the client
moves to new APIs. It's ok to delete these API now.
Bug: 185448758
Test: manual
Test: atest android.translation.cts.UiTranslationManagerTest
Change-Id: I5ea71d4658246f52610e1f62412d60c6c58bb31e
* TranslationContext holds source/dest specs, replacing spec pairs in
methods.
* TranslationCapability holds information on the translation models, as well
as a helper method to generate a TranslationContext for creating
translators.
* TCapability is meant to hold information about the translation models, and
provide information/flag on what the translator can support, versus the
TContext which will indicate exactly which supported flags should be
used and activated by the models.
* Added TM.getTranslationCapabilities, and add/remove TCapabilityUpdateListener
Bug: 176208267
Test: atest CtsTranslationTestCases
Change-Id: I2ab7a3eadcbbc9e13f8f33bf9c51cda69f30fdb7
This reverts commit 7c8010211de045cd54b655e7005a94d680f5c8db.
Reason for revert: Original change broke the build. This is a clean
revert. The next change in the relation chain here fixes the error.
Bug: 177500482
Bug: 182896753
Test: mmma frameworks/base/ RUN_ERROR_PRONE=true
CTS-Coverage-Bug: 182853869
Change-Id: I0a0ce22feb2e54769103f8f4eecbffe425099412
This is primarily intended for Input Methods, so they can offer
complementary translation experiences to the UI Translation.
But it could also be useful to the applications being translated too, so
it's added to UiTranslationManager.
The states are intentionally different from the ones in the View API -
these are about the UI Translation feature lifecycle, whereas the View
states are about the display states (shown/hidden).
Bug: 177500482
Test: manual - with a sample IME
CTS-Coverage-Bug: 182853869
Change-Id: I8255e18c29a229c8ea3b89098b76124ee8955bdc
1. Update UiTranslationManager APIs to use ActivityId parameter
2. Keep old APIs definition until AiAi is ready for new APIs.
Bug: 177789967
Test: manual. Local add test app in allow list, and get token from local
content capture service and use it in UiTranslationManager api.
Change-Id: I96aa5704600fd9b81eff7a2f42eefe78a43112da
1. Add shell command to allow a temporary override of the
TranslationService that helps e2e CTS tests.
2. Add permission to allow the shell call the UiTranslationManager
APIs for the tests.
3. Dump translation systemservice and activity translation related
information to help debugging
We don't want to leak translation feature now, so we submit the
change about Shell in internal branch.
Bug: 179047265
Test: manual.
1. Switch to temp TranslationService by "adb shell cmd transformer set
<myTranslationService> 12000" and make sure only the same app can
access the APIs when switching to the temp service.
2. adb shell dumpsys transformer
3. adb shell dumpsys activity <myactivity> --translation
(We set "transformer" now to prevent feature leak, the final value is
translation)
Change-Id: I2573b7ea226bd805a951f8346d5370d9c9776364
The implementation after receiving UiTranslatinManager calls. The
implementation after receiving state change will on the follow up
changes.
Bug: 172969740
Test: manual. Use a sample code to call the APIs, the methods are
called as expected.
Change-Id: Ic41c994055b4c580e2bff75313b6498db51b6130
The initial APIs for ui translation. There is no implementation in
this change, we will implement it in the next CL.
Bug: 172969740
Bug: 176871912
Test: manual. build pass and build success.
Change-Id: I4ae0bc7a695076a87bed73e458396312d87f48c5
The initial translation related APIs. The APIs and the implementation
will be revised in the follow up changes. The service register will
on the next changes.
Bug: 173243538
Bug: 176208267
Test: manual verification (build)
Change-Id: Ib7b39e1b548bc6663a81482fa335632e8da18d6a