From cc84c69726507a85116f5664e20e2ebfac76edbe Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 29 Mar 2010 14:54:02 -0700 Subject: API CHANGE: rename BackupHelperAgent => BackupAgentHelper per API Council Part of bug #2545514 Change-Id: Ic775e3b942c485252149c1b6c15c88517fa4e3e5 --- api/current.xml | 140 ++++++++++----------- core/java/android/app/backup/BackupAgent.java | 2 +- .../java/android/app/backup/BackupAgentHelper.java | 76 +++++++++++ core/java/android/app/backup/BackupHelper.java | 8 +- .../java/android/app/backup/BackupHelperAgent.java | 76 ----------- core/java/android/app/backup/BackupManager.java | 2 +- core/java/android/app/backup/FileBackupHelper.java | 4 +- .../app/backup/SharedPreferencesBackupHelper.java | 2 +- .../providers/settings/SettingsBackupAgent.java | 4 +- .../java/com/android/server/SystemBackupAgent.java | 4 +- .../com/android/backuptest/BackupTestAgent.java | 4 +- 11 files changed, 162 insertions(+), 160 deletions(-) create mode 100644 core/java/android/app/backup/BackupAgentHelper.java delete mode 100644 core/java/android/app/backup/BackupHelperAgent.java diff --git a/api/current.xml b/api/current.xml index bbed4fd1f301..5609a6333803 100644 --- a/api/current.xml +++ b/api/current.xml @@ -27075,6 +27075,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * A backup agent based on convenient helper classes is available in - * {@link android.app.backup.BackupHelperAgent} for less complex implementation + * {@link android.app.backup.BackupAgentHelper} for less complex implementation * requirements. *

