question: @ Override public void performBackup ( ParcelFileDescriptor oldState , BackupDataOutput data , ParcelFileDescriptor newState ) { if ( VERBOSE ) Log . v ( TAG , "onBackup" ) ; BackupProtos . Journal in = readJournal ( oldState ) ; if ( ! launcherIsReady ( ) ) { dataChanged ( ) ; writeJournal ( newState , in ) ; return ; } if ( mDeviceProfileData == null ) { LauncherAppState app = LauncherAppState . getInstance ( ) ; mIdp = app . getInvariantDeviceProfile ( ) ; mDeviceProfileData = initDeviceProfileData ( mIdp ) ; mIconCache = app . getIconCache ( ) ; } Log . v ( TAG , "lastBackupTime = " + in . t ) ; mKeys . clear ( ) ; applyJournal ( in ) ; long newBackupTime = System . currentTimeMillis ( ) ; mBackupDataWasUpdated = false ; try { backupFavorites ( data ) ; backupScreens ( data ) ; backupIcons ( data ) ; backupWidgets ( data ) ; HashSet < String > validKeys = new HashSet < String > ( ) ; for ( BackupProtos . Key key : mKeys ) { validKeys . add ( keyToBackupKey ( key ) ) ; } mExistingKeys . removeAll ( validKeys ) ; for ( String deleted : mExistingKeys ) { if ( VERBOSE ) Log . v ( TAG , "dropping deleted item " + deleted ) ; data . writeEntityHeader ( deleted , - 1 ) ; mBackupDataWasUpdated = true ; } mExistingKeys . clear ( ) ; if ( ! mBackupDataWasUpdated ) { mBackupDataWasUpdated = ( in . profile == null ) || ! Arrays . equals ( DeviceProfieData . toByteArray ( in . profile ) , DeviceProfieData . toByteArray ( mDeviceProfileData ) ) || ( in . backupVersion != BACKUP_VERSION ) || ( in . appVersion != getAppVersion ( ) ) ; } if ( mBackupDataWasUpdated ) { mLastBackupRestoreTime = newBackupTime ; BackupProtos . Journal state = getCurrentStateJournal ( ) ; writeRowToBackup ( JOURNAL_KEY , state , data ) ; } else { if ( DEBUG ) Log . d ( TAG , "Nothing was written during backup" ) ; } } catch ( IOException e ) { Log . e ( TAG , "launcher backup has failed" , e ) ; } writeNewStateDescription ( newState ) ; }
target:  Back up launcher data so we can restore the user's state on a new device. <P>The journal is a timestamp and a list of keys that were saved as of that time. <P>Keys may come back in any order, so each key/value is one complete row of the database.