1433 Commits

Author SHA1 Message Date
Makoto Onuki
4120ee3d44 Add ACTION_USER_RESTRICTIONS_CHANGED to protetced-broadcast.
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 CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.UserRestrictionsTest#testUserRestrictions_deviceOwnerOnly'
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 CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.UserRestrictionsTest#testUserRestrictions_primaryProfileOwnerOnly'
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 CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.UserRestrictionsTest#testUserRestrictions_secondaryProfileOwnerOnly'

Bug: 36355208
Change-Id: I7a002c1f796a3d1f6241577e6284a8e74bb96749
2017-03-22 17:50:45 -07:00
TreeHugger Robot
ac9e6f7453 Merge "Implement runtime account update notifications." 2017-03-22 02:19:28 +00:00
Fyodor Kupolov
d225f0bfd5 Support expiration of preloaded file cache
When device is provisioned, we delete all files from /data/preloads
except file_cache. We should do best effort to keep file_cache during
the first config_keepPreloadsMinDays. After that,
persist.sys.preloads.file_cache_expired is set to 1, which indicates
that cache can be deleted when additional storage space is requested.

Bug: 34690396
Test: Manual + RetailDemoModeServiceTest
Change-Id: Ie584a9dd6689bcc5e6b3cb448e95dfe5f73d2eeb
2017-03-21 16:51:25 -07:00
Dmitry Dementyev
8882d881f9 Implement runtime account update notifications.
Test: manual, cts.
Change-Id: Iaf9fe4814c3d3c2ca2dca0a5bfa0f997e060bfeb
2017-03-21 15:54:00 -07:00
Calin Juravle
91d40f1baa Set pm.BackgroundDexOptService as the source of true
The real dexopt maintainance job is
com.android.server.pm.BackgroundDexOptService, and not
com.android.server.BackgroundDexOptJobService

Partial revert of commit 096d304ae3d85c1bfcda1a1d9cd4eb13d0815500.

Test: manual inspection
Bug: 36140426
Change-Id: I983ac91117f107282095fa7eefdbce08e0dcfce3
2017-03-15 18:55:25 -07:00
TreeHugger Robot
bd7ae7df28 Merge "Basic accessibility support for picture-in-picture" 2017-03-11 01:52:51 +00:00
Phil Weaver
f00cd14f17 Basic accessibility support for picture-in-picture
Exposing actions from the PIP InputConsumer to accessibility,
stripping all actions from a covered PIP app, and adding the
InputConsumer's actions on the PIP app's root view.

We were also using an "undefined" accessibility ID to mean
three different things: a root view, a host view of a virtual
view hierarchy, and a truly undefined view. I've introduced
new values for cases where the id could be defined.

Also gathering all window IDs into one place to reduce the
chance of collisions.

Bug: 34773134
Test: In progress. Current cts passes.
Change-Id: I97269741a292cf406272bf02359c76c396f84640
2017-03-10 15:35:30 -08:00
Marie Janssen
4763c1b5ca Merge "Protect Bluetooth OPP ACCEPT and DECLINE broadcast" 2017-03-10 22:03:58 +00:00
Maurice Lam
95628d6d25 Merge "Add permission to show notification during setup" 2017-03-10 21:14:58 +00:00
Maurice Lam
132710e389 Add permission to show notification during setup
Add a priviledged permission NOTIFICATION_DURING_SETUP which together
with the existing Notification.EXTRA_ALLOW_DURING_SETUP will allow a
notification to be shown during setup.

Test: Added NotificationDataTest
Bug: 34705874
Change-Id: I7215acf4017ad897294c69abf63a7f2e5d556f31
2017-03-09 11:08:30 -08:00
Felipe Leme
640f30a776 Replaced auto-fill by autofill to keep it consistent with API style.
This change will affects 2 types of apps: autofill service implementations
and apps that use autofill APIs.

Since just the former is known to be used at the moment, we're not trying
to keep backward compatibility with the latter.

Bug: 35956626
Test: CtsAutoFillServiceTestCases pass
Test: android.provider.SettingsBackupTest pass

