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

Commit 646db04e authored by Matthew Sedam's avatar Matthew Sedam Committed by Android (Google) Code Review
Browse files

Merge "ContextHubService constructor and init cleanup"

parents 3e7dbafe 6b8171f5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.Log;

import com.android.internal.util.ConcurrentUtils;
import com.android.server.location.contexthub.ContextHubService;
import com.android.server.location.contexthub.IContextHubWrapper;

import java.util.concurrent.Future;

@@ -35,7 +36,8 @@ class ContextHubSystemService extends SystemService {
    public ContextHubSystemService(Context context) {
        super(context);
        mInit = SystemServerInitThreadPool.submit(() -> {
            mContextHubService = new ContextHubService(context);
            mContextHubService = new ContextHubService(context,
                    IContextHubWrapper.getContextHubWrapper());
        }, "Init ContextHubSystemService");
    }

+242 −175

File changed.

Preview size limit exceeded, changes collapsed.

+18 −0
Original line number Diff line number Diff line
@@ -94,6 +94,24 @@ public abstract class IContextHubWrapper {
                List<String> nanoappPermissions, List<String> messagePermissions);
    }

    /**
     * @return the IContextHubWrapper interface
     */
    public static IContextHubWrapper getContextHubWrapper() {
        IContextHubWrapper wrapper = maybeConnectToAidl();
        if (wrapper == null) {
            wrapper = maybeConnectTo1_2();
        }
        if (wrapper == null) {
            wrapper = maybeConnectTo1_1();
        }
        if (wrapper == null) {
            wrapper = maybeConnectTo1_0();
        }

        return wrapper;
    }

    /**
     * Attempts to connect to the Contexthub HAL 1.0 service, if it exists.
     *
+120 −0

File added.

Preview size limit exceeded, changes collapsed.