* STOPSHIP write more documentation about the backup process here. diff --git a/core/java/android/app/backup/BackupAgentHelper.java b/core/java/android/app/backup/BackupAgentHelper.java new file mode 100644 index 000000000000..7b6be2327b46 --- /dev/null +++ b/core/java/android/app/backup/BackupAgentHelper.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.app.backup; + +import android.os.ParcelFileDescriptor; + +import java.io.IOException; + +/** + * A convenient BackupAgent wrapper class that automatically manages + * heterogeneous data sets within the backup data, each identified by a unique + * key prefix. An application will typically extend this class in their own + * backup agent. Then, within the agent's onBackup() and onRestore() methods, it + * will call {@link #addHelper(String, BackupHelper)} one or more times to + * specify the data sets, then invoke super.onBackup() or super.onRestore() to + * have the BackupAgentHelper implementation process the data. + *

+ * STOPSHIP: document! + */ +public class BackupAgentHelper extends BackupAgent { + static final String TAG = "BackupAgentHelper"; + + BackupHelperDispatcher mDispatcher = new BackupHelperDispatcher(); + + /** + * Run the backup process on each of the configured handlers. + */ + @Override + public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, + ParcelFileDescriptor newState) throws IOException { + mDispatcher.performBackup(oldState, data, newState); + } + + /** + * Run the restore process on each of the configured handlers. + */ + @Override + public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) + throws IOException { + mDispatcher.performRestore(data, appVersionCode, newState); + } + + /** @hide */ + public BackupHelperDispatcher getDispatcher() { + return mDispatcher; + } + + /** + * Add a helper for a given data subset to the agent's configuration. Each helper + * must have a prefix string that is unique within this backup agent's set of + * helpers. + * + * @param keyPrefix A string used to disambiguate the various helpers within this agent + * @param helper A backup/restore helper object to be invoked during backup and restore + * operations. + */ + public void addHelper(String keyPrefix, BackupHelper helper) { + mDispatcher.addHelper(keyPrefix, helper); + } +} + + diff --git a/core/java/android/app/backup/BackupHelper.java b/core/java/android/app/backup/BackupHelper.java index dca23881a8fc..b7ef268ae443 100644 --- a/core/java/android/app/backup/BackupHelper.java +++ b/core/java/android/app/backup/BackupHelper.java @@ -20,7 +20,7 @@ import android.os.ParcelFileDescriptor; /** * A convenient interface to be used with the - * {@link android.app.backup.BackupHelperAgent} to implement backup and restore of + * {@link android.app.backup.BackupAgentHelper} to implement backup and restore of * arbitrary data types. *

* STOPSHOP: document! @@ -36,7 +36,8 @@ public interface BackupHelper { ParcelFileDescriptor newState); /** - * Called by BackupHelperAgent to restore one entity from the restore dataset. + * Called by {@link android.app.backup.BackupAgentHelper BackupAgentHelper} + * to restore one entity from the restore dataset. *

* Do not close the data stream. Do not read more than * data.size() bytes from data. @@ -44,7 +45,8 @@ public interface BackupHelper { public void restoreEntity(BackupDataInputStream data); /** - * Called by BackupHelperAgent to write the new backup state file corresponding to + * Called by {@link android.app.backup.BackupAgentHelper BackupAgentHelper} + * to write the new backup state file corresponding to * the current state of the app's data at the time the backup operation was * performed. */ diff --git a/core/java/android/app/backup/BackupHelperAgent.java b/core/java/android/app/backup/BackupHelperAgent.java deleted file mode 100644 index 6f4a0316c141..000000000000 --- a/core/java/android/app/backup/BackupHelperAgent.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.app.backup; - -import android.os.ParcelFileDescriptor; - -import java.io.IOException; - -/** - * A convenient BackupAgent wrapper class that automatically manages - * heterogeneous data sets within the backup data, each identified by a unique - * key prefix. An application will typically extend this class in their own - * backup agent. Then, within the agent's onBackup() and onRestore() methods, it - * will call {@link #addHelper(String, BackupHelper)} one or more times to - * specify the data sets, then invoke super.onBackup() or super.onRestore() to - * have the BackupHelperAgent implementation process the data. - *

- * STOPSHIP: document! - */ -public class BackupHelperAgent extends BackupAgent { - static final String TAG = "BackupHelperAgent"; - - BackupHelperDispatcher mDispatcher = new BackupHelperDispatcher(); - - /** - * Run the backup process on each of the configured handlers. - */ - @Override - public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, - ParcelFileDescriptor newState) throws IOException { - mDispatcher.performBackup(oldState, data, newState); - } - - /** - * Run the restore process on each of the configured handlers. - */ - @Override - public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) - throws IOException { - mDispatcher.performRestore(data, appVersionCode, newState); - } - - /** @hide */ - public BackupHelperDispatcher getDispatcher() { - return mDispatcher; - } - - /** - * Add a helper for a given data subset to the agent's configuration. Each helper - * must have a prefix string that is unique within this backup agent's set of - * helpers. - * - * @param keyPrefix A string used to disambiguate the various helpers within this agent - * @param helper A backup/restore helper object to be invoked during backup and restore - * operations. - */ - public void addHelper(String keyPrefix, BackupHelper helper) { - mDispatcher.addHelper(keyPrefix, helper); - } -} - - diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java index dff069527814..7eb626582336 100644 --- a/core/java/android/app/backup/BackupManager.java +++ b/core/java/android/app/backup/BackupManager.java @@ -41,7 +41,7 @@ import android.util.Log; * of how the backup then proceeds. *

* A simple implementation of a BackupAgent useful for backing up Preferences - * and files is available by using {@link android.app.backup.BackupHelperAgent}. + * and files is available by using {@link android.app.backup.BackupAgentHelper}. *

* STOPSHIP: more documentation! *

