package com.ifpdos.autotest.lancontrol.module.other.e;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.ifpdos.audiotest.AudioTestActivity;
import com.ifpdos.autotest.api.IAudio;
import java.io.File;

/* JADX INFO: compiled from: AudioImpl.java */
/* JADX INFO: loaded from: classes.dex */
public class h implements IAudio {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private Context f2087a;

    public h(Context context) {
        this.f2087a = context;
    }

    @Override // com.ifpdos.autotest.api.IAudio
    public boolean startAudioTest() {
        if (AudioTestActivity.class.getName().equals(b.c.d.d.a.c(this.f2087a))) {
            b.c.d.d.c.b("AudioImpl", "AudioTestActivity已经打开，无法重复打开");
            return false;
        }
        Intent intent = new Intent(this.f2087a, (Class<?>) AudioTestActivity.class);
        intent.setFlags(268435456);
        this.f2087a.startActivity(intent);
        return true;
    }

    @Override // com.ifpdos.autotest.api.IAudio
    public boolean startPlay() {
        if (AudioTestActivity.class.getName().equals(b.c.d.d.a.c(this.f2087a))) {
            org.greenrobot.eventbus.c.c().j(new com.ifpdos.autotest.lancontrol.module.other.d.a(com.ifpdos.autotest.lancontrol.module.other.d.b.START_PLAY));
            return true;
        }
        b.c.d.d.c.b("AudioImpl", "AudioTestActivity未打开，无法播放");
        return false;
    }

    @Override // com.ifpdos.autotest.api.IAudio
    public boolean startRecord() {
        if (AudioTestActivity.class.getName().equals(b.c.d.d.a.c(this.f2087a))) {
            org.greenrobot.eventbus.c.c().j(new com.ifpdos.autotest.lancontrol.module.other.d.a(com.ifpdos.autotest.lancontrol.module.other.d.b.START_RECORD));
            return true;
        }
        b.c.d.d.c.b("AudioImpl", "AudioTestActivity未打开，无法录音");
        return false;
    }

    @Override // com.ifpdos.autotest.api.IAudio
    public boolean stopPlay() {
        if (AudioTestActivity.class.getName().equals(b.c.d.d.a.c(this.f2087a))) {
            org.greenrobot.eventbus.c.c().j(new com.ifpdos.autotest.lancontrol.module.other.d.a(com.ifpdos.autotest.lancontrol.module.other.d.b.STOP_PLAY));
            return true;
        }
        b.c.d.d.c.b("AudioImpl", "AudioTestActivity未打开，无法停止播放");
        return false;
    }

    @Override // com.ifpdos.autotest.api.IAudio
    public boolean stopRecord() {
        if (AudioTestActivity.class.getName().equals(b.c.d.d.a.c(this.f2087a))) {
            org.greenrobot.eventbus.c.c().j(new com.ifpdos.autotest.lancontrol.module.other.d.a(com.ifpdos.autotest.lancontrol.module.other.d.b.STOP_RECORD));
            return true;
        }
        b.c.d.d.c.b("AudioImpl", "AudioTestActivity未打开，无法停止录音");
        return false;
    }

    @Override // com.ifpdos.autotest.api.IAudio
    public boolean startPlay(String str) {
        if (!AudioTestActivity.class.getName().equals(b.c.d.d.a.c(this.f2087a))) {
            b.c.d.d.c.b("AudioImpl", "AudioTestActivity未打开，无法播放");
            return false;
        }
        if (!TextUtils.isEmpty(str) && new File(str).exists()) {
            org.greenrobot.eventbus.c.c().j(new com.ifpdos.autotest.lancontrol.module.other.d.a(com.ifpdos.autotest.lancontrol.module.other.d.b.START_PLAY, str));
            return true;
        }
        b.c.d.d.c.b("AudioImpl", "路径非法或文件不存在，无法播放 -- [path] " + str);
        return false;
    }
}
