alexandroid/decompiled/jadx/sources/androidx/javascriptengine/MessagePort.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

45 lines
1.4 KiB
Java

package androidx.javascriptengine;
import androidx.annotation.VisibleForTesting;
import androidx.javascriptengine.common.MessagePortInternal;
import java.util.Objects;
import javax.annotation.concurrent.ThreadSafe;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@ThreadSafe
/* loaded from: classes14.dex */
public final class MessagePort implements AutoCloseable {
private final MessagePortInternal mMessagePortInternal;
public MessagePort() {
this.mMessagePortInternal = new MessagePortInternal();
}
@Override // java.lang.AutoCloseable
public void close() {
this.mMessagePortInternal.close();
}
@VisibleForTesting
public MessagePortInternal getMessagePortInternalForTest() {
return this.mMessagePortInternal;
}
public void postMessage(Message message) {
Objects.requireNonNull(message);
int type = message.getType();
if (type == 0) {
this.mMessagePortInternal.postString(message.getString());
} else {
if (type == 1) {
this.mMessagePortInternal.postArrayBuffer(message.getArrayBuffer());
return;
}
throw new UnsupportedOperationException("Unsupported message type: " + message.getType());
}
}
public MessagePort(MessagePortInternal messagePortInternal) {
this.mMessagePortInternal = messagePortInternal;
}
}