130 Commits

Author SHA1 Message Date
Anton Hansson
a46c453773 Merge "Cleanup framework-all usage" 2019-12-18 10:21:23 +00:00
Anton Hansson
6fb18bbfdb Cleanup framework-all usage
It generally shouldn't be depended on. Only by droidstubs for
modules.

Bug: 137191822
Test: m
Change-Id: I16e672aaae80d8bcce25e46c34984797740aae1b
2019-12-18 07:03:15 +00:00
Felka Chang
0d824d4161 Add the root of crates by Context.getCrateDir
Context.getCrateDir() creates and returns the File for the
root of the crates for the application context. Any child directories
under the crates root in Context.getDataFile() is called
the crate directory.

For example:
  /data/user/0/com.exmaple.app/crates/IAmCratedFolder/decentFiles
  /data/user/0/com.exmaple.app/crates/IAmCratedFolder/decentDirs

Context.getCrateDir return the crate dir
  --> /data/user/0/com.exmaple.app/crates/IAmCratedFolder

The crate dir
  --> IAmCratedFolder
The decent directories or files are not crated folders
  --> decentFiles, decentDirs

Test: atest CtsOsTestCases:android.os.storage.cts.StorageCrateTest
Bug: 141660526
Change-Id: If3ec1e121fb8f72bab5571d6190378e3ae208832
2019-12-16 09:52:12 +08:00
Artur Satayev
6aa25ec97d Add new UnsupportedAppUsage annotation as lib dependency.
Bug: 145132366
Test: m
Change-Id: Ibb7f8424186149365354a96249c06c9fccde66bd
2019-12-11 18:18:18 +00:00
Peter Wang
7701f57250 [Telephony Mainline] Exposed sendOrderedBroadcast
with appOp as String and options as Bundle

Bug: 139077993
Test: Build, GsmInboundSmsHandlerTest, CdmaInboundSmsHandlerTest and WapPushOverSmsTest
Change-Id: I60e21c7202d1bc7c5d28dfad2e2edde902f28a15
2019-11-27 15:20:42 -08:00
Jeff Sharkey
e9fe152f31 Extend insert/update/delete to provide extras.
A few releases ago we added ContentResolver.QUERY_ARG_* constants
to query() as a new best-practice that will help wean us off raw
SQL arguments.  (For example, a provider could add their own
custom arguments like QUERY_ARG_INCLUDE_PENDING to cause the query
to reveal pending items that would otherwise be hidden.)  This
change expands update() and delete() to accept those arguments.

This change also expand insert() to accept extras too, as part of
preparing to support an upcoming MediaProvider feature that will let
apps place new media "adjacent" to an existing media item.  (Sending
that adjacent item through extras is cleaner than trying to send it
through escaped query parameters.)

Bug: 131643582
Test: atest CtsContentTestCases
Change-Id: I436296155b9b5f371b4cbe661feaf42070285fcc
2019-11-15 13:46:31 -07:00
Jeff Sharkey
03263747d8 Merge "Allow sending of bulk Uri change notifications." 2019-11-14 03:48:02 +00:00
Jeff Sharkey
1307f428af Allow sending of bulk Uri change notifications.
MediaProvider makes heavy use of Uri change notifications, which
currently need to be delivered one at a time through the Binder
interface.  To optimize this, allow callers to provide a collection
of multiple Uris to notify with a single Binder call.

Bug: 134170767
Test: atest cts/tests/tests/content/src/android/content/cts/ContentResolverTest.java
Change-Id: Ifef778e88bb772b5580f70929c6f2e9c166d1c0e
2019-11-13 18:17:02 -07:00
atrost
56dea3a7cc resolve merge conflicts of 8e8c40b5c262cc8fb88c44953547fecf58e495b0 to master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ia3ee4dce9639f9b66a44828f28c1fa7cd645dfe5
2019-11-13 17:21:20 +00:00
atrost
1a9455046c Move android.compat.annotation package out of libcore
Test: m + flash
Bug: 142650523
Change-Id: I1321195c8724485a90b162b32c3c8549dbd11c42
2019-11-11 15:10:57 +00:00
Meng Wang
3f9e036f11 System API: Context#registerReceiverForAllUsers
Bug: 141193711
Test: make
Change-Id: Ie692d2ac27474b9fe11f5548bc504aa00c5ad53c
2019-11-07 15:03:13 -08:00
Jordan Liu
08a94a2236 Merge "Expose Context.sendOrderedBroadcast with appop" 2019-11-04 19:59:28 +00:00
Jiyong Park
d60c0eaebc Merge "android.test.mock is built with much less number of sources" am: f0b9dfc0b1 am: a321a944ea
am: dcfd8ddce7

