Commit Graph

1176 Commits

Author SHA1 Message Date
TreeHugger Robot
2eb3473d0d Merge "Private DNS connectivity check" 2018-12-08 22:50:21 +00:00
Adrian Roos
c894b352d6 Merge "FRP: save password quality in DPM.resetPassword" am: 08d4eb174d am: 635731866e
am: 38d5c1e8eb

Change-Id: I7e2780fbb9cd36cc23af5746aa6931ce761a0374
2018-12-07 03:42:03 -08:00
Adrian Roos
38d5c1e8eb Merge "FRP: save password quality in DPM.resetPassword" am: 08d4eb174d
am: 635731866e

Change-Id: Idcccada2ecdb5b1cf011d11dd239c1ee27169882
2018-12-07 03:32:45 -08:00
Adrian Roos
ebf84c264a FRP: save password quality in DPM.resetPassword
When setting a password from DPM.resetPassword(), the actual quality of the
password was not passed to LockSettingsService (instead, the minimum required
quality was passed which is often UNSPECIFIED). As a result, during FRP we
would see inconsistent state and skip it.

Bug: 110172241
Test: Set credential via DPM.resetPassword(), factory reset device to trigger FRP, verify FRP shows.
Change-Id: I54376f60ac53451ace22965d331b47cd8c2e614e
2018-12-06 19:29:39 +01:00
Eran Messeri
309e071bb6 Private DNS connectivity check
Implement connectivity check to DNS-over-TLS servers, checking that the
RFC-defined port on the host is reachable and a TLS handshake can be
performed.

Bug: 112982691
Test: atest com.android.cts.devicepolicy.DeviceOwnerTest#testPrivateDnsPolicy
Change-Id: I1eb4ec201d7e096b969b7bc2bcba271f99de2d2f
2018-12-05 21:28:39 +00:00
yuemingw
9dd0ba0e05 Add a hidden API for Cross Profile Calendar Settings UI.
Settings wants to know if there is currently any package that is allowed
for cross profile calendar by PO.
The UI is added in work account settings, which actually runs
in primary user, and we can't call the public
getCrossProfileCalendarPakcages(work_user_admin) from primary user.
So we need to add this hidden API.

Bug: b/117976974
Test: make ROBOTEST_FILTER=CrossProfileCalendarPreferenceControllerTest -j40 RunSettingsRoboTests
Change-Id: I3df29a25a7826639828041b47dcfb7dcf086c411
2018-12-05 01:01:31 +00:00
yuemingw
4bcea96bde Add APIs for cross profile calendar whitelist in DPM.
Bug: 118444029
Test: atest DevicePolicyManagerTest#testCrossProfileCalendar_failIfNotProfileOwner
atest ManagedProfileTest#testCrossProfileCalendarPackage

Change-Id: Id7e6a2fc32ec8bcf770700df1596378c858168c2
2018-11-28 23:46:41 +00:00
Neda Topoljanac
19f291660d Managed System Updates API
Adding API to install a system update from a file on the device.

Test: manual in TestDPC, CTS tests for negative cases: atest com.android.cts.devicepolicy.DeviceOwnerTest#testInstallUpdate

Fixes: 116511569

Change-Id: I34b5c6344301a9d2d64c98dedc4ed5e4a75c57d1
2018-11-23 16:28:07 +00:00
Eran Messeri
0bc24f6283 Device ID attestation for Corp-owned Profile Owner: follow-up
A small clean-up CL to follow-up on two comments from the original
review:
* Remove the new permission from privapp-permissions-platform.xml as it
is a signature-level permission, not a privileged premission, and as
such does not need to be in that file.
* Do not store the grant state if it's set to false - since the
de-serialization code will only care if there's a "true" value stored.

