Merge "Only bind to RESOLVE_EPHEMERAL_PACKAGE once." into nyc-mr1-dev

This commit is contained in:
Jeff Sharkey
2016-10-27 20:18:08 +00:00
committed by Android (Google) Code Review

View File

@@ -56,6 +56,7 @@ final class EphemeralResolverConnection {
/** Intent used to bind to the service */
private final Intent mIntent;
private volatile boolean mBindRequested;
private IEphemeralResolver mRemoteInstance;
public EphemeralResolverConnection(Context context, ComponentName componentName) {
@@ -111,8 +112,11 @@ final class EphemeralResolverConnection {
return;
}
mContext.bindServiceAsUser(mIntent, mServiceConnection,
Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, UserHandle.SYSTEM);
if (!mBindRequested) {
mBindRequested = true;
mContext.bindServiceAsUser(mIntent, mServiceConnection,
Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, UserHandle.SYSTEM);
}
final long startMillis = SystemClock.uptimeMillis();
while (true) {