Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7765d732 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Jeff Sharkey
Browse files

Only bind to RESOLVE_EPHEMERAL_PACKAGE once.

We never unbind, so we only ever need one bind request; creating more
bind requests just wastes resources.

Test: builds
Bug: 32446301
Change-Id: I7d6c4a93b8f5bb8d9aed7a5041b193e19a2d65fc
parent e9db00e3
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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;
        }

        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) {