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

Commit 4d1298ee authored by Atneya Nair's avatar Atneya Nair Committed by Android (Google) Code Review
Browse files

Merge "Catch STHAL factory exceptions" into udc-dev

parents 8020b8b6 c3de5db6
Loading
Loading
Loading
Loading
+12 −3
Original line number Original line Diff line number Diff line
@@ -168,9 +168,18 @@ class SoundTriggerModule implements IBinder.DeathRecipient, ISoundTriggerHal.Glo
     * Attached to the HAL service via factory.
     * Attached to the HAL service via factory.
     */
     */
    private void attachToHal() {
    private void attachToHal() {
        mHalService = null;
        while (mHalService == null) {
            try {
                mHalService = new SoundTriggerHalEnforcer(
                mHalService = new SoundTriggerHalEnforcer(
                        new SoundTriggerHalWatchdog(
                        new SoundTriggerHalWatchdog(
                            new SoundTriggerDuplicateModelHandler(mHalFactory.create())));
                            new SoundTriggerDuplicateModelHandler(mHalFactory.create())));
            } catch (RuntimeException e) {
                if (!(e.getCause() instanceof RemoteException)) {
                    throw e;
                }
            }
        }
        mHalService.linkToDeath(this);
        mHalService.linkToDeath(this);
        mHalService.registerCallback(this);
        mHalService.registerCallback(this);
        mProperties = mHalService.getProperties();
        mProperties = mHalService.getProperties();