Merge "Remove unused methods and classes"

This commit is contained in:
TreeHugger Robot
2021-07-19 19:01:53 +00:00
committed by Android (Google) Code Review
6 changed files with 0 additions and 368 deletions

View File

@@ -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<InputBindResult> 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<InputMethodSubtype> 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<List<InputMethodSubtype>> resultSupplier) {
List<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 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<List<InputMethodInfo>> resultSupplier) {
List<InputMethodInfo> 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.
*

View File

@@ -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);
}

View File

@@ -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<InputMethodInfo> result);
void onError(in ThrowableHolder exception);
}

View File

@@ -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<InputMethodSubtype> result);
void onError(in ThrowableHolder exception);
}

View File

@@ -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);
}

View File

@@ -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<WeakReference<Completable.InputBindResult>>
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<WeakReference<Completable.InputMethodSubtype>>
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<WeakReference<Completable.InputMethodSubtypeList>>
atomicRef = new AtomicReference<>(new WeakReference<>(value));
return new IInputMethodSubtypeListResultCallback.Stub() {
@BinderThread
@Override
public void onResult(List<InputMethodSubtype> 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<WeakReference<Completable.InputMethodInfoList>>
atomicRef = new AtomicReference<>(new WeakReference<>(value));
return new IInputMethodInfoListResultCallback.Stub() {
@BinderThread
@Override
public void onResult(List<InputMethodInfo> 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.