Commit Graph

1197 Commits

Author SHA1 Message Date
Adrian Roos
027ff08622 Merge "DPM: Fix regression from I54376f60ac53451ace22965d331b47cd8c2e614e" 2019-01-08 11:47:30 +00:00
Adrian Roos
ea8d82c08a DPM: Fix regression from I54376f60ac53451ace22965d331b47cd8c2e614e
Fixes an issue where setting a password via DPM would never
satisfy a QUALITY_COMPLEX password requirement.

Change-Id: I3fbc952bd44291ac22728c626b128fc0c1aae232
Fixes: 120915644
Bug: 110172241
Test: atest 'com.android.cts.devicepolicy.DeviceAdminHostSideTestApi24#testRunDeviceOwnerPasswordTest'
Test: Set credential via DPM.resetPassword(), factory reset device to trigger FRP, verify FRP shows.
2019-01-07 16:58:35 +01:00
Yohei Yukawa
a4710f3dce Remove a redundant Binder.clearCallingIdentity()
Following method/fields access should never require system server
priviledge.  Hence there is no need to clear calling identity.

  * ApplicationInfo#flags
  * InputMethodInfo.getServiceInfo()
  * ServiceInfo#applicationInfo
  * ServiceInfo#packageName

This CL should be no user-observable behavior change.

Bug: 120709962
Test: Manually verified as follows.
  1. Build aosp_taimen-userdebug and flash it
  2. Install TestDPC.
  3. Set up a work profile
  4. Open TestDPC in the work profile mode.
  5. Tap "Set input methods"
  6. Tap "OK"
  7. Open Settings App -> System -> Languages & input -> Virtual keyboard
  8. Tap "Manage keyboards"
  9. Make sure nothing crashes.
 10. make -j SoftKeyboard
 11. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
 12. Open TestDPC in the work profile mode.
 13. Tap "Set input methods"
 14. Make sure that "Sample Soft Keyboard" is unchecked.
 15. Tap "OK".
 16. Open Settings App -> System -> Languages & input -> Virtual keyboard
 17. Tap "Manage keyboards"
 18. Make sure that you cannot enable "Sample Soft Keyboard"
Change-Id: Idce0ac68ee6a6ca6e1186bd2adf9bd07a1f9f397
2018-12-24 21:23:12 -08:00
TreeHugger Robot
d21496879a Merge "Private DNS: Fix handling of null mode" 2018-12-21 12:19:22 +00:00
Eran Messeri
65acd23492 Private DNS: Fix handling of null mode
Address the case where the Private DNS mode has not been set at all, so
the value obtained from settings when reading it is null.

Java cannot cope with null value in a switch statement, so translate
that case to the default value (from the ConnectivityManager), in the
same way the Settings code does when presenting Private DNS mode to the
user.

Bug: 112982691
Test: Factory reset a device, then atest com.android.cts.devicepolicy.DeviceOwnerTest#testPrivateDnsPolicy
Change-Id: Ife6b5c15b70517f75d8815103a19a9ef72122212
2018-12-21 10:05:47 +00:00
TreeHugger Robot
fd473a32ef Merge "Fix iterator misuse" 2018-12-17 11:55:47 +00:00
xshu
5e288b9cdb DevicePolicyManager get factory MAC
Since MAC randomization will be randomized by default in Q,
which means the current MAC could change arbitrarily, the
existing API need to be modified to always get the factory MAC.

Bug: 111634904
Test: atest DevicePolicyManagerTest
Change-Id: I91a150fe4439ecef3836abb3c1ed087837a5fc67
2018-12-14 17:15:10 -08:00
Antoan Angelov
4297efb252 Merge changes I0863b40a,I4810f5e3
* changes:
  Add metrics for DevicePolicyManagerService methods (Part 2)
  Add additional event ids for DevicePolicyEvent atom.
2018-12-14 22:05:57 +00:00
Rubin Xu
57eb705e9b Fix iterator misuse
Fix a bug where we iterate through a map with an iterator while deleting
some elements (on the map directly, not using the iterator) at the same time.

Bug: 112982695
Test: atest com.android.cts.devicepolicy.MixedProfileOwnerTest#testDelegation
Change-Id: Id46701791d9666ed653683f41e82e3b1d2288432
2018-12-14 12:22:28 +00:00
arangelov
59486636d6 Add metrics for DevicePolicyManagerService methods (Part 2)
CTS tests will be added in a later CL.

Bug: 119911940
Test: Manual
Change-Id: I0863b40add42bb3927c582d819b0cee0184d6501
2018-12-13 13:55:50 +00:00
Rubin Xu
fd4a3b441b Implement DELEGATION_PACKAGE_INSTALLATION
Previously a Device Owner or an affliated Profile Owner of the DO can silently
install APKs via PackageInstaller APIs. This CL additionally grants delegates
of DO the same access.

