diff options
| author | Christine Franks <christyfranks@google.com> | 2018-02-22 16:19:26 -0800 |
|---|---|---|
| committer | Christine Franks <christyfranks@google.com> | 2018-02-26 22:58:05 +0000 |
| commit | 26449eda7a5595bfb97e59d0734b61e1bbe6f55d (patch) | |
| tree | 163ccd3a2421a291f9fe56bf142af0537787df51 /core/java | |
| parent | d8580e897be41b130a491ac959926b4444aec2b5 (diff) | |
Add DevicePolicyManager#setDefaultSmsApplication
Bug: 73788187
Test: make -j100
Change-Id: I4f379743b9d12109bb8ecae109591abb922463ec
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 23 | ||||
| -rw-r--r-- | core/java/android/app/admin/IDevicePolicyManager.aidl | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 16e36bc54ef2..1c3f34a2c8db 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -5627,6 +5627,29 @@ public class DevicePolicyManager { } /** + * Called by a device owner to set the default SMS application. + * <p> + * The calling device admin must be a device owner. If it is not, a security exception will be + * thrown. + * + * @param admin Which {@link DeviceAdminReceiver} this request is associated with. + * @param packageName The name of the package to set as the default SMS application. + * @throws SecurityException if {@code admin} is not a device owner. + * + * @hide + */ + public void setDefaultSmsApplication(@NonNull ComponentName admin, String packageName) { + throwIfParentInstance("setDefaultSmsApplication"); + if (mService != null) { + try { + mService.setDefaultSmsApplication(admin, packageName); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + } + + /** * Called by a profile owner or device owner to grant permission to a package to manage * application restrictions for the calling user via {@link #setApplicationRestrictions} and * {@link #getApplicationRestrictions}. diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 5218a7340ec9..c29369fe96a8 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -192,6 +192,8 @@ interface IDevicePolicyManager { void addPersistentPreferredActivity(in ComponentName admin, in IntentFilter filter, in ComponentName activity); void clearPackagePersistentPreferredActivities(in ComponentName admin, String packageName); + void setDefaultSmsApplication(in ComponentName admin, String packageName); + void setApplicationRestrictions(in ComponentName who, in String callerPackage, in String packageName, in Bundle settings); Bundle getApplicationRestrictions(in ComponentName who, in String callerPackage, in String packageName); boolean setApplicationRestrictionsManagingPackage(in ComponentName admin, in String packageName); |
