正在查看: 万能钥匙 v1.1.23 应用的 BeaconService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 万能钥匙 v1.1.23 应用的 BeaconService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.finogeeks.mop.bluetooth;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import com.finogeeks.lib.applet.modules.common.CommonKt;
import com.finogeeks.lib.applet.modules.log.FLog;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.n;
import mg0.p;
import mg0.x;
import org.altbeacon.beacon.Beacon;
import org.altbeacon.beacon.BeaconConsumer;
import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.BeaconParser;
import org.altbeacon.beacon.RangeNotifier;
import org.altbeacon.beacon.Region;
@Metadata(d1 = {"\u0000[\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\b\u0006*\u0001#\u0018\u00002\u00020\u0001:\u0001'B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\u000f\u0010\u0005\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0005\u0010\u0003J'\u0010\u000b\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\bH\u0016¢\u0006\u0004\b\u000b\u0010\fJ\u001b\u0010\u000e\u001a\u0004\u0018\u00010\r2\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006H\u0016¢\u0006\u0004\b\u000e\u0010\u000fJ\u000f\u0010\u0011\u001a\u00020\u0010H\u0002¢\u0006\u0004\b\u0011\u0010\u0012J\u001f\u0010\u0011\u001a\u00020\u00042\u0006\u0010\u0013\u001a\u00020\u00102\u0006\u0010\u0015\u001a\u00020\u0014H\u0002¢\u0006\u0004\b\u0011\u0010\u0016J\u0019\u0010\u0019\u001a\u00020\u00042\b\u0010\u0018\u001a\u0004\u0018\u00010\u0017H\u0002¢\u0006\u0004\b\u0019\u0010\u001aJ\u000f\u0010\u001b\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u001b\u0010\u0003R\u0016\u0010\u001d\u001a\u00020\u001c8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u001d\u0010\u001eR\u001c\u0010!\u001a\b\u0012\u0004\u0012\u00020 0\u001f8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b!\u0010\"R\u0014\u0010$\u001a\u00020#8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b$\u0010%R\u0018\u0010\u0018\u001a\u0004\u0018\u00010\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0018\u0010&¨\u0006("}, d2 = {"Lcom/finogeeks/mop/bluetooth/BeaconService;", "Landroid/app/Service;", "<init>", "()V", "Llg0/e0;", "onCreate", "Landroid/content/Intent;", "intent", "", "flags", "startId", "onStartCommand", "(Landroid/content/Intent;II)I", "Landroid/os/IBinder;", "onBind", "(Landroid/content/Intent;)Landroid/os/IBinder;", "Lorg/json/JSONObject;", "getBeacons", "()Lorg/json/JSONObject;", "param", "Lcom/finogeeks/lib/applet/interfaces/ICallback;", "callback", "(Lorg/json/JSONObject;Lcom/finogeeks/lib/applet/interfaces/ICallback;)V", "Lorg/altbeacon/beacon/Region;", "region", "startBeaconDiscovery", "(Lorg/altbeacon/beacon/Region;)V", "stopBeaconDiscovery", "Lorg/altbeacon/beacon/BeaconManager;", "beaconManager", "Lorg/altbeacon/beacon/BeaconManager;", "", "Lorg/altbeacon/beacon/Beacon;", "beacons", "Ljava/util/List;", "com/finogeeks/mop/bluetooth/BeaconService$consumer$1", "consumer", "Lcom/finogeeks/mop/bluetooth/BeaconService$consumer$1;", "Lorg/altbeacon/beacon/Region;", "Companion", "bluetooth_release"}, k = 1, mv = {1, 4, 0})
public final class BeaconService extends Service {
private BeaconManager a;
private final b b = new b();
private List<? extends Beacon> c;
private Region d;
public static final class a {
private a() {
}
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
public static final class b implements BeaconConsumer {
public b() {
}
public boolean bindService(Intent intent, ServiceConnection serviceConnection, int i) {
n.j(intent, "p0");
n.j(serviceConnection, "p1");
FLog.d$default("BeaconService", "bindService", null, 4, null);
return BeaconService.this.bindService(intent, serviceConnection, i);
}
public Context getApplicationContext() {
Context applicationContext = BeaconService.this.getApplicationContext();
n.e(applicationContext, "[email protected]");
return applicationContext;
}
public void onBeaconServiceConnect() {
FLog.d$default("BeaconService", "onBeaconServiceConnect", null, 4, null);
}
public void unbindService(ServiceConnection serviceConnection) {
n.j(serviceConnection, "p0");
BeaconService.this.unbindService(serviceConnection);
}
}
public static final class c implements RangeNotifier {
public c() {
}
public final void didRangeBeaconsInRegion(Collection<Beacon> collection, Region region) {
FLog.d$default("BeaconService", "RangeNotifier:" + collection, null, 4, null);
BeaconService beaconService = BeaconService.this;
n.e(collection, "beacons");
beaconService.c = x.Z0(collection);
BeaconService.this.sendBroadcast(new Intent("ACTION_BEACON_UPDATE").putParcelableArrayListExtra("beacons", new ArrayList<>(collection)), CommonKt.broadcastPermission(BeaconService.this));
}
}
static {
new a(null);
}
public BeaconService() {
p.j();
}
private final void a() {
if (this.d == null) {
return;
}
BeaconManager beaconManager = this.a;
if (beaconManager == null) {
n.z("beaconManager");
}
Region region = this.d;
if (region == null) {
n.t();
}
beaconManager.stopRangingBeaconsInRegion(region);
this.d = null;
FLog.d$default("BeaconService", "stopBeaconDiscovery", null, 4, null);
}
private final void a(Region region) {
if (region == null) {
return;
}
this.d = region;
BeaconManager beaconManager = this.a;
if (beaconManager == null) {
n.z("beaconManager");
}
beaconManager.startRangingBeaconsInRegion(region);
FLog.d$default("BeaconService", "startBeaconDiscovery:" + region, null, 4, null);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
BeaconManager instanceForApplication = BeaconManager.getInstanceForApplication(getApplicationContext());
n.e(instanceForApplication, "BeaconManager.getInstanc…ation(applicationContext)");
this.a = instanceForApplication;
if (instanceForApplication == null) {
n.z("beaconManager");
}
instanceForApplication.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
BeaconManager beaconManager = this.a;
if (beaconManager == null) {
n.z("beaconManager");
}
beaconManager.addRangeNotifier(new c());
BeaconManager.setDebug(true);
BeaconManager beaconManager2 = this.a;
if (beaconManager2 == null) {
n.z("beaconManager");
}
beaconManager2.bind(this.b);
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
n.j(intent, "intent");
String action = intent.getAction();
if (action != null) {
int hashCode = action.hashCode();
if (hashCode != -1233661590) {
if (hashCode == 1934018826 && action.equals("startBeaconDiscovery")) {
a((Region) intent.getParcelableExtra("region"));
}
} else if (action.equals("stopBeaconDiscovery")) {
a();
}
}
return super.onStartCommand(intent, flags, startId);
}
}