Merge "Revert "Allow modules to override --error-when-new UnflaggedApi"" into main am: 2075155076

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3247908

Change-Id: I697bdf0d2391b838d7a59a6db409b7baa7196871
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 6bcdf85..137ec92 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -970,14 +970,10 @@
 		d.apiLintReport = android.PathForModuleOut(ctx, Everything.String(), "api_lint_report.txt")
 		cmd.FlagWithOutput("--report-even-if-suppressed ", d.apiLintReport) // TODO:  Change to ":api-lint"
 
-		// If UnflaggedApi issues have not already been configured then make sure that existing
-		// UnflaggedApi issues are reported as warnings but issues in new/changed code are treated as
-		// errors by the Build Warnings Aye Aye Analyzer in Gerrit.
+		// Make sure that existing UnflaggedApi issues are reported as warnings but issues in
+		// new/changed code are treated as errors by the Build Warnings Aye Aye Analyzer in Gerrit.
 		// Once existing issues have been fixed this will be changed to error.
-		// TODO(b/362771529): Switch to --error
-		if !strings.Contains(cmd.String(), " UnflaggedApi ") {
-			cmd.Flag("--error-when-new UnflaggedApi")
-		}
+		cmd.Flag("--error-when-new UnflaggedApi")
 
 		// TODO(b/154317059): Clean up this allowlist by baselining and/or checking in last-released.
 		if d.Name() != "android.car-system-stubs-docs" &&