summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorAntoan Angelov <arangelov@google.com>2017-12-14 15:09:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-12-14 15:09:05 +0000
commitce0fe9b674085dc92cfb75fe43fbce14b713eb4b (patch)
treece99e1194cb5b2a39987e2094546f35fd7b97e7c /core/java/android
parent5607d0b72bdef1015365eb57e782f2e9d3e25c24 (diff)
parent08841efcdf4ff8cf5d743fd5f6f995730b5f876f (diff)
Merge "Add profile owner transfer functionality."
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java40
-rw-r--r--core/java/android/app/admin/IDevicePolicyManager.aidl1
2 files changed, 41 insertions, 0 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index b1c17d568c35..3c4036bc39aa 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -8753,4 +8753,44 @@ public class DevicePolicyManager {
throw re.rethrowFromSystemServer();
}
}
+
+ //TODO STOPSHIP Add link to onTransferComplete callback when implemented.
+ /**
+ * Transfers the current administrator. All policies from the current administrator are
+ * migrated to the new administrator. The whole operation is atomic - the transfer is either
+ * complete or not done at all.
+ *
+ * Depending on the current administrator (device owner, profile owner, corporate owned
+ * profile owner), you have the following expected behaviour:
+ * <ul>
+ * <li>A device owner can only be transferred to a new device owner</li>
+ * <li>A profile owner can only be transferred to a new profile owner</li>
+ * <li>A corporate owned managed profile can have two cases:
+ * <ul>
+ * <li>If the device owner and profile owner are the same package,
+ * both will be transferred.</li>
+ * <li>If the device owner and profile owner are different packages,
+ * and if this method is called from the profile owner, only the profile owner
+ * is transferred. Similarly, if it is called from the device owner, only
+ * the device owner is transferred.</li>
+ * </ul>
+ * </li>
+ * </ul>
+ *
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+ * @param target Which {@link DeviceAdminReceiver} we want the new administrator to be.
+ * @param bundle Parameters - This bundle allows the current administrator to pass data to the
+ * new administrator. The parameters will be received in the
+ * onTransferComplete callback.
+ * @hide
+ */
+ public void transferOwner(@NonNull ComponentName admin, @NonNull ComponentName target,
+ PersistableBundle bundle) {
+ throwIfParentInstance("transferOwner");
+ try {
+ mService.transferOwner(admin, target, bundle);
+ } catch (RemoteException re) {
+ throw re.rethrowFromSystemServer();
+ }
+ }
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index b76618b25e7d..014d7b9c5ad7 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -378,4 +378,5 @@ interface IDevicePolicyManager {
boolean isLogoutEnabled();
List<String> getDisallowedSystemApps(in ComponentName admin, int userId, String provisioningAction);
+ void transferOwner(in ComponentName admin, in ComponentName target, in PersistableBundle bundle);
}