diff --git a/core/java/android/app/backup/FileBackupHelper.java b/core/java/android/app/backup/FileBackupHelper.java index b42049eb91b9..3ce5b4315729 100644 --- a/core/java/android/app/backup/FileBackupHelper.java +++ b/core/java/android/app/backup/FileBackupHelper.java @@ -24,7 +24,7 @@ import java.io.File; /** * A helper class which can be used in conjunction with - * {@link android.app.backup.BackupHelperAgent} to manage the backup of a set of + * {@link android.app.backup.BackupAgentHelper} to manage the backup of a set of * files. Whenever backup is performed, all files changed since the last backup * will be saved in their entirety. During the first time the backup happens, * all the files in the list will be backed up. Note that this should only be @@ -69,7 +69,7 @@ public class FileBackupHelper extends FileBackupHelperBase implements BackupHelp * now. When oldState is null, all the files will * be backed up. *

- * This should be called from {@link android.app.backup.BackupHelperAgent} + * This should be called from {@link android.app.backup.BackupAgentHelper} * directly. See * {@link android.app.backup.BackupAgent#onBackup(ParcelFileDescriptor, BackupDataOutput, ParcelFileDescriptor)} * for a description of parameter meanings. diff --git a/core/java/android/app/backup/SharedPreferencesBackupHelper.java b/core/java/android/app/backup/SharedPreferencesBackupHelper.java index d35b10c714f4..f9e6b286b7da 100644 --- a/core/java/android/app/backup/SharedPreferencesBackupHelper.java +++ b/core/java/android/app/backup/SharedPreferencesBackupHelper.java @@ -25,7 +25,7 @@ import java.io.File; /** * A helper class which can be used in conjunction with - * {@link android.app.backup.BackupHelperAgent} to manage the backup of + * {@link android.app.backup.BackupAgentHelper} to manage the backup of * {@link android.content.SharedPreferences}. Whenever backup is performed it * will back up all named shared preferences which have changed since the last * backup. diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index d5c9855ab045..b98071e31af0 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -32,7 +32,7 @@ import java.util.zip.CRC32; import android.app.backup.BackupDataInput; import android.app.backup.BackupDataOutput; -import android.app.backup.BackupHelperAgent; +import android.app.backup.BackupAgentHelper; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -49,7 +49,7 @@ import android.util.Log; * Performs backup and restore of the System and Secure settings. * List of settings that are backed up are stored in the Settings.java file */ -public class SettingsBackupAgent extends BackupHelperAgent { +public class SettingsBackupAgent extends BackupAgentHelper { private static final boolean DEBUG = false; private static final String KEY_SYSTEM = "system"; diff --git a/services/java/com/android/server/SystemBackupAgent.java b/services/java/com/android/server/SystemBackupAgent.java index 86b9df639c71..fff1874096d5 100644 --- a/services/java/com/android/server/SystemBackupAgent.java +++ b/services/java/com/android/server/SystemBackupAgent.java @@ -21,7 +21,7 @@ import android.app.backup.BackupDataInput; import android.app.backup.BackupDataInputStream; import android.app.backup.BackupDataOutput; import android.app.backup.BackupHelper; -import android.app.backup.BackupHelperAgent; +import android.app.backup.BackupAgentHelper; import android.content.Context; import android.os.ParcelFileDescriptor; import android.os.ServiceManager; @@ -34,7 +34,7 @@ import java.io.IOException; /** * Backup agent for various system-managed data, currently just the system wallpaper */ -public class SystemBackupAgent extends BackupHelperAgent { +public class SystemBackupAgent extends BackupAgentHelper { private static final String TAG = "SystemBackupAgent"; // These paths must match what the WallpaperManagerService uses diff --git a/tests/backup/src/com/android/backuptest/BackupTestAgent.java b/tests/backup/src/com/android/backuptest/BackupTestAgent.java index 3fdd96b8d06b..edc54a414005 100644 --- a/tests/backup/src/com/android/backuptest/BackupTestAgent.java +++ b/tests/backup/src/com/android/backuptest/BackupTestAgent.java @@ -16,11 +16,11 @@ package com.android.backuptest; -import android.app.backup.BackupHelperAgent; +import android.app.backup.BackupAgentHelper; import android.app.backup.FileBackupHelper; import android.app.backup.SharedPreferencesBackupHelper; -public class BackupTestAgent extends BackupHelperAgent +public class BackupTestAgent extends BackupAgentHelper { public void onCreate() { addHelper("data_files", new FileBackupHelper(this, BackupTestActivity.FILE_NAME)); -- cgit v1.2.3-59-g8ed1b