338 Commits

Author SHA1 Message Date
Jeff Brown
c1aebfa02c Merge "Clean up USB Manager and fix ADB." into mnc-dev 2015-07-09 20:03:29 +00:00
Jeff Brown
460a146eb8 Clean up USB Manager and fix ADB.
Moved functions which parse the USB functions list into one common
place on UsbManager.

Deleted the no longer supported USB_FUNCTION_MASS_STORAGE.

Ensured that the UserManager.DISALLOW_USB_FILE_TRANSFER rule is
consistently applied during user switch and when changing the
current USB functions and make sure it only affects MTP and PTP.

Collapsed the boot completed and user switched receivers to
ensure consistent ordering of side-effects.

Validate the list of functions passed to setCurrentFunction() so
that the separation of concerns is clearer.  It was somewhat
ambiguous as to whether functions such as ADB could / should be
enabled through that interface.  Improved the docs for clarity.

Fixed a bunch of broken stuff related to the USB config
persistent property (list of default functions) that could cause
ADB and other functions to not work at all.  Added new failsafes
to ensure that we reliably get back into a happy state.

Bug: 22206076
Change-Id: I02915ddfce7193a8f67a14f0d76bab22fc575dfa
2015-07-09 12:55:56 -07:00
Kenny Guy
70e0c58c22 Mute correct user from device policy manager.
Add per user versions of mute methods so
device policy manager can mute the correct
user.
Just persist change if the calling user
isn't the current user.
Treat calls to audio manager coming from uid
1000 as if they were coming from current user
rather than user 0 so that the correct user's
user restriction is checked.

Bug: 21782066
Bug: 21778905
Change-Id: I51469b741096d8a2ffdc520eaf5b3fd754f2c819
2015-07-08 19:33:13 +01:00
Alex Chau
7ce2bd2161 Clear "profile wiped" notification when a new porfile is created
Make use of ACTION_MANAGED_PROFILE_ADDED to clear the notification.

Bug: 22186884

Change-Id: I08514ebc308f2e2fb61f837500e2ba712ccf8703
2015-06-30 15:19:55 +01:00
Esteban Talavera
fef8cbd6a6 Merge "Marking some globals from setGlobalSetting as not supported" into mnc-dev 2015-06-30 08:55:38 +00:00
Esteban Talavera
656fa7f5d1 Marking some globals from setGlobalSetting as not supported
Those globals don't have the intended behaviour any more.

Bug: 19967818
Change-Id: I8c7891e59280f9deb88b1f0ffead3de07f4eca56
2015-06-29 17:41:39 +01:00
Rubin Xu
e8490f1d78 Use StorageManager.wipeAdoptableDisks to wipe external disks
Retire FORMAT_AND_FACTORY_RESET which is more fragile.

Bug: 9433509
Change-Id: I158ee987274bb4db41d466de9f1e3c60ffc1d140
2015-06-26 15:58:21 +01:00
Esteban Talavera
28b9570d02 Reset permission policy to default when device owner goes away
Otherwise after the Device Owner is gone, runtime
permissions might still be auto granted/denied.
I understand that there are many other policies that
we don't reset after the device/profile owner goes
away (e.g. keyguard enabled/disabled). At least now
we have a single method when we could clear the
ones that we care about.

Bug: 21889278
Change-Id: I6997655e6ef6d474bd25ae1c323eca5b17944b16
2015-06-24 17:19:19 +01:00
Amith Yamasani
0bf8f7cc39 Runtime permissions cannot be set on legacy apps by device policy
Clarify docs that runtime permissions can be granted or revoked by
a profile owner/device owner only for MNC apps and not legacy apps.

Check the targetSdkVersion and return false if legacy app.

Remove all policy flags from permissions when cleaning up
a device or profile owner.

