diff options
| author | 2020-12-02 12:16:56 -0800 | |
|---|---|---|
| committer | 2020-12-03 17:43:50 -0800 | |
| commit | 4248f22f18842e3216833b515e53522c353fce7d (patch) | |
| tree | 27f0122e26b9f02ce32c668e1058b162a6374c6f | |
| parent | 08466f6151d0b98b435704ea31af6532864444e7 (diff) | |
Allow the System UID to unregister ConnDiags CBs.
This CL updates ConnectivityService to allow the System's UID to
unregister ConnectivityDiagnostics callbacks. Preivously, only the
registrant was allowed to unregister them - this caused problems for
callbacks that were attempted to be unregistered via binderDied() when
the registrant app dies.
Bug: 159912975
Bug: 174713659
Test: manually verified
Change-Id: I20d0cad5f902708d366aa703c2893b0ea3e55052
| -rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index f7de5c023b4f..da257beec5ef 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -8092,8 +8092,10 @@ public class ConnectivityService extends IConnectivityManager.Stub final NetworkRequestInfo nri = cbInfo.mRequestInfo; - if (uid != nri.mUid) { - if (VDBG) loge("Different uid than registrant attempting to unregister cb"); + // Caller's UID must either be the registrants (if they are unregistering) or the System's + // (if the Binder died) + if (uid != nri.mUid && uid != Process.SYSTEM_UID) { + if (DBG) loge("Uid(" + uid + ") not registrant's (" + nri.mUid + ") or System's"); return; } |