Un-hide some of the APIs in relation to nav state API.

Also removed some now-redundant methods. Since these methods were
previously @hide, there should be no harm in removing them as we
un-@hide onEvent.

Test: make update-car-api
Change-Id: I28d4621b3bcae01489dceea487d15878bbbeaa6b
diff --git a/car-lib/src/android/car/cluster/renderer/IInstrumentClusterNavigation.aidl b/car-lib/src/android/car/cluster/renderer/IInstrumentClusterNavigation.aidl
index b1fb7b1..6f33a9d 100644
--- a/car-lib/src/android/car/cluster/renderer/IInstrumentClusterNavigation.aidl
+++ b/car-lib/src/android/car/cluster/renderer/IInstrumentClusterNavigation.aidl
@@ -25,13 +25,6 @@
  * @hide
  */
 interface IInstrumentClusterNavigation {
-    void onStartNavigation();
-    void onStopNavigation();
-    void onNextManeuverChanged(
-        int event, CharSequence eventName, int turnAngle, int turnNumber, in Bitmap image,
-        int turnSide);
-    void onNextManeuverDistanceChanged(int distanceMeters, int timeSeconds,
-        int displayDistanceMillis, int displayDistanceUnit);
     void onEvent(int eventType, in Bundle bundle);
     CarNavigationInstrumentCluster getInstrumentClusterInfo();
 }
diff --git a/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java b/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
index e34f2fa..304f732 100644
--- a/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
+++ b/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
@@ -239,34 +239,6 @@
         }
 
         @Override
-        public void onStartNavigation() throws RemoteException {
-            assertContextOwnership();
-            mNavigationRenderer.onStartNavigation();
-        }
-
-        @Override
-        public void onStopNavigation() throws RemoteException {
-            assertContextOwnership();
-            mNavigationRenderer.onStopNavigation();
-        }
-
-        @Override
-        public void onNextManeuverChanged(int event, CharSequence eventName, int turnAngle,
-                int turnNumber, Bitmap image, int turnSide) throws RemoteException {
-            assertContextOwnership();
-            mNavigationRenderer.onNextTurnChanged(event, eventName, turnAngle, turnNumber,
-                    image, turnSide);
-        }
-
-        @Override
-        public void onNextManeuverDistanceChanged(int distanceMeters, int timeSeconds,
-                int displayDistanceMillis, int displayDistanceUnit) throws RemoteException {
-            assertContextOwnership();
-            mNavigationRenderer.onNextTurnDistanceChanged(distanceMeters, timeSeconds,
-                    displayDistanceMillis, displayDistanceUnit);
-        }
-
-        @Override
         public void onEvent(int eventType, Bundle bundle) throws RemoteException {
             assertContextOwnership();
             mNavigationRenderer.onEvent(eventType, bundle);
diff --git a/car-lib/src/android/car/cluster/renderer/NavigationRenderer.java b/car-lib/src/android/car/cluster/renderer/NavigationRenderer.java
index 0958548..4681a8b 100644
--- a/car-lib/src/android/car/cluster/renderer/NavigationRenderer.java
+++ b/car-lib/src/android/car/cluster/renderer/NavigationRenderer.java
@@ -24,7 +24,6 @@
 /**
  * Contains methods specified for Navigation App renderer in instrument cluster.
  *
- * TODO: Consider to add methods to report time / distance to final destination. bug:32060070
  * @hide
  */
 @SystemApi
@@ -35,13 +34,8 @@
      */
     abstract public CarNavigationInstrumentCluster getNavigationProperties();
 
-    abstract public void onStartNavigation();
-    abstract public void onStopNavigation();
-    abstract public void onNextTurnChanged(int event, CharSequence eventName, int turnAngle,
-            int turnNumber, Bitmap image, int turnSide);
-    abstract public void onNextTurnDistanceChanged(int distanceMeters, int timeSeconds,
-            int displayDistanceMillis, int displayDistanceUnit);
-
-    /** @hide */
-    public void onEvent(int eventType, Bundle bundle) {}
+    /**
+     * Called when an event is fired to change the navigation state.
+     */
+    abstract public void onEvent(int eventType, Bundle bundle);
 }