Bug: 21835304
Bug: 21889278
Change-Id: I4271394737990983449048d112a1830f9d0f2d78
2015-06-23 12:01:36 -07:00
Zoltan Szatmary-Ban
2c3c66a2cf Merge "Introduce Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN" into mnc-dev 2015-06-23 08:44:49 +00:00
Robin Lee
58e706d754 Merge "Let device owners handle onChoosePrivateKey" into mnc-dev 2015-06-22 23:51:02 +00:00
Robin Lee
deee7735d8 Let device owners handle onChoosePrivateKey
Bug: 21959745
Change-Id: Ifad3901015937d2ea700124bb5f61982cd580ad8
2015-06-22 11:11:13 -07:00
Benjamin Franz
1046ba518b Add DISALLOW_CREATE_WINDOWS to Device Owner only user restrictions
Even though the documentation of DISALLOW_CREATE_WINDOWS says it is for
Device Owners and Profile Owners on User 0 only, it was previously not
part of DEVICE_OWNER_USER_RESTRICTIONS and was therefore callable from
a profile owner on a managed profile or secondary user.

Bug: 19726884
Change-Id: If6443eacbc28b7ee6c0845754923573a79f8bde3
2015-06-17 16:13:31 +01:00
Jeff Sharkey
2cc03e5606 Yet another user restriction.
Change-Id: Ia2952da19cb974a6a9ba0271a298a10df58b8d18
2015-06-15 21:50:47 -07:00
Alex Chau
b24f01f473 Merge "Notification shown upon work profile deletion" into mnc-dev 2015-06-12 10:14:27 +00:00
Craig Lafayette
77b2d49abb Merge "Remove device initializer status messages" into mnc-dev 2015-06-11 17:45:03 +00:00
Alex Chau
c51b72acc0 Notification shown upon work profile deletion
Bug: 18543323

Change-Id: Ibd9bd20637a7bd019e080da306a19c94d9e82576
2015-06-11 15:17:53 +01:00
Robin Lee
83881bdbde Policy: make bulk CA uninstalls happen in service
Fewer round trips, only one point of contact for bugs to creep in.

Bug: 21650477
Change-Id: I1764faa753bd674ecb0d13149d778d99bd2ff4c4
2015-06-10 19:40:44 +00:00
Julia Reynolds
cedd53adc3 Remove the ability to set a preferred setup activity.
Bug: 21557327
Change-Id: I8c1809d25c5f5fcd186dfc0636d8ac47ed5fc903
2015-06-09 12:34:27 -04:00
Zoltan Szatmary-Ban
4045d24971 Introduce Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN
This setting controls whether WiFi configurations created by a Device Owner app
should be locked down (that is, editable or removable only by the Device Owner).

Bug: 21427528
Change-Id: I0f8fb72bf9da1597e08d3dfc631d37b6b4178ff5
2015-06-08 15:00:21 +01:00
Amith Yamasani
369d656533 Fix permission check in DPM.getPermissionGrantState
It was querying for permission of user 0 instead of the calling user.
Switched to passing in the explicity userId.
Also set the flags before granting/revoking permission from DPM.

Bug: 21430988
Change-Id: Id0d2dc65e20108cefa3eeb4363f866d49c791cc4
2015-06-04 17:58:11 -07:00
Craig Lafayette
240e64828f Remove device initializer status messages
- Remove ManagedProvision Bluetooth extras from
  DevicePolicyManager
- Remove ManagedProvisioning device initializer status
  action and extras from DevicePolicyManager.
- Remove DIA status update protected-broadcast
  and permission
- Remove DPM.sendDeviceInitializerStatus method

Bug: 21559093
Change-Id: Ibb651ebb2772ace6a16a5830f82f75465150e6e3
2015-06-02 13:28:23 -04:00
Stuart Scott
e3e314df4d Network Reset should have a lockdown like Factory Reset.
bug:20332322
Change-Id: I7c61a011d11e89513757f112abf320bb2a785edb
(cherry picked from commit 94b038bbb291431a7b39611d72f206b07e839891)
2015-06-01 16:31:00 +00:00
Sudheer Shanka
81c73e121e Merge "Clear caller identity before setting all the user restrictions." into mnc-dev 2015-05-27 11:25:33 +00:00
Amith Yamasani
184b3753de Add getPermissionGrantState method in device policy
This is to have a way to query what permission state was set by
the profile owner.

