Merge "Using the lock to obtain mRemoteStatusReceiver." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
76b41e009d
@@ -2822,8 +2822,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
}
|
}
|
||||||
case IDataLoaderStatusListener.DATA_LOADER_UNAVAILABLE: {
|
case IDataLoaderStatusListener.DATA_LOADER_UNAVAILABLE: {
|
||||||
// Don't fail or commit the session. Allow caller to commit again.
|
// Don't fail or commit the session. Allow caller to commit again.
|
||||||
sendPendingStreaming(mContext, mRemoteStatusReceiver, sessionId,
|
sendPendingStreaming("DataLoader unavailable");
|
||||||
"DataLoader unavailable");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDataLoaderStatusListener.DATA_LOADER_UNRECOVERABLE:
|
case IDataLoaderStatusListener.DATA_LOADER_UNRECOVERABLE:
|
||||||
@@ -2835,8 +2834,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// In case of streaming failure we don't want to fail or commit the session.
|
// In case of streaming failure we don't want to fail or commit the session.
|
||||||
// Just return from this method and allow caller to commit again.
|
// Just return from this method and allow caller to commit again.
|
||||||
sendPendingStreaming(mContext, mRemoteStatusReceiver, sessionId,
|
sendPendingStreaming(e.getMessage());
|
||||||
e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -3196,8 +3194,17 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendPendingStreaming(Context context, IntentSender target, int sessionId,
|
private void sendPendingStreaming(@Nullable String cause) {
|
||||||
@Nullable String cause) {
|
final IntentSender statusReceiver;
|
||||||
|
synchronized (mLock) {
|
||||||
|
statusReceiver = mRemoteStatusReceiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusReceiver == null) {
|
||||||
|
Slog.e(TAG, "Missing receiver for pending streaming status.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.putExtra(PackageInstaller.EXTRA_SESSION_ID, sessionId);
|
intent.putExtra(PackageInstaller.EXTRA_SESSION_ID, sessionId);
|
||||||
intent.putExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_PENDING_STREAMING);
|
intent.putExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_PENDING_STREAMING);
|
||||||
@@ -3208,7 +3215,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
|
|||||||
intent.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, "Staging Image Not Ready");
|
intent.putExtra(PackageInstaller.EXTRA_STATUS_MESSAGE, "Staging Image Not Ready");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
target.sendIntent(context, 0, intent, null, null);
|
statusReceiver.sendIntent(mContext, 0, intent, null, null);
|
||||||
} catch (IntentSender.SendIntentException ignored) {
|
} catch (IntentSender.SendIntentException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user