FileDocCategorySizeDatePackage
Trampoline.javaAPI DocAndroid 5.1 API11711Thu Mar 12 22:22:42 GMT 2015com.android.server.backup

Trampoline

public class Trampoline extends IBackupManager.Stub

Fields Summary
static final String
TAG
static final boolean
DEBUG_TRAMPOLINE
static final String
BACKUP_SUPPRESS_FILENAME
static final String
BACKUP_DISABLE_PROPERTY
final android.content.Context
mContext
final File
mSuppressFile
final boolean
mGlobalDisable
volatile BackupManagerService
mService
Constructors Summary
public Trampoline(android.content.Context context)


       
        mContext = context;
        File dir = new File(Environment.getSecureDataDirectory(), "backup");
        dir.mkdirs();
        mSuppressFile = new File(dir, BACKUP_SUPPRESS_FILENAME);
        mGlobalDisable = SystemProperties.getBoolean(BACKUP_DISABLE_PROPERTY, false);
    
Methods Summary
public voidacknowledgeFullBackupOrRestore(int token, boolean allow, java.lang.String curPassword, java.lang.String encryptionPassword, android.app.backup.IFullBackupRestoreObserver observer)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.acknowledgeFullBackupOrRestore(token, allow,
                    curPassword, encryptionPassword, observer);
        }
    
public voidagentConnected(java.lang.String packageName, android.os.IBinder agent)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.agentConnected(packageName, agent);
        }
    
public voidagentDisconnected(java.lang.String packageName)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.agentDisconnected(packageName);
        }
    
public voidbackupNow()

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.backupNow();
        }
    
booleanbeginFullBackup(FullBackupJob scheduledJob)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.beginFullBackup(scheduledJob) : false;
    
public android.app.backup.IRestoreSessionbeginRestoreSession(java.lang.String packageName, java.lang.String transportID)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.beginRestoreSession(packageName, transportID) : null;
    
public voidclearBackupData(java.lang.String transportName, java.lang.String packageName)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.clearBackupData(transportName, packageName);
        }
    
public voiddataChanged(java.lang.String packageName)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.dataChanged(packageName);
        }
    
public voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.dump(fd, pw, args);
        } else {
            pw.println("Inactive");
        }
    
voidendFullBackup()

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.endFullBackup();
        }
    
public voidfullBackup(android.os.ParcelFileDescriptor fd, boolean includeApks, boolean includeObbs, boolean includeShared, boolean doWidgets, boolean allApps, boolean allIncludesSystem, boolean doCompress, java.lang.String[] packageNames)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.fullBackup(fd, includeApks, includeObbs, includeShared, doWidgets,
                    allApps, allIncludesSystem, doCompress, packageNames);
        }
    
public voidfullRestore(android.os.ParcelFileDescriptor fd)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.fullRestore(fd);
        }
    
public voidfullTransportBackup(java.lang.String[] packageNames)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.fullTransportBackup(packageNames);
        }
    
public android.content.IntentgetConfigurationIntent(java.lang.String transport)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.getConfigurationIntent(transport) : null;
    
public java.lang.StringgetCurrentTransport()

        BackupManagerService svc = mService;
        return (svc != null) ? svc.getCurrentTransport() : null;
    
public android.content.IntentgetDataManagementIntent(java.lang.String transport)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.getDataManagementIntent(transport) : null;
    
public java.lang.StringgetDataManagementLabel(java.lang.String transport)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.getDataManagementLabel(transport) : null;
    
public java.lang.StringgetDestinationString(java.lang.String transport)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.getDestinationString(transport) : null;
    
public booleanhasBackupPassword()

        BackupManagerService svc = mService;
        return (svc != null) ? svc.hasBackupPassword() : false;
    
public voidinitialize(int whichUser)

        // Note that only the owner user is currently involved in backup/restore
        if (whichUser == UserHandle.USER_OWNER) {
            // Does this product support backup/restore at all?
            if (mGlobalDisable) {
                Slog.i(TAG, "Backup/restore not supported");
                return;
            }

            synchronized (this) {
                if (!mSuppressFile.exists()) {
                    mService = new BackupManagerService(mContext, this);
                } else {
                    Slog.i(TAG, "Backup inactive in user " + whichUser);
                }
            }
        }
    
public booleanisBackupEnabled()

        BackupManagerService svc = mService;
        return (svc != null) ? svc.isBackupEnabled() : false;
    
public booleanisBackupServiceActive(int userHandle)
Querying activity state of backup service. Calling this method before initialize yields undefined result.

param
userHandle The user in which the activity state of backup service is queried.
return
true if the service is active.

        if (userHandle == UserHandle.USER_OWNER) {
            synchronized (this) {
                return mService != null;
            }
        }
        return false;
    
public java.lang.String[]listAllTransports()

        BackupManagerService svc = mService;
        return (svc != null) ? svc.listAllTransports() : null;
    
public voidopComplete(int token)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.opComplete(token);
        }
    
public voidrestoreAtInstall(java.lang.String packageName, int token)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.restoreAtInstall(packageName, token);
        }
    
public java.lang.StringselectBackupTransport(java.lang.String transport)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.selectBackupTransport(transport) : null;
    
public voidsetAutoRestore(boolean doAutoRestore)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.setAutoRestore(doAutoRestore);
        }
    
public voidsetBackupEnabled(boolean isEnabled)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.setBackupEnabled(isEnabled);
        }
    
public booleansetBackupPassword(java.lang.String currentPw, java.lang.String newPw)

        BackupManagerService svc = mService;
        return (svc != null) ? svc.setBackupPassword(currentPw, newPw) : false;
    
public voidsetBackupProvisioned(boolean isProvisioned)

        BackupManagerService svc = mService;
        if (svc != null) {
            svc.setBackupProvisioned(isProvisioned);
        }
    
public voidsetBackupServiceActive(int userHandle, boolean makeActive)

        // Only the DPM should be changing the active state of backup
        final int caller = Binder.getCallingUid();
        if (caller != Process.SYSTEM_UID
                && caller != Process.ROOT_UID) {
            throw new SecurityException("No permission to configure backup activity");
        }

        if (mGlobalDisable) {
            Slog.i(TAG, "Backup/restore not supported");
            return;
        }

        if (userHandle == UserHandle.USER_OWNER) {
            synchronized (this) {
                if (makeActive != isBackupServiceActive(userHandle)) {
                    Slog.i(TAG, "Making backup "
                            + (makeActive ? "" : "in") + "active in user " + userHandle);
                    if (makeActive) {
                        mService = new BackupManagerService(mContext, this);
                        mSuppressFile.delete();
                    } else {
                        mService = null;
                        try {
                            mSuppressFile.createNewFile();
                        } catch (IOException e) {
                            Slog.e(TAG, "Unable to persist backup service inactivity");
                        }
                    }
                }
            }
        }