Create DPM APIs for cross profile callerId
Contact information in the managed profile is shown
in the incoming call UI unless blocked using this API.
TODO: Actually plumb this into the caller-id logic.
Bug: 16301261
Change-Id: If03adc907d9558baa0a45a1833b857206b7bf96a
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 4e7dac0..d3aa950 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -2270,6 +2270,45 @@
}
/**
+ * Called by a profile owner to set whether caller-Id information from the managed
+ * profile will be shown for incoming calls.
+ *
+ * <p>The calling device admin must be a profile owner. If it is not, a
+ * security exception will be thrown.
+ *
+ * @param who Which {@link DeviceAdminReceiver} this request is associated with.
+ * @param disabled If true caller-Id information in the managed profile is not displayed.
+ */
+ public void setCrossProfileCallerIdDisabled(ComponentName who, boolean disabled) {
+ if (mService != null) {
+ try {
+ mService.setCrossProfileCallerIdDisabled(who, disabled);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
+ }
+
+ /**
+ * Determine whether or not caller-Id information has been disabled.
+ *
+ * <p>The calling device admin must be a profile owner. If it is not, a
+ * security exception will be thrown.
+ *
+ * @param who Which {@link DeviceAdminReceiver} this request is associated with.
+ */
+ public boolean getCrossProfileCallerIdDisabled(ComponentName who) {
+ if (mService != null) {
+ try {
+ return mService.getCrossProfileCallerIdDisabled(who);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
+ return false;
+ }
+
+ /**
* Called by the profile owner so that some intents sent in the managed profile can also be
* resolved in the parent, or vice versa.
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index d36497e..46b8755 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -161,4 +161,8 @@
void setBlockUninstall(in ComponentName admin, in String packageName, boolean blockUninstall);
boolean getBlockUninstall(in ComponentName admin, in String packageName);
+
+ void setCrossProfileCallerIdDisabled(in ComponentName who, boolean disabled);
+ boolean getCrossProfileCallerIdDisabled(in ComponentName who);
+ boolean getCrossProfileCallerIdDisabledForUser(int userId);
}