916 Commits

Author SHA1 Message Date
Bartosz Fabianowski
05dc9f764c Add API for checking which CA certs were installed by the DO/PO
With this API, the system can determine whether a CA cert was
installed by the user or the user's DO/PO.

Bug: 32692748
Test: unit tests (see DevicePolicyManagerTest.java for invocation)
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases

Change-Id: I3bcae5ac18ec2b110154184fc515df804fd73da6
2017-03-03 19:42:51 +01:00
Geoffrey Pitsch
af759c52ce Channels for Frameworks notifications
Adapts all notifications used by system services to use channels.
Channels are initialized by SystemServer after the NotificationService
has started.

Test: runtest systemui-notification
Change-Id: I25c45293b786adb57787aeab4c2613c9d7c89dab
2017-03-01 10:17:15 -05:00
TreeHugger Robot
a7aaae881c Merge "Delete ParcelableString, add StringParceledListSlice" 2017-02-28 22:09:06 +00:00
Edman Anjos
3814d5d021 Merge "Fix is installed check condition in DevicePolicyManagerService" 2017-02-28 19:45:28 +00:00
Robin Lee
abaa0695c5 Delete ParcelableString, add StringParceledListSlice
Both inherit from package private BaseParceledListSlice.

This is still bad, but it's not as bad. The existing code that uses
this can just do Foo.bar().getList() now instead of having to marshal
to and from an oddball type at either end as well.

In the longer term ParceledListSlice<> should be eliminated, but it's
not clear how far into the future that is going to happen.

Test: runtest -x services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Test: runtest -x core/tests/coretests/src/android/content/pm/ParceledListSliceTest.java
Change-Id: Ie69b96b5215d6e04990f6d31345772cdfee21d78
2017-02-28 18:07:08 +00:00
TreeHugger Robot
8732003f69 Merge "Make IKeyChainAliasCallback oneway" 2017-02-27 16:39:56 +00:00
Robin Lee
3e7cf168a5 Make IKeyChainAliasCallback oneway
So it can be sent from devicepolicymanager (system_server) to keychain
(a system_app) without waiting on the response and having to do
everything in a background thread.

Side-effect: the regular keychain => app callback is slightly more
efficient now too. in case anyone particularly needs blazing fast
private key user selections.

Fix: 35675253
Test: cts-tradefed run cts --abi=arm64-v8a --skip-device-info --module CtsDevicePolicyManagerTestCases --test 'com.android.cts.devicepolicy.DeviceOwnerTest#testKeyManagement' </dev/null 2>&1
Change-Id: I6e9d96ca3c42e6489d879d8cfb0507eb94838bf1
2017-02-25 01:32:54 +00:00
TreeHugger Robot
ab6798951a Merge "Fix broken RestrictedLockUtils KeyGuard APIs" 2017-02-24 19:29:48 +00:00
Edman Anjos
0423b8f72f Fix is installed check condition in DevicePolicyManagerService
DPMS#setDelegatedScopes generally enforces the delegate is installed in
the device, but this check should be skipped on DELEGATION_CERT_INSTALL
scopes on pre-N. Additionally the check is also skipped when clearing up
delegations on pre-N. The check was extracted to a separate function for
clarity.

Bug: 35234284
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.ProfileOwnerTestApi23#testDelegatedCertInstaller
Change-Id: Ib723b58243f901af907e368017b1ae0bb101360d
2017-02-24 15:53:12 +01:00
Robin Lee
acdeac6809 Fix broken RestrictedLockUtils KeyGuard APIs
They were all broken in that they returned profile admins for parent
queries even when they clearly shouldn't.

Examples:
 - disable unredacted notifications
 - disable fingerprint

This doesn't seem to have been tested beyond the bare basics of one
user with one device admin. Added some reasonable coverage. It could
still do with more.

Test: make RunSettingsLibRoboTests
Bug: 34929375
Change-Id: I1b0e986056ffa62d47091c0010977ac810ebd690
2017-02-22 17:39:34 +00:00
Suprabh Shukla
0b1356ff1f Fix 'Modifying dpm.setSecureSetting call for install_non_market_apps'
The previous change was reverted as it broke work profile provisioning.
Clearing binder calling identity before calling into settings provider
should fix the issue.

Test: runtest managed-provisioning
Test: runtest -x services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Test: Manually tested that work profile is inflated with expected values
of install_non_market_apps

