466 lines
22 KiB
Java
466 lines
22 KiB
Java
|
package com.discord.stores;
|
||
|
|
||
|
import android.app.Application;
|
||
|
import android.content.Context;
|
||
|
import android.os.Handler;
|
||
|
import android.os.HandlerThread;
|
||
|
import androidx.annotation.VisibleForTesting;
|
||
|
import c.d.b.a.a;
|
||
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
||
|
import com.discord.api.channel.Channel;
|
||
|
import com.discord.app.AudioManagerFeatureFlag;
|
||
|
import com.discord.rtcconnection.RtcConnection;
|
||
|
import com.discord.rtcconnection.audio.DiscordAudioManager;
|
||
|
import com.discord.stores.StoreAudioDevices;
|
||
|
import com.discord.stores.updates.ObservationDeck;
|
||
|
import com.discord.utilities.media.AudioOutputState;
|
||
|
import d0.t.n;
|
||
|
import d0.t.o;
|
||
|
import d0.t.u;
|
||
|
import d0.z.d.m;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||
|
import rx.Observable;
|
||
|
/* compiled from: StoreAudioManagerV2.kt */
|
||
|
public final class StoreAudioManagerV2 extends StoreV2 {
|
||
|
public static final Companion Companion = new Companion(null);
|
||
|
private static final State DEFAULT_STATE;
|
||
|
private static final List<DiscordAudioManager.DeviceTypes> VOICE_ONLY_DEVICE_PRIORITIZATION;
|
||
|
private final AudioManagerFeatureFlag audioManagerFeatureFlag;
|
||
|
private Handler audioManagerHandler;
|
||
|
private final HandlerThread audioManagerThread;
|
||
|
private final StoreChannels channelsStore;
|
||
|
private Context context;
|
||
|
private final Dispatcher dispatcher;
|
||
|
private final boolean enabled;
|
||
|
private DiscordAudioManager.AudioDevice lastActiveAudioDevice;
|
||
|
private final ObservationDeck observationDeck;
|
||
|
private boolean prevMyVideoOn;
|
||
|
private State state;
|
||
|
private State stateSnapshot;
|
||
|
private final StoreAudioDevices.VideoUseDetector videoUseDetector;
|
||
|
private final StoreVoiceChannelSelected voiceChannelSelectedStore;
|
||
|
|
||
|
/* compiled from: StoreAudioManagerV2.kt */
|
||
|
public static final class Companion {
|
||
|
|
||
|
public final /* synthetic */ class WhenMappings {
|
||
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
||
|
|
||
|
static {
|
||
|
DiscordAudioManager.DeviceTypes.values();
|
||
|
int[] iArr = new int[6];
|
||
|
$EnumSwitchMapping$0 = iArr;
|
||
|
iArr[DiscordAudioManager.DeviceTypes.EARPIECE.ordinal()] = 1;
|
||
|
iArr[DiscordAudioManager.DeviceTypes.SPEAKERPHONE.ordinal()] = 2;
|
||
|
iArr[DiscordAudioManager.DeviceTypes.WIRED_HEADSET.ordinal()] = 3;
|
||
|
iArr[DiscordAudioManager.DeviceTypes.BLUETOOTH_HEADSET.ordinal()] = 4;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private Companion() {
|
||
|
}
|
||
|
|
||
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this();
|
||
|
}
|
||
|
|
||
|
@VisibleForTesting
|
||
|
public static /* synthetic */ void getDEFAULT_STATE$app_productionBetaRelease$annotations() {
|
||
|
}
|
||
|
|
||
|
public final State getDEFAULT_STATE$app_productionBetaRelease() {
|
||
|
return StoreAudioManagerV2.access$getDEFAULT_STATE$cp();
|
||
|
}
|
||
|
|
||
|
public final List<DiscordAudioManager.DeviceTypes> getVOICE_ONLY_DEVICE_PRIORITIZATION$app_productionBetaRelease() {
|
||
|
return StoreAudioManagerV2.access$getVOICE_ONLY_DEVICE_PRIORITIZATION$cp();
|
||
|
}
|
||
|
|
||
|
public final StoreAudioDevices.OutputDevice outputDeviceFromAudioDevice$app_productionBetaRelease(DiscordAudioManager.AudioDevice audioDevice) {
|
||
|
m.checkNotNullParameter(audioDevice, "device");
|
||
|
int ordinal = audioDevice.a.ordinal();
|
||
|
return ordinal != 2 ? ordinal != 3 ? ordinal != 4 ? ordinal != 5 ? StoreAudioDevices.Companion.getDEFAULT_OUTPUT_DEVICE$app_productionBetaRelease() : new StoreAudioDevices.OutputDevice.BluetoothAudio(audioDevice.d) : StoreAudioDevices.OutputDevice.Earpiece.INSTANCE : StoreAudioDevices.OutputDevice.WiredAudio.INSTANCE : StoreAudioDevices.OutputDevice.Speaker.INSTANCE;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: StoreAudioManagerV2.kt */
|
||
|
public static final class State {
|
||
|
private DiscordAudioManager.DeviceTypes activeAudioDevice;
|
||
|
private List<DiscordAudioManager.AudioDevice> audioDevices;
|
||
|
|
||
|
public final /* synthetic */ class WhenMappings {
|
||
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
||
|
|
||
|
static {
|
||
|
DiscordAudioManager.DeviceTypes.values();
|
||
|
int[] iArr = new int[6];
|
||
|
$EnumSwitchMapping$0 = iArr;
|
||
|
iArr[DiscordAudioManager.DeviceTypes.INVALID.ordinal()] = 1;
|
||
|
iArr[DiscordAudioManager.DeviceTypes.DEFAULT.ordinal()] = 2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public State() {
|
||
|
this(null, null, 3, null);
|
||
|
}
|
||
|
|
||
|
public State(List<DiscordAudioManager.AudioDevice> list, DiscordAudioManager.DeviceTypes deviceTypes) {
|
||
|
m.checkNotNullParameter(list, "audioDevices");
|
||
|
m.checkNotNullParameter(deviceTypes, "activeAudioDevice");
|
||
|
this.audioDevices = list;
|
||
|
this.activeAudioDevice = deviceTypes;
|
||
|
}
|
||
|
|
||
|
/* JADX WARNING: Illegal instructions before constructor call */
|
||
|
public /* synthetic */ State(List list, DiscordAudioManager.DeviceTypes deviceTypes, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this(list, (i & 2) != 0 ? DiscordAudioManager.DeviceTypes.INVALID : deviceTypes);
|
||
|
if ((i & 1) != 0) {
|
||
|
DiscordAudioManager discordAudioManager = DiscordAudioManager.d;
|
||
|
list = DiscordAudioManager.f();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.stores.StoreAudioManagerV2$State */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static /* synthetic */ State copy$default(State state, List list, DiscordAudioManager.DeviceTypes deviceTypes, int i, Object obj) {
|
||
|
if ((i & 1) != 0) {
|
||
|
list = state.audioDevices;
|
||
|
}
|
||
|
if ((i & 2) != 0) {
|
||
|
deviceTypes = state.activeAudioDevice;
|
||
|
}
|
||
|
return state.copy(list, deviceTypes);
|
||
|
}
|
||
|
|
||
|
public final StoreAudioDevices.AudioDevicesState asAudioDevicesState() {
|
||
|
StoreAudioDevices.Companion companion = StoreAudioDevices.Companion;
|
||
|
AudioOutputState dEFAULT_OUTPUT_STATE$app_productionBetaRelease = companion.getDEFAULT_OUTPUT_STATE$app_productionBetaRelease();
|
||
|
int ordinal = this.activeAudioDevice.ordinal();
|
||
|
StoreAudioDevices.OutputDevice dEFAULT_OUTPUT_DEVICE$app_productionBetaRelease = (ordinal == 0 || ordinal == 1) ? companion.getDEFAULT_OUTPUT_DEVICE$app_productionBetaRelease() : StoreAudioManagerV2.Companion.outputDeviceFromAudioDevice$app_productionBetaRelease(this.audioDevices.get(this.activeAudioDevice.getValue()));
|
||
|
List<DiscordAudioManager.AudioDevice> list = this.audioDevices;
|
||
|
ArrayList<DiscordAudioManager.AudioDevice> arrayList = new ArrayList();
|
||
|
for (Object obj : list) {
|
||
|
if (((DiscordAudioManager.AudioDevice) obj).b) {
|
||
|
arrayList.add(obj);
|
||
|
}
|
||
|
}
|
||
|
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(arrayList, 10));
|
||
|
for (DiscordAudioManager.AudioDevice audioDevice : arrayList) {
|
||
|
arrayList2.add(StoreAudioManagerV2.Companion.outputDeviceFromAudioDevice$app_productionBetaRelease(audioDevice));
|
||
|
}
|
||
|
return new StoreAudioDevices.AudioDevicesState(dEFAULT_OUTPUT_STATE$app_productionBetaRelease, dEFAULT_OUTPUT_DEVICE$app_productionBetaRelease, u.toSet(arrayList2));
|
||
|
}
|
||
|
|
||
|
public final List<DiscordAudioManager.AudioDevice> component1() {
|
||
|
return this.audioDevices;
|
||
|
}
|
||
|
|
||
|
public final DiscordAudioManager.DeviceTypes component2() {
|
||
|
return this.activeAudioDevice;
|
||
|
}
|
||
|
|
||
|
public final State copy(List<DiscordAudioManager.AudioDevice> list, DiscordAudioManager.DeviceTypes deviceTypes) {
|
||
|
m.checkNotNullParameter(list, "audioDevices");
|
||
|
m.checkNotNullParameter(deviceTypes, "activeAudioDevice");
|
||
|
return new State(list, deviceTypes);
|
||
|
}
|
||
|
|
||
|
public boolean equals(Object obj) {
|
||
|
if (this == obj) {
|
||
|
return true;
|
||
|
}
|
||
|
if (!(obj instanceof State)) {
|
||
|
return false;
|
||
|
}
|
||
|
State state = (State) obj;
|
||
|
return m.areEqual(this.audioDevices, state.audioDevices) && m.areEqual(this.activeAudioDevice, state.activeAudioDevice);
|
||
|
}
|
||
|
|
||
|
public final DiscordAudioManager.DeviceTypes getActiveAudioDevice() {
|
||
|
return this.activeAudioDevice;
|
||
|
}
|
||
|
|
||
|
public final List<DiscordAudioManager.AudioDevice> getAudioDevices() {
|
||
|
return this.audioDevices;
|
||
|
}
|
||
|
|
||
|
public int hashCode() {
|
||
|
List<DiscordAudioManager.AudioDevice> list = this.audioDevices;
|
||
|
int i = 0;
|
||
|
int hashCode = (list != null ? list.hashCode() : 0) * 31;
|
||
|
DiscordAudioManager.DeviceTypes deviceTypes = this.activeAudioDevice;
|
||
|
if (deviceTypes != null) {
|
||
|
i = deviceTypes.hashCode();
|
||
|
}
|
||
|
return hashCode + i;
|
||
|
}
|
||
|
|
||
|
public final void setActiveAudioDevice(DiscordAudioManager.DeviceTypes deviceTypes) {
|
||
|
m.checkNotNullParameter(deviceTypes, "<set-?>");
|
||
|
this.activeAudioDevice = deviceTypes;
|
||
|
}
|
||
|
|
||
|
public final void setAudioDevices(List<DiscordAudioManager.AudioDevice> list) {
|
||
|
m.checkNotNullParameter(list, "<set-?>");
|
||
|
this.audioDevices = list;
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
StringBuilder K = a.K("State(audioDevices=");
|
||
|
K.append(this.audioDevices);
|
||
|
K.append(", activeAudioDevice=");
|
||
|
K.append(this.activeAudioDevice);
|
||
|
K.append(")");
|
||
|
return K.toString();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final /* synthetic */ class WhenMappings {
|
||
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
||
|
|
||
|
static {
|
||
|
DiscordAudioManager.DeviceTypes.values();
|
||
|
int[] iArr = new int[6];
|
||
|
$EnumSwitchMapping$0 = iArr;
|
||
|
iArr[DiscordAudioManager.DeviceTypes.SPEAKERPHONE.ordinal()] = 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
DiscordAudioManager discordAudioManager = DiscordAudioManager.d;
|
||
|
List<DiscordAudioManager.AudioDevice> f = DiscordAudioManager.f();
|
||
|
DiscordAudioManager.DeviceTypes deviceTypes = DiscordAudioManager.DeviceTypes.EARPIECE;
|
||
|
DEFAULT_STATE = new State(f, deviceTypes);
|
||
|
VOICE_ONLY_DEVICE_PRIORITIZATION = n.listOf((Object[]) new DiscordAudioManager.DeviceTypes[]{DiscordAudioManager.DeviceTypes.SPEAKERPHONE, deviceTypes, DiscordAudioManager.DeviceTypes.BLUETOOTH_HEADSET, DiscordAudioManager.DeviceTypes.WIRED_HEADSET});
|
||
|
}
|
||
|
|
||
|
public StoreAudioManagerV2(ObservationDeck observationDeck, Dispatcher dispatcher, AudioManagerFeatureFlag audioManagerFeatureFlag, StoreVoiceChannelSelected storeVoiceChannelSelected, StoreChannels storeChannels, StoreAudioDevices.VideoUseDetector videoUseDetector) {
|
||
|
m.checkNotNullParameter(observationDeck, "observationDeck");
|
||
|
m.checkNotNullParameter(dispatcher, "dispatcher");
|
||
|
m.checkNotNullParameter(audioManagerFeatureFlag, "audioManagerFeatureFlag");
|
||
|
m.checkNotNullParameter(storeVoiceChannelSelected, "voiceChannelSelectedStore");
|
||
|
m.checkNotNullParameter(storeChannels, "channelsStore");
|
||
|
m.checkNotNullParameter(videoUseDetector, "videoUseDetector");
|
||
|
this.observationDeck = observationDeck;
|
||
|
this.dispatcher = dispatcher;
|
||
|
this.audioManagerFeatureFlag = audioManagerFeatureFlag;
|
||
|
this.voiceChannelSelectedStore = storeVoiceChannelSelected;
|
||
|
this.channelsStore = storeChannels;
|
||
|
this.videoUseDetector = videoUseDetector;
|
||
|
this.enabled = audioManagerFeatureFlag.b();
|
||
|
State state = new State(null, null, 3, null);
|
||
|
this.state = state;
|
||
|
this.stateSnapshot = state;
|
||
|
DiscordAudioManager discordAudioManager = DiscordAudioManager.d;
|
||
|
this.lastActiveAudioDevice = DiscordAudioManager.b;
|
||
|
this.audioManagerThread = new HandlerThread("AudioManagerThread", -1);
|
||
|
}
|
||
|
|
||
|
/* JADX WARNING: Illegal instructions before constructor call */
|
||
|
public /* synthetic */ StoreAudioManagerV2(ObservationDeck observationDeck, Dispatcher dispatcher, AudioManagerFeatureFlag audioManagerFeatureFlag, StoreVoiceChannelSelected storeVoiceChannelSelected, StoreChannels storeChannels, StoreAudioDevices.VideoUseDetector videoUseDetector, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this(observationDeck, dispatcher, audioManagerFeatureFlag, storeVoiceChannelSelected, storeChannels, videoUseDetector);
|
||
|
if ((i & 4) != 0) {
|
||
|
AudioManagerFeatureFlag audioManagerFeatureFlag2 = AudioManagerFeatureFlag.b;
|
||
|
audioManagerFeatureFlag = AudioManagerFeatureFlag.a();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ State access$getAudioManagerState(StoreAudioManagerV2 storeAudioManagerV2) {
|
||
|
return storeAudioManagerV2.getAudioManagerState();
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ State access$getDEFAULT_STATE$cp() {
|
||
|
return DEFAULT_STATE;
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ Dispatcher access$getDispatcher$p(StoreAudioManagerV2 storeAudioManagerV2) {
|
||
|
return storeAudioManagerV2.dispatcher;
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ List access$getVOICE_ONLY_DEVICE_PRIORITIZATION$cp() {
|
||
|
return VOICE_ONLY_DEVICE_PRIORITIZATION;
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$updateActiveAudioDevice(StoreAudioManagerV2 storeAudioManagerV2, DiscordAudioManager.DeviceTypes deviceTypes) {
|
||
|
storeAudioManagerV2.updateActiveAudioDevice(deviceTypes);
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ void access$updateAudioDevices(StoreAudioManagerV2 storeAudioManagerV2, List list) {
|
||
|
storeAudioManagerV2.updateAudioDevices(list);
|
||
|
}
|
||
|
|
||
|
private final State getAudioManagerState() {
|
||
|
return this.stateSnapshot;
|
||
|
}
|
||
|
|
||
|
@StoreThread
|
||
|
private final boolean prioritizeEarpieceOverSpeaker() {
|
||
|
long selectedVoiceChannelId = this.voiceChannelSelectedStore.getSelectedVoiceChannelId();
|
||
|
Channel channel = this.channelsStore.getChannel(selectedVoiceChannelId);
|
||
|
return channel != null && !AnimatableValueParser.w1(channel) && !this.videoUseDetector.isAnyoneUsingVideoInChannel(selectedVoiceChannelId);
|
||
|
}
|
||
|
|
||
|
@StoreThread
|
||
|
private final void updateActiveAudioDevice(DiscordAudioManager.DeviceTypes deviceTypes) {
|
||
|
State copy$default = State.copy$default(this.state, null, deviceTypes, 1, null);
|
||
|
this.state = copy$default;
|
||
|
if (!(deviceTypes == DiscordAudioManager.DeviceTypes.INVALID || deviceTypes == DiscordAudioManager.DeviceTypes.DEFAULT)) {
|
||
|
this.lastActiveAudioDevice = copy$default.getAudioDevices().get(deviceTypes.getValue());
|
||
|
}
|
||
|
markChanged();
|
||
|
}
|
||
|
|
||
|
@StoreThread
|
||
|
private final void updateAudioDevices(List<DiscordAudioManager.AudioDevice> list) {
|
||
|
this.state = State.copy$default(this.state, list, null, 2, null);
|
||
|
markChanged();
|
||
|
}
|
||
|
|
||
|
public final boolean getEnabled() {
|
||
|
return this.enabled;
|
||
|
}
|
||
|
|
||
|
public final DiscordAudioManager.AudioDevice getLastActiveAudioDevice$app_productionBetaRelease() {
|
||
|
return this.lastActiveAudioDevice;
|
||
|
}
|
||
|
|
||
|
public final State getState$app_productionBetaRelease() {
|
||
|
return this.state;
|
||
|
}
|
||
|
|
||
|
@StoreThread
|
||
|
public final void handleRtcConnectionState(RtcConnection.State state) {
|
||
|
m.checkNotNullParameter(state, "state");
|
||
|
if (this.enabled) {
|
||
|
if (m.areEqual(state, RtcConnection.State.f.a)) {
|
||
|
if (prioritizeEarpieceOverSpeaker()) {
|
||
|
DiscordAudioManager discordAudioManager = DiscordAudioManager.d;
|
||
|
DiscordAudioManager d = DiscordAudioManager.d();
|
||
|
List<DiscordAudioManager.DeviceTypes> list = VOICE_ONLY_DEVICE_PRIORITIZATION;
|
||
|
synchronized (d) {
|
||
|
m.checkNotNullParameter(list, "newPrioritization");
|
||
|
if (!m.areEqual(list, d.f2105y)) {
|
||
|
d.f2105y = list;
|
||
|
d.l();
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
DiscordAudioManager discordAudioManager2 = DiscordAudioManager.d;
|
||
|
DiscordAudioManager d2 = DiscordAudioManager.d();
|
||
|
synchronized (d2) {
|
||
|
List<? extends DiscordAudioManager.DeviceTypes> list2 = d2.f2105y;
|
||
|
List<DiscordAudioManager.DeviceTypes> list3 = DiscordAudioManager.f2102c;
|
||
|
if (!m.areEqual(list2, list3)) {
|
||
|
d2.f2105y = list3;
|
||
|
d2.l();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
Handler handler = this.audioManagerHandler;
|
||
|
if (handler == null) {
|
||
|
m.throwUninitializedPropertyAccessException("audioManagerHandler");
|
||
|
}
|
||
|
handler.post(StoreAudioManagerV2$handleRtcConnectionState$1.INSTANCE);
|
||
|
} else if ((state instanceof RtcConnection.State.d) && !((RtcConnection.State.d) state).a) {
|
||
|
Handler handler2 = this.audioManagerHandler;
|
||
|
if (handler2 == null) {
|
||
|
m.throwUninitializedPropertyAccessException("audioManagerHandler");
|
||
|
}
|
||
|
handler2.post(StoreAudioManagerV2$handleRtcConnectionState$2.INSTANCE);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@StoreThread
|
||
|
public final void handleVoiceStatesUpdated() {
|
||
|
boolean isMeUsingVideoInChannel;
|
||
|
if (this.enabled && (isMeUsingVideoInChannel = this.videoUseDetector.isMeUsingVideoInChannel(this.voiceChannelSelectedStore.getSelectedVoiceChannelId())) != this.prevMyVideoOn) {
|
||
|
if (isMeUsingVideoInChannel) {
|
||
|
DiscordAudioManager discordAudioManager = DiscordAudioManager.d;
|
||
|
DiscordAudioManager d = DiscordAudioManager.d();
|
||
|
synchronized (d) {
|
||
|
if (d.q.get(DiscordAudioManager.DeviceTypes.EARPIECE.getValue()).b) {
|
||
|
List<DiscordAudioManager.AudioDevice> list = d.q;
|
||
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(list, 10));
|
||
|
for (DiscordAudioManager.AudioDevice audioDevice : list) {
|
||
|
arrayList.add(audioDevice.a.ordinal() != 4 ? DiscordAudioManager.AudioDevice.a(audioDevice, null, false, null, null, 15) : DiscordAudioManager.AudioDevice.a(audioDevice, null, false, null, null, 13));
|
||
|
}
|
||
|
d.q = arrayList;
|
||
|
d.r.j.onNext(arrayList);
|
||
|
d.l();
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
DiscordAudioManager discordAudioManager2 = DiscordAudioManager.d;
|
||
|
DiscordAudioManager d2 = DiscordAudioManager.d();
|
||
|
synchronized (d2) {
|
||
|
if (d2.q.get(DiscordAudioManager.DeviceTypes.EARPIECE.getValue()).b != d2.h) {
|
||
|
List<DiscordAudioManager.AudioDevice> list2 = d2.q;
|
||
|
ArrayList arrayList2 = new ArrayList(o.collectionSizeOrDefault(list2, 10));
|
||
|
for (DiscordAudioManager.AudioDevice audioDevice2 : list2) {
|
||
|
arrayList2.add(audioDevice2.a.ordinal() != 4 ? DiscordAudioManager.AudioDevice.a(audioDevice2, null, false, null, null, 15) : DiscordAudioManager.AudioDevice.a(audioDevice2, null, d2.h, null, null, 13));
|
||
|
}
|
||
|
d2.q = arrayList2;
|
||
|
d2.r.j.onNext(arrayList2);
|
||
|
d2.l();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
this.prevMyVideoOn = isMeUsingVideoInChannel;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void init(Application application) {
|
||
|
m.checkNotNullParameter(application, "context");
|
||
|
if (this.enabled) {
|
||
|
this.context = application;
|
||
|
if (!this.audioManagerThread.isAlive()) {
|
||
|
this.audioManagerThread.start();
|
||
|
}
|
||
|
Handler handler = new Handler(this.audioManagerThread.getLooper());
|
||
|
this.audioManagerHandler = handler;
|
||
|
if (handler == null) {
|
||
|
m.throwUninitializedPropertyAccessException("audioManagerHandler");
|
||
|
}
|
||
|
handler.post(new StoreAudioManagerV2$init$1(this));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final Observable<State> observeAudioManagerState() {
|
||
|
return ObservationDeck.connectRx$default(this.observationDeck, new ObservationDeck.UpdateSource[]{this}, false, null, null, new StoreAudioManagerV2$observeAudioManagerState$1(this), 14, null);
|
||
|
}
|
||
|
|
||
|
public final void selectOutputDevice(DiscordAudioManager.DeviceTypes deviceTypes) {
|
||
|
m.checkNotNullParameter(deviceTypes, "device");
|
||
|
if (this.enabled) {
|
||
|
Handler handler = this.audioManagerHandler;
|
||
|
if (handler == null) {
|
||
|
m.throwUninitializedPropertyAccessException("audioManagerHandler");
|
||
|
}
|
||
|
handler.post(new StoreAudioManagerV2$selectOutputDevice$1(deviceTypes));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void setState$app_productionBetaRelease(State state) {
|
||
|
m.checkNotNullParameter(state, "<set-?>");
|
||
|
this.state = state;
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.stores.StoreV2
|
||
|
public void snapshotData() {
|
||
|
super.snapshotData();
|
||
|
List<DiscordAudioManager.AudioDevice> audioDevices = this.state.getAudioDevices();
|
||
|
ArrayList arrayList = new ArrayList(o.collectionSizeOrDefault(audioDevices, 10));
|
||
|
for (DiscordAudioManager.AudioDevice audioDevice : audioDevices) {
|
||
|
arrayList.add(DiscordAudioManager.AudioDevice.a(audioDevice, null, false, null, null, 15));
|
||
|
}
|
||
|
this.stateSnapshot = this.state.copy(arrayList, this.state.getActiveAudioDevice());
|
||
|
}
|
||
|
|
||
|
public final void toggleSpeakerOutput() {
|
||
|
this.dispatcher.schedule(new StoreAudioManagerV2$toggleSpeakerOutput$1(this));
|
||
|
}
|
||
|
}
|