Bug: 111335970
Test: Manual
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: atest com.android.cts.devicepolicy.MixedProfileOwnerTest#testKeyManagement
Test: atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testKeyManagement
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDeviceIdAttestationForProfileOwner
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDelegatedCertInstallerDeviceIdAttestation
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegatedCertInstallerDeviceIdAttestation
Change-Id: I8b570220f5652846fccc53b5e4daaa57f89eb824
2018-11-21 11:30:56 +00:00
Eran Messeri
bb27189f56 Grant Device IDs access to Profile Owner
In order to allow inclusion of device identifiers in the key attestation
record generated by the profile owner, the platform needs an explicit
signal that it is OK for the profile owner to access those identifiers.

Add a system-privileged method to the DevicePolicyManager that allows
system applications, as well as Managed Provisioning to indicate that the
profile owner may access those identifiers.

In the DevicePolicyManagerService the following has changed:
* The OwnerInfo now contains a flag indicating whether the profile owner
  was granted access to the device identifiers or not.
* The permission check for use of the Device ID Attestation flags in
  generateKeyPair has been adjusted to allow profile owner (or its
  delegate) to use them, if device identifiers access has been granted.
* A couple of utility methods have been added to ease checking of
  profile owner presence for a user and whether the profile owner can
  access device identifiers.

Additionally, a new adb command has been added to give this grant to an
existing profile owner for testing purposes.

Bug: 111335970
Test: Manual, using TestDPC + ADB command.
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Test: Additional CTS tests, see cts change in the same topic.

Change-Id: I05f2323d5edacd774cd3ce082ee9c551100f4afd
2018-11-15 10:34:20 +00:00
Lenka Trochtova
67ae7484dd Check if the device has telephony in APN methods.
BUG: 111071972
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.DeviceOwnerTest#testOverrideApn

Change-Id: I8f9817b8d4ba992c98c41e5bb37b78d7699e02fa
2018-11-13 18:10:58 +00:00
Junyu Lai
e914f1e453 Merge "Extend onDnsEvent callback to report more fields." am: 89eb3e6117 am: 7a782be65d
am: 556ae82025

Change-Id: I50ef791009b0e9301ba10d8e52c3fd6c15e6b938
2018-11-04 21:05:47 -08:00
Junyu Lai
556ae82025 Merge "Extend onDnsEvent callback to report more fields." am: 89eb3e6117
am: 7a782be65d

Change-Id: Ic1b35f2b02dc60e301d39e89008617b341194382
2018-11-04 20:54:14 -08:00
junyulai
4c2d2d5461 Extend onDnsEvent callback to report more fields.
When native layer reports onDnsEvent, netId, eventType and
returnCode are available only in NetdEventListenerService, but
not for the clients who register event on it.

Thus, extend the callback to give clients more detail on the
network the look up was performed on and the result of the
lookup.

Bug: 113916551
Test: 1. runtest frameworks-net
      2. runtest frameworks-services -c com.android.server. \
         net.watchlist.NetworkWatchlistServiceTests
Change-Id: If7beecea50e1baf18cb5c6775ad3ecb1a60b312a
2018-10-31 21:22:45 +08:00
Antoan Angelov
07a9c42c39 Merge "Add UserRestrictionChanged atom and log to track user restriction events." 2018-10-22 11:59:25 +00:00
Michael Groover
3ce26d00f7 Merge "Require READ_PHONE_STATE for DO/PO dev ID access" 2018-10-19 19:15:01 +00:00
arangelov
d5db50ee93 Add UserRestrictionChanged atom and log to track user restriction events.
Test: none
Bug: 114382154
Change-Id: I20dcdce657e1fed3057d84df5f427542bbabf2cc
2018-10-19 17:26:09 +01:00
Michael Groover
1905f3f162 Require READ_PHONE_STATE for DO/PO dev ID access
When device identifier access was moved from a runtime permission to a
privileged permission device and profile owner access regressed by no longer
requiring consent to access the identifiers. With this change device and
profile owners will still need to have the READ_PHONE_STATE permission to
access identifiers.

