1746 Commits

Author SHA1 Message Date
Nicolas Prevot
d37c4a99b2 Allow DO to provision even if it has set disallow remove mp.
If the device owner has set DISALLOW_REMOVE_MANAGED_PROFILE,
and there is already a managed profile:
it should be allowed to provision a new managed profile by
deleting the old one.
Test: adb shell am instrument -e class
com.android.server.devicepolicy.DevicePolicyManagerTest
-w
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
BUG:34116228

Change-Id: I9e6f39924107aee40b57d22e638487a1ea3132de
2017-01-24 16:36:14 +00:00
Nicolas Prevot
45d2907863 Update DPM unit tests checking isProvisioningAllowed for comp.
Two of the tests were actually checking the same thing. Removed one.
Refactore another test to make it easier to read.

Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest
-w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
BUG:32629873

Change-Id: Id4ca9bd8c113a858b016fb02d04bf4c76bbcb027
2017-01-24 16:35:58 +00:00
Jorim Jaggi
829b9cd100 Fill task snapshot with background color
Make sure to fill the portions that are not covered by the
snapshot are filled with the task background color.

Also fix an issue where the starting window was removed across
configuration changes.

Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotSurfaceTest
Bug: 31339431
Change-Id: I2451be87aff79b337015ab4bba72cfa03c0d3582
2017-01-24 16:19:31 +01:00
Julia Reynolds
924eed1ca6 Add updatable fields to Ranking
- NotificationChannel
- Badging

Test: runtest systemuinotification & cts

Change-Id: I7fd1f2dc06148927e9a4bd5b760d436e2c5e8a98
2017-01-24 08:43:38 -05:00
Jorim Jaggi
9bafc7150e Starting window tests, yay!
Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowContainerControllerTests
Fixes: 34364463
Fixes: 34361417
Change-Id: Ie1b8debc894e5cad8fe517912a1991a38661dfaa
2017-01-24 14:12:42 +01:00
Hongming Jin
7439b7cb61 Merge "Test: AccountManagerService APCT test." 2017-01-24 00:50:22 +00:00
Hongming Jin
c1a892a967 Test: AccountManagerService APCT test.
Add tests for startUpdateCredentials, finishSession and isCredentialsUpdateSuggested.

Bug: 31346530
Change-Id: I8c93b6b0db50086a83894eadfcf6a2398be81b6c
2017-01-23 15:20:54 -08:00
TreeHugger Robot
6500b1450d Merge "Do not allow ephemeral apps to access ShortcutManager" 2017-01-23 22:24:48 +00:00
TreeHugger Robot
0fd8eb2342 Merge "Better error message for privapp-permissions test" 2017-01-23 20:53:24 +00:00
Makoto Onuki
66e4a2b801 Do not allow ephemeral apps to access ShortcutManager
Bug: 34178279
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: I5672f15705a1bf6568a8df58b66e48c802c11852
2017-01-23 12:20:29 -08:00
TreeHugger Robot
eeb4e1d219 Merge "Change WebView fallback mechanism to consider all users' package states." 2017-01-23 20:20:15 +00:00
Daniel Nishi
e47eac74f7 Only count user 0 for diskstats package logging.
This avoids sizing issues and allows us to be accurate within
a subset of the users, rather than less accurate over the entire
user base.

Bug: 34457425
Test: services instrumentation tests
Change-Id: Ic460a564a9ab9805c7739b4f40502e96bbfe7953
2017-01-23 11:27:34 -08:00
TreeHugger Robot
8c055cbe02 Merge "Fix cancel notification race condition bug." 2017-01-23 19:16:35 +00:00
Fyodor Kupolov
cd2377c6b5 Better error message for privapp-permissions test
Bug: 31008485
Test: manual
Change-Id: Ia1acaa83c6d64ff5a7010f222e4e879fee20414e
2017-01-23 11:07:26 -08:00
Guang Zhu
045ae6dab7 Merge "adapt package manager presubmit test to GlobalPresubmit annotation" 2017-01-23 18:31:35 +00:00
Geoffrey Pitsch
331a64d091 Fix cancel notification race condition bug.
Cancel should always remove notifications, regardless of whether
they've been posted internally.  Primarily accomplished by ensuring
all cancels happen on the same handler, and that they check the
enqueued list as well the main notifications list.

Also fixes snoozing for enqueued notifications, since it is
implemented via cancelling.

Test: runtest systemui-notification
Change-Id: If8295a38102f245013d29831a060fabd80716e4b
2017-01-23 12:37:03 -05:00
TreeHugger Robot
2899a69295 Merge changes I72139780,I8e563654
* changes:
  Fix screenshotting with includeDecor=true in multi-window
  Implement restoring & correct caching of snapshots
2017-01-23 13:24:37 +00:00
Jorim Jaggi
7361babf94 Implement restoring & correct caching of snapshots
Introduce a retrieval cache that holds the last accessed
snapshots, in addition to the cache of the activities
that are the top most activtiy of a task that have a
running process.

Change everything to use an integer id instead of a Task object
to work around the issue that some tasks SystemUI might access
might not exist in WM yet (not yet restored from recents).

