Commit Graph

9543 Commits

Author SHA1 Message Date
Automerger Merge Worker
bcb6c7aff5 Merge "Merge "Deprecate docs for auto revoke manifest and Intent APIs" into rvc-dev am: c43f49dfc4 am: 5ec84ee3a3 am: de433322e2" into rvc-qpr-dev-plus-aosp am: 1a593e5ee6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11722408

Change-Id: If4436bcd35962f297dbe12e147fcb6462007306f
2020-06-04 01:57:27 +00:00
Eugene Susla
de433322e2 Merge "Deprecate docs for auto revoke manifest and Intent APIs" into rvc-dev am: c43f49dfc4 am: 5ec84ee3a3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11722408

Change-Id: Ic33f82bceb3257f976bac23640c61edc6739f808
2020-06-04 01:36:26 +00:00
Eugene Susla
c43f49dfc4 Merge "Deprecate docs for auto revoke manifest and Intent APIs" into rvc-dev 2020-06-04 01:08:10 +00:00
Eugene Susla
c7cae60a64 Deprecate docs for auto revoke manifest and Intent APIs
Test: presubmit
Bug: 153607914
Change-Id: I9c8d0aa1432ca00b729f19749e751cb117374b0a
2020-06-03 13:46:00 -07:00
Winson Chiu
5b66a3d0eb Merge "Fix up discrepancies between v1 and v2 package parsing" into rvc-dev-plus-aosp 2020-06-03 20:41:27 +00:00
Ashwini Oruganti
e8728dbf78 Merge "Require explicit android:exported in manifests" 2020-06-03 17:53:57 +00:00
TreeHugger Robot
44c8645f27 Merge "Add PackageInstaller SessionParams restrictions" into rvc-dev am: a817a0515e am: 0310dbe4fc am: 3de943756f am: 304cd07d0b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11621266

Change-Id: Ic5271e7297504f480d571f4c0cb2c248e78f74b1
2020-06-03 17:31:36 +00:00
Winson
10d51880e2 Add PackageInstaller SessionParams restrictions
To mitigate a boot loop with reading a massive
install_sessions.xml file, this restricts the amount of
data that can be written by limiting the size of
unbounded parameters like package name and app label.

This introduces a lowered max session count. 50 for general
applications without the INSTALL_PACKAGES permission, and
the same 1024 for those with the permission.

Also truncates labels read from PackageItemInfo to 1000
characters, which is probably enough.

These changes restrict a malicious third party app to ~0.15 MB
written to disk, and a valid installer to ~3.6 MB, as opposed to
the >1000 MB previously allowed.

These numbers assume no install granted runtime permissions.
Those were not restricted since there's no good way to do so,
but it's assumed that any installer with that permission is
highly privleged and doesn't need to be limited.

Along the same lines, DataLoaderParams are also not restricted.
This will have to be added if that API is ever made public.

However, installer package was restricted, even though the API is
hidden. It was an easy add and may have some effect since the value
is derived from other data and passed through by other system
components.

It's still possible to inflate the file size if a lot of
different apps attempt to install a large number of packages,
but that would require thousands of malicious apps to be installed.

Bug: 157224146

Test: atest android.content.pm.PackageSessionTests

Change-Id: Iec42bee08d19d4ac53b361a92be6bc1401d9efc8
2020-06-02 12:58:53 -07:00
Winson
4548256900 Fix up discrepancies between v1 and v2 package parsing
For Activity aliases, it's possible some values are already
set, which means they cannot be assumed to be 0, and can't be
overwritten if a attribute in the alias is undefined. For the
parsing v2 refactor, this was cleaned up to avoid
redundant != 0 checks, but those checks are indeed necessary.
This copies over the old logic and uses it exactly.

In some future cleanup, there should be a more structured way
of doing this, since it's not immediately obvious which values
are overridden or not. For example, description is always
overwritten even if no new value is provided in the alias.

This also fixes up the comparison tests and other bugs that
popped up because of them. The core issue was that when
auto-generating the dumpToString methods, the Alt+Insert
macro default selects all the fields in the current class,
but not all the parent classes, so some shared fields like
name/icon were not considered.

