32 Commits

Author SHA1 Message Date
Hai Zhang
bbb9b5b5b1 Merge "Add necessary system APIs for moving role into module." 2021-01-23 00:38:22 +00:00
Hai Zhang
84705c4ae3 Add necessary system APIs for moving role into module.
- 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-22 14:26:55 -08:00
paulhu
4ee7e55df0 Expose Context#sendStickyBroadcast(Intent, Bundle)
Bug: 177223402
Test: atest FrameworksCoreTests:ContextTest
Test: atest CtsContentTestCases:ContextTest
Change-Id: Ic85419934cf2c9df4e0f9cc287585b3296cec819
2021-01-18 00:09:38 +08:00
Anton Hansson
586a3cf229 Remove @TestApi from @SystemApi symbols
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-20 09:04:03 +01:00
Anton Hansson
dd7d52f963 Remove @TestApi from @SystemApi symbols
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-10-19 16:41:01 +01:00
Paul Duffin
c1abc71892 Update lint-baseline.txt for android.test.mock
Bug: 156126315
Bug: 156175891
Test: m checkapi
Change-Id: I39d5f458fdf965c14c999f906cbe4a487d33cf0f
2020-05-11 20:55:36 +01:00
Paul Duffin
f66bf9b172 Add lint-baseline.txt files for test base/runner/mock
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-05-11 19:57:41 +01:00
Andrii Kulian
4a31697319 Introduce WindowContext API
Test: atest WmTests CtsWindowManagerDeviceTestCases
Bug: 128338354
Change-Id: I9c9dfc5e7f4edd4c968e60d2ffcbb19b5c72a853
2020-01-22 18:30:29 -08:00
Nate Myren
d3a6385686 Permission flag updates now notify listeners
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-06-28 16:56:26 +00:00
wilsonshih
5db7b39dd8 Add Shell permission for CTS test.
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-03-22 09:13:10 +08:00
Wale Ogunwale
691af68a3c Added some TestApi that are already used by CTS
Allows us to remove the use of private platform API from CTS.

Bug: 124134247
Test: builds
Change-Id: Iceb81ff7c9385e877d2612fbb7b506245d116928
2019-02-21 20:15:56 -08:00
Philip P. Moltmann
3e4961757b Expose permission flag APIs for tests
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-15 08:57:16 -08:00
Paul Duffin
2ac4d5cc03 Merge "Add TEST_MAPPING for api specifications" am: 6bb71b0322 am: cd2586709b
am: 17abc1fd96

Change-Id: I76724e470d2de7b34900a5d21b6dd3b24ee6124d
2019-02-08 04:26:35 -08:00
Paul Duffin
507cbc4e58 Add TEST_MAPPING for api specifications
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-02-06 13:57:42 +00:00
Adrian Roos
fe6aeaf2a3 API Compatibility: Fix incompatible abstract methods on Context
Bug: 123221743
Test: m api-stubs-docs-check-last-released-api
Change-Id: I6d34c86582633d696464c8207a7d631be6d31693
2019-01-22 16:58:56 +01:00
Tor Norbye
68ea0c3c13 Update signature files to the new format
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-19 12:07:50 -08:00
Tor Norbye
8752dedb76 Update signature files to the new format
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
2019-01-19 07:22:55 -08:00
Jaewan Kim
0980c7f092 AML: Make Context#getOpPackageName() public
Bug: 119748678
Test: build
Change-Id: I79f7d057df5b61fa661987d36f20d24825eb1e5b
2018-11-29 12:48:38 +09:00
Dianne Hackborn
a631d56cf3 Add new API to performing grouping and ordering of bindings.
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-21 09:13:21 -08:00
Dianne Hackborn
27b4d94a07 Implement naming of isolated service bindings.
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-11-13 16:03:02 -08:00
Suprabh Shukla
389cb6f54a Suspending app can customize intercepting dialog
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-10-12 16:02:53 -07:00
Philip P. Moltmann
a4b3022c51 Make PackageManager#arePermissionsIndividuallyControlled system-api
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-09-10 16:46:30 -07:00
Sundong Ahn
e933cedf83 Build android.test.* with java_sdk_library
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-29 12:22:59 +09:00
Aurimas Liutikas
f0764b5c46 Deprecate Resources#getMovie()
Movie class has been deprecated, deprecate the getMovie as well.

Bug: 113054577
Test: None
Change-Id: Ic217adc002c7cfbe795e855689af1a58447b7d39
2018-08-22 13:13:07 -07:00
Sundong Ahn
f24779c8c7 Build android.test.* with java_sdk_library
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-08-16 12:16:28 +09:00
Philip P. Moltmann
18e3eb8168 Add SoundTriggerDetectionService
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-03-20 13:57:14 -07:00
Paul Duffin
772b692320 Add apis needed for android.test.legacy
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
2018-01-09 14:38:38 +00:00
Paul Duffin
a23c84c7ca Add android.test.mock.stubs-system
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-19 19:56:21 +00:00
Paul Duffin
bd97e3dd4e Fix visibility issues with android.test.mock.stubs
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-12-19 19:52:54 +00:00
Jeff Sharkey
b8b579e1b8 Emit all APIs using Predicates.
Generate APIs using updated doclava.

Test: manual inspection of API text files
Bug: 69505783
Change-Id: I2efd22998a64ebb57588b073c4a591242f4aef91
2017-11-22 12:34:08 -07:00
Philip P. Moltmann
b13f15332e Remove one legacy install path
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-16 11:32:47 -08:00
Paul Duffin
e254526f0f Separate android.test.mock from test-runner source
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
2017-11-16 13:15:29 +00:00