Don't put anything in the cache on the SystemUI side, but still
retrieve the thumbnails after a task changed event to make sure
the cache on the system_server side is fresh.

Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotCacheTest

Bug: 31339431
Change-Id: I8e56365459a677735320adaa169da8fb033ceab0
2017-01-23 14:05:35 +01:00
Gustav Sennton
364e160290 Change WebView fallback mechanism to consider all users' package states.
MultiProcess WebView will use a Service to start a separate process (the
renderer process). This Service can only be started if the WebView
package is enabled for the current user. To ensure that the current
WebView package is usable by all users on a single device we now only
use a WebView package as WebView implementation if that package is
enabled and installed for all user on the device. This also means that
the WebView-fallback mechanism will trigger when disabling the primary
WebView package for any user (not just the system user).

Also add multi-user unit tests to cover this new change.

Bug: 32894152
Test: run unit tests in WebViewUpdateServiceTest
Test: ensure the standalone WebView package becomes enabled (for all
device users) when disabling Chrome for a secondary user.
Test: load WebView (both using Monochrome, and using the standalone
WebView).

Change-Id: Iad3fc48aa50273062c2f29ae48a343c2dea38116
2017-01-23 09:30:11 +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
Guang Zhu
a78fe62f1f adapt package manager presubmit test to GlobalPresubmit annotation
Bug: 34464569
Test: make ... tests
Change-Id: Ief707a2a1d3438212f88f78c3deb9b86261adaf5
2017-01-22 12:15:01 -08:00
TreeHugger Robot
4cbec883f1 Merge "Set permissions for launching on private displays" 2017-01-21 00:59:20 +00:00
Makoto Onuki
75ca7b8edd Merge "Do not allow work profile apps to access main profile app." 2017-01-20 23:35:53 +00:00
Andrii Kulian
fb1bf69d5d Set permissions for launching on private displays
- System UIDs must be allowed to launch anything and everywhere.
- Display owner must be allowed to launch activities on it.
- Apps that are already on target display must be allowed to launch
  there.
- All other apps mustn't be allowed to launch on private displays.

Bug: 34230873
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testPermissionLaunchFromSystem
Test: #testPermissionLaunchFromAppOnSecondary
Test: #testPermissionLaunchFromOwner
Test: #testPermissionLaunchFromDifferentApp
Change-Id: Ic98005649a6368370c512e822cba4e9decc18ae9
2017-01-20 15:15:59 -08:00
Sunny Goyal
907b467e91 Merge "Fixing dimensions for AppWidgetProviderInfo not getting updated properly for PinItemRequest" 2017-01-20 23:07:22 +00:00
Makoto Onuki
aecbd03751 Do not allow work profile apps to access main profile app.
Bug: 34340531

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsShortcutHostTestCases -t 'android.content.pm.cts.shortcuthost.ShortcutManagerMultiuserTest#testManagedUser'
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsDevicePolicyManagerTestCases -t 'com.android.cts.devicepolicy.LauncherAppsProfileTest'

Change-Id: I34e9f351d2a8addf65a5a928c3dd4363f08611dc
2017-01-20 18:41:44 +00:00
Makoto Onuki
444d64749d Merge "requestPinShortcut for pinned shortcut still notifies launcher" 2017-01-20 16:49:16 +00:00
Julia Reynolds
99695b0fc9 Merge "Save deleted channels." 2017-01-20 14:30:20 +00:00
Jorim Jaggi
e47d2cd415 Merge "Persist task snapshots to disk" 2017-01-20 11:46:13 +00:00
Makoto Onuki
0c28071032 requestPinShortcut for pinned shortcut still notifies launcher
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Bug: 34391829
Change-Id: Iac652790f2aa02dab6afbe52f2e40be99543f325
2017-01-20 00:12:25 +00:00
Sunny Goyal
970d4b4626 Fixing dimensions for AppWidgetProviderInfo not getting updated properly
for PinItemRequest

Test: Manually tested on device
Change-Id: I7bbf7e93e052ef25c2a4a98ff0795ef500f68cc0
2017-01-19 15:12:47 -08:00
TreeHugger Robot
0ae1a7d9e9 Merge "Check for REQUEST_NETWORK_SCORES instead of BROADCAST_NETWORK_PRIVILEGED." 2017-01-19 16:40:47 +00:00
Jorim Jaggi
f9084ecae2 Persist task snapshots to disk
So they can be used again after rebooting or when the process gets
killed, but the snapshot is still used for recents.

Also implement TaskSnapshotLoader, to restore it from disk. The
infrastructure around restoring and caching snapshots for recents
will be implemented in the next CL.

Test: runtest frameworks-services -c
com.android.server.wm.TaskSnapshotPersisterLoaderTest