Change-Id: Ia720083508716deae9e887f9faa7ae7c5a82f471
2017-03-09 08:14:49 -08:00
Marie Janssen
71c52e6e30 Protect Bluetooth OPP ACCEPT and DECLINE broadcast
Non-system apps could send these, and accept OPP transfers without user
interaction.

Test: run POC code, see that it crashes instaed of accepting
Bug: 35258579
Change-Id: I37bf2e17b4d612258f9dbaa879727ac7c72e5969
2017-03-08 13:52:53 -08:00
Chad Brubaker
e45606d6c6 Expose ACCESS_INSTANT_APPS to the verifier
The package verifier needs to be able to see Instant Apps in order to do
its job. It already sees them on first install so no new information
about what Instant Apps are installed is leaked.

Test: builds
Change-Id: I5d892b2d7aa820a9c0c00ac357f20a3210cf3395
2017-03-06 13:14:01 -08:00
TreeHugger Robot
fa18d7cd71 Merge "Remove SystemApi from android.permission.REQUEST_NETWORK_SCORES." 2017-03-01 23:34:39 +00:00
TreeHugger Robot
247a3c0132 Merge "Introduce ANSWER_PHONE_CALLS permission" 2017-03-01 01:10:20 +00:00
Sunny Goyal
6d7cb23236 Sending explicit broadcast to the launcher when a package is installed
Test: Manually tested on device and add CTS tests
Bug: 32920609
Change-Id: Ic23c077a469fb41d6c4e123d4bc022899f634198
2017-02-28 12:55:59 -08:00
Jeremy Joslin
a9ad1d3af1 Remove SystemApi from android.permission.REQUEST_NETWORK_SCORES.
Copy/paste error, it's not needed.

Test: Built & run
Bug: 34250804
Change-Id: If9e0ff91e559bbcf278913cba47fd3d2073927b4
2017-02-28 16:59:56 +00:00
TreeHugger Robot
ffffb47569 Merge "Change internal intents from android.* to com.android.internal.*" 2017-02-27 20:34:21 +00:00
Eugene Susla
cae3d3e59e Introduce ANSWER_PHONE_CALLS permission
This exposes an API to answer a ringing call, as well as a corresponding
runtime permission and appop

Test: Grant the permission and ensure the call gets answered.
Deny the permission, and ensure that the API call throws an exception.
Bug: 30932767
Change-Id: I4c33fcea6b95a30469fa6c0c37090be32b0ad52e
2017-02-24 20:28:46 -08:00
Amit Mahajan
f5ee786475 Change internal intents from android.* to com.android.internal.*
Test: none
Bug: 35269293
Change-Id: I74585b3d6459cee613408d80fe4a3c13327e5dab
2017-02-24 13:29:37 -08:00
Adam Lesinski
aea3cf40d6 Whitelist new CHANGE_OVERLAY_PACKAGES permission
The Shell application needs access to change which overlays are
enabled in OverlayManagerService.

Test: Manual: invoke adb exec-out cmd overlay enable some.package.name
when shell is not root (adb unroot on eng builds).
Change-Id: I1849f68e244cfc9b1e13eb0e673dde7be03cba6d
2017-02-23 18:52:30 -08:00
Wale Ogunwale
791a887701 Updated some internal apps to use TYPE_APPLICATION_OVERLAY
TYPE_SYSTEM_ALERT is deprecated as of O.

Test: builds
Change-Id: Ic335ff0aa2f0356737c2e67debe8e71ea9eb2f41
2017-02-22 10:47:26 -08:00
Daniel Nishi
58229846d0 Merge "First pass at adding the cache quota suggestions." 2017-02-21 17:37:58 +00:00
TreeHugger Robot
4b441535c3 Merge changes Ie28325b6,I4e406a94
* changes:
  Display on-going notification for apps using alert windows.
  Set importance for processes displaying app-overlays based on visibility
2017-02-18 00:11:41 +00:00
Wale Ogunwale
387e4c6133 Display on-going notification for apps using alert windows.
Allows the user to associate alert windows with specific apps
and revoke the permission if they want.

Test: manual
Bug: 33256752
Change-Id: Ie28325b6bb799b3df253770ebe655f97ebbadd90
2017-02-17 13:45:24 -08:00
Daniel Nishi
cf9d19e030 First pass at adding the cache quota suggestions.
This currently integrates with installd, but not with
any framework API to expose this information to apps.