Bug: 33947615
Bug: 35590590

Change-Id: I3c31a73fef0c25c0e682e18f637272adad39b28d
2017-02-21 18:36:28 -08:00
Victor Chang
5663e05109 Revert "Modifying dpm.setSecureSetting call for install_non_market_apps"
This reverts commit 2e7d6d64b9b16ea27634bc0e8843717a465142b4.

Bug: 35590590
Fix: 35590106
Test: runtest managed-provisioning
Test: manual verified that work profile can be inflated
Change-Id: Ie780b94053e65bca2f96b32055937c0c9e8beae8
2017-02-20 17:00:58 +00:00
TreeHugger Robot
e453d8e762 Merge "Removing unnecessary call to ArraySet#toArray" 2017-02-18 02:48:42 +00:00
Suprabh Shukla
3dea1c7972 Removing unnecessary call to ArraySet#toArray
Iterating over ArraySet using iterators is still more efficient than
first calling ArraySet#toArray and then iterating over the array.

Test: Minor optimization. make and existing tests should suffice.

Change-Id: Ifc282bfca98cf89b047dddddd78a6de020f27381
2017-02-17 16:11:01 -08:00
TreeHugger Robot
dd903d4f0e Merge "Modifying dpm.setSecureSetting call for install_non_market_apps" 2017-02-17 23:05:48 +00:00
Suprabh Shukla
2e7d6d64b9 Modifying dpm.setSecureSetting call for install_non_market_apps
Starting from O, install_non_market_apps is deprecated and will not be
checked by the package installer. Device admin apps should be using the
user restriction instead.
Since on managed profiles, the default value blocked install from
unknown sources, the system will set the user restriction on behalf of
the profile owners (if the profile has one).
For non-managed profiles, the user had access to the settings to change
the value of install_non_market_apps. So going forward, any request to
change it's value by dpm#setSecureSetting in such users is going to be
ignored.

Test: Manually tested that:
1. For a profile with PO, when install_non_market_apps was set to 0,
user restriction is set on upgrade
2. For a profile with PO, when install_non_market_apps was set to 1,
user restriction is not set on upgrade
3. After upgrade, newly created managed profiles with PO have user
restriction set

Bug: 33947615
Change-Id: I063e9ee608b52086ffdf8ed2b24e2928574c58cd
2017-02-17 13:25:14 -08:00
TreeHugger Robot
8c9a6b0089 Merge "Revert "Revert "Per user setting for instant app""" 2017-02-17 20:46:12 +00:00
TreeHugger Robot
a4f3891d28 Merge "Mark clearDeviceOwnerApp/clearProfileOwner as deprecated" 2017-02-17 18:38:36 +00:00
Bartosz Fabianowski
4f7e1fc9af Merge "Add API for checking whether the default IME was set by the DO/PO" 2017-02-17 17:53:02 +00:00
TreeHugger Robot
939ccc3854 Merge "Clear DISALLOW_ADD_USER in clearDeviceOwner for all cases" 2017-02-16 22:08:20 +00:00
Todd Kennedy
be0b8896d1 Revert "Revert "Per user setting for instant app""
This reverts commit be9ffa15af9e1906e9ffb505768328d62d4a3793.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Ib21321cf157a79890de487060a093840f7182047
2017-02-16 12:43:37 -08:00
Victor Chang
348f696d33 Clear DISALLOW_ADD_USER in clearDeviceOwner for all cases
We are not moving the restriction from system to the DO in the end.
clearDeviceOwnerUserRestrictionLocked becomes the permanent solution
for DeviceOwner CTS. Looks like no one setting DISALLOW_ADD_USER
directly in UserManager except DO/PO, and so remove it when DO is
clear

Change-Id: I235bebebd02b5e0d9883eea6dd3a4e49b40fe043
Fix: 33476323
Test: runtest frameworks-services -c com.android.server.devicepolicy.DevicePolicyManagerTest
2017-02-16 20:41:50 +00:00
Esteban Talavera
a5b0963c0c Mark clearDeviceOwnerApp/clearProfileOwner as deprecated
Bug: 33175679
Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest    frameworks-services
Change-Id: I05e10638d838ccf8dc67b7a01b3ffeb7cbea8500
2017-02-16 18:47:06 +00:00
Bartosz Fabianowski
aff5e9c21c Add API for checking whether the default IME was set by the DO/PO
With this API, the system can determine whether a user's default
IME was set by the user or the user's DO/PO.

