From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Fri, 29 Jul 2022 20:45:30 +0300 Subject: [PATCH] bugfix: reportNetworkConnectivity() wasn't switched to isInternetCompatEnabled() --- framework/src/android/net/ConnectivityManager.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java index 8857b7996..0fa34a46b 100644 --- a/framework/src/android/net/ConnectivityManager.java +++ b/framework/src/android/net/ConnectivityManager.java @@ -25,7 +25,6 @@ import static android.net.NetworkRequest.Type.TRACK_DEFAULT; import static android.net.NetworkRequest.Type.TRACK_SYSTEM_DEFAULT; import static android.net.QosCallback.QosCallbackRegistrationException; -import android.Manifest; import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.NonNull; @@ -43,7 +42,7 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.content.pm.PackageManager; +import android.content.pm.SpecialRuntimePermAppUtils; import android.net.ConnectivityDiagnosticsManager.DataStallReport.DetectionMethod; import android.net.IpSecManager.UdpEncapsulationSocket; import android.net.SocketKeepalive.Callback; @@ -3141,12 +3140,12 @@ public class ConnectivityManager { */ public void reportNetworkConnectivity(@Nullable Network network, boolean hasConnectivity) { printStackTrace(); - if (mContext.checkSelfPermission(Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED) { - // ConnectivityService enforces this by throwing an unexpected SecurityException, - // which puts GMS into a crash loop. Also useful for other apps that don't expect that - // INTERNET permission might get revoked. + + if (SpecialRuntimePermAppUtils.isInternetCompatEnabled()) { + // caller doesn't have INTERNET, but expects to always have it return; } + try { mService.reportNetworkConnectivity(network, hasConnectivity); } catch (RemoteException e) {