The first pass, as per the design doc, adds a service
which polls for large changes in the file system free space.
If enough spaces changes, it begins a recalculation of the
cache quotas and pipes the information down to installd.
This calculation is done in the updateable ExtServices.

Further enhancements in later patches include integrating this
to listen to package install and removal events, caching the
last computed quota values into an XML file on disk to load
on boot, and exposing the information to apps.

Bug: 33965858
Test: ExtServices unit test

Change-Id: Ie39f228b73532cb6ce2f98529f7c5df0839202ae
2017-02-17 10:26:16 -08:00
Julia Reynolds
1327d3c3fa Hide incomplete feature.
Test: make
Change-Id: I505a8ee2f2fbdb574f607005579832951f28022a
2017-02-17 11:20:45 -05:00
Svet Ganov
da0acdf938 Auto-grant background execution and data access
Companion apps can declare they want background access and
background execution exceptions via dedicated permissions
in their manifest. If such a permission is requested we
auto-grant the corresponding exception after the user has
chosen a device from the companion UI. These permissions
are appop ones allowing us to use the app ops for gauging
whether the user has made a change after we auto-granted
the permission since we would like to revoke these special
privileges when the app disassociates itself from the
companion device if the user did not make an excplicit
choice otherwise.

While at this auto-grant fixed location permission to the
companion device discovery service.

Test: manual

Change-Id: I46ee4291e5e5a8f7613f0dd75eb61d6b9341f306
2017-02-15 20:32:41 -08:00
Jeff Sharkey
500ce9ea58 Explicit API for allocating disk space.
Now that we're giving apps better guidance around how much cached
disk space they can use, we also need to provide a way to help clear
some of those cached files.  The final logic is coming in a future
CL, but it will be designed to prevent abuse.

Test: newly added CTS tests
Bug: 34690590
Change-Id: I1e46ade0cdabbc33162fc7bfa76abec711992f92
2017-02-12 04:02:28 -07:00
Chad Brubaker
b09ac24c3c Merge "Add permission for instant apps creating foreground services" 2017-02-09 21:33:19 +00:00
Chad Brubaker
97b383f5a5 Add permission for instant apps creating foreground services
Foreground services could potentially be abused to get around the
lifecycle requirements of Instant Apps, so limit that behavior with a
perission that will need to be granted by the installer.

Test: Manually verified
Change-Id: Ia162077971e914960ebdb8293a33faa8038ed850
2017-02-07 15:35:20 -08:00
TreeHugger Robot
95e76d7e3d Merge "Add android.permission.RESTRICTED_VR_ACCESS for privileged VR APIs." 2017-02-07 22:10:42 +00:00
Eugene Susla
6ed45d8cd3 CompanionDeviceManager
This introduces an API for apps that support companion devices to provide a
more streamlined flow for pairing and setting up the device

Bug: 30932767
Test: Using a toy app, invoke the newly introduced API (CompanionDeviceManager),
 and go through the flow. Ensure filtering works, and device is returned to
 the calling app. Ensure the calling app can pair to the selected device.
Change-Id: I0aeb653afd65e4adead13ea9c7248ec20971b04a
2017-02-06 12:50:55 -08:00
Svetoslav Ganov
096d304ae3 Add instant cookie APIs
This change adds APIs for instant apps to store cookie data
that is presisted across instant installs and across the
upgrade from an instant to a standard app. Standard apps
can use the cookie APIs but when they are uninstalled the
cookie is also deleted. The cookies are kept longer than
the instant apps as they are much smaller - 16KB by default.
We can change the cookie size via a system setting i.e.
after we ship we can increase size if needed.

We also add internal APIs to surface information about
installed and uninstalled instant apps which should be
used for showing them in the UI. For this puporse we store
the icon, permissions, and label of uninstalled apps. If
the app is re-installed we drop this meta-data but keep
the cookie around. If we have cookie data stored and the
signing cert of the app changes when it gets re-intalled
we wipe the cookie.

Test: CTS tests pass; hiddent APIs tested manually

