正在查看: 哔哩哔哩 v1.6.6 应用的 UpgradeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 哔哩哔哩 v1.6.6 应用的 UpgradeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.bilibili.tv.ui.upgrade;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import bl.adl;
import bl.adm;
import bl.afv;
import bl.afw;
import bl.agb;
import bl.att;
import bl.bbg;
import bl.bbi;
import bl.bbl;
import bl.bcl;
import bl.ld;
import bl.lr;
import bl.ok;
import com.bilibili.tv.MainApplication;
import com.bilibili.tv.ui.base.BaseActivity;
import com.bilibili.tv.widget.DrawTextView;
import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.RandomAccessFile;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.FileLock;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import javax.net.ssl.HttpsURLConnection;
import kotlin.TypeCastException;
import org.java_websocket.WebSocketImpl;
import tv.danmaku.android.log.BLog;
import tv.danmaku.ijk.media.player.IMediaPlayer;
import u.aly.j;
public final class UpgradeActivity extends BaseActivity implements View.OnClickListener, View.OnFocusChangeListener {
public static final a Companion = new a(null);
private TextView a;
private TextView b;
private DrawTextView c;
private DrawTextView d;
private View e;
private BiliUpgradeInfo f;
private ProgressBar g;
private boolean h;
private c i;
private String j;
@Override
public int g() {
return 2131361832;
}
@Override
public void onBackPressed() {
}
public static final class a {
private a() {
}
public a(bbg bbgVar) {
this();
}
public final Intent a(Context context, BiliUpgradeInfo biliUpgradeInfo) {
Intent intent = new Intent(context, (Class<?>) UpgradeActivity.class);
intent.putExtra("args:info", biliUpgradeInfo);
return intent;
}
}
@Override
public void a(Bundle bundle) {
DrawTextView drawTextView;
this.f = (BiliUpgradeInfo) getIntent().getParcelableExtra("args:info");
if (this.f == null) {
finish();
return;
}
this.a = (TextView) findViewById(2131231026);
this.b = (TextView) findViewById(2131230912);
this.c = (DrawTextView) findViewById(2131230840);
this.d = (DrawTextView) findViewById(2131230793);
this.e = findViewById(2131230726);
this.g = (ProgressBar) findViewById(2131230938);
DrawTextView drawTextView2 = this.c;
if (drawTextView2 != null) {
drawTextView2.setOnClickListener(this);
}
DrawTextView drawTextView3 = this.d;
if (drawTextView3 != null) {
drawTextView3.setOnClickListener(this);
}
DrawTextView drawTextView4 = this.c;
if (drawTextView4 != null) {
drawTextView4.setUpDrawable(2131165415);
}
DrawTextView drawTextView5 = this.d;
if (drawTextView5 != null) {
drawTextView5.setUpDrawable(2131165415);
}
DrawTextView drawTextView6 = this.c;
if (drawTextView6 != null) {
drawTextView6.setOnFocusChangeListener(this);
}
DrawTextView drawTextView7 = this.d;
if (drawTextView7 != null) {
drawTextView7.setOnFocusChangeListener(this);
}
DrawTextView drawTextView8 = this.c;
if (drawTextView8 != null) {
drawTextView8.requestFocus();
}
BiliUpgradeInfo biliUpgradeInfo = this.f;
if (biliUpgradeInfo != null && biliUpgradeInfo.getUpgradeType() == BiliUpgradeInfo.UPGRADE_TYPE_FORCE && (drawTextView = this.d) != null) {
drawTextView.setVisibility(8);
}
TextView textView = this.a;
if (textView != null) {
bbl bblVar = bbl.a;
Object[] objArr = new Object[1];
BiliUpgradeInfo biliUpgradeInfo2 = this.f;
if (biliUpgradeInfo2 == null) {
bbi.a();
}
objArr[0] = biliUpgradeInfo2.getVersionName();
String format = String.format("检测到新版本 V%s", Arrays.copyOf(objArr, objArr.length));
bbi.a((Object) format, "java.lang.String.format(format, *args)");
textView.setText(format);
}
TextView textView2 = this.b;
if (textView2 != null) {
bbl bblVar2 = bbl.a;
Object[] objArr2 = new Object[1];
BiliUpgradeInfo biliUpgradeInfo3 = this.f;
if (biliUpgradeInfo3 == null) {
bbi.a();
}
objArr2[0] = biliUpgradeInfo3.getNewFeature();
String format2 = String.format("更新日志:\n\n%s", Arrays.copyOf(objArr2, objArr2.length));
bbi.a((Object) format2, "java.lang.String.format(format, *args)");
textView2.setText(format2);
}
}
@Override
public void onDestroy() {
DrawTextView drawTextView = this.d;
if (drawTextView != null) {
drawTextView.setOnFocusChangeListener((View.OnFocusChangeListener) null);
}
DrawTextView drawTextView2 = this.c;
if (drawTextView2 != null) {
drawTextView2.setOnFocusChangeListener((View.OnFocusChangeListener) null);
}
DrawTextView drawTextView3 = this.d;
if (drawTextView3 != null) {
drawTextView3.setOnClickListener(null);
}
DrawTextView drawTextView4 = this.c;
if (drawTextView4 != null) {
drawTextView4.setOnClickListener(null);
}
super.onDestroy();
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i != 10086) {
return;
}
if ((Build.VERSION.SDK_INT >= 26 && getPackageManager().canRequestPackageInstalls()) || i2 == -1) {
h();
} else {
i();
}
}
public final void h() {
String str = this.j;
if (TextUtils.isEmpty(str)) {
lr.a(MainApplication.a(), "下载文件失效,请重新下载");
return;
}
if (!TextUtils.equals(Build.BRAND, "HUAWEI")) {
if (!(Build.VERSION.SDK_INT >= 26 ? getPackageManager().canRequestPackageInstalls() : true)) {
agb.a aVar = new agb.a(this);
aVar.a(1).a("安装应用需要打开未知来源权限\n请去设置中开启权限").b(getString(2131492985), new d()).a(getString(2131492982), new e());
aVar.a().show();
return;
}
}
adl.a.a("777", str != null ? str : "");
Intent a2 = adl.a.a(this, str);
if (a2 != null) {
try {
startActivity(a2);
} catch (Exception e2) {
att.a(e2);
}
}
i();
}
static final class d implements agb.b {
d() {
}
@Override
public final void a(agb agbVar, View view) {
if (Build.VERSION.SDK_INT >= 26) {
adl.a(UpgradeActivity.this, 10086);
}
agbVar.dismiss();
}
}
static final class e implements agb.b {
e() {
}
@Override
public final void a(agb agbVar, View view) {
agbVar.dismiss();
UpgradeActivity.this.i();
}
}
public final void i() {
finish();
}
@Override
public void onClick(View view) {
bbi.b(view, "v");
int id = view.getId();
if (id == 2131230793) {
finish();
} else {
if (id != 2131230840) {
return;
}
j();
}
}
private final void j() {
if (this.h) {
finish();
} else if (afw.a(this, afv.a)) {
k();
} else {
afw.a(this);
}
}
private final void k() {
this.h = false;
TextView textView = this.a;
if (textView != null) {
textView.setText("下载中...");
}
View view = this.e;
if (view != null) {
view.setVisibility(8);
}
ProgressBar progressBar = this.g;
if (progressBar != null) {
progressBar.setVisibility(0);
}
if (this.i != null) {
return;
}
lr.b(this, "准备下载");
BiliUpgradeInfo biliUpgradeInfo = this.f;
if (biliUpgradeInfo == null) {
bbi.a();
}
Looper mainLooper = Looper.getMainLooper();
bbi.a((Object) mainLooper, "Looper.getMainLooper()");
this.i = new c(biliUpgradeInfo, new b(this, mainLooper, this));
c cVar = this.i;
if (cVar == null) {
bbi.a();
}
cVar.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Object[0]);
}
public final void a(int i) {
TextView textView = this.b;
if (textView != null) {
bbl bblVar = bbl.a;
Object[] objArr = {Integer.valueOf(i)};
String format = String.format("已下载:%d%%", Arrays.copyOf(objArr, objArr.length));
bbi.a((Object) format, "java.lang.String.format(format, *args)");
textView.setText(format);
}
ProgressBar progressBar = this.g;
if (progressBar != null) {
progressBar.setProgress(i);
}
}
@Override
public void onFocusChange(View view, boolean z) {
bbi.b(view, "v");
if (!(view instanceof DrawTextView)) {
view = null;
}
DrawTextView drawTextView = (DrawTextView) view;
if (drawTextView != null) {
drawTextView.setUpEnabled(z);
}
}
final class b extends Handler {
final UpgradeActivity a;
private final WeakReference<Activity> b;
public b(UpgradeActivity upgradeActivity, Looper looper, Activity activity) {
super(looper);
bbi.b(looper, "looper");
bbi.b(activity, "activity");
this.a = upgradeActivity;
this.b = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message message) {
bbi.b(message, "msg");
switch (message.what) {
case 1:
lr.b(this.a, "开始下载");
break;
case 2:
Object obj = message.obj;
if (obj instanceof Integer) {
this.a.a(((Number) obj).intValue());
break;
}
break;
case 3:
Object obj2 = message.obj;
if (obj2 instanceof String) {
TextView textView = this.a.a;
if (textView == null) {
bbi.a();
}
textView.setText("已完成");
TextView textView2 = this.a.b;
if (textView2 == null) {
bbi.a();
}
textView2.setText("下载完成!");
Activity activity = this.b.get();
boolean z = activity instanceof UpgradeActivity;
UpgradeActivity upgradeActivity = (UpgradeActivity) (!z ? null : activity);
if (upgradeActivity != null) {
upgradeActivity.j = (String) obj2;
}
if (!z) {
activity = null;
}
UpgradeActivity upgradeActivity2 = (UpgradeActivity) activity;
if (upgradeActivity2 != null) {
upgradeActivity2.h();
break;
}
}
break;
case 4:
Object obj3 = message.obj;
if (obj3 instanceof String) {
TextView textView3 = this.a.a;
if (textView3 == null) {
bbi.a();
}
textView3.setText("出错了");
TextView textView4 = this.a.b;
if (textView4 == null) {
bbi.a();
}
textView4.setText((CharSequence) obj3);
View view = this.a.e;
if (view == null) {
bbi.a();
}
view.setVisibility(0);
DrawTextView drawTextView = this.a.d;
if (drawTextView == null) {
bbi.a();
}
drawTextView.setVisibility(8);
DrawTextView drawTextView2 = this.a.c;
if (drawTextView2 == null) {
bbi.a();
}
drawTextView2.setText("确定");
DrawTextView drawTextView3 = this.a.c;
if (drawTextView3 == null) {
bbi.a();
}
drawTextView3.requestFocus();
this.a.h = true;
ok.a("upgrade_error", "type", (String) obj3);
break;
}
break;
}
}
}
static final class c extends AsyncTask<Object, Object, Object> {
public static final a Companion = new a(null);
private String a;
private ConnectivityManager b;
private volatile boolean c;
private final BiliUpgradeInfo d;
private final b e;
public c(BiliUpgradeInfo biliUpgradeInfo, b bVar) {
bbi.b(biliUpgradeInfo, "mUpgradeInfo");
this.d = biliUpgradeInfo;
this.e = bVar;
}
@Override
protected void onPreExecute() {
File externalFilesDir = MainApplication.a().getExternalFilesDir("update");
if (externalFilesDir == null || TextUtils.isEmpty(externalFilesDir.getAbsolutePath())) {
externalFilesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
}
if (externalFilesDir != null) {
String absolutePath = externalFilesDir.getAbsolutePath();
bbi.a((Object) absolutePath, "file.absolutePath");
if (adm.a(absolutePath) == 0) {
externalFilesDir = (File) null;
}
}
if (externalFilesDir == null || TextUtils.isEmpty(externalFilesDir.getAbsolutePath())) {
MainApplication a2 = MainApplication.a();
bbi.a((Object) a2, "MainApplication.getInstance()");
externalFilesDir = a2.getCacheDir();
}
if (externalFilesDir == null) {
a(4, "存储不可用\\n请尝试重启设备后重试");
return;
}
if (!externalFilesDir.exists()) {
externalFilesDir.mkdirs();
}
String absolutePath2 = externalFilesDir.getAbsolutePath();
bbi.a((Object) absolutePath2, "filePath");
boolean z = false;
if (bcl.b(absolutePath2, "/", false, 2, null)) {
this.a = absolutePath2 + "bilibili.apk";
} else {
this.a = absolutePath2 + File.separator + "bilibili.apk";
}
Object systemService = MainApplication.a().getSystemService("connectivity");
if (systemService == null) {
throw new TypeCastException("null cannot be cast to non-null type android.net.ConnectivityManager");
}
this.b = (ConnectivityManager) systemService;
ConnectivityManager connectivityManager = this.b;
if (connectivityManager == null) {
bbi.a();
}
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.getState() == NetworkInfo.State.CONNECTED) {
z = true;
}
if (!z) {
a(4, "网络连接不可用\n请连接后重试");
return;
}
String absolutePath3 = externalFilesDir.getAbsolutePath();
bbi.a((Object) absolutePath3, "file.absolutePath");
long a3 = adm.a(absolutePath3);
if (a3 == 0) {
a(4, "无外置磁盘\n请尝试重启设备后重试");
} else if (a3 <= 104857600) {
a(4, "空间不足\n请清理后重试");
}
}
@Override
protected Object doInBackground(Object[] objArr) {
HttpsURLConnection httpsURLConnection;
bbi.b(objArr, "params");
if (this.c) {
return null;
}
a(1, (Object) null);
String str = this.a;
if (str == null) {
bbi.b("mDownloadPath");
}
File file = new File(str);
if (file.exists()) {
file.delete();
}
BufferedInputStream bufferedInputStream = (BufferedInputStream) null;
try {
try {
try {
URL url = new URL(this.d.getApkUrl());
String protocol = url.getProtocol();
httpsURLConnection = (HttpURLConnection) null;
if (TextUtils.equals(protocol, "https")) {
URLConnection openConnection = url.openConnection();
if (openConnection == null) {
throw new TypeCastException("null cannot be cast to non-null type javax.net.ssl.HttpsURLConnection");
}
httpsURLConnection = (HttpsURLConnection) openConnection;
} else if (TextUtils.equals(protocol, "http")) {
URLConnection openConnection2 = url.openConnection();
if (openConnection2 == null) {
throw new TypeCastException("null cannot be cast to non-null type java.net.HttpURLConnection");
}
httpsURLConnection = (HttpURLConnection) openConnection2;
}
} catch (IOException e) {
e = e;
}
} catch (DownloadException e2) {
e = e2;
} catch (MalformedURLException unused) {
}
if (httpsURLConnection == null) {
throw new DownloadException("无效的网络连接");
}
if (this.c) {
adl.a.a((Closeable) bufferedInputStream);
return null;
}
httpsURLConnection.setRequestMethod("GET");
httpsURLConnection.setConnectTimeout(10000);
httpsURLConnection.setReadTimeout(10000);
httpsURLConnection.setInstanceFollowRedirects(true);
httpsURLConnection.setDoInput(true);
httpsURLConnection.setDoOutput(false);
int responseCode = httpsURLConnection.getResponseCode();
if (this.c) {
adl.a.a((Closeable) bufferedInputStream);
return null;
}
if (responseCode == 0) {
throw new DownloadException("网络连接失败" + String.valueOf(responseCode));
}
if (responseCode == 200) {
String contentType = httpsURLConnection.getContentType();
if (!TextUtils.equals("application/vnd.android.package-archive", contentType) && !TextUtils.equals("application/octet-stream", contentType)) {
throw new DownloadException("下载文件类型异常");
}
}
try {
BufferedInputStream bufferedInputStream2 = new BufferedInputStream(httpsURLConnection.getInputStream());
try {
} catch (DownloadException e3) {
bufferedInputStream = bufferedInputStream2;
e = e3;
a(4, e.getMessage());
adl.a.a((Closeable) bufferedInputStream);
return null;
} catch (MalformedURLException unused2) {
bufferedInputStream = bufferedInputStream2;
a(4, "下载链接异常");
adl.a.a((Closeable) bufferedInputStream);
return null;
} catch (IOException e4) {
bufferedInputStream = bufferedInputStream2;
e = e4;
a(4, e.getMessage());
adl.a.a((Closeable) bufferedInputStream);
return null;
} catch (Throwable th) {
bufferedInputStream = bufferedInputStream2;
th = th;
adl.a.a((Closeable) bufferedInputStream);
throw th;
}
if (this.c) {
adl.a.a((Closeable) bufferedInputStream2);
return null;
}
String str2 = this.a;
if (str2 == null) {
bbi.b("mDownloadPath");
}
String a2 = a(str2, bufferedInputStream2, this.d.getFileSize());
if (!TextUtils.isEmpty(a2)) {
throw new DownloadException(a2);
}
if (file.length() != this.d.getFileSize()) {
throw new DownloadException("下载文件大小异常,请重新下载");
}
if (!a(file, this.d.getApkMd5())) {
throw new DownloadException("下载文件检查异常,请重新下载");
}
String str3 = this.a;
if (str3 == null) {
bbi.b("mDownloadPath");
}
a(3, str3);
adl.a.a((Closeable) bufferedInputStream2);
return null;
} catch (IOException e5) {
throw new DownloadException("获取网络数据流失败" + e5.toString());
}
} catch (Throwable th2) {
th = th2;
}
}
private final String a(String str, BufferedInputStream bufferedInputStream, long j) {
Throwable th;
RandomAccessFile randomAccessFile;
IOException iOException;
InterruptedIOException interruptedIOException;
String iOException2;
FileLock fileLock;
FileLock fileLock2;
FileLock fileLock3;
FileLock fileLock4;
Throwable th2;
IOException e;
InterruptedIOException e2;
byte[] bArr = new byte[WebSocketImpl.RCVBUF];
RandomAccessFile randomAccessFile2 = (RandomAccessFile) null;
FileLock fileLock5 = (FileLock) null;
try {
try {
randomAccessFile = new RandomAccessFile(str, "rwd");
try {
FileLock lock = randomAccessFile.getChannel().lock();
try {
randomAccessFile.seek(randomAccessFile.length());
long nanoTime = System.nanoTime();
long j2 = 0;
while (true) {
int read = bufferedInputStream.read(bArr);
if (read == -1) {
break;
}
try {
if (this.c) {
break;
}
randomAccessFile.write(bArr, 0, read);
fileLock4 = lock;
long j3 = j2 + read;
try {
long nanoTime2 = System.nanoTime();
if (nanoTime2 - nanoTime > IMediaPlayer.MEDIA_INFO_TIMED_TEXT_ERROR) {
a(2, Integer.valueOf((int) ((100 * j3) / j)));
nanoTime = nanoTime2;
}
lock = fileLock4;
j2 = j3;
} catch (InterruptedIOException e3) {
e2 = e3;
interruptedIOException = e2;
randomAccessFile2 = randomAccessFile;
fileLock5 = fileLock4;
BLog.i("DownloadTask", "skip write file!");
iOException2 = interruptedIOException.toString();
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile2);
adl.a.a(fileLock5);
return iOException2;
} catch (IOException e4) {
e = e4;
iOException = e;
randomAccessFile2 = randomAccessFile;
fileLock5 = fileLock4;
BLog.e("DownloadTask", iOException.toString());
iOException2 = iOException.toString();
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile2);
adl.a.a(fileLock5);
return iOException2;
} catch (Throwable th3) {
th2 = th3;
th = th2;
fileLock5 = fileLock4;
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile);
adl.a.a(fileLock5);
throw th;
}
} catch (InterruptedIOException e5) {
e2 = e5;
fileLock4 = lock;
interruptedIOException = e2;
randomAccessFile2 = randomAccessFile;
fileLock5 = fileLock4;
BLog.i("DownloadTask", "skip write file!");
iOException2 = interruptedIOException.toString();
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile2);
adl.a.a(fileLock5);
return iOException2;
} catch (IOException e6) {
e = e6;
fileLock4 = lock;
iOException = e;
randomAccessFile2 = randomAccessFile;
fileLock5 = fileLock4;
BLog.e("DownloadTask", iOException.toString());
iOException2 = iOException.toString();
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile2);
adl.a.a(fileLock5);
return iOException2;
} catch (Throwable th4) {
th2 = th4;
fileLock4 = lock;
th = th2;
fileLock5 = fileLock4;
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile);
adl.a.a(fileLock5);
throw th;
}
}
fileLock4 = lock;
} catch (InterruptedIOException e7) {
e = e7;
fileLock3 = lock;
} catch (IOException e8) {
e = e8;
fileLock2 = lock;
} catch (Throwable th5) {
th = th5;
fileLock = lock;
}
try {
if (!this.c) {
a(2, (Object) 100);
}
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile);
adl.a.a(fileLock4);
return null;
} catch (InterruptedIOException e9) {
e = e9;
fileLock3 = fileLock4;
fileLock5 = fileLock3;
randomAccessFile2 = randomAccessFile;
interruptedIOException = e;
BLog.i("DownloadTask", "skip write file!");
iOException2 = interruptedIOException.toString();
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile2);
adl.a.a(fileLock5);
return iOException2;
} catch (IOException e10) {
e = e10;
fileLock2 = fileLock4;
fileLock5 = fileLock2;
randomAccessFile2 = randomAccessFile;
iOException = e;
BLog.e("DownloadTask", iOException.toString());
iOException2 = iOException.toString();
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile2);
adl.a.a(fileLock5);
return iOException2;
} catch (Throwable th6) {
th = th6;
fileLock = fileLock4;
fileLock5 = fileLock;
th = th;
adl.a.a((InputStream) bufferedInputStream);
adl.a.a(randomAccessFile);
adl.a.a(fileLock5);
throw th;
}
} catch (InterruptedIOException e11) {
interruptedIOException = e11;
randomAccessFile2 = randomAccessFile;
} catch (IOException e12) {
iOException = e12;
randomAccessFile2 = randomAccessFile;
} catch (Throwable th7) {
th = th7;
}
} catch (Throwable th8) {
th = th8;
randomAccessFile = randomAccessFile2;
}
} catch (InterruptedIOException e13) {
e = e13;
} catch (IOException e14) {
e = e14;
}
}
private final boolean a(File file, String str) {
MessageDigest messageDigest;
if (TextUtils.isEmpty(str)) {
return true;
}
try {
FileInputStream fileInputStream = new FileInputStream(file);
messageDigest = MessageDigest.getInstance("MD5");
byte[] bArr = new byte[j.h];
while (true) {
int read = fileInputStream.read(bArr);
if (read < 0) {
break;
}
messageDigest.update(bArr, 0, read);
}
} catch (IOException e) {
BLog.e("DownloadTask", e.toString());
} catch (NoSuchAlgorithmException e2) {
BLog.e("DownloadTask", e2.toString());
}
return bcl.a(str, ld.a(messageDigest.digest()), true);
}
private final void a(int i, Object obj) {
if (this.e == null) {
return;
}
if (i == 4) {
this.c = true;
}
Message obtain = Message.obtain();
obtain.what = i;
obtain.obj = obj;
this.e.sendMessage(obtain);
}
public static final class a {
private a() {
}
public a(bbg bbgVar) {
this();
}
}
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
bbi.b(strArr, "permissions");
bbi.b(iArr, "grantResults");
if ((!(iArr.length == 0)) && i == 16) {
k();
}
}
public static final class DownloadException extends Exception {
public DownloadException(String str) {
super(str);
}
}
}