summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Kesting <ckesting@google.com>2020-12-04 19:22:05 +0000
committerCody Kesting <ckesting@google.com>2020-12-04 20:46:52 +0000
commit8744c5c999c12f53d7b543f17cfe1a89eefe66c5 (patch)
tree548456b703771ad62f4a1d3bcb1a3fdcf6515c0e
parent6cdf2a4ab695f299126cd6d4d24266b3875e3124 (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 Merged-In: I20d0cad5f902708d366aa703c2893b0ea3e55052 (cherry picked from commit 4787c9bc59556ffb62d3b9d6c894af017d985280)
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java6
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 03c31a6971..cf14c6377d 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -8042,8 +8042,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;
}