正在查看: 管控平台 v5.2.3.0. 应用的 DeployService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 管控平台 v5.2.3.0. 应用的 DeployService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.iflytek.mdmservice.service;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.IntentService;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.iflytek.mdmcommon.LogUtil;
import com.iflytek.mdmcommon.NetUtil;
import com.iflytek.mdmcommon.StringUtils;
import com.iflytek.mdmlibrary.MdmSdk;
import com.iflytek.mdmservice.MDMApp;
import com.iflytek.mdmservice.R$id;
import com.iflytek.mdmservice.R$layout;
import com.iflytek.mdmservice.R$style;
import com.iflytek.mdmservice.k.d0;
import com.igexin.sdk.PushConsts;
public class DeployService extends IntentService {
private static final Object k = new Object();
private volatile boolean f462a;
private volatile boolean f463b;
private volatile boolean f464c;
private volatile boolean d;
private volatile boolean e;
private boolean f;
private Handler g;
private BroadcastReceiver h;
private Runnable i;
private Runnable j;
class a extends BroadcastReceiver {
a() {
}
@Override
public void onReceive(Context context, Intent intent) {
LogUtil.c("app_deployment", "网络变化");
if (intent.getAction().equals(PushConsts.ACTION_BROADCAST_NETWORK_CHANGE) && NetUtil.isNetworkAvailable(context) && com.iflytek.mdmservice.utils.v.c(context).equalsIgnoreCase(com.iflytek.mdmservice.utils.v.d().f())) {
DeployService.w(2);
DeployService.this.f462a = true;
}
}
}
public DeployService() {
super("CheckBlackAppService");
this.g = new Handler(Looper.getMainLooper());
this.h = new a();
this.i = new Runnable() {
@Override
public final void run() {
DeployService.this.k();
}
};
this.j = new Runnable() {
@Override
public final void run() {
DeployService.this.l();
}
};
}
static void q(Dialog dialog, View view) {
dialog.dismiss();
try {
MdmSdk.resetNetworkSetting();
SystemClock.sleep(1000L);
com.iflytek.mdmservice.utils.v d = com.iflytek.mdmservice.utils.v.d();
d.p();
d.u();
} catch (Exception e) {
LogUtil.c("app_deployment", "重走部署流程:" + e.getMessage());
}
}
private void s(long j) {
long currentTimeMillis = System.currentTimeMillis();
while (!this.f462a && System.currentTimeMillis() - currentTimeMillis < j) {
synchronized (k) {
try {
k.wait(1000L);
} catch (InterruptedException e) {
LogUtil.e(e.getMessage());
Thread.currentThread().interrupt();
}
}
}
LogUtil.d("app_deployment", "结束循环");
}
private void t(long j) {
long currentTimeMillis = System.currentTimeMillis();
while (!this.f464c && System.currentTimeMillis() - currentTimeMillis < j) {
synchronized (k) {
try {
k.wait(1000L);
} catch (InterruptedException e) {
LogUtil.e(e.getMessage());
Thread.currentThread().interrupt();
}
}
}
LogUtil.d("app_deployment", "结束循环");
}
public void u(int i) {
if (com.iflytek.mdmservice.utils.v.d().i()) {
if (i == 1) {
this.g.post(new Runnable() {
@Override
public final void run() {
DeployService.v("部署模式下获取应用列表失败");
}
});
return;
}
if (i == 2) {
this.g.post(new Runnable() {
@Override
public final void run() {
DeployService.v("部署模式下打开商店失败");
}
});
} else if (i == 3) {
this.g.post(new Runnable() {
@Override
public final void run() {
DeployService.v("部署模式下网络连接错误,请检查网络");
}
});
} else if (i == 4) {
this.g.post(new Runnable() {
@Override
public final void run() {
DeployService.v("部署模式下获取学生网络失败");
}
});
}
}
}
public static void v(String str) {
LogUtil.d("showMessage");
Context applicationContext = MDMApp.j().getApplicationContext();
AlertDialog.Builder builder = new AlertDialog.Builder(applicationContext);
View inflate = View.inflate(applicationContext, R$layout.dialog_error_deploy, null);
if (StringUtils.notEmpty(str)) {
((TextView) inflate.findViewById(R$id.tv_tip)).setText(str);
}
builder.setView(inflate);
builder.setCancelable(false);
final AlertDialog create = builder.create();
create.getContext().setTheme(R$style.DialogStyle);
inflate.findViewById(R$id.tv_confirm).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DeployService.q(create, view);
}
});
inflate.findViewById(R$id.iv).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
create.dismiss();
}
});
Window window = create.getWindow();
if (Build.VERSION.SDK_INT >= 26) {
window.setType(2038);
} else {
window.setType(2003);
}
int i = applicationContext.getResources().getDisplayMetrics().widthPixels;
create.show();
window.setLayout((i / 5) * 2, -2);
}
public static void w(int i) {
if (com.iflytek.mdmservice.utils.v.d().i()) {
Intent intent = new Intent(MDMApp.j(), (Class<?>) DeployService.class);
intent.putExtra("deploy_service_type", i);
MDMApp.j().startService(intent);
}
}
public static void x() {
MDMApp.j().stopService(new Intent(MDMApp.j(), (Class<?>) DeployService.class));
}
public void k() {
d0.b0().a0().h(new u(this), new v(this));
}
public void l() {
d0.b0().S(com.iflytek.mdmservice.utils.v.d().e(), com.iflytek.mdmservice.utils.v.d().b(), true, -1L, new w(this));
}
@Override
public void onCreate() {
super.onCreate();
this.f = false;
}
@Override
public void onDestroy() {
LogUtil.c("app_deployment", "停止服务DeployService");
unregisterReceiver(this.h);
this.f = false;
this.g.removeCallbacksAndMessages(null);
super.onDestroy();
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
int intExtra = intent.getIntExtra("deploy_service_type", 0);
LogUtil.c("app_deployment", "启动服务DeployService: " + intExtra);
if (intExtra != 1 || !com.iflytek.mdmservice.utils.v.d().i() || this.e) {
if (intExtra != 2 || !com.iflytek.mdmservice.utils.v.d().i() || this.d || this.f464c) {
return;
}
this.g.removeCallbacksAndMessages(null);
this.j.run();
t(60000L);
if (this.f464c) {
return;
}
this.d = true;
u(1);
return;
}
if (this.f463b || this.f462a) {
return;
}
if (!this.f) {
LogUtil.c("app_deployment", "注册学生wifi广播");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(PushConsts.ACTION_BROADCAST_NETWORK_CHANGE);
registerReceiver(this.h, intentFilter);
this.f = true;
}
this.g.removeCallbacksAndMessages(null);
this.i.run();
s(com.igexin.push.config.c.l);
if (this.f462a) {
return;
}
this.f463b = true;
u(4);
}
}