summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2019-04-23 20:45:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-04-23 20:45:59 +0000
commita7a78153b4fa396c3e735444cdef3bba87aeb4f7 (patch)
treec3f167eb1ef0abeef29ff8915b8381b0dce32d78
parenta8f40c8c7f4b4fde3222f644e266bf716954cac6 (diff)
parent733d408a5910dbe65648d6836081b5c9eea836f5 (diff)
Merge "Keep track of Calling UID for WifiLock acquisition" into qt-dev
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 82b7bab97..2f2eeaf20 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -2816,10 +2816,15 @@ public class WifiServiceImpl extends BaseWifiService {
.c(Binder.getCallingUid())
.c(lockMode).flush();
+ // If no UID is provided in worksource, use the calling UID
+ WorkSource updatedWs = (ws == null || ws.isEmpty())
+ ? new WorkSource(Binder.getCallingUid()) : ws;
+
Mutable<Boolean> lockSuccess = new Mutable<>();
boolean runWithScissorsSuccess = mWifiInjector.getClientModeImplHandler().runWithScissors(
() -> {
- lockSuccess.value = mWifiLockManager.acquireWifiLock(lockMode, tag, binder, ws);
+ lockSuccess.value = mWifiLockManager.acquireWifiLock(
+ lockMode, tag, binder, updatedWs);
}, RUN_WITH_SCISSORS_TIMEOUT_MILLIS);
if (!runWithScissorsSuccess) {
Log.e(TAG, "Failed to post runnable to acquireWifiLock");
@@ -2833,9 +2838,13 @@ public class WifiServiceImpl extends BaseWifiService {
public void updateWifiLockWorkSource(IBinder binder, WorkSource ws) {
mLog.info("updateWifiLockWorkSource uid=%").c(Binder.getCallingUid()).flush();
+ // If no UID is provided in worksource, use the calling UID
+ WorkSource updatedWs = (ws == null || ws.isEmpty())
+ ? new WorkSource(Binder.getCallingUid()) : ws;
+
boolean runWithScissorsSuccess = mWifiInjector.getClientModeImplHandler().runWithScissors(
() -> {
- mWifiLockManager.updateWifiLockWorkSource(binder, ws);
+ mWifiLockManager.updateWifiLockWorkSource(binder, updatedWs);
}, RUN_WITH_SCISSORS_TIMEOUT_MILLIS);
if (!runWithScissorsSuccess) {
Log.e(TAG, "Failed to post runnable to updateWifiLockWorkSource");