Change-Id: I67d7d2e9e490fd71c472e38e105c8fcfcb17df60
2019-11-02 01:27:25 -07:00
Jordan Liu
a32e6fcb03 Expose Context.sendOrderedBroadcast with appop
Bug: 143100231
Test: atest ContextTest#testSendOrderedBroadcastWithAppOp
      atest ContextTest#testSendOrderedBroadcastWithAppOp_NotGranted

Change-Id: Ia75d0db11f337769eaf3cf5436e09a7d38b0564c
Merged-In: Ia75d0db11f337769eaf3cf5436e09a7d38b0564c
2019-11-01 16:25:15 -07:00
Jordan Liu
54735539fb Expose Context.sendOrderedBroadcast with appop
Bug: 143100231
Test: atest ContextTest#testSendOrderedBroadcastWithAppOp
      atest ContextTest#testSendOrderedBroadcastWithAppOp_NotGranted

Change-Id: Ia75d0db11f337769eaf3cf5436e09a7d38b0564c
2019-11-01 14:01:09 -07:00
Jiyong Park
00ea0b1f91 android.test.mock is built with much less number of sources
android.test.mock is built with its own sources plus a small number of
framework sources that provides private APIs that the library's APIs
have references to. Previously, it was built with the entire framework
sources which is too many and should have slowed the build performance.

Bug: 141149570
Test: m
Change-Id: I165ffdfc053a71b323ef7058651d5908df06870f
2019-10-31 20:38:47 +09:00
Philip P. Moltmann
128b70364e Note with featureId from ContentProvider
This takes the Context#getFeatureId from the calling context and pipes
it all way through to the noteOp calls done by the content provider.

Bug: 136595429
Test: atest CtsAppOpsTestCases (new test added to capture this case)
            TelecomUnitTests:CallLogManagerTest
	    ContentProviderClientTest
	    TelecomUnitTests:MissedCallNotifierImplTest
	    TelecomUnitTests:BasicCallTests
	    MediaInserterTest
	    PreferencesHelperTest
	    RankingHelperTest
	    PinnedSliceStateTest
	    FrameworksCoreTests:ContentResolverTest
Change-Id: I53b1035626229c920b353509a5bece157b52fb51
2019-10-29 15:41:28 -07:00
Makoto Onuki
e5449f0b34 Explicitly take flags in createContextAsUser()
Bug: 142472686
Test: atest android.content.cts.ContextTest#testCreateContextAsUser
Change-Id: Id2e3d5ffe5887a4916e0872a7e85d62cbb439744
2019-10-14 11:09:00 -07:00
Makoto Onuki
b844001d6a Add Context.createContextAsUser()
Without it, apps (mainline modules) will need to use createPackageContext...,
which is a bit painful.

Bug: 142472686
Test: atest android.content.cts.ContextTest#testCreateContextAsUser
Change-Id: Id640e03862462724df1a4a3101f0b08faafba22f
2019-10-10 15:58:20 +00:00
Jiyong Park
acac2c9174 Merge changes Iea1d2ae2,I1d3c8e48 am: d708ea7b4a am: ebde74e7b1 am: fd4c08b689
am: 4de7f5eaac

Change-Id: Icf780d431f0dd596eee4d07ed26f33f5e0819ed9
2019-09-23 15:45:09 -07:00
Jiyong Park
0d94fae8ac Merge "Use filter_packages to unbunden metalava" am: 385291c36d am: 14698c6e71 am: 382aaf00de
am: a02ab098db

