Commit Graph

6163 Commits

Author SHA1 Message Date
Jiyong Park
002fdbdb95 Support privileged vendor apps
Privileged apps can now be located in the vendor partition. This is
mainly to move SoC-dependent apks to the vendor partition so that the
system partition becomes more generic.

Like existing privileged apps in the system partition, the list of
privileged apps in the vendor partition and the permissions they are
using must be white-listed. The whitelist can be specified via
<privapp-permissions> tags in one of /vendor/etc/permissions/*.xml
files. Note: vendors can only white-list the apps in vendor partition,
but not the apps in system partition.

This change also introduces a new flag 'vendor-privileged' to the
permission protection level. It is used to expose platform-defined
permissions to the privileged vendor apps. If a platform permission does
not have this flag, it is not granted to vendor apps even when the app
is privileged and white-listed.

Bug: 35301609
Test: `mm` under frameworks/base/tests/privapp-permissions
adb sync && adb reboot
adb shell cmd package \
com.android.framework.permission.privapp.tests.vendor
shows that the app is installed.
android.permission.BIND_IMS_SERVICE is in the installed permissions list
android.permission.MANAGE_USE is not in the installed permissions list,
but is in the requested permissions list.

Change-Id: I196375aaaa9ea3a2ba15686ef08cf3f70ade7046
2017-11-30 14:41:55 +09:00
Andrii Kulian
4d26c21a82 Merge changes from topic "lifecycle_transaction_base"
* changes:
  Add transaction unit tests
  Add basic lifecycle transaction containers
2017-11-28 20:47:34 +00:00
TreeHugger Robot
c26f4c5678 Merge "Remove scanFile argument" 2017-11-28 18:37:55 +00:00
Andrii Kulian
6b9d3a1400 Add transaction unit tests
Bug: 64797980
Test: android.app.servertransaction.ClientTransactionTests
Test: android.app.servertransaction.TransactionParcelTests
Change-Id: I108bacc819e9d43d0a2f5a30338ae88674a53239
2017-11-27 18:15:49 -08:00
Jeff Sharkey
c204c223a7 Deeper sanity checking of emitted types.
When emitting a method or field, verify that we're able to reference
all mentioned types.  This ensures that we don't accidentally
reference undefined classes/interfaces.

Test: manual inspection of API files
Bug: 69791141
Change-Id: I84e0c87fe83daa118661f61dbdf17b58ea5282d4
2017-11-27 17:07:40 -07:00
Todd Kennedy
ddaaf4cf48 Remove scanFile argument
In several locations we were passing both a parsed Package object
and a scanFile File object. But, the Package object was parsed from
the scanFile! Instead, just pass the singular Package object and
pull the scanned file from it.

Bug: 63539144
Test: bit FrameworksServicesTests:com.android.server.pm.
Change-Id: Ibd200fb567e005869de61d9c123f211fa9a38f0a
2017-11-27 14:10:03 -08:00
Peter Visontay
79af02db03 Merge "Fix outdated docs of permission protection levels." 2017-11-23 11:06:46 +00:00
Christopher Tate
a732f014c5 The job scheduler now backs off jobs based on standby bucketing
The default parameters here translate to roughly this rate limiting:

  ACTIVE:   run jobs whenever
  WORKING:  ~ hourly
  FREQUENT: ~ every 6 hours
  RARE:     ~ daily

Bug: 63527785
Test: cts & manual (WIP)
      atest CtsJobSchedulerTestCases
Change-Id: I58f8e53e5bdf40601823e5a10a9f2383a6f67ae5
2017-11-22 22:07:06 +00:00
Peter Visontay
51fbad5a76 Fix outdated docs of permission protection levels.
1) Added deprecation notice to the 'system' and 'signatureOrSystem' protection levels.
These were deprecated in API Level 23:
https://developer.android.com/reference/android/content/pm/PermissionInfo.html#PROTECTION_SIGNATURE_OR_SYSTEM
https://developer.android.com/reference/android/content/pm/PermissionInfo.html#PROTECTION_FLAG_SYSTEM

2) Removed an outdated list of protection levels from PermissionInfo.protectionLevel's JavaDoc.
Its Javadoc has a link to an up-to-date list.

Test: Ran "make docs".
Change-Id: Ia6dc88ba3a66f248f60f010323d5ba40200c1cda
2017-11-22 20:31:14 +00:00
Todd Kennedy
916c83d227 Merge "Make sense out of scan & parse flags" 2017-11-22 20:02:48 +00:00
TreeHugger Robot
8377006984 Merge "Show warning when app was compiled against incompatible preview SDK" 2017-11-22 15:54:05 +00:00
Todd Kennedy
232d29e0cd Make sense out of scan & parse flags
Parse flags are often used confusingly to control policy during
APK parsing. Additionally, some flags [such as PARSE_IS_PRIVILEGED
or PARSE_IS_SYSTEM] aren't always determined based upon APK location
[they change based upon which apps are installed]. This means we
have to perform some gymnastics to set them correctly _before_
parsing a package.

Instead, these should be scan flags that can be determined at a
later point during package parsing. Then, based upon the scan flag
we apply policy on the package object to create the resulting
data structures.

Bug: 63539144
Bug: 69663125
Test: Manual; it builds, runs and applications can be installed / removed
Test: bit FrameworksServicesTests:com.android.server.pm.
Change-Id: I53fb18e58544e0a39f35eb6fb53c950e5c696aee
2017-11-22 15:39:04 +00:00
Alan Viverette
b6a25737d6 Show warning when app was compiled against incompatible preview SDK
Adds publicly-visible API for compile SDK version and codename. AAPT2 does
not support these yet, but that will be included in a follow-up CL.

Also refactors the Unsupported Display Size dialog out to a generic app
warnings manager class and fixes a bug there where the "always show"
preference was not persisted.

Improves documentation around threading and concurrency guarantees.

Bug: 64107584
Fixes: 68995409
Test: CtsActivityManagerDeviceTestCases
Change-Id: Ic86efa554b8b1caf80e5e004fda897d3483a68e8
2017-11-21 21:11:38 +00:00
Fyodor Kupolov
bc8d3e6049 Merge "Updated JavaDoc for onStartLoading" 2017-11-21 20:32:26 +00:00
TreeHugger Robot
0f02aeb66c Merge "Allow "cmd package bg-dexopt-job" to take a list of package names" 2017-11-18 04:37:45 +00:00
Arthur Eubanks
09dd1ec4b2 Allow "cmd package bg-dexopt-job" to take a list of package names
Modify "cmd package bg-dexopt-job" to accept an optional list of
packages to run bg-dexopt on to help with testing.

Test: make && flashall && automated tests (ag/2959616)
Test: adb shell cmd package bg-dexopt-job
Test: adb shell cmd package bg-dexopt-job pkg_name

BUG: 64807719
Change-Id: Ibf1fda88810dd4ec19fbbfe3322c35b201727707
2017-11-17 17:16:39 -08:00
Fyodor Kupolov
96481dee19 Updated JavaDoc for onStartLoading
Test: n/a
Bug: 68133232
Change-Id: I0c94913ac4510fff82787ee89ba29d6e66f3ba22
2017-11-17 15:30:03 -08:00
Peter Visontay
f702fd43b4 Add a link to the PackageInstaller API demos.
Test: Ran "make docs".
Change-Id: I8459bc2a4aaf3827f71a6af5478ff0f30fae6dc3
2017-11-17 14:19:46 +00: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
Philip P. Moltmann
81e46d9232 Doc that SharedPreferences is IO-expensive
Tried to find the right middle ground in between
- not exposing potentially changing implementation details
- being clear on what it is for and what not
- being too alarmist vs. being to weak

Test: compiled
Bug: 69177691
Change-Id: Ifb40e350a18bf72c113229f31e129b7e8fdacd2a
2017-11-15 13:31:56 -08:00
TreeHugger Robot
07201a7922 Merge "Enforce REQUEST_DELETE_PACKAGES for PackageInstaller.uninstall()" 2017-11-15 01:09:06 +00:00
Philip P. Moltmann
d9bb39abdf Enforce REQUEST_DELETE_PACKAGES for PackageInstaller.uninstall()
Fixes: 64576642
Test: Uninstalled apps
Change-Id: Ia7f3c047bb9c725228ca45e4c34e51a2d9177120
2017-11-14 14:37:38 -08:00
TreeHugger Robot
341775bfef Merge "Adds client API for interacting with statsd." 2017-11-14 20:25:09 +00:00
TreeHugger Robot
a379f499c8 Merge "Allow assistant app to access any shortcuts" 2017-11-14 18:41:50 +00:00
David Chen
adaf8b344e Adds client API for interacting with statsd.
This API will primarily be used by GmsCore to send updated configs.
Also, sending a config will implicitly notify the StatsD that this
client wants to know when it should request data for this config.

We send a broadcast so that all interested subscribers can know if
data needs to be pulled.

Test: Manually tested that sending broadcast works via new adb
command added in StatsService.

Change-Id: I23cdd1df706036e14b32c3d01af30c3d4af819fa
2017-11-13 19:37:12 -08:00
TreeHugger Robot
29cd580e4a Merge "Deprecate framework Fragments and Loaders" 2017-11-13 22:34:34 +00:00
Ian Lake
0a1feb8192 Deprecate framework Fragments and Loaders
Redirect developers to use the Support Library
versions of Fragments and Loaders to ensure that
they get consistent behavior across versions of
Android and all devices as well as access to
Lifecycle improvements.

Test: Confirmed APIs deprecated in current.txt
BUG: 68381801
Change-Id: I58ec599e557fc93c8547c45ba7c9ced96b0c8616
2017-11-13 10:55:59 -08:00
TreeHugger Robot
3bba35111e Merge "Introduce CrossProfileApps API" 2017-11-13 06:43:44 +00:00
Jeff Sharkey
cbc5867ede Merge "Allow blocking calls when protected against ANRs." 2017-11-10 06:01:40 +00:00
Jeff Sharkey
5918948db7 Allow blocking calls when protected against ANRs.
ContentProviderClient has a nice setDetectNotResponding() method
that detects hanging calls to remote providers, and it can trigger
an ANR to kill the app and release the blocked thread.

We typically don't want to perform blocking calls from the system
server, but we're okay allowing them on CPCs that are using
setDetectNotResponding() to watch for hung clients.

Test: builds, boots
Bug: 69128093
Change-Id: I223aaf1d0cef0f8dee28f800d9e3c101d7449952
2017-11-09 18:32:37 -07:00
Christian Williams
ce19db9e48 Merge "Add missing break to switch in resourceQualifierString()." 2017-11-09 22:58:36 +00:00
Makoto Onuki
35559d6125 Allow assistant app to access any shortcuts
Bug: 68760723
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -w -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases
Change-Id: I8c0f0ba1f01c1da7df44bb235abdaa94c36d86d3
2017-11-08 15:52:23 -08:00
Ricky Wai
1a6e667cb6 Add Network security watchlist service
Network security watchlist service is a service to monitor all potential
harmful network traffic. By setting a network watchlist, any connections
that visit any site from watchlist will be logged.

Logs will be aggregated everyday and encoded using differential
privacy before exporting it from framework.

This feature is disabled now, run "setprop ro.network_watchlist_enabled true" to enable it.

All network events are handled in an async bg thread, it should not
cause any delay in netd. Also, it uses the hooks in enterprise network logging,
so we can run netd_benchmark to measure the impact to netd.

Here are the things not included in this CL:
- ConfigUpdater to get and set watchlist
- Differential privacy encoding logic and reporting
- CTS
- Memory and performance optimization for internal watchlist data structure

Test: manual - turn on the feature, hard code a watchlist xml, process
that visited that domain is being logged in sqlite.
Test: run netd_benchmark - seems no obvious performance change.
Test: bit FrameworksCoreTests:android.net.NetworkWatchlistManagerTests
Test: runtest frameworks-net
Test: runtest frameworks-services -p com.android.server.net.watchlist

Bug: 63908748

Change-Id: I09595178bac0070a867bc5e0501a7bf2c840e398
2017-11-08 18:57:46 +00:00
Nikolas Bravo
6283100a87 Fixes javadoc documentation of PackageInstaller.SessionParams#setOriginatingUid(int)
* Current "See also" link in https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionParams.html#setOriginatingUid(int) is not only wrong, but also broken
* Added a missing "the"

Test: none
Change-Id: I90410ed3393b5c37afdf0476eb70821fae9f63fd
2017-11-07 21:11:40 +00:00
Christian Williams
b709f3c322 Add missing break to switch in resourceQualifierString().
Change-Id: Ia90b4dd6a2697896ac59fc93bbd61d0d9748f437
2017-11-02 17:19:27 -07:00
TreeHugger Robot
90a789e122 Merge "Give VoiceInteractionService access to shortcuts." 2017-11-02 22:26:40 +00:00
Jeff Davidson
5280b4205e Merge "Expose Intent#EXTRA_REASON as a SystemApi." 2017-11-02 20:10:18 +00:00
Dianne Hackborn
c160fa4cc4 Give VoiceInteractionService access to shortcuts.
The shortcut manager now has a set of additional packages that
have access, which the voice interaction system service feeds in
to.

Bug: 68760723
Test: CtsVoiceInteractionTestCases
Change-Id: I2a69f83569eb350f405bdd548998570ceef9ea7e
2017-11-02 10:51:03 -07:00
Sunny Goyal
b2985209fe Preventing recursive referrence in drawables am: 99b25d2817
am: ced997ec10

Change-Id: Iab88125b030bfe21aad82a1b287495cb9e3f54a2
2017-11-02 04:55:36 +00:00
Sunny Goyal
ced997ec10 Preventing recursive referrence in drawables
am: 99b25d2817

Change-Id: I1c23d40e590d6d8bb21f6734a106d0ee217b6672
2017-11-02 04:46:07 +00:00
Sunny Goyal
99b25d2817 Preventing recursive referrence in drawables
Bug: 68706673
Bug: 66498711
Test: Added CTS tests
Change-Id: I8034f49d16f9a7bc1749714fd6d6231bba5088d0
2017-11-02 04:31:12 +00:00
Bryce Lee
fbddd89e93 Merge "DO NOT MERGE Remove orientation restriction to only fullscreen activities." into oc-mr1-dev
am: 0be61c662b

Change-Id: I8db0cda8ce289423b9f63d3dc1b2598e951e1e2d
2017-11-02 01:14:49 +00:00
Jeff Davidson
a0c7d1fb3c Expose Intent#EXTRA_REASON as a SystemApi.
It's expected to be set with ACTION_FACTORY_RESET intents, and this
action was exposed as a @SystemApi in b/32974361.

Change-Id: Ib29ffb8d62460eb4ec0208076331bbba3272f290
Fixes: 67751036
Test: Just TreeHugger; no functional changes
2017-11-01 18:07:32 -07:00
Tony Mak
1b708e68b3 Introduce CrossProfileApps API
CTS will be in next CL.
APIs for labels/ icons of profile switching are not implemented yet.

Test: Wrote a test app to play around the APIs
Test: bit FrameworksServicesTests:com.android.server.pm.crossprofile.CrossProfileAppsServiceImplTest
BUG: 67765768

Change-Id: I27714aa4a8d61c6df398cbc5112cb4c35316a3fb
2017-11-01 10:11:51 +00:00
Bryce Lee
e83f34cde7 Remove orientation restriction to only fullscreen activities.
This changelist removes checks that enforce that only fullscreen,
opaque activities may request orientation changes. An application
may itself be compatible with the change and update their SDK level.
However, it is possible they use a library that has not itself been
updated and still leverages this feature for non-fullscreen
activities.

Change-Id: Ie1d300e3531fc8c588d2124dea698e4a876713c2
Fixes: 68684796
Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowTokenTests
2017-10-31 20:25:15 -07:00
Bryce Lee
a89b183ef9 DO NOT MERGE Remove orientation restriction to only fullscreen activities.
This changelist removes checks that enforce that only fullscreen,
opaque activities may request orientation changes. An application
may itself be compatible with the change and update their SDK level.
However, it is possible they use a library that has not itself been
updated and still leverages this feature for non-fullscreen
activities.

Fixes: 68684796
Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowTokenTests

Change-Id: Ib5a60f0b660ad145d07e953e541a0a1b801aeef2
2017-10-31 18:29:34 -07:00
Dianne Hackborn
ca3872ce36 Fully implement "install" and "install-write" in PackageManagerShellCommand.
We can use the new mechanism to ask the calling shell to open
a file in order to implement the rest of these commands, allowing
you to give the path to an apk to install.  That API is thus
extended to allow you to open readable files, not just opening
file for writing.

Doing this however means we no longer can pass a file path to
AssetManager for the apk to parse, we only have an already open
fd for that.  Extending AssetManager to allow adding apks from
fds is not that hard, however, since the underlying zip library
already supports this.

This main thing this changes is in AssetManager.cpp where we
retrieve the open zip file for a particular apk that has been
added.  This used to look up the zip file by path every time
it was needed, but that won't work anymore now that we can have
things added by fd.  Instead, we keep track of each opened zip
in the AssetManager, so we can just directly retrieve it from
the asset_path representing the item that was added.  As a
side-effect, this means for normal paths we no longer need to
look up by name, but just have the opened zip file directly
accessible.  (This is probably good, but it does mean that we
no longer run the logic of seeing if the zip file's timestamp
has changed and re-opening it if it has.  We probably shouldn't
be relying on that for an active AssetManager anyway, and maybe
it is even good that we don't allow the zip file to change
under it?)

A follow-up change will finally remove the Pm.java implementation
and turn the pm "command" into a simple shell script that runs
cmd package.

Test: manual

Change-Id: Ie103e3bdaa5b706796cc329254f2638151a3924f
2017-10-31 10:54:31 -07:00
TreeHugger Robot
34d4130fd4 Merge "Enable variation settings for fonts in XMLs" 2017-10-30 14:29:45 +00:00
Mihai Popa
690e62bb68 Enable variation settings for fonts in XMLs
Bug: 37853920
Test: bit FrameworksCoreTests:android.content.res.FontResourcesParserTest

Change-Id: I1acf9767fb1cecc5f4982b79405f92280b31bfa7
2017-10-30 11:48:54 +00:00
TreeHugger Robot
7b9f263781 Merge "Move grantPermission to permission manager" 2017-10-25 20:44:24 +00:00