From 542588e3ba1e25a9465246a8542b1b6cbe6f9249 Mon Sep 17 00:00:00 2001 From: Jessica Hummel Date: Wed, 21 May 2014 12:32:57 +0100 Subject: [PATCH 1/3] Update documentation so it meets api requirements Change-Id: Ice52dc3d5ecca77f81d3df1b43179c94aece6fef bug:15023443 Conflicts: api/current.txt core/java/android/app/admin/DeviceAdminReceiver.java --- api/current.txt | 4 +- .../app/admin/DeviceAdminReceiver.java | 38 +++++++++++-------- .../app/admin/DevicePolicyManager.java | 29 +++++++++----- 3 files changed, 45 insertions(+), 26 deletions(-) diff --git a/api/current.txt b/api/current.txt index d6831c8d8bb09..8953d7ebfde81 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5253,8 +5253,8 @@ package android.app.admin { field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0 field public static final java.lang.String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION"; field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN"; - field public static final java.lang.String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME = "defaultManagedProfileName"; - field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME = "deviceAdminPackageName"; + field public static final java.lang.String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME = "android.app.extra.defaultManagedProfileName"; + field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME = "android.app.extra.deviceAdminPackageName"; field public static int FLAG_TO_MANAGED_PROFILE; field public static int FLAG_TO_PRIMARY_USER; field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff diff --git a/core/java/android/app/admin/DeviceAdminReceiver.java b/core/java/android/app/admin/DeviceAdminReceiver.java index ee222a9c2dc44..101551477a4d4 100644 --- a/core/java/android/app/admin/DeviceAdminReceiver.java +++ b/core/java/android/app/admin/DeviceAdminReceiver.java @@ -16,6 +16,7 @@ package android.app.admin; +import android.accounts.AccountManager; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.app.Service; @@ -165,12 +166,14 @@ public class DeviceAdminReceiver extends BroadcastReceiver { = "android.app.action.ACTION_PASSWORD_EXPIRING"; /** - * Broadcast Action: This broadcast is sent to the newly created profile when - * the provisioning of a managed profile has completed successfully. It is used in both the - * Profile Owner and the Device Owner provisioning. + * Broadcast Action: This broadcast is sent to indicate that provisioning of a managed profile + * or managed device has completed successfully. * - *

The broadcast is limited to the DeviceAdminReceiver component specified in the message - * that started the provisioning. It is also limited to the managed profile. + *

The broadcast is limited to the profile that will be managed by the application that + * requested provisioning. In the device owner case the profile is the primary user. + * The broadcast will also be limited to the {@link DeviceAdminReceiver} component + * specified in the original intent or NFC bump that started the provisioning process + * (@see DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE). * *

Input: Nothing.

*

Output: Nothing

@@ -307,18 +310,23 @@ public class DeviceAdminReceiver extends BroadcastReceiver { } /** - * Called on the new profile when managed profile provisioning has completed. - * Managed profile provisioning is the process of setting up the device so that it has a - * separate profile which is managed by the mobile device management(mdm) application that - * triggered the provisioning. + * Called when provisioning of a managed profile or managed device has completed successfully. * - *

As part of provisioning a new profile is created, the mdm is moved to the new profile and - * set as the owner of the profile so that it has full control over it. - * This intent is only received by the mdm package that is set as profile owner during - * provisioning. + *

As a prerequisit for the execution of this callback the (@link DeviceAdminReceiver} has + * to declare an intent filter for {@link #ACTION_PROFILE_PROVISIONING_COMPLETE}. + * Its component must also be specified in the {@link DevicePolicyManager#EXTRA_DEVICE_ADMIN} + * of the {@link DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE} intent that started the + * managed provisioning. * - *

Provisioning can be triggered via an intent with the action - * android.managedprovisioning.ACTION_PROVISION_MANAGED_PROFILE. + *

When provisioning is complete, the managed profile is hidden until the profile owner + * calls {DevicePolicyManager#setProfileEnabled(ComponentName admin)}. Typically a profile + * owner will enable the profile when it has finished any additional setup such as adding an + * account by using the {@link AccountManager} and calling apis to bring the profile into the + * desired state. + * + *

Note that provisioning completes without waiting for any server interactions, so the + * profile owner needs to wait for data to be available if required (e.g android device ids or + * other data that is set as a result of server interactions). * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index d725873f5f794..157b8ecfb6b55 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -82,17 +82,25 @@ public class DevicePolicyManager { /** * Activity action: Starts the provisioning flow which sets up a managed profile. - * This intent will typically be sent by a mobile device management application(mdm). - * Managed profile provisioning creates a profile, moves the mdm to the profile, - * sets the mdm as the profile owner and removes all non required applications from the profile. - * As a profile owner the mdm than has full control over the managed profile. * - *

The intent must contain the extras {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME} and - * {@link #EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME}. + *

A managed profile allows data separation for example for the usage of a + * device as a personal and corporate device. The user which provisioning is started from and + * the managed profile share a launcher. + * + *

This intent will typically be sent by a mobile device management application (mdm). + * Provisioning adds a managed profile and sets the mdm as the profile owner who has full + * control over the profile + * + *

This intent must contain the extras {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME} + * {@link #EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME} and {@link #EXTRA_DEVICE_ADMIN}. * *

When managed provisioning has completed, an intent of the type * {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE} is broadcasted to the - * mdm app on the managed profile. + * managed profile. The intent is sent to the {@link DeviceAdminReceiver} specified in the + * {@link #EXTRA_DEVICE_ADMIN} exclusively. + * + * If provisioning fails, the managedProfile is removed so the device returns to its previous + * state. * *

Input: Nothing.

*

Output: Nothing

@@ -107,7 +115,7 @@ public class DevicePolicyManager { *

Use with {@link #ACTION_PROVISION_MANAGED_PROFILE}. */ public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME - = "deviceAdminPackageName"; + = "android.app.extra.deviceAdminPackageName"; /** * A String extra holding the default name of the profile that is created during managed profile @@ -115,7 +123,7 @@ public class DevicePolicyManager { *

Use with {@link #ACTION_PROVISION_MANAGED_PROFILE} */ public static final String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME - = "defaultManagedProfileName"; + = "android.app.extra.defaultManagedProfileName"; /** * Activity action: ask the user to add a new device administrator to the system. @@ -837,6 +845,9 @@ public class DevicePolicyManager { * {@link DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD} to be able to call this * method; if it has not, a security exception will be thrown. * + *

Note that setting the password will automatically reset the expiration time for all + * active admins. Active admins do not need to explicitly call this method in that case. + * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param timeout The limit (in ms) that a password can remain in effect. A value of 0 * means there is no restriction (unlimited). From c776997e876dbf066c1a93d180e39a5dc74dd7c9 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 5 Jun 2014 02:54:26 -0400 Subject: [PATCH 2/3] Clean up progress bars for media & other notifications. Bug: 15147533 Change-Id: Ib4905203c004232bd7d78fe9fa316aa5688eaaa2 --- .../res/res/layout/notification_template_material_big_base.xml | 2 +- .../res/layout/notification_template_material_big_media.xml | 3 +-- .../res/res/layout/notification_template_material_big_text.xml | 2 +- core/res/res/values/colors.xml | 1 - core/res/res/values/styles_material.xml | 3 +++ core/res/res/values/symbols.xml | 1 - 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/res/res/layout/notification_template_material_big_base.xml b/core/res/res/layout/notification_template_material_big_base.xml index bdf27c8c9b03e..0564a8f30c25e 100644 --- a/core/res/res/layout/notification_template_material_big_base.xml +++ b/core/res/res/layout/notification_template_material_big_base.xml @@ -145,7 +145,7 @@ android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:visibility="gone" - style="@style/Widget.Material.Light.ProgressBar.Horizontal" + style="@style/Widget.StatusBar.Material.ProgressBar" /> diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml index 6f8c3a9adf2e1..1de5add91c8cd 100644 --- a/core/res/res/layout/notification_template_material_big_text.xml +++ b/core/res/res/layout/notification_template_material_big_text.xml @@ -99,7 +99,7 @@ android:layout_marginEnd="8dp" android:visibility="gone" android:layout_weight="0" - style="@style/Widget.Material.Light.ProgressBar.Horizontal" + style="@style/Widget.StatusBar.Material.ProgressBar" /> #ff555555 #00000000 - #40FFFFFF #FFFFFFFF diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 92cce25bc3e1a..a40835c58e903 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -345,6 +345,9 @@ please see styles_device_defaults.xml. + + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index bfdb8a444385d..853df6e24336d 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1677,7 +1677,6 @@ - From 01cdce69e94bda60a4e40a77b46c49e72265aadc Mon Sep 17 00:00:00 2001 From: George Mount Date: Thu, 12 Jun 2014 07:41:13 -0700 Subject: [PATCH 3/3] Add reasonable default activity transitions to theme.material.light. Bug 15583434 Change-Id: Ie4dd08a0392698d2e2794a82d50ad9a213658917 --- core/res/res/values/themes_material.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 1304d2b2aa0f6..fe54f6d4b8726 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -513,6 +513,9 @@ please see themes_device_defaults.xml. @layout/screen_toolbar ?attr/colorPrimaryDark @color/black + @transition/fade + @transition/move + @transition/move @style/Theme.Material.Light.Dialog