Exclude ndk stubs from notice file list

There are many references to ndk stub libraries in the third party
notices:

out/soong/ndk/platforms/android-10/arch-arm/usr/lib/libc.so
out/soong/ndk/platforms/android-10/arch-arm/usr/lib/liblog.so
...

These are just stub libraries, and aren't distributed on the device. The
real versions of these libraries will be distributed on the device, and
already have the license information.

So let Soong set LOCAL_NO_NOTICE_FILE to prevent these from appearing.

Bug: 36867708
Test: Diff aosp_arm's system/etc/NOTICE.html.gz file before/after
Change-Id: Ifa3693bde7d3b6b9dc7a83122f9cfa24997fac50
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 72c451c..257f3f9 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -156,6 +156,7 @@
 LOCAL_NO_FPIE :=
 LOCAL_NO_LIBCOMPILER_RT:=
 LOCAL_NO_LIBGCC:=
+LOCAL_NO_NOTICE_FILE:=
 LOCAL_NO_PIC:=
 LOCAL_NOSANITIZE:=
 LOCAL_NO_STANDARD_LIBRARIES:=
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 447e59b..f850fff 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -14,6 +14,14 @@
   notice_file :=
 endif
 
+# Soong generates stub libraries that don't need NOTICE files
+ifdef LOCAL_NO_NOTICE_FILE
+  ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+    $(call pretty-error,LOCAL_NO_NOTICE_FILE should not be used by Android.mk files)
+  endif
+  notice_file :=
+endif
+
 ifeq ($(LOCAL_MODULE_CLASS),NOTICE_FILES)
 # If this is a NOTICE-only module, we don't include base_rule.mk,
 # so my_prefix is not set at this point.