1bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell/* 2bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * Copyright (C) 2010 The Android Open Source Project 3bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * 4bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * Licensed under the Apache License, Version 2.0 (the "License"); 5bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * you may not use this file except in compliance with the License. 6bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * You may obtain a copy of the License at 7bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * 8bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * http://www.apache.org/licenses/LICENSE-2.0 9bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * 10bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * Unless required by applicable law or agreed to in writing, software 11bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * distributed under the License is distributed on an "AS IS" BASIS, 12bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * See the License for the specific language governing permissions and 14bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell * limitations under the License. 15bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell */ 16bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell 17bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushellpackage com.android.calendar; 18bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell 19bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushellimport android.app.backup.BackupAgentHelper; 201851ecb450bbfa40ef375a914d1c31c793684894Michael Chanimport android.app.backup.BackupDataInput; 21bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushellimport android.app.backup.SharedPreferencesBackupHelper; 221851ecb450bbfa40ef375a914d1c31c793684894Michael Chanimport android.content.Context; 231851ecb450bbfa40ef375a914d1c31c793684894Michael Chanimport android.content.SharedPreferences.Editor; 241851ecb450bbfa40ef375a914d1c31c793684894Michael Chanimport android.os.ParcelFileDescriptor; 251851ecb450bbfa40ef375a914d1c31c793684894Michael Chan 261851ecb450bbfa40ef375a914d1c31c793684894Michael Chanimport java.io.IOException; 27bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell 28bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushellpublic class CalendarBackupAgent extends BackupAgentHelper 29bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell{ 30bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell static final String SHARED_KEY = "shared_pref"; 31bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell 321851ecb450bbfa40ef375a914d1c31c793684894Michael Chan @Override 331851ecb450bbfa40ef375a914d1c31c793684894Michael Chan public void onCreate() { 34bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell addHelper(SHARED_KEY, new SharedPreferencesBackupHelper(this, 35bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell GeneralPreferences.SHARED_PREFS_NAME)); 36bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell } 371851ecb450bbfa40ef375a914d1c31c793684894Michael Chan 381851ecb450bbfa40ef375a914d1c31c793684894Michael Chan @Override 391851ecb450bbfa40ef375a914d1c31c793684894Michael Chan public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) 401851ecb450bbfa40ef375a914d1c31c793684894Michael Chan throws IOException { 411851ecb450bbfa40ef375a914d1c31c793684894Michael Chan // See Utils.getRingTonePreference for more info 421851ecb450bbfa40ef375a914d1c31c793684894Michael Chan final Editor editor = getSharedPreferences( 431851ecb450bbfa40ef375a914d1c31c793684894Michael Chan GeneralPreferences.SHARED_PREFS_NAME_NO_BACKUP, Context.MODE_PRIVATE).edit(); 441851ecb450bbfa40ef375a914d1c31c793684894Michael Chan editor.putString(GeneralPreferences.KEY_ALERTS_RINGTONE, 451851ecb450bbfa40ef375a914d1c31c793684894Michael Chan GeneralPreferences.DEFAULT_RINGTONE).commit(); 461851ecb450bbfa40ef375a914d1c31c793684894Michael Chan 471851ecb450bbfa40ef375a914d1c31c793684894Michael Chan super.onRestore(data, appVersionCode, newState); 481851ecb450bbfa40ef375a914d1c31c793684894Michael Chan } 49bdadecb6a5fc35b51bc3d488b5f0b4cbed987964Garth Bushell} 50