Bug 1084423: Fix guards to limit wifi and cellular data per location. r=vng

Without these size guards in place, can result in excessively large collections for a single location.
This commit is contained in:
Garvan Keeley 2014-10-17 16:02:45 -07:00
Родитель 631882b0cd
Коммит 6d39b72e2d
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -142,6 +142,10 @@ public final class Reporter extends BroadcastReceiver {
Map<String, ScanResult> currentWifiData = mBundle.getWifiData();
for (ScanResult result : results) {
if (currentWifiData.size() > MAX_WIFIS_PER_LOCATION) {
return;
}
String key = result.BSSID;
if (!currentWifiData.containsKey(key)) {
currentWifiData.put(key, result);
@ -156,6 +160,9 @@ public final class Reporter extends BroadcastReceiver {
Map<String, CellInfo> currentCellData = mBundle.getCellData();
for (CellInfo result : cells) {
if (currentCellData.size() > MAX_CELLS_PER_LOCATION) {
return;
}
String key = result.getCellIdentity();
if (!currentCellData.containsKey(key)) {
currentCellData.put(key, result);
@ -191,7 +198,9 @@ public final class Reporter extends BroadcastReceiver {
Log.d(LOG_TAG, "Received bundle: " + mlsObj.toString());
}
AppGlobals.guiLogInfo(mlsObj.toString());
if (wifiCount + cellCount < 1) {
return;
}
try {
DataStorageManager.getInstance().insert(mlsObj.toString(), wifiCount, cellCount);