- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
84 lines
2.8 KiB
Java
84 lines
2.8 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.hardware.Sensor;
|
|
import android.hardware.SensorEvent;
|
|
import android.hardware.SensorEventListener;
|
|
import android.hardware.SensorManager;
|
|
import com.applovin.impl.sdk.AppLovinBroadcastManager;
|
|
import com.applovin.impl.sdk.SessionTracker;
|
|
import java.util.Map;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class s6 implements SensorEventListener, AppLovinBroadcastManager.Receiver {
|
|
private final com.applovin.impl.sdk.j a;
|
|
private final SensorManager b;
|
|
private final Sensor c;
|
|
private final a d;
|
|
private float f;
|
|
|
|
public interface a {
|
|
void a();
|
|
|
|
void b();
|
|
}
|
|
|
|
@Override // android.hardware.SensorEventListener
|
|
public void onAccuracyChanged(Sensor sensor, int i) {
|
|
}
|
|
|
|
public s6(com.applovin.impl.sdk.j jVar, a aVar) {
|
|
this.a = jVar;
|
|
SensorManager sensorManager = (SensorManager) com.applovin.impl.sdk.j.l().getSystemService("sensor");
|
|
this.b = sensorManager;
|
|
this.c = sensorManager.getDefaultSensor(1);
|
|
this.d = aVar;
|
|
}
|
|
|
|
public void a() {
|
|
if (Boolean.parseBoolean(this.a.g0().getExtraParameters().get("disable_sensor_data_collection"))) {
|
|
return;
|
|
}
|
|
this.b.unregisterListener(this);
|
|
this.b.registerListener(this, this.c, (int) TimeUnit.MILLISECONDS.toMicros(50L));
|
|
AppLovinBroadcastManager.unregisterReceiver(this);
|
|
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
|
|
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_RESUMED));
|
|
}
|
|
|
|
public void b() {
|
|
AppLovinBroadcastManager.unregisterReceiver(this);
|
|
this.b.unregisterListener(this);
|
|
}
|
|
|
|
@Override // android.hardware.SensorEventListener
|
|
public void onSensorChanged(SensorEvent sensorEvent) {
|
|
if (sensorEvent.sensor.getType() == 1) {
|
|
float max = Math.max(Math.min(sensorEvent.values[2] / 9.81f, 1.0f), -1.0f);
|
|
float f = this.f;
|
|
float f2 = (f * 0.5f) + (max * 0.5f);
|
|
this.f = f2;
|
|
if (f < 0.8f && f2 > 0.8f) {
|
|
this.d.a();
|
|
} else {
|
|
if (f <= -0.8f || f2 >= -0.8f) {
|
|
return;
|
|
}
|
|
this.d.b();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.sdk.AppLovinBroadcastManager.Receiver
|
|
public void onReceive(Intent intent, Map map) {
|
|
String action = intent.getAction();
|
|
if (SessionTracker.ACTION_APPLICATION_PAUSED.equals(action)) {
|
|
this.b.unregisterListener(this);
|
|
} else if (SessionTracker.ACTION_APPLICATION_RESUMED.equals(action)) {
|
|
a();
|
|
}
|
|
}
|
|
}
|