Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6403,6 +6403,7 @@ package android.app.admin { method public int getLockTaskFeatures(android.content.ComponentName); method public java.lang.String[] getLockTaskPackages(android.content.ComponentName); method public java.lang.CharSequence getLongSupportMessage(android.content.ComponentName); method public android.content.ComponentName getMandatoryBackupTransport(); method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName); method public long getMaximumTimeToLock(android.content.ComponentName); method public int getOrganizationColor(android.content.ComponentName); Loading Loading @@ -6502,6 +6503,7 @@ package android.app.admin { method public void setLockTaskPackages(android.content.ComponentName, java.lang.String[]) throws java.lang.SecurityException; method public void setLogoutEnabled(android.content.ComponentName, boolean); method public void setLongSupportMessage(android.content.ComponentName, java.lang.CharSequence); method public void setMandatoryBackupTransport(android.content.ComponentName, android.content.ComponentName); method public void setMasterVolumeMuted(android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int); method public void setMaximumTimeToLock(android.content.ComponentName, long); core/java/android/app/admin/DevicePolicyManager.java +44 −0 Original line number Diff line number Diff line Loading @@ -8633,6 +8633,13 @@ public class DevicePolicyManager { * * <p> Backup service is off by default when device owner is present. * * <p> If backups are made mandatory by specifying a non-null mandatory backup transport using * the {@link DevicePolicyManager#setMandatoryBackupTransport} method, the backup service is * automatically enabled. * * <p> If the backup service is disabled using this method after the mandatory backup transport * has been set, the mandatory backup transport is cleared. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param enabled {@code true} to enable the backup service, {@code false} to disable it. * @throws SecurityException if {@code admin} is not a device owner. Loading Loading @@ -8663,6 +8670,43 @@ public class DevicePolicyManager { } } /** * Makes backups mandatory and enforces the usage of the specified backup transport. * * <p>When a {@code null} backup transport is specified, backups are made optional again. * <p>Only device owner can call this method. * <p>If backups were disabled and a non-null backup transport {@link ComponentName} is * specified, backups will be enabled. * * @param admin admin Which {@link DeviceAdminReceiver} this request is associated with. * @param backupTransportComponent The backup transport layer to be used for mandatory backups. * @throws SecurityException if {@code admin} is not a device owner. */ public void setMandatoryBackupTransport( @NonNull ComponentName admin, @Nullable ComponentName backupTransportComponent) { try { mService.setMandatoryBackupTransport(admin, backupTransportComponent); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns the backup transport which has to be used for backups if backups are mandatory or * {@code null} if backups are not mandatory. * * @return a {@link ComponentName} of the backup transport layer to be used if backups are * mandatory or {@code null} if backups are not mandatory. */ public ComponentName getMandatoryBackupTransport() { try { return mService.getMandatoryBackupTransport(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Called by a device owner to control the network logging feature. * Loading core/java/android/app/admin/IDevicePolicyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -359,6 +359,8 @@ interface IDevicePolicyManager { void setBackupServiceEnabled(in ComponentName admin, boolean enabled); boolean isBackupServiceEnabled(in ComponentName admin); void setMandatoryBackupTransport(in ComponentName admin, in ComponentName backupTransportComponent); ComponentName getMandatoryBackupTransport(); void setNetworkLoggingEnabled(in ComponentName admin, boolean enabled); boolean isNetworkLoggingEnabled(in ComponentName admin); Loading core/java/android/app/backup/IBackupManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -294,7 +294,8 @@ interface IBackupManager { * * @param transport ComponentName of the service hosting the transport. This is different from * the transport's name that is returned by {@link BackupTransport#name()}. * @param listener A listener object to get a callback on the transport being selected. * @param listener A listener object to get a callback on the transport being selected. It may * be {@code null}. * * @hide */ Loading services/backup/java/com/android/server/backup/BackupPolicyEnforcer.java 0 → 100644 +25 −0 Original line number Diff line number Diff line package com.android.server.backup; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; import com.android.internal.annotations.VisibleForTesting; /** * A helper class to decouple this service from {@link DevicePolicyManager} in order to improve * testability. */ @VisibleForTesting public class BackupPolicyEnforcer { private DevicePolicyManager mDevicePolicyManager; public BackupPolicyEnforcer(Context context) { mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); } public ComponentName getMandatoryBackupTransport() { return mDevicePolicyManager.getMandatoryBackupTransport(); } } Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6403,6 +6403,7 @@ package android.app.admin { method public int getLockTaskFeatures(android.content.ComponentName); method public java.lang.String[] getLockTaskPackages(android.content.ComponentName); method public java.lang.CharSequence getLongSupportMessage(android.content.ComponentName); method public android.content.ComponentName getMandatoryBackupTransport(); method public int getMaximumFailedPasswordsForWipe(android.content.ComponentName); method public long getMaximumTimeToLock(android.content.ComponentName); method public int getOrganizationColor(android.content.ComponentName); Loading Loading @@ -6502,6 +6503,7 @@ package android.app.admin { method public void setLockTaskPackages(android.content.ComponentName, java.lang.String[]) throws java.lang.SecurityException; method public void setLogoutEnabled(android.content.ComponentName, boolean); method public void setLongSupportMessage(android.content.ComponentName, java.lang.CharSequence); method public void setMandatoryBackupTransport(android.content.ComponentName, android.content.ComponentName); method public void setMasterVolumeMuted(android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int); method public void setMaximumTimeToLock(android.content.ComponentName, long);
core/java/android/app/admin/DevicePolicyManager.java +44 −0 Original line number Diff line number Diff line Loading @@ -8633,6 +8633,13 @@ public class DevicePolicyManager { * * <p> Backup service is off by default when device owner is present. * * <p> If backups are made mandatory by specifying a non-null mandatory backup transport using * the {@link DevicePolicyManager#setMandatoryBackupTransport} method, the backup service is * automatically enabled. * * <p> If the backup service is disabled using this method after the mandatory backup transport * has been set, the mandatory backup transport is cleared. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param enabled {@code true} to enable the backup service, {@code false} to disable it. * @throws SecurityException if {@code admin} is not a device owner. Loading Loading @@ -8663,6 +8670,43 @@ public class DevicePolicyManager { } } /** * Makes backups mandatory and enforces the usage of the specified backup transport. * * <p>When a {@code null} backup transport is specified, backups are made optional again. * <p>Only device owner can call this method. * <p>If backups were disabled and a non-null backup transport {@link ComponentName} is * specified, backups will be enabled. * * @param admin admin Which {@link DeviceAdminReceiver} this request is associated with. * @param backupTransportComponent The backup transport layer to be used for mandatory backups. * @throws SecurityException if {@code admin} is not a device owner. */ public void setMandatoryBackupTransport( @NonNull ComponentName admin, @Nullable ComponentName backupTransportComponent) { try { mService.setMandatoryBackupTransport(admin, backupTransportComponent); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns the backup transport which has to be used for backups if backups are mandatory or * {@code null} if backups are not mandatory. * * @return a {@link ComponentName} of the backup transport layer to be used if backups are * mandatory or {@code null} if backups are not mandatory. */ public ComponentName getMandatoryBackupTransport() { try { return mService.getMandatoryBackupTransport(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Called by a device owner to control the network logging feature. * Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -359,6 +359,8 @@ interface IDevicePolicyManager { void setBackupServiceEnabled(in ComponentName admin, boolean enabled); boolean isBackupServiceEnabled(in ComponentName admin); void setMandatoryBackupTransport(in ComponentName admin, in ComponentName backupTransportComponent); ComponentName getMandatoryBackupTransport(); void setNetworkLoggingEnabled(in ComponentName admin, boolean enabled); boolean isNetworkLoggingEnabled(in ComponentName admin); Loading
core/java/android/app/backup/IBackupManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -294,7 +294,8 @@ interface IBackupManager { * * @param transport ComponentName of the service hosting the transport. This is different from * the transport's name that is returned by {@link BackupTransport#name()}. * @param listener A listener object to get a callback on the transport being selected. * @param listener A listener object to get a callback on the transport being selected. It may * be {@code null}. * * @hide */ Loading
services/backup/java/com/android/server/backup/BackupPolicyEnforcer.java 0 → 100644 +25 −0 Original line number Diff line number Diff line package com.android.server.backup; import android.app.admin.DevicePolicyManager; import android.content.ComponentName; import android.content.Context; import com.android.internal.annotations.VisibleForTesting; /** * A helper class to decouple this service from {@link DevicePolicyManager} in order to improve * testability. */ @VisibleForTesting public class BackupPolicyEnforcer { private DevicePolicyManager mDevicePolicyManager; public BackupPolicyEnforcer(Context context) { mDevicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); } public ComponentName getMandatoryBackupTransport() { return mDevicePolicyManager.getMandatoryBackupTransport(); } }