Initial import of ADIF API reverse-engineering toolkit
This commit is contained in:
66
apk_decompiled/sources/k0/AbstractC0415a.java
Normal file
66
apk_decompiled/sources/k0/AbstractC0415a.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package k0;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import kotlinx.coroutines.test.TestBuildersKt;
|
||||
|
||||
/* renamed from: k0.a, reason: case insensitive filesystem */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractC0415a extends BroadcastReceiver {
|
||||
private static final String EXTRA_WAKE_LOCK_ID = "androidx.contentpager.content.wakelockid";
|
||||
private static final SparseArray<PowerManager.WakeLock> sActiveWakeLocks = new SparseArray<>();
|
||||
private static int mNextId = 1;
|
||||
|
||||
public static boolean completeWakefulIntent(Intent intent) {
|
||||
int intExtra = intent.getIntExtra(EXTRA_WAKE_LOCK_ID, 0);
|
||||
if (intExtra == 0) {
|
||||
return false;
|
||||
}
|
||||
SparseArray<PowerManager.WakeLock> sparseArray = sActiveWakeLocks;
|
||||
synchronized (sparseArray) {
|
||||
try {
|
||||
PowerManager.WakeLock wakeLock = sparseArray.get(intExtra);
|
||||
if (wakeLock != null) {
|
||||
wakeLock.release();
|
||||
sparseArray.remove(intExtra);
|
||||
return true;
|
||||
}
|
||||
Log.w("WakefulBroadcastReceiv.", "No active wake lock id #" + intExtra);
|
||||
return true;
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ComponentName startWakefulService(Context context, Intent intent) {
|
||||
SparseArray<PowerManager.WakeLock> sparseArray = sActiveWakeLocks;
|
||||
synchronized (sparseArray) {
|
||||
try {
|
||||
int i = mNextId;
|
||||
int i4 = i + 1;
|
||||
mNextId = i4;
|
||||
if (i4 <= 0) {
|
||||
mNextId = 1;
|
||||
}
|
||||
intent.putExtra(EXTRA_WAKE_LOCK_ID, i);
|
||||
ComponentName startService = context.startService(intent);
|
||||
if (startService == null) {
|
||||
return null;
|
||||
}
|
||||
PowerManager.WakeLock newWakeLock = ((PowerManager) context.getSystemService("power")).newWakeLock(1, "androidx.core:wake:" + startService.flattenToShortString());
|
||||
newWakeLock.setReferenceCounted(false);
|
||||
newWakeLock.acquire(TestBuildersKt.DEFAULT_DISPATCH_TIMEOUT_MS);
|
||||
sparseArray.put(i, newWakeLock);
|
||||
return startService;
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user