Skip to content
Snippets Groups Projects
  1. Jan 11, 2024
    • Nelson Li's avatar
      Remove unused Android.mk in NamespaceTest · a276b963
      Nelson Li authored
      After checking, the modules under these directories can not be built
      because the upper-level directories lack Android.mk.
      Even if these Android.mk are included, they cannot be tested correctly
      with atest.
      
      Bug: 319568429
      Test: N/A
      Change-Id: I797d2327e340fcd38cde03dd0f520ec756be5fc3
      a276b963
    • Nelson Li's avatar
      Remove unused Android.mk in MergeOnlyTest · a8bb9e40
      Nelson Li authored
      After checking, the modules under these directories can not be built
      because the upper-level directories lack Android.mk.
      In addition, the format of the Android.mk in these directories is also
      incorrect, and if it is included, it will cause the build to break.
      
      Bug: 319565408
      Test: N/A
      Change-Id: I1a7b2fc2ad78bcbcd6cd3f65c0a5043656711dae
      a8bb9e40
  2. Jan 10, 2024
    • Mark Punzalan's avatar
      [aapt2] Allow multi-line argument files · 8c4d4ea3
      Mark Punzalan authored
      Previously, aapt2 would read arguments from files but they all have to
      be in one line, separated by spaces. Now they can be spread over
      multiple lines in the file.
      
      Bug: 297373084
      Bug: 315329624
      Test: Called `aapt2 link ... --feature_flags @args.txt` with args.txt
      containing flag values over multiple lines. Verified the resulting APK
      has the expected output.
      
      Change-Id: I91be6c7a869f63eafd88c04de69401d248f05545
      8c4d4ea3
  3. Jan 05, 2024
    • Mark Punzalan's avatar
      [aapt2] Use FeatureFlagsFilter in link command · 4b564ded
      Mark Punzalan authored
      The behavior of the filter depends on the minSdkVersion. If > UDC,
      manifest elements will be untouched. Otherwise, they will be removed
      depending on the value of the flag in the `android:featureFlag`
      attribute.
      
      Bug: 297373084
      Test: atest aapt2_tests
      Change-Id: Ib07c45752a4cc00bfdae7fedc745ce267ec7082a
      4b564ded
  4. Dec 15, 2023
    • Tor Norbye's avatar
      Update EnforcePermissionFix to set fix name · 9bb21bc2
      Tor Norbye authored
      Lint now forces you to explicitly set an explicit
      display name for composite quick fixes (it used to
      just default to the nested quickfix' display name,
      but this is sometimes misleading so now lint checks
      need to explicitly do this.)
      
      Test: SimpleManualPermissionEnforcementDetectorTest.kt
      Bug: Not filed
      Change-Id: Ie46d32833efc7bd9f7051acf6b45327d4fda7927
      9bb21bc2
  5. Dec 11, 2023
    • Cole Faust's avatar
      Add compile_data to AaptSymlinkTest · f30995fa
      Cole Faust authored
      A change is being made to how sandboxed actions work,
      and now the targets of symlinks need to be listed in
      the Android.bp file. Add them to compile_data.
      
      Bug: 307824623
      Test: m out/soong/.intermediates/frameworks/base/tools/aapt2/integration-tests/SymlinkTest/AaptSymlinkTest/android_common/lint/lint-baseline.xml
      Change-Id: I304a1e98045ba6ff19dc8052b2187d53c29e02bc
      f30995fa
    • Colin Cross's avatar
      Disable use_resource_processor for aapt2 integration tests · 1894f3ff
      Colin Cross authored
      These tests are testing aapt2 outputs and shouldn't use
      ResourceProcessorBusyBox.
      
      Bug: 294256649
      Test: m javac-check
      Change-Id: I28f093d697448131968ed4c4c32e31b9a8fb3036
      Merged-In: I28f093d697448131968ed4c4c32e31b9a8fb3036
      1894f3ff
  6. Dec 05, 2023
    • Yi Kong's avatar
      Fix -Wunused-variable compiler warning · d650788b
      Yi Kong authored
      frameworks/base/tools/aapt2/link/ManifestFixer.cpp:341:23: error: unused variable 'attr' [-Werror,-Wunused-variable]
        341 |   if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "glEsVersion")) {
            |                       ^~~~
      
      Test: presubmit
      Change-Id: Icec4737a5f8076173a2aff54532a79fa123df326
      d650788b
  7. Nov 14, 2023
    • Mark Punzalan's avatar
      [aapt2] Implement FeatureFlagsFilter · dcc00c4b
      Mark Punzalan authored
      FeatureFlagsFilter looks for `android:featureFlag` attributes in the XML
      and removes elements according to the given flag values.
      
      Bug: 297373084
      Test: atest aapt2_tests
      Change-Id: Icf97de2152c0c53b0b4518ae837e0d198873d1c5
      dcc00c4b
  8. Nov 10, 2023
    • Thiébaud Weksteen's avatar
      Add PermissionAnnotationDetector · 627faea6
      Thiébaud Weksteen authored
      This detector ensures that all AIDL-generated interfaces are annotated
      with one permission annotation (@EnforcePermission,
      @NoPermissionRequired, or @PermissionManuallyEnforced). It is part of
      the framework linters and disabled by default.
      
      It will be enabled explicitly in a subsequent change (for
      services/Android.bp). The baseline of the services will also be updated
      to capture the current status of non-annotated interfaces.
      
      Bug: 220214993
      Test: atest --host AndroidFrameworkLintCheckerTest
      Change-Id: I0fbd41b63465f119d90505153fa3a98c0fcdc798
      627faea6
  9. Nov 09, 2023
  10. Nov 08, 2023
    • Thiébaud Weksteen's avatar
      Ignore superMethods from non-Stub parents · eb133bf3
      Thiébaud Weksteen authored
      In commit 9252e5ce, the logic did not ensure that the super method
      belonged to the Stub class, and not any arbitrary method in a parent.
      
      Refactor EnforcePermissionUtils by:
       - Removing isContainedInSubclassOfStub() in favour of containingStub(),
         which returns the Stub PsiClass. Document that this method does not
         mean that the argument is necessary an AIDL-generated method.
       - Update getContainingAidlInterface() to pass the PsiClass to
         findSuperMethod. This ensures that only the Stub class and its
         parents are considered.
       - Drop the check for IINTERFACE_INTERFACE. This is already verified in
         the inner call to isStub().
      
      The same logic is applied manually to EnforcePermissionDetector, as each
      condition in getContainingAidlInterface() raises a different error
      message.
      
      Add a test to confirm the behaviour of EnforcePermissionDetector.
      
      Bug: 307433823
      Test: atest --host AndroidGlobalLintCheckerTest
      Test: atest --host AndroidFrameworkLintCheckerTest
      Test: enforce_permission_counter
      Change-Id: If791b6d8741e5db483589446484bb68061b67b70
      eb133bf3
  11. Nov 03, 2023
  12. Nov 01, 2023
  13. Oct 31, 2023
    • Thiébaud Weksteen's avatar
      Add test for mis-annotated method · 9252e5ce
      Thiébaud Weksteen authored
      Previously, if a method:
        1. was annotated with @EnforcePermission,
        2. belonged to a class which implements an AIDL interface,
        3. but did not override a method from that interface;
      an error was returned as the call to the helper was missing. The correct
      error for this case is that the method should not use the annotation.
      Update the detector and add a test for this case.
      
      Bug: 307433823
      Test: atest --host AndroidGlobalLintCheckerTest
      Change-Id: I04c68e95bc4932459b46982a7dd1814424ff6b46
      9252e5ce
    • Thiébaud Weksteen's avatar
      Enable related issues in EnforcePermissionDetectorTest · e7ad23ad
      Thiébaud Weksteen authored
      Enable ISSUE_ENFORCE_PERMISSION_HELPER and
      ISSUE_MISSING_ENFORCE_PERMISSION on EnforcePermissionDetectorTest.
      Update the Stub to avoid false negatives (and better reflect AIDL
      generated code). This is a no-op to confirm that issues do not
      negatively impact each other.
      
      Bug: 307433823
      Test: atest --host AndroidGlobalLintCheckerTest
      Change-Id: I9ab2b654932a6d228a2a646e5b1fa9c5fc16db02
      e7ad23ad
    • Azhara Assanova's avatar
      Allow short strings for manifest permissions in @EnforcePermission · 5b91f32b
      Azhara Assanova authored
      Short strings in this context are permission strings without the leading
      "android.permission.", e.g. a short string for
      "android.permission.MODIFY_AUDIO_ROUTING" is "MODIFY_AUDIO_ROUTING".
      
      Bug: 270686198
      Test: atest --host AndroidGlobalLintCheckerTest
      Change-Id: Ic01049613316b79123ce2300511efb5fd8143d4c
      Merged-In: Ic01049613316b79123ce2300511efb5fd8143d4c
      5b91f32b
  14. Oct 27, 2023
  15. Oct 26, 2023
    • Mark Punzalan's avatar
      [aapt2] Add placeholder --feature-flags flag · 297b85ef
      Mark Punzalan authored
      Adding a placeholder so that soong build integration can happen in
      parallel with the implementation of this flag.
      
      Bug: 297373084
      Bug: 306024510
      Test: m aapt2
      Change-Id: If9df57daaa871c11e146a8a8f8113fceb2fd96c2
      297b85ef
  16. Oct 11, 2023
    • Mark Punzalan's avatar
      [aapt2] Generate @FlaggedApi annotations · 636b6283
      Mark Punzalan authored
      Like we currently do for @TestApi and @SystemApi, we look for
      "@FlaggedApi" and its parameters in the comment above the resource.
      
      Bug: 295328308
      Test: Did the following:
      1. Ran `atest aapt2_tests`
      2. Ran `aapt2 link` on public-staging.xml with an added @FlaggedApi
         in the comment for the resource currently there. Verified the
         @FlaggedApi annotation is present in the generated R.java.
      3. Ran `m framework-minus-apex` and it built successfully.
      4. Modified the @FlaggedApi comment with an invalid value (e.g.,
         `Flags.FOO` which does not exist). The build failed. Since
         @FlaggedApi is a source-only annotation (i.e., not present in the
         R.class file), we want to verify it was actually used in the build.
      (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6fa7a3c7c5213ad3a94406f46fec6d1219b3fa43)
      Merged-In: I0739f888d40269915c0acea5650c386da1a1782e
      Change-Id: I0739f888d40269915c0acea5650c386da1a1782e
      636b6283
  17. Oct 06, 2023
  18. Oct 02, 2023
  19. Oct 01, 2023
    • Thiébaud Weksteen's avatar
      Add integration test for EnforcePermissionHelperDetector · 4c785fe1
      Thiébaud Weksteen authored
      This test ensures that the linter is correctly executed and reports an
      error. It uses the `lint.suppress_exit_code` to silence the error when
      building the test library (otherwise, this module would fail to build on
      a checkbuild).
      
      Bug: 302400088
      Test: atest --host AndroidGlobalLintCheckerIntegrationTest
      Change-Id: Ib9e9deec16f6b703139fb85337f4a826a99ec033
      4c785fe1
  20. Sep 27, 2023
    • Thiébaud Weksteen's avatar
      enforce_permission_counter: Find targets automatically · e09b6f3a
      Thiébaud Weksteen authored
      The target list of enforce_permission_counter can be reconstructed
      based on the dependencies of the "services" module. Add the ability to
      soong_lint_fix to collect and parse module_bp_java_deps.json which
      contains the dependency list.
      
      SoongLintFix is split into 2 classes: SoongWrapper and SoongLintFix. The
      former is used as a general wrapper to invoke Soong and parse the module
      files. The latter, a subclass of SoongWrapper, contains the calls to the
      different steps.
      
      The building and loading of module-info.json and
      module_bp_java_deps.json is now done dynamically whenever required.
      
      Bug: 298285238
      Test: enforce_permission_counter
      Test: lint_fix --no-fix --check AnnotatedAidlCounter --lint-module AndroidUtilsLintChecker services.autofill
      Change-Id: I781e9cdf80feb4c4d480673e044d526c528f8412
      e09b6f3a
  21. Sep 22, 2023
    • Thiébaud Weksteen's avatar
      lint_fix: fix CLI arguments use · 03933438
      Thiébaud Weksteen authored
      Commit df4cd065 updated how command line arguments are parsed. However,
      sys.argv[0] should be ignored (as this is the name of the program).
      Remove the argument, so the default value (sys.argv[1:]) is used.
      
      Also, use the embedded_launcher so that the help renders
      as:
          usage: lint_fix [-h]
      instead of:
          usage: usage: __soong_entrypoint_redirector__.py [-h]
      
      Test: lint_fix --print --no-fix --check AnnotatedAidlCounter \
             --lint-module AndroidUtilsLintChecker services.autofill
      Change-Id: I00e3e3b70c9715e363d3448ae84bf9ff161f2306
      03933438
  22. Sep 19, 2023
    • Thiébaud Weksteen's avatar
      Add reporting tool for migration to @EnforcePermission · df4cd065
      Thiébaud Weksteen authored
      Add a tool "enforce_permission_counter" which leverages lint_fix and the
      AndroidUtilsLintChecker linter to report on the number of AIDL methods
      that have been migrated to use the @EnforcePermission annotation (or
      @RequiresNoPermission).
      
      Test: enforce_permission_counter
      Test: lint_fix --print --no-fix --check AnnotatedAidlCounter \
                     --lint-module AndroidUtilsLintChecker services.autofill
      Bug: 298285238
      Change-Id: I521ab5358476f63387674e17c601da3b63cbc1d8
      df4cd065
  23. Sep 14, 2023
  24. Sep 12, 2023
  25. Sep 08, 2023
  26. Sep 07, 2023
    • Thiébaud Weksteen's avatar
      Support multiple modules for lint_fix · 5c149e2d
      Thiébaud Weksteen authored
      Test: lint_fix --print --no-fix --check AnnotatedAidlCounter --lint-module AndroidUtilsLintChecker services.autofill services.usage
      Change-Id: I08f5aa3e74db8ff24544bbdd3edb0635a0d2fb52
      5c149e2d
    • Thiébaud Weksteen's avatar
      Add utility lint for metrics on @EnforcePermission · e2916513
      Thiébaud Weksteen authored
      Bug: 298285238
      Test: lint_fix --print --no-fix --check AnnotatedAidlCounter --lint-module AndroidUtilsLintChecker services.autofill
      Test: atest --host AndroidUtilsLintCheckerTest
      Change-Id: I7876e44cabc006de9b996f84477e15071cb95203
      e2916513
    • Ryan Prichard's avatar
      [RESTRICT AUTOMERGE] Fix std::unique_ptr error with incomplete CommonFeatureGroup · c3e32935
      Ryan Prichard authored
      After upgrading libc++, Clang fails to compile DumpManifest.cpp.
      
      prebuilts/clang/host/linux-x86/clang-r498229/include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of 'sizeof' to an incomplete type 'aapt::CommonFeatureGroup'
          static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
                        ^~~~~~~~~~~
      
      Fix the problem by deferring the instantiation of ~unique_ptr, by
      making the ManifestExtractor constructor out-of-line and moving it and
      the initialization of commonFeatureGroup_ to a point after
      CommonFeatureGroup has been defined.
      
      Bug: b/175635923
      Test: treehugger
      Change-Id: I9ab51f29724fded24773344aa36763ffeea02d00
      Merged-In: I9ab51f29724fded24773344aa36763ffeea02d00
      c3e32935
    • Ryan Prichard's avatar
      Fix std::unique_ptr error with incomplete CommonFeatureGroup · 9d637824
      Ryan Prichard authored
      After upgrading libc++, Clang fails to compile DumpManifest.cpp.
      
      prebuilts/clang/host/linux-x86/clang-r498229/include/c++/v1/__memory/unique_ptr.h:63:19: error: invalid application of 'sizeof' to an incomplete type 'aapt::CommonFeatureGroup'
          static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
                        ^~~~~~~~~~~
      
      Fix the problem by deferring the instantiation of ~unique_ptr, by
      making the ManifestExtractor constructor out-of-line and moving it and
      the initialization of commonFeatureGroup_ to a point after
      CommonFeatureGroup has been defined.
      
      Bug: b/175635923
      Test: treehugger
      (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:42d2e51bf78bec72031e5f7a70422851b302d1f4)
      Merged-In: I9ab51f29724fded24773344aa36763ffeea02d00
      Change-Id: I9ab51f29724fded24773344aa36763ffeea02d00
      9d637824
    • Thiébaud Weksteen's avatar
      Move AidlImplementationDetector from global to common · 96431b11
      Thiébaud Weksteen authored
      Bug: 298285238
      Test: m AndroidGlobalLintChecker
      Change-Id: I4e90a0452caaf69ec5da680b7955b16eb1387871
      96431b11
  27. Sep 05, 2023
  28. Sep 01, 2023
Loading