A notable case that was found when running the comparison tests
is that persistableMode is now "fixed" with v2. Previously,
a bug in PackageParser caused this value to be dropped if
the ActivityInfo object ever had to be copied. This is a change
from Q behavior, but there's no good way to reconcile this, and
it's better to be correct and consistent than broken, so this
fix was left in and excluded from the comparison tests.

Bug: 150106908

Test: manual run through steps in bug
Test: atest com.android.server.pm.parsing

Merged-In: I1301e28540314d0e643b73af7146c1a366eca6b5
Change-Id: I1301e28540314d0e643b73af7146c1a366eca6b5
2020-06-02 18:25:01 +00:00
TreeHugger Robot
5dbe9b099f Merge "Fix up discrepancies between v1 and v2 package parsing" 2020-06-02 15:50:33 +00:00
Zimuzo Ezeozue
5fd1767ab1 Merge "Support apps sharing file:// URIs with the camera API" into rvc-dev am: efbc3f2d5e am: d371efcfb2 am: 46ca9f3ddd am: b8dd27d216
Original change: undetermined

Change-Id: I7b34b29c6cef114420491bb1710f240e38b3981d
2020-06-02 11:37:20 +00:00
Zimuzo Ezeozue
efbc3f2d5e Merge "Support apps sharing file:// URIs with the camera API" into rvc-dev 2020-06-02 10:45:33 +00:00
Automerger Merge Worker
463207a1e8 Merge "Merge "[wm] Introduce meta-data tag (android.supports_size_changes)" into rvc-dev am: 247144d4a2 am: 925463ba53 am: e9f14eeb22" into rvc-qpr-dev-plus-aosp am: 66b1ad0ddf
Original change: undetermined

Change-Id: I531d037518115630bb7d7a1eeef4cb31ccca9c19
2020-06-01 22:12:23 +00:00
Zim
c7496a3a62 Support apps sharing file:// URIs with the camera API
The camera API, MediaStore.ACTION_IMAGE_CAPTURE requires apps to pass
a content:// URI with write permissions to the camera. Unfortunately,
apps haven't been doing this and we only started hitting problems in R
for two reasons:
1. The FileUriExposedException that should crash apps when they try to
share file:// URIs acroos binder is skipped. This is because, the
image_capture intent is passed across binder as a field in a
ChooserActivity Intent and the child intents are not checked for
file URI exposed
2. Prior to R, when camera gets a file:// URI, camera issues a file
open(2) in its process. This open(2) succeeds because the camera had
write_external_storage permission which gave it write access to all
files on external storage

Now, camera targets R and (2) fails because camera does not have write
access to files owned by other apps. To workaround, we do the
following in the apps process when it targets < R:
a. When we detect a file:// URI for the camera in an Intent, we create
the file on disk if it is not already created.
b. Scan the file to insert it in the database and retrieve a
content:// URI
c. Replace the file:// URI with the content URI in the image_capture
intent

This works because, the system will ensure the camera is granted write
access to the content URI.

Test: Manual
Bug: 156336269
Change-Id: I4849ff5e806a8207650ff7534846c36ecdc6d3c0
2020-06-01 20:33:52 +01:00
Winson
66e9f33cc5 Fix up discrepancies between v1 and v2 package parsing
For Activity aliases, it's possible some values are already
set, which means they cannot be assumed to be 0, and can't be
overwritten if a attribute in the alias is undefined. For the
parsing v2 refactor, this was cleaned up to avoid
redundant != 0 checks, but those checks are indeed necessary.
This copies over the old logic and uses it exactly.

In some future cleanup, there should be a more structured way
of doing this, since it's not immediately obvious which values
are overridden or not. For example, description is always
overwritten even if no new value is provided in the alias.

This also fixes up the comparison tests and other bugs that
popped up because of them. The core issue was that when
auto-generating the dumpToString methods, the Alt+Insert
macro default selects all the fields in the current class,
but not all the parent classes, so some shared fields like
name/icon were not considered.

A notable case that was found when running the comparison tests
is that persistableMode is now "fixed" with v2. Previously,
a bug in PackageParser caused this value to be dropped if
the ActivityInfo object ever had to be copied. This is a change
from Q behavior, but there's no good way to reconcile this, and
it's better to be correct and consistent than broken, so this
fix was left in and excluded from the comparison tests.

Bug: 150106908

Test: manual run through steps in bug
Test: atest com.android.server.pm.parsing

