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

Commit 2292d9d2 authored by Chen Chen's avatar Chen Chen Committed by Gerrit Code Review
Browse files

Merge "HeadsetPhoneState: Synchronize constructor with phone state listening functions."

parents 009099dc 0cb6ebe9
Loading
Loading
Loading
Loading
+19 −17
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public class HeadsetPhoneState {
    private final Object mPhoneStateListenerLock = new Object();

    HeadsetPhoneState(HeadsetService headsetService) {
        synchronized (mPhoneStateListenerLock) {
            Objects.requireNonNull(headsetService, "headsetService is null");
            mHeadsetService = headsetService;
            mTelephonyManager = mHeadsetService.getSystemService(TelephonyManager.class);
@@ -87,13 +88,14 @@ public class HeadsetPhoneState {
            // Initialize subscription on the handler thread
            mHandler = new Handler(headsetService.getStateMachinesThreadLooper());
            mOnSubscriptionsChangedListener = new HeadsetPhoneStateOnSubscriptionChangedListener();
        mSubscriptionManager.addOnSubscriptionsChangedListener(command -> mHandler.post(command),
                mOnSubscriptionsChangedListener);
            mSubscriptionManager.addOnSubscriptionsChangedListener(
                    command -> mHandler.post(command), mOnSubscriptionsChangedListener);
            mSignalStrengthUpdateRequest = new SignalStrengthUpdateRequest.Builder()
                    .setSignalThresholdInfos(Collections.EMPTY_LIST)
                    .setSystemThresholdReportingRequestedWhileIdle(true)
                    .build();
        }
    }

    /**
     * Cleanup this instance. Instance can no longer be used after calling this method.