Loading android/api_levels.go +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ func getApiLevelsMap(config Config) map[string]int { "O": 26, "O-MR1": 27, "P": 28, "Q": 29, } for i, codename := range config.PlatformVersionCombinedCodenames() { apiLevelsMap[codename] = baseApiLevel + i Loading android/neverallow.go +10 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ func init() { AddNeverAllowRules(createIncludeDirsRules()...) AddNeverAllowRules(createTrebleRules()...) AddNeverAllowRules(createLibcoreRules()...) AddNeverAllowRules(createMediaRules()...) AddNeverAllowRules(createJavaDeviceForHostRules()...) } Loading Loading @@ -110,7 +111,7 @@ func createTrebleRules() []Rule { // TODO(b/67974785): always enforce the manifest NeverAllow(). Without("name", "libhidltransport"). Without("name", "libhidltransport-impl-internal"). With("product_variables.enforce_vintf_manifest.cflags", "*"). Because("manifest enforcement should be independent of ."), Loading Loading @@ -151,6 +152,14 @@ func createLibcoreRules() []Rule { return rules } func createMediaRules() []Rule { return []Rule{ NeverAllow(). With("libs", "updatable-media"). Because("updatable-media includes private APIs. Use updatable_media_stubs instead."), } } func createJavaDeviceForHostRules() []Rule { javaDeviceForHostProjectsWhitelist := []string{ "external/guava", Loading android/neverallow_test.go +13 −14 Original line number Diff line number Diff line Loading @@ -157,20 +157,6 @@ var neverallowTests = []struct { "manifest enforcement should be independent", }, }, { name: "libhidltransport enforce_vintf_manifest.cflags", fs: map[string][]byte{ "Blueprints": []byte(` cc_library { name: "libhidltransport", product_variables: { enforce_vintf_manifest: { cflags: ["-DSHOULD_NOT_EXIST"], }, }, }`), }, }, { name: "no treble_linker_namespaces.cflags", Loading Loading @@ -203,6 +189,19 @@ var neverallowTests = []struct { }`), }, }, { name: "dependency on updatable-media", fs: map[string][]byte{ "Blueprints": []byte(` java_library { name: "needs_updatable_media", libs: ["updatable-media"], }`), }, expectedErrors: []string{ "updatable-media includes private APIs. Use updatable_media_stubs instead.", }, }, { name: "java_device_for_host", fs: map[string][]byte{ Loading cc/config/clang.go +5 −9 Original line number Diff line number Diff line Loading @@ -101,9 +101,8 @@ func init() { // not emit the table by default on Android since NDK still uses GNU binutils. "-faddrsig", // Make implicit fallthrough an error in the future. // -Wimplicit-fallthrough is not enabled by -Wall. "-Wimplicit-fallthrough", "-Wno-error=implicit-fallthrough", // Help catch common 32/64-bit errors. "-Werror=int-conversion", Loading Loading @@ -169,11 +168,6 @@ func init() { "-Wno-tautological-constant-compare", "-Wno-tautological-type-limit-compare", // http://b/72330874 Disable -Wenum-compare until the instances detected by this new // warning are fixed. "-Wno-enum-compare", "-Wno-enum-compare-switch", // Disable c++98-specific warning since Android is not concerned with C++98 // compatibility. "-Wno-c++98-compat-extra-semi", Loading @@ -182,9 +176,11 @@ func init() { "-Wno-return-std-move-in-c++11", }, " ")) // Extra cflags for projects under external/ directory // Extra cflags for projects under external/ directory to disable warnings that are infeasible // to fix in all the external projects and their upstream repos. pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{ // TODO(yikong): Move -Wno flags here "-Wno-enum-compare", "-Wno-enum-compare-switch", // http://b/72331524 Allow null pointer arithmetic until the instances detected by // this new warning are fixed. Loading cc/sanitize.go +2 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,8 @@ var ( minimalRuntimeFlags = []string{"-fsanitize-minimal-runtime", "-fno-sanitize-trap=integer,undefined", "-fno-sanitize-recover=integer,undefined"} hwasanGlobalOptions = []string{"heap_history_size=1023,stack_history_size=512"} hwasanGlobalOptions = []string{"heap_history_size=1023", "stack_history_size=512", "export_memory_stats=0", "max_malloc_fill_size=0"} ) type sanitizerType int Loading Loading
android/api_levels.go +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ func getApiLevelsMap(config Config) map[string]int { "O": 26, "O-MR1": 27, "P": 28, "Q": 29, } for i, codename := range config.PlatformVersionCombinedCodenames() { apiLevelsMap[codename] = baseApiLevel + i Loading
android/neverallow.go +10 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ func init() { AddNeverAllowRules(createIncludeDirsRules()...) AddNeverAllowRules(createTrebleRules()...) AddNeverAllowRules(createLibcoreRules()...) AddNeverAllowRules(createMediaRules()...) AddNeverAllowRules(createJavaDeviceForHostRules()...) } Loading Loading @@ -110,7 +111,7 @@ func createTrebleRules() []Rule { // TODO(b/67974785): always enforce the manifest NeverAllow(). Without("name", "libhidltransport"). Without("name", "libhidltransport-impl-internal"). With("product_variables.enforce_vintf_manifest.cflags", "*"). Because("manifest enforcement should be independent of ."), Loading Loading @@ -151,6 +152,14 @@ func createLibcoreRules() []Rule { return rules } func createMediaRules() []Rule { return []Rule{ NeverAllow(). With("libs", "updatable-media"). Because("updatable-media includes private APIs. Use updatable_media_stubs instead."), } } func createJavaDeviceForHostRules() []Rule { javaDeviceForHostProjectsWhitelist := []string{ "external/guava", Loading
android/neverallow_test.go +13 −14 Original line number Diff line number Diff line Loading @@ -157,20 +157,6 @@ var neverallowTests = []struct { "manifest enforcement should be independent", }, }, { name: "libhidltransport enforce_vintf_manifest.cflags", fs: map[string][]byte{ "Blueprints": []byte(` cc_library { name: "libhidltransport", product_variables: { enforce_vintf_manifest: { cflags: ["-DSHOULD_NOT_EXIST"], }, }, }`), }, }, { name: "no treble_linker_namespaces.cflags", Loading Loading @@ -203,6 +189,19 @@ var neverallowTests = []struct { }`), }, }, { name: "dependency on updatable-media", fs: map[string][]byte{ "Blueprints": []byte(` java_library { name: "needs_updatable_media", libs: ["updatable-media"], }`), }, expectedErrors: []string{ "updatable-media includes private APIs. Use updatable_media_stubs instead.", }, }, { name: "java_device_for_host", fs: map[string][]byte{ Loading
cc/config/clang.go +5 −9 Original line number Diff line number Diff line Loading @@ -101,9 +101,8 @@ func init() { // not emit the table by default on Android since NDK still uses GNU binutils. "-faddrsig", // Make implicit fallthrough an error in the future. // -Wimplicit-fallthrough is not enabled by -Wall. "-Wimplicit-fallthrough", "-Wno-error=implicit-fallthrough", // Help catch common 32/64-bit errors. "-Werror=int-conversion", Loading Loading @@ -169,11 +168,6 @@ func init() { "-Wno-tautological-constant-compare", "-Wno-tautological-type-limit-compare", // http://b/72330874 Disable -Wenum-compare until the instances detected by this new // warning are fixed. "-Wno-enum-compare", "-Wno-enum-compare-switch", // Disable c++98-specific warning since Android is not concerned with C++98 // compatibility. "-Wno-c++98-compat-extra-semi", Loading @@ -182,9 +176,11 @@ func init() { "-Wno-return-std-move-in-c++11", }, " ")) // Extra cflags for projects under external/ directory // Extra cflags for projects under external/ directory to disable warnings that are infeasible // to fix in all the external projects and their upstream repos. pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{ // TODO(yikong): Move -Wno flags here "-Wno-enum-compare", "-Wno-enum-compare-switch", // http://b/72331524 Allow null pointer arithmetic until the instances detected by // this new warning are fixed. Loading
cc/sanitize.go +2 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,8 @@ var ( minimalRuntimeFlags = []string{"-fsanitize-minimal-runtime", "-fno-sanitize-trap=integer,undefined", "-fno-sanitize-recover=integer,undefined"} hwasanGlobalOptions = []string{"heap_history_size=1023,stack_history_size=512"} hwasanGlobalOptions = []string{"heap_history_size=1023", "stack_history_size=512", "export_memory_stats=0", "max_malloc_fill_size=0"} ) type sanitizerType int Loading