blob: ecf4c71739de96d1468564998c5d75312bf113d9 [file] [log] [blame]
Sunny Goyalae788a12019-04-24 17:11:24 -07001/**
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.settings.backup;
18
Allen Su00c40d82023-10-05 09:28:37 +000019import static com.android.settings.localepicker.LocaleNotificationDataManager.LOCALE_NOTIFICATION;
20
Sunny Goyalae788a12019-04-24 17:11:24 -070021import android.app.backup.BackupAgentHelper;
Allen Su00c40d82023-10-05 09:28:37 +000022import android.app.backup.SharedPreferencesBackupHelper;
Sunny Goyalae788a12019-04-24 17:11:24 -070023
Jacky Wang382f8452024-02-29 22:47:53 +080024import com.android.settings.flags.Flags;
ykhung96e96852021-08-13 15:36:53 +080025import com.android.settings.fuelgauge.BatteryBackupHelper;
XingHaiLu49cb0002023-11-14 14:17:30 +080026import com.android.settings.onboarding.OnboardingFeatureProvider;
27import com.android.settings.overlay.FeatureFactory;
Sunny Goyalae788a12019-04-24 17:11:24 -070028import com.android.settings.shortcut.CreateShortcutPreferenceController;
29
Jacky Wang382f8452024-02-29 22:47:53 +080030/** Backup agent for Settings APK */
Sunny Goyalae788a12019-04-24 17:11:24 -070031public class SettingsBackupHelper extends BackupAgentHelper {
Allen Su00c40d82023-10-05 09:28:37 +000032 private static final String PREF_LOCALE_NOTIFICATION = "localeNotificationSharedPref";
XingHaiLu49cb0002023-11-14 14:17:30 +080033 public static final String SOUND_BACKUP_HELPER = "SoundSettingsBackup";
Sunny Goyalae788a12019-04-24 17:11:24 -070034
35 @Override
36 public void onCreate() {
37 super.onCreate();
ykhung96e96852021-08-13 15:36:53 +080038 addHelper(BatteryBackupHelper.TAG, new BatteryBackupHelper(this));
Allen Su00c40d82023-10-05 09:28:37 +000039 addHelper(PREF_LOCALE_NOTIFICATION,
40 new SharedPreferencesBackupHelper(this, LOCALE_NOTIFICATION));
XingHaiLu49cb0002023-11-14 14:17:30 +080041 if (Flags.enableSoundBackup()) {
42 OnboardingFeatureProvider onboardingFeatureProvider =
43 FeatureFactory.getFeatureFactory().getOnboardingFeatureProvider();
44 if (onboardingFeatureProvider != null) {
45 addHelper(SOUND_BACKUP_HELPER, onboardingFeatureProvider.
46 getSoundBackupHelper(this, this.getBackupRestoreEventLogger()));
47 }
48 }
Sunny Goyalae788a12019-04-24 17:11:24 -070049 }
50
51 @Override
52 public void onRestoreFinished() {
53 super.onRestoreFinished();
54 CreateShortcutPreferenceController.updateRestoredShortcuts(this);
55 }
Sunny Goyalae788a12019-04-24 17:11:24 -070056}