From ebc8d5154a98d9c84b5707aa543e7e07a579ceca Mon Sep 17 00:00:00 2001 From: Ahaan Ugale Date: Thu, 6 May 2021 13:48:58 -0700 Subject: [PATCH] Add a default implementation of UiTranslationStateCallback#onResumed. This is temporary, to avoid breaking clients that already implemented the API before onResumed was added. Bug: 185274258 Test: manual Change-Id: Icd2c392e248f01c22b95e0b88ba56847ae71f10a --- core/api/current.txt | 2 +- .../android/view/translation/UiTranslationStateCallback.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 82264c177248b..e05080d3b5146 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -52965,7 +52965,7 @@ package android.view.translation { public interface UiTranslationStateCallback { method public void onFinished(); method public void onPaused(); - method public void onResumed(@NonNull android.icu.util.ULocale, @NonNull android.icu.util.ULocale); + method public default void onResumed(@NonNull android.icu.util.ULocale, @NonNull android.icu.util.ULocale); method @Deprecated public void onStarted(@NonNull String, @NonNull String); method public default void onStarted(@NonNull android.icu.util.ULocale, @NonNull android.icu.util.ULocale); } diff --git a/core/java/android/view/translation/UiTranslationStateCallback.java b/core/java/android/view/translation/UiTranslationStateCallback.java index 968cbdcbd69d3..1bae0efb632ee 100644 --- a/core/java/android/view/translation/UiTranslationStateCallback.java +++ b/core/java/android/view/translation/UiTranslationStateCallback.java @@ -54,7 +54,9 @@ public interface UiTranslationStateCallback { * The system is requesting that the application restore from the temporarily paused state and * show the content in translated language. */ - void onResumed(@NonNull ULocale sourceLocale, @NonNull ULocale targetLocale); + // TODO: Remove the default implementation when clients have implemented this. + default void onResumed(@NonNull ULocale sourceLocale, @NonNull ULocale targetLocale) { + } /** * The UI Translation session has ended.