Bug: 117611604
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
      -t com.android.cts.devicepolicy.DeviceOwnerTest#testDeviceOwnerCanGetDeviceIdentifiers
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
      -t com.android.cts.devicepolicy.ManagedProfileTest#testProfileOwnerCanGetDeviceIdentifiers

Change-Id: Ib2d86440c531eab075d010de183ccfa45c2443e5
2018-10-15 16:45:12 -07:00
Eran Messeri
a2e0ca77a8 Enterprise Policy for Private DNS Setting
A new API for setting the Private DNS settings value programatically via
the DevicePolicyManager.

Since there are two separate settings for Private DNS, and the value
provided for the hostname needs to be validated, a new
DevicePolicyManager API is introduced.

Only a Device Policy Client in Device Owner mode may change these
settings.
The DPC may additionally set a user restriction (added in a separate CL)
to prevent the user from changing Private DNS settings.

Bug: 112982691
Test: atest com.android.cts.devicepolicy.DeviceOwnerTest#testPrivateDnsPolicy
Change-Id: I566437e4fe10e1346858149120c50b3c20ca073f
2018-10-15 11:53:22 +01:00
Michael Groover
6d20d75e9e Protect Device Identifiers behind priv permission and DO/PO checks
Bug: 110099294
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
      -t com.android.cts.devicepolicy.DeviceOwnerTest.testDeviceOwnerCanGetDeviceIdentifiers
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
      -t com.android.cts.devicepolicy.ManagedProfileTest#testGetDeviceIdentifiers
Test: cts-tradefed run cts -m CtsTelephonyTestCases -t android.telephony.cts.TelephonyManagerTest
Test: cts-tradefed run cts -m CtsPermissionTestCases -t android.permission.cts.TelephonyManagerPermissionTest

Change-Id: I3c82c53ec89cd17b34a61166ccc9e9747388efac
2018-10-09 13:44:02 -07:00
TreeHugger Robot
aeeb3f5eda Merge "BaseIDevicePolicyManager cleanup." 2018-10-04 14:35:40 +00:00
Makoto Onuki
8c7c5cc91e Persistent connection to SMS app 2/2 (main)
Bug: 109809543
Test: atest CtsAppBindingHostTestCases
Test: atest ${ANDROID_BUILD_TOP}/frameworks/base/services/tests/servicestests/src/com/android/server/am/PersistentConnectionTest.java
Change-Id: If927050fba5edea63137e10af5570c3450165237
2018-10-02 14:19:53 -07:00
Makoto Onuki
23961c8a80 Merge "Allow default SMS app to be always running" 2018-10-02 15:32:50 +00:00
TreeHugger Robot
e1251df8eb Merge "Device-wide unknown sources block option for DPC." 2018-10-02 13:07:25 +00:00
Lenka Trochtova
9ecde320ad BaseIDevicePolicyManager cleanup.
Move P APIs out of BaseIDevicePolicyManager.

Bug: 73469681
Test: make -j64 checkbuild
Test: make RunFrameworksServicesRoboTests

Change-Id: Ieffafb5c331b0befed5356f8d45e9ac6e0d81bee
2018-10-02 11:13:58 +02:00
Irina Dumitrescu
4638edd79f Device-wide unknown sources block option for DPC.
This adds a new framework user restriction that can be used by the DPC
to block installs from unknown sources on all profiles of a device.