Bug: 112982695
Test: atest com.android.cts.devicepolicy.MixedProfileOwnerTest#testDelegation
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegation
Test: atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDelegation
Change-Id: I777ee6aa1ecd036ee56270fc6b4e86b74d1042a6
2018-12-12 23:22:59 +00:00
TreeHugger Robot
559ff8acbc Merge "New API for getting the screen lock complexity" 2018-12-12 21:12:43 +00:00
Yueming Wang
3dc2f1ef59 Merge "Add API to view calendar events cross profile." 2018-12-12 19:07:05 +00:00
TreeHugger Robot
ccb3c07030 Merge "Add metric for managed system update callback." 2018-12-12 18:10:12 +00:00
Rubin Xu
eb45862718 Merge "Add three new delegation capabilities for profile/device owner" 2018-12-12 17:47:12 +00:00
Bernard Chau
e958655829 New API for getting the screen lock complexity
Return parent profile screen lock complexity if unified challenge is used

Bug: 111173457
Test: atest FrameworksCoreTests:PasswordMetricsTest
      atest FrameworksServicesTests:DevicePolicyManagerTest
      atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.PasswordComplexityTest
      manual test with sample app

Change-Id: I99f8bd644c5119590f49add98f216c4a527d6f2d
2018-12-12 17:43:49 +00:00
arangelov
4d2ccb15a5 Add metric for managed system update callback.
Bug: 120677469
Test: Manual
Change-Id: Id5535848fe6afa7ae27abe7d563b880dc51310ea
2018-12-12 13:56:35 +00:00
yuemingw
369f96dd98 Add API to view calendar events cross profile.
Bug: 118456236
Test: .manual by TestDPC
cts test will be added later
Change-Id: I0d36586ea6017dea446abd8e609c2712ba88e93c
2018-12-11 22:20:33 +00:00
Rubin Xu
99a66a9032 Add three new delegation capabilities for profile/device owner
* DELEGATION_NETWORK_LOGGING
Allow delegated apps to control and retrieve network logging

* DELEGATION_CERT_SELECTION
Allow delegated apps to automatically select client certificates for apps.

* DELEGATION_PACKAGE_INSTALLATION
Allow delegated apps to silently install packages.

Also introduce DelegatedAdminReceiver which is analogue of the existing
DeviceAdminReceiver and enables delegated apps to receive system callbacks
related to their delegated capabilities.

This CL introduces the three new delegation scopes as well as some
implementations changes required to support these three delegations.
it also implements the actual logic around DELEGATION_NETWORK_LOGGING
and DELEGATION_CERT_SELECTION. Handling DELEGATION_PACKAGE_INSTALLATION
will be implmented in a subseqent CL.

Bug: 112982695
Test: atest com.android.cts.devicepolicy.MixedProfileOwnerTest#testDelegation
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegation
Test: atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDelegation
Test: Manual with TestDPC-replica
Change-Id: I508fdda0572041cf121d0e297c93d51e981545e3
2018-12-11 21:16:31 +00:00
Alex Kershaw
8a8430bff0 Merge "Add isManagedKiosk system APIs." 2018-12-11 17:02:25 +00:00
Alex Kershaw
2418ea970b Add isManagedKiosk system APIs.
Add system APIs isManagedKiosk and isUnattendedManagedKiosk. These will
be defined in the CDD.

The intention is to have privacy and security-approved definitions that
future features (removing user consent dialogs, stronger APIs) can use
specifically for publicly-accessible dedicated devices.

We use 'kiosk' rather than 'publicly-accessible dedicated device' for
ease-of-use, which is actually consistent with ChromeOS.

Bug: 111384878
Test: Each use will have its own CTS tests. The definitions themselves
will be in CDD. Currently tested by calling the methods in TestDPC.
Change-Id: If080a3b9dae285bc28823e6004750908009130d2
2018-12-11 13:01:11 +00:00
TreeHugger Robot
4c47901848 Merge "Add metrics for DevicePolicyManagerService methods (Part 1)" 2018-12-10 18:14:43 +00:00
TreeHugger Robot
2eb3473d0d Merge "Private DNS connectivity check" 2018-12-08 22:50:21 +00:00
arangelov
37a6217e5b Add metrics for DevicePolicyManagerService methods (Part 1)
CTS tests will be added in a later CL.

Bug: 119911940
Test: Manual
Change-Id: I040deec232e40b223821a5c521661310f78e6cba
2018-12-07 22:03:42 +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