am fc60c4c3: CameraITS: improve ITS user experience
* commit 'fc60c4c3603ed819ebaa1e88fdd47de424ccbad2':
CameraITS: improve ITS user experience
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 0540aab..de39275 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -797,8 +797,8 @@
No camera manager exists! This test device is in a bad state.
</string>
<string name="all_legacy_devices">
- All cameras on this device are LEGACY mode only - ITS tests will only be applied to LIMITED
- or better devices. \'PASS\' button enabled.
+ All cameras on this device are LEGACY mode only - ITS tests are only required on LIMITED
+ or better devices. Pass.
</string>
<string name="its_test_passed">All Camera ITS tests passed. Pass button enabled!</string>
<string name="its_test_failed">Some Camera ITS tests failed.</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
index 17df106..1fdd044 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
@@ -138,6 +138,33 @@
setContentView(R.layout.its_main);
setInfoResources(R.string.camera_its_test, R.string.camera_its_test_info, -1);
setPassFailButtonClickListeners();
+
+ // Hide the test if all camera devices are legacy
+ CameraManager manager = (CameraManager) this.getSystemService(Context.CAMERA_SERVICE);
+ try {
+ String[] cameraIds = manager.getCameraIdList();
+ mNonLegacyCameraIds = new ArrayList<String>();
+ boolean allCamerasAreLegacy = true;
+ for (String id : cameraIds) {
+ CameraCharacteristics characteristics = manager.getCameraCharacteristics(id);
+ if (characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)
+ != CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
+ mNonLegacyCameraIds.add(id);
+ allCamerasAreLegacy = false;
+ }
+ }
+ if (allCamerasAreLegacy) {
+ showToast(R.string.all_legacy_devices);
+ ItsTestActivity.this.getReportLog().setSummary(
+ "PASS: all cameras on this device are LEGACY"
+ , 1.0, ResultType.NEUTRAL, ResultUnit.NONE);
+ setTestResultAndFinish(true);
+ }
+ } catch (CameraAccessException e) {
+ Toast.makeText(ItsTestActivity.this,
+ "Received error from camera service while checking device capabilities: "
+ + e, Toast.LENGTH_SHORT).show();
+ }
getPassButton().setEnabled(false);
}
@@ -148,27 +175,6 @@
if (manager == null) {
showToast(R.string.no_camera_manager);
} else {
- try {
- String[] cameraIds = manager.getCameraIdList();
- mNonLegacyCameraIds = new ArrayList<String>();
- boolean allCamerasAreLegacy = true;
- for (String id : cameraIds) {
- CameraCharacteristics characteristics = manager.getCameraCharacteristics(id);
- if (characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL)
- != CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
- mNonLegacyCameraIds.add(id);
- allCamerasAreLegacy = false;
- }
- }
- if (allCamerasAreLegacy) {
- showToast(R.string.all_legacy_devices);
- getPassButton().setEnabled(true);
- }
- } catch (CameraAccessException e) {
- Toast.makeText(ItsTestActivity.this,
- "Received error from camera service while checking device capabilities: "
- + e, Toast.LENGTH_SHORT).show();
- }
Log.d(TAG, "register ITS result receiver");
IntentFilter filter = new IntentFilter(ACTION_ITS_RESULT);
registerReceiver(mSuccessReceiver, filter);