diff --git a/car-lib/src/android/car/cluster/renderer/ThreadSafeNavigationRenderer.java b/car-lib/src/android/car/cluster/renderer/ThreadSafeNavigationRenderer.java
index 047ed90..251b670 100644
--- a/car-lib/src/android/car/cluster/renderer/ThreadSafeNavigationRenderer.java
+++ b/car-lib/src/android/car/cluster/renderer/ThreadSafeNavigationRenderer.java
@@ -30,16 +30,13 @@
  * A wrapper over {@link NavigationRenderer} that runs all its methods in the context of provided
  * looper. It is guaranteed that all calls will be invoked in order they were called.
  */
+// TODO(deanh): Does this class even need to exist?
 /* package */ class ThreadSafeNavigationRenderer extends NavigationRenderer {
 
     private final Handler mHandler;
     private final NavigationRenderer mRenderer;
 
-    private final static int MSG_NAV_START = 1;
-    private final static int MSG_NAV_STOP = 2;
-    private final static int MSG_NAV_NEXT_TURN = 3;
-    private final static int MSG_NAV_NEXT_TURN_DISTANCE = 4;
-    private final static int MSG_EVENT = 5;
+    private final static int MSG_EVENT = 1;
 
     /** Creates thread-safe {@link NavigationRenderer}. Returns null if renderer == null */
     @Nullable
@@ -68,31 +65,6 @@
     }
 
     @Override
-    public void onStartNavigation() {
-        mHandler.sendMessage(mHandler.obtainMessage(MSG_NAV_START));
-    }
-
-    @Override
-    public void onStopNavigation() {
-        mHandler.sendMessage(mHandler.obtainMessage(MSG_NAV_STOP));
-    }
-
-    @Override
-    public void onNextTurnChanged(int event, CharSequence eventName, int turnAngle, int turnNumber,
-            Bitmap image, int turnSide) {
-        mHandler.sendMessage(mHandler.obtainMessage(MSG_NAV_NEXT_TURN,
-                new NextTurn(event, eventName, turnAngle, turnNumber, image, turnSide)));
-    }
-
-    @Override
-    public void onNextTurnDistanceChanged(int distanceMeters, int timeSeconds,
-            int displayDistanceMillis, int displayDistanceUnit) {
-        ManeuverDistance distance = new ManeuverDistance(distanceMeters, timeSeconds,
-                displayDistanceMillis, displayDistanceUnit);
-        mHandler.sendMessage(mHandler.obtainMessage(MSG_NAV_NEXT_TURN_DISTANCE, distance));
-    }
-
-    @Override
     public void onEvent(int eventType, Bundle bundle) {
         mHandler.sendMessage(mHandler.obtainMessage(MSG_EVENT, eventType, 0, bundle));
     }
@@ -106,22 +78,6 @@
         @Override
         public void handleMessage(Message msg, NavigationRenderer renderer) {
             switch (msg.what) {
-                case MSG_NAV_START:
-                    renderer.onStartNavigation();
-                    break;
-                case MSG_NAV_STOP:
-                    renderer.onStopNavigation();
-                    break;
-                case MSG_NAV_NEXT_TURN:
-                    NextTurn nt = (NextTurn) msg.obj;
-                    renderer.onNextTurnChanged(nt.event, nt.eventName, nt.turnAngle, nt.turnNumber,
-                            nt.bitmap, nt.turnSide);
-                    break;
-                case MSG_NAV_NEXT_TURN_DISTANCE:
-                    ManeuverDistance d = (ManeuverDistance) msg.obj;
-                    renderer.onNextTurnDistanceChanged(
-                            d.meters, d.seconds, d.displayDistanceMillis, d.displayDistanceUnit);
-                    break;
                 case MSG_EVENT:
                     Bundle bundle = (Bundle) msg.obj;
                     renderer.onEvent(msg.arg1, bundle);
@@ -153,25 +109,6 @@
         return runnable.getResult();
     }
 
-    private static class NextTurn {
-        private final int event;
-        private final CharSequence eventName;
-        private final int turnAngle;
-        private final int turnNumber;
-        private final Bitmap bitmap;
-        private final int turnSide;
-
-        NextTurn(int event, CharSequence eventName, int turnAngle, int turnNumber, Bitmap bitmap,
-                int turnSide) {
-            this.event = event;
-            this.eventName = eventName;
-            this.turnAngle = turnAngle;
-            this.turnNumber = turnNumber;
-            this.bitmap = bitmap;
-            this.turnSide = turnSide;
-        }
-    }
-
     private static abstract class RunnableWithResult<T> implements Runnable {
         private volatile T result;
 
@@ -206,19 +143,4 @@
 
         public abstract void handleMessage(Message msg, T renderer);
     }
-
-    private static class ManeuverDistance {
-        final int meters;
-        final int seconds;
-        final int displayDistanceMillis;
-        final int displayDistanceUnit;
-
-        ManeuverDistance(int meters, int seconds, int displayDistanceMillis,
-                int displayDistanceUnit) {
-            this.meters = meters;
-            this.seconds = seconds;
-            this.displayDistanceMillis = displayDistanceMillis;
-            this.displayDistanceUnit = displayDistanceUnit;
-        }
-    }
 }
