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
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 47133d4..ed814c3 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -4325,4 +4325,21 @@
}
}
}
+
+ /**
+ * Called by a device initializer to set the activity to be launched on device boot or after a
+ * user switch during user setup. This activity will be started regardless of the priority of
+ * other 'home' activities. Once user setup is complete, the preferred setup activity will be
+ * ignored.
+ *
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+ * @param activity The Activity to be started by default during user setup.
+ */
+ public void setPreferredSetupActivity(ComponentName admin, ComponentName activity) {
+ try {
+ mService.setPreferredSetupActivity(admin, activity);
+ } catch (RemoteException re) {
+ Log.w(TAG, "Failed talking with device policy service", re);
+ }
+ }
}