Merge "Catch STHAL factory exceptions" into udc-dev

This commit is contained in:
Atneya Nair
2023-05-11 22:04:26 +00:00
committed by Android (Google) Code Review

View File

@@ -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 = new SoundTriggerHalEnforcer( mHalService = null;
new SoundTriggerHalWatchdog( while (mHalService == null) {
new SoundTriggerDuplicateModelHandler(mHalFactory.create()))); try {
mHalService = new SoundTriggerHalEnforcer(
new SoundTriggerHalWatchdog(
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();