149 Commits

Author SHA1 Message Date
Amith Yamasani
cd410ba4e8 Use the correct method to check if device is encrypted
DPM's method will return false if encrypted by default password,
preventing the changing of encryption password to lockscreen password.

Check if the device is encrypted by some means, instead.

Also fix a SecurityException when Device Admin queries encryption state
(recent regression)

Bug: 17881324
Change-Id: Id897e61c5e254ab3f8dc569285428a73005303ea
2014-10-17 11:43:57 -07:00
Jim Miller
3836c9a4c1 Fix getStorageEncryptionStatus() in DevicePolicyManager
This fixes a bug introduced by a change where the function
ignores systems with default encryption where it's disabled.

The fix also checks to see if vold thinks the device is secure.

Fixes bug 17881324

Change-Id: I2c40f76cf990d90d1a825955aa3b080b21684426
2014-10-15 13:15:52 -07:00
Amith Yamasani
2c3886cb34 Merge "Fix admin policies in managed profiles" into lmp-dev 2014-10-15 17:44:24 +00:00
Amith Yamasani
242f4b1259 Fix admin policies in managed profiles
Some of the admin policies are throwing security exceptions in
a managed profile without being documented correctly and others
shouldn't be throwing security exceptions.

Changed setCameraDisabled() to not throw an exception. It now just
prevents work profile apps from using the camera.

Changed wipeData() to allow passing in ERASE_EXTERNAL_STORAGE. In
secondary users/profiles, this is just going to remove the user, so
the flag is harmless.

Updated documentation for setKeyguardDisabledFeatures() and resetPassword()
to indicate that they cannot be called in a managed profile.

Bug: 17987913
Change-Id: I8060be4c2d32bdd4edb46ce543551fabb9c8c983
2014-10-15 10:42:17 -07:00
Svetoslav
28433dbdab Fix a NPE in device policy manager service.
It is possible that the device does not have an owner. If there
is no owner we get a NPE when asking the device policy manager
for cross-profile widget providers.

bug:17989189

Change-Id: I5759f2dec160ed8076ab47fdf09134f78c57458d
2014-10-14 15:53:17 -07:00
Robin Lee
d0130e8539 DevicePolicy: One cert tracker warning per profile
Shows one notification per profile instead of one notification per
user or (previously) one notification per device.

Bug: 17794425
Change-Id: I6f0d34a16fa2a45082941387ac765dd99eefa131
2014-10-09 12:46:13 +01:00
Kenny Guy
baa05930ec Merge "Ignore badly formed ComponentNames when loading device_owner.xml" into lmp-dev 2014-09-25 16:42:11 +00:00
Kenny Guy
be16357f40 Ignore badly formed ComponentNames when loading device_owner.xml
In the past we wrote out badly formed ComponentNames with no
class part. Loading these results in a null pointer exception
blocking boot.

Bug: 17652534
Change-Id: Iec592343425a23c7ada5f73cf30b8646d31eae81
2014-09-25 17:03:53 +01:00
Jeff Sharkey
004a4b20f8 Include reason when wiping data.
This will help us track down who requested a data wipe.

Bug: 17412160
Change-Id: If8413e5d6377773f37e8b34ae3d26347226a027c
2014-09-24 13:58:09 -07:00
Amith Yamasani
8d9f121618 Merge "Allow primary user profile owner to set device restrictions" into lmp-dev 2014-09-19 15:51:39 +00:00
Jessica Hummel
dd31a10c7f bug fix: Allow enableSystemApps to be called by profile and device owner.
We had an additional check for managed profile in there, so it wasn't working for device owners. Also needed to look at uninstalled packages.

Change-Id: I4813f23b00d7905e92ade582ce082a6f295a322d
Bug: 17384318
2014-09-19 09:56:19 +00:00
Amith Yamasani
c34dc7cdeb Allow primary user profile owner to set device restrictions
In addition to device owners, profile owners on the primary user
can also set user restrictions that are necessary to lock down the
user.