Change-Id: If145c0440cc61a5303e2cbb70228d235d36037a5
2017-01-30 17:52:14 -08:00
Mårten Kongstad
eabc9e9576 OMS: introduce the OverlayManagerService
Add a new system service to manage Runtime Resource Overlays. This will
offload the PackageManagerService and allow administration of overlay
packages while affected packages continue to execute.

Overlays can be enabled or disabled during runtime. Running applications
will re-create their ResourcesImpl objects and restart their activities
via the usual activity life cycle.

The order in which a set of overlays is loaded may also be changed
during runtime. The underlying mechanics are the same as for when an
overlay is enabled or disabled.

When an overlay changes state, e.g. becomes enabled, the
OverlayManagerService will broadcast one of the new intents
android.intent.action.OVERLAY_ADDED, *_CHANGED, *_REMOVED or
*.OVERLAYS_REORDERED.

Clients that wish to read information about overlays for users other
than themselves are required to hold the
android.permission.INTERACT_ACROSS_USERS_FULL permission. This mirrors
the protection level of PackageManager.getPackageInfo.

Clients that wish to change the information are required to
hold the permission android.permission.CHANGE_OVERLAY_PACKAGES.

Each pair of overlay package and corresponding target package is
respresented by a new OverlayInfo class. This class mirrors the
existing PackageInfo class.

Overlay packages are handled per Android user. The data is persisted in
/data/system/overlays.xml.

Co-authored-by: Martin Wallgren <martin.wallgren@sonymobile.com>
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sonymobile.com>
Bug: 31052947
Test: run tests from 'OMS: tests for OverlayManagerService'
Change-Id: I15325e173193df3240b8dc0a58c852fd7a3d5916
2017-01-26 17:04:53 -08:00
TreeHugger Robot
bcf3b70371 Merge "Adding an api for apps to check whether they can install apps" 2017-01-26 07:35:33 +00:00
Brad Ebinger
0f4a8ba209 Merge "Adding Dynamic ImsService Binding (1/3)" am: 8e6b13a1c0 am: 64057ab972 am: 2741442324
am: ded1df24e0

Change-Id: Ifd95efa076b7f5c8c8b02be7688aab1008bbc63c
2017-01-26 01:56:25 +00:00
Brad Ebinger
ded1df24e0 Merge "Adding Dynamic ImsService Binding (1/3)" am: 8e6b13a1c0 am: 64057ab972
am: 2741442324

Change-Id: Ibd5c988226e7994c332a7e7f8b40a9338cf84e0f
2017-01-26 01:49:53 +00:00
Brad Ebinger
2741442324 Merge "Adding Dynamic ImsService Binding (1/3)" am: 8e6b13a1c0
am: 64057ab972

Change-Id: I901c72a38b522c190e849de55078036adc80d8b6
2017-01-26 01:46:06 +00:00
Suprabh Shukla
aef2513c71 Adding an api for apps to check whether they can install apps
Some apps may want to check whether they are trusted to install apps on
the device, so they can prompt the user to go to settings and mark them
as trusted before they do an intensive operation like downloading an
apk.

Test: cts-tradefed run cts -m CtsExternalSourcesTestCases

Bug: 31002700
Change-Id: Icd9d04daa157e6733decba245ec251ce4acd4122
2017-01-25 17:26:02 -08:00
Brad Ebinger
024aaf2388 Adding Dynamic ImsService Binding (1/3)
Adds support for dynamic ImsService Binding (change 1/3). Included
in this change:
- AIDLs for ImsServiceController
- ImsFeature/ImsServiceBase definitions
- KEY_CONFIG_IMS_PACKAGE_OVERRIDE CarrierConfig option

Test: Unit Tests in opt/telephony
Bug: 30290416
Change-Id: Ic4cb1d85a29681b08a6a525c588a72209862dcc3
2017-01-25 15:12:28 -08:00
Julia Reynolds
717ca4b07d Merge "Allow notifications to be autocanceled at a time." 2017-01-25 16:03:38 +00:00
Julia Reynolds
2a128746b3 Allow notifications to be autocanceled at a time.
Test: cts
Change-Id: I24ebcab2c0fa2028ec5d2984dc3b7ec19391b590
2017-01-25 09:28:01 -05:00
Edman Anjos
f994677626 Refactor DPMS Cert Installer and App Restrictions delegation.
The DevicePolicyManagerService currently supports delegation of
certificate installation and application restriction management, both
of which are individually handled by DPMS.

