diff options
author | Martijn Coenen <maco@google.com> | 2011-05-31 10:28:52 -0700 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2011-05-31 11:51:57 -0700 |
commit | 225ae2587712b06a354b4ad4625aadc780fa4e80 (patch) | |
tree | 2c49ca1f9a48878a7e6c6c1aa8a5822a24648b73 /src | |
parent | d8ee1a5825fb595b6b66441764a371bd696d04dc (diff) | |
download | packages_apps_nfc-225ae2587712b06a354b4ad4625aadc780fa4e80.zip packages_apps_nfc-225ae2587712b06a354b4ad4625aadc780fa4e80.tar.gz packages_apps_nfc-225ae2587712b06a354b4ad4625aadc780fa4e80.tar.bz2 |
Backup NFC preferences.
Backs up all NFC shared preferences. Note this only works when doing a
full system restore. Doing just a runtime restore won't trigger the NFC
service to restart and reload the setting.
Bug: 3139537
Change-Id: I40d3e5c5cd39482a292e634a941af6093f639ece
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/nfc/NfcBackupAgent.java | 33 | ||||
-rwxr-xr-x | src/com/android/nfc/NfcService.java | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/com/android/nfc/NfcBackupAgent.java b/src/com/android/nfc/NfcBackupAgent.java new file mode 100644 index 0000000..27fdf76 --- /dev/null +++ b/src/com/android/nfc/NfcBackupAgent.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011 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.nfc; + +import android.app.backup.BackupAgentHelper; +import android.app.backup.SharedPreferencesBackupHelper; + +public class NfcBackupAgent extends BackupAgentHelper { + // Backup identifier + static final String SHARED_PREFS_BACKUP_KEY = "shared_prefs"; + + @Override + public void onCreate() { + SharedPreferencesBackupHelper helper = + new SharedPreferencesBackupHelper(this, NfcService.PREF); + addHelper(SHARED_PREFS_BACKUP_KEY, helper); + } +} + diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java index e8fb79d..648455c 100755 --- a/src/com/android/nfc/NfcService.java +++ b/src/com/android/nfc/NfcService.java @@ -152,7 +152,7 @@ public class NfcService extends Application { private static final String NFCEE_ADMIN_PERM = NFC_PERM; private static final String NFCEE_ADMIN_PERM_ERROR = "NFCEE_ADMIN permission required"; - private static final String PREF = "NfcServicePrefs"; + /*package*/ static final String PREF = "NfcServicePrefs"; private static final String PREF_NFC_ON = "nfc_on"; private static final boolean NFC_ON_DEFAULT = true; |