| Sunny Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 1 | /** |
| 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 | |
| 17 | package com.android.settings.backup; |
| 18 | |
| Allen Su | 00c40d8 | 2023-10-05 09:28:37 +0000 | [diff] [blame] | 19 | import static com.android.settings.localepicker.LocaleNotificationDataManager.LOCALE_NOTIFICATION; |
| 20 | |
| Sunny Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 21 | import android.app.backup.BackupAgentHelper; |
| Allen Su | 00c40d8 | 2023-10-05 09:28:37 +0000 | [diff] [blame] | 22 | import android.app.backup.SharedPreferencesBackupHelper; |
| Sunny Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 23 | |
| Jacky Wang | 382f845 | 2024-02-29 22:47:53 +0800 | [diff] [blame] | 24 | import com.android.settings.flags.Flags; |
| ykhung | 96e9685 | 2021-08-13 15:36:53 +0800 | [diff] [blame] | 25 | import com.android.settings.fuelgauge.BatteryBackupHelper; |
| XingHaiLu | 49cb000 | 2023-11-14 14:17:30 +0800 | [diff] [blame] | 26 | import com.android.settings.onboarding.OnboardingFeatureProvider; |
| 27 | import com.android.settings.overlay.FeatureFactory; |
| Sunny Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 28 | import com.android.settings.shortcut.CreateShortcutPreferenceController; |
| 29 | |
| Jacky Wang | 382f845 | 2024-02-29 22:47:53 +0800 | [diff] [blame] | 30 | /** Backup agent for Settings APK */ |
| Sunny Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 31 | public class SettingsBackupHelper extends BackupAgentHelper { |
| Allen Su | 00c40d8 | 2023-10-05 09:28:37 +0000 | [diff] [blame] | 32 | private static final String PREF_LOCALE_NOTIFICATION = "localeNotificationSharedPref"; |
| XingHaiLu | 49cb000 | 2023-11-14 14:17:30 +0800 | [diff] [blame] | 33 | public static final String SOUND_BACKUP_HELPER = "SoundSettingsBackup"; |
| Sunny Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 34 | |
| 35 | @Override |
| 36 | public void onCreate() { |
| 37 | super.onCreate(); |
| ykhung | 96e9685 | 2021-08-13 15:36:53 +0800 | [diff] [blame] | 38 | addHelper(BatteryBackupHelper.TAG, new BatteryBackupHelper(this)); |
| Allen Su | 00c40d8 | 2023-10-05 09:28:37 +0000 | [diff] [blame] | 39 | addHelper(PREF_LOCALE_NOTIFICATION, |
| 40 | new SharedPreferencesBackupHelper(this, LOCALE_NOTIFICATION)); |
| XingHaiLu | 49cb000 | 2023-11-14 14:17:30 +0800 | [diff] [blame] | 41 | 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 Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public void onRestoreFinished() { |
| 53 | super.onRestoreFinished(); |
| 54 | CreateShortcutPreferenceController.updateRestoredShortcuts(this); |
| 55 | } |
| Sunny Goyal | ae788a1 | 2019-04-24 17:11:24 -0700 | [diff] [blame] | 56 | } |