DO NOT MERGE: Add lane guidance offLanesAlpha support in getBitmap am: 575dde1e7b
am: 38c966104a
Change-Id: I27090c7ebe713447cff1325115e7349ae23434a1
diff --git a/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java b/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
index 29ae9b8..67b1df0 100644
--- a/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
+++ b/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
@@ -103,6 +103,7 @@
private static final int NAVIGATION_STATE_EVENT_ID = 1;
private static final String BITMAP_QUERY_WIDTH = "w";
private static final String BITMAP_QUERY_HEIGHT = "h";
+ private static final String BITMAP_QUERY_OFFLANESALPHA = "offLanesAlpha";
private final Handler mUiHandler = new Handler(Looper.getMainLooper());
@@ -647,8 +648,18 @@
}
/**
+ * See {@link #getBitmap(Uri, int, int, float)}
+ *
+ * @hide
+ */
+ @Nullable
+ public Bitmap getBitmap(Uri uri, int width, int height) {
+ return getBitmap(uri, width, height, 1f);
+ }
+
+ /**
* Fetches a bitmap from the navigation context owner (application holding navigation focus)
- * of the given width and height. The fetched bitmaps are cached.
+ * of the given width and height and off lane opacity. The fetched bitmaps are cached.
* It returns null if:
* <ul>
* <li>there is no navigation context owner
@@ -657,12 +668,16 @@
* </ul>
* This is a costly operation. Returned bitmaps should be fetched on a secondary thread.
*
+ * @throws IllegalArgumentException if width, height <= 0, or 0 > offLanesAlpha > 1
* @hide
*/
@Nullable
- public Bitmap getBitmap(Uri uri, int width, int height) throws InvalidSizeException {
+ public Bitmap getBitmap(Uri uri, int width, int height, float offLanesAlpha) {
if (width <= 0 || height <= 0) {
- throw new InvalidSizeException("Width and height must be > 0");
+ throw new IllegalArgumentException("Width and height must be > 0");
+ }
+ if (offLanesAlpha < 0 || offLanesAlpha > 1) {
+ throw new IllegalArgumentException("offLanesAlpha must be between [0, 1]");
}
try {
@@ -675,6 +690,7 @@
uri = uri.buildUpon()
.appendQueryParameter(BITMAP_QUERY_WIDTH, String.valueOf(width))
.appendQueryParameter(BITMAP_QUERY_HEIGHT, String.valueOf(height))
+ .appendQueryParameter(BITMAP_QUERY_OFFLANESALPHA, String.valueOf(offLanesAlpha))
.build();
String host = uri.getHost();
diff --git a/car-lib/src/android/car/cluster/renderer/InvalidSizeException.java b/car-lib/src/android/car/cluster/renderer/InvalidSizeException.java
deleted file mode 100644
index b89cd9f..0000000
--- a/car-lib/src/android/car/cluster/renderer/InvalidSizeException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.car.cluster.renderer;
-
-/**
- * Exception denoting invalid size of an object.
- * eg.) Minimum size of an image
- *
- * @hide
- */
-public class InvalidSizeException extends Exception {
- public InvalidSizeException(String message) {
- super(message);
- }
-
- public InvalidSizeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidSizeException(Throwable cause) {
- super(cause);
- }
-}