Commit Graph

787 Commits

Author SHA1 Message Date
TreeHugger Robot
3e17ea13c1 Merge "[DPM] Allow lower strong auth timeout on debuggable builds" 2017-01-12 13:46:09 +00:00
Michal Karpinski
2df5919faa [DPM] Allow lower strong auth timeout on debuggable builds
Timeout can be set to lower than 1h on debuggable builds (eng, user-debug)
using persist.sys.min_str_auth_timeo system property. This allows manual
testers to more easily carry out testing scenarios.

Bug: 29825955
Test: manual without setting the property: if timeout is set to less than 1h, it's clamped to 1h
Test: manual with setting the property: on user-debug build with "adb root && adb shell setprop persist.sys.min_str_auth_timeo 30000"
Change-Id: I8cd871e3d04b2c6c7164f684b9a6a24e7292bfab
2017-01-12 11:36:20 +00:00
Pavel Grafov
a902e5c255 Merge "Let profile owners also receive OTA notification." 2017-01-12 11:12:01 +00:00
Pavel Grafov
19b3ecb9c8 Let profile owners also receive OTA notification.
Also removed the code that sends broadcast to all device admins
in profile owner package since it was used for legacy
provisioning of the whole package and now should be migrated
by findOwnerComponentIfNecessaryLocked().

Test: gts-tradefed run gts -a armeabi-v7a -m GtsGmscoreHostTestCases -t com.google.android.gts.devicepolicy.ManagedProfileTest
Change-Id: I6316df7375fd24da133c83c7930815ba909194f2
Bug:31000521
2017-01-11 18:08:10 +00:00
phweiss
d4a54bbfd1 Add ticker text for network logging notification
Set ticker text to title for accessibility.

Bug:31207965
Test: manual

Change-Id: I0b78f9e6464dd470b74e0db97813623b335835d9
2017-01-11 14:38:29 +01:00
Andrew Scull
54402aab14 Merge "Evict CE key on request and when work mode is turned off." 2017-01-10 13:20:49 +00:00
Philipp Weiß
18315230f6 Merge "Dismiss network logging notification when disabling logging" 2017-01-10 10:15:26 +00:00
phweiss
82ed31c1ef Dismiss network logging notification when disabling logging
Bug:34116213
Bug:29748723
Test: CTSVerifier in a separate CL.

Change-Id: Ie652505ff57665f626712c67837577833f1595d6
2017-01-09 18:52:35 +01:00
Makoto Onuki
a755fb1030 Do not call RecoverySystem with DPMS lock held
Note DPM.wipeData() on a secondary user is now blocking, just like
it's been always blocking on the primary user.

Test: Manually tested wipeData() with TestDPC, both on 1) the primary user,
2) a secondary user and 3) work profile.
* Modified TestDPC so it supports secondary users

Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w com.android.frameworks.servicestests

Bug 30681079

Change-Id: Ib97a92a6af87a5589d2643b9ae0522395735e1a5
2017-01-04 16:44:22 -08:00
Makoto Onuki
cbfec5d491 Follow-up to I1e4dd97
Don't check the accounts when the caller is not ADB.

MR2 already has this change.

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.AccountCheckHostSideTest
* without having Id49f2bd5dfa80ecf35b3a23c789100ade38c2656 *

Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w com.android.frameworks.servicestests
Change-Id: I654c41d0e7434c5fce75eb2df5fd7686a54e9093
2017-01-04 11:01:29 -08:00
Makoto Onuki
9bab1c4dd5 Merge "Get account features before taking lock" 2017-01-03 21:34:41 +00:00
Makoto Onuki
606da7778f Get account features before taking lock
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.AccountCheckHostSideTest
* without having Id49f2bd5dfa80ecf35b3a23c789100ade38c2656 *

Test: adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest -w com.android.frameworks.servicestests

