OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.excelliance.kxqp.gs.util;

import a.q;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import androidx.work.WorkRequest;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.api.ApiManager;
import com.excelliance.kxqp.bean.ReponsePlayableArea;
import com.excelliance.kxqp.bean.ReponsePlayableGameInfo;
import com.excelliance.kxqp.bean.ReponsePlayablePort;
import com.excelliance.kxqp.gs.appstore.model.ResponseData;
import com.excelliance.kxqp.gs.bean.PingIpInfo;
import com.excelliance.kxqp.gs.service.ProxyDelayService;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.ui.detail.RankingDetailInfo;
import com.quick.sdk.slice.SliceResolvedActivity;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;

public class r {

    private static r f12023b;

    private final String f12024a = "CloudGameFunction";
    private final Object c = new Object();
    private float d = 10000.0f;
    private String e = null;

    private r() {
    }

    public static r a() {
        if (f12023b == null) {
            synchronized (r.class) {
                if (f12023b == null) {
                    f12023b = new r();
                }
            }
        }
        return f12023b;
    }

    public ExcellianceAppInfo a(Context context, String str) {
        RankingDetailInfo F;
        ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(str);
        return (b2 != null || (F = as.F(context, str)) == null) ? b2 : F.getAppInfo();
    }

    public boolean b(Context context, String str) {
        String c = c(context, str);
        if (TextUtils.isEmpty(c)) {
            return false;
        }
        return a(context, str, c);
    }