Bug: 31339431
Change-Id: Iaec03c4cc92e04b6dd7e623bca755ddc92613bce
2017-01-19 17:06:42 +01:00
TreeHugger Robot
96415fb603 Merge "Pass more data through the recommendation request." 2017-01-19 15:29:42 +00:00
TreeHugger Robot
aba241892e Merge "Notify task about display change when moved to new stack" 2017-01-19 05:42:12 +00:00
Hongming Jin
1d5e668fcd Merge "Test: AccountManagerService APCT test." 2017-01-19 04:47:34 +00:00
Andrii Kulian
7cd7c2d333 Notify task about display change when moved to new stack
Bug: 34176283
Test: android.server.cts.ActivityManagerDisplayTests
Test: #testMoveTaskBetweenDisplays
Test: bit FrameworksServicesTests:com.android.server.wm.TaskWindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskStackContainersTests
Change-Id: If085246926790089e014a94093d788805e812489
2017-01-18 18:21:18 -08:00
Phil Weaver
106fe73205 New accessibility shortcut.
Removing accessibility gesture from power dialog.

Adding new accessibility shortcut activated by holding both volume
buttons down. This shortcut is configurable by OEMs and users to
work with any installed accessibility service.

Bug: 30160335

Test: Added automated testing for the EnableAccessibilityController.
Manually toggled various services on and off.
Change-Id: I546bd29a2ab1ba64a0cbfd11e2004cdf85ee6cfd
2017-01-18 17:12:54 -08:00
Sunny Goyal
6804d4de65 Merge "Adding support for apps to return PinItemRequest to launchers as a result of Intent.ACTION_CREATE_SHORTCUT" 2017-01-19 00:27:52 +00:00
Jeremy Joslin
6397ab5411 Check for REQUEST_NETWORK_SCORES instead of BROADCAST_NETWORK_PRIVILEGED.
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
BUG: 33752149
Change-Id: If261cf25c227eeeb4155e43afd9354e6ff8df3b4
2017-01-18 15:12:01 -08:00
Jeremy Joslin
26a45e5b13 Pass more data through the recommendation request.
Expanding the API so it can accept the WiFi config of the currently
connected network (if any) and the set of connectable WiFi
configurations. Also renamed currentRecommendedWifiConfig to
defaultWifiConfig so the name was more representative of the
parameter's purpose and added more documentation throughout.

Test: adb shell am instrument -e class android.net.RecommendationRequestTest -w com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w com.android.networkrecommendation.tests/android.support.test.runner.AndroidJUnitRunner
Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Bug: 34387385
Change-Id: I1089b70303b0396def7e6bf3737fdc67e40c9dcd
2017-01-18 15:00:06 -08:00
Sunny Goyal
a6be88a10d Adding support for apps to return PinItemRequest to launchers
as a result of Intent.ACTION_CREATE_SHORTCUT

> Adding API to allow launchers to query shortcut config activities in
  managed profiles.
> Adding API to allow the default Launcher to start the shortcut config
  activity in managed profiles.
> Updating the ACTION_CREATE_SHORTCUT documentation to represend changes
  in the expected result.

Test: Manual tests and all the unit tests
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to test10

Change-Id: I785c4f2fba782b864cc401ac7905330ea4498289
2017-01-18 10:26:51 -08:00
TreeHugger Robot
e247432035 Merge "Fix test DevicePolicyManagerTest#testSetRequiredStrongAuthTimeout_DeviceOwner" 2017-01-18 17:58:04 +00:00
Hongming Jin
81c4c8af20 Test: AccountManagerService APCT test.
Setup test authenticators, add tests for startAddAccountSession.

Bug: 31346530
Change-Id: I0fb460a8a1c35e2c88c624d0e291b20051110b34
2017-01-18 09:40:18 -08:00
Bartosz Fabianowski
094119df3e Merge "Allow system to retrieve permission grant state" 2017-01-18 17:25:49 +00:00
Bartosz Fabianowski
4b0624fee4 Allow system to retrieve permission grant state
To inform the user which apps were granted permissions by the admin,
the Settings app needs to access this information without being a DO/PO.

Bug: 32692748
Test: FrameworksServicesTests unit test

Change-Id: I3770ec6343b85be9c6f7655675ed6db5cb50612c
2017-01-18 18:22:50 +01:00
Michal Karpinski
d084ca5fad Fix test DevicePolicyManagerTest#testSetRequiredStrongAuthTimeout_DeviceOwner
1) Started returning the default value for getLong() on SystemProperties mock
2) Added a test that the minimum timeout cannot be changed using a system
   property on non-debuggable builds
3) Added new within range test for completeness.
4) Started using TimeUnit instead of ms constants.

Test: runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Bug: 34317979
Change-Id: I0409451ae39e74ec3d96a098042302291ec3408f
2017-01-18 16:25:17 +00:00
TreeHugger Robot
9ecde44945 Merge "Handle multiprocess flag in WebView update service." 2017-01-18 15:19:43 +00:00
TreeHugger Robot
2ec59897cf Merge changes I01e81b9c,I532c2d74
* changes:
  Add a listener when task snapshots change
  When app dies, destroy snapshot
2017-01-18 12:17:45 +00:00
Pavel Grafov
eaed75d923 Merge "Make ENSURE_VERIFY_APPS global even when set by PO." 2017-01-18 11:15:28 +00:00