Merge "fix bug 184901520." into sc-dev am: 2e2e479ef1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14174201

Change-Id: I0cd1fbd64ddd1e864415556268471110cd8d5118
This commit is contained in:
Yanchao Su
2021-04-21 01:54:18 +00:00
committed by Automerger Merge Worker

View File

@@ -24,6 +24,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SynchronousResultReceiver;
import android.util.ArrayMap;
@@ -200,8 +201,14 @@ public final class TranslationManager {
if (result.resultCode != STATUS_SYNC_CALL_SUCCESS) {
return Collections.emptySet();
}
return new ArraySet<>(
(TranslationCapability[]) result.bundle.getParcelableArray(EXTRA_CAPABILITIES));
Parcelable[] parcelables = result.bundle.getParcelableArray(EXTRA_CAPABILITIES);
ArraySet<TranslationCapability> capabilities = new ArraySet();
for (Parcelable obj : parcelables) {
if (obj instanceof TranslationCapability) {
capabilities.add((TranslationCapability) obj);
}
}
return capabilities;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
} catch (TimeoutException e) {