Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06a0ac2f authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

Merge "backup launcher preferences" into jb-ub-now-kermit

parents 5d518fa7 45297f85
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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));
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -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;