diff options
author | Michael Chan <mchan@android.com> | 2010-12-09 14:33:31 -0800 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2010-12-09 14:33:31 -0800 |
commit | 01433197f57dea37678bd7dff66b9281a24d1f79 (patch) | |
tree | 91fcf9bcfb1e4ada40cbf76cd651c43001abd9a2 | |
parent | e12c383fc76887e3cb8bbf983e10ae92c1e46929 (diff) | |
parent | d56949581a42db01d3e23139682dc319d8db6b24 (diff) | |
download | Calendar-froyo-plus-aosp.tar.gz |
Merge "Patch to backup settings using BackupAgentHelper"tools_r9tools_r8froyo-plus-aosp
-rw-r--r-- | AndroidManifest.xml | 6 | ||||
-rw-r--r-- | src/com/android/calendar/CalendarBackupAgent.java | 30 | ||||
-rw-r--r-- | src/com/android/calendar/CalendarPreferenceActivity.java | 4 |
3 files changed, 38 insertions, 2 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e77ee054..76e49f51 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -38,7 +38,11 @@ <application android:name="CalendarApplication" android:label="@string/app_label" android:icon="@drawable/app_icon" - android:taskAffinity="android.task.calendar"> + android:taskAffinity="android.task.calendar" + android:backupAgent="com.android.calendar.CalendarBackupAgent"> + + <meta-data android:name="com.google.android.backup.api_key" + android:value="AEdPqrEAAAAIM256oVOGnuSel5QKDpL8je_T65ZI8rFnDinssA" /> <!-- TODO: Remove dependency of application on the test runner (android.test) library. --> <uses-library android:name="android.test.runner" /> diff --git a/src/com/android/calendar/CalendarBackupAgent.java b/src/com/android/calendar/CalendarBackupAgent.java new file mode 100644 index 00000000..f812d9b9 --- /dev/null +++ b/src/com/android/calendar/CalendarBackupAgent.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2010 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 com.android.calendar; + +import android.app.backup.BackupAgentHelper; +import android.app.backup.SharedPreferencesBackupHelper; + +public class CalendarBackupAgent extends BackupAgentHelper +{ + static final String SHARED_KEY = "shared_pref"; + + public void onCreate () { + addHelper(SHARED_KEY, new SharedPreferencesBackupHelper(this, + CalendarPreferenceActivity.SHARED_PREFS_NAME)); + } +} diff --git a/src/com/android/calendar/CalendarPreferenceActivity.java b/src/com/android/calendar/CalendarPreferenceActivity.java index a02a1d50..150ba2bf 100644 --- a/src/com/android/calendar/CalendarPreferenceActivity.java +++ b/src/com/android/calendar/CalendarPreferenceActivity.java @@ -27,13 +27,14 @@ import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.preference.RingtonePreference; +import android.app.backup.BackupManager; public class CalendarPreferenceActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener { private static final String BUILD_VERSION = "build_version"; // The name of the shared preferences file. This name must be maintained for historical // reasons, as it's what PreferenceManager assigned the first time the file was created. - private static final String SHARED_PREFS_NAME = "com.android.calendar_preferences"; + static final String SHARED_PREFS_NAME = "com.android.calendar_preferences"; // Preference keys static final String KEY_HIDE_DECLINED = "preferences_hide_declined"; @@ -114,6 +115,7 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements On if (key.equals(KEY_ALERTS_TYPE)) { updateChildPreferences(); } + BackupManager.dataChanged(this.getPackageName()); } private void updateChildPreferences() { |