Bug: 32692748
Test: DPMS unit tests and CTS CtsDevicePolicyManagerTestCases

Change-Id: Ibd703ff5c9e4c072599ad8d6023c94a97d728109
2017-02-16 13:07:11 +01:00
Rubin Xu
824b073fbe Merge "Add escrow token API in DevicePolicyManager." 2017-02-16 01:36:46 +00:00
Guang Zhu
626ffb4556 Merge "Revert "Per user setting for instant app"" 2017-02-15 21:47:34 +00:00
Guang Zhu
be9ffa15af Revert "Per user setting for instant app"
Bug: 35390781

This reverts commit 2f5811dcfd840e149851a9333e27ef3cdddf7a46.

Change-Id: Ibb1c8dacbdc6908fc7fa2bc5dca664f2455162bf
2017-02-15 21:43:48 +00:00
Rubin Xu
aab7a4146c Add escrow token API in DevicePolicyManager.
Take advantage of the new authentication flow in LockSettingsService
and allow PO or DO to provision escrow tokens on the device. The
escrow token grants them the ability to change device lockscreen
(if used by DO) or work profile challenge (if used by PO). The
new password reset mechanism is even usable before user unlocks,
and it preserves authentication-bound keys in keystore.

Test: runtest frameworks-services -c com.android.server.SyntheticPasswordTests
Test: runtest frameworks-services -c com.android.server.devicepolicy.DevicePolicyManagerTest
Test: cts-tradefed run cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedDeviceOwnerTest#testResetPasswordWithToken
Bug: 33126620
Change-Id: Iaa684c51946f726cbd909e9ac70ad3e9ca3de1ac
2017-02-15 19:54:31 +00:00
Todd Kennedy
bf92b812db Merge "Per user setting for instant app" 2017-02-15 19:19:26 +00:00
Todd Kennedy
2f5811dcfd Per user setting for instant app
The same application can run as either an instant app or an installed
app. Store this setting per-user instead of based upon the install
location.

Bug: 25119046
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
Change-Id: Iff565bb1ac10d631499f0bd0f69b401cb073c10e
2017-02-14 13:42:01 -08:00
TreeHugger Robot
f5e107140d Merge "Flush addPersistentPreferredActivity setting in DPMS" 2017-02-14 20:15:34 +00:00
TreeHugger Robot
723eac769e Merge "Use DevicePolicyData#mUserSetupComplete for DPM's isDeviceProvisioned." 2017-02-14 18:47:53 +00:00
Tony Mak
288639860a Flush addPersistentPreferredActivity setting in DPMS
To fix the glitch that "kiosk mode" does not persist if device
is rebooted within 10s after addPersistentPreferredActivity is called.

Test: Manual Test
      1. Using TestDPC to start kisok mode, reboot right away.
      Observed that TestDPC is launched in kiosk mode.
      2. Stop the kiosk mode, reboot without 10s.
         Kisok mode is stopped.

Fix: 28169791

Change-Id: I555fc18efe86380f2e028b698c2bdb01017bf9f5
2017-02-14 18:18:48 +00:00
TreeHugger Robot
a10b057bb8 Merge "MonitoringCertTask no longer relies on software.device_admin" 2017-02-14 15:35:04 +00:00
Lenka Trochtova
5108f1efa6 Use DevicePolicyData#mUserSetupComplete for DPM's isDeviceProvisioned.
DevicePolicyData#mUserSetupComplete on user 0 us a more accurate and
reliable indicator of whether the device has been provisioned than
the currently used 'ro.device_owner' property.

Test: gts-tradefed run gts -m GtsGmscoreHostTestCases --test com.google.android.gts.devicepolicy.DevicePolicyManagerTest

BUG: 29935702

Change-Id: Iec62f2aebe865ac0ee69c2cc7177333ce5450474
2017-02-14 14:44:06 +01:00
Robin Lee
7f5c91c6bc MonitoringCertTask no longer relies on software.device_admin
Added a test to validate that it still works the way it should before
and after the change.