Upcoming framework features will add four more delegation types,
namely: block uninstall; app permission management; app access
management; and system app enabler. At this moment it makes sense to
refactor the underlying delegation system in DPMS so that current and
future delegates can be handled in a more generic way.

Bug: 33099995
Test: DPMS unit tests
Change-Id: I9e350143572c6690febdd59d1ed5149af8ee4388
2017-01-25 13:00:40 +01:00
TreeHugger Robot
b7cab6a190 Merge changes from topic 'bisto-request'
* changes:
  Allow privileged app to set media key event listener
  Allow privileged app to set volume key long-press listener
2017-01-25 01:16:32 +00:00
Karthik Ravi Shankar
246b4144f1 Add android.permission.RESTRICTED_VR_ACCESS for privileged VR APIs.
Bug: 34682109
Change-Id: I65dc7aeaaceefad470adea8313e1d81c86ad233d
Signed-off-by: Karthik Ravi Shankar <karthikrs@google.com>
2017-01-24 13:47:27 -08:00
Jaewan Kim
6e2b01ce75 Allow privileged app to set media key event listener
If the media key listener is set, the listener will receive the media key
events before any other sessions, but after the global priority session.
If the event is handled by the listener, other sessions cannot get the event.

Privileged app needs permission android.permission.SET_MEDIA_KEY_LISTENER
to set the listener.

Bug: 30125811
Change-Id: I2b2cf4ac7873b70899194701c6921990dcb9de02
2017-01-24 09:41:54 -08:00
Jaewan Kim
5026936e49 Allow privileged app to set volume key long-press listener
If the volume long-press listener is set, the listener will receive
the volume key long-presses instead of chaging the volume.

Privileged app needs permission
android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER to set the listener.

Bug: 30125811
Change-Id: I5e8fafbb950e5e11522da0f14004648d0877bf3e
2017-01-24 09:41:43 -08:00
Jeff Schumacher
b16bddca89 Merge "Opened some App Links APIs to @SystemApi" 2017-01-23 18:50:16 +00:00
Svet Ganov
6788212d17 Platform support for static shared libraries
This change adds support for static shared libraries that
emulate static linking allowing apps that statically link
against the same library version to share a common
implementation. A library is hosed by a package in a standard
APK.

Static shared libraries have a name and a version declared
by a dedicated manifest tag. A client uses also a new tag
to refer to the static library it uses by specifying the
lib name, version, and the hash of the signing certificate.
This allows two apps to rely on two different library versions
and prevents impersonation of the shared library by a side-loaded
app with the same package name.

Internally apps providing static libs use synthetic package
name generated from the manifest package name and the library
version. This allows having different "versions" of the same
package installed at the same time.

An application cannot be installed if a static shared lib it
depends on is missing. A used shared library cannot be uninstalled.
Shared libraries can rotate certificates like normal apps. The
versions of these libs should be ordered similarly to the version
codes of the hosting package. Such libs cannot use shared user
id, cannot be ephemeral, cannot declare other libraries, cannot
rename their package, cannot declare child-packages. They must
target O SDK. Also they cannot be suspended or hidden or their
uninstall blocked. Generally, speaking policy regarding code in
static shared libs should be applied to the packages using the
library as it could have just statically linked the code.

We now have APIs to query information about the shared libraries
on the device in general. To clients static shared libraries are
presented as multiple versions of the same package which is how
they are declared and published. Therefore, one can have two
versions of the same package which means we need way to query
for and uninstall a specific version of a package. Also static
shared libs can depend on other static shared libs which are
versioned packages. To ease representation we add the concept
of a versioned package which should be used in the case of
static shared libs.

A client can see only the static shared libs it depends on and
more specifically only the versions it depends would be retrieved
by using the standard package manager APIs. There is a new
dedicated API to get info about all shared libraries which
would provide data about all static shared lib versions. Also
these libraries must use v2 signing scheme.

Test: CTS tests pass

bug:30974070

Change-Id: I4f3d537ee7a81f880950377b996e1d9d4813da5c
2017-01-22 14:05:15 -08:00