Bug: 33481725
Change-Id: I1e4dd9701a76ca366f86fdaf2fc6c282e9dbe5c1
2017-01-03 10:58:23 -08:00
Robin Lee
f8ced7790a Merge "Don't check for monitoring CA certs in cryptkeeper" 2017-01-03 18:43:52 +00:00
Robin Lee
a04a29ae02 Don't check for monitoring CA certs in cryptkeeper
Change-Id: I35dc031e4cd652a79174d03f6a9f02120f46abd2
Test: CtsVerifier (ca certificate test)
Fix: 33454899
2016-12-23 16:38:00 +00:00
TreeHugger Robot
43769ddb2c Merge "Add DISALLOW_ADD_MANAGED_PROFILE to existing device owners" 2016-12-22 10:29:31 +00:00
Esteban Talavera
548a04b8f8 Add DISALLOW_ADD_MANAGED_PROFILE to existing device owners
For device owners set pre-O, that restriction will not
be set via setDeviceOwner(). Therefore set it during
first boot after O OTA.

Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest frameworks-services

Bug: 31952368

Change-Id: I7db9b14c49a75ae2760e6923a1f3f7cde0e2784b
2016-12-21 10:57:12 +00:00
Andrew Scull
85a63bc1a0 Evict CE key on request and when work mode is turned off.
DPMS.lockNow takes a flag which can request the managed profile CE key to
be evicted.

Test: com.android.cts.devicepolicy.ManagedProfileTest#testLockNowWithKeyEviction*
Bug: 31000719
Change-Id: I68f4d6eed4b041c39fd13375f7f284f5d6ac33da
2016-12-20 17:37:03 +00:00
Philipp Weiß
cbe76a0f1e Merge "Show notification when network logging is enabled" 2016-12-20 15:58:44 +00:00
phweiss
a0cb251ca6 Show notification when network logging is enabled
A notification is shown after network logging is enabled
and after the next three reboots that are at least one day apart.

Clicking it sends an intent to quick settings to shown its device monitoring
dialog.

Bug: 29748723
Bug: 33126577

Test: Manual, CTS-Verifier tests will be added later
Change-Id: I2bf517bd27ab23ad3f66270602dbf062efab8cbb
2016-12-19 15:59:58 +01:00
Andrew Scull
7cd4536e80 Merge "Don't save the password metrics to disk." 2016-12-19 14:48:37 +00:00
TreeHugger Robot
805e893e35 Merge "Enforce DISALLOW_ADD_MANAGED_PROFILE" 2016-12-19 11:57:13 +00:00
Esteban Talavera
01576869a3 Enforce DISALLOW_ADD_MANAGED_PROFILE
Only the device owner should be able to create a managed
profile if that restriction is set

Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest    frameworks-services

Bug: 31952368

Change-Id: Ia5170e54594ccba1e5bcedffaec98c2af42264c0
2016-12-19 11:54:11 +00:00
Michal Karpinski
e4dfd2d002 Initialize AtomicBoolean for NetworkLogger#mIsLoggingEnabled
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testNetworkLoggingWithSingleUser
Bug: 29748723
Change-Id: Ib175f1d57093590b0080f32dc5f6c60ea50066e0
2016-12-16 18:09:12 +00:00
Andrew Scull
5daf273b7e Don't save the password metrics to disk.
Only store the metrics in RAM, computing them at first log in.

Test: com.android.cts.devicepolicy.DeviceAdminHostSideTestApi24
Bug: 32793550
Change-Id: Iaf9516c193f054331e3e2c68cb3f627bd543b408
2016-12-16 15:30:14 +00:00
Amith Yamasani
0a5aeecf4e Merge "Revert "[DPM] Allow lower strong auth timeout on debuggable builds"" 2016-12-15 22:15:46 +00:00
Amith Yamasani
960128c9c6 Revert "[DPM] Allow lower strong auth timeout on debuggable builds"
Reverting because the length of the prop key is out of bounds.

Bug: 33662416
This reverts commit 60d1feed92.