Bug: 21356830
Change-Id: Ie396e946b4285267c1d95f82b9d9765b43697d3c
2015-05-22 13:55:57 -07:00
Svet Ganov
d8ecc5aee4 Allow DO/PO to go back to normal permission state.
We have APIs for a DO/PO to fix a permission in a granted or
denied state in which the user cannot manage this permission
through the UI. However, there is no way to go back to the
default state in which the user gets to choose the permission
grant state.

Change-Id: I2562a1d8b1385cd740b44812844ef14c895c2902
2015-05-20 13:08:58 -07:00
Sudheer Shanka
21d9ef6dc7 Clear caller identity before setting all the user restrictions.
Bug: 19687895
Change-Id: Ieaa1f4e5a39395f11bf4cf797332a2d9d495bc0a
2015-05-20 17:29:59 +01:00
Rubin Xu
6e1c17a3df Merge "clear caller identify before sending system update notification" into mnc-dev 2015-05-14 14:00:18 +00:00
Rubin Xu
2c84cc2ea2 clear caller identify before sending system update notification
Because DeviceAdminReceiver is protected by BIND_DEVICE_ADMIN permission,
in order to send broadcast to it, we need to clear the caller's identity
and call sendBroadcastAsUser() as system.

Bug: 20213644
Change-Id: Icc7b239b9005e286012ade6580ec92a0a57198e0
2015-05-14 13:48:35 +01:00
Wojciech Staszkiewicz
9e9e2e73c6 Pass charset to XmlPullParser.setInput instead of null
Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
2015-05-14 10:24:34 +01:00
Robin Lee
39087b1cec Replace String host:port/url args with Uri arg
Uri provides a stronger guarantee of well-formedness and lets apps do
nice extra things like specifying scheme etc. without twisting any
expectations.

Bug: 20820034
Change-Id: Ia6bbedb74765444920b667d643fb7e1eb6a7292b
2015-05-14 07:15:18 +01:00
Nick Kralevich
9831fad676 Merge "Modify how USB connections are handled." into mnc-dev 2015-05-13 22:31:57 +00:00
Nick Kralevich
fcf10f7c12 Modify how USB connections are handled.
* Introduce a new "charger only" mode. In this mode, MTP is disabled,
and no file transfers can occur.
* Make charger only mode the default.
* Modify "persist.sys.usb.config" so it now only holds the adb status.
* Make the USB settings non-persistent. Unplugging the USB connection will
reset the device back to "charger only" mode.
* Fixup wording per UI guidelines.

TODO: Re-implement MDM restrictions for USB / MTP access controls.

Bug: 18905620
Change-Id: I99a50d9132a81e98187f431166fd9fef4d437e4f
2015-05-13 14:28:13 -07:00
Kenny Guy
467eb0566f Merge "Allowing profile to set a subset of keyguard restrictions." into mnc-dev 2015-05-13 21:07:17 +00:00
Julia Reynolds
396d944001 Merge "Remove initiator name param." into mnc-dev 2015-05-13 20:14:44 +00:00
Rubin Xu
9fc8bb63d8 Merge "Tweak SystemUpdatePolicy according to API review." into mnc-dev 2015-05-12 09:06:14 +00:00
Svet Ganov
8c7f700a59 Add permission meta-state flags to support grant/revoke permission policy.
We now maintain a mata-state with each permission in the form of flags
specyfying the policy for this permission. This enables support of the
following use cases:

1. The user denies a permission with prejudice in which case an app cannot
   request the permission at runtime. If an app requests such a permssion
   it gets a denial unless the user grants the permission from settings.

2. A legacy app with disabled app-ops being upgraded to support runtime
   permissions. The disabled app ops are converted to permission revocations.
   The app ops manager is a part of the activity manger which sits on top
   of the package manager, hence the latter cannot have a dependency on the
   former. To avoid this the package installer which is the global
   permission managment authority marks the permission as revoked on
   upgrade and the package manager revokes it on upgrade.

3. A device policy fixing a permission in a granted or revoked state. This
   additional information is folded in the meta-state flags and neither
   apps can request such permissions if revoked not the user can change
   the permission state in the UI.

