Update CodeInspectionTest
Update the method to check it contains valid constructor, otherwise
report error.
Fixes: 129346285
Test: RunSettingsRoboTests
Change-Id: I4c5a62b1046e791f3988cd5215879435a831d19d
diff --git a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
index a723842..675108d 100644
--- a/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
+++ b/tests/robotests/assets/grandfather_invalid_base_preference_controller_constructor
@@ -10,8 +10,5 @@
com.android.settings.fuelgauge.RestrictAppPreferenceController
com.android.settings.fuelgauge.batterysaver.BatterySaverButtonPreferenceController
com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController
-com.android.settings.gestures.SystemNavigationEdgeToEdgePreferenceController
-com.android.settings.gestures.SystemNavigationLegacyPreferenceController
-com.android.settings.gestures.SystemNavigationSwipeUpPreferenceController
com.android.settings.security.VisiblePatternProfilePreferenceController
com.android.settings.wifi.details.WifiMeteredPreferenceController
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java b/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java
index 28e394f..2d1dc5c 100644
--- a/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java
+++ b/tests/robotests/src/com/android/settings/core/BasePreferenceControllerSignatureInspector.java
@@ -58,12 +58,17 @@
if (constructors == null || constructors.length == 0) {
badClasses.append(c.getName()).append(",");
}
+
+ boolean hasValidConstructor = false;
for (Constructor constructor : constructors) {
- if (!hasValidConstructorSignature(constructor)) {
- badClasses.append(className).append(",");
- continue;
+ if (hasValidConstructorSignature(constructor)) {
+ hasValidConstructor = true;
+ break;
}
}
+ if (!hasValidConstructor) {
+ badClasses.append(className).append(",");
+ }
}
assertWithMessage("All BasePreferenceController (and subclasses) constructor must either"