Change-Id: I1301e28540314d0e643b73af7146c1a366eca6b5
2020-06-01 17:52:58 +00:00
Kwangho Lim
2141f707b7 [wm] Introduce meta-data tag (android.supports_size_changes)
Introduce meta-data tag "android.supports_size_changes" which will indicated that an activity works well with size changes like display changing size.

Test: Manual - Run by adding metadata to the app running with SizeCompatMode.
Bug: 155041354
Change-Id: I0f358f63c9e14c63294275c0bfcd08744bee1108
2020-06-01 08:34:38 -07:00
TreeHugger Robot
92cb1b7124 Merge "Add test for permission APEX." into rvc-dev am: e40b321ee6 am: 7a4f041cc0 am: fc5d27390c am: a82376011e
Change-Id: Iac0ef2d1dc0bb8067585c216ea9b315a8a18e60b
2020-05-29 22:37:51 +00:00
Ashwini Oruganti
c4e90ac06a Require explicit android:exported in manifests
Starting S+, if an intent filter is defined, we are requiring that the
android:exported flag also be explicitly defined in the manifest. With
this change apps targeting S+  that do not meet this requirement will
fail to install.

There is no change in the default behavior of the `android:exported`
flag when there is no intent filter defined (i.e. the flag defaults to
false in these cases).

Bug: 150232615
Test: Flashed the build on a device and tested with test apps
Change-Id: I36efeebf28f21a4d4277f40a17e38d2183514037
2020-05-29 14:48:28 -07:00
TreeHugger Robot
e40b321ee6 Merge "Add test for permission APEX." into rvc-dev 2020-05-29 21:40:19 +00:00
Ryan Mitchell
fd30295b29 Merge "Install system app in greatest priority partition" into rvc-dev am: d32418a72a am: d5bfbd0f27 am: 4053dfca5e am: cedef20a54
Change-Id: I3785b1e11a70127cd30b080e9a26b527f738ddc8
2020-05-29 18:29:29 +00:00
Ryan Mitchell
d32418a72a Merge "Install system app in greatest priority partition" into rvc-dev 2020-05-29 18:05:31 +00:00
TreeHugger Robot
a13e6aac3d Merge "Add DPC restriction for INTERACT_ACROSS_PROFILES to javadoc." into rvc-dev am: d220529254 am: 6939118f43 am: c8d970b2c2 am: bfb1d705eb
Change-Id: I4cc5087eb603ba021af84a583de29f75ad71cd2b
2020-05-29 14:00:42 +00:00
TreeHugger Robot
d220529254 Merge "Add DPC restriction for INTERACT_ACROSS_PROFILES to javadoc." into rvc-dev 2020-05-29 13:22:27 +00:00
Alex Kershaw
4da9c2097d Add DPC restriction for INTERACT_ACROSS_PROFILES to javadoc.
Fixes: 157229284
Test: Javadoc only
Change-Id: I21f6276ba08e62c1f17a279241838fdbd352c8d8
2020-05-29 12:43:08 +01:00
Hai Zhang
3562068af9 Add test for permission APEX.
Bug: 152055112
Test: atest PermissionApexTests
Change-Id: I4201501d586fe62df7a04d0e2da955d6d873d3df
2020-05-28 16:19:07 -07:00
Ryan Mitchell
d4e7f93df5 Install system app in greatest priority partition
On Pixel 2 devices, /product is a symlink to /system/product. The
product partition has a higher partition precedence than the system
partition so the app should be installed as a system app on the product
partition.

This change also unifies methods for checking whether a file is within
a partition so we will paths will always be canonicalized before the
check.

Bug: 152522330
Test: update system app in system/product/privapp, uninstall updates,
      verify that the app was scanned as privileged
