Loading src/com/android/settings/backup/SettingsBackupHelper.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.backup.BackupDataOutput; import android.app.backup.BackupHelper; import android.os.ParcelFileDescriptor; import com.android.settings.fuelgauge.BatteryBackupHelper; import com.android.settings.shortcut.CreateShortcutPreferenceController; import java.io.FileInputStream; Loading @@ -37,6 +38,7 @@ public class SettingsBackupHelper extends BackupAgentHelper { public void onCreate() { super.onCreate(); addHelper("no-op", new NoOpHelper()); addHelper(BatteryBackupHelper.TAG, new BatteryBackupHelper(this)); } @Override Loading src/com/android/settings/fuelgauge/BatteryBackupHelper.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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.settings.fuelgauge; import android.app.backup.BackupDataInputStream; import android.app.backup.BackupDataOutput; import android.app.backup.BackupHelper; import android.content.Context; import android.os.ParcelFileDescriptor; import android.util.Log; /** An implementation to backup and restore battery configurations. */ public final class BatteryBackupHelper implements BackupHelper { /** An inditifier for {@link BackupHelper}. */ public static final String TAG = "BatteryBackupHelper"; private final Context mContext; public BatteryBackupHelper(Context context) { mContext = context; } @Override public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) { Log.d(TAG, "performBackup()"); } @Override public void restoreEntity(BackupDataInputStream data) { Log.d(TAG, "restoreEntity()"); } @Override public void writeNewStateDescription(ParcelFileDescriptor newState) { } } src/com/android/settings/fuelgauge/BatteryDiffEntry.java +4 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ public class BatteryDiffEntry { // Caches app label and icon to improve loading performance. static final Map<String, BatteryEntry.NameAndIcon> sResourceCache = new HashMap<>(); // Whether a specific item is valid to launch restriction page? static final Map<String, Boolean> sValidForRestriction = new HashMap<>(); @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public static final Map<String, Boolean> sValidForRestriction = new HashMap<>(); /** A comparator for {@link BatteryDiffEntry} based on consumed percentage. */ public static final Comparator<BatteryDiffEntry> COMPARATOR = Loading Loading @@ -339,7 +340,8 @@ public class BatteryDiffEntry { return builder.toString(); } static void clearCache() { /** Clears app icon and label cache data. */ public static void clearCache() { sResourceCache.clear(); sValidForRestriction.clear(); } Loading Loading
src/com/android/settings/backup/SettingsBackupHelper.java +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.backup.BackupDataOutput; import android.app.backup.BackupHelper; import android.os.ParcelFileDescriptor; import com.android.settings.fuelgauge.BatteryBackupHelper; import com.android.settings.shortcut.CreateShortcutPreferenceController; import java.io.FileInputStream; Loading @@ -37,6 +38,7 @@ public class SettingsBackupHelper extends BackupAgentHelper { public void onCreate() { super.onCreate(); addHelper("no-op", new NoOpHelper()); addHelper(BatteryBackupHelper.TAG, new BatteryBackupHelper(this)); } @Override Loading
src/com/android/settings/fuelgauge/BatteryBackupHelper.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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.settings.fuelgauge; import android.app.backup.BackupDataInputStream; import android.app.backup.BackupDataOutput; import android.app.backup.BackupHelper; import android.content.Context; import android.os.ParcelFileDescriptor; import android.util.Log; /** An implementation to backup and restore battery configurations. */ public final class BatteryBackupHelper implements BackupHelper { /** An inditifier for {@link BackupHelper}. */ public static final String TAG = "BatteryBackupHelper"; private final Context mContext; public BatteryBackupHelper(Context context) { mContext = context; } @Override public void performBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) { Log.d(TAG, "performBackup()"); } @Override public void restoreEntity(BackupDataInputStream data) { Log.d(TAG, "restoreEntity()"); } @Override public void writeNewStateDescription(ParcelFileDescriptor newState) { } }
src/com/android/settings/fuelgauge/BatteryDiffEntry.java +4 −2 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ public class BatteryDiffEntry { // Caches app label and icon to improve loading performance. static final Map<String, BatteryEntry.NameAndIcon> sResourceCache = new HashMap<>(); // Whether a specific item is valid to launch restriction page? static final Map<String, Boolean> sValidForRestriction = new HashMap<>(); @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public static final Map<String, Boolean> sValidForRestriction = new HashMap<>(); /** A comparator for {@link BatteryDiffEntry} based on consumed percentage. */ public static final Comparator<BatteryDiffEntry> COMPARATOR = Loading Loading @@ -339,7 +340,8 @@ public class BatteryDiffEntry { return builder.toString(); } static void clearCache() { /** Clears app icon and label cache data. */ public static void clearCache() { sResourceCache.clear(); sValidForRestriction.clear(); } Loading