Skip to content

Commit

Permalink
Merge pull request mozilla#606 from garvankeeley/bug598
Browse files Browse the repository at this point in the history
Issue 598: allow empty phone type (not just GSM/CDMA)
  • Loading branch information
eggpi committed May 22, 2014
2 parents f588240 + 1fa28d9 commit 2e4d0f6
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/org/mozilla/mozstumbler/Reporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void onReceive(Context context, Intent intent) {
}

if (mGpsPosition != null &&
(mWifiData.size() > WIFI_COUNT_WATERMARK || mCellData.size() > CELLS_COUNT_WATERMARK)) {
(mWifiData.size() > WIFI_COUNT_WATERMARK || mCellData.size() > CELLS_COUNT_WATERMARK)) {
reportCollectedLocation();
}
}
Expand Down Expand Up @@ -162,22 +162,24 @@ private void reportCollectedLocation() {
values.put(Reports.ACCURACY, (int) Math.ceil(mGpsPosition.getAccuracy()));
}

// only upload cell data if it's GSM or CDMA
if (mPhoneType == TelephonyManager.PHONE_TYPE_GSM ||
mPhoneType == TelephonyManager.PHONE_TYPE_CDMA) {

values.put(Reports.RADIO,
(mPhoneType == TelephonyManager.PHONE_TYPE_GSM) ? "gsm" : "cdma");

JSONArray cellJSON = new JSONArray();
for (CellInfo cell : cells) {
cellJSON.put(cell.toJSONObject());
}
// only upload cell data if it's GSM or CDMA
if (mPhoneType == TelephonyManager.PHONE_TYPE_GSM) {
values.put(Reports.RADIO, "gsm");
} else if (mPhoneType == TelephonyManager.PHONE_TYPE_CDMA) {
values.put(Reports.RADIO, "cdma");
} else {
values.put(Reports.RADIO, "");
}

values.put(Reports.CELL, cellJSON.toString());
values.put(Reports.CELL_COUNT, cellJSON.length());
JSONArray cellJSON = new JSONArray();
for (CellInfo cell : cells) {
cellJSON.put(cell.toJSONObject());
}

values.put(Reports.CELL, cellJSON.toString());
values.put(Reports.CELL_COUNT, cellJSON.length());

JSONArray wifiJSON = new JSONArray();
for (ScanResult wifi : wifis) {
try {
Expand All @@ -201,3 +203,4 @@ private void reportCollectedLocation() {
}
}
}

0 comments on commit 2e4d0f6

Please sign in to comment.