Change-Id: I646a5f293b977a78daa2102b73f1d3122f774a2a
2020-05-28 16:06:30 -07:00
TreeHugger Robot
a00402bb70 Merge "Remove InstantAppResolverTests for migration to CTS" into rvc-dev am: f37b09335f am: 38a9ac0ff4 am: 538f254eec am: a9196432f5
Change-Id: Ifd8ca2bb20d50a7011d03bf876c00775a00f8cf7
2020-05-28 01:29:26 +00:00
TreeHugger Robot
f37b09335f Merge "Remove InstantAppResolverTests for migration to CTS" into rvc-dev 2020-05-28 00:23:16 +00:00
Mehdi Alizadeh
8162d716e6 Merge "Adds cacheFlags parameter to cache/uncacheShortcuts() methods" into rvc-dev am: c95be6995a am: 366d6c10f1 am: 987fa9cdcf am: 7f155cc487
Change-Id: I4f79117d9800a712cd0b632cd37a073509a9c1e9
2020-05-27 19:59:32 +00:00
Mehdi Alizadeh
c95be6995a Merge "Adds cacheFlags parameter to cache/uncacheShortcuts() methods" into rvc-dev 2020-05-27 19:23:39 +00:00
JW Wang
ef4cfd9bcf Merge "Clean up the code that deletes snapshots by inode (1/n)" 2020-05-27 02:24:56 +00:00
TreeHugger Robot
4e87878de5 Merge "Camera: Extend FEATURE_CAMERA_CONCURRENT to old API levels" into rvc-dev am: 80a18c0a7b am: 5600e116c1 am: 6a83a9a509 am: eba4a0383f
Change-Id: I8596328eb0d642f395f33b2d2a399cd35c4dc92a
2020-05-27 01:43:29 +00:00
TreeHugger Robot
80a18c0a7b Merge "Camera: Extend FEATURE_CAMERA_CONCURRENT to old API levels" into rvc-dev 2020-05-27 00:45:04 +00:00
TreeHugger Robot
9056ffab54 Merge "Add CarrierAppUtils integration test to PackageManager presubmit." 2020-05-26 23:29:50 +00:00
Automerger Merge Worker
9551c5aac9 Merge "Merge "Address edge cases for signing certificate lineages in sharedUids" into rvc-dev am: 2046776127 am: 3cdc8fbdb2 am: 0a0ef10023" into rvc-qpr-dev-plus-aosp am: 26b5c31032
Change-Id: I99ac9fa3e84e854cccb0a457d7d7f2f20360d4b5
2020-05-26 16:34:13 +00:00
Michael Groover
2046776127 Merge "Address edge cases for signing certificate lineages in sharedUids" into rvc-dev 2020-05-26 16:07:57 +00:00
Mehdi Alizadeh
a3d22cec32 Adds cacheFlags parameter to cache/uncacheShortcuts() methods
Bug: 155135890
Test: atest ShortcutManagerTest1 ShortcutManagerTest11 \
            ConversationInfoTest DataManagerTest \
            NotificationManagerServiceTest
Change-Id: Idda777ba032546bd616ee3079b9c8dc8676dc589
2020-05-26 03:30:55 +00:00
Michael Groover
f1744af7ed Address edge cases for signing certificate lineages in sharedUids
Currently when a package is installed / updated in a sharedUid the
signatures for the sharedUid are not updated unless the new package
adds a new signer to the lineage; in this case the new lineage is
assigned to the sharedUid without consideration for the existing
lineage. This leads to the following problems:

1. If the current sharedUid lineage is A -> B and the new package has
lineage B -> C then this is used for the sharedUid and A is lost from
the lineage.
2. If the new lineage revokes one or more capabilities from a previous
signer in the lineage these updated capabilities are ignored unless the
lineage added a new signer as well.
3. If the new lineage revokes the sharedUid capability from a previous
signing key in the lineage and another app is installed as part of the
sharedUid and signed with that key the new app's installation is allowed
to proceed.
4. If only a single app is installed as part of a sharedUid, and that
app is updated with a rotated key and a lineage that revokes the
previous signing key's sharedUid capability the update is blocked.
5. If an app is installed as part of the sharedUid and has a diverged
signer in the lineage (ie sharedUid lineage is Y -> A -> B and new app
lineage is Z -> A -> B -> C) the installation is allowed and Y is lost
from the lineage.

Problems 1 and 2 are addressed with the new SigningDetails
mergeLineageWith method that merges common signers between two lineages
and also updates their capabilities to the most restrictive between
the two lineages (capabilities are anded together). Problems 3 is
addressed by checking the signatures of each of the packages in the
sharedUid for any signed with an ancestor for which the sharedUid
capability may have been revoked. Problem 4 is addressed by checking
if the package being updated is the only one in the sharedUid; if so
the update to the new lineage is allowed to proceed. Problem 5 is
addressed by verifying the new app's lineage is the same, a subset, or
a superset of the other.