Change-Id: I443e8a7bb94bfcb4ff6003d158e1408c26149811
2015-05-11 17:13:57 -07:00
Julia Reynolds
731051e36b Remove initiator name param.
This won't be shown in the UI; it's not needed.
Bug: 20820224

Change-Id: I51ecd0a9151a49e26faf52e792a0b316a8facc8e
2015-05-11 16:41:20 -04:00
Kenny Guy
0b7dd1e6c8 Allowing profile to set a subset of keyguard restrictions.
Allow admins in managed profiles disable trust related
keyguard features (trust agents and finger prints) for the
parent user.
Allow admins in managed profiles to control whether notifications
from the profile are redacted on the keyguard.

Bug: 18581512
Change-Id: Ic2323671f63781630206cc2efcc8e27ee58c38e6
2015-05-11 20:22:20 +01:00
Rubin Xu
d86d58cd01 Tweak SystemUpdatePolicy according to API review.
Make SystemUpdatePolicy Parcelable; hide public constructor and
expose static builder methods.

Bug: 20820025
Change-Id: I594ba3c7e5514551134ba6c866b24498b66506bf
2015-05-11 18:35:32 +01:00
Craig Lafayette
4e401fa498 DevicePolicyManager API review changes
Renamed DO_NOT_ASK_CREDENTIALS_ON_BOOT to
RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT.

Bug: 20820907
Change-Id: I6455f9a6d370afbd5154505f402b409dba3b7918
2015-05-07 10:24:02 -04:00
Benjamin Franz
94fb2024b0 Merge "Rename functions that disable status bar and keyguard" into mnc-dev 2015-05-06 15:16:20 +00:00
Benjamin Franz
bece80645e Rename functions that disable status bar and keyguard
Rename the DevicePolicyManager functions setKeyguardEnabledState and
setStatusBarEnabledState to setKeyguardDisabled and
setStatusBarDisabled respectively.

Bug: 20820039
Change-Id: I06f6a19ac55b24e66e9f2cb340ead5d940cb2235
2015-05-06 13:19:22 +01:00
Amith Yamasani
6f36d42dcc Permission policies are for profile and device owners
Not just device owners

Change-Id: I78ad815651e9bdc4bd78e61d634a5067935fa33f
2015-05-05 17:16:18 -07:00
Robin Lee
ddd553f2ae Device policy: use owner label instead of name
Managed provisioning does not currently set a meaningful profile owner
name. This changes to use the application label as returned by
PackageManager.getApplicationLabel which should be more descriptive.

Bug: 20679292
Change-Id: I5a0e87ef05b62879a73814e6d338e8b984b81c94
2015-04-30 18:01:46 +00:00
Benjamin Franz
c4aa3c781a Merge "Add status bar flag to disable quick settings" into mnc-dev 2015-04-29 08:36:00 +00:00
Amith Yamasani
d49489b3af Permissions control via profile/device owner admin
Profile owners and Device owners can set policies for runtime
permissions. Blanket grant/deny policy can be set for a user.
They can also explicitly grant/revoke permissions for specific apps
which cannot be overridden by the user and will not be prompted.

[More implementation required in PackageManagerService and
 PackageInstaller]

Bug: 20666663
Change-Id: I2c25c18c2a195db9023a17716d5896970848bb45
2015-04-28 14:30:09 -07:00
Benjamin Franz
27cf146361 Add status bar flag to disable quick settings
Bug: 20331928
Change-Id: I79dc7f2c9e64245bdeeea3916d339985a8b17f92
2015-04-28 18:49:47 +01:00
Julia Reynolds
13c58bacc8 Allow device initializers to set a preferred setup activity.
This activity will launch by default on device reboot or user switch
during user initialization, even if there are higher priority 'home'
activities.

Bug: 20223050
Change-Id: I335aeb010a1ae5db07a4343d26e160c74bd299e1
2015-04-27 12:57:15 -04:00
Julia Reynolds
f7d3a766f0 Merge "Only skip unrecognized tags." 2015-04-25 01:09:25 +00:00