Change-Id: I2d43dcd8190966610e874775024a5b83e262f751
2019-09-19 07:10:14 -07:00
Jiyong Park
b1d2701f76 Build java_sdk_libraries with much less sources
This change fixes a regression that java_sdk_libraries under
frameworks/base were built with all framework sources.

Bug: 141149570
Test: m
Change-Id: Iea1d2ae20ca1c5b514a52d8b2a22e8a1d7543efd
2019-09-17 23:17:47 +09:00
Jiyong Park
ae9972bda4 Use filter_packages to unbunden metalava
This change fixes a problem that entire framework source files are given
to metalava even when many of the source files are not for public. Using
the new property filter_packages, only source files that belongs to the
public packages are given to metalava.

This CL also changes the name of the filegroup 'framework-srcs' to
'framework-non-updatable-sources' to better describe its contents. In
addition, a build-time only library 'framework-all' is introduced. This
library produces a header jar for all framework sources for both
non-updatable and updatable parts. It is put to the classpath when
invoking metalava to give information on the hidden classes that were
filtered-out.

Bug: 140764681
Test: m
Change-Id: I6e16679109ac07820e35037754d4327442c014f2
2019-09-16 13:12:59 +09:00
Jiyong Park
5366ea2089 Cut the dependency to framework from droiddoc modules
droiddoc modules for the SDK API documentation and stubs library
generations have depended on the 'framework' (which was recently changed
to framework-minus-apex' module to get the list of Java source files to
be processed.

This however caused a circular dependency when we tried to modularize
some classes in the framework library as a separate library. The
separate java library depended on the stubs library (because it should
only use SDK APIs) and the stubs library depended on the framework
library. The framework library itself depended on the separated library
(or its stub) to use APIs from the separated library, thus forming a
circular dependency.

This change fixes the problem by directly giving the framework source
files via a filegroup `framework-sources-to-document` where all Java
and AIDL files that are to be documented are included in.

This change also put the generated R.java and Manifest.java files from
framework-res into the filegroup for framework sources.

Bug: 70046217
Bug: 135922046
Test: m

Exempt-From-Owner-Approval: Approved internally
Merged-In: I09ad88da47540d31ad089aad5e1151a4b6877ec2
(cherry picked from commit 20426538f85098552f52dffb40d0f7ffff7946d4)
Change-Id: I09ad88da47540d31ad089aad5e1151a4b6877ec2
2019-08-30 05:14:08 +00:00
Jiyong Park
20426538f8 Cut the dependency to framework from droiddoc modules
droiddoc modules for the SDK API documentation and stubs library
generations have depended on the 'framework' (which was recently changed
to framework-minus-apex' module to get the list of Java source files to
be processed.

This however caused a circular dependency when we tried to modularize
some classes in the framework library as a separate library. The
separate java library depended on the stubs library (because it should
only use SDK APIs) and the stubs library depended on the framework
library. The framework library itself depended on the separated library
(or its stub) to use APIs from the separated library, thus forming a
circular dependency.

This change fixes the problem by directly giving the framework source
files via a filegroup `framework-sources-to-document` where all Java
and AIDL files that are to be documented are included in.

This change also put the generated R.java and Manifest.java files from
framework-res into the filegroup for framework sources.

Bug: 70046217
Bug: 135922046
Test: m

Change-Id: I09ad88da47540d31ad089aad5e1151a4b6877ec2
2019-08-29 07:44:38 +09:00
Jiyong Park
7e1339e055 Use filegroup to simplify Android.bp for frameworks and its friends
Java and AIDL source files under frameworks/base are now modularized
using filegroup. Each filegroup has 'path' property set to the base
directory of the ssource files. This allows us to not rely on
aidl.[local_]include_dirs and srcs_lib_whitelist_dirs to get the base
directories.

Bug: 70046217
Test: m
Exempt-From-Owner-Approval: Approved internally
Merged-In: I0705ddf76b3c628127f65d75e0a8b06c6c250fe2
(cherry picked from commit b360931bf0f2d011dada18762829c0d0e47c54b6)
Change-Id: I0705ddf76b3c628127f65d75e0a8b06c6c250fe2
2019-08-24 00:04:18 +00:00
Jiyong Park
b360931bf0 Use filegroup to simplify Android.bp for frameworks and its friends
Java and AIDL source files under frameworks/base are now modularized
using filegroup. Each filegroup has 'path' property set to the base
directory of the ssource files. This allows us to not rely on
aidl.[local_]include_dirs and srcs_lib_whitelist_dirs to get the base
directories.

Bug: 70046217
Test: m
Change-Id: I0705ddf76b3c628127f65d75e0a8b06c6c250fe2
2019-08-22 20:07:38 +09:00
Makoto Onuki
62242c48e0 Introduce framework-minus-apex and create jobscheduler-framework.jar
Bug: 137763703
Test: Clean local build + "flash -w" and boot
Test: Presubmit
Test: atest CtsJobSchedulerTestCases
Test: ./cts/tests/signature/runSignatureTests.sh
Change-Id: Ie2a5a7a17f903ac18de0bcdde5be25311a62fa01
2019-08-12 18:11:57 +00:00
Jeff Sharkey
9edef25ede Detailed ContentProvider permissions checks.
The new MediaProvider design has an internal dynamic security model
based on the value stored in OWNER_PACKAGE_NAME, so the OS always
needs to consult the provider when resolving Uri permission grants.

Blocking calls from the system process like this are typically
discouraged, but this is the best we can do with the limited time
left, and there is existing precident with getType().

For now, use "forceUriPermissions" as a proxy for determining when
we need to consult the provider directly.

Bug: 115619667
Test: atest --test-mapping packages/providers/MediaProvider
Test: atest android.appsecurity.cts.ExternalStorageHostTest
Change-Id: I1d54feeec93fbb4cf5ff55240ef4eae3a35ed068
2019-07-12 09:27:41 -06: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
Paul Duffin
48cce27632 Merge "Export some api files for use by cts/tests/signature tests" am: 0a45ac2928
am: b5d6cc540c

Change-Id: If5179d1403e99ac2008cfeb89046eb486263817c
2019-06-03 08:15:50 -07:00
Paul Duffin
cd35de3507 Export some api files for use by cts/tests/signature tests
Creates a filegroup for each of these files:
* api/current.txt
* api/system-current.txt
* api/system-removed.txt
* test-base/api/current.txt
* test-mock/api/current.txt
* test-runner/api/current.txt

Bug: 122332514
Test: atest -p cts/tests/signature
Change-Id: Ib031dcc39d3c1cca6dcdf977c0277d5e4875591e
2019-06-03 11:56:35 +01:00
Svet Ganov
d8eb8b2690 Restricted permission mechanism - framework
This change adds a mechanism for restricting permissions (only runtime
for now), so that an app cannot hold the permission if it is not white
listed. The whitelisting can happen at install or at any later point.

There are three whitelists: system: OS managed with default grants
and role holders being on it; upgrade: only OS puts on this list
apps when upgrading from a pre to post restriction permission database
version and OS and installer on record can remove; installer: only
the installer on record can add and remove (and the system of course).

Added a permission policy service that sits on top of permissions
and app ops and is responsible to sync between permissions and app
ops when there is an interdependecy in any direction.

Added versioning to the runtime permissions database to allow operations
that need to be done once on upgrade such as adding all permissions held
by apps pre upgrade to the upgrade whitelist if the new permisison version
inctroduces a new restricted permission. The upgrade logic is in the
permission controller and we will eventually put the default grants there.

NOTE: This change is reacting to a VP feedback for how we would handle
SMS/CallLog restriction as we pivoted from role based approach to roles
for things the user would understand plus whitelist for everything else.
This would also help us roll out softly the storage permisison as there
is too much churm coming from developer feedback.

Exempt-From-Owner-Approval: trivial change due to APi adjustment

Test: atest CtsAppSecurityHostTestCases:android.appsecurity.cts.PermissionsHostTest
Test: atest CtsPermissionTestCases
Test: atest CtsPermission2TestCases
Test: atest RoleManagerTestCases

bug:124769181

Change-Id: Ic48e3c728387ecf02f89d517ba1fe785ab9c75fd
2019-04-07 22:39:54 -07: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
Bo Liu
58a57667e4 Add Context.bindService with executor parameter
Allow app to control the thread where ServiceConnection methods are
called on.

Bug: 111434506
Test: Used new bindContext method in chrome and checked callbacks
are on the correct thread.

Change-Id: I480e5bd6773a530fb9e8e73e3a2a2a88b76569ec
2019-03-06 20:21:45 +00:00
Paul Duffin
eec4726e3c Merge "Revert "Revert "Remove legacy-test and legacy-android-test targets""" am: e051b0c95e am: 643318f4d2
am: a8025a851d

Change-Id: Ibe9fce04c43c435764c313f64bf49e03fa826012
2019-02-26 04:16:34 -08:00
Paul Duffin
e051b0c95e Merge "Revert "Revert "Remove legacy-test and legacy-android-test targets""" 2019-02-26 10:59:54 +00:00
Paul Duffin
79d7ba2773 Revert "Revert "Remove legacy-test and legacy-android-test targets""
Fixes up the android.test.legacy target to stop using sources directly
now that the issue with android.test.runner-minus-junit not being able
to be built against the SDK has been resolved.

Also, fixes a couple of comments.

This reverts commit 7d7af10dc9057a49c617c7c97c174e8b4ec5008c.

Reason for revert: When this was originally applied it broke the
pi-dev-plus-aosp branch as it contained references to these targets.
Those references have now been removed.

Bug: 63127064
Change-Id: I619e92faf4cc38f8fd4f053bde832e9a76a2a2bf
Test: make checkbuild
2019-02-25 19:20:10 +00: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
Svet Ganov
c2841ec7fe Allow UiAutomation to adopt the shell permission indentity
For testing we often need to run shell commands. This can be done
today via running a shell command from an instrumentation test
started from the shell. However, this requires adding shell commands
which are not in the API contract, involve boilerplate code, require
string parsing, etc.

This change allows an instrumentation started from the shell to
adopt the shell UID permission state. As a result one can call APIs
protected by permissions normal apps cannot get by are granted to
the shell. This enables adding dedicated test APIs protected by
signatures permissions  granted to the shell.

Test: cts-tradefed run cts-dev -m CtsUiAutomationTestCases
          -t android.app.uiautomation.cts.UiAutomationTest#testAdoptShellPermissions

bug:80415658

Merged-In: I4bfd4b475225125512abf80ea98cd8fcacb6a1be
Change-Id: I4bfd4b475225125512abf80ea98cd8fcacb6a1be
2019-02-21 19:59:14 +00:00
Jakub Gielzak
e00505b90a Merge "Revert "Remove legacy-test and legacy-android-test targets"" am: 049c1589ee am: 7f997d4cfc
am: 95a9dc906f

Change-Id: I1034050336bdf8be84e3b86ae346dc4bfe1737ef
2019-02-18 10:51:09 -08:00
Jakub Gielzak
7d7af10dc9 Revert "Remove legacy-test and legacy-android-test targets"
This reverts commit 3b0be60307cc6063795f8cd32356745ee371e757.

Reason for revert: Broken build

Change-Id: I71270c7b47163ab7147029f2d3961d1848fdd9eb
2019-02-18 18:24:17 +00:00
Paul Duffin
0cc3064ada Merge "Remove legacy-test and legacy-android-test targets" am: 14daedf747 am: 4a83feb18a
am: 9248379c98

Change-Id: Ia409c6c4596269120386f8ae47d7f6379a1073bf
2019-02-18 07:44:41 -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
3b0be60307 Remove legacy-test and legacy-android-test targets
Fixes up the android.test.legacy target to stop using sources directly
now that the issue with android.test.runner-minus-junit not being able
to be built against the SDK has been resolved.

Also, fixes a couple of comments.

Bug: 63127064
Test: make checkbuild
Change-Id: If38fa0d87b36343896e97efb2269ac070810db84
2019-02-15 10:08:35 +00: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
Sudheer Shanka
a07b052eb4 Add Cursor.{set,get}NotificationUris.
Bug: 120879205
Test: manual
Test: atest cts/tests/tests/database/src/android/database/cts/AbstractCursorTest.java
Change-Id: If3be228dc6b08ea58d24c9209822f9d8c2348082
2019-01-26 11:19:34 -08: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