diff --git a/car-lib/src/android/car/navigation/CarNavigationStatusManager.java b/car-lib/src/android/car/navigation/CarNavigationStatusManager.java
index e15a17d..c21afb1 100644
--- a/car-lib/src/android/car/navigation/CarNavigationStatusManager.java
+++ b/car-lib/src/android/car/navigation/CarNavigationStatusManager.java
@@ -31,153 +31,12 @@
 
 /**
  * API for providing navigation status for instrument cluster.
- * @hide
  */
 public final class CarNavigationStatusManager implements CarManagerBase {
-
-    /** Navigation status */
-    public static final int STATUS_UNAVAILABLE = 0;
-    public static final int STATUS_ACTIVE = 1;
-    public static final int STATUS_INACTIVE = 2;
-
-    /** @hide */
-    @IntDef({
-        STATUS_UNAVAILABLE,
-        STATUS_ACTIVE,
-        STATUS_INACTIVE
-    })
-    @Retention(RetentionPolicy.SOURCE)
-    public @interface Status {}
-
-    /* Turn Types */
-    /** Turn is of an unknown type.*/
-    public static final int TURN_UNKNOWN = 0;
-    /** Starting point of the navigation. */
-    public static final int TURN_DEPART = 1;
-    /** No turn, but the street name changes. */
-    public static final int TURN_NAME_CHANGE = 2;
-    /** Slight turn. */
-    public static final int TURN_SLIGHT_TURN = 3;
-    /** Regular turn. */
-    public static final int TURN_TURN = 4;
-    /** Sharp turn. */
-    public static final int TURN_SHARP_TURN = 5;
-    /** U-turn. */
-    public static final int TURN_U_TURN = 6;
-    /** On ramp. */
-    public static final int TURN_ON_RAMP = 7;
-    /** Off ramp. */
-    public static final int TURN_OFF_RAMP = 8;
-    /** Road forks (diverges). */
-    public static final int TURN_FORK = 9;
-    /** Road merges. */
-    public static final int TURN_MERGE = 10;
-    /** Roundabout entrance on which the route ends. Instruction says "Enter roundabout". */
-    public static final int TURN_ROUNDABOUT_ENTER = 11;
-    /** Roundabout exit. */
-    public static final int TURN_ROUNDABOUT_EXIT = 12;
-    /**
-     * Roundabout entrance and exit. For example, "At the roundabout, take Nth exit." Be sure to
-     * specify the "turnNumber" parameter when using this type.
-     */
-    public static final int TURN_ROUNDABOUT_ENTER_AND_EXIT = 13;
-    /** Potentially confusing intersection where the user should steer straight. */
-    public static final int TURN_STRAIGHT = 14;
-    /** You're on a boat! */
-    public static final int TURN_FERRY_BOAT = 16;
-    /** Train ferries for vehicles. */
-    public static final int TURN_FERRY_TRAIN = 17;
-    /** You have arrived. */
-    public static final int TURN_DESTINATION = 19;
-
-    /** @hide */
-    @IntDef({
-        TURN_UNKNOWN,
-        TURN_DEPART,
-        TURN_NAME_CHANGE,
-        TURN_SLIGHT_TURN,
-        TURN_TURN,
-        TURN_SHARP_TURN,
-        TURN_U_TURN,
-        TURN_ON_RAMP,
-        TURN_OFF_RAMP,
-        TURN_FORK,
-        TURN_MERGE,
-        TURN_ROUNDABOUT_ENTER,
-        TURN_ROUNDABOUT_EXIT,
-        TURN_ROUNDABOUT_ENTER_AND_EXIT,
-        TURN_STRAIGHT,
-        TURN_FERRY_BOAT,
-        TURN_FERRY_TRAIN,
-        TURN_DESTINATION
-    })
-    @Retention(RetentionPolicy.SOURCE)
-    public @interface TurnEvent {}
-
-    /**
-     * Event type that holds information about next maneuver.
-     * @hide
-     */
-    public static final int EVENT_TYPE_NEXT_MANEUVER_INFO = 1;
-    /**
-     * Event type that holds information regarding distance/time to the next maneuver.
-     * @hide
-     */
-    public static final int EVENT_TYPE_NEXT_MANEUVER_COUNTDOWN = 2;
-    /**
-     * All custom (vendor-specific) event types should be equal or greater than this constant.
-     * @hide
-     */
-    public static final int EVENT_TYPE_VENDOR_FIRST = 1024;
-
-    /* Turn Side */
-    /** Turn is on the left side of the vehicle. */
-    public static final int TURN_SIDE_LEFT = 1;
-    /** Turn is on the right side of the vehicle. */
-    public static final int TURN_SIDE_RIGHT = 2;
-    /** Turn side is unspecified. */
-    public static final int TURN_SIDE_UNSPECIFIED = 3;
-
-    /** @hide */
-    @IntDef({
-        TURN_SIDE_LEFT,
-        TURN_SIDE_RIGHT,
-        TURN_SIDE_UNSPECIFIED
-    })
-    public @interface TurnSide {}
-
-    private static final int START = 1;
-    private static final int STOP = 2;
-
-    /**
-     * Distance units for use in {@link #sendNavigationTurnDistanceEvent(int, int, int, int)}.
-     */
-    /** Distance is specified in meters. */
-    public static final int DISTANCE_METERS = 1;
-    /** Distance is specified in kilometers. */
-    public static final int DISTANCE_KILOMETERS = 2;
-    /** Distance is specified in miles. */
-    public static final int DISTANCE_MILES = 3;
-    /** Distance is specified in feet. */
-    public static final int DISTANCE_FEET = 4;
-    /** Distance is specified in yards. */
-    public static final int DISTANCE_YARDS = 5;
-
-    /** @hide */
-    @IntDef({
-        DISTANCE_METERS,
-        DISTANCE_KILOMETERS,
-        DISTANCE_MILES,
-        DISTANCE_FEET,
-        DISTANCE_YARDS
-    })
-    public @interface DistanceUnit {}
-
     private static final String TAG = CarLibLog.TAG_NAV;
 
     private final IInstrumentClusterNavigation mService;
 
-
     /**
      * Only for CarServiceLoader
      * @hide
@@ -187,101 +46,14 @@
     }
 
     /**
-     * @param status new instrument cluster navigation status.
-     * @throws CarNotConnectedException if the connection to the car service has been lost.
-     */
-    public void sendNavigationStatus(@Status int status) throws CarNotConnectedException {
-        try {
-            if (status == STATUS_ACTIVE) {
-                mService.onStartNavigation();
-            } else {
-                mService.onStopNavigation();
-            }
-        } catch (IllegalStateException e) {
-            CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
-        } catch (RemoteException e) {
-            handleCarServiceRemoteExceptionAndThrow(e);
-        }
-    }
-
-    /**
-     * Sends a Navigation Next Step event to the car.
-     * <p>
-     * Note: For an example of a roundabout: if a roundabout has 4 exits, spaced evenly, then the
-     * first exit will have turnNumber=1, turnAngle=90; the second will have turnNumber=2,
-     * turnAngle=180; the third will have turnNumber=3, turnAngle=270.  turnNumber and turnAngle are
-     * counted in the direction of travel around the roundabout (clockwise for roads where the car
-     * drives on the left-hand side of the road, such as Australia; anti-clockwise for roads where
-     * the car drives on the right, such as the USA).
-     *
-     * @param turnEvent turn event like ({@link #TURN_TURN}, {@link #TURN_U_TURN},
-     *        {@link #TURN_ROUNDABOUT_ENTER_AND_EXIT}, etc).
-     * @param eventName Name of the turn event like road name to turn. For example "Charleston road"
-     *        in "Turn right to Charleston road"
-     * @param turnAngle turn angle in degrees between the roundabout entry and exit (0..359).  Only
-     *        used for event type {@link #TURN_ROUNDABOUT_ENTER_AND_EXIT}.  -1 if unused.
-     * @param turnNumber turn number, counting around from the roundabout entry to the exit.  Only
-     *        used for event type {@link #TURN_ROUNDABOUT_ENTER_AND_EXIT}.  -1 if unused.
-     * @param image image to be shown in the instrument cluster.  Null if instrument
-     *        cluster type doesn't support images.
-     * @param turnSide turn side ({@link #TURN_SIDE_LEFT}, {@link #TURN_SIDE_RIGHT} or
-     *        {@link #TURN_SIDE_UNSPECIFIED}).
-     * @throws CarNotConnectedException if the connection to the car service has been lost.
-     *
-     * @deprecated Use {@link #sendEvent(int, Bundle)} instead.
-     */
-    public void sendNavigationTurnEvent(@TurnEvent int turnEvent, CharSequence eventName,
-            int turnAngle, int turnNumber, Bitmap image, @TurnSide int turnSide)
-                    throws CarNotConnectedException {
-        try {
-            mService.onNextManeuverChanged(turnEvent, eventName, turnAngle, turnNumber, image,
-                    turnSide);
-        } catch (IllegalStateException e) {
-            CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
-        } catch (RemoteException e) {
-            handleCarServiceRemoteExceptionAndThrow(e);
-        }
-    }
-
-    /**
-     * Sends a Navigation Next Step Distance event to the car.
-     *
-     * @param distanceMeters Distance to next event in meters.
-     * @param timeSeconds Time to next event in seconds.
-     * @param displayDistanceMillis Distance to the next event. This is exactly the same distance
-     * that navigation app is displaying. Use it when you want to display distance, it has
-     * appropriate rounding function and units are in sync with navigation app. This parameter is
-     * in {@code displayDistanceUnit * 1000}.
-     * @param displayDistanceUnit units for {@param displayDistanceMillis} param.
-     * See {@link DistanceUnit} for acceptable values.
-     * @throws CarNotConnectedException if the connection to the car service has been lost.
-     *
-     * @deprecated Use {@link #sendEvent(int, Bundle)} instead.
-     */
-    public void sendNavigationTurnDistanceEvent(int distanceMeters, int timeSeconds,
-            int displayDistanceMillis, @DistanceUnit int displayDistanceUnit)
-            throws CarNotConnectedException {
-        try {
-            mService.onNextManeuverDistanceChanged(distanceMeters, timeSeconds,
-                    displayDistanceMillis, displayDistanceUnit);
-        } catch (IllegalStateException e) {
-            CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
-        } catch (RemoteException e) {
-            handleCarServiceRemoteExceptionAndThrow(e);
-        }
-    }
-
-    /**
      * Sends events from navigation app to instrument cluster.
      *
+     * <p>The event type and bundle can be populated by
+     * {@link android.support.car.navigation.CarNavigationStatusEvent}.
+     *
      * @param eventType event type
      * @param bundle object that holds data about the event
      * @throws CarNotConnectedException if the connection to the car service has been lost.
-     *
-     * @see #EVENT_TYPE_NEXT_MANEUVER_INFO
-     * @see #EVENT_TYPE_NEXT_MANEUVER_COUNTDOWN
-     *
-     * @hide
      */
     public void sendEvent(int eventType, Bundle bundle) throws CarNotConnectedException {
         try {
@@ -293,10 +65,9 @@
         }
     }
 
+    /** @hide */
     @Override
-    public void onCarDisconnected() {
-        Log.d(TAG, "onCarDisconnected");
-    }
+    public void onCarDisconnected() {}
 
     /** Returns navigation features of instrument cluster */
     public CarNavigationInstrumentCluster getInstrumentClusterInfo()