From 4ca36d5cf37c22ce4be371e1ed6e5c8ac737c4ce Mon Sep 17 00:00:00 2001 From: lucaslin Date: Tue, 23 Mar 2021 18:07:24 +0800 Subject: [PATCH] Replace CM#isNetworkSupported() with checking FEATURE_TELEPHONY ConnectivityManager will be a part of mainline module, so its hidden API cannot be called by external caller. Replace ConnectivityManager#isNetworkSupported() with checking FEATURE_TELEPHONY. Bug: 182963397 Test: m Change-Id: I457459554e5e6fe0874b8db81c6547035a6603b8 Merged-In: I457459554e5e6fe0874b8db81c6547035a6603b8 --- .../timezonedetector/TimeZoneDetectorCallbackImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java index 35194658a48f9..85d2d39d7a1d2 100644 --- a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java +++ b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java @@ -20,7 +20,7 @@ import android.annotation.Nullable; import android.app.AlarmManager; import android.content.ContentResolver; import android.content.Context; -import android.net.ConnectivityManager; +import android.content.pm.PackageManager; import android.os.SystemProperties; import android.provider.Settings; @@ -52,9 +52,7 @@ public final class TimeZoneDetectorCallbackImpl implements TimeZoneDetectorStrat } private boolean deviceHasTelephonyNetwork() { - // TODO b/150583524 Avoid the use of a deprecated API. - return mContext.getSystemService(ConnectivityManager.class) - .isNetworkSupported(ConnectivityManager.TYPE_MOBILE); + return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY); } @Override