Merge "Catch STHAL factory exceptions" into udc-dev am: 4d1298eee8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23088896

Change-Id: I094352766edd22a18d513aecbaf0db4acc75b08a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Atneya Nair
2023-05-11 22:16:56 +00:00
committed by Automerger Merge Worker

View File

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