正在查看: Minits v4.9.3.32 应用的 BluetoothDeviceSelector.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Minits v4.9.3.32 应用的 BluetoothDeviceSelector.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.xone.android.script.activities;
import C9.e;
import C9.h;
import F9.b;
import U9.A0;
import U9.AbstractC0359y0;
import U9.AbstractC0362z0;
import android.R;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.DialogInterface;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.xone.android.script.activities.BluetoothDeviceSelector;
import com.xone.android.utils.Utils;
import g.c;
import ha.q;
import ha.v;
import java.lang.ref.WeakReference;
import java.util.HashSet;
import java.util.Set;
import p7.m;
import w7.s;
public final class BluetoothDeviceSelector extends c {
public final BluetoothAdapter l = BluetoothAdapter.getDefaultAdapter();
public final T9.c m = new T9.c(this);
public b n;
public boolean o;
public boolean p;
public h q;
public AlertDialog r;
private AlertDialog G0(Throwable th, DialogInterface.OnClickListener onClickListener) {
String M2 = Utils.M2(th);
final String N2 = Utils.N2(th);
AlertDialog.Builder builder = new AlertDialog.Builder(this, 5);
builder.setIcon(R.drawable.ic_dialog_alert);
builder.setTitle(w7.h.c);
builder.setMessage(M2);
if (onClickListener == null) {
onClickListener = new m();
}
builder.setPositiveButton("OK", onClickListener);
final Context applicationContext = getApplicationContext();
final WeakReference weakReference = new WeakReference(findViewById(R.id.content));
builder.setNeutralButton(w7.h.g, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
s.r(applicationContext, weakReference, (String) null, N2);
}
});
AlertDialog create = builder.create();
create.setOwnerActivity(this);
return create;
}
public void O0(Throwable th, DialogInterface.OnClickListener onClickListener) {
if (c()) {
Utils.l("XOneAndroidFramework", "An exception has happened while the activity was being destroyed");
return;
}
AlertDialog G0 = G0(th, onClickListener);
G0.show();
T0(G0);
}
private void T0(AlertDialog alertDialog) {
this.r = alertDialog;
}
public final String[] I0() {
Context applicationContext = getApplicationContext();
HashSet hashSet = new HashSet();
e.b(applicationContext, hashSet, "android.permission.ACCESS_COARSE_LOCATION", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE");
return (String[]) hashSet.toArray(new String[0]);
}
public void J(final Throwable th, final DialogInterface.OnClickListener onClickListener) {
if (c()) {
Utils.l("XOneAndroidFramework", "An exception has happened while the activity was being destroyed");
return;
}
AlertDialog alertDialog = this.r;
if (alertDialog == null || !alertDialog.isShowing()) {
if (!Utils.s3()) {
runOnUiThread(new Runnable() {
@Override
public final void run() {
BluetoothDeviceSelector.this.O0(th, onClickListener);
}
});
return;
}
AlertDialog G0 = G0(th, onClickListener);
this.r = G0;
G0.show();
}
}
public int J0() {
ApplicationInfo applicationInfo = getApplicationContext().getApplicationInfo();
if (applicationInfo != null) {
return applicationInfo.targetSdkVersion;
}
Utils.l("XOneAndroidFramework", "Error in Utils.getTargetSdkVersion(Context context), cannot obtain application info. Returning default targetSdkVersion 7 (Android 2.1).");
return 7;
}
public boolean K0() {
return this.p;
}
public boolean L0(String str) {
try {
getPackageManager().getPermissionInfo(str, 0);
if (A0.b.a(this, str) == 0) {
return true;
}
if (str.equals("android.permission.CHANGE_NETWORK_STATE") && Build.VERSION.RELEASE.equals("6.0")) {
return true;
}
Utils.l("XOneAndroidFramework", "Permission not granted yet: " + str);
return false;
} catch (PackageManager.NameNotFoundException unused) {
Utils.l("XOneAndroidFramework", "Permission " + str + " not found on this device, ignoring it");
return true;
}
}
public boolean M0() {
return Build.VERSION.SDK_INT < 23 || J0() < 23;
}
public final void N0(Throwable th) {
if (c()) {
Utils.l("XOneAndroidFramework", "An exception has happened while the activity was being destroyed");
return;
}
AlertDialog G0 = G0(th, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
G0.show();
T0(G0);
}
public final void P0(DialogInterface dialogInterface, int i) {
try {
S0();
} catch (Exception e) {
b(e);
}
}
public final void Q0(Set set) {
v0();
}
public final void R0(int i) {
Toast.makeText(getApplicationContext(), i, 1).show();
}
public void S0() {
h a = new h.a().d(true).e(1000).f(getString(v.b)).c(new C9.c() {
@Override
public final void a(Set set) {
BluetoothDeviceSelector.this.Q0(set);
}
}).h(I0()).a();
this.q = a;
z0.b.y(this, (String[]) a.d().toArray(new String[0]), this.q.b());
}
public void U0(final int i) {
if (Utils.s3()) {
Toast.makeText(getApplicationContext(), i, 1).show();
} else {
runOnUiThread(new Runnable() {
@Override
public final void run() {
BluetoothDeviceSelector.this.R0(i);
}
});
}
}
public void b(final Throwable th) {
th.printStackTrace();
if (c()) {
Utils.l("XOneAndroidFramework", "An exception has happened while the activity was being destroyed");
return;
}
AlertDialog alertDialog = this.r;
if (alertDialog == null || !alertDialog.isShowing()) {
if (!Utils.s3()) {
runOnUiThread(new Runnable() {
@Override
public final void run() {
BluetoothDeviceSelector.this.N0(th);
}
});
return;
}
AlertDialog G0 = G0(th, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
this.r = G0;
G0.show();
}
}
public boolean c() {
return isDestroyed();
}
public void onCreate(Bundle bundle) {
super/*androidx.fragment.app.j*/.onCreate(bundle);
setContentView(AbstractC0362z0.a);
try {
if (t0(I0())) {
v0();
} else {
S0();
}
} catch (Exception e) {
b(e);
}
}
@SuppressLint({"NotifyDataSetChanged"})
public void onDeleteListClicked(View view) {
try {
this.n.clear();
this.n.notifyDataSetChanged();
} catch (Exception e) {
b(e);
}
}
public void onDestroy() {
try {
if (this.o) {
getApplicationContext().unregisterReceiver(this.m);
this.o = false;
}
} catch (Exception e) {
b(e);
}
super.onDestroy();
}
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super/*androidx.fragment.app.j*/.onRequestPermissionsResult(i, strArr, iArr);
e.v(this, strArr);
if (i != 1000) {
return;
}
HashSet hashSet = new HashSet();
if (iArr != null) {
for (int i2 = 0; i2 < iArr.length; i2++) {
if (iArr[i2] != 0) {
hashSet.add(strArr[i2]);
}
}
}
try {
if (hashSet.isEmpty()) {
this.q.h(Utils.r4(strArr));
return;
}
StringBuilder sb2 = new StringBuilder(this.q.c());
if (this.q.e()) {
J(new q(sb2), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i3) {
BluetoothDeviceSelector.this.P0(dialogInterface, i3);
}
});
}
this.q.g(hashSet);
} catch (Exception e) {
b(e);
}
}
public boolean t0(String... strArr) {
if (strArr == null || strArr.length == 0 || M0()) {
return true;
}
for (String str : strArr) {
if (!L0(str)) {
return false;
}
}
return true;
}
public void v0() {
BluetoothAdapter bluetoothAdapter = this.l;
if (bluetoothAdapter == null) {
U0(A0.a);
finish();
return;
}
if (!bluetoothAdapter.isEnabled()) {
U0(A0.c);
this.l.enable();
}
this.l.startDiscovery();
U0(A0.e);
this.p = getIntent().getBooleanExtra("forceauthentication", false);
RecyclerView findViewById = findViewById(AbstractC0359y0.e);
findViewById.setLayoutManager(new LinearLayoutManager(this));
b bVar = new b(this);
this.n = bVar;
findViewById.setAdapter(bVar);
if (!this.o) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.bluetooth.device.action.FOUND");
intentFilter.addAction("android.bluetooth.adapter.action.DISCOVERY_FINISHED");
getApplicationContext().registerReceiver(this.m, intentFilter);
this.o = true;
}
((Button) findViewById(AbstractC0359y0.a)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
BluetoothDeviceSelector.this.onDeleteListClicked(view);
}
});
}
public b w0() {
return this.n;
}
}