Skip to content

Instantly share code, notes, and snippets.

@Svirusx
Created October 28, 2023 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Svirusx/6870c99a6c710371d8b39804ab1a9e39 to your computer and use it in GitHub Desktop.
Save Svirusx/6870c99a6c710371d8b39804ab1a9e39 to your computer and use it in GitHub Desktop.
commit c1cfacd60751faf8ddabd01b9b34b85778dbd559
Author: Svirusx <45526199+Svirusx@users.noreply.github.com>
Date: Sat Oct 28 16:27:39 2023 +0200
BackupFix
diff --git a/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java b/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java
index 7c47f1e4..982066a3 100644
--- a/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java
+++ b/services/backup/java/com/android/server/backup/utils/BackupEligibilityRules.java
@@ -139,9 +139,9 @@ public class BackupEligibilityRules {
public boolean appIsEligibleForBackup(ApplicationInfo app) {
// 1. their manifest states android:allowBackup="false" and this is not a device-to-device
// migration
- if (!isAppBackupAllowed(app)) {
- return false;
- }
+ //if (!isAppBackupAllowed(app)) {
+ // return false;
+ //}
// 2. they run as a system-level uid
if (UserHandle.isCore(app.uid)) {
diff --git a/services/backup/java/com/android/server/backup/utils/TarBackupReader.java b/services/backup/java/com/android/server/backup/utils/TarBackupReader.java
index 71ca8ca2..d17a2d0c 100644
--- a/services/backup/java/com/android/server/backup/utils/TarBackupReader.java
+++ b/services/backup/java/com/android/server/backup/utils/TarBackupReader.java
@@ -420,7 +420,6 @@ public class TarBackupReader {
info.packageName, PackageManager.GET_SIGNING_CERTIFICATES, userId);
// Fall through to IGNORE if the app explicitly disallows backup
final int flags = pkgInfo.applicationInfo.flags;
- if (eligibilityRules.isAppBackupAllowed(pkgInfo.applicationInfo)) {
// Restore system-uid-space packages only if they have
// defined a custom backup agent
if (!UserHandle.isCore(pkgInfo.applicationInfo.uid)
@@ -501,18 +500,6 @@ public class TarBackupReader {
LOG_EVENT_CATEGORY_AGENT,
null);
}
- } else {
- if (DEBUG) {
- Slog.i(TAG,
- "Restore manifest from " + info.packageName + " but allowBackup=false");
- }
- mMonitor = BackupManagerMonitorUtils.monitorEvent(
- mMonitor,
- LOG_EVENT_ID_FULL_RESTORE_ALLOW_BACKUP_FALSE,
- pkgInfo,
- LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY,
- null);
- }
} catch (PackageManager.NameNotFoundException e) {
// Okay, the target app isn't installed. We can process
// the restore properly only if the dataset provides the
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment