am 06a0ac2f: Merge "backup launcher preferences" into jb-ub-now-kermit
* commit '06a0ac2fea10bde7f5a45e72dea83308773a220d': backup launcher preferences
This commit is contained in:
@@ -18,10 +18,14 @@ package com.android.launcher3;
|
||||
|
||||
import android.app.backup.BackupAgentHelper;
|
||||
import android.app.backup.BackupManager;
|
||||
import android.app.backup.SharedPreferencesBackupHelper;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class LauncherBackupAgentHelper extends BackupAgentHelper {
|
||||
|
||||
private static final String TAG = "LauncherBackupAgentHelper";
|
||||
|
||||
private static BackupManager sBackupManager;
|
||||
|
||||
/**
|
||||
@@ -38,9 +42,21 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
|
||||
sBackupManager.dataChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
// There is only one process accessing this preference file, but the restore
|
||||
// modifies the file outside the normal codepaths, so it looks like another
|
||||
// process. This forces a reload of the file, in case this process persists.
|
||||
String spKey = LauncherAppState.getSharedPreferencesKey();
|
||||
SharedPreferences sp = getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
addHelper(LauncherBackupHelper.LAUNCHER_PREFS_PREFIX,
|
||||
new SharedPreferencesBackupHelper(this,
|
||||
LauncherAppState.getSharedPreferencesKey()));
|
||||
addHelper(LauncherBackupHelper.LAUNCHER_PREFIX, new LauncherBackupHelper(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ public class LauncherBackupHelper implements BackupHelper {
|
||||
|
||||
public static final String LAUNCHER_PREFIX = "L";
|
||||
|
||||
public static final String LAUNCHER_PREFS_PREFIX = "LP";
|
||||
|
||||
private static final Bitmap.CompressFormat IMAGE_FORMAT =
|
||||
android.graphics.Bitmap.CompressFormat.PNG;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user