summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Estrada Alva <destradaa@google.com> 2015-09-02 17:33:47 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-09-02 17:33:47 +0000
commit3dabfe593aaaa86324e325f5200c2044a68d5c49 (patch)
treee87b1a81c8856fdb9f89802f0ad6f16574d02f66
parent458e7589dd6adeebb4ff9458b69a720cc6db58a6 (diff)
parentee9fd34c6a0669c7451dfe4c1bd15a132a237796 (diff)
Merge "Add required null-checks while handling network intents."
-rw-r--r--services/core/java/com/android/server/location/GpsLocationProvider.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/location/GpsLocationProvider.java b/services/core/java/com/android/server/location/GpsLocationProvider.java
index 5c60a610e392..239c471d2859 100644
--- a/services/core/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/core/java/com/android/server/location/GpsLocationProvider.java
@@ -434,8 +434,11 @@ public class GpsLocationProvider implements LocationProviderInterface {
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
-
if (DEBUG) Log.d(TAG, "receive broadcast intent, action: " + action);
+ if (action == null) {
+ return;
+ }
+
if (action.equals(ALARM_WAKEUP)) {
startNavigating(false);
} else if (action.equals(ALARM_TIMEOUT)) {
@@ -490,21 +493,27 @@ public class GpsLocationProvider implements LocationProviderInterface {
private void checkSmsSuplInit(Intent intent) {
SmsMessage[] messages = Intents.getMessagesFromIntent(intent);
-
if (messages == null) {
Log.e(TAG, "Message does not exist in the intent.");
return;
}
- for (int i=0; i <messages.length; i++) {
- byte[] supl_init = messages[i].getUserData();
- native_agps_ni_message(supl_init,supl_init.length);
+ for (SmsMessage message : messages) {
+ if (message != null && message.mWrappedSmsMessage != null) {
+ byte[] suplInit = message.getUserData();
+ if (suplInit != null) {
+ native_agps_ni_message(suplInit, suplInit.length);
+ }
+ }
}
}
private void checkWapSuplInit(Intent intent) {
- byte[] supl_init = (byte[]) intent.getExtra("data");
- native_agps_ni_message(supl_init,supl_init.length);
+ byte[] suplInit = intent.getByteArrayExtra("data");
+ if (suplInit == null) {
+ return;
+ }
+ native_agps_ni_message(suplInit,suplInit.length);
}
private void updateLowPowerMode() {