Skip to content
Snippets Groups Projects
  1. Dec 12, 2023
    • Jeff Sharkey's avatar
      Support "probing" ignored tests; more Parcel impl. · 06e55aba
      Jeff Sharkey authored
      As test authors onboard their bivalent tests, they'll be using the
      `@IgnoreUnderRavenwood` annotation to quietly ignore tests that
      don't currently have enough Ravenwood support to run.
      
      However, over time the Ravenwood environment will continue to
      gain new functionality, and we'd like an easy way to "probe" those
      previously-ignored tests to see if any of them started passing.
      
      This change implements this using a locally-configured flag
      that unconditionally runs all tests under Ravenwood, and reports
      failures for any tests marked as `@IgnoreUnderRavenwood` that
      are now passing.  (As these "failures" might be confusing for normal
      test authors, we leave it disabled by default in the build, and
      leave it for internal Ravenwood maintainers.)
      
      To confirm this works, implement two new methods on Parcel, and
      detect the relevant tests that started passing.
      
      Bug: 292141694
      Test: atest CtsUtilTestCasesRavenwood CtsUtilTestCases
      Change-Id: Ied2a5e3d1781c76a4f3506192d015309f2f424b2
      06e55aba
  2. Dec 08, 2023
  3. Dec 07, 2023
    • Jeff Sharkey's avatar
      Ravenwood support for feature flags. · 9ac0521c
      Jeff Sharkey authored
      Since feature flags are becoming an important part of development
      work, ensure that Ravenwood tests can use existing tools such as
      `SetFlagsRule` to populate values for code-under-test to consume.
      
      To enable this, we extend `AndroidHeuristicsFilter` to recognize
      feature flags generated code, and include that in the Ravenwood
      environment by default.
      
      Bug: 311370221
      Test: atest FrameworksCoreTestsRavenwood FrameworksCoreTests
      Change-Id: I526af65f816d153cb6e365cf6810a5a304d3e6a6
      9ac0521c
  4. Dec 05, 2023
    • Jeff Sharkey's avatar
      Support more internal utils under Ravenwood. · 256d9070
      Jeff Sharkey authored
      Tests for these internal utils are local within the frameworks/base/
      repo, instead of in CTS.
      
      To help future-proof, bring the entire utils/* test directory by
      default into the Ravenwood suites, and give developers the way to
      easily opt-out with @IgnoreUnderRavenwood at the class level.
      
      Bug: 292141694
      Test: atest FrameworksCoreTestsRavenwood FrameworksCoreTests
      Test: atest FrameworksUtilTestsRavenwood FrameworksUtilTests
      Change-Id: I5251dca752396faa77774659d0923d8cdb719830
      256d9070
    • 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
  5. Dec 04, 2023
  6. Dec 01, 2023
    • Makoto Onuki's avatar
      HostStubGen: Make sure substitution methods have right visibility · 6b19707b
      Makoto Onuki authored
      Bug: 292141694
      Test: ./scripts/run-all-tests.sh
      Change-Id: I9b1db65d9c0cdac1012637d60a3bc6c3bbe3f5d6
      6b19707b
    • Makoto Onuki's avatar
      Update TEST_MAPPING for ravenwood · ededd7e6
      Makoto Onuki authored
      Bug: 292141694
      Test: Tree hugger
      Change-Id: Ica5cfff6bc209376ab39f665d48f992c143c49a2
      ededd7e6
    • Makoto Onuki's avatar
      HostStubGen: Inject more annotations in output jar · 0622dd1c
      Makoto Onuki authored
      Now we inject 5 annotations:
      HostStubGenKeptInImpl
      HostStubGenKeptInStub
      
      HostStubGenProcessedAsIgnore
      HostStubGenProcessedAsSubstitute
      HostStubGenProcessedAsThrow
      
      Bug: 311174191
      Test: ./scripts/run-all-tests.sh
      Change-Id: I9bf399bfdb789bc95be77fe51cd1579358e2dcee
      0622dd1c
    • Makoto Onuki's avatar
      HostStubGen: Fix direct outer class detection · 0e7dca65
      Makoto Onuki authored
      If there's a nested class like A$B$C and C doesn't have a class-wide
      policy, HSG was supposed to look at A$B's ("direct outer class") policy,
      but it was using A's policy. Fixed it.
      
      Bug: 311174191
      Test: ./scripts/run-all-tests.sh
      Test: atest --host CtsGraphicsTestCasesRavenwood \
          CtsTextTestCasesRavenwood \
          CtsOsTestCasesRavenwood \
          CtsAccountManagerTestCasesRavenwood \
          CtsContentTestCasesRavenwood \
          CtsProtoTestCasesRavenwood \
          CtsUtilTestCasesRavenwood \
          CtsDatabaseTestCasesRavenwood
      Change-Id: I4881caac5e91366cf60e1aa232ecaf6b7c88aecf
      0e7dca65
  7. Nov 30, 2023
  8. Nov 29, 2023
    • Makoto Onuki's avatar
      Clean up hoststubgen README files · 1a00caea
      Makoto Onuki authored
      Bug: 311174191
      Test: N/A
      Change-Id: Ief5c80d6a03c58830329c81a8c0350ff1955583e
      1a00caea
    • Jeff Sharkey's avatar
      Base support for `servicestests` under Ravenwood. · 784b36cc
      Jeff Sharkey authored
      As part of upcoming `servicestests` work, this change makes some
      general changes.
      
      We don't currently have Mainline stubs included in the Ravenwood
      runtime, so this change "hides" references in `PackageManagerInternal`
      and `ActivityManagerInternal` while keeping the clients working.
      
      Adds support for `Process.setCanSelfBackground()` to support
      ServiceThread.
      
      Adds support for `LocalServices`, along with a new hook to clear out
      any registered services between each Ravenwood test.
      
      Bug: 292141694
      Test: atest CtsUtilTestCasesRavenwood
      Change-Id: Iea3b4a5bf2ebebb34d56cfc76014fc07987cf355
      784b36cc
    • Jeff Sharkey's avatar
      `FileUtils` and `AtomicFile` under Ravenwood. · 299ea3e3
      Jeff Sharkey authored
      These are common utility classes used by framework code, so support
      them and their relevant tests.
      
      Since they depend on ErrnoException and IoUtils, bring over limited
      versions of those classes into `libcore-fake`, and compile them into
      the Ravenwood runtime using variant washing.
      
      Bug: 292141694
      Test: atest FrameworksCoreTestsRavenwood FrameworksUtilTestsRavenwood
      Change-Id: Ib44dedacfa4d12a7d697973caf070477ed07202d
      299ea3e3
    • Makoto Onuki's avatar
      HostStubGen: Write verbose/debug log to a file · 623cffb0
      Makoto Onuki authored
      See below for the log filename.
      
      Also disable an unimplemented flag.
      
      Bug: 311174191
      Test: ./scripts/run-all-tests.sh
      Test: m framework-minus-apex.ravenwood
          and examine console output and
          out/soong/.intermediates/frameworks/base/framework-minus-apex.ravenwood-base/android_common/gen/hoststubgen_framework-minus-apex.log
      Change-Id: I9997370c93e2fe90276d5f3e657d45d440ca0a59
      623cffb0
    • Jeremy Meyer's avatar
      Move some image/9patch code to androidfw · 32154d2c
      Jeremy Meyer authored
      Test: Automatic
      Bug: 296324826
      Change-Id: I06b8df4fd53304d6663e80879892a635168ab28b
      32154d2c
  9. Nov 28, 2023
    • Makoto Onuki's avatar
      HostStubGen: Fix minor bug · ac5636e6
      Makoto Onuki authored
      In some cases, filter classes need to use [outermostFilter]
      to refer to policies on other items.
      
      Bug: 292141694
      Test: run-all-tests.sh
      Change-Id: I6f2796fb44e7f70e9f64f77107b2046c3733e0e2
      ac5636e6
    • Makoto Onuki's avatar
      Keep all AIDL generated classes · 3b0c4f80
      Makoto Onuki authored
      Also fix the AIDL class detection.
      
      Test: m framework-minus-apex.ravenwood and make sure IAccountAthenticator
        and its nested classes are all kept.
      Test: ./run-all-tests.sh
      Change-Id: Idb870a6e7558f7303a2072afbede2a868204e2bf
      3b0c4f80
  10. Nov 22, 2023
  11. Nov 21, 2023
    • Makoto Onuki's avatar
      HostStubGen: Stub generation is now optional, etc · c8a04dca
      Makoto Onuki authored
      - Now both --out-stub-jar and --out-impl-jar are optional
      - Disable --enable-non-stub-method-check by default
        (it's not fully implemented anyway)
      - Delete the script `run-ravenwood-test` since now atest
        just works.
      
      Test: run-all-tests.sh
      Bug: 292141694
      Change-Id: I3b7d63600139425e5fffc12930ee860edf2acd7f
      c8a04dca
    • Jeff Sharkey's avatar
      Support Handler/Looper for Ravenwood, with CTS. · 1c7db6b9
      Jeff Sharkey authored
      Now that we have a solid foundation of classes available, one of the
      tricker pieces is supporting Handler/Looper under Ravenwood.  At its
      core, the native implementation of MessageQueue can be emulated using
      core JVM primitives, which is enough to reliably pass CTS.
      
      Advanced features like FileDescriptor events will need to wait until
      we eventually have real JNI support.
      
      Fix obscure bug with SystemClock; must be positive number.  Always
      start our "fake" pointers from 1 to prevent `nullptr` oddness.
      
      Bug: 292141694
      Test: atest-dev CtsOsTestCasesRavenwood CtsOsTestCases
      Change-Id: I0f82b659973443968ef2609a7e3151f381abff29
      1c7db6b9
  12. Nov 20, 2023
    • Jeff Sharkey's avatar
      More `android.util` internals, with tests. · ce9f0d06
      Jeff Sharkey authored
      Internal test authors are likely going to want to use internal
      utilities that aren't in the official API surface.  This change adds
      those to Ravenwood, along with local tests to confirm they work.
      
      Bug: 292141694
      Test: atest-dev FrameworksUtilTestsRavenwood
      Change-Id: I0f4df50416d153418d4525bd8ec5c4dbf04521a2
      ce9f0d06
  13. Nov 17, 2023
    • Makoto Onuki's avatar
      [HostStubGen] Support non-static methods... · 0c76c852
      Makoto Onuki authored
      ... with native substition classes.
      
      It turned out native methods can be non-static. Now we handle them in this way:
      - The substitution method still needs to be static.
      - And take the original 'this' as the first argument.
      
      The first argument type must match the source class.
      (e.g. the arg type can't be `Object`)
      
      Test: run-all-tests.sh
      Bug: 292141694
      Change-Id: I9a53e1c155e138e466589c1a7684dcc86601e9c8
      0c76c852
  14. Nov 15, 2023
    • Jeff Sharkey's avatar
      [1/?] Support android.content for Ravenwood. · 73067713
      Jeff Sharkey authored
      Initial pass at foundational classes under android.content, along
      with CTS to verify consistency.
      
      Methods that interface to broader parts of OS remain marked as
      "throw" for the moment, such as cross-process work and StrictMode.
      
      Bug: 292141694
      Test: atest-dev CtsOsTestCasesRavenwood CtsOsTestCases
      Test: atest-dev CtsContentTestCasesRavenwood CtsContentTestCases
      Change-Id: Ic3deafb1f4058fcc104882a3508728994669f7d2
      73067713
    • Jeff Sharkey's avatar
      PersistableBundle for Ravenwood, with CTS. · 4ee8a655
      Jeff Sharkey authored
      We have the XML interfaces from libcore, but the implementations
      there are tied closely to things like StringPool.  We thankfully
      have our own human-readable XML serializer that we could use, but
      there's unfortunately not a good pull parser.
      
      To get us unstuck for the moment, pivot the internals to
      unconditionally use the binary XML format, which at least we
      know is thoroughly tested, and any data written through this path
      can then also be parsed.
      
      This is enough to support PersistableBundle, and we'll circle back
      to get ourselves a human-readable XML implementation in the future.
      
      Bug: 292141694
      Test: atest-dev CtsOsTestCasesRavenwood CtsOsTestCases
      Change-Id: I875a3a2b0e95e52861afe187e2a5e9f1e740d8d5
      4ee8a655
  15. 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
  16. Nov 13, 2023
    • Jeff Sharkey's avatar
      Initial Process and Binder support, with CTS. · 5e210d7d
      Jeff Sharkey authored
      The Ravenwood environment doesn't support IPC, but much of the code
      that developers intend to test (such as AIDL stubs) still relies on
      baseline same-process behavior to be intact.
      
      This change adds UID and PID support to Process and Binder, but we
      carefully communicate that it's only available when the test author
      has configured it via a RavenwoodRule.  This ensures that tests
      don't accidentally rely on unexpected defaults, as some tests will
      want AID_SYSTEM, and others want a normal app UID.
      
      Also bring along SystemClock, PatternMatcher, and ParcelUuid
      along with relevant tests.
      
      Finally, now that we have an IgnoreUnderRavenwood annotation, we
      can pivot back our default failure to be a RuntimeException instead
      of an AssumptionViolatedException.
      
      Bug: 292141694
      Test: atest-dev CtsOsTestCasesRavenwood CtsOsTestCases
      Change-Id: I5f54c3179b2d305b9ab9144c43fd063c6b756e44
      5e210d7d
  17. Nov 10, 2023
    • Jeff Sharkey's avatar
      Start using Ravenwood annotations in source tree. · 55c2256e
      Jeff Sharkey authored
      These inline annotations make maintenance commitments easier for
      code owners to reason about.
      
      Bug: 292141694
      Test: atest-dev CtsUtilTestCasesRavenwood CtsUtilTestCases
      Change-Id: Ia3479c7fd66123e2cc759c661fc551967ecdec08
      55c2256e
    • Makoto Onuki's avatar
      [hoststubgen] Handle lambdas · cedc08b5
      Makoto Onuki authored
      For now, we inherit the visibility of the enclosing class.
      
      So there's now way to make them "throw" yet.
      
      Bug: 310212493
      Bug: 292141694
      Test: run-all-tests.sh
      Test: atest --no-bazel-mode CtsUtilTestCasesRavenwood
      Change-Id: I590e4e972a3b0812c0470c9872c02cf7293e83f6
      cedc08b5
    • Makoto Onuki's avatar
      Fix --annotation-allowed-classes-file, and start using it · 743a58aa
      Makoto Onuki authored
      Also add some presubmit tests as a smoke test.
      
      Bug: 292141694
      Test: run-all-tests.sh
      Test: atest --no-bazel-mode CtsUtilTestCasesRavenwood
      
      Change-Id: I30569313b764dfa30db9c2c5627050da4a6a1d67
      743a58aa
    • 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
  18. Nov 09, 2023
  19. Nov 08, 2023
    • Jeff Sharkey's avatar
      Support Parcel, Bundle under Ravenwood, with CTS. · 91f414e4
      Jeff Sharkey authored
      We have baseline implementations of the Parcel and Bundle, so we're
      ready to support them under the Ravenwood environment.  Brings along
      the relevant CTS to prove that it works consistently on both devices
      and Ravenwood.  Make a few test-driven bug fixes to Parcel code.
      
      Currently does not support FDs or Binders.
      
      Add new `@IgnoreUnderRavenwood` annotation that is respected by a
      new `RavenwoodRule`, letting the same test code be shared to run
      under both devices and Ravenwood.  Currently packaged under our own
      area of the tree, but named to match layout of `platform_testing`
      for future migration.
      
      Add "ThrowClass" policy.
      
      Bug: 292141694
      Test: atest-dev CtsOsTestCasesRavenwood CtsOsTestCases:ParcelTest CtsOsTestCases:BundleTest
      Change-Id: I88d19afff47fbea6557e922a10e8555ee0f70ba3
      91f414e4
    • 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
  20. Nov 07, 2023
    • Makoto Onuki's avatar
      [HostStubGen] Precise enum handling · 293328da
      Makoto Onuki authored
      Only implicitly include auto-generated enum members.
      
      Bug: 292141694
      Test: run-all-tests.sh
      Test: atest --no-bazel-mode CtsUtilTestCasesRavenwood
      Change-Id: Iab2f3ec28fb47293e342e09aee9a2596baa31800
      293328da
  21. Nov 06, 2023
    • Makoto Onuki's avatar
      [HostStubGen] Add --package-redirect · 8bb2b4a9
      Makoto Onuki authored
      Example:
      --package-redirect dalvik:com.android.hoststubgen.substitution.dalvik
      
      will rewrite all references to classes `dalvik.*` to `com....dalvik.*`.
      This allows us to define libcore substitution classes in a different package.
      This is useful becuase javac won't let us add classes to the `dalvic` package
      which is already taken by the libcore module.
      
      Bug: 292141694
      Test: run-all-tests.sh
      
      Change-Id: I01e72f4b4a7ce4baefaaccddbb462edd84267e0e
      8bb2b4a9
Loading