Test: Manual test, disallowing installs in TestDPC disables installing
unknown sources apps.
Bug: 111335021
Change-Id: Ib9fb672c5e5dea2ac63bf8cbd1b04484b12b4056
2018-10-01 21:45:00 +01:00
Makoto Onuki
87d260a3a3 Allow default SMS app to be always running
Bug: 109809543
Test: atest CtsAppBindingHostTestCases
Test: atest services/tests/servicestests/src/com/android/server/am/PersistentConnectionTest.java
Change-Id: Ic016f2c073d178db4aa36268628ebf3880acb3c3
2018-09-28 14:48:53 -07:00
TreeHugger Robot
d2b1a57093 Merge "Suppress suppressing work profile removed notification if reason is null" 2018-09-20 18:06:28 +00:00
Zimuzo Ezeozue
3bf9f76b88 Merge "Add privileged APIs to lock device and reset device password" 2018-09-17 19:27:18 +00:00
Alex Chau
16d9490245 Suppress suppressing work profile removed notification if reason is null
Bug: 114711242
Test: cts-tradefed run singleCommand cts -m CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.ManagedProfileTest#testWipeDataWithoutReason
Change-Id: Icea2c95272f3d3d693c3289a5c4a55761026a8f9
2018-09-17 19:33:28 +01:00
Zimuzo
9f62a26385 Add privileged APIs to lock device and reset device password
In 534d732e9f274ad3f3e0637b9da963f889309afb, we are restricting privileged apps from silently becoming
Device Admins. Privileged apps can now call the following existing Device Admin APIs provided they have the correct permissions:
1. DevicePolicyManager#resetPassword -> Guarded by android.permission.RESET_PASSWORD
2. DevicePolicyManager#lockNow -> Guarded by android.permission.LOCK_DEVICE

The following existing Device Admin APIs already have alternatives hence no change required:
3. DevicePolicyManager#wipeData -> Send ACTION_FACTORY_RESET broadcast.
Guarded by android.permission.MASTER_CLEAR
4. DevicePolicyManager#setKeyguardDisabledFeatures -> Write '0' to LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS setting
Guarded by WRITE_SECURE_SETTINGS

Bug: 111153365
Bug: 112601004
Test: Manually tested with dev privileged app
Change-Id: Ia4e1ce9b81756e7f84ed0aa22d97e0b968cd8d89
2018-09-12 13:28:24 +01:00
Lenka Trochtova
3b6e08772e Revert the mandatory backups feature.
Bug: 79736299
Test: make RunFrameworksServicesRoboTests
Test: cts-tradefed run cts -m CtsBackupHostTestCase

Change-Id: I1209174c9f6aa794c7ca67f4a8737c0589d5fd69
2018-09-12 13:39:05 +02:00
TreeHugger Robot
6c1c842dc7 Merge "Frameworks: Annotate trivial @GuardedBy in services" 2018-09-10 22:18:40 +00:00
Eric Sandness
a521deb920 Merge "Block Policies From Device Admin Targetting Q" 2018-09-07 09:07:21 +00:00
Andreas Gampe
8ce7ed95a0 Frameworks: Annotate trivial @GuardedBy in services
Add @GuardedBy for simple functions that require locks and have a name in
one of the frameworks naming styles for locks ("^.*(Locked|LPw|LPr|L[a-zA-Z]|UL|AL|NL)$").

Derived by errorprone.

Bug: 73000847
Test: m
Change-Id: If70bb03313388af34d547efca20fb5115de95bf1
2018-09-05 17:02:08 -07:00
Eric Sandness
ca5969d6e0 Block Policies From Device Admin Targetting Q
If a device admin app targets Android Q or above, and it is not a device
owner or profile owner, throw a SecurityException if it attempts to
control the following policies:
  - DeviceAdminInfo.USES_POLICY_DISABLE_CAMERA
  - DeviceAdminInfo.USES_POLICY_DISABLE_KEYGUARD_FEATURES
  - DeviceAdminInfo.USES_POLICY_EXPIRE_PASSWORD
  - DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD

The set of policies available to a device admin targetting Android P or below is unchanged.

Bug: 111546201
Test: com.android.server.devicepolicy.DevicePolicyManagerTest
Test: com.android.cts.devicepolicy.DeviceAdminHostSideTestApi24
Test: com.android.cts.devicepolicy.DeviceAdminHostSideTestApi29
Test: com.android.cts.devicepolicy.ManagedProfileTest
Change-Id: Idcd0b4b91ad2fa363535c718928d382c7da054d4
2018-09-05 18:47:42 +01:00
Philip P. Moltmann
4e615e6986 Factor some RestrictedLockUtils out of SettingLib
Also make the new lib only use system-apis.

