Merge "Check success before registering DeathRecipient" am: b6c4bc311a am: c336947da4
am: 8e055b131a
Change-Id: Ic98d58505c311250fad7220bec88fcd89846b14e
This commit is contained in:
@@ -118,14 +118,8 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int uid = Binder.getCallingUid();
|
final int uid = Binder.getCallingUid();
|
||||||
callback.asBinder().linkToDeath(new DeathRecipient() {
|
|
||||||
@Override
|
|
||||||
public void binderDied() {
|
|
||||||
onAppCallbackDied(uid, subscriptionId);
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
return initialize(subscriptionId, new MbmsDownloadSessionCallback() {
|
int result = initialize(subscriptionId, new MbmsDownloadSessionCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onError(int errorCode, String message) {
|
public void onError(int errorCode, String message) {
|
||||||
try {
|
try {
|
||||||
@@ -153,6 +147,17 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (result == MbmsErrors.SUCCESS) {
|
||||||
|
callback.asBinder().linkToDeath(new DeathRecipient() {
|
||||||
|
@Override
|
||||||
|
public void binderDied() {
|
||||||
|
onAppCallbackDied(uid, subscriptionId);
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,17 +256,6 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
|
|||||||
throw new NullPointerException("Callback must not be null");
|
throw new NullPointerException("Callback must not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
DeathRecipient deathRecipient = new DeathRecipient() {
|
|
||||||
@Override
|
|
||||||
public void binderDied() {
|
|
||||||
onAppCallbackDied(uid, downloadRequest.getSubscriptionId());
|
|
||||||
mDownloadCallbackBinderMap.remove(callback.asBinder());
|
|
||||||
mDownloadCallbackDeathRecipients.remove(callback.asBinder());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
mDownloadCallbackDeathRecipients.put(callback.asBinder(), deathRecipient);
|
|
||||||
callback.asBinder().linkToDeath(deathRecipient, 0);
|
|
||||||
|
|
||||||
DownloadStateCallback exposedCallback = new FilteredDownloadStateCallback(callback, flags) {
|
DownloadStateCallback exposedCallback = new FilteredDownloadStateCallback(callback, flags) {
|
||||||
@Override
|
@Override
|
||||||
protected void onRemoteException(RemoteException e) {
|
protected void onRemoteException(RemoteException e) {
|
||||||
@@ -269,9 +263,23 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mDownloadCallbackBinderMap.put(callback.asBinder(), exposedCallback);
|
int result = registerStateCallback(downloadRequest, exposedCallback);
|
||||||
|
|
||||||
return registerStateCallback(downloadRequest, exposedCallback);
|
if (result == MbmsErrors.SUCCESS) {
|
||||||
|
DeathRecipient deathRecipient = new DeathRecipient() {
|
||||||
|
@Override
|
||||||
|
public void binderDied() {
|
||||||
|
onAppCallbackDied(uid, downloadRequest.getSubscriptionId());
|
||||||
|
mDownloadCallbackBinderMap.remove(callback.asBinder());
|
||||||
|
mDownloadCallbackDeathRecipients.remove(callback.asBinder());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mDownloadCallbackDeathRecipients.put(callback.asBinder(), deathRecipient);
|
||||||
|
callback.asBinder().linkToDeath(deathRecipient, 0);
|
||||||
|
mDownloadCallbackBinderMap.put(callback.asBinder(), exposedCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -70,14 +70,8 @@ public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int uid = Binder.getCallingUid();
|
final int uid = Binder.getCallingUid();
|
||||||
callback.asBinder().linkToDeath(new DeathRecipient() {
|
|
||||||
@Override
|
|
||||||
public void binderDied() {
|
|
||||||
onAppCallbackDied(uid, subscriptionId);
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
return initialize(new MbmsStreamingSessionCallback() {
|
int result = initialize(new MbmsStreamingSessionCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onError(final int errorCode, final String message) {
|
public void onError(final int errorCode, final String message) {
|
||||||
try {
|
try {
|
||||||
@@ -105,6 +99,17 @@ public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, subscriptionId);
|
}, subscriptionId);
|
||||||
|
|
||||||
|
if (result == MbmsErrors.SUCCESS) {
|
||||||
|
callback.asBinder().linkToDeath(new DeathRecipient() {
|
||||||
|
@Override
|
||||||
|
public void binderDied() {
|
||||||
|
onAppCallbackDied(uid, subscriptionId);
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -161,14 +166,8 @@ public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int uid = Binder.getCallingUid();
|
final int uid = Binder.getCallingUid();
|
||||||
callback.asBinder().linkToDeath(new DeathRecipient() {
|
|
||||||
@Override
|
|
||||||
public void binderDied() {
|
|
||||||
onAppCallbackDied(uid, subscriptionId);
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
return startStreaming(subscriptionId, serviceId, new StreamingServiceCallback() {
|
int result = startStreaming(subscriptionId, serviceId, new StreamingServiceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onError(final int errorCode, final String message) {
|
public void onError(final int errorCode, final String message) {
|
||||||
try {
|
try {
|
||||||
@@ -215,6 +214,17 @@ public class MbmsStreamingServiceBase extends IMbmsStreamingService.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (result == MbmsErrors.SUCCESS) {
|
||||||
|
callback.asBinder().linkToDeath(new DeathRecipient() {
|
||||||
|
@Override
|
||||||
|
public void binderDied() {
|
||||||
|
onAppCallbackDied(uid, subscriptionId);
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user