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

Commit e38d5e03 authored by Matthew Sedam's avatar Matthew Sedam
Browse files

Reduce locking in ContextHubTransactionManager

This CL replaces a global synchronization lock in
ContextHubManager with individual locks to reduce locking
time.

Bug: 362299144
Change-Id: Ib19f7ebe093b2ed0c0065f0e9896df16255fb6e4
Flag: android.chre.flags.reduce_locking_context_hub_transaction_manager
Test: Run the reliable message test
parent 5c7f65fc
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -444,8 +444,17 @@ public class ContextHubService extends IContextHubService.Stub {
        mSupportedContextHubPerms = hubInfo.second;
        mContextHubInfoList = new ArrayList<>(mContextHubIdToInfoMap.values());
        mClientManager = new ContextHubClientManager(mContext, mContextHubWrapper);
        mTransactionManager = new ContextHubTransactionManager(

        if (Flags.reduceLockingContextHubTransactionManager()) {
            mTransactionManager =
                    new ContextHubTransactionManager(
                            mContextHubWrapper, mClientManager, mNanoAppStateManager);
        } else {
            mTransactionManager =
                    new ContextHubTransactionManagerOld(
                            mContextHubWrapper, mClientManager, mNanoAppStateManager);
        }

        mSensorPrivacyManagerInternal =
                LocalServices.getService(SensorPrivacyManagerInternal.class);
        return true;