正在查看: moonshot.企业版 v8.14.46 应用的 DownloadIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: moonshot.企业版 v8.14.46 应用的 DownloadIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.ddtx.dingdatacontact.file.update;
import android.app.IntentService;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import androidx.core.content.FileProvider;
import c8sKPHc73aST6XPVbBtC.PGqkJnXjeiwrwErSxdaQ.hX79Ew6mJdJrSjlkdwnl.C1281;
import com.ddtx.dingdatacontact.R;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.UUID;
import kp1AiJpjqJHu1Tcnj96z.IRnPlw4EC2IclzeuBbCK.zSFvmU2XOpXZrEfUxlHp.KHxhowXrCRyoOmo43Lr3.kp1AiJpjqJHu1Tcnj96z.C3158;
public class DownloadIntentService extends IntentService {
private static final int f11396 = 10240;
public static final String f11397 = "CMPP.apk";
private static final int f11398 = 10000;
public static final String f11399 = "service.intent.version_name";
private static final int f11400 = UUID.randomUUID().hashCode();
public static final String f11401 = "service.intent.download_url";
private NotificationManager f11402;
private C1281.C1299 f11403;
private String f11404;
private String f11405;
public DownloadIntentService() {
super("DownloadService");
}
private Intent m15053() {
File m17760 = C3158.m17760(getApplicationContext());
String str = "路径---" + m17760.getAbsolutePath();
Intent intent = new Intent("android.intent.action.VIEW");
intent.addFlags(268435456);
if (Build.VERSION.SDK_INT < 24) {
intent.setDataAndType(Uri.fromFile(m17760), "application/vnd.android.package-archive");
} else {
intent.setFlags(1);
intent.setDataAndType(FileProvider.getUriForFile(this, "com.ddtx.app1.cailiao.fileProvider", m17760), "application/vnd.android.package-archive");
}
return intent;
}
private void m15054() {
FileOutputStream fileOutputStream;
Throwable th;
InputStream inputStream;
FileOutputStream fileOutputStream2;
Exception e;
long contentLength;
long j;
try {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(this.f11404).openConnection();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoOutput(false);
httpURLConnection.setConnectTimeout(f11398);
httpURLConnection.setReadTimeout(f11398);
httpURLConnection.setRequestProperty("Connection", "Keep-Alive");
httpURLConnection.setRequestProperty("Charset", "UTF-8");
httpURLConnection.setRequestProperty("Accept-Encoding", "gzip, deflate");
httpURLConnection.connect();
contentLength = httpURLConnection.getContentLength();
j = 0;
inputStream = httpURLConnection.getInputStream();
} catch (Throwable th2) {
th = th2;
}
try {
fileOutputStream2 = new FileOutputStream(new File(C3158.m17759(getApplicationContext()), f11397));
try {
byte[] bArr = new byte[f11396];
int i = 0;
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
break;
}
j += read;
fileOutputStream2.write(bArr, 0, read);
int i2 = (int) ((100 * j) / contentLength);
if (i2 != i) {
m15056(i2);
}
i = i2;
}
m15057();
try {
fileOutputStream2.close();
} catch (IOException unused) {
}
if (inputStream == null) {
return;
}
} catch (Exception e2) {
e = e2;
String str = "download apk file error:" + e.getMessage();
if (fileOutputStream2 != null) {
try {
fileOutputStream2.close();
} catch (IOException unused2) {
}
}
if (inputStream == null) {
return;
}
inputStream.close();
}
} catch (Exception e3) {
fileOutputStream2 = null;
e = e3;
} catch (Throwable th3) {
fileOutputStream = null;
th = th3;
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException unused3) {
}
}
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException unused4) {
}
}
throw th;
}
} catch (Exception e4) {
fileOutputStream2 = null;
e = e4;
inputStream = null;
} catch (Throwable th4) {
fileOutputStream = null;
th = th4;
inputStream = null;
}
try {
inputStream.close();
} catch (IOException unused5) {
}
}
private void m15055() {
this.f11402 = (NotificationManager) getSystemService("notification");
C1281.C1299 c1299 = new C1281.C1299(this);
this.f11403 = c1299;
c1299.m9264(String.format("%s V%s", getString(getApplicationInfo().labelRes), this.f11405)).m9271("新版本诚邀体验").m9270(true).m9250(1).m9217(System.currentTimeMillis());
Drawable m15059 = m15059(this);
Bitmap m15058 = m15059 != null ? m15058(m15059) : null;
if (m15058 == null) {
this.f11403.m9272(R.drawable.logo);
} else {
this.f11403.m9272(R.drawable.logo);
this.f11403.m9249(m15058);
}
}
private void m15056(int i) {
this.f11403.m9242(String.format("正在下载:%1$d%%", Integer.valueOf(i))).m9260(100, i, false);
this.f11403.m9225(PendingIntent.getActivity(this, 0, new Intent(), 134217728));
this.f11402.notify(f11400, this.f11403.m9203());
}
private void m15057() {
startActivity(m15053());
}
@Override
public void onDestroy() {
super.onDestroy();
this.f11402.cancel(f11400);
}
@Override
public void onHandleIntent(Intent intent) {
if (intent != null) {
this.f11405 = intent.getStringExtra(f11399);
this.f11404 = intent.getStringExtra(f11401);
if (TextUtils.isEmpty(this.f11405) || TextUtils.isEmpty(this.f11404)) {
return;
}
String str = "INTENT_VERSION_NAME---" + this.f11405;
String str2 = "INTENT_DOWNLOAD_URL---" + this.f11404;
m15055();
m15054();
}
}
public Bitmap m15058(Drawable drawable) {
Bitmap createBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), drawable.getOpacity() != -1 ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(createBitmap);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
drawable.draw(canvas);
return createBitmap;
}
public Drawable m15059(Context context) {
try {
return context.getPackageManager().getApplicationIcon(context.getPackageName());
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
public DownloadIntentService(String str) {
super(str);
}
}