Get SubscriptionManager by name due to ContextCompat bug for API 22.

Fixes #8826
This commit is contained in:
Alan Evans 2019-05-23 11:38:24 -03:00 committed by GitHub
parent 56848fb83d
commit 156fe37a60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ import android.os.Vibrator;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi; import android.support.annotation.RequiresApi;
import android.support.v4.content.ContextCompat;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.view.WindowManager; import android.view.WindowManager;
@ -57,6 +56,6 @@ public class ServiceUtil {
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
public static @Nullable SubscriptionManager getSubscriptionManager(@NonNull Context context) { public static @Nullable SubscriptionManager getSubscriptionManager(@NonNull Context context) {
return ContextCompat.getSystemService(context, SubscriptionManager.class); return (SubscriptionManager) context.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
} }
} }