summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2013-09-12 18:22:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-12 18:22:28 +0000
commit8f435baca8b5285a6b4658fc9563f5fcbbdafc6e (patch)
tree385b01e8ed04b5afdfbe4bcf766ee9f07e3795dd /services
parent6c62163976844b28859fca322b28af907ec2856d (diff)
parent126755cf41710d52554d747f3d3667eb0a3c2694 (diff)
downloadframeworks_base-8f435baca8b5285a6b4658fc9563f5fcbbdafc6e.zip
frameworks_base-8f435baca8b5285a6b4658fc9563f5fcbbdafc6e.tar.gz
frameworks_base-8f435baca8b5285a6b4658fc9563f5fcbbdafc6e.tar.bz2
Merge "Fix Wifi Batch Scanning" into klp-dev
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/wifi/WifiService.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/services/java/com/android/server/wifi/WifiService.java b/services/java/com/android/server/wifi/WifiService.java
index c215f40..ed2b8fd 100644
--- a/services/java/com/android/server/wifi/WifiService.java
+++ b/services/java/com/android/server/wifi/WifiService.java
@@ -325,11 +325,13 @@ public final class WifiService extends IWifiManager.Stub {
private class BatchedScanRequest extends DeathRecipient {
BatchedScanSettings settings;
int uid;
+ int pid;
- BatchedScanRequest(BatchedScanSettings settings, IBinder binder, int uid) {
+ BatchedScanRequest(BatchedScanSettings settings, IBinder binder) {
super(0, null, binder, null);
this.settings = settings;
- this.uid = uid;
+ this.uid = getCallingUid();
+ this.pid = getCallingPid();
}
public void binderDied() {
stopBatchedScan(settings, mBinder);
@@ -337,6 +339,10 @@ public final class WifiService extends IWifiManager.Stub {
public String toString() {
return "BatchedScanRequest{settings=" + settings + ", binder=" + mBinder + "}";
}
+
+ public boolean isSameApp() {
+ return (this.uid == getCallingUid() && this.pid == getCallingPid());
+ }
}
private final List<BatchedScanRequest> mBatchedScanners = new ArrayList<BatchedScanRequest>();
@@ -359,7 +365,7 @@ public final class WifiService extends IWifiManager.Stub {
if (mBatchedScanSupported == false) return false;
requested = new BatchedScanSettings(requested);
if (requested.isInvalid()) return false;
- BatchedScanRequest r = new BatchedScanRequest(requested, binder, Binder.getCallingUid());
+ BatchedScanRequest r = new BatchedScanRequest(requested, binder);
synchronized(mBatchedScanners) {
mBatchedScanners.add(r);
resolveBatchedScannersLocked();
@@ -393,16 +399,18 @@ public final class WifiService extends IWifiManager.Stub {
public void stopBatchedScan(BatchedScanSettings settings, IBinder binder) {
enforceChangePermission();
if (mBatchedScanSupported == false) return;
+ ArrayList<BatchedScanRequest> found = new ArrayList<BatchedScanRequest>();
synchronized(mBatchedScanners) {
- BatchedScanRequest found = null;
for (BatchedScanRequest r : mBatchedScanners) {
- if (r.mBinder.equals(binder) && r.settings.equals(settings)) {
- found = r;
- break;
+ if (r.isSameApp() && (settings == null || settings.equals(r.settings))) {
+ found.add(r);
+ if (settings != null) break;
}
}
- if (found != null) {
- mBatchedScanners.remove(found);
+ for (BatchedScanRequest r : found) {
+ mBatchedScanners.remove(r);
+ }
+ if (found.size() != 0) {
resolveBatchedScannersLocked();
}
}