Merge "Avoid waiting unnecessarily if there is no data to return." am: 7184887d71 am: 16063e8281
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1735977 Change-Id: I7a952ff80ce9f68c6a7a6a432799cc1b5b7d1b49
This commit is contained in:
@@ -126,6 +126,8 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
private static final String KEY_NETWORK_STATE_OBSERVER = TEST_PKG + ".observer";
|
private static final String KEY_NETWORK_STATE_OBSERVER = TEST_PKG + ".observer";
|
||||||
private static final String KEY_SKIP_VALIDATION_CHECKS = TEST_PKG + ".skip_validation_checks";
|
private static final String KEY_SKIP_VALIDATION_CHECKS = TEST_PKG + ".skip_validation_checks";
|
||||||
|
|
||||||
|
private static final String EMPTY_STRING = "";
|
||||||
|
|
||||||
protected static final int TYPE_COMPONENT_ACTIVTIY = 0;
|
protected static final int TYPE_COMPONENT_ACTIVTIY = 0;
|
||||||
protected static final int TYPE_COMPONENT_FOREGROUND_SERVICE = 1;
|
protected static final int TYPE_COMPONENT_FOREGROUND_SERVICE = 1;
|
||||||
protected static final int TYPE_EXPEDITED_JOB = 2;
|
protected static final int TYPE_EXPEDITED_JOB = 2;
|
||||||
@@ -229,6 +231,8 @@ public abstract class AbstractRestrictBackgroundNetworkTestCase {
|
|||||||
final String resultData = getResultData();
|
final String resultData = getResultData();
|
||||||
if (resultData == null) {
|
if (resultData == null) {
|
||||||
Log.e(TAG, "Received null data from ordered intent");
|
Log.e(TAG, "Received null data from ordered intent");
|
||||||
|
// Offer an empty string so that the code waiting for the result can return.
|
||||||
|
result.offer(EMPTY_STRING);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result.offer(resultData);
|
result.offer(resultData);
|
||||||
|
|||||||
Reference in New Issue
Block a user