Bug: 152046935
Test: atest PkgInstallSignatureVerificationTest
Test: atest SigningDetailsTest
Test: atest PackageManagerTests
Test: atest PackageManagerTest
Change-Id: I420c309f522bb47b65ca40ee848024c85cd5804d
2020-05-22 23:50:52 +00:00
TreeHugger Robot
0bc9fb5814 Merge "Don't truncate an app's own label when forcing safe label." into rvc-dev am: 2f988b5a82 am: a98609c3b9 am: 498366bb1c am: 4a3c82a7a4
Change-Id: I44ca503d57b1d3d1b6faa13702ee7e64c333d501
2020-05-21 20:47:47 +00:00
Julia Reynolds
6304878212 Merge "Update conversation labels" into rvc-dev am: 28c3a34faa am: c9bf62b6fe am: c31eb3260f am: 8f0cbb4498
Change-Id: I4dfacbc5543b0cf096a49eee7f8a1c069ec4daf3
2020-05-21 20:11:16 +00:00
TreeHugger Robot
2f988b5a82 Merge "Don't truncate an app's own label when forcing safe label." into rvc-dev 2020-05-21 19:06:51 +00:00
Winson
badad7b62f Remove InstantAppResolverTests for migration to CTS
See change I79b7c42e8a495c0f4ba4cd42a076ac3b43ee2919

Bug: 155114274
Bug: 155115137
Bug: 155115845
Bug: 155116506
Bug: 155116748
Bug: 155117421

Test: atest CtsInstantAppTests

Change-Id: I09023d098c93758c049169a909c27c230bb3dd9b
2020-05-21 11:50:43 -07:00
Hai Zhang
5177cfa1bd Don't truncate an app's own label when forcing safe label.
Fixes: 152973001
Test: manually confirm default apps title isn't truncated in RU.
Change-Id: Ic54ea66fa4b9117d633b58838465adfb9d2ae7fa
2020-05-20 14:51:00 -07:00
Julia Reynolds
8d34af82ac Update conversation labels
By adding a util method that prefers longlabel and
falls back to shortlabel.

Test: atest
Bug: 157140669
Change-Id: Ib7229b75b7a8ab87274e9aab1c7816129f04e505
2020-05-20 17:03:35 -04:00
TreeHugger Robot
a75467031a Merge "Fix parsing sCachedPackageReadCount" into rvc-dev am: db48450e84 am: 863059a635 am: 2126d201f6 am: 9180d9b395
Change-Id: I839a55d0ecf37e65dc34e4422beb24ddf4859c8d
2020-05-19 19:25:14 +00:00
TreeHugger Robot
db48450e84 Merge "Fix parsing sCachedPackageReadCount" into rvc-dev 2020-05-19 18:57:33 +00:00
Winson
46220780ba Fix parsing sCachedPackageReadCount
This was moved to PackageCacher, but the old and unused counter
was not removed.

Bug: 154310064

Test: manual device reboots and logs cached count >0

Change-Id: I32fdb4b8fccd281fe61c64f231cb0ba154934679
2020-05-19 09:37:36 -07:00
JW Wang
16d49b4003 Clean up the code that deletes snapshots by inode (1/n)
Per b/147806409, the old code to delete snapshots by inode didn't work.
There is no point in storing mCeSnapshotInodes inside
PackageRollbackInfo. Let's remove related code.

TODO: fix ApexManager/Installer APIs that have unused parameter/return
values.

Bug: 154897348
Test: atest RollbackStoreTest RollbackUnitTest AppDataRollbackHelperTest

Change-Id: I66357c22607bfffbe4d9f55fc13c4c657d5f700c
2020-05-19 17:27:37 +08:00
Patrick Baumann
1a2a730d4d Merge "Doc update re use of MATCH_UNINSTALLED flag" into rvc-dev am: ce6252e5a4 am: 756e0cb1b9 am: 317ffa96e0 am: 0564a89529
Change-Id: I5dade459f1d5f43dfe74bfceda7fa1d4e44490c8
2020-05-18 22:33:30 +00:00
Patrick Baumann
ce6252e5a4 Merge "Doc update re use of MATCH_UNINSTALLED flag" into rvc-dev 2020-05-18 21:31:02 +00:00