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

Commit 6b8171f5 authored by Matthew Sedam's avatar Matthew Sedam
Browse files

ContextHubService constructor and init cleanup

Bug: 246384988
Test: m && ./vendor/google/tools/flashall
Test: adb shell dumpsys contexthub # normal
Test: adb shell logcat | grep -iE 'CHRE|contexthub' # normal
Test: atest com.android.server.location.contexthub.ContextHubServiceTest
Change-Id: Id00dbad0d8ef94b682ca935a68d1b5f56a3c0d51
parent 31071af4
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.