This is to enable the case of a profile owner registered after setup
wizard is completed, on the primary user.

Also make managed profile vs. profile wording consistent in the
DevicePolicyManager docs.

Bug: 17555025
Change-Id: Ib9d08b8af34a99b25e11757fa7dc83673a7deb32
2014-09-18 15:14:26 -07:00
Amith Yamasani
d616a33578 Prevent device owner registration after setup is complete
This change prevents adding a device owner after setupwizard
has finished provisioning. Only the new dpm shell command
can set a device owner.

Bug: 17316711
Change-Id: I98bdfd9b8c8da3042111c45e2e7fd2b559fac510
2014-09-12 11:25:51 -07:00
Esteban Talavera
d09fbafa92 Merge "Add new adb dpm (= DevicePolicyManager) command" into lmp-dev 2014-09-12 10:35:44 +00:00
Esteban Talavera
b5ef162129 Add new adb dpm (= DevicePolicyManager) command
Adds new adb command to execute DevicePolicyManager tasks. First subcommand
allows us to set a device owner on a provisioned device (provided no accounts
are associated with the device). This is required as GTS tests run on provisioned
devices. We plan to add more subcomands required for new GTS tests, such as the
ability to create a managed profile.

Bug: 17312478, 17316711
Change-Id: I2613178ea82a6c6268e7f8012e74c4a852fea0d4
2014-09-12 11:33:59 +01:00
Bernhard Bauer
26408ccd8e Add DevicePolicyManager PrivateKey mgmt
Additional device policy API to install keypairs to the keychain
silently.

Bug: 15065444
Change-Id: Idc25774c9ab1a61080290bebd6f5c4f24e6ee2e0
2014-09-11 19:17:00 +01:00
Amith Yamasani
f58e532e01 Merge "Apply cross-user restrictions to Shell" into lmp-dev 2014-09-11 16:46:34 +00:00
Julia Reynolds
d86734b469 Merge "Allow device owners to update LOCATION_MODE." into lmp-dev 2014-09-11 15:46:07 +00:00
Amith Yamasani
8cd28b57ed Apply cross-user restrictions to Shell
Even though Shell user is allowed to perform cross-user actions,
lock that path down if the target user has restrictions imposed by
the profile owner device admin that prevents access via adb.

If the profile owner has imposed DISALLOW_DEBUGGING_FEATURES, don't
allow the shell user to make the following types of calls:
start activities, make service calls, access content providers,
send broadcasts, block/unblock packages, clear user data, etc.

Bug: 15086577
Change-Id: I9669fc165953076f786ed51cbc17d20d6fa995c3
2014-09-10 17:15:06 -07:00
Amith Yamasani
a240d8377a Merge "Don't allow guests to install from unknown sources" into lmp-dev 2014-09-05 16:32:30 +00:00
Julia Reynolds
82735bcb14 Allow device owners to update LOCATION_MODE.
Bug: 17388933
Change-Id: If3267aa52c2611cf764a19bee019c312f6ebf5d1
2014-09-04 16:43:30 -04:00
Craig Mautner
127343cb46 Merge "Eliminate deadlock by deferring wipe data call" into lmp-dev 2014-09-04 20:41:39 +00:00
Craig Mautner
66eb521833 Eliminate deadlock by deferring wipe data call
The call to RecoverySystem.rebootWipeUserData() was made while
holding the lock to DevicePolicyManagerService. But it blocks
waiting for system_process' main thread to receive the ordered
broadcast complete callback. It won't receive that callback
because Keyguard is running on the main thread and is concurrently
blocked on DevicePolicyManagerService.

By moving the call to rebootWipeUserData() out of the synchronized
block the deadlock is eliminated.

Fixes bug 16870054.

Change-Id: I3eb587211e5484859cc9dab7e80e5a1f6c85225d
2014-09-04 12:56:39 -07:00
Amith Yamasani
29ce85bab9 Don't allow guests to install from unknown sources
Added a user restriction when creating a guest.
Made sure that guests can't install profile owners that
could undo the restriction.

