summaryrefslogtreecommitdiff
path: root/test-mock/api
AgeCommit message (Collapse)Author
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-02-13New TestApis to use in VDM CTS Vladimir Komsiyski
Bug: 324560285 Test: CTS Change-Id: I494fdc3213688f0a1d0980adc1f60b6f917e9d1a
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-02-23[pm] Un-deprecate PackageManager APIs that use int flags Songchun Fan
BUG: 269336944 Test: builds Change-Id: I7bdbd96e63bc33a469ca05c26d4215f344981502
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-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-01-23Merge "Add necessary system APIs for moving role into module." Hai Zhang
2021-01-22Add necessary system APIs for moving role into module. Hai Zhang
- Added Context.getUser() to system API, to allow module framework classes to also implement multi-user support in manager classes. - Added PackageManager.getPermissionControllerPackageName() to system API for RoleControllerManager to know which package to bind to. Bug: 158736025 Test: build Change-Id: If69a97573eb1e676145e0accdfa73fef320aabe7
2021-01-18Expose Context#sendStickyBroadcast(Intent, Bundle) paulhu
Bug: 177223402 Test: atest FrameworksCoreTests:ContextTest Test: atest CtsContentTestCases:ContextTest Change-Id: Ic85419934cf2c9df4e0f9cc287585b3296cec819
2020-10-20Remove @TestApi from @SystemApi symbols Anton Hansson
I ran these commands: cd frameworks/base grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \ 's/\@SystemApi[\s\n]+(\@\w+[\s\n]+)?\@TestApi/\@SystemApi\1/gs' grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \ 's/\@TestApi[\s\n]+(\@\w+[\s\n]+)?\@SystemApi/\1\@SystemApi/gs' Bug: 171179806 Test: m checkapi Change-Id: I772790b783b0a8730b8bf680c9e569a886b8d789
2020-10-19Remove @TestApi from @SystemApi symbols Anton Hansson
I ran these commands: cd frameworks/base grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \ 's/\@SystemApi[\s\n]+(\@\w+[\s\n]+)?\@TestApi/\@SystemApi\1/gs' grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \ 's/\@TestApi[\s\n]+(\@\w+[\s\n]+)?\@SystemApi/\1\@SystemApi/gs' Bug: 171179806 Test: m checkapi Change-Id: I772790b783b0a8730b8bf680c9e569a886b8d789 Merged-In: I772790b783b0a8730b8bf680c9e569a886b8d789
2020-05-11Update lint-baseline.txt for android.test.mock Paul Duffin
Bug: 156126315 Bug: 156175891 Test: m checkapi Change-Id: I39d5f458fdf965c14c999f906cbe4a487d33cf0f
2020-05-11Add lint-baseline.txt files for test base/runner/mock Paul Duffin
In preparation for enabling API lint checking on java_sdk_library adds lint-baseline.txt containing all the existing issues for these APIs. The test-base and test-runner APIs are old and have been deprecated so there is little benefit in fixing those issues. The test-mock API while old has not been deprecated and so should be cleaned up. Bug 156175891 tracks that cleanup work. Bug: 156126315 Bug: 156175891 Test: m checkapi Merged-In: Ifb4669fcf7f2a36e5cb4d593bfc5d03330901ee9 Change-Id: Ifb4669fcf7f2a36e5cb4d593bfc5d03330901ee9 (cherry picked from commit ee5a4af4c5a7f8f9b3b33ded7f1fd9da9497d9ff)
2020-01-22Introduce WindowContext API Andrii Kulian
Test: atest WmTests CtsWindowManagerDeviceTestCases Bug: 128338354 Change-Id: I9c9dfc5e7f4edd4c968e60d2ffcbb19b5c72a853
2019-06-28Permission flag updates now notify listeners Nate Myren
Added a version of the onPermissionUpdated and onInstallPermissionUpdated methods which will notify OnPermissionChangedListeners, and added this to the PermissionManagerService "updatePermissionFlags" and "updatePermissionFlagsForAllApps" methods. Also adds OnPermissionsChangedListener to @TestApi Fixes: 135937566 Test: atest PermissionUpdateListenerTest Change-Id: I906598c366234c3daaa202261678bca04837cb13
2019-03-22Add Shell permission for CTS test. wilsonshih
Add Shell permission for new CTS tests to test the multi-display functionality in WallpaperService/WallpaperManagerService. Bug: 123707989 Test: atest WallpaperManagerMultiDisplayTests Test: atest ActivityManagerMultiDisplayTests Change-Id: Id97db050a0b9d1940c2dfaa793fbe526df578105
2019-02-21Added some TestApi that are already used by CTS Wale Ogunwale
Allows us to remove the use of private platform API from CTS. Bug: 124134247 Test: builds Change-Id: Iceb81ff7c9385e877d2612fbb7b506245d116928
2019-02-15Expose permission flag APIs for tests Philip P. Moltmann
tests need to make sure the flags are set correctly. Bug: 116738135 Test: atest CtsBackupTestCases:android.backup.cts.PermissionTest#testRestorePermReviewed Change-Id: Ia1000de3594e910c3345e205679bee37be898d17
2019-02-08Merge "Add TEST_MAPPING for api specifications" am: 6bb71b0322 am: cd2586709b Paul Duffin
am: 17abc1fd96 Change-Id: I76724e470d2de7b34900a5d21b6dd3b24ee6124d
2019-02-06Add TEST_MAPPING for api specifications Paul Duffin
Changes to the various api directories will run the tests which make use of the API specification in those directories. Could not include CtsSystemApiSignatureTestCases as it is broken on git_master because of bug 116632058. Bug: 123254057 Test: atest Change-Id: I1fe4ca498cbd0393aba7cf4c1386a6325ace7937
2019-01-22API Compatibility: Fix incompatible abstract methods on Context Adrian Roos
Bug: 123221743 Test: m api-stubs-docs-check-last-released-api Change-Id: I6d34c86582633d696464c8207a7d631be6d31693
2019-01-19Update signature files to the new format Tor Norbye
The new format is described in tools/metalava/FORMAT.md. Fixes: 116589402 Switch signature files over to the v2 format Fixes: 112626813 Drop "synchronized" modifier from the signature format Fixes: 122358225 Omit overriding methods that only differ in final [...] Fixes: 73088715 API Review: Need doclava to output nullability Fixes: 79739773 API Review: Metalava enforcing constants are constant Exempt-From-Owner-Approval: Large-scale tooling change Test: make sdk, make update-api, make checkapi Change-Id: Ia248aece5250e84e47c815c601133b698bf644c2
2019-01-19Update signature files to the new format Tor Norbye
The new format is described in tools/metalava/FORMAT.md. Fixes: 116589402 Switch signature files over to the v2 format Fixes: 112626813 Drop "synchronized" modifier from the signature format Fixes: 122358225 Omit overriding methods that only differ in final [...] Fixes: 73088715 API Review: Need doclava to output nullability Fixes: 79739773 API Review: Metalava enforcing constants are constant Exempt-From-Owner-Approval: Large-scale tooling change Test: make sdk, make update-api, make checkapi Change-Id: I8314f4e7099fa92e4f8ed7d283ccf836cc9a84a0 Merged-In: Ia248aece5250e84e47c815c601133b698bf644c2
2018-11-29AML: Make Context#getOpPackageName() public Jaewan Kim
Bug: 119748678 Test: build Change-Id: I79f7d057df5b61fa661987d36f20d24825eb1e5b
2018-11-21Add new API to performing grouping and ordering of bindings. Dianne Hackborn
This will allow apps to better manage many isolated processes, telling the system how they are grouped together (so should be managed as one related entity within the LRU cache) and fine-tune the ordering within that group. The API is not yet tested... though in theory it is implemented. But the implementation done for that also fixes a *lot* of problems with activity LRU management that, even without groups, should make the ordering of processes in the LRU list much more consistently match how recently the user has interacted with it. Also clean up some of the new dumpsys output in the activity manager: move the new sections to before the process output (so it is still easy to see the process state at the end of the output), and add and document the command line options for controlling them. And add a new "lru" section that gives a clear view of what is going on with the raw LRU list. An upcoming change will add tests for the new grouping functionality, and probably some fixes resulting from that. Test: atest CtsAppTestCases:ServiceTest Bug: 111434506 Change-Id: I1f6b6b9de66ccde1573e1a0e9615e8c5f8e6c0d7
2018-11-13Implement naming of isolated service bindings. Dianne Hackborn
This allows clients to run multiple instances of the same manifest service declaration. It only works for isolated services, to avoid too much abuse temptation. This is part of the "Chrome site isolation" work, to allow chrome to have many more render processes running and help it manage them. Bug: 111434506 Test: atest CtsAppTestCases:ServiceTest Change-Id: I22e65758678a07075ed32ed6463082ddf846d3a4
2018-10-12Suspending app can customize intercepting dialog Suprabh Shukla
The suspending app has more context about why a particular app was suspended by the user, but we do not want to delegate the interception of the suspended activity out of the system. Hence allowing it further customizations to the dialog to make it clearer. Test: atest com.android.server.pm.SuspendDialogInfoTest \ com.android.server.pm.SuspendPackagesTest \ com.android.server.pm.PackageUserStateTest \ com.android.server.pm.PackageManagerSettingsTests \ com.android.server.am.ActivityStartInterceptorTest atest GtsSuspendAppsPermissionTestCases GtsSuspendAppsTestCases Bug: 112486945 Bug: 113150060 Change-Id: If9f4d14587a2b75bb572e7984a90e300a2c72d16
2018-09-10Make PackageManager#arePermissionsIndividuallyControlled system-api Philip P. Moltmann
The PermissonController is going to become a mainline module, hence it has to compile against @SystemApi. PackageManager#arePermissionsIndividuallyControlled controls how certain permissions are presented in the UI, hence Permission controller needs to read it. The value of this API comes from a config option. Bug: 110953302 Test: Built Change-Id: If78b1bb594af0c85e92abf70ae8315e7ba3f31fa
2018-08-29Build android.test.* with java_sdk_library Sundong Ahn
android.test.* are built with java_sdk_library and api files are added by running "make update-api". android.test.base_static is created for allowing to use android.test.base as a static library. Bug:77577799 Test: make -j Test: make checkapi Test: make checkapi fails with a random change in the txt file Test: adb shell cmd package list libraries |\ grep android.test.* And check the android.test.* libraries Merged-In: Ia27612657532e50b077a9c55dbef59ee3ec04b8a Change-Id: Ia27612657532e50b077a9c55dbef59ee3ec04b8a
2018-08-22Deprecate Resources#getMovie() Aurimas Liutikas
Movie class has been deprecated, deprecate the getMovie as well. Bug: 113054577 Test: None Change-Id: Ic217adc002c7cfbe795e855689af1a58447b7d39
2018-08-16Build android.test.* with java_sdk_library Sundong Ahn
android.test.* are built with java_sdk_library and api files are added by running "make update-api". android.test.base_static is created for allowing to use android.test.base as a static library. Bug:77577799 Test: make -j Test: make checkapi Test: make checkapi fails with a random change in the txt file Test: adb shell cmd package list libraries |\ grep android.test.* And check the android.test.* libraries Change-Id: Ia27612657532e50b077a9c55dbef59ee3ec04b8a
2018-03-20Add SoundTriggerDetectionService Philip P. Moltmann
The service is meant to replace the PendingIntent based API. Once all users of the PendingIntent based API switched the PendingIntent based API will be removed. To have as little as possible impact on the whole SoundTrigger framework the RemoteSoundTriggerDetectionService class implements the same interface as the PendingIntent based class. Hence the exising code has very little change. Further once the old code can be removed the amount of changed (and added) code is limited. The RemoteSoundTriggerDetectionService -> SoundTriggerDetectionService is a vanilla as possible service implementation. The special behaviors are: - The system holds a wakelock while service operations are in progress and the service is bound as foreground. Hence the service can e.g. listen to the microphone. - Service operations have a certain amount of time they are allowed to run. Once every operation is either finished or the the operation exceeded the allotted time, the system calls onStopOperation for each still pending operation. This is a similar model as for the commonly used JobService. Please note that if the time allowed for an operation is 15s and op1 was run as 0si, and op1 was run at 5s, the service is allowed to run until 20s. Hence _both_ onStopOperations will happen at 20s. This is done for ease of implementation but should not give the service more power than calling onStopOperation exactly 15s after each operation is triggered. - If an operation is done before the allotted time is reached, the service can declare the operation as finished manually by calling onOperationFinished. This is a call back into the system, hence a 'client' binder is sent to the service. If the operation is finished by calling this method onStopOperation will not be called. - As the service instance might be killed and restored between operations we add a opaque bundle 'params' to each operations. The users of the API can use this to send data from the start command to the operations. It can also just be set to null. The params are not meant to store changing state in between operations. Such state needs to be persisted using the regular methods (e.g. write it to disk) - A service can be used for multiple recognition sessions. Each recognition is uniquelity defined by its sound model UUID. Hence each operation gets at least tree arguments: Operation ID, sound mode UUID, params - As a small optimization the params are cached inside of the service instance. The time allowed for each operation is in a @SystemAPI global setting, so the service can make sure it finishes the operations before they are stopped. It might take some time to deliver the operations via the binder, hence it is not recommended to try to use every last ms of allotted time. Test: atest SoundTriggerDetectionServiceTest (added in separate CL) atest android.provider.SettingsBackupTest Change-Id: I47f813b7a5138a6f24732197813a605d29f85a93 Fixes: 73829108
2018-01-09Add apis needed for android.test.legacy Paul Duffin
The long term goal of removing junit and dependent android.test classes from the android.jar is the removal of the runtime libraries that provide those classes. A key part of the strategy for migrating APKs off the runtime libraries is the android.test.legacy library which APKs can statically include in place of the runtime dependencies without having to change their source code. The longer term goal is for all tests to migrate from these classes altogther and to use the Android Test Support Library instead but that will require significant changes to the test source code. In order for it to be safe to statically include android.test.legacy in an APK it cannot use any internal APIs. This change adds the additional classes and methods needed to the android.test.mock API library. The additions are all marked as deprecated to try and avoid developers from using them in new tests. It also marks the AccountManager constructor used by MockAccountManager with the android.annotation.MockApi so that it is included in the mock stubs libraries against which the android.test.mock.stubs[-system] libraries build. Bug: 30188076 Test: make checkbuild Change-Id: I85417cc328cab898ab93b9b726648f4232555324
2017-12-19Add android.test.mock.stubs-system Paul Duffin
The android.test.mock package contains one class with some methods that are annotated with @SystemApi which are not present in the android.test.mock.stubs. This adds a new android.test.mock.stubs-system library that includes those additional methods. Checked that the new API definition files contain the exact same definitions for the android.test.mock packages as are found in the api/system-current.txt and api/system-removed.txt files. Bug: 30188076 Test: make update-api && make checkbuild Change-Id: I4644d30716e556204caa4acb53d7af84ca520271
2017-12-19Fix visibility issues with android.test.mock.stubs Paul Duffin
This ensures that the API definitions for the android.test.mock package matches the definitions in the api/current.txt file. Bug: 30188076 Test: make update-api Change-Id: Id325b8cf2f189117ac4cfe7634095ab710eee004
2017-11-22Emit all APIs using Predicates. Jeff Sharkey
Generate APIs using updated doclava. Test: manual inspection of API text files Bug: 69505783 Change-Id: I2efd22998a64ebb57588b073c4a591242f4aef91
2017-11-16Remove one legacy install path Philip P. Moltmann
Also removed everything needed only for this path Test: Installed app via package installer, adb, google play store Bug: 65261282 Change-Id: Ia8a03fa5900687cd2adf844ba7e6c07e0537382e
2017-11-16Separate android.test.mock from test-runner source Paul Duffin
Extracts the source for the android.test.mock library from the frameworks/base/test-runner directory into its own frameworks/base/test-mock directory. They are already treated separately at runtime and compile time so this just makes the separation complete. Bug: 30188076 Test: make checkbuild Change-Id: I20e5b06ba79677e76117c82e9f9e2ecd15e5fed6