Merge "Handle onBindingDied in AbstractRemoteService" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
08ccf9bba4
@@ -344,13 +344,21 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
|
||||
* {@link #getTimeoutIdleBindMillis() idle timeout} expires.
|
||||
*/
|
||||
protected void scheduleUnbind() {
|
||||
final long unbindDelay = getTimeoutIdleBindMillis();
|
||||
scheduleUnbind(true);
|
||||
}
|
||||
|
||||
if (unbindDelay <= 0) {
|
||||
private void scheduleUnbind(boolean delay) {
|
||||
long unbindDelay = getTimeoutIdleBindMillis();
|
||||
|
||||
if (unbindDelay <= PERMANENT_BOUND_TIMEOUT_MS) {
|
||||
if (mVerbose) Slog.v(mTag, "not scheduling unbind when value is " + unbindDelay);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!delay) {
|
||||
unbindDelay = 0;
|
||||
}
|
||||
|
||||
cancelScheduledUnbind();
|
||||
// TODO(b/117779333): make sure it's unbound if the service settings changing (right now
|
||||
// it's not)
|
||||
@@ -462,9 +470,16 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
if (mVerbose) Slog.v(mTag, "onServiceDisconnected()");
|
||||
mBinding = true;
|
||||
mService = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindingDied(ComponentName name) {
|
||||
if (mVerbose) Slog.v(mTag, "onBindingDied()");
|
||||
scheduleUnbind(false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkIfDestroyed() {
|
||||
|
||||
Reference in New Issue
Block a user