Bug: 17359648
Change-Id: Icdd919e8b1cbd79a69aacb76e573ec3449f18e4c
2014-09-03 17:30:43 -07:00
Esteban Talavera
808f6ef2ac Pass ComponentName to probing certificate methods
Pass ComponentName and check whether that admin is a profile owner on DPM
get/has certificate methods (requested on the API review).

As per Change I55eec17e01489ab323f8a0e68b11592605a7b740, not keeping track of
which admins installed which certificates for now:

"Having per-admin CA certificates would be a fair bit of work. The only MDMs
we're opening this up to for now are Device and Profile Owners which 100%
manage the profile so will be the only admin.
It seems like if we keep track of "who installed which certs" it'll be a little
pointless because the answer will always be "the ProfileOwner" for every single
one."

Bug: 17005622
Change-Id: I45e9dac5236ab4ed235a341c208ac3cb6aba17da
2014-09-03 11:50:55 +00:00
Julia Reynolds
a8528c6420 Merge "Audio/Micrphone user restriction/multiuser updates." into lmp-dev 2014-08-28 19:41:42 +00:00
Robin Lee
65c2797082 Relocate broken getCallingUserId() calls
This should not be invoked while the calling identity is cleared
because it will return the current user rather than the calling user.

Bug: 17314802
Change-Id: I587daa420b0976d41928ab7c34eeda2329c1341e
2014-08-28 16:59:11 +01:00
Esteban Talavera
729b2a6c2f Renamed getUninstallBlocked to isUninstallBlocked
As per API review.

Bug: 17297103
Change-Id: Icb4ceded317b0df4deb0f5221512541a632e150b
2014-08-28 10:56:18 +01:00
Julia Reynolds
b53453fae0 Audio/Micrphone user restriction/multiuser updates.
1. Persist microphone mute state.
2. Set mute state for correct user.
3. Check for settings restrictions as the correct user.

Bug: 17177502
Bug: 16701642
Change-Id: Id8b6cd90c5caceb67fbec862f90aac7ec7a00b3c
2014-08-27 16:25:00 -04:00
Julia Reynolds
19d431f330 Merge "Limit the settings profile/device owners can update." into lmp-dev 2014-08-27 16:49:46 +00:00
Julia Reynolds
9ed66da8df Limit the settings profile/device owners can update.
Bug: 16351901
Change-Id: Id33a57ad651b5b7b58de0549eb90d5a1fe5c19c5
2014-08-27 11:49:37 -04:00
Sander Alewijnse
0ced627291 Provide lockdown of date/time device owners.
Fixed two minor issues with the screencapture as well.
Updated documentation and added enforceCrossUserPermission.

Bug:16948504
Change-Id: I9a645dcf480a4a044879ba481bce964d06fe5153
2014-08-26 14:44:53 +01:00
Jason Monk
de3af82ce0 Merge "Write device owner name to XML" into lmp-dev 2014-08-21 20:28:10 +00:00
Jason Monk
4e7a65f15c Write device owner name to XML
So that it can be remembered.

Bug: 17153003
Change-Id: I6fb96334f235348bc237cc52e09c2fe5ef1332b7
2014-08-21 15:50:48 -04:00
Esteban Talavera
d5c5c13c85 Rename get/setBlockUninstall() to get/setUninstallBlocked()
As requested in the API review

Bug: 17005622
Change-Id: I1332ad11e588ab3fa409f2a28222608936cb383e
2014-08-21 15:30:13 +01:00
Esteban Talavera
8c5c373647 Merge "Remove setApplicationsHidden" into lmp-dev 2014-08-21 14:17:25 +00:00
Kenny Guy
b9e468cb9d Merge "Add apis for whitelisting IMEs and accessibility services." into lmp-dev 2014-08-21 10:54:26 +00:00
Esteban Talavera
115cd65d2a Remove setApplicationsHidden
As requested in the API review. This version (the one that takes an Intent) was used only in the DeviceAdminSample and some CTS tests.

Bug: 17005622
Change-Id: I9984b22836417ad4d025302f61bd91704e9345a4
2014-08-21 10:29:38 +01:00
Kenny Guy
fa80a4faa3 Add apis for whitelisting IMEs and accessibility services.
Adds apis for device / profile owners to white list
the accessibility and input methods a user can enable.

Bug: 14469005
Change-Id: I921888660d29a5370395db87adf75d4d106660c9
2014-08-20 22:30:05 +01:00
Svet Ganov
6bd702538d Notify app widget hosts when cross-profile providers change.
1. Notify the hosts in the group if a package gets white-listed or
   un-white-listed for providing widgets across profiles.

2. Notify hosts in the group for provider changes when a profile
   is deleted.

bug:17126070

Change-Id: Ic719c1c68e45842d50decc95603f1d61583b8f02
2014-08-20 20:25:10 +00:00
Julia Reynolds
afe7a2c9c3 Merge "Prevent profile owners from setting certain user restrictions." into lmp-dev 2014-08-16 04:03:42 +00:00
Julia Reynolds
2cb384f425 Prevent profile owners from setting certain user restrictions.
Bug: 16351901
Bug: 16701492
Change-Id: Ie866bc24d2d7cc15f86c5b50062a730e099612a1
2014-08-20 16:06:29 -04:00
Selim Cinek
255dd04271 Added notification color to all system notifications
Bug: 17128331
Change-Id: I81a94510ef51b99916f314c0dd65852426a1fbeb
2014-08-20 14:25:18 +02:00
Jason Monk
95d9ad0f79 Merge "Fixes to lock task API from API review" into lmp-dev 2014-08-16 04:32:18 +00:00
Julia Reynolds
d438deffad Merge "Apply lockdowns when user restrictions are set." into lmp-dev 2014-08-15 19:03:20 +00:00
Julia Reynolds
3d9eb78fe9 Apply lockdowns when user restrictions are set.
Previously DMAgent would apply these lockdowns before/
after setting the matching user restrictions.

Bug: 16701642
Bug: 16945830
Bug: 16944983
Change-Id: Ib4f7145055687f12408d6ccacd8e6380406a32b2
2014-08-15 16:16:38 -04:00
Narayan Kamath
29564cd245 Remove system_server classes from the boot image.
We set the system_server classpath in the environment
(like we do with BOOTCLASSPATH). After the zygote forks
the system_server, we dexopt the classpath (if needed)
and then launch the system server with the correct
PathClassLoader. This needed several small / medium
refactorings :

- The logic for connecting to installd is now in a separate
  class and belongs in the system_server.
- SystemService / SystemServiceManager have now moved to
  classes.jar. They are only used from there, and since they
  use Class.forName, we want them to be loaded by the
  system_server classloader, and not the bootclassloader.
- BootReceiver now moves to frameworks.jar, because it is
  used by ActivityThread and friends.

bug: 16555230

Change-Id: Ic84f0b2baf611eeedff6d123cb7191bb0259e600
2014-08-15 13:37:03 +01:00
Jason Monk
48aacba761 Fixes to lock task API from API review
Adding ComponentNames and some splitting/renaming of broadcasts.

Bug: 17005622
Change-Id: I9ece3553310fb20b0c3c3e4032b408e86384363a
2014-08-14 11:37:58 -04:00
Adrian Roos
b8b4774e61 Fix NPE in DevicePolicyManagerService that crashed SystemUI
Bug: 16857795
Change-Id: I6234f03c4ee31311af9f9c556b790594ee1a8b2f
2014-08-07 15:55:21 +02:00
Esteban Talavera
00f201e41b Merge "Wipe only managed profile when max number of incorrect passwords exceeded" into lmp-dev 2014-08-05 00:35:13 +00:00