Avoid waiting unnecessarily if there is no data to return.
Bug: 189790442 Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java Change-Id: I091991aac8eb11319bd60dc8f07124ace1ad52f1
This commit is contained in:
@@ -106,6 +106,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 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;
|
||||||
|
|
||||||
@@ -206,6 +208,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