diff --git a/core/java/com/android/internal/inputmethod/CallbackUtils.java b/core/java/com/android/internal/inputmethod/CallbackUtils.java index 3958b9eefefb0..1933c54d267f0 100644 --- a/core/java/com/android/internal/inputmethod/CallbackUtils.java +++ b/core/java/com/android/internal/inputmethod/CallbackUtils.java @@ -16,15 +16,9 @@ package com.android.internal.inputmethod; -import android.annotation.AnyThread; import android.annotation.NonNull; import android.os.RemoteException; -import android.view.inputmethod.InputMethodInfo; -import android.view.inputmethod.InputMethodSubtype; -import com.android.internal.view.InputBindResult; - -import java.util.List; import java.util.function.BooleanSupplier; import java.util.function.IntSupplier; import java.util.function.Supplier; @@ -40,34 +34,6 @@ public final class CallbackUtils { private CallbackUtils() { } - /** - * A utility method using given {@link IInputBindResultResultCallback} to callback the - * {@link InputBindResult}. - * - * @param callback {@link IInputBindResultResultCallback} to be called back. - * @param resultSupplier the supplier from which {@link InputBindResult} is provided. - */ - @AnyThread - public static void onResult(@NonNull IInputBindResultResultCallback callback, - @NonNull Supplier resultSupplier) { - InputBindResult result = null; - Throwable exception = null; - - try { - result = resultSupplier.get(); - } catch (Throwable throwable) { - exception = throwable; - } - - try { - if (exception != null) { - callback.onError(ThrowableHolder.of(exception)); - return; - } - callback.onResult(result); - } catch (RemoteException ignored) { } - } - /** * A utility method using given {@link IBooleanResultCallback} to callback the result. * @@ -94,87 +60,6 @@ public final class CallbackUtils { } catch (RemoteException ignored) { } } - /** - * A utility method using given {@link IInputMethodSubtypeResultCallback} to callback the - * result. - * - * @param callback {@link IInputMethodSubtypeResultCallback} to be called back. - * @param resultSupplier the supplier from which the result is provided. - */ - public static void onResult(@NonNull IInputMethodSubtypeResultCallback callback, - @NonNull Supplier resultSupplier) { - InputMethodSubtype result = null; - Throwable exception = null; - - try { - result = resultSupplier.get(); - } catch (Throwable throwable) { - exception = throwable; - } - - try { - if (exception != null) { - callback.onError(ThrowableHolder.of(exception)); - return; - } - callback.onResult(result); - } catch (RemoteException ignored) { } - } - - /** - * A utility method using given {@link IInputMethodSubtypeListResultCallback} to callback the - * result. - * - * @param callback {@link IInputMethodSubtypeListResultCallback} to be called back. - * @param resultSupplier the supplier from which the result is provided. - */ - public static void onResult(@NonNull IInputMethodSubtypeListResultCallback callback, - @NonNull Supplier> resultSupplier) { - List result = null; - Throwable exception = null; - - try { - result = resultSupplier.get(); - } catch (Throwable throwable) { - exception = throwable; - } - - try { - if (exception != null) { - callback.onError(ThrowableHolder.of(exception)); - return; - } - callback.onResult(result); - } catch (RemoteException ignored) { } - } - - /** - * A utility method using given {@link IInputMethodInfoListResultCallback} to callback the - * result. - * - * @param callback {@link IInputMethodInfoListResultCallback} to be called back. - * @param resultSupplier the supplier from which the result is provided. - */ - public static void onResult(@NonNull IInputMethodInfoListResultCallback callback, - @NonNull Supplier> resultSupplier) { - List result = null; - Throwable exception = null; - - try { - result = resultSupplier.get(); - } catch (Throwable throwable) { - exception = throwable; - } - - try { - if (exception != null) { - callback.onError(ThrowableHolder.of(exception)); - return; - } - callback.onResult(result); - } catch (RemoteException ignored) { } - } - /** * A utility method using given {@link IIntResultCallback} to callback the result. * diff --git a/core/java/com/android/internal/inputmethod/IInputBindResultResultCallback.aidl b/core/java/com/android/internal/inputmethod/IInputBindResultResultCallback.aidl deleted file mode 100644 index 2691984048734..0000000000000 --- a/core/java/com/android/internal/inputmethod/IInputBindResultResultCallback.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.inputmethod; - -import com.android.internal.view.InputBindResult; -import com.android.internal.inputmethod.ThrowableHolder; - -oneway interface IInputBindResultResultCallback { - void onResult(in InputBindResult result); - void onError(in ThrowableHolder exception); -} \ No newline at end of file diff --git a/core/java/com/android/internal/inputmethod/IInputMethodInfoListResultCallback.aidl b/core/java/com/android/internal/inputmethod/IInputMethodInfoListResultCallback.aidl deleted file mode 100644 index 0dfd5da00abe2..0000000000000 --- a/core/java/com/android/internal/inputmethod/IInputMethodInfoListResultCallback.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.inputmethod; - -import android.view.inputmethod.InputMethodInfo; -import com.android.internal.inputmethod.ThrowableHolder; - -oneway interface IInputMethodInfoListResultCallback { - void onResult(in List result); - void onError(in ThrowableHolder exception); -} \ No newline at end of file diff --git a/core/java/com/android/internal/inputmethod/IInputMethodSubtypeListResultCallback.aidl b/core/java/com/android/internal/inputmethod/IInputMethodSubtypeListResultCallback.aidl deleted file mode 100644 index 619c87e1cd5b1..0000000000000 --- a/core/java/com/android/internal/inputmethod/IInputMethodSubtypeListResultCallback.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.inputmethod; - -import android.view.inputmethod.InputMethodSubtype; -import com.android.internal.inputmethod.ThrowableHolder; - -oneway interface IInputMethodSubtypeListResultCallback { - void onResult(in List result); - void onError(in ThrowableHolder exception); -} \ No newline at end of file diff --git a/core/java/com/android/internal/inputmethod/IInputMethodSubtypeResultCallback.aidl b/core/java/com/android/internal/inputmethod/IInputMethodSubtypeResultCallback.aidl deleted file mode 100644 index 66c09026321f9..0000000000000 --- a/core/java/com/android/internal/inputmethod/IInputMethodSubtypeResultCallback.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.inputmethod; - -import android.view.inputmethod.InputMethodSubtype; -import com.android.internal.inputmethod.ThrowableHolder; - -oneway interface IInputMethodSubtypeResultCallback { - void onResult(in InputMethodSubtype result); - void onError(in ThrowableHolder exception); -} \ No newline at end of file diff --git a/core/java/com/android/internal/inputmethod/ResultCallbacks.java b/core/java/com/android/internal/inputmethod/ResultCallbacks.java index c56ed2d199276..398cffbe1142c 100644 --- a/core/java/com/android/internal/inputmethod/ResultCallbacks.java +++ b/core/java/com/android/internal/inputmethod/ResultCallbacks.java @@ -20,13 +20,8 @@ import android.annotation.AnyThread; import android.annotation.BinderThread; import android.annotation.NonNull; import android.annotation.Nullable; -import android.view.inputmethod.InputMethodInfo; -import android.view.inputmethod.InputMethodSubtype; - -import com.android.internal.view.InputBindResult; import java.lang.ref.WeakReference; -import java.util.List; import java.util.concurrent.atomic.AtomicReference; /** @@ -170,43 +165,6 @@ public final class ResultCallbacks { }; } - /** - * Creates {@link IInputBindResultResultCallback.Stub} that is to set - * {@link Completable.InputBindResult} when receiving the result. - * - * @param value {@link Completable.InputBindResult} to be set when receiving the result. - * @return {@link IInputBindResultResultCallback.Stub} that can be passed as a binder IPC - * parameter. - */ - @AnyThread - public static IInputBindResultResultCallback.Stub of( - @NonNull Completable.InputBindResult value) { - final AtomicReference> - atomicRef = new AtomicReference<>(new WeakReference<>(value)); - - return new IInputBindResultResultCallback.Stub() { - @BinderThread - @Override - public void onResult(InputBindResult result) { - final Completable.InputBindResult value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onComplete(result); - } - - @BinderThread - @Override - public void onError(ThrowableHolder throwableHolder) { - final Completable.InputBindResult value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onError(throwableHolder); - } - }; - } - /** * Creates {@link IBooleanResultCallback.Stub} that is to set {@link Completable.Boolean} when * receiving the result. @@ -242,117 +200,6 @@ public final class ResultCallbacks { }; } - /** - * Creates {@link IInputMethodSubtypeResultCallback.Stub} that is to set - * {@link Completable.InputMethodSubtype} when receiving the result. - * - * @param value {@link Completable.InputMethodSubtype} to be set when receiving the result. - * @return {@link IInputMethodSubtypeResultCallback.Stub} that can be passed as a binder - * IPC parameter. - */ - @AnyThread - public static IInputMethodSubtypeResultCallback.Stub of( - @NonNull Completable.InputMethodSubtype value) { - final AtomicReference> - atomicRef = new AtomicReference<>(new WeakReference<>(value)); - - return new IInputMethodSubtypeResultCallback.Stub() { - @BinderThread - @Override - public void onResult(InputMethodSubtype result) { - final Completable.InputMethodSubtype value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onComplete(result); - } - - @BinderThread - @Override - public void onError(ThrowableHolder throwableHolder) { - final Completable.InputMethodSubtype value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onError(throwableHolder); - } - }; - } - - /** - * Creates {@link IInputMethodSubtypeListResultCallback.Stub} that is to set - * {@link Completable.InputMethodSubtypeList} when receiving the result. - * - * @param value {@link Completable.InputMethodSubtypeList} to be set when receiving the result. - * @return {@link IInputMethodSubtypeListResultCallback.Stub} that can be passed as a binder - * IPC parameter. - */ - @AnyThread - public static IInputMethodSubtypeListResultCallback.Stub of( - @NonNull Completable.InputMethodSubtypeList value) { - final AtomicReference> - atomicRef = new AtomicReference<>(new WeakReference<>(value)); - - return new IInputMethodSubtypeListResultCallback.Stub() { - @BinderThread - @Override - public void onResult(List result) { - final Completable.InputMethodSubtypeList value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onComplete(result); - } - - @BinderThread - @Override - public void onError(ThrowableHolder throwableHolder) { - final Completable.InputMethodSubtypeList value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onError(throwableHolder); - } - }; - } - - /** - * Creates {@link IInputMethodInfoListResultCallback.Stub} that is to set - * {@link Completable.InputMethodInfoList} when receiving the result. - * - * @param value {@link Completable.InputMethodInfoList} to be set when receiving the result. - * @return {@link IInputMethodInfoListResultCallback.Stub} that can be passed as a binder - * IPC parameter. - */ - @AnyThread - public static IInputMethodInfoListResultCallback.Stub of( - @NonNull Completable.InputMethodInfoList value) { - final AtomicReference> - atomicRef = new AtomicReference<>(new WeakReference<>(value)); - - return new IInputMethodInfoListResultCallback.Stub() { - @BinderThread - @Override - public void onResult(List result) { - final Completable.InputMethodInfoList value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onComplete(result); - } - - @BinderThread - @Override - public void onError(ThrowableHolder throwableHolder) { - final Completable.InputMethodInfoList value = unwrap(atomicRef); - if (value == null) { - return; - } - value.onError(throwableHolder); - } - }; - } - /** * Creates {@link IVoidResultCallback.Stub} that is to set {@link Completable.Void} when * receiving the result.