This allows mainline module to use the new
RestrictedLockUtilsSettingLib.

Unfortunately the whole RestrictedLockUtils would have caused to much
new system-api. Hence it was split into RestrictedLockUtils and
RestrictedLockUtilsInternal. This caused a lot of trivial code changes.

Bug: 110953302
Test: Built
Change-Id: I693b3bf56f3be71f0790776e3aad5694717786ef
2018-08-30 11:59:29 -07:00
Pavel Grafov
71a3d85bcb Use DPM's counter for invalid password attempts
Currently Keyguard uses separate counter for invalid password attempts
that is not persisted and is always initialized to zero after boot,
so if the user made several attempts and rebooted the device, the
device will show more allowed attempts before wipe than actually
available. The counter is also incorrectly reset to zero when
fingerprint is used successfully.

With this CL the same counter is used for that message and for actual
wipe triggering, it is persisted and is not reset upon reboot or
fingerprint authehtication.

Counting failed password attempts should be available in DevicePolicyManager
even without PackageManager.FEATURE_DEVICE_ADMIN.

Test: manual, tried using fingerprint and rebooting.
Bug: 112588257
Merged-In: I1f4012a95c6f6758885206f69e7ebe2c3704a567
Change-Id: I1f4012a95c6f6758885206f69e7ebe2c3704a567
2018-08-16 14:04:54 +00:00
Pavel Grafov
b90dc43e15 Use DPM's counter for invalid password attempts
Currently Keyguard uses separate counter for invalid password attempts
that is not persisted and is always initialized to zero after boot,
so if the user made several attempts and rebooted the device, the
device will show more allowed attempts before wipe than actually
available. The counter is also incorrectly reset to zero when
fingerprint is used successfully.

With this CL the same counter is used for that message and for actual
wipe triggering, it is persisted and is not reset upon reboot or
fingerprint authehtication.

Counting failed password attempts should be available in DevicePolicyManager
even without PackageManager.FEATURE_DEVICE_ADMIN.

Test: manual, tried using fingerprint and rebooting.
Bug: 112588257
Change-Id: I1f4012a95c6f6758885206f69e7ebe2c3704a567
2018-08-16 14:31:08 +01:00
Wale Ogunwale
6d50dcc8af Moved URI grants code out of ActivityManagerService to its own service (13/n)
Allows for other services like window manager to call uri grants without
holding AM service lock.

Bug: 80414790
Test: Existing tests pass.
Change-Id: Ie5b4ddb19a2cedff09332dbeb56bcd9292fd18ac
2018-07-23 16:37:46 -07:00
Eran Messeri
607a995691 DPM: Propagate StrongBox-related exception
When the caller attempts to generate a key via DevicePolicyManager
(using DevicePolicyManager.generateKeyPair), and specifies that
StrongBox should be used, throw the right exception indicating
StrongBox unavailability - the same one that is thrown if the same
parameters were passed to the KeyStore's key generation method.

This is achieved by catching the StrongBoxUnavailableException in
KeyChain, returning an error code indicating this particular failure
to the DevicePolicyManagerService, which then propagates it by
throwing a service-specific exception with a value indicating
StrongBox unavailability.
The DevicePolicyManager then raises StrongBoxUnavailableException.

Prior to this change the exception propagated from KeyChain would be
a generic failure so the caller would simply get a null result.

Bug: 110882855
Bug: 111183576
Bug: 111322478
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
Change-Id: I9abe3f449b48eb5a960fafbc15c59b9b4ce7a966
2018-07-17 12:58:13 +01:00
TreeHugger Robot
abe78cd313 Merge changes from topic "biometrics-face"
* changes:
  5/n: Move FaceService to biometrics directory
  4/n: Add face authentication framework
2018-06-22 18:44:27 +00:00
Gilad Bretter
cb51b8b847 4/n: Add face authentication framework
This change is cherry-picked and rebased from AOSP
https://android-review.googlesource.com/c/platform/frameworks/base/+/660242

