diff options
41 files changed, 366 insertions, 77 deletions
diff --git a/api/Android.bp b/api/Android.bp index 6aef5fff7c7d..4f14c3779a15 100644 --- a/api/Android.bp +++ b/api/Android.bp @@ -86,6 +86,7 @@ combined_apis { "framework-media", "framework-mediaprovider", "framework-ondevicepersonalization", + "framework-pdf", "framework-permission", "framework-permission-s", "framework-scheduling", diff --git a/api/ApiDocs.bp b/api/ApiDocs.bp index fbcaa52f9bb4..6461c00b1dcd 100644 --- a/api/ApiDocs.bp +++ b/api/ApiDocs.bp @@ -209,6 +209,7 @@ doc_defaults { custom_template: "droiddoc-templates-sdk", resourcesdir: "docs/html/reference/images/", resourcesoutdir: "reference/android/images/", + lint_baseline: "javadoc-lint-baseline", hdf: [ "dac true", "sdk.codename O", diff --git a/api/OWNERS b/api/OWNERS index bf6216c168e8..965093c9ab38 100644 --- a/api/OWNERS +++ b/api/OWNERS @@ -3,7 +3,10 @@ hansson@google.com # Modularization team file:platform/packages/modules/common:/OWNERS +# Soong plugin owned by Soong team. +per-file *.go,go.mod,go.work,go.work.sum = file:platform/build/soong:/OWNERS + per-file Android.bp = file:platform/build/soong:/OWNERS #{LAST_RESORT_SUGGESTION} # For metalava team to disable lint checks in platform -per-file Android.bp = aurimas@google.com,emberrose@google.com,sjgilbert@google.com +per-file Android.bp = aurimas@google.com,emberrose@google.com diff --git a/api/StubLibraries.bp b/api/StubLibraries.bp index 8b535926a8e7..180a41c68709 100644 --- a/api/StubLibraries.bp +++ b/api/StubLibraries.bp @@ -357,13 +357,15 @@ java_library { ], srcs: [":module-lib-api-stubs-docs-non-updatable"], libs: [ + // We cannot depend on all-modules-module-lib-stubs, because the module-lib stubs + // depend on this stub. We resolve dependencies on APIs in modules by depending + // on a prebuilt of the whole platform (sdk_system_current_android). + // That prebuilt does not include module-lib APIs, so use the prebuilt module-lib + // stubs for modules that export module-lib stubs that the non-updatable part + // depends on. "sdk_module-lib_current_framework-tethering", "sdk_module-lib_current_framework-connectivity-t", - "sdk_public_current_framework-bluetooth", - // NOTE: The below can be removed once the prebuilt stub contains bluetooth. "sdk_system_current_android", - // NOTE: The below can be removed once the prebuilt stub contains IKE. - "sdk_system_current_android.net.ipsec.ike", ], dist: { dir: "apistubs/android/module-lib", diff --git a/api/api.go b/api/api.go index 431d6d8d06ff..692d38fe21a2 100644 --- a/api/api.go +++ b/api/api.go @@ -114,6 +114,7 @@ type defaultsProps struct { } type Bazel_module struct { + Label *string Bp2build_available *bool } type bazelProperties struct { @@ -140,6 +141,8 @@ type MergedTxtDefinition struct { ModuleTag string // public, system, module-lib or system-server Scope string + // True if there is a bp2build definition for this module + Bp2buildDefined bool } func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { @@ -152,8 +155,10 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { if txt.Scope != "public" { filename = txt.Scope + "-" + filename } + moduleName := ctx.ModuleName() + "-" + filename + props := genruleProps{} - props.Name = proptools.StringPtr(ctx.ModuleName() + "-" + filename) + props.Name = proptools.StringPtr(moduleName) props.Tools = []string{"metalava"} props.Out = []string{filename} props.Cmd = proptools.StringPtr(metalavaCmd + "$(in) --out $(out)") @@ -171,7 +176,20 @@ func createMergedTxt(ctx android.LoadHookContext, txt MergedTxtDefinition) { }, } props.Visibility = []string{"//visibility:public"} - ctx.CreateModule(genrule.GenRuleFactory, &props, &bp2buildNotAvailable) + bazelProps := bazelProperties{ + &Bazel_module{ + Bp2build_available: proptools.BoolPtr(false), + }, + } + if txt.Bp2buildDefined { + moduleDir := ctx.ModuleDir() + if moduleDir == android.Bp2BuildTopLevel { + moduleDir = "" + } + label := fmt.Sprintf("//%s:%s", moduleDir, moduleName) + bazelProps.Label = &label + } + ctx.CreateModule(genrule.GenRuleFactory, &props, &bazelProps) } func createMergedAnnotationsFilegroups(ctx android.LoadHookContext, modules, system_server_modules []string) { @@ -301,38 +319,43 @@ func createMergedTxts(ctx android.LoadHookContext, bootclasspath, system_server_ tagSuffix := []string{".api.txt}", ".removed-api.txt}"} distFilename := []string{"android.txt", "android-removed.txt"} + bp2BuildDefined := []bool{true, false} for i, f := range []string{"current.txt", "removed.txt"} { textFiles = append(textFiles, MergedTxtDefinition{ - TxtFilename: f, - DistFilename: distFilename[i], - BaseTxt: ":non-updatable-" + f, - Modules: bootclasspath, - ModuleTag: "{.public" + tagSuffix[i], - Scope: "public", + TxtFilename: f, + DistFilename: distFilename[i], + BaseTxt: ":non-updatable-" + f, + Modules: bootclasspath, + ModuleTag: "{.public" + tagSuffix[i], + Scope: "public", + Bp2buildDefined: bp2BuildDefined[i], }) textFiles = append(textFiles, MergedTxtDefinition{ - TxtFilename: f, - DistFilename: distFilename[i], - BaseTxt: ":non-updatable-system-" + f, - Modules: bootclasspath, - ModuleTag: "{.system" + tagSuffix[i], - Scope: "system", + TxtFilename: f, + DistFilename: distFilename[i], + BaseTxt: ":non-updatable-system-" + f, + Modules: bootclasspath, + ModuleTag: "{.system" + tagSuffix[i], + Scope: "system", + Bp2buildDefined: bp2BuildDefined[i], }) textFiles = append(textFiles, MergedTxtDefinition{ - TxtFilename: f, - DistFilename: distFilename[i], - BaseTxt: ":non-updatable-module-lib-" + f, - Modules: bootclasspath, - ModuleTag: "{.module-lib" + tagSuffix[i], - Scope: "module-lib", + TxtFilename: f, + DistFilename: distFilename[i], + BaseTxt: ":non-updatable-module-lib-" + f, + Modules: bootclasspath, + ModuleTag: "{.module-lib" + tagSuffix[i], + Scope: "module-lib", + Bp2buildDefined: bp2BuildDefined[i], }) textFiles = append(textFiles, MergedTxtDefinition{ - TxtFilename: f, - DistFilename: distFilename[i], - BaseTxt: ":non-updatable-system-server-" + f, - Modules: system_server_classpath, - ModuleTag: "{.system-server" + tagSuffix[i], - Scope: "system-server", + TxtFilename: f, + DistFilename: distFilename[i], + BaseTxt: ":non-updatable-system-server-" + f, + Modules: system_server_classpath, + ModuleTag: "{.system-server" + tagSuffix[i], + Scope: "system-server", + Bp2buildDefined: bp2BuildDefined[i], }) } for _, txt := range textFiles { diff --git a/api/api_test.go b/api/api_test.go index 1f4c2af32493..70f2162348ad 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -33,6 +33,8 @@ func runCombinedApisTestCase(t *testing.T, tc bp2build.Bp2buildTestCase) { t.Helper() runCombinedApisTestCaseWithRegistrationCtxFunc(t, tc, func(ctx android.RegistrationContext) { ctx.RegisterModuleType("java_defaults", java.DefaultsFactory) + ctx.RegisterModuleType("java_sdk_library", java.SdkLibraryFactory) + ctx.RegisterModuleType("filegroup", android.FileGroupFactory) }) } @@ -44,6 +46,33 @@ func TestCombinedApisGeneral(t *testing.T) { bootclasspath: ["bcp"], system_server_classpath: ["ssc"], } + +java_sdk_library { + name: "bcp", + srcs: ["a.java", "b.java"], + shared_library: false, +} +java_sdk_library { + name: "ssc", + srcs: ["a.java", "b.java"], + shared_library: false, +} +filegroup { + name: "non-updatable-current.txt", + srcs: ["current.txt"], +} +filegroup { + name: "non-updatable-system-current.txt", + srcs: ["system-current.txt"], +} +filegroup { + name: "non-updatable-module-lib-current.txt", + srcs: ["system-removed.txt"], +} +filegroup { + name: "non-updatable-system-server-current.txt", + srcs: ["system-lint-baseline.txt"], +} `, Filesystem: map[string]string{ "a/Android.bp": ` @@ -51,27 +80,35 @@ func TestCombinedApisGeneral(t *testing.T) { name: "android.jar_defaults", } `, + "api/current.txt": "", + "api/removed.txt": "", + "api/system-current.txt": "", + "api/system-removed.txt": "", + "api/test-current.txt": "", + "api/test-removed.txt": "", }, + StubbedBuildDefinitions: []string{"bcp", "ssc", "non-updatable-current.txt", "non-updatable-system-current.txt", "non-updatable-module-lib-current.txt", "non-updatable-system-server-current.txt"}, + ExpectedHandcraftedModules: []string{"foo-current.txt", "foo-system-current.txt", "foo-module-lib-current.txt", "foo-system-server-current.txt"}, ExpectedBazelTargets: []string{ bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-current.txt", bp2build.AttrNameToString{ "scope": `"public"`, - "base": `":non-updatable-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, + "base": `":non-updatable-current.txt"`, + "deps": `[":bcp"]`, }), bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-system-current.txt", bp2build.AttrNameToString{ "scope": `"system"`, - "base": `":non-updatable-system-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, + "base": `":non-updatable-system-current.txt"`, + "deps": `[":bcp"]`, }), bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-module-lib-current.txt", bp2build.AttrNameToString{ "scope": `"module-lib"`, - "base": `":non-updatable-module-lib-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":bcp__BP2BUILD__MISSING__DEP"]`, + "base": `":non-updatable-module-lib-current.txt"`, + "deps": `[":bcp"]`, }), bp2build.MakeBazelTargetNoRestrictions("merged_txts", "foo-system-server-current.txt", bp2build.AttrNameToString{ "scope": `"system-server"`, - "base": `":non-updatable-system-server-current.txt__BP2BUILD__MISSING__DEP"`, - "deps": `[":ssc__BP2BUILD__MISSING__DEP"]`, + "base": `":non-updatable-system-server-current.txt"`, + "deps": `[":ssc"]`, }), }, }) diff --git a/api/go.mod b/api/go.mod new file mode 100644 index 000000000000..f8bb1c01cd96 --- /dev/null +++ b/api/go.mod @@ -0,0 +1,12 @@ +module android/soong/aidl + +go 1.18 + +require ( + android/soong v0.0.0 + github.com/google/blueprint v0.0.0 + google.golang.org/protobuf v0.0.0 + prebuilts/bazel/common/proto/analysis_v2 v0.0.0 + prebuilts/bazel/common/proto/build v0.0.0 + go.starlark.net v0.0.0 +) diff --git a/api/go.work b/api/go.work new file mode 100644 index 000000000000..aa2d2b1cb461 --- /dev/null +++ b/api/go.work @@ -0,0 +1,19 @@ +go 1.18 + +use ( + . + ../../../build/soong + ../../../build/blueprint + ../../../external/go-cmp + ../../../external/golang-protobuf +) + +replace ( + android/soong v0.0.0 => ../../../build/soong + google.golang.org/protobuf v0.0.0 => ../../../external/golang-protobuf + github.com/google/blueprint v0.0.0 => ../../../build/blueprint + github.com/google/go-cmp v0.0.0 => ../../../external/go-cmp + prebuilts/bazel/common/proto/analysis_v2 v0.0.0 => ../../../prebuilts/bazel/common/proto/analysis_v2 + prebuilts/bazel/common/proto/build v0.0.0 => ../../../prebuilts/bazel/common/proto/build + go.starlark.net v0.0.0 => ../../../external/starlark-go +) diff --git a/api/go.work.sum b/api/go.work.sum new file mode 100644 index 000000000000..d00184fa2aa5 --- /dev/null +++ b/api/go.work.sum @@ -0,0 +1,66 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/api/javadoc-lint-baseline b/api/javadoc-lint-baseline new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/api/javadoc-lint-baseline diff --git a/boot/Android.bp b/boot/Android.bp index 851294cbb56f..6b90f10b511f 100644 --- a/boot/Android.bp +++ b/boot/Android.bp @@ -192,6 +192,13 @@ custom_platform_bootclasspath { ], } +genrule { // This module exists to make the srcjar output available to Make. + name: "platform-bootclasspath.srcjar", + srcs: [":platform-bootclasspath{.srcjar}"], + out: ["platform-bootclasspath.srcjar"], + cmd: "cp $(in) $(out)", +} + platform_systemserverclasspath { name: "platform-systemserverclasspath", } diff --git a/core/api/system-current.txt b/core/api/system-current.txt index eda6057cb85a..ebf5f5e499f0 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -3027,7 +3027,7 @@ package android.content { field public static final String ACTION_MANAGE_PERMISSION_APPS = "android.intent.action.MANAGE_PERMISSION_APPS"; field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_MANAGE_PERMISSION_USAGE = "android.intent.action.MANAGE_PERMISSION_USAGE"; field @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public static final String ACTION_MANAGE_SPECIAL_APP_ACCESSES = "android.intent.action.MANAGE_SPECIAL_APP_ACCESSES"; - field public static final String ACTION_MASTER_CLEAR_NOTIFICATION = "android.intent.action.MASTER_CLEAR_NOTIFICATION"; + field @RequiresPermission(android.Manifest.permission.MASTER_CLEAR) public static final String ACTION_MASTER_CLEAR_NOTIFICATION = "android.intent.action.MASTER_CLEAR_NOTIFICATION"; field public static final String ACTION_PACKAGE_NEEDS_INTEGRITY_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_INTEGRITY_VERIFICATION"; field public static final String ACTION_PACKAGE_UNSUSPENDED_MANUALLY = "android.intent.action.PACKAGE_UNSUSPENDED_MANUALLY"; field public static final String ACTION_PENDING_INCIDENT_REPORTS_CHANGED = "android.intent.action.PENDING_INCIDENT_REPORTS_CHANGED"; diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 4549c30b8c5d..2e3f1c01d306 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -4356,6 +4356,7 @@ public class Intent implements Parcelable, Cloneable { */ @SystemApi @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + @RequiresPermission(Manifest.permission.MASTER_CLEAR) public static final String ACTION_MASTER_CLEAR_NOTIFICATION = "android.intent.action.MASTER_CLEAR_NOTIFICATION"; diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java index a9eb672c4e4d..1307dfc2665e 100644 --- a/core/java/android/nfc/NfcAdapter.java +++ b/core/java/android/nfc/NfcAdapter.java @@ -484,7 +484,6 @@ public final class NfcAdapter { /** * A callback to be invoked when the system successfully delivers your {@link NdefMessage} * to another device. - * @see #setOnNdefPushCompleteCallback * @deprecated this feature is removed. File sharing can work using other technology like * Bluetooth. */ @@ -496,7 +495,6 @@ public final class NfcAdapter { * <p>This callback is usually made on a binder thread (not the UI thread). * * @param event {@link NfcEvent} with the {@link NfcEvent#nfcAdapter} field set - * @see #setNdefPushMessageCallback */ public void onNdefPushComplete(NfcEvent event); } @@ -504,11 +502,11 @@ public final class NfcAdapter { /** * A callback to be invoked when another NFC device capable of NDEF push (Android Beam) * is within range. - * <p>Implement this interface and pass it to {@link + * <p>Implement this interface and pass it to {@code * NfcAdapter#setNdefPushMessageCallback setNdefPushMessageCallback()} in order to create an * {@link NdefMessage} at the moment that another device is within range for NFC. Using this * callback allows you to create a message with data that might vary based on the - * content currently visible to the user. Alternatively, you can call {@link + * content currently visible to the user. Alternatively, you can call {@code * #setNdefPushMessage setNdefPushMessage()} if the {@link NdefMessage} always contains the * same data. * @deprecated this feature is removed. File sharing can work using other technology like diff --git a/core/java/android/nfc/TEST_MAPPING b/core/java/android/nfc/TEST_MAPPING index 71ad687b7889..5b5ea3790010 100644 --- a/core/java/android/nfc/TEST_MAPPING +++ b/core/java/android/nfc/TEST_MAPPING @@ -2,6 +2,9 @@ "presubmit": [ { "name": "NfcManagerTests" + }, + { + "name": "CtsNfcTestCases" } ] } diff --git a/core/java/android/service/controls/Control.java b/core/java/android/service/controls/Control.java index 3b757d6e3dd3..33978be9fb82 100644 --- a/core/java/android/service/controls/Control.java +++ b/core/java/android/service/controls/Control.java @@ -50,7 +50,7 @@ import java.lang.annotation.RetentionPolicy; * and zone. Some of these values are defined by the user and/or the {@link ControlsProviderService} * and will be used to display the control as well as group them for management. * <p> - * Each object will have an associated {@link DeviceTypes.DeviceType}. This will determine the icons and colors + * Each object will have an associated {@link DeviceTypes}. This will determine the icons and colors * used to display it. * <p> * An {@link Intent} linking to the provider Activity that expands on this {@link Control} and @@ -420,7 +420,7 @@ public final class Control implements Parcelable { * This fixes the values relating to state of the {@link Control} as required by * {@link ControlsProviderService#createPublisherForAllAvailable}: * <ul> - * <li> Status: {@link Status#STATUS_UNKNOWN} + * <li> Status: {@link #STATUS_UNKNOWN} * <li> Control template: {@link ControlTemplate#getNoTemplateObject} * <li> Status text: {@code ""} * <li> Auth Required: {@code true} @@ -620,7 +620,7 @@ public final class Control implements Parcelable { * <li> Device type: {@link DeviceTypes#TYPE_UNKNOWN} * <li> Title: {@code ""} * <li> Subtitle: {@code ""} - * <li> Status: {@link Status#STATUS_UNKNOWN} + * <li> Status: {@link #STATUS_UNKNOWN} * <li> Control template: {@link ControlTemplate#getNoTemplateObject} * <li> Status text: {@code ""} * <li> Auth Required: {@code true} diff --git a/core/java/android/service/controls/ControlsProviderService.java b/core/java/android/service/controls/ControlsProviderService.java index ed247404c486..097abbb37827 100644 --- a/core/java/android/service/controls/ControlsProviderService.java +++ b/core/java/android/service/controls/ControlsProviderService.java @@ -158,7 +158,7 @@ public abstract class ControlsProviderService extends Service { * The user has interacted with a Control. The action is dictated by the type of * {@link ControlAction} that was sent. A response can be sent via * {@link Consumer#accept}, with the Integer argument being one of the provided - * {@link ControlAction.ResponseResult}. The Integer should indicate whether the action + * {@link ControlAction} response results. The Integer should indicate whether the action * was received successfully, or if additional prompts should be presented to * the user. Any visual control updates should be sent via the Publisher. diff --git a/core/java/android/service/controls/actions/ControlAction.java b/core/java/android/service/controls/actions/ControlAction.java index 10f526d6565c..4e382222547d 100644 --- a/core/java/android/service/controls/actions/ControlAction.java +++ b/core/java/android/service/controls/actions/ControlAction.java @@ -154,7 +154,7 @@ public abstract class ControlAction { public static final @ResponseResult int RESPONSE_CHALLENGE_PASSPHRASE = 5; /** - * The {@link ActionType} associated with this class. + * The action type associated with this class. */ public abstract @ActionType int getActionType(); diff --git a/core/java/android/service/controls/templates/ControlTemplate.java b/core/java/android/service/controls/templates/ControlTemplate.java index 3902d6af69e7..0dd950d596f6 100644 --- a/core/java/android/service/controls/templates/ControlTemplate.java +++ b/core/java/android/service/controls/templates/ControlTemplate.java @@ -137,7 +137,7 @@ public abstract class ControlTemplate { } /** - * The {@link TemplateType} associated with this class. + * The template type associated with this class. */ public abstract @TemplateType int getTemplateType(); diff --git a/core/java/android/service/watchdog/ExplicitHealthCheckService.java b/core/java/android/service/watchdog/ExplicitHealthCheckService.java index 49e00d6f6328..7befbfb0f370 100644 --- a/core/java/android/service/watchdog/ExplicitHealthCheckService.java +++ b/core/java/android/service/watchdog/ExplicitHealthCheckService.java @@ -151,7 +151,7 @@ public abstract class ExplicitHealthCheckService extends Service { */ @NonNull public abstract List<String> onGetRequestedPackages(); - private final Handler mHandler = new Handler(Looper.getMainLooper(), null, true); + private final Handler mHandler = Handler.createAsync(Looper.getMainLooper()); @Nullable private RemoteCallback mCallback; @Override diff --git a/core/java/android/view/textclassifier/TextClassifierEvent.java b/core/java/android/view/textclassifier/TextClassifierEvent.java index 195565c5bc09..33db6715c327 100644 --- a/core/java/android/view/textclassifier/TextClassifierEvent.java +++ b/core/java/android/view/textclassifier/TextClassifierEvent.java @@ -551,8 +551,8 @@ public abstract class TextClassifierEvent implements Parcelable { * Sets the entity types. e.g. {@link TextClassifier#TYPE_ADDRESS}. * <p> * Supported types: - * <p>See {@link TextClassifier.EntityType} - * <p>See {@link ConversationAction.ActionType} + * <p>See {@link TextClassifier} types + * <p>See {@link ConversationAction} types * <p>See {@link ULocale#toLanguageTag()} */ @NonNull diff --git a/core/java/android/view/translation/TranslationCapability.java b/core/java/android/view/translation/TranslationCapability.java index b7e13dda9ff6..52760f728205 100644 --- a/core/java/android/view/translation/TranslationCapability.java +++ b/core/java/android/view/translation/TranslationCapability.java @@ -207,7 +207,7 @@ public final class TranslationCapability implements Parcelable { /** * Translation flags for settings that are supported by the - * {@link android.service.translation.TranslationService} between the {@link TranslationSpec}s + * translation service between the {@link TranslationSpec}s * provided in this capability. */ @DataClass.Generated.Member diff --git a/core/java/android/view/translation/TranslationManager.java b/core/java/android/view/translation/TranslationManager.java index fbaf711ba67d..4e7223ead208 100644 --- a/core/java/android/view/translation/TranslationManager.java +++ b/core/java/android/view/translation/TranslationManager.java @@ -56,7 +56,7 @@ import java.util.function.Consumer; * translation framework. * * <p>The TranslationManager manages {@link Translator}s and help bridge client calls to - * the server {@link android.service.translation.TranslationService} </p> + * the server translation service </p> */ @SystemService(Context.TRANSLATION_MANAGER_SERVICE) public final class TranslationManager { diff --git a/core/java/android/view/translation/TranslationRequest.java b/core/java/android/view/translation/TranslationRequest.java index 027edc21389f..ff11ffad28f5 100644 --- a/core/java/android/view/translation/TranslationRequest.java +++ b/core/java/android/view/translation/TranslationRequest.java @@ -27,7 +27,7 @@ import java.util.Collections; import java.util.List; /** - * Translation request sent to the {@link android.service.translation.TranslationService} by the + * Translation request sent to the translation service by the * {@link android.view.translation.Translator} which contains the text to be translated. */ @DataClass(genToString = true, genHiddenConstDefs = true, genBuilder = true) diff --git a/core/java/android/view/translation/TranslationResponse.java b/core/java/android/view/translation/TranslationResponse.java index b77f2e282650..3362fc007ded 100644 --- a/core/java/android/view/translation/TranslationResponse.java +++ b/core/java/android/view/translation/TranslationResponse.java @@ -20,7 +20,6 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; -import android.service.translation.TranslationService; import android.util.SparseArray; import com.android.internal.util.DataClass; @@ -30,17 +29,17 @@ import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** - * Response from the {@link TranslationService}, which contains the translated result. + * Response from the translation service, which contains the translated result. */ @DataClass(genBuilder = true, genToString = true, genHiddenConstDefs = true) public final class TranslationResponse implements Parcelable { /** - * The {@link TranslationService} was successful in translating. + * The translation service was successful in translating. */ public static final int TRANSLATION_STATUS_SUCCESS = 0; /** - * The {@link TranslationService} returned unknown translation result. + * The translation service returned unknown translation result. */ public static final int TRANSLATION_STATUS_UNKNOWN_ERROR = 1; /** diff --git a/core/java/android/view/translation/TranslationResponseValue.java b/core/java/android/view/translation/TranslationResponseValue.java index 9dff2d56322b..18a240daffa8 100644 --- a/core/java/android/view/translation/TranslationResponseValue.java +++ b/core/java/android/view/translation/TranslationResponseValue.java @@ -27,7 +27,7 @@ import com.android.internal.util.DataClass; import java.util.Objects; /** - * A translated response value from {@link android.service.translation.TranslationService}. + * A translated response value from translation service. */ @DataClass(genBuilder = true, genToString = true, genEqualsHashCode = true, genHiddenConstDefs = true) diff --git a/core/java/android/view/translation/ViewTranslationRequest.java b/core/java/android/view/translation/ViewTranslationRequest.java index a41749a2bc50..54b8ac2102c6 100644 --- a/core/java/android/view/translation/ViewTranslationRequest.java +++ b/core/java/android/view/translation/ViewTranslationRequest.java @@ -33,7 +33,7 @@ import java.util.Set; /** * Wrapper class representing a translation request associated with a {@link android.view.View} to - * be used by {@link android.service.translation.TranslationService}. + * be used by translation service. */ @DataClass(genBuilder = false, genToString = true, genEqualsHashCode = true, genGetters = false, genHiddenConstructor = true, genHiddenConstDefs = true) diff --git a/core/java/android/view/translation/ViewTranslationResponse.java b/core/java/android/view/translation/ViewTranslationResponse.java index d993114dba0a..134ff5a6b2c3 100644 --- a/core/java/android/view/translation/ViewTranslationResponse.java +++ b/core/java/android/view/translation/ViewTranslationResponse.java @@ -33,7 +33,7 @@ import java.util.Set; /** * Wrapper class representing a translation response associated with a {@link android.view.View} to - * be used by {@link android.service.translation.TranslationService}. + * be used by translation service. */ @DataClass(genBuilder = true, genToString = true, genEqualsHashCode = true, genGetters = false) public final class ViewTranslationResponse implements Parcelable { diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 6cb48db10590..1e77b92ac901 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1393,6 +1393,11 @@ <!-- Is the lock-screen disabled for new users by default --> <bool name="config_disableLockscreenByDefault">false</bool> + <!-- Provides default value for double line clock in lock screen setting: + 0 - Don't show double line clock + 1 - Show double line clock in lock screen (default) --> + <integer name="config_doublelineClockDefault">1</integer> + <!-- If true, enables verification of the lockscreen credential in the factory reset protection flow. This should be true if gatekeeper / weaver credentials can still be checked after a factory reset. --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 0cb8062f81a8..0ea342de052a 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2376,6 +2376,9 @@ <java-symbol type="dimen" name="popup_enter_animation_from_y_delta" /> <java-symbol type="dimen" name="popup_exit_animation_to_y_delta" /> + <!-- For double line clock in lock screen --> + <java-symbol type="integer" name="config_doublelineClockDefault"/> + <!-- ImfTest --> <java-symbol type="layout" name="auto_complete_list" /> diff --git a/libs/hwui/OWNERS b/libs/hwui/OWNERS index 6ca991d8b294..bc174599a4d3 100644 --- a/libs/hwui/OWNERS +++ b/libs/hwui/OWNERS @@ -4,9 +4,8 @@ alecmouri@google.com djsollen@google.com jreck@google.com njawad@google.com -reed@google.com scroggo@google.com -stani@google.com +sumir@google.com # For text, e.g. Typeface, Font, Minikin, etc. nona@google.com diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index ba217804c96e..bf98717ff373 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -470,7 +470,8 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS private void updateDoubleLineClock() { mCanShowDoubleLineClock = mSecureSettings.getIntForUser( - Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, 1, + Settings.Secure.LOCKSCREEN_USE_DOUBLE_LINE_CLOCK, mView.getResources() + .getInteger(com.android.internal.R.integer.config_doublelineClockDefault), UserHandle.USER_CURRENT) != 0; if (!mCanShowDoubleLineClock) { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java index b15ac39dc57d..82d3994d6c35 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java @@ -149,6 +149,9 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase { when(mResources.getDimensionPixelSize(R.dimen.keyguard_large_clock_top_margin)) .thenReturn(-200); + when(mResources.getInteger(com.android.internal.R.integer.config_doublelineClockDefault)) + .thenReturn(1); + when(mView.findViewById(R.id.lockscreen_clock_view_large)).thenReturn(mLargeClockFrame); when(mView.findViewById(R.id.lockscreen_clock_view)).thenReturn(mSmallClockFrame); when(mSmallClockView.getContext()).thenReturn(getContext()); @@ -309,6 +312,7 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase { // When a settings change has occurred to the small clock, make sure the view is adjusted reset(mView); + when(mView.getResources()).thenReturn(mResources); observer.onChange(true); mExecutor.runAllReady(); verify(mView).switchToClock(KeyguardClockSwitch.SMALL, /* animate */ true); diff --git a/services/companion/OWNERS b/services/companion/OWNERS index 734d8b6c5f43..dcf2377b4be1 100644 --- a/services/companion/OWNERS +++ b/services/companion/OWNERS @@ -1 +1,3 @@ -include /core/java/android/companion/OWNERS
\ No newline at end of file +include /core/java/android/companion/OWNERS + +per-file Android.bp,lint-baseline.xml,OWNERS=file:java/com/android/server/companion/virtual/OWNERS
\ No newline at end of file diff --git a/services/core/java/com/android/server/ExplicitHealthCheckController.java b/services/core/java/com/android/server/ExplicitHealthCheckController.java index 77059d918052..81db70ade63b 100644 --- a/services/core/java/com/android/server/ExplicitHealthCheckController.java +++ b/services/core/java/com/android/server/ExplicitHealthCheckController.java @@ -343,7 +343,7 @@ class ExplicitHealthCheckController { }; mContext.bindServiceAsUser(intent, mConnection, - Context.BIND_AUTO_CREATE, UserHandle.of(UserHandle.USER_SYSTEM)); + Context.BIND_AUTO_CREATE, UserHandle.SYSTEM); Slog.i(TAG, "Explicit health check service is bound"); } } diff --git a/services/core/java/com/android/server/OWNERS b/services/core/java/com/android/server/OWNERS index 55130e4cbbe6..987507fe7f03 100644 --- a/services/core/java/com/android/server/OWNERS +++ b/services/core/java/com/android/server/OWNERS @@ -16,9 +16,6 @@ per-file UserspaceRebootLogger.java = ioffe@google.com, dvander@google.com # ServiceWatcher per-file ServiceWatcher.java = sooniln@google.com -# Health -per-file BatteryService.java = file:platform/hardware/interfaces:/health/aidl/OWNERS - per-file *Accessibility* = file:/services/accessibility/OWNERS per-file *Alarm* = file:/apex/jobscheduler/OWNERS per-file *AppOp* = file:/core/java/android/permission/OWNERS @@ -39,7 +36,7 @@ per-file MmsServiceBroker.java = file:/telephony/OWNERS per-file NetIdManager.java = file:/services/core/java/com/android/server/net/OWNERS per-file PackageWatchdog.java, RescueParty.java = file:/services/core/java/com/android/server/rollback/OWNERS per-file PinnerService.java = file:/apct-tests/perftests/OWNERS -per-file RescueParty.java = fdunlap@google.com, shuc@google.com, ancr@google.com, harshitmahajan@google.com +per-file RescueParty.java = shuc@google.com, ancr@google.com, harshitmahajan@google.com per-file SystemClockTime.java = file:/services/core/java/com/android/server/timedetector/OWNERS per-file SystemTimeZone.java = file:/services/core/java/com/android/server/timezonedetector/OWNERS per-file TelephonyRegistry.java = file:/telephony/OWNERS diff --git a/services/core/java/com/android/server/RescueParty.java b/services/core/java/com/android/server/RescueParty.java index c1c9fbb121a8..97f65dd736c2 100644 --- a/services/core/java/com/android/server/RescueParty.java +++ b/services/core/java/com/android/server/RescueParty.java @@ -500,7 +500,8 @@ public class RescueParty { Exception res = null; final ContentResolver resolver = context.getContentResolver(); try { - Settings.Global.resetToDefaultsAsUser(resolver, null, mode, UserHandle.USER_SYSTEM); + Settings.Global.resetToDefaultsAsUser(resolver, null, mode, + UserHandle.SYSTEM.getIdentifier()); } catch (Exception e) { res = new RuntimeException("Failed to reset global settings", e); } @@ -741,12 +742,13 @@ public class RescueParty { } private static int[] getAllUserIds() { - int[] userIds = { UserHandle.USER_SYSTEM }; + int systemUserId = UserHandle.SYSTEM.getIdentifier(); + int[] userIds = { systemUserId }; try { for (File file : FileUtils.listFilesOrEmpty(Environment.getDataSystemDeDirectory())) { try { final int userId = Integer.parseInt(file.getName()); - if (userId != UserHandle.USER_SYSTEM) { + if (userId != systemUserId) { userIds = ArrayUtils.appendInt(userIds, userId); } } catch (NumberFormatException ignored) { diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index bce31734d064..3ed4df779dad 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -276,8 +276,8 @@ public final class ProcessList { // don't have an oom adj assigned by the system). public static final int NATIVE_ADJ = -1000; - // Memory pages are 4K. - static final int PAGE_SIZE = 4 * 1024; + // Memory page size. + static final int PAGE_SIZE = (int) Os.sysconf(OsConstants._SC_PAGESIZE); // Activity manager's version of Process.THREAD_GROUP_BACKGROUND static final int SCHED_GROUP_BACKGROUND = 0; diff --git a/tools/lint/global/integration_tests/Android.bp b/tools/lint/global/integration_tests/Android.bp new file mode 100644 index 000000000000..ca96559ac016 --- /dev/null +++ b/tools/lint/global/integration_tests/Android.bp @@ -0,0 +1,40 @@ +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +java_library { + name: "AndroidGlobalLintTestNoAidl", + srcs: ["TestNoAidl/**/*.java"], + libs: [ + "framework-annotations-lib", + ], + lint: { + // It is expected that lint returns an error when processing this + // library. Silence it here, the lint output is verified in tests.py. + suppress_exit_code: true, + }, +} + +python_test_host { + name: "AndroidGlobalLintCheckerIntegrationTest", + srcs: ["tests.py"], + main: "tests.py", + data: [ + ":AndroidGlobalLintTestNoAidl{.lint}", + ], + version: { + py3: { + embedded_launcher: true, + }, + }, +} diff --git a/tools/lint/global/integration_tests/TestNoAidl/TestNoAidl.java b/tools/lint/global/integration_tests/TestNoAidl/TestNoAidl.java new file mode 100644 index 000000000000..0015f958a78e --- /dev/null +++ b/tools/lint/global/integration_tests/TestNoAidl/TestNoAidl.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.android.lint.integration_tests; + +import android.annotation.EnforcePermission; + +/** + * A class that use the annotation but does not rely on AIDL. + */ +class TestNoAidl { + + @EnforcePermission("INTERNET") + void myMethod() { + } + +} diff --git a/tools/lint/global/integration_tests/tests.py b/tools/lint/global/integration_tests/tests.py new file mode 100644 index 000000000000..fc3eeb4f8ed9 --- /dev/null +++ b/tools/lint/global/integration_tests/tests.py @@ -0,0 +1,34 @@ +# Copyright 2023 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pkgutil +import unittest +import xml.etree.ElementTree + +class TestLinterReports(unittest.TestCase): + """Integration tests for the linters used by @EnforcePermission.""" + + def test_no_aidl(self): + report = pkgutil.get_data("lint", "lint-report.xml").decode() + issues = xml.etree.ElementTree.fromstring(report) + self.assertEqual(issues.tag, "issues") + self.assertEqual(len(issues), 1) + + issue = issues[0] + self.assertEqual(issue.attrib["id"], "MisusingEnforcePermissionAnnotation") + self.assertEqual(issue.attrib["severity"], "Error") + + +if __name__ == '__main__': + unittest.main(verbosity=2) |