Merge "Fix the deadlock problem"

This commit is contained in:
Chris Tate
2016-12-02 22:39:57 +00:00
committed by Gerrit Code Review

View File

@@ -2383,16 +2383,15 @@ public class BackupManagerService {
} catch (InterruptedException e) { } catch (InterruptedException e) {
// just bail // just bail
Slog.w(TAG, "Interrupted: " + e); Slog.w(TAG, "Interrupted: " + e);
mActivityManager.clearPendingBackup(); mConnecting = false;
return null; mConnectedAgent = null;
} }
} }
// if we timed out with no connect, abort and move on // if we timed out with no connect, abort and move on
if (mConnecting == true) { if (mConnecting == true) {
Slog.w(TAG, "Timeout waiting for agent " + app); Slog.w(TAG, "Timeout waiting for agent " + app);
mActivityManager.clearPendingBackup(); mConnectedAgent = null;
return null;
} }
if (DEBUG) Slog.i(TAG, "got agent " + mConnectedAgent); if (DEBUG) Slog.i(TAG, "got agent " + mConnectedAgent);
agent = mConnectedAgent; agent = mConnectedAgent;
@@ -2401,6 +2400,13 @@ public class BackupManagerService {
// can't happen - ActivityManager is local // can't happen - ActivityManager is local
} }
} }
if (agent == null) {
try {
mActivityManager.clearPendingBackup();
} catch (RemoteException e) {
// can't happen - ActivityManager is local
}
}
return agent; return agent;
} }