Add face recognition as an identification method, following fingerprint
design. Unlike fingerprint, only one face template can be enrolled per
user, and a vendor message is passed from the HAL all the way to the
client callback to allow GUI indication about the enrolled face
templates.

Add FaceAuthenticationManager and FaceService.
Add face authentication capability to TrustManager and Keyguard.
Modify TrustManager and KeyguardUpdateMonitorCallback fingerprint code
to support generic biometric method to eliminate duplications.
Add BiometricSourceType enum to keep track of the specific biometric
method.

Test: biometric authentication still works on the device

Fixes: 110385761

Change-Id: I5d04fe69a112c13d3ef7330b9c08c146e36c5335
Signed-off-by: Gilad Bretter <gilad.bretter@intel.com>
2018-06-21 17:00:07 -07:00
Irina Dumitrescu
24ed35cd83 Add dpm force-network-logs command to force network logs retrieval.
This is useful because logs are batched every 1.5-2hrs if there are
not enough logs to fill up a batch. The command is throttled at
10 seconds as a spam prevention measure.

Bug: 62251154
Test: in adb shell run dpm force-network-logs. Observe a new batch
being created in the phone directory
/storage/emulated/0/Android/data/com.afwsamples.testdpc/files/. Also
observe a fresh batch is being displayed on the phone in the TestDPC
app, under "Retrieve network logs".
Change-Id: I5ff9d5c78497ea81533b5248816b4d6e160d338f
2018-06-20 16:23:58 +01:00
Wale Ogunwale
04d9cb5f40 Moved some activities implementation to ActivityTaskManagerService (2/n)
Second step in unifying the window hierarchy that is currently split
within AM and WM packages. We move some of the API implementation for
activities from ActivityManagerService.java to
ActivityTaskManagerService.java.

Test: Existing tests pass
Test: go/wm-smoke-auto
Bug: 80414790

Change-Id: I23dcd924493d8ad1e0b6e3a55386fd72b0146605
2018-06-12 13:38:39 -07:00
Pavel Grafov
2560f6f872 Only call getActiveAdminForCallerLocked when holding a lock
+ factored out all device-owner checking calls
+ some profile owner checks

Fixes: 110040849
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.DeviceOwnerTest#testSetTime
Test: create a profile with TestDPS, it sets profile name.
Change-Id: I5fec70505d089bd7dcea80eae3df9c0f2b7094dd
2018-06-12 15:57:34 +01:00
Pavel Grafov
acafeeb7de Merge "Start SecurityLogMonitor after broadcasts are allowed." into pi-dev am: 8e0ad6534d
am: eec59f4851

Change-Id: Ia4338c836ac7ca16548c82ffcd5c4d68ef43ab09
2018-06-07 10:53:03 -07:00
Pavel Grafov
3bca09f308 Start SecurityLogMonitor after broadcasts are allowed.
Otherwise if boot takes long enough, DO broadcast will be sent while
ActivityManagerSerivce is not ready, causing IllegalStateException.

Change-Id: I6b55ed45ed7b1f3ed9ad6ec20695907b4fa6f3b1
Fixes: 109746888
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.DeviceOwnerTest#testSecurityLoggingWithSingleUser
Test: provisioned TestDPC as DO in SuW, enabled logging.
2018-06-07 11:16:46 +01:00
Dianne Hackborn
2b8336f241 Merge "Allow device/profile owners to change app ops modes." into pi-dev am: adaca2146d
am: 82a87674ce

Change-Id: Id4a52aaca3d94075ff179141e96fba5c7326d4ee
2018-05-14 14:32:23 -07:00
Dianne Hackborn
d52544183e Allow device/profile owners to change app ops modes.
This allows them to continue to have this capability the
same as before we locked down access to it.

Bug: 78480444
Test: manual
Change-Id: If2b0722945235eb67676ace3f54efaa71a64bcde
2018-05-14 11:29:43 -07:00