Only bind to RESOLVE_EPHEMERAL_PACKAGE once. am: 7765d7320d am: eeac5a064d

am: f46b2eeab6

Change-Id: If4c4ab8ddd7e15a93de6422d8724077f158b1047
This commit is contained in:
Jeff Sharkey
2016-10-27 20:37:32 +00:00
committed by android-build-merger

View File

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