1 package com.android.launcher3; 2 3 import android.app.backup.BackupAgent; 4 import android.app.backup.BackupDataInput; 5 import android.app.backup.BackupDataOutput; 6 import android.os.ParcelFileDescriptor; 7 8 import com.android.launcher3.logging.FileLog; 9 import com.android.launcher3.provider.RestoreDbTask; 10 11 public class LauncherBackupAgent extends BackupAgent { 12 13 @Override onCreate()14 public void onCreate() { 15 super.onCreate(); 16 // Set the log dir as LauncherAppState is not initialized during restore. 17 FileLog.setDir(getFilesDir()); 18 } 19 20 @Override onRestore( BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState)21 public void onRestore( 22 BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) { 23 // Doesn't do incremental backup/restore 24 } 25 26 @Override onBackup( ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState)27 public void onBackup( 28 ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) { 29 // Doesn't do incremental backup/restore 30 } 31 32 @Override onRestoreFinished()33 public void onRestoreFinished() { 34 RestoreDbTask.setPending(this, true); 35 } 36 } 37