942 Commits

Author SHA1 Message Date
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
TreeHugger Robot
4d600d150f Merge "Clear affiliation ids and lock task packages when clearing DO/PO" 2017-02-06 12:58:55 +00:00
Esteban Talavera
a7bd04e892 Clear affiliation ids and lock task packages when clearing DO/PO
Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest    frameworks-services
Change-Id: I38eea34cff82766c7e3b8cd79dd9757a212bb451
2017-02-03 12:20:20 +00:00
Rubin Xu
a55b168b5d Small tweaks in LockSettingsService
Paves way for synthetic password flow: Two notable changes:
1. when unify/un-unify work challenges, provide the old work profile password.
2. when clearing lock, supply old credentials.

Test: Unit test to be added in a follow up CL.
Bug: 33126414
Change-Id: I2a9553c5e7cc701338436e99e5a1289cebd1eda9
2017-02-02 18:44:46 +00:00
Makoto Onuki
f1e276384d DO NOT MERGE Do not call RecoverySystem with DPMS lock held am: 2317451acc am: 01f971dcdc
am: 963cba5b5b

Change-Id: I3a1421f656d1a90970eac6156e0840625662fb17
2017-02-02 01:15:44 +00:00
Makoto Onuki
963cba5b5b DO NOT MERGE Do not call RecoverySystem with DPMS lock held am: 2317451acc
am: 01f971dcdc

Change-Id: If5f5e5d47b97e2b8480adc5ca2cb08702056ca87
2017-02-02 01:10:43 +00:00
Makoto Onuki
01f971dcdc DO NOT MERGE Do not call RecoverySystem with DPMS lock held
am: 2317451acc

Change-Id: Id3441141d4feea4c7291350c9670bd59ec017240
2017-02-02 01:03:21 +00:00
Esteban Talavera
bdcada9762 Affiliated profile owners can set lock task packages
Mentioned that in the documentation, cleaned up the code
a bit and added unit tests

Bug: 34614754

Test: runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest    frameworks-services
Change-Id: I91232bbe494398015094ab977c6a2adce339811f
2017-02-01 15:02:22 +00:00
Makoto Onuki
2317451acc DO NOT MERGE 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 ApiDemos, both on 1) the primary user,
2) a secondary user and 3) work profile.

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

Bug 30681079

Change-Id: Ia832bed0f22396998d6307ab46e262dae9463838
Merged-in: Ia832bed0f22396998d6307ab46e262dae9463838
(cherry picked from commit efdec8f5688ce6b0a287eddb6d5dad93ffa0e1ee)
2017-01-31 21:21:36 +00:00
Edman Anjos
9e62c3111e Update in DPM delegation documentation.
Add note on DPM#setDelegatedScopes documentation regarding the
broadcast sent to the delegate package to notify its new scopes; and
change the admin ComponentName annotation to @Nullable in
DPM#getDelegatedScopes.

Bug: 33099995
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegation
Change-Id: I28fe3a631c05a9e6b8dae766ce6c42881f2e3a00
2017-01-30 17:11:40 +01:00
Edman Anjos
a5ec280b4a Fix delegation broadcast to send an ArrayList<String> extra.
Change DPMS to call Intent#putStringArrayListExtra to ensure the extra
is sent as an array list of strings.

Bug: 33099995
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegation
Change-Id: I1466fb457e34adbfb7704320c021210c1569f55f
2017-01-30 17:11:40 +01:00
Esteban Talavera
b3231029b5 Merge "Profile owners on a user can communicate with device owners" 2017-01-30 11:33:38 +00:00
Makoto Onuki
efdec8f568 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 ApiDemos, both on 1) the primary user,
2) a secondary user and 3) work profile.

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

Bug 30681079

Change-Id: Ia832bed0f22396998d6307ab46e262dae9463838
Merged-in: Ib97a92a6af87a5589d2643b9ae0522395735e1a5
2017-01-27 14:08:01 -08:00
TreeHugger Robot
695417c252 Merge "Fix DPM.getPermissionGrantState()" 2017-01-27 15:23:14 +00:00
Bartosz Fabianowski
2dbf9ae67a Fix DPM.getPermissionGrantState()
The recent addition of DPM API access delegation introduced a bug in
this method. When a system app (UID 1000) called the method, it would
crash.