Bug: 33258404
Bug: 35196414
Fix: 35129745
Test: runtest -x services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Test: also manual, instructions:
Test: (1) Disable software.device_admin from tablet_core_hardware, rebuild.
Test: (2) Install CA cert. Notification should appear.
Test: (3) Reboot. Notification should still be there.
Change-Id: Id992725c1844a2fffbde4d8acaba531e99f853ad
2017-02-14 13:29:31 +00:00
TreeHugger Robot
33a119c94f Merge "Fix typo on DISALLOW_UNMUTE_DEVICE" 2017-02-13 18:48:28 +00:00
Esteban Talavera
492b4724fb Fix typo on DISALLOW_UNMUTE_DEVICE
Test: Builds sucessfully. Cannot find other usages in code search
Change-Id: I83f85b4715b11630b0ce0b471be536aef46a2936
2017-02-13 14:59:45 +00:00
Greg Plesur
150a584aee Allow any device with a device_owner to execute setDeviceOwnerSystemPropertyLocked(). am: 735b4dc0af am: d78a0d21cb
am: 82a3793269

Change-Id: I3f7fe9ba2c572eb0dda23386a62c50f58a6a08f9
2017-02-09 20:06:10 +00:00
Greg Plesur
d78a0d21cb Allow any device with a device_owner to execute setDeviceOwnerSystemPropertyLocked().
am: 735b4dc0af

Change-Id: I5c8ca6d0a63af83cde91c17d10a634469c726442
2017-02-09 19:49:58 +00:00
Greg Plesur
735b4dc0af Allow any device with a device_owner to execute setDeviceOwnerSystemPropertyLocked().
BUG: 34824902
Change-Id: I95fbe0a352c48a3fff5af57b91325901a16d3d89
2017-02-09 11:44:39 -05:00
Greg Plesur
c928e9fa53 Don't check device_provisioned on Wear devices in setDeviceOwnerSystemPropertyLocked() am: c7b18342ea am: b6323817db
am: f206de957a

Change-Id: Ic1f2bd765ecc3eb7239923147a93fc4afa6eb70c
2017-02-08 23:56:33 +00:00
Greg Plesur
f206de957a Don't check device_provisioned on Wear devices in setDeviceOwnerSystemPropertyLocked() am: c7b18342ea
am: b6323817db

Change-Id: I5f3b6935af32ba94fef35d8db573d75925eee434
2017-02-08 23:49:32 +00:00
Greg Plesur
66af3515de Don't check device_provisioned on Wear devices in setDeviceOwnerSystemPropertyLocked()
am: c7b18342ea

Change-Id: I692fee4165de9a274d8eb8f0deaf49762974bb22
2017-02-08 23:44:13 +00:00
Greg Plesur
c7b18342ea Don't check device_provisioned on Wear devices in setDeviceOwnerSystemPropertyLocked()
BUG: 34824902
Change-Id: I49d4d7043829862e1abacb3f400a6690f454d6c0
2017-02-08 16:32:51 -05:00
Rubin Xu
b94a914c9e Merge "Small tweaks in LockSettingsService" 2017-02-08 16:04:27 +00:00
Esteban Talavera
84e706fb9b Merge "Unhide getLockTaskPackages" 2017-02-07 15:04:48 +00:00
Rubin Xu
f810cc9a5b Merge "Fix uri permission grant on remote bug report uri" 2017-02-07 14:40:17 +00:00
Esteban Talavera
bfb666da53 Unhide getLockTaskPackages
getLockTaskPackages is currently hidden, and can only be
called by a device or profile owner, which doesn't make
much sense. Unhidding it to be consistent with the rest
of the DevicePolicyManager APIs that have a getter for
each setter.

Bug: 34614754
Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_affiliatedSecondaryUser
Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_unaffiliatedUser
Test: Test:  cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_deviceOwnerUser
Change-Id: I6e03c2f47c0f9e7a635e798a1bf7f131a8e37c65
2017-02-07 12:01:20 +00:00
Rubin Xu
7226c7dc9f Fix uri permission grant on remote bug report uri
System server is no longer allowed to grant uri permission directly. As a result
we use grantUriPermissionFromIntent() to grant permission from the shell UID,
who is the owner of the bug report content.

Also fix a security bug where the broadcast to notify user consent of remote
bug report mismatches the <protected-broadcast> definition, causing it to be
sendable by anyone.

Bug: 34159108
Test: manual - Install TestDPC and request bugreport, try accept and decline
      once the report is ready (Bullhead).

Change-Id: I66e3f2a16d4547549f09d3c96d52aed2330caedf
2017-02-07 11:30:20 +00:00