Change-Id: I66a3f7f18e668acbf2ddaf60ab8efa2584799906
2016-12-15 20:18:39 +00:00
Nicolas Prévot
1548d5c43b Merge "Use affiliation ids when checking bind target users." 2016-12-15 14:31:39 +00:00
Michal Karpinski
b775737e95 Merge "Make NetworkLogger.mIsLoggingEnabled an AtomicBoolean" 2016-12-15 12:57:04 +00:00
Michal Karpinski
d8145f6743 Make NetworkLogger.mIsLoggingEnabled an AtomicBoolean
Fixes a potential race condition - when enabling/disabling the logging
some events might have been lost.

Bug: 29748723
Change-Id: I8a436d525393b2314805e287eddcea26d4ec073b
2016-12-15 12:53:48 +00:00
Michal Karpinski
67ed651dab Merge "[DPM] Allow lower strong auth timeout on debuggable builds" 2016-12-15 12:20:27 +00:00
Michal Karpinski
60d1feed92 [DPM] Allow lower strong auth timeout on debuggable builds
Timeout can be set to lower than 1h on debuggable builds (eng, user-debug)
using persist.sys.min_strong_auth_timeout system property.

Bug: 29825955
Change-Id: I51d421c3e10625787ecfdbe011f9128cd47cb2a2
2016-12-14 15:23:35 +00:00
Nicolas Prevot
d5b036014d Use affiliation ids when checking bind target users.
BUG:32764274
Test: adb shell am instrument -e class
com.android.server.devicepolicy.DevicePolicyManagerTest -w
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ic79b58dcb583b1d9eb9e7af0d1501cf8cfd0ee86
2016-12-14 15:15:10 +00:00
Esteban Talavera
6c9116a643 Create DISALLOW_{ADD,REMOVE}_MANAGED_PROFILE user restrictions
Bug: 31952368

Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest    frameworks-services
Test: runtest -c com.android.server.pm.UserManagerTest frameworks-services
Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.UserRestrictionsTest

Change-Id: I240ab99c2409bbabffbc574bef202f2457026905
2016-12-13 18:14:19 +00:00
Philipp Weiß
9498f5a81b Merge "Add network logging icon to Quicksettings when enabled" 2016-12-09 16:31:41 +00:00
phweiss
a4e169ed68 Add network logging icon to Quicksettings when enabled
Add the network logging icon in Quick Settings' footer if
network logging is enabled, possible next to the VPN icon.
Quicksettings has to be able to tell that network logging
is enabled, so this CL changes DPM.isNetworkLoggingEnabled() to be
callable from the device owner or from any app with the MANAGE_USERS
permission.

The icon is only a placeholder until the official icon is finished.

CTS Verifier tests will be added when all Network logging UX changes are
done.

BUG: 33126618
BUG: 29748723
Test: runtest --path frameworks/base/packages/SystemUI/tests
Change-Id: Ib35d323605ab11f883a4b6199d1db79b9e53c49b
2016-12-08 16:34:25 +01:00
TreeHugger Robot
3c41744b8c Merge "Clear DISALLOW_ADD_USER user restriction when dpm remove-active-admin is called from shell" 2016-12-08 13:54:41 +00:00
Victor Chang
d9758e7479 Clear DISALLOW_ADD_USER user restriction when dpm remove-active-admin is called from shell
- Make the CTS hermetic and not adding new restriction after CTS test
- DeviceOwner can't clear this user restriction in CTS, as it's set by ManagedProvisioning
- It can be only clear when testOnly DPC becomes deviceOwner, and being removed by remove-active-admin in shell

Bug:31856203
Test: build successfully

Change-Id: I75b91629ef09c54e9dbe7253df6a52894a938e83
2016-12-07 20:26:43 +00:00
Mahaver Chopra
abf86385f8 Merge "Return error code from isProvisioningAllowed" 2016-12-06 09:45:05 +00:00
Mahaver Chopra
849fd6f58e Return error code from isProvisioningAllowed
Added hidden pre condition codes for PO and DO provsioning.
Added hidden api checkProvisioningPreCondition, which returns codes
instead of boolean. Managed provisioning can use this to show
useful debug information and user facing error dialogs.

Test: All DevicePolicyManagerTest pass

