From b71fedc494189538b7219919ba1c831f9c6c91f9 Mon Sep 17 00:00:00 2001 From: Michal Karpinski Date: Thu, 5 Jan 2017 15:21:38 +0000 Subject: [PATCH] Unhide enabling backup service in DO APIs Bug: 28628532 Change-Id: I5940735994c7e63fae86549fedcf138ad12151cd --- api/current.txt | 2 ++ api/system-current.txt | 2 ++ api/test-current.txt | 2 ++ .../app/admin/DevicePolicyManager.java | 19 +++++++++++-------- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/api/current.txt b/api/current.txt index 6da09e35fe5ed..eb1c68243a607 100644 --- a/api/current.txt +++ b/api/current.txt @@ -6128,6 +6128,7 @@ package android.app.admin { method public boolean isActivePasswordSufficient(); method public boolean isAdminActive(android.content.ComponentName); method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String); + method public boolean isBackupServiceEnabled(android.content.ComponentName); method public boolean isCallerApplicationRestrictionsManagingPackage(); method public boolean isDeviceOwnerApp(java.lang.String); method public boolean isLockTaskPermitted(java.lang.String); @@ -6158,6 +6159,7 @@ package android.app.admin { method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle); method public void setApplicationRestrictionsManagingPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; method public void setAutoTimeRequired(android.content.ComponentName, boolean); + method public void setBackupServiceEnabled(android.content.ComponentName, boolean); method public void setBluetoothContactSharingDisabled(android.content.ComponentName, boolean); method public void setCameraDisabled(android.content.ComponentName, boolean); method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException; diff --git a/api/system-current.txt b/api/system-current.txt index 5640eafcee1f4..a7d8b9d222594 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6318,6 +6318,7 @@ package android.app.admin { method public boolean isActivePasswordSufficient(); method public boolean isAdminActive(android.content.ComponentName); method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String); + method public boolean isBackupServiceEnabled(android.content.ComponentName); method public boolean isCallerApplicationRestrictionsManagingPackage(); method public boolean isDeviceManaged(); method public boolean isDeviceOwnerApp(java.lang.String); @@ -6353,6 +6354,7 @@ package android.app.admin { method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle); method public void setApplicationRestrictionsManagingPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; method public void setAutoTimeRequired(android.content.ComponentName, boolean); + method public void setBackupServiceEnabled(android.content.ComponentName, boolean); method public void setBluetoothContactSharingDisabled(android.content.ComponentName, boolean); method public void setCameraDisabled(android.content.ComponentName, boolean); method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException; diff --git a/api/test-current.txt b/api/test-current.txt index 714cac9fc559e..6f79c47be8b92 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -6149,6 +6149,7 @@ package android.app.admin { method public boolean isActivePasswordSufficient(); method public boolean isAdminActive(android.content.ComponentName); method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String); + method public boolean isBackupServiceEnabled(android.content.ComponentName); method public boolean isCallerApplicationRestrictionsManagingPackage(); method public boolean isDeviceManaged(); method public boolean isDeviceOwnerApp(java.lang.String); @@ -6180,6 +6181,7 @@ package android.app.admin { method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle); method public void setApplicationRestrictionsManagingPackage(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException; method public void setAutoTimeRequired(android.content.ComponentName, boolean); + method public void setBackupServiceEnabled(android.content.ComponentName, boolean); method public void setBluetoothContactSharingDisabled(android.content.ComponentName, boolean); method public void setCameraDisabled(android.content.ComponentName, boolean); method public void setCertInstallerPackage(android.content.ComponentName, java.lang.String) throws java.lang.SecurityException; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index c95e0113e8012..c8ef47cf57f77 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -7122,15 +7122,14 @@ public class DevicePolicyManager { } /** - * @hide - * Enable backup service. - *

This includes all backup and restore mechanisms. - * Setting this to {@code false} will make backup service no-op or return empty results. + * Allows the device owner to enable or disable the backup service. * - *

There must be only one user on the device, managed by the device owner. - * Otherwise a {@link SecurityException} will be thrown. + *

Backup service manages all backup and restore mechanisms on the device. Setting this to + * false will prevent data from being backed up or restored. * - *

Backup service is off by default when device owner is present. + *

Backup service is off by default when device owner is present. + * + * @throws SecurityException if {@code admin} is not a device owner. */ public void setBackupServiceEnabled(@NonNull ComponentName admin, boolean enabled) { try { @@ -7141,8 +7140,12 @@ public class DevicePolicyManager { } /** - * @hide + * Return whether the backup service is enabled by the device owner. + * + *

Backup service manages all backup and restore mechanisms on the device. + * * @return {@code true} if backup service is enabled, {@code false} otherwise. + * @see #setBackupServiceEnabled */ public boolean isBackupServiceEnabled(@NonNull ComponentName admin) { try {