Loading core/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -10410,7 +10410,7 @@ package android.service.translation { } public static interface TranslationService.OnTranslationResultCallback { method public void onError(); method @Deprecated public void onError(); method public void onTranslationSuccess(@NonNull android.view.translation.TranslationResponse); } core/java/android/service/translation/ITranslationCallback.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -25,5 +25,4 @@ import android.view.translation.TranslationResponse; */ oneway interface ITranslationCallback { void onTranslationResponse(in TranslationResponse translationResponse); void onError(); } core/java/android/service/translation/OnTranslationResultCallbackWrapper.java +5 −14 Original line number Diff line number Diff line Loading @@ -66,22 +66,13 @@ final class OnTranslationResultCallbackWrapper implements } } /** * @deprecated use {@link #onTranslationSuccess} with error response instead. */ @Override @Deprecated public void onError() { assertNotCalled(); if (mCalled.getAndSet(true)) { throw new IllegalStateException("Already called"); } try { mCallback.onError(); } catch (RemoteException e) { if (e instanceof DeadObjectException) { Log.w(TAG, "Process is dead, ignore."); return; } throw e.rethrowAsRuntimeException(); } // no-op. } private void assertNotCalled() { Loading core/java/android/service/translation/TranslationService.java +2 −0 Original line number Diff line number Diff line Loading @@ -143,7 +143,9 @@ public abstract class TranslationService extends Service { /** * TODO: implement javadoc * @deprecated use {@link #onTranslationSuccess} with an error response instead. */ @Deprecated void onError(); } Loading core/java/android/view/translation/Translator.java +0 −19 Original line number Diff line number Diff line Loading @@ -379,24 +379,5 @@ public class Translator { } } } @Override public void onError() throws RemoteException { final Consumer<TranslationResponse> callback = mCallback.get(); final Runnable runnable = () -> callback.accept( new TranslationResponse.Builder( TranslationResponse.TRANSLATION_STATUS_UNKNOWN_ERROR) .build()); if (callback != null) { final Executor executor = mExecutor.get(); final long token = Binder.clearCallingIdentity(); try { executor.execute(runnable); } finally { restoreCallingIdentity(token); } } } } } Loading
core/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -10410,7 +10410,7 @@ package android.service.translation { } public static interface TranslationService.OnTranslationResultCallback { method public void onError(); method @Deprecated public void onError(); method public void onTranslationSuccess(@NonNull android.view.translation.TranslationResponse); }
core/java/android/service/translation/ITranslationCallback.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -25,5 +25,4 @@ import android.view.translation.TranslationResponse; */ oneway interface ITranslationCallback { void onTranslationResponse(in TranslationResponse translationResponse); void onError(); }
core/java/android/service/translation/OnTranslationResultCallbackWrapper.java +5 −14 Original line number Diff line number Diff line Loading @@ -66,22 +66,13 @@ final class OnTranslationResultCallbackWrapper implements } } /** * @deprecated use {@link #onTranslationSuccess} with error response instead. */ @Override @Deprecated public void onError() { assertNotCalled(); if (mCalled.getAndSet(true)) { throw new IllegalStateException("Already called"); } try { mCallback.onError(); } catch (RemoteException e) { if (e instanceof DeadObjectException) { Log.w(TAG, "Process is dead, ignore."); return; } throw e.rethrowAsRuntimeException(); } // no-op. } private void assertNotCalled() { Loading
core/java/android/service/translation/TranslationService.java +2 −0 Original line number Diff line number Diff line Loading @@ -143,7 +143,9 @@ public abstract class TranslationService extends Service { /** * TODO: implement javadoc * @deprecated use {@link #onTranslationSuccess} with an error response instead. */ @Deprecated void onError(); } Loading
core/java/android/view/translation/Translator.java +0 −19 Original line number Diff line number Diff line Loading @@ -379,24 +379,5 @@ public class Translator { } } } @Override public void onError() throws RemoteException { final Consumer<TranslationResponse> callback = mCallback.get(); final Runnable runnable = () -> callback.accept( new TranslationResponse.Builder( TranslationResponse.TRANSLATION_STATUS_UNKNOWN_ERROR) .build()); if (callback != null) { final Executor executor = mExecutor.get(); final long token = Binder.clearCallingIdentity(); try { executor.execute(runnable); } finally { restoreCallingIdentity(token); } } } } }