- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
49 lines
1.4 KiB
Java
49 lines
1.4 KiB
Java
package androidx.core.telephony;
|
|
|
|
import android.os.Build;
|
|
import android.telephony.SubscriptionManager;
|
|
import androidx.annotation.RequiresApi;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
|
|
@RequiresApi(22)
|
|
/* loaded from: classes.dex */
|
|
public class SubscriptionManagerCompat {
|
|
private static Method sGetSlotIndexMethod;
|
|
|
|
public static int getSlotIndex(int i) {
|
|
if (i == -1) {
|
|
return -1;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 29) {
|
|
return Api29Impl.getSlotIndex(i);
|
|
}
|
|
try {
|
|
if (sGetSlotIndexMethod == null) {
|
|
Method declaredMethod = SubscriptionManager.class.getDeclaredMethod("getSlotIndex", Integer.TYPE);
|
|
sGetSlotIndexMethod = declaredMethod;
|
|
declaredMethod.setAccessible(true);
|
|
}
|
|
Integer num = (Integer) sGetSlotIndexMethod.invoke(null, Integer.valueOf(i));
|
|
if (num != null) {
|
|
return num.intValue();
|
|
}
|
|
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
private SubscriptionManagerCompat() {
|
|
}
|
|
|
|
@RequiresApi(29)
|
|
public static class Api29Impl {
|
|
private Api29Impl() {
|
|
}
|
|
|
|
public static int getSlotIndex(int i) {
|
|
return SubscriptionManager.getSlotIndex(i);
|
|
}
|
|
}
|
|
}
|