Commit 06a951db authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

android: Ignore exception from updateServiceGroup

Exception caused by race in activity manager when service process
crashes. So just ignore it in chromium code.

Bug: 1026626
Change-Id: Id1f7642b308044914dfc903d8a65b11f80f722d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333094
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: default avatarssid <ssid@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794305}
parent a9949096
...@@ -10,6 +10,7 @@ import android.content.Intent; ...@@ -10,6 +10,7 @@ import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.TraceEvent; import org.chromium.base.TraceEvent;
...@@ -72,7 +73,17 @@ import java.util.concurrent.Executor; ...@@ -72,7 +73,17 @@ import java.util.concurrent.Executor;
public void updateGroupImportance(int group, int importanceInGroup) { public void updateGroupImportance(int group, int importanceInGroup) {
assert isBound(); assert isBound();
if (BindService.supportVariableConnections()) { if (BindService.supportVariableConnections()) {
ApiHelperForQ.updateServiceGroup(mContext, this, group, importanceInGroup); try {
ApiHelperForQ.updateServiceGroup(mContext, this, group, importanceInGroup);
} catch (IllegalArgumentException e) {
if (!(e.getCause() instanceof RemoteException)) {
throw e;
}
// Ignore RemoteException. There is a race in ActivityManager that the
// binding might be removed for example due to a crash, which causes
// a remote exception thrown from ActiveServices.updateServiceGroupLocked.
// Just ignore that in this case.
}
BindService.doBindService( BindService.doBindService(
mContext, mBindIntent, this, mBindFlags, mHandler, mExecutor, mInstanceName); mContext, mBindIntent, this, mBindFlags, mHandler, mExecutor, mInstanceName);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment