Skip to content
Snippets Groups Projects
  1. Mar 08, 2024
    • Wei Li's avatar
      Clean the license metadata on dependencies of module android.test.legacy · 4cf550d6
      Wei Li authored
      1) Moved the patched junit code in test-base and test-runner to a new directory test-junit which is under license CPL-1.0.
      2) Clean the license metadata on packages in test-base, test-mock, test-runner and test-junit so packages have their license metadata precisely.
      3) With this cleanup the Android.mk in test-legacy could be converted to Soong with license metadata handled properly, see b/319031379 and aosp/2900169.
      
      Bug: 328809280
      Test: CIs
      Change-Id: I2a5832a97b09a5c7d064b8c2adbc0b04a325f326
      4cf550d6
  2. Feb 13, 2024
  3. Jan 17, 2024
  4. Jan 16, 2024
    • Nikhil Kumar's avatar
      Remove getUserId mock method from Mock Context. · caa341ae
      Nikhil Kumar authored
      getUserId is a widely used context method and mocking it with an exception can cause many failures if not overridden with a valid value.
      
      Removed the getUserId() method from mock context to use actual invocation, Text classes can still override the method in the Test class implementation if it's needed for any specific case.
      
      Test: atest EabControllerTest -c
      Test: atest TelephonyProviderTest -c
      
      Bug: 319931444
      Bug: 319437162
      Bug: 320426061
      
      Change-Id: Ibf9a2efc22a3bdbc8403dfbc25be07485f4336b4
      caa341ae
  5. Nov 29, 2023
    • Jeff Sharkey's avatar
      Verify `android.test.mock` under Ravenwood. · de344710
      Jeff Sharkey authored
      Even though developers are encouraged to use Mockito, existing tests
      may still be using this old library for their mocking.
      
      We'll circle back later to consider support for components such as
      ContentProvider, Service, etc.
      
      Clean up OWNERS.
      
      Bug: 310268946
      Test: atest android.test.mock.ravenwood.tests
      Change-Id: Ie3f4ccea9cf6719d61cff277a627825868edc992
      de344710
  6. Nov 09, 2023
    • Jihoon Kang's avatar
      Add overriding method of a default method to signature files · ec4e94e1
      Jihoon Kang authored
      Currently, the signature file elides overrides of a default method,
      as they are not essential for the compilation of the stubs.
      However, in some scenarios, the overrides of a default method may be
      essential for the compilation of the reverse dependency of the stubs.
      In the scenario seen below:
      ```
      // API
      interface ApiInterface {
          public default void bar() {};
      }
      class ApiClass implements AnotherParentInterface{
          public void bar() {}
      }
      
      // App depending on the API
      interface AppInterface {
          public void bar();
      }
      public class AppClass extends ApiClass implements AppInterface {
      }
      ```
      Removal of `ApiClass.bar()` will lead to not overriding an abstract method
      `AppInterface.bar()` compilation error in `AppClass`.
      Therefore, this change adds the overrides of a default method to the
      signature files.
      
      Test: checkapi
      Bug: 299366704
      Change-Id: I212bd9aa895088fa9de33c7e3521453dea30c350
      ec4e94e1
  7. Oct 16, 2023
    • Paul Duffin's avatar
      Add additional overriding methods to signature files · d93cd390
      Paul Duffin authored
      This change adds overriding methods that are essential to compile the
      stubs generated from the signature files.
      
      More information and the background for this change is available at
      go/add-overriding-one-pager.
      
      Test: m checkbuild --build-from-text-stub
      Bug: 299366704
      Change-Id: Ia8f0ae4b4e47a2974016fd844242aa0564027131
      Merged-In: Ifc1876eb60a4b716f72c86003dc9bea0081e9a4c
      d93cd390
    • Paul Duffin's avatar
      Add additional overriding methods to signature files · 70523673
      Paul Duffin authored
      This change adds overriding methods that are essential to compile the
      stubs generated from the signature files.
      
      More information and the background for this change is available at
      go/add-overriding-one-pager.
      
      Test: m checkapi
      Change-Id: Ifc1876eb60a4b716f72c86003dc9bea0081e9a4c
      Merged-In: Ifc1876eb60a4b716f72c86003dc9bea0081e9a4c
      70523673
  8. Oct 12, 2023
    • Paul Duffin's avatar
      Add additional overriding methods to signature files · 96ce72c4
      Paul Duffin authored
      This change adds overriding methods that are essential to compile the
      stubs generated from the signature files.
      
      More information and the background for this change is available at
      go/add-overriding-one-pager.
      
      Test: m checkapi
      Change-Id: Ifc1876eb60a4b716f72c86003dc9bea0081e9a4c
      96ce72c4
    • Paul Duffin's avatar
      Prepare for keeping concrete overrides of abstract methods · 4ed6f66e
      Paul Duffin authored
      Currently, metalava will discard concrete overrides of abstract methods
      from the API signature files which causes problems when attempting to
      generate stubs from those files and also discards information that may
      be important in API reviews. This change is the first step in the
      process of changing that behavior.
      
      This change hard codes the current behavior for discarding the concrete
      overrides (`add-additional-overrides=no`) into those signature files
      that will (or are likely) to be affected by the change in behavior.
      That allows the default behavior to be changed for all the other files
      without affecting these.
      
      Follow up changes will remove the hard coding from the signature files
      and will update the contents which will include the concrete overrides
      of the abstract methods.
      
      More information and the background for this change is available at
      go/add-overriding-one-pager.
      
      Test: m checkapi
      Bug: 299366704
      (cherry picked from https://android-review.googlesource.com/q/commit:48379f815d43560db37c7291fbfb29cfa06e865c)
      Merged-In: Ibe0dbfa29f88d1040798ae394e8d456436259aea
      Change-Id: Ibe0dbfa29f88d1040798ae394e8d456436259aea
      4ed6f66e
  9. Oct 10, 2023
    • Paul Duffin's avatar
      Prepare for keeping concrete overrides of abstract methods · 48379f81
      Paul Duffin authored
      Currently, metalava will discard concrete overrides of abstract methods
      from the API signature files which causes problems when attempting to
      generate stubs from those files and also discards information that may
      be important in API reviews. This change is the first step in the
      process of changing that behavior.
      
      This change hard codes the current behavior for discarding the concrete
      overrides (`add-additional-overrides=no`) into those signature files
      that will (or are likely) to be affected by the change in behavior.
      That allows the default behavior to be changed for all the other files
      without affecting these.
      
      Follow up changes will remove the hard coding from the signature files
      and will update the contents which will include the concrete overrides
      of the abstract methods.
      
      More information and the background for this change is available at
      go/add-overriding-one-pager.
      
      Test: m checkapi
      Bug: 299366704
      Change-Id: Ibe0dbfa29f88d1040798ae394e8d456436259aea
      48379f81
  10. Mar 22, 2023
  11. Feb 23, 2023
  12. Feb 17, 2023
    • Ashish Kumar's avatar
      Added a new api ContentProvider#getTypeAnonymous · 0ec40657
      Ashish Kumar authored
      - When an app is unable to acquire IContentProvider in contentResolver#getType,
      they can only call getTypeAnonymous via activityManagerService.
      - default getTypeUnchecked returns getType (to ensure less breaking)
      - getType calls are protected by readPermission.
      - updated logging of getType calls without readPermisison.
      
      Bug: b/161370118
      
      Test: Build, manual test and logging
      Change-Id: Ia5fe69061de36ed70d93b30754d68b63ad791c83
      0ec40657
  13. Feb 15, 2023
    • Hui Yu's avatar
      Extend bindService flags from 32 bits to 64 bits. · 57c7aa90
      Hui Yu authored
      bindService flags used to a be a 32 bits integer type, we are running
      out of 32 bits flags. Now use an object BindServiceFlags which is a 64
      bits long type (can be changed to other data structure/type in the
      future) for the bindService flags.
      
      Bug: 191785864
      Test: atest cts/tests/app/src/android/app/cts/ServiceTest.java#testBindServiceFlags
      atest cts/tests/app/src/android/app/cts/ServiceTest.java
      atest cts/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
      atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
      Change-Id: Ib120869c5d90ff37f551d760205a7b65f8b56020
      
      Change-Id: Ib5bec28b7c9aa55874f46210fdbe24596bab40d6
      57c7aa90
  14. Jan 30, 2023
    • Michael Groover's avatar
      Add APIs to allow broadcaster to share identity with receivers · 9199fb9a
      Michael Groover authored
      This commit adds APIs to allow a broadcasting app to share its
      identity with the receiver(s) that will receive the broadcast and
      to allow receivers to obtain the uid and package name of the
      broadcasting app.
      
      Bug: 259743961
      Test: atest ShareIdentityTest
      Change-Id: Ibe9df2b44e414ab92adbf44cd5b4c9eabecb7ee1
      9199fb9a
  15. Dec 20, 2022
    • Marco Loaiza's avatar
      Add APIs to update and listen to deviceId changes in Context · 01d21e8d
      Marco Loaiza authored
      - Adds a updateDeviceId @hide API that can be used by the system
        to update the device association of a Context that is not
        explicitly created as a Device Context.
      - Adds a listener that would be notified whenever the deviceId
        of the Context has changed.
      - Adds an isDeviceContext() API that can be used to determine
        if the device ID returned by getDeviceId() is reliable for
        this Context instance.
      
      These APIs will enable implicit deviceId association for Contexts
      that are not Device Contexts.
      
      Test: atest DeviceAssociationTest
      Bug: 253201821
      Change-Id: I8ef7a5f7a82ee341fb98236a01940b4be1e4fb23
      01d21e8d
  16. Oct 17, 2022
  17. Aug 02, 2022
    • Sarup Dalwani's avatar
      Making add and clear CPIF apis as TestApis · d06acf69
      Sarup Dalwani authored
      Making addCrossProfileIntentFilter and clearCrossProfileIntentFilters as
      TestApis so that we can write CTS device side test cases to emulate
      behaviour used by 3P apps or profile owners. This is to ensure that no
      malicious user can add/remove filters by following access control rules.
      
      Bug: 238019465
      Test: atest CtsAppCloningDeviceTestCases
      Change-Id: I4084826cbc63b1afc5569bd310be694b11202aee
      d06acf69
  18. Dec 02, 2021
    • Songchun Fan's avatar
      [pm] new APIs for ApplictaionInfo/PackageInfo/ComponentInfo/ResolveInfo flags · cf3f673b
      Songchun Fan authored
      We are running out of int flags for public API methods such as
      PackageManager.getPackageInfo(String packageName, int flags). As a
      solution, we will change the flags param to Flags objects. At the
      same time, we deprecate the old methods that directly use int flags.
      
      The new flags classes are: ApplicationInfoFlags, PackageInfoFlags,
      ComponentInfoFlags and ResolveInfoFlags. Because there are already
      annotations of the same names, we renamed the annotations to *FlagsBits.
      
      Old API usage example:
      getPackageInfo(pkgName, MATCH_UNINSTALLED_PACKAGES)
      
      New API usage example:
      getPackageInfo(pkgName, PackageInfoFlags.of(MATCH_UNINSTALLED_PACKAGES))
      
      See b/204433742 for discussions.
      
      CTS-Coverage-Bug: 206147270
      BUG: 204432643
      BUG: 204433659
      Test: manual
      Change-Id: I8ab2adad6907670c5879c043d170c950afefe46c
      cf3f673b
  19. Nov 24, 2021
    • Anton Hansson's avatar
      Make android.test.mock use api_srcs instead of jarjar · 7a4b9d91
      Anton Hansson authored
      Since the jarjar solution was introduced, api_srcs support was
      added back to java_sdk_library. Migrate to that.
      
      Aside from the slightly simpler setup, I also noticed the jarjar-version
      left some *.uau and *.xml files in the output jar.
      
      Test: diff jar before and after
      Change-Id: I9724cce159ea4f1b882505f589a9cfe17a880514
      7a4b9d91
  20. Oct 05, 2021
    • Alex Johnston's avatar
      Revert "Revert "Cherrypicking flags and override methods for all..." · 4e8851d0
      Alex Johnston authored
      Revert "Revert "Required change for adding overload method for r..."
      
      Revert submission 1842720-revert-1836473-receiverChangesinAOSP-FWJQDTADTI
      
      Reason for revert: DroidMonitor-triggered revert due to breakage, bug b/202144225
      Reverted Changes:
      I03409ea39:Revert "Required change for adding overload method...
      I583a11d2a:Revert "Cherrypicking flags and override methods f...
      
      Change-Id: I5cdf9c74d51a259fdaa43dfdc9423d22145eac60
      4e8851d0
    • Jacky Kao's avatar
      Revert "Cherrypicking flags and override methods for allowing dy..." · 0827cf0c
      Jacky Kao authored
      Revert "Required change for adding overload method for registerR..."
      
      Revert submission 1836473-receiverChangesinAOSP
      
      Reason for revert: <INSERT REASONING HERE>
      Reverted Changes:Making build break
      I906ce9eb0:Required change for adding overload method for reg...
      I9a16f566c:Cherrypicking flags and override methods for allow...
      
      Change-Id: I583a11d2a23651db24acde303d522a5faae15c6b
      0827cf0c
  21. Sep 23, 2021
  22. Sep 14, 2021
    • Jiyong Park's avatar
      Keep only the classes in the android.test.mock package · 9b62bc81
      Jiyong Park authored
      framework-core-sources-for-test-mock has some classes that are outside
      of the android.test.mock package. It is necessary just to provide
      private APIs to the mock classes, but not to include them in the impl
      library.
      
      Removing the unnecessary classes by using jarjar.
      
      Bug: 199529199
      Test: m
      Change-Id: I4d0de6132245c4923a4b17a4004c300cd864c116
      9b62bc81
  23. Sep 02, 2021
    • Jacob Hobbie's avatar
      Adding support for FLAG_EXPORTED and FLAG_NOT_EXPORTED to · bd012f41
      Jacob Hobbie authored
      registerReceiverAsUser and registerReceiverForAllUsers
      
      Test: not needed, added an override method. Manually tested
      Bug: 161145287
      CTS-Coverage-Bug: 197772228
      Change-Id: I2c8220c8d54b9ec5cb9481cef98735395db76e27
      Topic: registerReceiverAsUser
      bd012f41
  24. Jun 03, 2021
    • Colin Cross's avatar
      Set dist_group: "android" for frameworks/base java_sdk_libraries · 5959ec0a
      Colin Cross authored
      dist_group replaces owner and the default is going to change, set it
      to the current default "android" for frameworks/base java_sdk_libraries.
      
      Bug: 186723288
      Test: m checkbuild
      Change-Id: I1526853951bcffbe5c5aec6fbc6ba8e0dbea95ad
      Merged-In: I1526853951bcffbe5c5aec6fbc6ba8e0dbea95ad
      5959ec0a
  25. Jun 02, 2021
  26. May 10, 2021
    • Anton Hansson's avatar
      Use filegroups for test-{base,mock,runner} srcs · 2e25fdc9
      Anton Hansson authored
      This allows soong to infer the package of the given srcs, which in turns
      make it able to filter the inputs to metalava to exclude unwanted
      packages.
      
      This is part of a larger topic of changes intended to remove undesired
      classes from the public documentation.
      
      Bug: 187386774
      Test: m
      Change-Id: I8196c306b743ce6ca8a6452d212f3d7c0b5b2b82
      2e25fdc9
  27. May 01, 2021
    • Baligh Uddin's avatar
      Remove annotations that have been relocated · 3b927567
      Baligh Uddin authored
      These annotations have been relocated to frameworks/libs/modules-utils.
      This CL removes the files and updates necessary build rules.
      
      Bug: 183133670
      Test: TH
      Merged-In: I024252070bd806d50d54377190fdc5cd5b4445e1
      Change-Id: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      3b927567
    • Baligh Uddin's avatar
      Remove annotations that have been relocated · 7430c985
      Baligh Uddin authored
      These annotations have been relocated to frameworks/libs/modules-utils.
      This CL removes the files and updates necessary build rules.
      
      Bug: 183133670
      Test: TH
      Merged-In: Ic0ec9c3c12571b3405c1b7668528f5c50d083896
      Change-Id: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      7430c985
    • Baligh Uddin's avatar
      Remove annotations that have been relocated · 800380eb
      Baligh Uddin authored
      These annotations have been relocated to frameworks/libs/modules-utils.
      This CL removes the files and updates necessary build rules.
      
      Bug: 183133670
      Test: TH
      Merged-In: Ie6d4938961f7725cc141dd1a43f69a906b913f24
      Change-Id: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      800380eb
  28. Apr 30, 2021
    • Chris Wailes's avatar
      Remove annotations that have been relocated · b68f4510
      Chris Wailes authored
      These annotations have been relocated to frameworks/libs/modules-utils.
      This CL removes the files and updates necessary build rules.
      
      Bug: 183133670
      Test: m
      Merged-In: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      Change-Id: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      b68f4510
    • Chris Wailes's avatar
      Remove annotations that have been relocated · c6360dab
      Chris Wailes authored
      These annotations have been relocated to frameworks/libs/modules-utils.
      This CL removes the files and updates necessary build rules.
      
      Bug: 183133670
      Test: m
      Merged-In: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      Change-Id: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      c6360dab
  29. Apr 26, 2021
    • Chris Wailes's avatar
      Remove annotations that have been relocated · 68f38b2f
      Chris Wailes authored
      These annotations have been relocated to frameworks/libs/modules-utils.
      This CL removes the files and updates necessary build rules.
      
      Bug: 183133670
      Test: m
      Change-Id: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
      68f38b2f
  30. Apr 21, 2021
    • Hui Yu's avatar
      Temp allowlist bluetooth broadcast to start FGS for 10 seconds. · 8c23d658
      Hui Yu authored
      Add an overloaded version of Context.sendBroadcastMultiplePermissions() that can
      specify BroadcastOptions, it is called by com.android.bluetooth package.
      
      Bug: 182816627
      Test: atest AdapterServiceTest
      Test: atest AvrcpControllerStateMachineTest
      Test: atest BondStateMachineTest
      Test: atest MapClientStateMachineTest
      Test: atest RemoteDevicesTest
      
      Change-Id: I8bb2d2ed98ece70ebbe9d3a1b549b966d690de4f
      8c23d658
  31. Apr 07, 2021
    • Charles Chen's avatar
      Allow config context to inflate views · d12be752
      Charles Chen authored
      Besides UI contexts, the context created via
      Context#createConfigurationContext with a proper configuration
      should be allowed to inflate views or obtain ViewConfiguration.
      An example is that a wear device inflate views into bitmap and pass
      the bitmap to the Wear OS Companion app on the phone.
      
      Bug: 177847640
      Test: atest StrictModeTest
      
      Change-Id: Iab232a80a973f54bf0484262d45af3e4c2f0e5dc
      d12be752
  32. Mar 29, 2021
    • Svet Ganov's avatar
      Runtime permission attribution improvements · 8d2ed506
      Svet Ganov authored
      When an app is proxying access to runtime permission protected
      data it needs to check whether the calling app has a permission
      to the data it is about to proxy which leaves a trace in app ops
      that the requesting app perofmed a data access. However, then the
      app doing the work needs to get the protected data itself from the
      OS which access gets attributed only to itself. As a result there
      are two data accesses in app ops where only the first one is a
      proxy one that app A got access to Foo through app B - that is the
      one we want to show in the permission tracking UIs - and one
      for the data access - that is the one we would want to blame on
      the calling app, and in fact, these two accesses should be one -
      that app A accessed Foo though B. This limitation requires fragile
      one off workarounds where both accesses use the same attribution
      tag and sys UI has hardcoded rules to dedupe. Since this is not
      documented we cannot expect that the ecosystem would reliably
      do this workaround in apps that that the workaround in the OS
      would be respected by every OEM.
      
      This change adds a mechaism to resolve this issue. It allows for
      an app to create an attribution context for another app and then
      any private data access thorugh this context would result in a
      single app op blame that A accessed Foo though B, i.e. we no longer
      have double accounting. Also this can be nested through apps, e.g.
      app A asks app B which asks app C for contacts. In this case app
      B creates an attribution context for app A and calls into app C
      which creates an attribution context for app B. When app C gets
      contacts the entire attribution chain would get a porper, single
      blame: that C accessed the data, that B got the data from C, and
      that A got the data form B. Furthermore, this mechanism ensures
      that apps cannot forget to check permissions for the caller
      before proxying private data. In our example B and C don't need
      to check the permisisons for A and B, respectively, since the
      permisisons for the entire attribution chain are checked before
      data delivery. Attribution chains are not forgeable preventing
      a bad actor to create an arbitrary one - each attribution is
      created by the app it refers to and points to a chain of
      attributions created by their corresponding apps.
      
      This change also fixes a bug where all content provider accesses
      were double counted in app ops due to double noting. While at
      this it also fixes that apps can now access their own last ops.
      There was a bug where one could not pass null getting the attributed
      ops from a historical package ops while this is a valid use case
      since if there is no attribution everything is mapped to the null
      tag. There were some app op APIs not being piped thorough the app
      ops delegate and by extension through the app ops policy. Also
      now that we have nice way to express the permission chain in a
      call we no longer need the special casing in activity manager to
      handle content provider accesses through the OS. Fixed a bug
      where we don't properly handle the android.os.shell calls with
      an invlaid tag which was failing while the shell can do any tag.
      
      Finally, to ensure the mechanims is validated and works end-to-end
      we are adding support for a voice recognizer to blame the client
      app for the mic access. The recognition service can create a blaming
      context when opening the mic and if the mic is open, which would
      do all permission checks, we would not do so again. Since changes
      to PermissionChercker for handling attribution sources were made
      the CL also hooks up renounced permissoins in the request permission
      flow and in the permission checks.
      
      bug:158792096
      bug:180647319
      
      Test:atest CtsPermissionsTestCases
           atest CtsPermissions2TestCases
           atest CtsPermissions3TestCases
           atest CtsPermissions4TestCases
           atest CtsPermissions5TestCases
           atest CtsAppOpsTestCases
           atest CtsAppOps2TestCases
      
      Change-Id: Ib04585515d3dc3956966005ae9d94955b2f3ee08
      8d2ed506
Loading