    private String c(Context context, String str) {
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        cVar.a(ApiManager.getInstance().a(context, 15000L, 15000L, "https://api.ourplay.com.cn/").e());
        ResponseData b2 = cVar.b();
        az.d("CloudGameFunction", "startPlayGame responseData:" + b2);
        if (b2.code == 0) {
            if (b2 != null && b2.data != 0) {
                List list = (List) b2.data;
                az.d("CloudGameFunction", "startPlayGame reponseInfoList: " + list);
                if (list != null && list.size() > 0) {
                    az.d("CloudGameFunction", "startPlayGame getBestServerForPlayPort size: " + list.size());
                    final int size = list.size();
                    final HashMap hashMap = new HashMap();
                    for (int i = 0; i < size; i++) {
                        final ReponsePlayableArea reponsePlayableArea = (ReponsePlayableArea) list.get(i);
                        tp.f(new Runnable() {
                            @Override
                            public void run() {
                                PingIpInfo pingIpInfo = new PingIpInfo();
                                if (reponsePlayableArea == null || TextUtils.isEmpty(reponsePlayableArea.api)) {
                                    return;
                                }
                                az.d("CloudGameFunction", "startPlayGame getBestServerForPlayPort rpa.api: " + reponsePlayableArea.api);
                                int lastIndexOf = reponsePlayableArea.api.lastIndexOf(":");
                                int indexOf = reponsePlayableArea.api.indexOf("//");
                                if (lastIndexOf <= 10 || indexOf <= 0) {
                                    return;
                                }
                                pingIpInfo.ip = reponsePlayableArea.api.substring(indexOf + 2, lastIndexOf);
                                ProxyDelayService.a(pingIpInfo, WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS);
                                Log.d("CloudGameFunction", "startPlayGame delayTime: " + pingIpInfo.delayTime);
                                synchronized (r.this.c) {
                                    if (pingIpInfo.delayTime < r.this.d) {
                                        r.this.d = pingIpInfo.delayTime;
                                        r.this.e = reponsePlayableArea.api;
                                    }
                                    hashMap.put(reponsePlayableArea.api, pingIpInfo);
                                    if (hashMap.size() > 2 || hashMap.size() >= size) {
                                        r.this.c.notifyAll();
                                    }
                                }
                            }
                        });
                    }
                    az.d("CloudGameFunction", "startPlayGame getBestServerForPlayPort size: " + hashMap.size() + ", size = " + size);
                    synchronized (this.c) {
                        try {
                            this.c.wait();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    az.d("CloudGameFunction", "startPlayGame bestTime= " + this.d + ",bestAreaServer: " + this.e);
                    StringBuilder sb = new StringBuilder();
                    sb.append("startPlayGame bestTime= ");
                    sb.append(this.d);
                    Log.d("CloudGameFunction", sb.toString());
                    if (this.d >= 2000.0f) {
                        this.e = null;
                    }
                }
            }
        } else {
            Log.e("CloudGameFunction", "startPlayGame get getPlayAreaList failed " + b2);
            String str2 = b2.msg;
            if (!TextUtils.isEmpty(str2)) {
                cg.a(context, str2);
            }
        }
        return this.e;
    }

    private boolean a(Context context, String str, String str2) {
        ReponsePlayablePort reponsePlayablePort;
        JSONObject jSONObject;
        String str3 = str2;
        if (TextUtils.isEmpty(str2)) {
            Log.e("CloudGameFunction", "startGame no port url " + str3);
            return false;
        }
        com.excelliance.kxqp.api.c cVar = new com.excelliance.kxqp.api.c(context);
        az.d("CloudGameFunction", "startGame urlGetPort: " + str3);
        String r = GameUtil.getIntance().r(context);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        if (context instanceof Activity) {
            ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        }
        az.d("CloudGameFunction", "startGame DisplayMetrics dm.widthPixels: " + displayMetrics.widthPixels + ", heightPixels = " + displayMetrics.heightPixels + ", densityDpi = " + displayMetrics.densityDpi);
        a.q a2 = new q.a().a("uid", r).a(com.umeng.analytics.pro.am.o, str).a("width", String.valueOf(displayMetrics.widthPixels)).a("height", String.valueOf(displayMetrics.heightPixels)).a("dpi", String.valueOf(displayMetrics.densityDpi)).a();
        ApiManager apiManager = ApiManager.getInstance();
        if (str3 == null) {
            str3 = "https://api.ourplay.com.cn/";
        }
        cVar.a(apiManager.a(context, 15000L, 15000L, str3).l(a2));
        ResponseData b2 = cVar.b();
        az.d("CloudGameFunction", "startGame responsePortData:" + b2);
        ReponsePlayableGameInfo reponsePlayableGameInfo = null;
        if (b2.code == 0) {
            if (b2 != null && b2.data != 0) {
                reponsePlayablePort = (ReponsePlayablePort) b2.data;
                ExcellianceAppInfo a3 = a(context, str);
                Intent intent = new Intent();
                intent.setComponent(new ComponentName(context.getPackageName(), "com.excelliance.zmcaplayer.client.VideoActivity"));
                intent.putExtra("game_cpu", a3 == null ? a3.cpu : 0);
                intent.putExtra("master_cpu", !com.excelliance.kxqp.gs.ui.home.b.a(context).d() ? 2 : 1);
                intent.putExtra("assist_pkg", com.excelliance.kxqp.manager.d.a(context).b(context));
                JSONObject jSONObject2 = new JSONObject();
                if (reponsePlayablePort == null) {
                    try {
                        jSONObject2.put("token", reponsePlayablePort.token);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    jSONObject = jSONObject2;
                    cVar.a(ApiManager.getInstance().a(context, 15000L, 15000L, "https://api.ourplay.com.cn/").m(new q.a().a(com.umeng.analytics.pro.am.o, str).a("uid", r).a()));
                    ResponseData b3 = cVar.b();
                    az.d("CloudGameFunction", "startGame responseGameData:" + b3);
                    if (b3.code == 0) {
                        if (b3 != null && b3.data != 0) {
                            reponsePlayableGameInfo = (ReponsePlayableGameInfo) b3.data;
                        }
                    } else {
                        Log.e("CloudGameFunction", "startGame responseGameData failed " + b3);
                        String str4 = b3.msg;
                        if (!TextUtils.isEmpty(str4)) {
                            cg.a(context, str4);
                        }
                    }
                } else {
                    jSONObject = jSONObject2;
                }
                int i = reponsePlayableGameInfo == null ? reponsePlayableGameInfo.game_screen : 2;
                az.d("CloudGameFunction", "startGame reponsePortInfo: " + reponsePlayablePort + ",pkg = " + str);
                if (reponsePlayablePort == null) {
                    intent.putExtra("server_addr", reponsePlayablePort.ip);
                    intent.putExtra("server_port", Integer.parseInt(reponsePlayablePort.port));
                    intent.putExtra("session_token", jSONObject.toString());
                    intent.putExtra("home_package", str);
                    intent.putExtra("screen_orientation", i);
                    intent.putExtra("game_package", str);
                    intent.putExtra("play_time", reponsePlayableGameInfo != null ? reponsePlayableGameInfo.play_time : 120);
                    intent.putExtra("display_width", reponsePlayablePort.width);
                    intent.putExtra("display_height", reponsePlayablePort.height);
                    intent.putExtra("display_dpi", reponsePlayablePort.dpi);
                    context.startActivity(intent);
                    SliceResolvedActivity.startActivity(context, "com.excelliance.zmcaplayer.client", intent);
                    return true;
                }
                Log.e("CloudGameFunction", "startGame reponsePortInfo null");
                return false;
            }
        } else {
            Log.e("CloudGameFunction", "startGame get reponsePortInfo failed " + b2);
            String str5 = b2.msg;
            if (!TextUtils.isEmpty(str5)) {
                cg.a(context, str5);
            }
        }
        reponsePlayablePort = null;
        ExcellianceAppInfo a32 = a(context, str);
        Intent intent2 = new Intent();
        intent2.setComponent(new ComponentName(context.getPackageName(), "com.excelliance.zmcaplayer.client.VideoActivity"));
        intent2.putExtra("game_cpu", a32 == null ? a32.cpu : 0);
        intent2.putExtra("master_cpu", !com.excelliance.kxqp.gs.ui.home.b.a(context).d() ? 2 : 1);
        intent2.putExtra("assist_pkg", com.excelliance.kxqp.manager.d.a(context).b(context));
        JSONObject jSONObject22 = new JSONObject();
        if (reponsePlayablePort == null) {
        }
        if (reponsePlayableGameInfo == null) {
        }
        az.d("CloudGameFunction", "startGame reponsePortInfo: " + reponsePlayablePort + ",pkg = " + str);
        if (reponsePlayablePort == null) {
        }
    }
}