Sends the empty navigation state on the app context ownership change.

- This task is needed to clear out the last navigation direction.

Bug: 173454430
Test: check ClusterOsDouble clears the navigation state when the \
    navigation is finished.
Change-Id: I07feff1867560d4e9ca68afcf8406773c7799914
diff --git a/service/Android.bp b/service/Android.bp
index 700d4e3..1bc18eb 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -34,6 +34,7 @@
 ]
 
 common_lib_deps = [
+    "android.car.cluster.navigation",
     "android.car.userlib",
     "android.car.watchdoglib",
     "android.frameworks.automotive.powerpolicy.internal-java",
diff --git a/service/src/com/android/car/cluster/ClusterHomeService.java b/service/src/com/android/car/cluster/ClusterHomeService.java
index 1cdc406..dbe0bb9 100644
--- a/service/src/com/android/car/cluster/ClusterHomeService.java
+++ b/service/src/com/android/car/cluster/ClusterHomeService.java
@@ -30,6 +30,7 @@
 import android.car.cluster.ClusterState;
 import android.car.cluster.IClusterHomeCallback;
 import android.car.cluster.IClusterHomeService;
+import android.car.cluster.navigation.NavigationState.NavigationStateProto;
 import android.car.navigation.CarNavigationInstrumentCluster;
 import android.content.ComponentName;
 import android.content.Context;
@@ -234,6 +235,10 @@
     public void onNavigationStateChanged(Bundle bundle) {
         byte[] protoBytes = bundle.getByteArray(NAV_STATE_PROTO_BUNDLE_KEY);
 
+        sendNavigationState(protoBytes);
+    }
+
+    private void sendNavigationState(byte[] protoBytes) {
         final int n = mClientCallbacks.beginBroadcast();
         for (int i = 0; i < n; i++) {
             IClusterHomeCallback callback = mClientCallbacks.getBroadcastItem(i);
@@ -259,7 +264,12 @@
 
     @Override
     public void notifyNavContextOwnerChanged(ClusterNavigationService.ContextOwner owner) {
-        // TODO: Implement this
+        Slogf.d(TAG, "notifyNavContextOwnerChanged: owner=%s", owner);
+        // Sends the empty NavigationStateProto to clear out the last direction
+        // when the app context owner is changed or the navigation is finished.
+        NavigationStateProto emptyProto = NavigationStateProto.newBuilder()
+                .setServiceStatus(NavigationStateProto.ServiceStatus.NORMAL).build();
+        sendNavigationState(emptyProto.toByteArray());
     }
     // ClusterNavigationServiceCallback ends