Bug: 27467633
Change-Id: I7d2a79921bc3ac2e12d506629a35563fc7ff62bf
2016-12-05 17:48:42 +00:00
Amith Yamasani
f81df2d5e5 Merge "Secure MATCH_UNINSTALLED_PACKAGES across users" 2016-12-01 17:01:07 +00:00
TreeHugger Robot
3db81ae38d Merge "Revise when to throw SecurityException in bindDeviceAdminServiceAsUser" 2016-12-01 11:52:05 +00:00
Amith Yamasani
0d1fd8d091 Secure MATCH_UNINSTALLED_PACKAGES across users
Introduce a new internal flag MATCH_ANY_USER for genuine uses
of searching through all apps on the device.

Some temporary accommodations for Launchers that reach across
to the work profile until we have a new LauncherApps API to do
that officially.

Bug: 31000380
Test: CTS tests added
Change-Id: I2e43dc49d6c2e11814a8f8d1eb07ef557f31af34
2016-11-30 13:24:53 -08:00
Bartosz Fabianowski
365a3db470 Allow setting managing organization for the device
The Profile Owner of a managed profile can set a string that will be
shown in the UI to identify the organization managing the profile.
This CL extends the functionality to the Device Owner of a managed
device.

Bug: 32692748
Test: DevicePolicyManagerTest unit test + CTS test in separate CL

Change-Id: I47295da2fd6485ebf0e890da13990a044accaf17
2016-11-30 18:28:10 +01:00
Tony Mak
700c6ae748 Revise when to throw SecurityException in bindDeviceAdminServiceAsUser
1. No longer throw SecurityException when we fail to resolve the intent.
   Return false instead.

2. Throw IllegalArgumentException early if the incoming intent is not
   explicit.

3. Throw SecurityException with different error message. It makes debug
   easier and allows tests to verify a particular thing happened.

Bug: 33197200

Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerPlusManagedProfileTest

Change-Id: I723ab7f434c10407aa4e7dc8e9a6e3e9bb9f2059
2016-11-30 14:59:39 +00:00
Bartosz Fabianowski
dd7f8dafd8 Allow DO to access DevicePolicyManager.isDeviceManaged()
This CL makes DPM.isDeviceManaged() accessible to the DO so that it
can be CTS-tested.

Bug: 32692748
Test: Device policy manager unit test + CTS & GTS in separate CLs

Change-Id: I5326e86b0ffee81d04bd48f0267044463a899b78
2016-11-30 11:09:22 +01:00
TreeHugger Robot
9f9e453b64 Merge "Unit test for getBindDeviceAdminTargetUsers" 2016-11-30 09:58:11 +00:00
TreeHugger Robot
b57bd791bf Merge "Add user affiliation APIs" 2016-11-29 16:09:10 +00:00
Esteban Talavera
c9bb378a8b Add user affiliation APIs
Make setAffiliationIds public so that it can be used for COMP.
That way we can allow network logging and other features to
work on devices that have a DO and a managed profile.
Those features are currently restricted to single user devices but we'll
open them up to devices where all users are affiliated.

Also create a getter for that API.

Bug: 32326223
Test: m FrameworksServicesTests &&
 adb install \
   -r ${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk &&
 adb shell am instrument -e class com.android.server.devicepolicy.DevicePolicyManagerTest \
   -w com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ie443be887a6ca61a7f7a07e137757dceab7eb3d3
2016-11-29 12:15:09 +00:00
Tony Mak
2f26b79eea Unit test for getBindDeviceAdminTargetUsers
Was meant to write test for bindDeviceAdminServiceAsUser, but
it can't be done without having tests for
getBindDeviceAdminTargetUsers first as bindDeviceAdminService depends
on getBindDeviceAdminTargetUsers.

A bit shocked by we didn't have any managed profile tests in
DevicePolicyManagerTest. Added managed profile support in the CL.

Bug: 32764274

Test: runtest -x frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java

Change-Id: If412e4f44c3ae998f69e17411f2503a97f80149f
2016-11-28 17:54:51 +00:00
Nicolas Prévot
22b2a81f75 Merge "Send callbacks to DO when a user is added or removed." 2016-11-28 16:50:08 +00:00