正在查看: 新暖心缘 v8.1.1 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 新暖心缘 v8.1.1 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package i6;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.Parcelable;
import android.text.TextUtils;
import com.amap.api.fence.GeoFence;
import com.amap.api.fence.GeoFenceListener;
import com.amap.api.fence.GeoFenceManagerBase;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.location.DPoint;
import com.faceunity.core.utils.CameraUtils;
import com.tencent.imsdk.BaseConstants;
import com.tencent.qcloud.core.util.IOUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@SuppressLint({"NewApi"})
public class a implements GeoFenceManagerBase {
Context f12676b;
q2 f12675a = null;
PendingIntent f12677c = null;
String f12678d = null;
GeoFenceListener f12679e = null;
private Object f12680f = new Object();
volatile int f12681g = 1;
ArrayList<GeoFence> f12682h = new ArrayList<>();
d f12683i = null;
Object f12684j = new Object();
Object f12685k = new Object();
b f12686l = null;
c f12687m = null;
volatile boolean f12688n = false;
volatile boolean f12689o = false;
volatile boolean f12690p = false;
b0 f12691q = null;
b1 f12692r = null;
AMapLocationClient f12693s = null;
volatile AMapLocation f12694t = null;
long f12695u = 0;
AMapLocationClientOption f12696v = null;
int f12697w = 0;
AMapLocationListener f12698x = new C0176a();
final int f12699y = 3;
volatile boolean f12700z = false;
final class C0176a implements AMapLocationListener {
C0176a() {
}
@Override
public final void onLocationChanged(AMapLocation aMapLocation) {
boolean z7;
int i8;
try {
if (!a.this.f12700z && a.this.f12690p) {
a.this.f12694t = aMapLocation;
if (aMapLocation != null) {
i8 = aMapLocation.getErrorCode();
if (aMapLocation.getErrorCode() == 0) {
a.this.f12695u = t2.y();
a.this.h(5, null, 0L);
z7 = true;
} else {
a.l("定位失败", aMapLocation.getErrorCode(), aMapLocation.getErrorInfo(), "locationDetail:" + aMapLocation.getLocationDetail());
z7 = false;
}
} else {
z7 = false;
i8 = 8;
}
if (z7) {
a aVar = a.this;
aVar.f12697w = 0;
aVar.h(6, null, 0L);
return;
}
Bundle bundle = new Bundle();
if (!a.this.f12688n) {
a.this.f(7);
bundle.putLong("interval", CameraUtils.FOCUS_TIME);
a.this.h(8, bundle, CameraUtils.FOCUS_TIME);
}
a aVar2 = a.this;
int i9 = aVar2.f12697w + 1;
aVar2.f12697w = i9;
if (i9 >= 3) {
bundle.putInt(GeoFence.BUNDLE_KEY_LOCERRORCODE, i8);
a.this.g(1002, bundle);
}
}
} catch (Throwable unused) {
}
}
}
class b extends Handler {
public b(Looper looper) {
super(looper);
}
@Override
public final void handleMessage(Message message) {
try {
switch (message.what) {
case 0:
a.this.u(message.getData());
break;
case 1:
a.this.x(message.getData());
break;
case 2:
a.this.B(message.getData());
break;
case 3:
a.this.z(message.getData());
break;
case 4:
a.this.D(message.getData());
break;
case 5:
a.this.w();
break;
case 6:
a aVar = a.this;
aVar.k(aVar.f12694t);
break;
case 7:
a.this.r();
break;
case 8:
a.this.I(message.getData());
break;
case 9:
a.this.i(message.getData());
break;
case 10:
a.this.e();
break;
case 11:
a.this.G(message.getData());
break;
case 12:
a.this.F(message.getData());
break;
case 13:
a.this.y();
break;
}
} catch (Throwable unused) {
}
}
}
static class c extends HandlerThread {
public c(String str) {
super(str);
}
@Override
public final void run() {
try {
super.run();
} catch (Throwable unused) {
}
}
}
class d extends Handler {
public d() {
}
public d(Looper looper) {
super(looper);
}
@Override
public final void handleMessage(Message message) {
try {
Bundle data = message.getData();
switch (message.what) {
case 1000:
a.this.H(data);
return;
case 1001:
try {
a.this.j((GeoFence) data.getParcelable("geoFence"));
return;
} catch (Throwable th) {
th.printStackTrace();
return;
}
case 1002:
try {
a.this.s(data.getInt(GeoFence.BUNDLE_KEY_LOCERRORCODE));
return;
} catch (Throwable th2) {
th2.printStackTrace();
return;
}
default:
return;
}
} catch (Throwable unused) {
}
}
}
public a(Context context) {
this.f12676b = null;
try {
this.f12676b = context.getApplicationContext();
A();
} catch (Throwable th) {
l2.h(th, "GeoFenceManger", "<init>");
}
}
private void A() {
if (!this.f12690p) {
this.f12690p = true;
}
if (this.f12689o) {
return;
}
try {
this.f12683i = Looper.myLooper() == null ? new d(this.f12676b.getMainLooper()) : new d();
} catch (Throwable th) {
l2.h(th, "GeoFenceManger", "init 1");
}
try {
c cVar = new c("fenceActionThread");
this.f12687m = cVar;
cVar.setPriority(5);
this.f12687m.start();
this.f12686l = new b(this.f12687m.getLooper());
} catch (Throwable th2) {
l2.h(th2, "GeoFenceManger", "init 2");
}
try {
this.f12691q = new b0(this.f12676b);
this.f12692r = new b1();
this.f12696v = new AMapLocationClientOption();
this.f12693s = new AMapLocationClient(this.f12676b);
this.f12696v.setLocationCacheEnable(true);
this.f12696v.setNeedAddress(false);
this.f12693s.setLocationListener(this.f12698x);
if (this.f12675a == null) {
this.f12675a = new q2();
}
} catch (Throwable th3) {
l2.h(th3, "GeoFenceManger", "initBase");
}
this.f12689o = true;
try {
String str = this.f12678d;
if (str == null || this.f12677c != null) {
return;
}
createPendingIntent(str);
} catch (Throwable th4) {
l2.h(th4, "GeoFenceManger", "init 4");
}
}
private void C() {
if (this.f12700z || this.f12686l == null) {
return;
}
boolean z7 = false;
if (this.f12694t != null && t2.o(this.f12694t) && t2.y() - this.f12695u < 10000) {
z7 = true;
}
if (z7) {
h(6, null, 0L);
h(5, null, 0L);
} else {
f(7);
h(7, null, 0L);
}
}
private void E() {
try {
if (this.f12688n) {
f(8);
}
AMapLocationClient aMapLocationClient = this.f12693s;
if (aMapLocationClient != null) {
aMapLocationClient.stopLocation();
}
this.f12688n = false;
} catch (Throwable unused) {
}
}
static float a(DPoint dPoint, List<DPoint> list) {
float f8 = Float.MAX_VALUE;
if (dPoint != null && list != null && !list.isEmpty()) {
Iterator<DPoint> it = list.iterator();
while (it.hasNext()) {
f8 = Math.min(f8, t2.d(dPoint, it.next()));
}
}
return f8;
}
private int b(List<GeoFence> list) {
try {
if (this.f12682h == null) {
this.f12682h = new ArrayList<>();
}
Iterator<GeoFence> it = list.iterator();
while (it.hasNext()) {
p(it.next());
}
return 0;
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "addGeoFenceList");
l("添加围栏失败", 8, th.getMessage(), new String[0]);
return 8;
}
}
private static Bundle c(GeoFence geoFence, String str, String str2, int i8, int i9) {
Bundle bundle = new Bundle();
if (str == null) {
str = "";
}
bundle.putString(GeoFence.BUNDLE_KEY_FENCEID, str);
bundle.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str2);
bundle.putInt(GeoFence.BUNDLE_KEY_FENCESTATUS, i8);
bundle.putInt(GeoFence.BUNDLE_KEY_LOCERRORCODE, i9);
bundle.putParcelable(GeoFence.BUNDLE_KEY_FENCE, geoFence);
return bundle;
}
private GeoFence d(Bundle bundle, boolean z7) {
GeoFence geoFence = new GeoFence();
ArrayList arrayList = new ArrayList();
DPoint dPoint = new DPoint();
if (z7) {
geoFence.setType(1);
arrayList = bundle.getParcelableArrayList("pointList");
if (arrayList != null) {
dPoint = q(arrayList);
}
geoFence.setMaxDis2Center(o(dPoint, arrayList));
geoFence.setMinDis2Center(a(dPoint, arrayList));
} else {
geoFence.setType(0);
dPoint = (DPoint) bundle.getParcelable("centerPoint");
if (dPoint != null) {
arrayList.add(dPoint);
}
float f8 = bundle.getFloat("fenceRadius", 1000.0f);
float f9 = f8 > 0.0f ? f8 : 1000.0f;
geoFence.setRadius(f9);
geoFence.setMinDis2Center(f9);
geoFence.setMaxDis2Center(f9);
}
geoFence.setActivatesAction(this.f12681g);
geoFence.setCustomId(bundle.getString(GeoFence.BUNDLE_KEY_CUSTOMID));
ArrayList arrayList2 = new ArrayList();
arrayList2.add(arrayList);
geoFence.setPointList(arrayList2);
geoFence.setCenter(dPoint);
geoFence.setPendingIntentAction(this.f12678d);
geoFence.setExpiration(-1L);
geoFence.setPendingIntent(this.f12677c);
StringBuilder sb = new StringBuilder();
sb.append(b1.b());
geoFence.setFenceId(sb.toString());
q2 q2Var = this.f12675a;
if (q2Var != null) {
q2Var.b(this.f12676b, 2);
}
return geoFence;
}
static void l(String str, int i8, String str2, String... strArr) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("===========================================\n");
stringBuffer.append(" " + str + " ");
stringBuffer.append(IOUtils.LINE_SEPARATOR_UNIX);
stringBuffer.append("-------------------------------------------\n");
stringBuffer.append("errorCode:" + i8);
stringBuffer.append(IOUtils.LINE_SEPARATOR_UNIX);
stringBuffer.append("错误信息:" + str2);
stringBuffer.append(IOUtils.LINE_SEPARATOR_UNIX);
if (strArr != null && strArr.length > 0) {
for (String str3 : strArr) {
stringBuffer.append(str3);
stringBuffer.append(IOUtils.LINE_SEPARATOR_UNIX);
}
}
stringBuffer.append("===========================================\n");
}
private static boolean m(com.amap.api.fence.GeoFence r4, int r5) {
throw new UnsupportedOperationException("Method not decompiled: i6.a.m(com.amap.api.fence.GeoFence, int):boolean");
}
private static boolean n(AMapLocation aMapLocation, GeoFence geoFence) {
boolean z7 = false;
try {
if (t2.o(aMapLocation) && geoFence != null && geoFence.getPointList() != null && !geoFence.getPointList().isEmpty()) {
int type = geoFence.getType();
if (type != 0) {
if (type != 1) {
if (type != 2) {
if (type != 3) {
}
}
}
boolean z8 = false;
for (List<DPoint> list : geoFence.getPointList()) {
try {
if (list.size() < 3 ? false : l2.k(new DPoint(aMapLocation.getLatitude(), aMapLocation.getLongitude()), list)) {
z8 = true;
}
} catch (Throwable th) {
th = th;
z7 = z8;
l2.h(th, "Utils", "isInGeoFence");
return z7;
}
}
z7 = z8;
}
DPoint center = geoFence.getCenter();
if (t2.e(new double[]{center.getLatitude(), center.getLongitude(), aMapLocation.getLatitude(), aMapLocation.getLongitude()}) <= geoFence.getRadius()) {
return true;
}
}
} catch (Throwable th2) {
th = th2;
}
return z7;
}
static float o(DPoint dPoint, List<DPoint> list) {
float f8 = Float.MIN_VALUE;
if (dPoint != null && list != null && !list.isEmpty()) {
Iterator<DPoint> it = list.iterator();
while (it.hasNext()) {
f8 = Math.max(f8, t2.d(dPoint, it.next()));
}
}
return f8;
}
private int p(GeoFence geoFence) {
try {
if (this.f12682h == null) {
this.f12682h = new ArrayList<>();
}
if (this.f12682h.contains(geoFence)) {
return 17;
}
this.f12682h.add(geoFence);
return 0;
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "addGeoFence2List");
l("添加围栏失败", 8, th.getMessage(), new String[0]);
return 8;
}
}
private static DPoint q(List<DPoint> list) {
DPoint dPoint = new DPoint();
if (list == null) {
return dPoint;
}
try {
double d8 = 0.0d;
double d9 = 0.0d;
for (DPoint dPoint2 : list) {
d8 += dPoint2.getLatitude();
d9 += dPoint2.getLongitude();
}
return new DPoint(t2.I(d8 / list.size()), t2.I(d9 / list.size()));
} catch (Throwable th) {
l2.h(th, "GeoFenceUtil", "getPolygonCenter");
return dPoint;
}
}
private void t(int i8, Bundle bundle) {
String str;
int i9;
String str2;
boolean z7;
boolean z8;
String str3;
String str4;
int i10;
String str5;
String b8;
int i11;
Bundle bundle2 = new Bundle();
try {
ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
if (bundle != null) {
try {
if (!bundle.isEmpty()) {
List<GeoFence> arrayList2 = new ArrayList<>();
String string = bundle.getString(GeoFence.BUNDLE_KEY_CUSTOMID);
String string2 = bundle.getString("keyWords");
String string3 = bundle.getString("city");
String string4 = bundle.getString("poiType");
DPoint dPoint = (DPoint) bundle.getParcelable("centerPoint");
int i12 = bundle.getInt("searchSize", 10);
float f8 = bundle.getFloat("aroundRadius", 3000.0f);
if (TextUtils.isEmpty(string2)) {
str2 = "添加围栏失败";
z8 = false;
} else {
if (i8 != 1) {
if (i8 == 2) {
if (dPoint == null) {
str2 = "添加围栏失败";
} else {
try {
if (dPoint.getLatitude() > 90.0d || dPoint.getLatitude() < -90.0d || dPoint.getLongitude() > 180.0d || dPoint.getLongitude() < -180.0d) {
str2 = "添加围栏失败";
l(str2, 0, "经纬度错误,传入的纬度:" + dPoint.getLatitude() + "传入的经度:" + dPoint.getLongitude(), new String[0]);
}
} catch (Throwable th) {
th = th;
str = "errorCode";
i9 = 0;
try {
l2.h(th, "GeoFenceManager", "doAddGeoFenceNearby");
bundle2.putInt(str, 8);
g(1000, bundle2);
return;
} catch (Throwable th2) {
bundle2.putInt(str, i9);
g(1000, bundle2);
throw th2;
}
}
}
}
str2 = "添加围栏失败";
} else {
str2 = "添加围栏失败";
z7 = TextUtils.isEmpty(string4) ? false : true;
}
z8 = z7;
}
if (z8) {
Bundle bundle3 = new Bundle();
bundle3.putString(GeoFence.BUNDLE_KEY_CUSTOMID, string);
bundle3.putString("pendingIntentAction", this.f12678d);
str3 = GeoFence.BUNDLE_KEY_CUSTOMID;
str4 = "errorCode";
try {
bundle3.putLong("expiration", -1L);
bundle3.putInt("activatesAction", this.f12681g);
} catch (Throwable th3) {
th = th3;
}
try {
if (i8 == 1) {
bundle3.putFloat("fenceRadius", 1000.0f);
b8 = this.f12691q.b(this.f12676b, "http://restapi.amap.com/v3/place/text?", string2, string4, string3, String.valueOf(i12));
} else if (i8 != 2) {
b8 = i8 != 3 ? null : this.f12691q.a(this.f12676b, "http://restapi.amap.com/v3/config/district?", string2);
} else {
double I = t2.I(dPoint.getLatitude());
double I2 = t2.I(dPoint.getLongitude());
int intValue = Float.valueOf(f8).intValue();
bundle3.putFloat("fenceRadius", 200.0f);
b8 = this.f12691q.c(this.f12676b, "http://restapi.amap.com/v3/place/around?", string2, string4, String.valueOf(i12), String.valueOf(I), String.valueOf(I2), String.valueOf(intValue));
}
int i13 = 4;
if (b8 != null) {
int a8 = 1 == i8 ? b1.a(b8, arrayList2, bundle3) : 0;
if (2 == i8) {
a8 = b1.d(b8, arrayList2, bundle3);
}
if (3 == i8) {
a8 = this.f12692r.e(b8, arrayList2, bundle3);
}
if (a8 != 10000) {
if (a8 != 1 && a8 != 7 && a8 != 4 && a8 != 5 && a8 != 16 && a8 != 17) {
switch (a8) {
case 10000:
i11 = 0;
break;
case 10001:
case 10002:
case BaseConstants.ERR_SVR_GROUP_PERMISSION_DENY:
case BaseConstants.ERR_SVR_GROUP_INVALID_REQ:
case BaseConstants.ERR_SVR_GROUP_SUPER_NOT_ALLOW_QUIT:
case BaseConstants.ERR_SVR_GROUP_INVALID_ID:
case BaseConstants.ERR_SVR_GROUP_ALLREADY_MEMBER:
i11 = 7;
break;
case 10003:
case 10004:
case 10005:
case BaseConstants.ERR_SVR_GROUP_FREQ_LIMIT:
case BaseConstants.ERR_SVR_GROUP_NOT_FOUND:
case BaseConstants.ERR_SVR_GROUP_JSON_PARSE_FAILED:
case BaseConstants.ERR_SVR_GROUP_FULL_MEMBER_COUNT:
case BaseConstants.ERR_SVR_GROUP_INVALID_GROUPID:
case BaseConstants.ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:
case BaseConstants.ERR_SVR_GROUP_SHUTUP_DENY:
i11 = 4;
break;
default:
switch (a8) {
case 20000:
case 20001:
case 20002:
i11 = 1;
break;
case 20003:
default:
i11 = 8;
break;
}
}
} else {
i11 = a8;
}
if (i11 != 0) {
l(str2, i11, "searchErrCode is " + i11, new String[0]);
}
i9 = i11;
} else if (arrayList2.isEmpty()) {
i9 = 16;
} else {
i9 = b(arrayList2);
if (i9 == 0) {
try {
arrayList.addAll(arrayList2);
} catch (Throwable th4) {
th = th4;
str = str4;
l2.h(th, "GeoFenceManager", "doAddGeoFenceNearby");
bundle2.putInt(str, 8);
g(1000, bundle2);
return;
}
} else {
i13 = i9;
}
}
}
i9 = i13;
} catch (Throwable th5) {
th = th5;
str = str4;
i9 = 0;
l2.h(th, "GeoFenceManager", "doAddGeoFenceNearby");
bundle2.putInt(str, 8);
g(1000, bundle2);
return;
}
} else {
str3 = GeoFence.BUNDLE_KEY_CUSTOMID;
str4 = "errorCode";
i9 = 1;
}
bundle2.putString(str3, string);
bundle2.putParcelableArrayList("resultList", arrayList);
i10 = i9;
str5 = str4;
bundle2.putInt(str5, i10);
g(1000, bundle2);
}
} catch (Throwable th6) {
th = th6;
}
}
str5 = "errorCode";
i10 = 1;
bundle2.putInt(str5, i10);
g(1000, bundle2);
} catch (Throwable th7) {
th = th7;
str = "errorCode";
}
}
private static boolean v(AMapLocation aMapLocation, GeoFence geoFence) {
boolean z7 = true;
try {
if (!n(aMapLocation, geoFence)) {
if (geoFence.getStatus() != 2) {
try {
geoFence.setStatus(2);
geoFence.setEnterTime(-1L);
} catch (Throwable th) {
th = th;
l2.h(th, "Utils", "isFenceStatusChanged");
return z7;
}
}
z7 = false;
} else if (geoFence.getEnterTime() == -1) {
if (geoFence.getStatus() != 1) {
geoFence.setEnterTime(t2.y());
geoFence.setStatus(1);
}
z7 = false;
} else {
if (geoFence.getStatus() != 3 && t2.y() - geoFence.getEnterTime() > 600000) {
geoFence.setStatus(3);
}
z7 = false;
}
} catch (Throwable th2) {
th = th2;
z7 = false;
}
return z7;
}
final void B(Bundle bundle) {
t(1, bundle);
}
final void D(Bundle bundle) {
t(3, bundle);
}
final void F(android.os.Bundle r6) {
throw new UnsupportedOperationException("Method not decompiled: i6.a.F(android.os.Bundle):void");
}
final void G(Bundle bundle) {
try {
if (this.f12682h != null) {
GeoFence geoFence = (GeoFence) bundle.getParcelable("fc");
if (this.f12682h.contains(geoFence)) {
this.f12682h.remove(geoFence);
}
if (this.f12682h.size() <= 0) {
e();
} else {
C();
}
}
} catch (Throwable unused) {
}
}
final void H(Bundle bundle) {
if (bundle != null) {
try {
if (bundle.isEmpty()) {
return;
}
int i8 = bundle.getInt("errorCode");
ArrayList parcelableArrayList = bundle.getParcelableArrayList("resultList");
if (parcelableArrayList == null) {
parcelableArrayList = new ArrayList();
}
String string = bundle.getString(GeoFence.BUNDLE_KEY_CUSTOMID);
if (string == null) {
string = "";
}
GeoFenceListener geoFenceListener = this.f12679e;
if (geoFenceListener != null) {
geoFenceListener.onGeoFenceCreateFinished((ArrayList) parcelableArrayList.clone(), i8, string);
}
if (i8 == 0) {
C();
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "resultAddGeoFenceFinished");
}
}
}
final void I(Bundle bundle) {
try {
if (this.f12693s != null) {
long j8 = CameraUtils.FOCUS_TIME;
if (bundle != null && !bundle.isEmpty()) {
j8 = bundle.getLong("interval", CameraUtils.FOCUS_TIME);
}
this.f12696v.setOnceLocation(false);
this.f12696v.setInterval(j8);
this.f12693s.setLocationOption(this.f12696v);
if (this.f12688n) {
return;
}
this.f12693s.stopLocation();
this.f12693s.startLocation();
this.f12688n = true;
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doStartContinueLocation");
}
}
@Override
public void addDistrictGeoFence(String str, String str2) {
try {
A();
Bundle bundle = new Bundle();
bundle.putString("keyWords", str);
bundle.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str2);
h(4, bundle, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "addDistricetGeoFence");
}
}
@Override
public void addKeywordGeoFence(String str, String str2, String str3, int i8, String str4) {
try {
A();
if (i8 <= 0) {
i8 = 10;
}
if (i8 > 25) {
i8 = 25;
}
Bundle bundle = new Bundle();
bundle.putString("keyWords", str);
bundle.putString("poiType", str2);
bundle.putString("city", str3);
bundle.putInt("searchSize", i8);
bundle.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str4);
h(2, bundle, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "addKeywordGeoFence");
}
}
@Override
public void addNearbyGeoFence(String str, String str2, DPoint dPoint, float f8, int i8, String str3) {
try {
A();
if (f8 <= 0.0f || f8 > 50000.0f) {
f8 = 3000.0f;
}
if (i8 <= 0) {
i8 = 10;
}
if (i8 > 25) {
i8 = 25;
}
Bundle bundle = new Bundle();
bundle.putString("keyWords", str);
bundle.putString("poiType", str2);
bundle.putParcelable("centerPoint", dPoint);
bundle.putFloat("aroundRadius", f8);
bundle.putInt("searchSize", i8);
bundle.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str3);
h(3, bundle, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "addNearbyGeoFence");
}
}
@Override
public void addPolygonGeoFence(List<DPoint> list, String str) {
try {
A();
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("pointList", new ArrayList<>(list));
bundle.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str);
h(1, bundle, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "addPolygonGeoFence");
}
}
@Override
public void addRoundGeoFence(DPoint dPoint, float f8, String str) {
try {
A();
Bundle bundle = new Bundle();
bundle.putParcelable("centerPoint", dPoint);
bundle.putFloat("fenceRadius", f8);
bundle.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str);
h(0, bundle, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "addRoundGeoFence");
}
}
@Override
public PendingIntent createPendingIntent(String str) {
synchronized (this.f12680f) {
try {
Intent intent = new Intent(str);
intent.setPackage(c3.g(this.f12676b));
this.f12677c = PendingIntent.getBroadcast(this.f12676b, 0, intent, 0);
this.f12678d = str;
ArrayList<GeoFence> arrayList = this.f12682h;
if (arrayList != null && !arrayList.isEmpty()) {
Iterator<GeoFence> it = this.f12682h.iterator();
while (it.hasNext()) {
GeoFence next = it.next();
next.setPendingIntent(this.f12677c);
next.setPendingIntentAction(this.f12678d);
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "createPendingIntent");
}
}
return this.f12677c;
}
final void e() {
if (this.f12689o) {
ArrayList<GeoFence> arrayList = this.f12682h;
if (arrayList != null) {
arrayList.clear();
this.f12682h = null;
}
if (this.f12690p) {
return;
}
try {
synchronized (this.f12684j) {
b bVar = this.f12686l;
if (bVar != null) {
bVar.removeCallbacksAndMessages(null);
}
this.f12686l = null;
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "destroyActionHandler");
}
AMapLocationClient aMapLocationClient = this.f12693s;
if (aMapLocationClient != null) {
aMapLocationClient.stopLocation();
this.f12693s.onDestroy();
}
this.f12693s = null;
c cVar = this.f12687m;
if (cVar != null) {
cVar.quitSafely();
}
this.f12687m = null;
this.f12691q = null;
synchronized (this.f12680f) {
PendingIntent pendingIntent = this.f12677c;
if (pendingIntent != null) {
pendingIntent.cancel();
}
this.f12677c = null;
}
try {
synchronized (this.f12685k) {
d dVar = this.f12683i;
if (dVar != null) {
dVar.removeCallbacksAndMessages(null);
}
this.f12683i = null;
}
} catch (Throwable th2) {
l2.h(th2, "GeoFenceManager", "destroyResultHandler");
}
q2 q2Var = this.f12675a;
if (q2Var != null) {
q2Var.s(this.f12676b);
}
this.f12688n = false;
this.f12689o = false;
}
}
final void f(int i8) {
try {
synchronized (this.f12684j) {
b bVar = this.f12686l;
if (bVar != null) {
bVar.removeMessages(i8);
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "removeActionHandlerMessage");
}
}
final void g(int i8, Bundle bundle) {
try {
synchronized (this.f12685k) {
d dVar = this.f12683i;
if (dVar != null) {
Message obtainMessage = dVar.obtainMessage();
obtainMessage.what = i8;
obtainMessage.setData(bundle);
this.f12683i.sendMessage(obtainMessage);
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "sendResultHandlerMessage");
}
}
@Override
public List<GeoFence> getAllGeoFence() {
try {
if (this.f12682h == null) {
this.f12682h = new ArrayList<>();
}
return (ArrayList) this.f12682h.clone();
} catch (Throwable unused) {
return new ArrayList();
}
}
final void h(int i8, Bundle bundle, long j8) {
try {
synchronized (this.f12684j) {
b bVar = this.f12686l;
if (bVar != null) {
Message obtainMessage = bVar.obtainMessage();
obtainMessage.what = i8;
obtainMessage.setData(bundle);
this.f12686l.sendMessageDelayed(obtainMessage, j8);
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "sendActionHandlerMessage");
}
}
final void i(Bundle bundle) {
int i8 = 1;
if (bundle != null) {
try {
i8 = bundle.getInt("activatesAction", 1);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doSetActivatesAction");
return;
}
}
if (this.f12681g != i8) {
ArrayList<GeoFence> arrayList = this.f12682h;
if (arrayList != null && !arrayList.isEmpty()) {
Iterator<GeoFence> it = this.f12682h.iterator();
while (it.hasNext()) {
GeoFence next = it.next();
next.setStatus(0);
next.setEnterTime(-1L);
}
}
C();
}
this.f12681g = i8;
}
@Override
public boolean isPause() {
return this.f12700z;
}
final void j(GeoFence geoFence) {
PendingIntent pendingIntent;
Context context;
try {
synchronized (this.f12680f) {
if (this.f12676b != null) {
if (this.f12677c == null && geoFence.getPendingIntent() == null) {
return;
}
Intent intent = new Intent();
intent.putExtras(c(geoFence, geoFence.getFenceId(), geoFence.getCustomId(), geoFence.getStatus(), 0));
String str = this.f12678d;
if (str != null) {
intent.setAction(str);
}
intent.setPackage(c3.g(this.f12676b));
if (geoFence.getPendingIntent() != null) {
pendingIntent = geoFence.getPendingIntent();
context = this.f12676b;
} else {
pendingIntent = this.f12677c;
context = this.f12676b;
}
pendingIntent.send(context, 0, intent);
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "resultTriggerGeoFence");
}
}
final void k(AMapLocation aMapLocation) {
ArrayList<GeoFence> arrayList;
try {
if (this.f12700z || (arrayList = this.f12682h) == null || arrayList.isEmpty() || aMapLocation == null || aMapLocation.getErrorCode() != 0) {
return;
}
Iterator<GeoFence> it = this.f12682h.iterator();
while (it.hasNext()) {
GeoFence next = it.next();
if (next.isAble() && v(aMapLocation, next) && m(next, this.f12681g)) {
next.setCurrentLocation(aMapLocation);
Bundle bundle = new Bundle();
bundle.putParcelable("geoFence", next);
g(1001, bundle);
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doCheckFence");
}
}
@Override
public void pauseGeoFence() {
try {
A();
this.f12700z = true;
h(13, null, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "pauseGeoFence");
}
}
final void r() {
try {
if (this.f12693s != null) {
E();
this.f12696v.setOnceLocation(true);
this.f12693s.setLocationOption(this.f12696v);
this.f12693s.startLocation();
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doStartOnceLocation");
}
}
@Override
public void removeGeoFence() {
try {
this.f12690p = false;
h(10, null, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "removeGeoFence");
}
}
@Override
public boolean removeGeoFence(GeoFence geoFence) {
try {
ArrayList<GeoFence> arrayList = this.f12682h;
if (arrayList != null && !arrayList.isEmpty()) {
if (!this.f12682h.contains(geoFence)) {
return false;
}
if (this.f12682h.size() == 1) {
this.f12690p = false;
}
Bundle bundle = new Bundle();
bundle.putParcelable("fc", geoFence);
h(11, bundle, 0L);
return true;
}
this.f12690p = false;
h(10, null, 0L);
return true;
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "removeGeoFence(GeoFence)");
return false;
}
}
@Override
public void resumeGeoFence() {
try {
A();
if (this.f12700z) {
this.f12700z = false;
C();
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "resumeGeoFence");
}
}
final void s(int i8) {
try {
if (this.f12676b != null) {
synchronized (this.f12680f) {
if (this.f12677c == null) {
return;
}
Intent intent = new Intent();
intent.putExtras(c(null, null, null, 4, i8));
this.f12677c.send(this.f12676b, 0, intent);
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "resultRemindLocationError");
}
}
@Override
public void setActivateAction(int i8) {
try {
A();
if (i8 > 7 || i8 <= 0) {
i8 = 1;
}
Bundle bundle = new Bundle();
bundle.putInt("activatesAction", i8);
h(9, bundle, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "setActivateAction");
}
}
@Override
public void setGeoFenceAble(String str, boolean z7) {
try {
A();
Bundle bundle = new Bundle();
bundle.putString("fid", str);
bundle.putBoolean("ab", z7);
h(12, bundle, 0L);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "setGeoFenceAble");
}
}
@Override
public void setGeoFenceListener(GeoFenceListener geoFenceListener) {
try {
this.f12679e = geoFenceListener;
} catch (Throwable unused) {
}
}
final void u(Bundle bundle) {
String str;
try {
ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
String str2 = "";
int i8 = 1;
if (bundle != null && !bundle.isEmpty()) {
DPoint dPoint = (DPoint) bundle.getParcelable("centerPoint");
str = bundle.getString(GeoFence.BUNDLE_KEY_CUSTOMID);
if (dPoint != null) {
if (dPoint.getLatitude() <= 90.0d && dPoint.getLatitude() >= -90.0d && dPoint.getLongitude() <= 180.0d && dPoint.getLongitude() >= -180.0d) {
GeoFence d8 = d(bundle, false);
i8 = p(d8);
if (i8 == 0) {
arrayList.add(d8);
}
Bundle bundle2 = new Bundle();
bundle2.putInt("errorCode", i8);
bundle2.putParcelableArrayList("resultList", arrayList);
bundle2.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str);
g(1000, bundle2);
}
l("添加围栏失败", 1, "经纬度错误,传入的纬度:" + dPoint.getLatitude() + "传入的经度:" + dPoint.getLongitude(), new String[0]);
Bundle bundle22 = new Bundle();
bundle22.putInt("errorCode", i8);
bundle22.putParcelableArrayList("resultList", arrayList);
bundle22.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str);
g(1000, bundle22);
}
str2 = str;
}
str = str2;
Bundle bundle222 = new Bundle();
bundle222.putInt("errorCode", i8);
bundle222.putParcelableArrayList("resultList", arrayList);
bundle222.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str);
g(1000, bundle222);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doAddGeoFenceRound");
}
}
final void w() {
float f8;
float f9;
try {
if (!this.f12700z && t2.o(this.f12694t)) {
AMapLocation aMapLocation = this.f12694t;
ArrayList<GeoFence> arrayList = this.f12682h;
if (aMapLocation == null || aMapLocation.getErrorCode() != 0 || arrayList == null || arrayList.isEmpty()) {
f8 = Float.MAX_VALUE;
} else {
DPoint dPoint = new DPoint(aMapLocation.getLatitude(), aMapLocation.getLongitude());
f8 = Float.MAX_VALUE;
for (GeoFence geoFence : arrayList) {
if (geoFence.isAble()) {
float d8 = t2.d(dPoint, geoFence.getCenter());
if (d8 > geoFence.getMinDis2Center() && d8 < geoFence.getMaxDis2Center()) {
f9 = 0.0f;
break;
}
if (d8 > geoFence.getMaxDis2Center()) {
f8 = Math.min(f8, d8 - geoFence.getMaxDis2Center());
}
if (d8 < geoFence.getMinDis2Center()) {
f8 = Math.min(f8, geoFence.getMinDis2Center() - d8);
}
}
}
}
f9 = f8;
if (f9 == Float.MAX_VALUE) {
return;
}
if (f9 < 1000.0f) {
f(7);
Bundle bundle = new Bundle();
bundle.putLong("interval", CameraUtils.FOCUS_TIME);
h(8, bundle, 500L);
return;
}
if (f9 < 5000.0f) {
E();
f(7);
h(7, null, 10000L);
} else {
E();
f(7);
h(7, null, (long) (((f9 - 4000.0f) / 100.0f) * 1000.0f));
}
}
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doCheckLocationPolicy");
}
}
final void x(Bundle bundle) {
GeoFence d8;
try {
ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
String str = "";
int i8 = 1;
if (bundle != null && !bundle.isEmpty()) {
ArrayList parcelableArrayList = bundle.getParcelableArrayList("pointList");
String string = bundle.getString(GeoFence.BUNDLE_KEY_CUSTOMID);
if (parcelableArrayList != null && parcelableArrayList.size() > 2 && (i8 = p((d8 = d(bundle, true)))) == 0) {
arrayList.add(d8);
}
str = string;
}
Bundle bundle2 = new Bundle();
bundle2.putString(GeoFence.BUNDLE_KEY_CUSTOMID, str);
bundle2.putInt("errorCode", i8);
bundle2.putParcelableArrayList("resultList", arrayList);
g(1000, bundle2);
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doAddGeoFencePolygon");
}
}
final void y() {
try {
f(7);
f(8);
AMapLocationClient aMapLocationClient = this.f12693s;
if (aMapLocationClient != null) {
aMapLocationClient.stopLocation();
}
this.f12688n = false;
} catch (Throwable th) {
l2.h(th, "GeoFenceManager", "doPauseGeoFence");
}
}
final void z(Bundle bundle) {
t(2, bundle);
}
}