正在查看: moonshot.企业版 v5.53.33 应用的 DownloadIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: moonshot.企业版 v5.53.33 应用的 DownloadIntentService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.ddtx.dingdatacontact.file.update;
import TCUcMtElLJnqSvqb7YcU.cr3JSOpoZIqsmhvmO4JX.rKwtQoMTg9U9BbR7dg96.C1078;
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 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 jnksI9k6J1HFuFo5YzBf.upyuhngDCr2AObMMnNNw.UBVL9U3WwxbAPwDW6rA5.vjjZ5Y372JU5DzDjNZY5.jnksI9k6J1HFuFo5YzBf.C4024;
public class DownloadIntentService extends IntentService {
public static final String f11414 = "service.intent.version_name";
private static final int f11415 = UUID.randomUUID().hashCode();
public static final String f11416 = "CMPP.apk";
public static final String f11417 = "service.intent.download_url";
private static final int f11418 = 10000;
private static final int f11419 = 10240;
private String f11420;
private C1078.C1090 f11421;
private NotificationManager f11422;
private String f11423;
public DownloadIntentService() {
super("DownloadService");
}
private void m15039() {
FileOutputStream fileOutputStream;
Throwable th;
InputStream inputStream;
FileOutputStream fileOutputStream2;
Exception e;
long contentLength;
long j;
try {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(this.f11420).openConnection();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoOutput(false);
httpURLConnection.setConnectTimeout(f11418);
httpURLConnection.setReadTimeout(f11418);
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(C4024.m18920(getApplicationContext()), f11416));
try {
byte[] bArr = new byte[f11419];
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) {
m15040(i2);
}
i = i2;
}
m15043();
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 m15040(int i) {
this.f11421.m4633(String.format("正在下载:%1$d%%", Integer.valueOf(i))).m4591(100, i, false);
this.f11421.m4655(PendingIntent.getActivity(this, 0, new Intent(), 134217728));
this.f11422.notify(f11415, this.f11421.m4613());
}
private void m15041() {
this.f11422 = (NotificationManager) getSystemService("notification");
C1078.C1090 c1090 = new C1078.C1090(this);
this.f11421 = c1090;
c1090.m4594(String.format("%s V%s", getString(getApplicationInfo().labelRes), this.f11423)).m4641("新版本诚邀体验").m4627(true).m4601(1).m4597(System.currentTimeMillis());
Drawable m15044 = m15044(this);
Bitmap m15045 = m15044 != null ? m15045(m15044) : null;
if (m15045 == null) {
this.f11421.m4634(R.drawable.logo);
} else {
this.f11421.m4634(R.drawable.logo);
this.f11421.m4628(m15045);
}
}
private Intent m15042() {
File m18918 = C4024.m18918(getApplicationContext());
String str = "路径---" + m18918.getAbsolutePath();
Intent intent = new Intent("android.intent.action.VIEW");
intent.addFlags(268435456);
if (Build.VERSION.SDK_INT < 24) {
intent.setDataAndType(Uri.fromFile(m18918), "application/vnd.android.package-archive");
} else {
intent.setFlags(1);
intent.setDataAndType(FileProvider.getUriForFile(this, "com.ddtx.app1.cailiao.fileProvider", m18918), "application/vnd.android.package-archive");
}
return intent;
}
private void m15043() {
startActivity(m15042());
}
@Override
public void onDestroy() {
super.onDestroy();
this.f11422.cancel(f11415);
}
@Override
public void onHandleIntent(Intent intent) {
if (intent != null) {
this.f11423 = intent.getStringExtra(f11414);
this.f11420 = intent.getStringExtra(f11417);
if (TextUtils.isEmpty(this.f11423) || TextUtils.isEmpty(this.f11420)) {
return;
}
String str = "INTENT_VERSION_NAME---" + this.f11423;
String str2 = "INTENT_DOWNLOAD_URL---" + this.f11420;
m15041();
m15039();
}
}
public Drawable m15044(Context context) {
try {
return context.getPackageManager().getApplicationIcon(context.getPackageName());
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
public Bitmap m15045(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 DownloadIntentService(String str) {
super(str);
}
}