Don't crash in various ways when using backup services too early
BackupManager now no longer tries to use a null service binder if it's used
early during the boot process. ActivityManagerService no longer tries to
dereference null pointers if bind/unbind semantics get out of step due to things
being run too early.
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index fd1dfc8..6d04b6b 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -10472,8 +10472,17 @@
// done with this agent
public void unbindBackupAgent(ApplicationInfo appInfo) {
if (DEBUG_BACKUP) Log.v(TAG, "unbindBackupAgent: " + appInfo);
+ if (appInfo == null) {
+ Log.w(TAG, "unbind backup agent for null app");
+ return;
+ }
synchronized(this) {
+ if (mBackupAppName == null) {
+ Log.w(TAG, "Unbinding backup agent with no active backup");
+ return;
+ }
+
if (!mBackupAppName.equals(appInfo.packageName)) {
Log.e(TAG, "Unbind of " + appInfo + " but is not the current backup target");
return;