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 19 20 import android.app.backup.BackupAgentHelper; 21 22 import com.android.settings.flags.Flags; 23 import com.android.settings.onboarding.OnboardingFeatureProvider; 24 import com.android.settings.overlay.FeatureFactory; 25 import com.android.settings.shortcut.CreateShortcutPreferenceController; 26 import com.android.settingslib.datastore.BackupRestoreStorageManager; 27 28 /** Backup agent for Settings APK */ 29 public class SettingsBackupHelper extends BackupAgentHelper { 30 public static final String SOUND_BACKUP_HELPER = "SoundSettingsBackup"; 31 32 @Override onCreate()33 public void onCreate() { 34 super.onCreate(); 35 BackupRestoreStorageManager.getInstance(this).addBackupAgentHelpers(this); 36 if (Flags.enableSoundBackup()) { 37 OnboardingFeatureProvider onboardingFeatureProvider = 38 FeatureFactory.getFeatureFactory().getOnboardingFeatureProvider(); 39 if (onboardingFeatureProvider != null) { 40 addHelper(SOUND_BACKUP_HELPER, onboardingFeatureProvider. 41 getSoundBackupHelper(this, this.getBackupRestoreEventLogger())); 42 } 43 } 44 } 45 46 @Override onRestoreFinished()47 public void onRestoreFinished() { 48 super.onRestoreFinished(); 49 BackupRestoreStorageManager.getInstance(this).onRestoreFinished(); 50 CreateShortcutPreferenceController.updateRestoredShortcuts(this); 51 } 52 } 53