Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -7248,6 +7248,7 @@ package android.app.backup { ctor public BackupManager(android.content.Context); method public void dataChanged(); method public static void dataChanged(String); method @Nullable public android.os.UserHandle getUserForAncestralSerialNumber(long); method @Deprecated public int requestRestore(android.app.backup.RestoreObserver); } api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -711,6 +711,7 @@ package android.app.backup { method @Deprecated public int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method @Deprecated @RequiresPermission(android.Manifest.permission.BACKUP) public String selectBackupTransport(String); method @RequiresPermission(android.Manifest.permission.BACKUP) public void selectBackupTransport(android.content.ComponentName, android.app.backup.SelectBackupTransportCallback); method @RequiresPermission(android.Manifest.permission.BACKUP) public void setAncestralSerialNumber(long); method @RequiresPermission(android.Manifest.permission.BACKUP) public void setAutoRestore(boolean); method @RequiresPermission(android.Manifest.permission.BACKUP) public void setBackupEnabled(boolean); method @RequiresPermission(android.Manifest.permission.BACKUP) public void updateTransportAttributes(android.content.ComponentName, String, @Nullable android.content.Intent, String, @Nullable android.content.Intent, @Nullable String); Loading core/java/android/app/backup/BackupManager.java +41 −0 Original line number Diff line number Diff line Loading @@ -750,6 +750,47 @@ public class BackupManager { } } /** * Returns a {@link UserHandle} for the user that has {@code ancestralSerialNumber} as the * serial number of the its ancestral work profile or {@code null} if there is none. * * <p> The ancestral serial number will have a corresponding {@link UserHandle} if the device * has a work profile that was restored from another work profile with serial number * {@code ancestralSerialNumber}. * * @see UserManager#getSerialNumberForUser(UserHandle) */ @Nullable public UserHandle getUserForAncestralSerialNumber(long ancestralSerialNumber) { if (sService != null) { try { return sService.getUserForAncestralSerialNumber(ancestralSerialNumber); } catch (RemoteException e) { Log.e(TAG, "getUserForAncestralSerialNumber() couldn't connect"); } } return null; } /** * Sets the ancestral work profile for the calling user. * * <p> The ancestral work profile corresponds to the profile that was used to restore to the * callers profile. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.BACKUP) public void setAncestralSerialNumber(long ancestralSerialNumber) { if (sService != null) { try { sService.setAncestralSerialNumber(ancestralSerialNumber); } catch (RemoteException e) { Log.e(TAG, "setAncestralSerialNumber() couldn't connect"); } } } /** * Returns an {@link Intent} for the specified transport's configuration UI. * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String, Loading core/java/android/app/backup/IBackupManager.aidl +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.backup.IFullBackupRestoreObserver; import android.app.backup.IRestoreSession; import android.app.backup.ISelectBackupTransportCallback; import android.os.ParcelFileDescriptor; import android.os.UserHandle; import android.content.Intent; import android.content.ComponentName; Loading Loading @@ -685,4 +686,24 @@ interface IBackupManager { * {@link android.app.backup.IBackupManager.cancelBackups} for the calling user id. */ void cancelBackups(); /** * Returns a {@link UserHandle} for the user that has {@code ancestralSerialNumber} as the serial * number of the it's ancestral work profile. * * <p> The ancestral work profile is set by {@link #setAncestralSerialNumber(long)} * and it corresponds to the profile that was used to restore to the callers profile. */ UserHandle getUserForAncestralSerialNumber(in long ancestralSerialNumber); /** * Sets the ancestral work profile for the calling user. * * <p> The ancestral work profile corresponds to the profile that was used to restore to the * callers profile. * * <p>Callers must hold the android.permission.BACKUP permission to use this method. */ void setAncestralSerialNumber(in long ancestralSerialNumber); } services/backup/java/com/android/server/backup/BackupManagerService.java +41 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.util.Slog; import android.util.SparseArray; Loading Loading @@ -437,6 +438,44 @@ public class BackupManagerService { : userBackupManagerService.getConfigurationIntent(transportName); } /** * Sets the ancestral work profile for the calling user. * * <p> The ancestral work profile corresponds to the profile that was used to restore to the * callers profile. */ public void setAncestralSerialNumber(long ancestralSerialNumber) { UserBackupManagerService userBackupManagerService = getServiceForUserIfCallerHasPermission( Binder.getCallingUserHandle().getIdentifier(), "setAncestralSerialNumber()"); if (userBackupManagerService != null) { userBackupManagerService.setAncestralSerialNumber(ancestralSerialNumber); } } /** * Returns a {@link UserHandle} for the user that has {@code ancestralSerialNumber} as the * serial number of the its ancestral work profile. * * <p> The ancestral work profile is set by {@link #setAncestralSerialNumber(long)} * and it corresponds to the profile that was used to restore to the callers profile. */ @Nullable public UserHandle getUserForAncestralSerialNumber(long ancestralSerialNumber) { for (UserHandle handle : mContext.getSystemService(UserManager.class).getUserProfiles()) { UserBackupManagerService userBackupManagerService = getServiceUsers().get( handle.getIdentifier()); if (userBackupManagerService != null) { if (userBackupManagerService.getAncestralSerialNumber() == ancestralSerialNumber) { return handle; } } } return null; } /** * Supply the current destination string for the given transport. If the name is not one of the * registered transports the method will return null. Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -7248,6 +7248,7 @@ package android.app.backup { ctor public BackupManager(android.content.Context); method public void dataChanged(); method public static void dataChanged(String); method @Nullable public android.os.UserHandle getUserForAncestralSerialNumber(long); method @Deprecated public int requestRestore(android.app.backup.RestoreObserver); }
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -711,6 +711,7 @@ package android.app.backup { method @Deprecated public int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor); method @Deprecated @RequiresPermission(android.Manifest.permission.BACKUP) public String selectBackupTransport(String); method @RequiresPermission(android.Manifest.permission.BACKUP) public void selectBackupTransport(android.content.ComponentName, android.app.backup.SelectBackupTransportCallback); method @RequiresPermission(android.Manifest.permission.BACKUP) public void setAncestralSerialNumber(long); method @RequiresPermission(android.Manifest.permission.BACKUP) public void setAutoRestore(boolean); method @RequiresPermission(android.Manifest.permission.BACKUP) public void setBackupEnabled(boolean); method @RequiresPermission(android.Manifest.permission.BACKUP) public void updateTransportAttributes(android.content.ComponentName, String, @Nullable android.content.Intent, String, @Nullable android.content.Intent, @Nullable String); Loading
core/java/android/app/backup/BackupManager.java +41 −0 Original line number Diff line number Diff line Loading @@ -750,6 +750,47 @@ public class BackupManager { } } /** * Returns a {@link UserHandle} for the user that has {@code ancestralSerialNumber} as the * serial number of the its ancestral work profile or {@code null} if there is none. * * <p> The ancestral serial number will have a corresponding {@link UserHandle} if the device * has a work profile that was restored from another work profile with serial number * {@code ancestralSerialNumber}. * * @see UserManager#getSerialNumberForUser(UserHandle) */ @Nullable public UserHandle getUserForAncestralSerialNumber(long ancestralSerialNumber) { if (sService != null) { try { return sService.getUserForAncestralSerialNumber(ancestralSerialNumber); } catch (RemoteException e) { Log.e(TAG, "getUserForAncestralSerialNumber() couldn't connect"); } } return null; } /** * Sets the ancestral work profile for the calling user. * * <p> The ancestral work profile corresponds to the profile that was used to restore to the * callers profile. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.BACKUP) public void setAncestralSerialNumber(long ancestralSerialNumber) { if (sService != null) { try { sService.setAncestralSerialNumber(ancestralSerialNumber); } catch (RemoteException e) { Log.e(TAG, "setAncestralSerialNumber() couldn't connect"); } } } /** * Returns an {@link Intent} for the specified transport's configuration UI. * This value is set by {@link #updateTransportAttributes(ComponentName, String, Intent, String, Loading
core/java/android/app/backup/IBackupManager.aidl +21 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.backup.IFullBackupRestoreObserver; import android.app.backup.IRestoreSession; import android.app.backup.ISelectBackupTransportCallback; import android.os.ParcelFileDescriptor; import android.os.UserHandle; import android.content.Intent; import android.content.ComponentName; Loading Loading @@ -685,4 +686,24 @@ interface IBackupManager { * {@link android.app.backup.IBackupManager.cancelBackups} for the calling user id. */ void cancelBackups(); /** * Returns a {@link UserHandle} for the user that has {@code ancestralSerialNumber} as the serial * number of the it's ancestral work profile. * * <p> The ancestral work profile is set by {@link #setAncestralSerialNumber(long)} * and it corresponds to the profile that was used to restore to the callers profile. */ UserHandle getUserForAncestralSerialNumber(in long ancestralSerialNumber); /** * Sets the ancestral work profile for the calling user. * * <p> The ancestral work profile corresponds to the profile that was used to restore to the * callers profile. * * <p>Callers must hold the android.permission.BACKUP permission to use this method. */ void setAncestralSerialNumber(in long ancestralSerialNumber); }
services/backup/java/com/android/server/backup/BackupManagerService.java +41 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; import android.util.Slog; import android.util.SparseArray; Loading Loading @@ -437,6 +438,44 @@ public class BackupManagerService { : userBackupManagerService.getConfigurationIntent(transportName); } /** * Sets the ancestral work profile for the calling user. * * <p> The ancestral work profile corresponds to the profile that was used to restore to the * callers profile. */ public void setAncestralSerialNumber(long ancestralSerialNumber) { UserBackupManagerService userBackupManagerService = getServiceForUserIfCallerHasPermission( Binder.getCallingUserHandle().getIdentifier(), "setAncestralSerialNumber()"); if (userBackupManagerService != null) { userBackupManagerService.setAncestralSerialNumber(ancestralSerialNumber); } } /** * Returns a {@link UserHandle} for the user that has {@code ancestralSerialNumber} as the * serial number of the its ancestral work profile. * * <p> The ancestral work profile is set by {@link #setAncestralSerialNumber(long)} * and it corresponds to the profile that was used to restore to the callers profile. */ @Nullable public UserHandle getUserForAncestralSerialNumber(long ancestralSerialNumber) { for (UserHandle handle : mContext.getSystemService(UserManager.class).getUserProfiles()) { UserBackupManagerService userBackupManagerService = getServiceUsers().get( handle.getIdentifier()); if (userBackupManagerService != null) { if (userBackupManagerService.getAncestralSerialNumber() == ancestralSerialNumber) { return handle; } } } return null; } /** * Supply the current destination string for the given transport. If the name is not one of the * registered transports the method will return null. Loading