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

Commit 903308d6 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

AudioService: initialize sensors if head tracking supported

Query ISpatializer to check if head tracking is supported to
determine whether to initialize sensors

Bug: 202515176
Test: after boot on device with head tracking, grep logcat for
SpatializerHelper, verify no "not initializing sensors" message
Change-Id: I02de212452c7beaa8c06776c34eb6005da0e9073

Change-Id: I5050a4507c9c84a9fa166943f28b3cd92b789419
parent ecdb3cdb
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -825,9 +825,18 @@ public class SpatializerHelper {
    }

    synchronized void onInitSensors(boolean init) {
        final int[] modes = getSupportedHeadTrackingModes();
        if (modes.length == 0) {
            Log.i(TAG, "not initializing sensors, no headtracking supported");
        final String action = init ? "initializing" : "releasing";
        if (mSpat == null) {
            Log.e(TAG, "not " + action + " sensors, null spatializer");
            return;
        }
        try {
            if (!mSpat.isHeadTrackingSupported()) {
                Log.e(TAG, "not " + action + " sensors, spatializer doesn't support headtracking");
                return;
            }
        } catch (RemoteException e) {
            Log.e(TAG, "not " + action + " sensors, error querying headtracking", e);
            return;
        }
        initSensors(init);