OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 FlowReportService.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.ui.flow;
import android.app.Service;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.util.Log;
import androidx.annotation.Nullable;
import com.android.spush.util.WebActionRouter;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.gs.util.aq;
import com.excelliance.kxqp.gs.util.ar;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class FlowReportService extends Service {
private static Map<String, Long> f8987a = new HashMap();
private static int f8988b = 0;
private int c;
private Handler d;
@Override
@Nullable
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
Log.d("FlowReportService", "onCreate: ");
HandlerThread handlerThread = new HandlerThread("FlowReportService", 10);
handlerThread.start();
this.d = new Handler(handlerThread.getLooper());
this.d.post(new Runnable() {
@Override
public void run() {
FlowReportService.this.c = bx.a().b(FlowReportService.this.getApplicationContext().getSharedPreferences("sp_flow_info", Build.VERSION.SDK_INT < 11 ? 0 : 4), "markFlowReportValve");
if (FlowReportService.this.c == 0) {
FlowReportService.this.c = 10;
}
}
});
}
@Override
public int onStartCommand(final Intent intent, int i, int i2) {
this.d.post(new Runnable() {
@Override
public void run() {
FlowReportService.this.a(intent);
}
});
return super.onStartCommand(intent, i, i2);
}
protected void a(Intent intent) {
int i;
String a2;
if (intent == null || !"com.excean.gspace.flowMonitor.report_flow".equals(intent.getStringExtra("action"))) {
return;
}
String stringExtra = intent.getStringExtra(WebActionRouter.KEY_PKG);
long j = 0;
long longExtra = intent.getLongExtra(ExcellianceAppInfo.KEY_CURRNETPOS, 0L);
long longExtra2 = intent.getLongExtra(RankingItem.KEY_SIZE, 0L);
az.d("FlowReportService", "pkg:" + stringExtra + " currnetPos:" + longExtra + " size:" + longExtra2);
if (longExtra == longExtra2 && longExtra2 != 0) {
by.a(getApplicationContext(), "sp_flow_info").a("download_game_complete", true);
}
if (bx.a().n(getApplicationContext()) || aq.v()) {
return;
}
String a3 = ar.a(getApplicationContext(), longExtra2);
az.d("FlowReport", "reportFlow flowStr:" + a3 + "size:" + longExtra2);
Long l = f8987a.get(stringExtra);
StringBuilder sb = new StringBuilder();
sb.append("FlowReport: flow ");
sb.append(l);
az.d(sb.toString());
if (l == null) {
f8987a.put(stringExtra, Long.valueOf(longExtra));
return;
}
if (l.longValue() >= longExtra2) {
l = 0L;
f8987a.put(stringExtra, l);
}
long longValue = longExtra - l.longValue();
float f = ((((float) longValue) * 1.0f) / 1024.0f) / 1024.0f;
az.d("FlowReport", "reportFlow flowStr:" + a3);
az.d("FlowReport", "valve:" + this.c);
if (b.INSTANCE.b("markTotalCommonFlow") <= 0 && b.INSTANCE.b("markTotalFastFlow") <= 0) {
sendBroadcast(new Intent(getApplicationContext().getPackageName() + ".pause.notify.state"));
az.d("FlowReport", "普通流量使用完,自动暂停下载");
}
if (f < this.c && longExtra != longExtra2) {
return;
}
az.d("FlowReport", "reportFlow: 流量使用大于" + this.c + "M,上报" + f);
JSONObject f2 = aq.f(getApplicationContext());
try {
f2.put("rid", bx.a().a(getApplicationContext()));
f2.put("account", bx.a().r(getApplicationContext()));
f2.put(WebActionRouter.KEY_PKG, stringExtra);
f2.put("flow", longValue);
} catch (JSONException e) {
e = e;
i = 1;
}
try {
if (b.INSTANCE.b("markTotalCommonFlow") <= 0) {
if (b.INSTANCE.b("markTotalFastFlow") > 0) {
i = 2;
f2.put("type", i);
az.d("FlowReport", "reportFlow requestParams:" + f2.toString());
az.d("FlowReportService", "enrequest:" + cn.b(f2.toString()));
String a4 = bd.a("https://sdk.ourplay.com.cn/flow/flowClientRealUse.php", f2.toString());
az.d("FlowReport", "流量上报!entry" + a4);
a2 = cn.a(a4);
az.d("FlowReport", "流量上报!" + a2);
if (new JSONObject(a2).getInt("code") == 1) {
if (longExtra >= longExtra2) {
az.d("FlowReport", "sTotalUseFlow(byte):" + longExtra);
} else {
j = longExtra;
}
if (i == 1) {
b.INSTANCE.a(getApplicationContext(), "markTotalCommonFlow", String.valueOf(b.INSTANCE.b("markTotalCommonFlow") - longValue), "markTotalUseFlow", String.valueOf(b.INSTANCE.b("markTotalUseFlow") + longValue));
} else {
b.INSTANCE.a(getApplicationContext(), "markTotalFastFlow", String.valueOf(b.INSTANCE.b("markTotalFastFlow") - longValue), "markTotalUseFlow", String.valueOf(b.INSTANCE.b("markTotalUseFlow") + longValue));
}
f8988b = (int) (f8988b + longValue);
az.d("FlowReport", "上报成功!sTotalUseFlow:" + aq.b(f8988b));
f8987a.put(stringExtra, Long.valueOf(j));
return;
}
az.d("FlowReport", "上报失败!");
return;
}
}
if (new JSONObject(a2).getInt("code") == 1) {
}
} catch (Exception e2) {
e2.printStackTrace();
return;
}
i = 1;
f2.put("type", i);
az.d("FlowReport", "reportFlow requestParams:" + f2.toString());
az.d("FlowReportService", "enrequest:" + cn.b(f2.toString()));
String a42 = bd.a("https://sdk.ourplay.com.cn/flow/flowClientRealUse.php", f2.toString());
az.d("FlowReport", "流量上报!entry" + a42);
a2 = cn.a(a42);
az.d("FlowReport", "流量上报!" + a2);
}
}