summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Erik Kline <ek@google.com> 2017-09-12 03:06:53 +0000
committer android-build-merger <android-build-merger@google.com> 2017-09-12 03:06:53 +0000
commitb49e11f712e3f97f1c5ad5129144e454ae5931b8 (patch)
treece78950260892dc9723b0eb2640791520b208007
parentdd5fc73944e3e32401fb53b27345ac4d8553f100 (diff)
parentec02583438effc8b3559ccdfa6c78a8fe1da6fc4 (diff)
Merge "Check for IControllOffload.getServer() returning null" into oc-mr1-dev
am: ec02583438 Change-Id: I5a57a9fd14dc53eaf1722fbc9a972f4f73280497
-rw-r--r--services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java4
-rw-r--r--services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp4
2 files changed, 7 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java b/services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java
index 553fd8c453a0..76195c4ac7d4 100644
--- a/services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java
+++ b/services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java
@@ -109,6 +109,10 @@ public class OffloadHardwareInterface {
mLog.e("tethering offload control not supported: " + e);
return false;
}
+ if (mOffloadControl == null) {
+ mLog.e("tethering IOffloadControl.getService() returned null");
+ return false;
+ }
}
final String logmsg = String.format("initOffloadControl(%s)",
diff --git a/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp b/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
index f9cbd1601290..9a17635721b8 100644
--- a/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
+++ b/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
@@ -113,7 +113,7 @@ static jboolean android_server_connectivity_tethering_OffloadHardwareInterface_c
hidl_handle h1(handleFromFileDescriptor(std::move(fd1))),
h2(handleFromFileDescriptor(std::move(fd2)));
- bool rval;
+ bool rval(false);
hidl_string msg;
const auto status = configInterface->setHandles(h1, h2,
[&rval, &msg](bool success, const hidl_string& errMsg) {
@@ -123,6 +123,8 @@ static jboolean android_server_connectivity_tethering_OffloadHardwareInterface_c
if (!status.isOk() || !rval) {
ALOGE("IOffloadConfig::setHandles() error: '%s' / '%s'",
status.description().c_str(), msg.c_str());
+ // If status is somehow not ok, make sure rval captures this too.
+ rval = false;
}
return rval;