更新广点通
修复安装mod问题 备份mod还有问题
This commit is contained in:
parent
6ba724c96e
commit
30e527d6f2
@ -148,5 +148,5 @@ dependencies {
|
|||||||
//卡顿检测
|
//卡顿检测
|
||||||
|
|
||||||
// implementation 'com.github.markzhai:blockcanary-android:1.5.0'
|
// implementation 'com.github.markzhai:blockcanary-android:1.5.0'
|
||||||
implementation files('libs/tbs_sdk_thirdapp_v4.3.0.1148_43697_sharewithdownloadwithfile_withoutGame_obfs_20190805_175505.jar')
|
implementation 'com.tencent.tbs.tbssdk:sdk:43697'
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
BIN
app/libs/GDTSDK.unionNormal.4.176.1046.aar
Normal file
BIN
app/libs/GDTSDK.unionNormal.4.176.1046.aar
Normal file
Binary file not shown.
Binary file not shown.
@ -1,5 +1,6 @@
|
|||||||
package Interfaces;
|
package Interfaces;
|
||||||
|
|
||||||
public interface MagicBoxInterface {
|
public abstract class MagicBoxInterface {
|
||||||
void getData(String data);
|
public void getData(String data){};
|
||||||
|
public void getData(String data,Object src){};
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class LoadingActivity extends AppCompatActivity {
|
|||||||
System.out.println("update");
|
System.out.println("update");
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
//setContentView(R.layout.activity_loading);
|
setContentView(R.layout.activity_loading);
|
||||||
Utils.setImmersion(this);
|
Utils.setImmersion(this);
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
clazz = MainActivity.class;
|
clazz = MainActivity.class;
|
||||||
@ -90,12 +90,12 @@ public class LoadingActivity extends AppCompatActivity {
|
|||||||
clazz = WebActivity.class;
|
clazz = WebActivity.class;
|
||||||
}
|
}
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
/* initViews();
|
initViews();
|
||||||
initData();
|
initData();
|
||||||
initAd();*/
|
initAd();
|
||||||
JianRUtils.reloadShipType();
|
/*JianRUtils.reloadShipType();
|
||||||
MapView mapView=new MapView(this);
|
MapView mapView=new MapView(this);
|
||||||
setContentView(mapView.getView());
|
setContentView(mapView.getView());*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void login(String name, String pass) {
|
private void login(String name, String pass) {
|
||||||
@ -473,6 +473,7 @@ public class LoadingActivity extends AppCompatActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AdTools.upload(AdTools.Open,AdTools.req);
|
AdTools.upload(AdTools.Open,AdTools.req);
|
||||||
|
|
||||||
SplashAD splashAD= new SplashAD(this, ad.getAppid(), ad.getPosid(), new SplashADListener() {
|
SplashAD splashAD= new SplashAD(this, ad.getAppid(), ad.getPosid(), new SplashADListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onADDismissed() {
|
public void onADDismissed() {
|
||||||
@ -503,7 +504,12 @@ public class LoadingActivity extends AppCompatActivity {
|
|||||||
public void onADExposure() {
|
public void onADExposure() {
|
||||||
AdTools.upload(AdTools.Open,AdTools.show);
|
AdTools.upload(AdTools.Open,AdTools.show);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
@Override
|
||||||
|
public void onADLoaded(long l) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
splashAD.fetchAndShowIn(adLayout);
|
splashAD.fetchAndShowIn(adLayout);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ package com.yutou.jianr_mg.Network;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class HttpApi {
|
public class HttpApi {
|
||||||
//public static final String HOME="http://jianr.jianrmod.cn/";
|
public static final String HOME="http://jianr.jianrmod.cn/";
|
||||||
// public static final String HOME = "http://192.168.31.92:8080/"; //zzz_gz wifi
|
// public static final String HOME = "http://192.168.31.92:8080/"; //zzz_gz wifi
|
||||||
// public static final String HOME = "http://192.168.43.68:8088/"; //zzz_gz wifi
|
// public static final String HOME = "http://192.168.43.68:8088/"; //zzz_gz wifi
|
||||||
//public static final String HOME = "http://192.168.137.1:8088/"; //笔记本本身WIFI
|
//public static final String HOME = "http://192.168.137.1:8088/"; //笔记本本身WIFI
|
||||||
public static final String HOME = "http://192.168.1.151:8080/"; //公司
|
//public static final String HOME = "http://192.168.1.151:8080/"; //公司
|
||||||
public static final String HOME_URL=HOME+"android/"; //服务器
|
public static final String HOME_URL=HOME+"android/"; //服务器
|
||||||
|
|
||||||
public static final String MOD_ALL = "mod/all.do";
|
public static final String MOD_ALL = "mod/all.do";
|
||||||
|
@ -4,6 +4,7 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@ -28,11 +29,14 @@ import com.yutou.jianr_mg.services.DownloadService;
|
|||||||
import com.yutou.jianr_mg.services.MagicBoxService;
|
import com.yutou.jianr_mg.services.MagicBoxService;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import Interfaces.MagicBoxInterface;
|
import Interfaces.MagicBoxInterface;
|
||||||
import me.drakeet.materialdialog.MaterialDialog;
|
import me.drakeet.materialdialog.MaterialDialog;
|
||||||
@ -247,7 +251,58 @@ public class ModUtils {
|
|||||||
Log.i(TAG, "找不到文件:" + src.getAbsolutePath());
|
Log.i(TAG, "找不到文件:" + src.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private int notRootInstallIndex=0;
|
||||||
public void notRootInstallStart(ModInterface modInterface,boolean isBackup){
|
public void notRootInstallStart(ModInterface modInterface,boolean isBackup){
|
||||||
|
notRootInstallIndex=0;
|
||||||
|
MagicBoxService service=MagicBoxService.init();
|
||||||
|
try {
|
||||||
|
for (int j = 0; j < srcs.size(); j++) {
|
||||||
|
JSONObject order=new JSONObject();
|
||||||
|
order.put("action","copy");
|
||||||
|
if(isBackup){
|
||||||
|
String path= srcs.get(j).getAbsolutePath().replace(srcs.get(j).getName(), "backup/" + packname.getPackname() + "/" + srcs.get(j).getName());
|
||||||
|
order.put("args", new String[]{"files:" + paths.get(j).replace("/files/","")+srcs.get(j).getName(),
|
||||||
|
path});
|
||||||
|
}else {
|
||||||
|
order.put("args", new String[]{srcs.get(j).getAbsolutePath(), "files:" + paths.get(j).replace("/files/", "") + srcs.get(j).getName()});
|
||||||
|
}
|
||||||
|
service.setOrder(order, new MagicBoxInterface() {
|
||||||
|
@Override
|
||||||
|
public void getData(String data,Object src) {
|
||||||
|
JSONObject json= (JSONObject) src;
|
||||||
|
try {
|
||||||
|
System.out.println(">>>>"+((String[])json.get("args"))[0]);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
notRootInstallIndex++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
int time=0;
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
time+=100;
|
||||||
|
if(notRootInstallIndex==srcs.size()){
|
||||||
|
cancel();
|
||||||
|
if(isBackup){
|
||||||
|
notRootInstallStart(modInterface,false);
|
||||||
|
}else {
|
||||||
|
modInterface.onAction(true, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(time==10000){
|
||||||
|
modInterface.onAction(false,-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},0,100);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void notRootInstallStart1(ModInterface modInterface,boolean isBackup){
|
||||||
try{
|
try{
|
||||||
if(i==srcs.size()){
|
if(i==srcs.size()){
|
||||||
MagicBoxService.init().clearOrder();
|
MagicBoxService.init().clearOrder();
|
||||||
@ -268,24 +323,33 @@ public class ModUtils {
|
|||||||
modInterface.onAction(false,0);
|
modInterface.onAction(false,0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
service.setOrder(order, data -> { //先备份
|
service.setOrder(order, new MagicBoxInterface() {
|
||||||
try {
|
@Override
|
||||||
if(!isBackup){//如果不需要备份则按照安装逻辑进行
|
public void getData(String data, Object src) {
|
||||||
|
super.getData(data, src);
|
||||||
|
try {
|
||||||
|
if(!isBackup){//如果不需要备份则按照安装逻辑进行
|
||||||
|
i++;
|
||||||
|
MagicBoxService.init().clearOrder();
|
||||||
|
notRootInstallStart(modInterface,false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
order.put("action","copy");
|
||||||
|
order.put("args",new String[]{srcs.get(i).getAbsolutePath(),"files:" + paths.get(i).replace("/files/","")+srcs.get(i).getName()});
|
||||||
i++;
|
i++;
|
||||||
MagicBoxService.init().clearOrder();
|
|
||||||
notRootInstallStart(modInterface,false);
|
MagicBoxService.init().setOrder(order, new MagicBoxInterface() {
|
||||||
return;
|
@Override
|
||||||
|
public void getData(String data, Object src) {
|
||||||
|
super.getData(data, src);
|
||||||
|
MagicBoxService.init().clearOrder();
|
||||||
|
notRootInstallStart(modInterface,true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
modInterface.onAction(false,0);
|
||||||
}
|
}
|
||||||
order.put("action","copy");
|
|
||||||
order.put("args",new String[]{srcs.get(i).getAbsolutePath(),"files:" + paths.get(i).replace("/files/","")+srcs.get(i).getName()});
|
|
||||||
i++;
|
|
||||||
MagicBoxService.init().setOrder(order, data2 -> {//再安装
|
|
||||||
MagicBoxService.init().clearOrder();
|
|
||||||
notRootInstallStart(modInterface,true);
|
|
||||||
});
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
modInterface.onAction(false,0);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getAppPath() {
|
public static String getAppPath() {
|
||||||
String path = Application.application.getFilesDir() + "/jianRMG";
|
String path = Application.application.getExternalFilesDir("") + "/jianRMG";
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,6 @@ public class Utils {
|
|||||||
|
|
||||||
List<PackageInfo> packages = context.getPackageManager().getInstalledPackages(0);
|
List<PackageInfo> packages = context.getPackageManager().getInstalledPackages(0);
|
||||||
for (PackageInfo info : packages) {
|
for (PackageInfo info : packages) {
|
||||||
System.out.println("被检测的包名:" + packName + " 当前包名:" + info.packageName);
|
|
||||||
if (info.packageName.equals(packName)) {
|
if (info.packageName.equals(packName)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@ import org.json.JSONObject;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
@ -28,9 +30,7 @@ import Interfaces.MagicBoxInterface;
|
|||||||
import static android.content.Context.BIND_AUTO_CREATE;
|
import static android.content.Context.BIND_AUTO_CREATE;
|
||||||
|
|
||||||
public class MagicBoxService {
|
public class MagicBoxService {
|
||||||
private JSONObject order = null;
|
|
||||||
private static MagicBoxService magicBoxService = null;
|
private static MagicBoxService magicBoxService = null;
|
||||||
private MagicBoxInterface magicBoxInterface;
|
|
||||||
private JSONObject dealNode, getWarResult;
|
private JSONObject dealNode, getWarResult;
|
||||||
private boolean isClose = true, saveData = false;
|
private boolean isClose = true, saveData = false;
|
||||||
private String dataType, dataName;
|
private String dataType, dataName;
|
||||||
@ -82,23 +82,26 @@ public class MagicBoxService {
|
|||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (order != null && !order.isNull("action")) {
|
List<Map<JSONObject, MagicBoxInterface>> tmpList=new ArrayList<>();
|
||||||
try {
|
for (Map<JSONObject, MagicBoxInterface> map : list) {
|
||||||
System.out.println("提交参数 action:" + order.getString("action") + " args:" + JSON.toJSONString(order.get("args")));
|
tmpList.add(map);
|
||||||
} catch (Exception ignored) {
|
JSONObject order=map.keySet().iterator().next();
|
||||||
}
|
MagicBoxInterface magicBoxInterface=map.get(order);
|
||||||
try {
|
if(!order.isNull("action")){
|
||||||
if (order.getString("action").equals("getVersion")) {
|
try {
|
||||||
magicBoxInterface.getData(boxBinder.getVersion() + "");
|
if (order.getString("action").equals("getVersion")) {
|
||||||
} else {
|
magicBoxInterface.getData(boxBinder.getVersion() + "");
|
||||||
magicBoxInterface.getData(boxBinder.action_remote(order.getString("action"), (String[]) order.get("args")));
|
} else {
|
||||||
|
String[] args=(String[]) order.get("args");
|
||||||
|
System.out.println("执行:"+order.getString("action")+" "+args[0]+" > "+args[1]);
|
||||||
|
magicBoxInterface.getData(boxBinder.action_remote(order.getString("action"),args ),order);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
Application.application.unbindService(connection);
|
|
||||||
isClose = true;
|
|
||||||
cancel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
list.removeAll(tmpList);
|
||||||
try {
|
try {
|
||||||
String str = boxBinder.action_remote("getLastLog", new String[]{"DealNode"});
|
String str = boxBinder.action_remote("getLastLog", new String[]{"DealNode"});
|
||||||
if (str != null) {
|
if (str != null) {
|
||||||
@ -151,7 +154,6 @@ public class MagicBoxService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
order = null;
|
|
||||||
}
|
}
|
||||||
}, 0, 500);
|
}, 0, 500);
|
||||||
}
|
}
|
||||||
@ -180,13 +182,14 @@ public class MagicBoxService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private List<Map<JSONObject,MagicBoxInterface>> list=new ArrayList<>();
|
||||||
public void setOrder(JSONObject order, MagicBoxInterface boxInterface) {
|
public void setOrder(JSONObject order, MagicBoxInterface boxInterface) {
|
||||||
if (isClose) {
|
if (isClose) {
|
||||||
initMagicBox();
|
initMagicBox();
|
||||||
}
|
}
|
||||||
this.order = order;
|
Map<JSONObject,MagicBoxInterface> map=new HashMap<>();
|
||||||
this.magicBoxInterface = boxInterface;
|
map.put(order,boxInterface);
|
||||||
|
list.add(map);
|
||||||
}
|
}
|
||||||
private List<MagicBoxInterface> interfaces;
|
private List<MagicBoxInterface> interfaces;
|
||||||
public void addInterface(MagicBoxInterface magicBoxInterface){
|
public void addInterface(MagicBoxInterface magicBoxInterface){
|
||||||
@ -198,7 +201,7 @@ public class MagicBoxService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearOrder() {
|
public void clearOrder() {
|
||||||
order = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject getDealNode() {
|
public JSONObject getDealNode() {
|
||||||
|
@ -48,6 +48,8 @@ import java.util.List;
|
|||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import Interfaces.MagicBoxInterface;
|
||||||
|
|
||||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||||
|
|
||||||
public class WindowsService extends Service {
|
public class WindowsService extends Service {
|
||||||
@ -144,20 +146,16 @@ public class WindowsService extends Service {
|
|||||||
try {
|
try {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("action", "getVersion");
|
json.put("action", "getVersion");
|
||||||
boxService.setOrder(json, data -> {
|
boxService.setOrder(json, new MagicBoxInterface() {
|
||||||
boxService.clearOrder();
|
@Override
|
||||||
isRuntime = true;
|
public void getData(String data) {
|
||||||
|
super.getData(data);
|
||||||
|
boxService.clearOrder();
|
||||||
|
isRuntime = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if(listener) {
|
if(listener) {
|
||||||
listener=false;
|
listener=false;
|
||||||
boxService.setOnListener(data -> {
|
|
||||||
try{
|
|
||||||
JSONObject jdata=new JSONObject(data);
|
|
||||||
//保留,还不知道干啥用
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
if (isRuntime) {
|
if (isRuntime) {
|
||||||
|
Loading…
Reference in New Issue
Block a user