DO NOT MERGE: Add lane guidance offLanesAlpha support in getBitmap
Fix: 138671602
Test: Manual
Change-Id: If99d24436b378beff218eb346572572ce877174b
diff --git a/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java b/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
index b692c02..3dff6e2 100644
--- a/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
+++ b/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java
@@ -93,6 +93,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 Object mLock = new Object();
private RendererBinder mRendererBinder;
@@ -547,8 +548,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
@@ -557,12 +568,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 {
@@ -575,6 +590,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);
- }
-}