Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 1 | package com.android.launcher3; |
| 2 | |
| 3 | import android.app.backup.BackupAgent; |
| 4 | import android.app.backup.BackupDataInput; |
| 5 | import android.app.backup.BackupDataOutput; |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 6 | import android.os.ParcelFileDescriptor; |
| 7 | |
Sunny Goyal | 49f19f0 | 2017-01-05 14:36:02 -0800 | [diff] [blame] | 8 | import com.android.launcher3.logging.FileLog; |
Sunny Goyal | e8f7d5a | 2016-05-24 11:30:14 -0700 | [diff] [blame] | 9 | import com.android.launcher3.provider.RestoreDbTask; |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 10 | |
| 11 | public class LauncherBackupAgent extends BackupAgent { |
| 12 | |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 13 | @Override |
Sunny Goyal | 49f19f0 | 2017-01-05 14:36:02 -0800 | [diff] [blame] | 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 |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 21 | public void onRestore( |
| 22 | BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) { |
| 23 | // Doesn't do incremental backup/restore |
| 24 | } |
| 25 | |
| 26 | @Override |
| 27 | public void onBackup( |
| 28 | ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) { |
| 29 | // Doesn't do incremental backup/restore |
| 30 | } |
| 31 | |
| 32 | @Override |
| 33 | public void onRestoreFinished() { |
Sunny Goyal | 68031ca | 2021-08-02 12:23:44 -0700 | [diff] [blame^] | 34 | RestoreDbTask.setPending(this); |
Sunny Goyal | c190dbf | 2016-05-05 14:37:05 -0700 | [diff] [blame] | 35 | } |
| 36 | } |