package com.mbridge.msdk.shake; import android.content.Context; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.text.TextUtils; import com.mbridge.msdk.foundation.controller.c; import com.mbridge.msdk.foundation.download.core.DownloadCommon; import com.mbridge.msdk.foundation.same.report.d.d; import com.mbridge.msdk.foundation.tools.af; import org.json.JSONObject; /* loaded from: classes4.dex */ public final class a { private SensorManager a; /* renamed from: com.mbridge.msdk.shake.a$a, reason: collision with other inner class name */ public static class C0233a { static a a = new a(); } private a() { } public static a a() { return C0233a.a; } public final void b(SensorEventListener sensorEventListener) { SensorManager sensorManager = this.a; if (sensorManager != null) { try { sensorManager.unregisterListener(sensorEventListener); } catch (Exception e) { e.printStackTrace(); } } } public final void a(SensorEventListener sensorEventListener) { Context c = c.m().c(); if (c != null) { try { if (this.a == null) { this.a = (SensorManager) c.getSystemService("sensor"); } this.a.registerListener(sensorEventListener, this.a.getDefaultSensor(1), 2); } catch (Exception e) { e.printStackTrace(); String message = e.getMessage(); try { if (TextUtils.isEmpty(message)) { return; } JSONObject jSONObject = new JSONObject(); jSONObject.put("key", "2000106"); if (!TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.V)) { jSONObject.put(DownloadCommon.DOWNLOAD_REPORT_FIND_FILE_RESULT_VALUE_B, com.mbridge.msdk.foundation.same.a.V); } if (!TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.g)) { jSONObject.put("c", com.mbridge.msdk.foundation.same.a.g); } jSONObject.put("reason", message); d.a().a(jSONObject); } catch (Throwable th) { af.b("NativeShakeManager", th.getMessage()); } } } } }