Package org.robolectric.shadows
Class ShadowBackupManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowBackupManager
-
@Implements(android.app.backup.BackupManager.class) public class ShadowBackupManager extends Object
A stub implementation ofBackupManager
that instead of connecting to a real backup transport and performing restores, stores which packages are restored from which backup set, and can be verified using methods on the shadow likegetPackageRestoreToken(String)
.
-
-
Constructor Summary
Constructors Constructor Description ShadowBackupManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
__constructor__(Context context)
void
addAvailableRestoreSets(long restoreToken, List<String> packages)
Adds a restore set available to be restored.protected RestoreSession
beginRestoreSession()
protected void
dataChanged()
protected long
getAvailableRestoreToken(String packageName)
int
getDataChangedCount()
Returns number of timesdataChanged()
was called.long
getPackageRestoreToken(String packageName)
Returns the restore token for the given package, or0
if the package was not restored.protected boolean
isBackupEnabled()
boolean
isDataChanged()
Returns whetherdataChanged()
was called.static void
reset()
protected void
setBackupEnabled(boolean isEnabled)
-
-
-
Method Detail
-
reset
@Resetter public static void reset()
-
__constructor__
@Implementation protected void __constructor__(Context context)
-
dataChanged
@Implementation protected void dataChanged()
-
isDataChanged
public boolean isDataChanged()
Returns whetherdataChanged()
was called.
-
getDataChangedCount
public int getDataChangedCount()
Returns number of timesdataChanged()
was called.
-
setBackupEnabled
@Implementation(minSdk=21) @HiddenApi protected void setBackupEnabled(boolean isEnabled)
-
isBackupEnabled
@Implementation(minSdk=21) @HiddenApi protected boolean isBackupEnabled()
-
beginRestoreSession
@Implementation @HiddenApi protected RestoreSession beginRestoreSession()
-
getAvailableRestoreToken
@Implementation(minSdk=23) @HiddenApi protected long getAvailableRestoreToken(String packageName)
-
getPackageRestoreToken
public long getPackageRestoreToken(String packageName)
Returns the restore token for the given package, or0
if the package was not restored.
-
-