Files
rr3-apk/decompiled/sources/androidx/core/telephony/TelephonyManagerCompat.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

85 lines
2.7 KiB
Java

package androidx.core.telephony;
import android.annotation.SuppressLint;
import android.os.Build;
import android.telephony.TelephonyManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RequiresPermission;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public class TelephonyManagerCompat {
private static Method sGetDeviceIdMethod;
private static Method sGetSubIdMethod;
@Nullable
@RequiresPermission("android.permission.READ_PHONE_STATE")
@SuppressLint({"MissingPermission"})
public static String getImei(@NonNull TelephonyManager telephonyManager) {
return Api26Impl.getImei(telephonyManager);
}
@SuppressLint({"SoonBlockedPrivateApi"})
public static int getSubscriptionId(@NonNull TelephonyManager telephonyManager) {
if (Build.VERSION.SDK_INT >= 30) {
return Api30Impl.getSubscriptionId(telephonyManager);
}
try {
if (sGetSubIdMethod == null) {
Method declaredMethod = TelephonyManager.class.getDeclaredMethod("getSubId", new Class[0]);
sGetSubIdMethod = declaredMethod;
declaredMethod.setAccessible(true);
}
Integer num = (Integer) sGetSubIdMethod.invoke(telephonyManager, new Object[0]);
if (num == null || num.intValue() == -1) {
return Integer.MAX_VALUE;
}
return num.intValue();
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
return Integer.MAX_VALUE;
}
}
private TelephonyManagerCompat() {
}
@RequiresApi(30)
public static class Api30Impl {
private Api30Impl() {
}
public static int getSubscriptionId(TelephonyManager telephonyManager) {
return telephonyManager.getSubscriptionId();
}
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
@Nullable
@RequiresPermission("android.permission.READ_PHONE_STATE")
@SuppressLint({"MissingPermission"})
public static String getImei(TelephonyManager telephonyManager) {
return telephonyManager.getImei();
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
@Nullable
@RequiresPermission("android.permission.READ_PHONE_STATE")
@SuppressLint({"MissingPermission"})
public static String getDeviceId(TelephonyManager telephonyManager, int i) {
return telephonyManager.getDeviceId(i);
}
}
}