Present user-facing UI when VHAL fragment cannot be used

With SELinux enforcement turned on, the Vehicle HAL fragment does not
have permission to connect to the HAL instance.

This could be fixed but it would require a decent amount of effort,
and in general the VHAL tool should only be really useful during early
bringup, when SELinux is likely to be turned off anyway. In all other
scenarios, the car property test UI should be preferred.

Bug: 150336686
Test: setenforce 1 and load VHAL fragment
Change-Id: I4070cf786d27bde0896a6e5576f0bd3aab5a728a
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/vhal/VehicleHalFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/vhal/VehicleHalFragment.java
index f8de9f5..f9e1b04 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/vhal/VehicleHalFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/vhal/VehicleHalFragment.java
@@ -41,7 +41,6 @@
 import com.google.android.car.kitchensink.R;
 
 import java.util.List;
-import java.util.NoSuchElementException;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
@@ -70,8 +69,14 @@
         final IVehicle vehicle;
         try {
             vehicle = Objects.requireNonNull(IVehicle.getService());
-        } catch (NullPointerException | RemoteException | NoSuchElementException e) {
+        } catch (RemoteException | RuntimeException e) {
             Log.e(TAG, "unable to retrieve Vehicle HAL service", e);
+            AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+            builder.setTitle("Vehicle HAL not available")
+                   .setPositiveButton(android.R.string.ok, (x, y) -> { })
+                   .setMessage("In some cases (e.g. SELinux enforcing mode), this UI "
+                            + "is not available for use. Please use the car property UI")
+                   .show();
             return;
         }