summaryrefslogtreecommitdiff
path: root/test-mock
AgeCommit message (Collapse)Author
2024-12-19Set `trendy_team_ravenwood` to most Ravenwood tests John Wu
Bug: 382060152 Test: TH Flag: EXEMPT host side change only Change-Id: I0965327155d1f6a54a98874159a254ddcb96314f
2024-11-08MockContentResolver: add logging for missing providers Tomasz Wasilczyk
This will allow easier debugging for failing unit tests. Bug: 365800992 Test: m Flag: EXEMPT logging only Change-Id: I672a5b00cf378b27e5438f5ad89d2755152bd33b
2024-10-29Allow querying the intent-filters receivers were registered for. Sudheer Shanka
Bug: 371313878 Test: atest tests/app/BroadcastsTest/src/android/app/cts/broadcasts/BroadcastReceiverRegistrationTest.java Flag: EXEMPT testapi Change-Id: I52a5a4af077a4a1cbf6c604e5a2f92666b41bc77
2024-08-06Revert "Revert "Remove full api surface from-text stubs java_api..." Jihoon Kang
Revert submission 3207397-revert-2982300-java_api_library_non_sdk-FIKZOSARQI Reason for revert: Post submit build breakage culprit fixed Reverted changes: /q/submissionid:3207397-revert-2982300-java_api_library_non_sdk-FIKZOSARQI Change-Id: Ie4741daf508c7cc9c6688091d44658bfb76df6b1
2024-08-05Revert "Remove full api surface from-text stubs java_api_library..." Liana Kazanova
Revert submission 2982300-java_api_library_non_sdk Reason for revert: DroidMonitor: Potential culprit for b/357648959 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Reverted changes: /q/submissionid:2982300-java_api_library_non_sdk Change-Id: I4224efbb47dc5ecf9afd7e3c9cd00b59a6c337ae
2024-08-02Remove full api surface from-text stubs java_api_library modules Jihoon Kang
The toggle between from-text and from-source stubs are made within java_sdk_library level stubs, and they no longer depend on the full api surface java_api_library modules. Therefore, these can be safely removed. This change also rename android_*_stubs_current.from-source to android_*_stubs_current, and remove the full api surface modules that are currently generated from api.go. Test: ENABLE_HIDDENAPI_FLAGS=true m Bug: 327507877 Change-Id: If1f081693c7380e2ed5b5d4a1a7f7365ef1770ca
2024-07-17Move ravenwood-runtime ravenwood-utils to f/b/r Makoto Onuki
This will help set better build module visibilities. Fix: 340891982 Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh Flag: EXEMPT build file change only Merged-in: I96e55a1d73bde7175a3bbdc640201bc146f4a022 Change-Id: I96e55a1d73bde7175a3bbdc640201bc146f4a022
2024-07-03Add Context.sendOrderedBroadcastMultiplePermissions Jakub Pawlowski
Flag: com.android.bluetooth.ordered_broadcast_multiple_permissions Test: mma -j68 Bug: 344915071 Merged-In: I8ecf003dc5e1babdbb4e104f548eef9d3562174e Change-Id: I8ecf003dc5e1babdbb4e104f548eef9d3562174e
2024-06-10Merge "Fix some discrepancies in @Deprecated handling in Metalava" into main ↵ Treehugger Robot
am: 0c73437caa Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3123071 Change-Id: Id8285aa6d421be672f5a8b960fb193ccb3eb5084 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-10Fix some discrepancies in @Deprecated handling in Metalava Paul Duffin
Previously, Metalava had some inconsistencies in the handling of deprecated status which lead to some inconsistencies in the API signature files. This change fixes those signatures. * `onGetLayoutInflater` was removed because the code to determine whether a method is elided from the signature files because it matches an overridden method will only elide a method if it has the same deprecated status as the overridden method. However, in some cases it would not take into account that the method, while not explicitly deprecated was a member of a deprecated class. That meant that `onGetLayoutInflater` was kept in the API signature file when it should not have been. That issue is fixed in this topic and so this change removes it. * `setPackagesSuspended` had an `@Deprecated` annotation added to it because while the API signature writing was supposed to add an `@Deprecated` annotation for a method that was explicitly deprecated or a member of a deprecated class in some cases the latter was ignored. That issue is fixed in this topic and so this change adds the previously missing `@Deprecated` annotation. Bug: 315206833 Test: m checkapi Change-Id: I0ef23d32c5b5b11f964aeb93c2bb0346d75cea83
2024-05-24Merge Android 24Q2 Release (ab/11526283) to aosp-main-future Xin Li
Bug: 337098550 Merged-In: Ie71e752f0224aa239ba1350d50996ce4b510949a Change-Id: Ib25c1abf055b0114e0494088df5585f65df27595
2024-03-18Merge "Clean the license metadata on dependencies of module ↵ Wei Li
android.test.legacy" into main
2024-03-08Clean the license metadata on dependencies of module android.test.legacy Wei Li
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
2024-02-13New TestApis to use in VDM CTS Vladimir Komsiyski
Bug: 324560285 Test: CTS Change-Id: I494fdc3213688f0a1d0980adc1f60b6f917e9d1a
2024-01-30Merge Android 24Q1 Release (ab/11220357) Xin Li
Bug: 319669529 Merged-In: I46c7859ff042ee7aa9193757e5df8269f4892362 Change-Id: I0c7b5036c0b0f5f2caad551edb063350f6eb87e7
2024-01-18Merge "Make the android-test-mock-current.txt available for use by the ↵ Treehugger Robot
/vendor tests." into main
2024-01-17Make the android-test-mock-current.txt available for use by the /vendor tests Nelson Li
Bug: 312324146 Test: Add android-test-mock-current.txt to the Android.bp Merged-In: I228744137f82e14bec936b11b96cb6876a392487 Change-Id: Ie895b25a6e0b70e558807d094304ea2e84425a3d
2024-01-17Make the android-test-mock-current.txt available for use by the /vendor tests. Nelson Li
Because this change will cause a merge conflict in AOSP, it will be merged into the main branch first. Bug: 312324146 Test: Add android-test-mock-current.txt to the Android.bp Change-Id: I228744137f82e14bec936b11b96cb6876a392487
2024-01-16Remove getUserId mock method from Mock Context. Nikhil Kumar
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
2023-11-29Verify `android.test.mock` under Ravenwood. Jeff Sharkey
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
2023-11-09Add overriding method of a default method to signature files Jihoon Kang
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
2023-10-16Add additional overriding methods to signature files Paul Duffin
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
2023-10-10Prepare for keeping concrete overrides of abstract methods Paul Duffin
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
2023-03-22Setting callingAttributionSource in getType and getStreamType Ashish Kumar
Test: build Bug: b/274595210 Change-Id: I31d6c7e9786ad187a92a02e707180410a3c875d6 Merged-In: I31d6c7e9786ad187a92a02e707180410a3c875d6
2023-02-23[pm] Un-deprecate PackageManager APIs that use int flags Songchun Fan
BUG: 269336944 Test: builds Change-Id: I7bdbd96e63bc33a469ca05c26d4215f344981502
2023-02-17Added a new api ContentProvider#getTypeAnonymous Ashish Kumar
- 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
2023-02-15Extend bindService flags from 32 bits to 64 bits. Hui Yu
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
2023-01-30Add APIs to allow broadcaster to share identity with receivers Michael Groover
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
2022-12-20Add APIs to update and listen to deviceId changes in Context Marco Loaiza
- 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
2022-10-17Add deviceId to Context and allow for creating Contexts with different deviceId. Vladimir Komsiyski
Applications may create contexts associated with the default host device or with any virtual device. The only way to create a non-default device context for now is via an explcit createDeviceContext call. Bug: 239152561 Test: atest FrameworksCoreTests:ContextTest Change-Id: If18dc7661fb232b0bc40121c723673ba880be9d5
2022-08-02Making add and clear CPIF apis as TestApis Sarup Dalwani
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
2021-12-02[pm] new APIs for ApplictaionInfo/PackageInfo/ComponentInfo/ResolveInfo flags Songchun Fan
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
2021-11-24Make android.test.mock use api_srcs instead of jarjar Anton Hansson
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
2021-10-05Merge "Revert "Revert "Cherrypicking flags and override methods for all..."" ↵ Alex Johnston
am: 5c35d3bce6 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1845059 Change-Id: I90e8a4d567fe2de9ab765806fc7bd3aba4fe0845
2021-10-05Revert "Revert "Cherrypicking flags and override methods for all..." Alex Johnston
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
2021-10-05Merge "Revert "Cherrypicking flags and override methods for allowing dy..."" ↵ Jacky Kao
am: 98ff8ecdaa Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1842721 Change-Id: Ieaed4fcc2fa97db551a70f4a3076b4237acfb8ab
2021-10-05Revert "Cherrypicking flags and override methods for allowing dy..." Jacky Kao
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
2021-10-05Merge "Cherrypicking flags and override methods for allowing dynamically ↵ Jacob Hobbie
registered receivers to mark themselves explicitly as exported or not exported." am: 316e0e8336 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1836473 Change-Id: I39049e42feb66c3fa3f0ebdef8e175ae86d5d410
2021-09-23Cherrypicking flags and override methods for allowing dynamically Jacob Hobbie
registered receivers to mark themselves explicitly as exported or not exported. Test: will add tests with enforcement Change-Id: I9a16f566c54e389743dcf460734ecdc0b1081768
2021-09-17Merge "Keep only the classes in the android.test.mock package" am: 70a0869f49 Treehugger Robot
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1824624 Change-Id: I5b4e93c719b31489611e64da97b041fc60b19c8a
2021-09-15Keep only the classes in the android.test.mock package Jiyong Park
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
2021-06-03Set dist_group: "android" for frameworks/base java_sdk_libraries Colin Cross
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
2021-06-02Set dist_group: "android" for frameworks/base java_sdk_libraries Colin Cross
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
2021-05-11Merge "Use filegroups for test-{base,mock,runner} srcs" am: af9b5f0a04 am: ↵ Anton Hansson
06e56695cc am: 4eecbfcd41 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1700026 Change-Id: I5444e5d1028c8cf9cd3fa624e05ad5b102866d94
2021-05-10Use filegroups for test-{base,mock,runner} srcs Anton Hansson
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
2021-05-01Remove annotations that have been relocated Baligh Uddin
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
2021-04-30Remove annotations that have been relocated Chris Wailes
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
2021-04-21Temp allowlist bluetooth broadcast to start FGS for 10 seconds. Hui Yu
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
2021-04-07Allow config context to inflate views Charles Chen
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
2021-03-29Runtime permission attribution improvements Svet Ganov
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