CameraITS: Move report_result out of the ItsSession class.
This function doesn't communicate over an open TCP session with a
device, but rather sends a separate intent.
Change-Id: If2bbb561e69c72b7dd5e0776f1a8ba85bbf0ccbc
diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py
index 81a180f..6f42051 100644
--- a/apps/CameraITS/pymodules/its/device.py
+++ b/apps/CameraITS/pymodules/its/device.py
@@ -506,12 +506,20 @@
rets.append(objs if ncap>1 else objs[0])
return rets if len(rets)>1 else rets[0]
- @staticmethod
- def report_result(camera_id, success):
- resultstr = "%s=%s" % (camera_id, 'True' if success else 'False')
- _run(('%s shell am broadcast '
- '-a %s --es %s %s') % (ItsSession.ADB, ItsSession.ACTION_ITS_RESULT, \
- ItsSession.EXTRA_SUCCESS, resultstr))
+def report_result(camera_id, success):
+ """Send a pass/fail result to the device, via an intent.
+
+ Args:
+ camera_id: The ID string of the camera for which to report pass/fail.
+ success: Boolean, indicating if the result was pass or fail.
+
+ Returns:
+ Nothing.
+ """
+ resultstr = "%s=%s" % (camera_id, 'True' if success else 'False')
+ _run(('%s shell am broadcast '
+ '-a %s --es %s %s') % (ItsSession.ADB, ItsSession.ACTION_ITS_RESULT,
+ ItsSession.EXTRA_SUCCESS, resultstr))
def _run(cmd):
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index 77b5ce5..03f0774 100644
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -114,7 +114,7 @@
if numnotmandatedfail > 0:
print "(*) tests are not yet mandated"
- its.device.ItsSession.report_result(camera_id, numfail == 0)
+ its.device.report_result(camera_id, numfail == 0)
if __name__ == '__main__':
main()