Call Recorder v6.34.2版本的 MD5 值为:298659ce317c966b10d9947b76831521

以下内容为反编译后的 j.java 源代码,内容仅作参考


package n6;

import android.content.Context;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.http.client.methods.HttpPost;
import org.json.JSONArray;
import org.json.JSONObject;
public class j extends a {
    private h3.a f25014e;
    ByteArrayOutputStream f25015h;

    public j(Context context, l6.f fVar, d dVar) {
        super(context, fVar, dVar);
        this.f25015h = new ByteArrayOutputStream();
        this.f25000d = true;
    }

    @Override
    public void a(short[] sArr, int i9, int i10) {
        this.f25014e.a(sArr, i9, i10);
    }

    @Override
    public void b(int i9) {
        this.f25014e = h3.c.a(this.f24997a, "opus", new h3.b(1, i9, 16), this.f25015h);
    }

    @Override
    public void c() {
        try {
            this.f24999c.c();
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://speaktome-2.services.mozilla.com/").openConnection();
            httpURLConnection.setRequestMethod(HttpPost.METHOD_NAME);
            httpURLConnection.setRequestProperty("Accept-Language-STT", this.f24998b.a());
            String str = "1";
            httpURLConnection.setRequestProperty("Store-Transcription", this.f24998b.e() ? "1" : "0");
            if (!this.f24998b.d()) {
                str = "0";
            }
            httpURLConnection.setRequestProperty("Store-Sample", str);
            httpURLConnection.setRequestProperty("Product-Tag", this.f24998b.c());
            OutputStream outputStream = httpURLConnection.getOutputStream();
            outputStream.write(this.f25015h.toByteArray());
            outputStream.close();
            if (httpURLConnection.getResponseCode() == 200) {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
                StringBuilder sb = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine != null) {
                        sb.append(readLine);
                    } else {
                        bufferedReader.close();
                        e(new String(sb));
                        return;
                    }
                }
            } else {
                this.f25000d = false;
                this.f24999c.b("STT Error");
            }
        } catch (Exception e9) {
            this.f25000d = false;
            e9.printStackTrace();
            d dVar = this.f24999c;
            dVar.b("STT Error: " + e9.getMessage());
        }
    }

    @Override
    public void d() {
        this.f25014e.close();
    }

    void e(String str) {
        try {
            JSONArray jSONArray = new JSONObject(str).getJSONArray("data");
            k kVar = new k(jSONArray.getJSONObject(0).getString("text"), Float.parseFloat(jSONArray.getJSONObject(0).getString("confidence")));
            this.f25000d = false;
            this.f24999c.a(kVar);
        } catch (Exception e9) {
            String format = String.format("Response error: %s", e9.getMessage());
            this.f25000d = false;
            this.f24999c.b(format);
        }
    }
}