Bug: 34760123
Test: DPM unit tests
Change-Id: I69390ca30270d64a4d28a74c13a7679f14a62959
2017-01-27 14:47:17 +01:00
Esteban Talavera
2f897917fd Profile owners on a user can communicate with device owners
Allow device owners and profile owners on a user
to communicate with each other, rather than restricting
it to device owners and managed profile owners as it is
at the moment

Bug: 34429083

Test:  runtest -c com.android.server.devicepolicy.DevicePolicyManagerTest    frameworks-services
Test: cts-tradefed run cts -a armeabi-v7a --module DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerPlusManagedProfileTest
Change-Id: I81561a9838c3ccb623354a1b718da2fc6a5af1fe
2017-01-26 18:40:59 +00:00
Michal Karpinski
f329254053 Merge "Change batch finalization timeout mechanism from Handler#sendMessageDelayed() to a wakeful alarm" 2017-01-26 15:15:14 +00:00
Michal Karpinski
1710e5f079 DO NOT MERGE Change batch finalization timeout mechanism from
Handler#sendMessageDelayed() to a wakeful alarm

Messages sent with Handler#sendMessageDelayed() didn't get delivered
until the device woke up after being idle, which resulted in
potentially very long windows of logs accumulation and highly possible
network log loss from before the device becaming idle.

Bug: 34157435
Test: manual with decreased timeout over a few timeout iterations
Change-Id: I22d9cc743acb1a478d2da5407c5718e7f95e89cb
2017-01-26 12:48:56 +00:00
Michal Karpinski
9a2e4207d7 Change batch finalization timeout mechanism from
Handler#sendMessageDelayed() to a wakeful alarm

Messages sent with Handler#sendMessageDelayed() didn't get delivered
until the device woke up after being idle, which resulted in
potentially very long windows of logs accumulation and highly possible
network log loss from before the device becaming idle.

Bug: 34157435
Test: manual with decreased timeout over a few timeout iterations
Change-Id: I50b29b9f132856a629e28f46c022f21976bd92fb
2017-01-26 12:45:45 +00:00
phweiss
73145f4e60 Create public API for policy transparency outside of Settings
The new DPM.createAdminSupportIntent() returns an intent that shows the
"This action was disabled by your admin"-dialog from settings.
This enables apps to inform the user about the cause of restricted
functionality.

A new extra for the intent allows to specialize the dialog for different
restricted features, instead of a generic message for all features.

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

Change-Id: I3de7aeec0f88b8f013a63957aec803cd123fbedc
2017-01-25 22:20:46 +01:00
Edman Anjos
452efaac32 Merge changes I50d2903e,Ieb347ce3
* changes:
  Add DPMS delegation scopes.
  Add block uninstall delegation in DPMS.
2017-01-25 18:00:03 +00:00
Esteban Talavera
8f3b34338a Merge "Wipe device or profile if max failed attempt reached" 2017-01-25 16:17:38 +00:00
Edman Anjos
52088e4859 Add DPMS delegation scopes.
Implement the permission grant, package access, enable system app, and
keep uninstalled packages delegation scope APIs in the
DevicePolicyManagerService.

This feature gives a device owner or profile owner the ability to
delegate some of its privileges to another application.

Bug: 33105287, 33105284, 33105719
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegation
Change-Id: I50d2903eb73ae7844ec1f6fe07e41101ea2760ea
2017-01-25 16:53:50 +01:00
Edman Anjos
a5f2fb1a43 Add block uninstall delegation in DPMS.
Implement the uninstall blocker delegation scope API in
DevicePolicyManagerSercice.

This feature gives a device owner or profile owner the ability to
delegate some of its privileges to another application.

Bug: 33105718
Test: cts-tradefed run cts-dev --module CtsDevicePolicyManagerTestCases --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegation
Change-Id: Ieb347ce3fb6219fe7f04cafbcd1e6b7359b31a10
2017-01-25 16:31:13 +01:00
Edman Anjos
4877b9c298 Merge "Refactor DPMS Cert Installer and App Restrictions delegation." 2017-01-25 15:19:28 +00:00