[automerger] Merge "Fix typecast" into pi-dev am: cc10275934 am: dd8349be28
Change-Id: I7524b3ff5f6f43935e90042525fa36d1b500e0df
diff --git a/car-lib/src/android/car/hardware/CarVendorExtensionManager.java b/car-lib/src/android/car/hardware/CarVendorExtensionManager.java
index 9f06764..5e07ace 100644
--- a/car-lib/src/android/car/hardware/CarVendorExtensionManager.java
+++ b/car-lib/src/android/car/hardware/CarVendorExtensionManager.java
@@ -106,7 +106,6 @@
if (mCallbacks.isEmpty()) {
mListenerToBase = new CarPropertyEventListenerToBase(this);
}
-
List<CarPropertyConfig> configs = mPropertyManager.getPropertyList();
for (CarPropertyConfig c : configs) {
// Register each individual propertyId
diff --git a/car-lib/src/android/car/hardware/cabin/CarCabinManager.java b/car-lib/src/android/car/hardware/cabin/CarCabinManager.java
index 1dee2b0..7d5715f 100644
--- a/car-lib/src/android/car/hardware/cabin/CarCabinManager.java
+++ b/car-lib/src/android/car/hardware/cabin/CarCabinManager.java
@@ -496,8 +496,6 @@
mCarPropertyMgr.registerListener(mListenerToBase, c.getPropertyId(), 0);
}
mCallbacks.add(callback);
-
-
}
/**
@@ -510,7 +508,7 @@
mCallbacks.remove(callback);
List<CarPropertyConfig> configs = getPropertyList();
for (CarPropertyConfig c : configs) {
- // Register each individual propertyId
+ // Register each individual propertyId
mCarPropertyMgr.unregisterListener(mListenerToBase, c.getPropertyId());
}
if (mCallbacks.isEmpty()) {
diff --git a/car-lib/src/android/car/hardware/hvac/CarHvacManager.java b/car-lib/src/android/car/hardware/hvac/CarHvacManager.java
index c953d6f..fc0e065 100644
--- a/car-lib/src/android/car/hardware/hvac/CarHvacManager.java
+++ b/car-lib/src/android/car/hardware/hvac/CarHvacManager.java
@@ -325,7 +325,7 @@
}
List<CarPropertyConfig> configs = getPropertyList();
for (CarPropertyConfig c : configs) {
- // Register each individual propertyId
+ // Register each individual propertyId
mCarPropertyMgr.registerListener(mListenerToBase, c.getPropertyId(), 0);
}
mCallbacks.add(callback);
@@ -343,6 +343,7 @@
for (CarPropertyConfig c : configs) {
// Register each individual propertyId
mCarPropertyMgr.unregisterListener(mListenerToBase, c.getPropertyId());
+
}
} catch (Exception e) {
Log.e(TAG, "getPropertyList exception ", e);
diff --git a/car-lib/src/android/car/media/CarAudioManager.java b/car-lib/src/android/car/media/CarAudioManager.java
index c9aef74..d68f3ce 100644
--- a/car-lib/src/android/car/media/CarAudioManager.java
+++ b/car-lib/src/android/car/media/CarAudioManager.java
@@ -109,7 +109,7 @@
try {
return mService.getGroupMaxVolume(groupId);
} catch (RemoteException e) {
- Log.e(CarLibLog.TAG_CAR, "getUsageMaxVolume failed", e);
+ Log.e(CarLibLog.TAG_CAR, "getGroupMaxVolume failed", e);
throw new CarNotConnectedException(e);
}
}
@@ -127,7 +127,7 @@
try {
return mService.getGroupMinVolume(groupId);
} catch (RemoteException e) {
- Log.e(CarLibLog.TAG_CAR, "getUsageMinVolume failed", e);
+ Log.e(CarLibLog.TAG_CAR, "getGroupMinVolume failed", e);
throw new CarNotConnectedException(e);
}
}
@@ -148,7 +148,7 @@
try {
return mService.getGroupVolume(groupId);
} catch (RemoteException e) {
- Log.e(CarLibLog.TAG_CAR, "getUsageVolume failed", e);
+ Log.e(CarLibLog.TAG_CAR, "getGroupVolume failed", e);
throw new CarNotConnectedException(e);
}
}
diff --git a/car-support-lib/proguard-release.flags b/car-support-lib/proguard-release.flags
index 91cab7e..652be52 100644
--- a/car-support-lib/proguard-release.flags
+++ b/car-support-lib/proguard-release.flags
@@ -1823,6 +1823,7 @@
public void finishOp(java.lang.String, int, java.lang.String);
public void finishOp(int, int, java.lang.String);
public void finishOp(int);
+ public static int getNumOps();
public static java.lang.String[] getOpStrs();
public java.util.List getOpsForPackage(int, java.lang.String, int[]);
public java.util.List getPackagesForOps(int[]);
@@ -4451,7 +4452,6 @@
public int describeContents();
public void dump(boolean);
public void ensureData();
- public void ensureDataForAutofill();
public long getAcquisitionEndTime();
public long getAcquisitionStartTime();
public android.content.ComponentName getActivityComponent();
@@ -8094,6 +8094,7 @@
public void writeToProto(android.util.proto.ProtoOutputStream, long);
+ public static float DEFAULT_MAX_LABEL_SIZE_PX;
public static int DUMP_FLAG_ALL;
public static int DUMP_FLAG_APPLICATION;
public static int DUMP_FLAG_DETAILS;
@@ -10763,7 +10764,6 @@
public boolean isMutable();
public boolean isPremultiplied();
public boolean isRecycled();
- public void makeImmutable();
public void prepareToDraw();
public void reconfigure(int, int, android.graphics.Bitmap$Config);
public void recycle();
@@ -10775,6 +10775,7 @@
public void setHasAlpha(boolean);
public void setHasMipMap(boolean);
public void setHeight(int);
+ public void setImmutable();
public void setNinePatchChunk(byte[]);
public void setPixel(int, int, int);
public void setPixels(int[], int, int, int, int, int, int);
@@ -15107,6 +15108,7 @@
public static int DETECT_CUSTOM;
public static int DETECT_DISK_READ;
public static int DETECT_DISK_WRITE;
+ public static int DETECT_EXPLICIT_GC;
public static int DETECT_NETWORK;
public static int DETECT_RESOURCE_MISMATCH;
public static int DETECT_UNBUFFERED_IO;
@@ -17460,7 +17462,7 @@
protected void finalize();
public void finishInputEvent(android.view.InputEvent, boolean);
public void onBatchedInputEventPending();
- public void onInputEvent(android.view.InputEvent, int);
+ public void onInputEvent(android.view.InputEvent);
}
@@ -17946,6 +17948,7 @@
public static int KEYCODE_ZENKAKU_HANKAKU;
public static int KEYCODE_ZOOM_IN;
public static int KEYCODE_ZOOM_OUT;
+ public static int LAST_KEYCODE;
public static int MAX_KEYCODE;
public static int META_ALT_LEFT_ON;
public static int META_ALT_LOCKED;
@@ -18260,6 +18263,7 @@
public float getAxisValue(int, int);
public int getButtonState();
public int getDeviceId();
+ public int getDisplayId();
public long getDownTime();
public int getEdgeFlags();
public long getEventTime();
@@ -18325,6 +18329,7 @@
public boolean isTargetAccessibilityFocus();
public boolean isTouchEvent();
public boolean isWithinBoundsNoHistory(float, float, float, float);
+ public static android.view.MotionEvent obtain(long, long, int, int, android.view.MotionEvent$PointerProperties[], android.view.MotionEvent$PointerCoords[], int, int, float, float, int, int, int, int, int);
public static android.view.MotionEvent obtain(long, long, int, int, android.view.MotionEvent$PointerProperties[], android.view.MotionEvent$PointerCoords[], int, int, float, float, int, int, int, int);
public static android.view.MotionEvent obtain(long, long, int, int, int[], android.view.MotionEvent$PointerCoords[], int, float, float, int, int, int, int);
public static android.view.MotionEvent obtain(long, long, int, float, float, float, float, int, float, float, int, int);
@@ -18338,6 +18343,7 @@
public void setAction(int);
public void setActionButton(int);
public void setButtonState(int);
+ public void setDisplayId(int);
public void setDownTime(long);
public void setEdgeFlags(int);
public void setHoverExitPending(boolean);
@@ -19081,7 +19087,6 @@
public void notifyFramePending();
public static void overrideProperty(java.lang.String, java.lang.String);
public void removeRenderNode(android.view.RenderNode);
- public void serializeDisplayListTree();
public void setContentDrawBounds(int, int, int, int);
public static void setContextPriority(int);
public static void setDebuggingEnabled(boolean);
@@ -23405,6 +23410,8 @@
protected android.widget.Toolbar$LayoutParams generateLayoutParams(android.view.ViewGroup$LayoutParams);
protected android.view.ViewGroup$LayoutParams generateLayoutParams(android.view.ViewGroup$LayoutParams);
public android.view.ViewGroup$LayoutParams generateLayoutParams(android.util.AttributeSet);
+ public java.lang.CharSequence getCollapseContentDescription();
+ public android.graphics.drawable.Drawable getCollapseIcon();
public int getContentInsetEnd();
public int getContentInsetEndWithActions();
public int getContentInsetLeft();
@@ -23445,6 +23452,10 @@
protected android.os.Parcelable onSaveInstanceState();
protected void onSetLayoutParams(android.view.View, android.view.ViewGroup$LayoutParams);
public boolean onTouchEvent(android.view.MotionEvent);
+ public void setCollapseContentDescription(int);
+ public void setCollapseContentDescription(java.lang.CharSequence);
+ public void setCollapseIcon(int);
+ public void setCollapseIcon(android.graphics.drawable.Drawable);
public void setCollapsible(boolean);
public void setContentInsetEndWithActions(int);
public void setContentInsetStartWithNavigation(int);
diff --git a/car_product/build/car_base.mk b/car_product/build/car_base.mk
index 9138090..6788a49 100644
--- a/car_product/build/car_base.mk
+++ b/car_product/build/car_base.mk
@@ -20,8 +20,6 @@
PRODUCT_PACKAGE_OVERLAYS += packages/services/Car/car_product/overlay
PRODUCT_PACKAGES += \
- ContactsProvider \
- DefaultContainerService \
Home \
BasicDreams \
CaptivePortalLogin \
@@ -46,39 +44,13 @@
ExternalStorageProvider \
atrace \
libandroidfw \
- libaudiopreprocessing \
libaudioutils \
- libfilterpack_imageproc \
- libgabi++ \
libmdnssd \
libnfc_ndef \
libpowermanager \
libspeexresampler \
- libstagefright_soft_aacdec \
- libstagefright_soft_aacenc \
- libstagefright_soft_amrdec \
- libstagefright_soft_amrnbenc \
- libstagefright_soft_amrwbenc \
- libstagefright_soft_avcdec \
- libstagefright_soft_avcenc \
- libstagefright_soft_flacdec \
- libstagefright_soft_flacenc \
- libstagefright_soft_g711dec \
- libstagefright_soft_gsmdec \
- libstagefright_soft_hevcdec \
- libstagefright_soft_mp3dec \
- libstagefright_soft_mpeg2dec \
- libstagefright_soft_mpeg4dec \
- libstagefright_soft_mpeg4enc \
- libstagefright_soft_opusdec \
- libstagefright_soft_rawdec \
- libstagefright_soft_vorbisdec \
- libstagefright_soft_vpxdec \
- libstagefright_soft_vpxenc \
libvariablespeed \
libwebrtc_audio_preprocessing \
- mdnsd \
- requestsync \
wifi-service \
A2dpSinkService \
diff --git a/evs/app/RenderDirectView.cpp b/evs/app/RenderDirectView.cpp
index 24eb485..45dfa78 100644
--- a/evs/app/RenderDirectView.cpp
+++ b/evs/app/RenderDirectView.cpp
@@ -135,6 +135,6 @@
// Wait for the rendering to finish
glFinish();
-
+ detachRenderTarget();
return true;
}
diff --git a/evs/app/RenderTopView.cpp b/evs/app/RenderTopView.cpp
index bff2b3c..5bc943c 100644
--- a/evs/app/RenderTopView.cpp
+++ b/evs/app/RenderTopView.cpp
@@ -214,7 +214,7 @@
// Wait for the rendering to finish
glFinish();
-
+ detachRenderTarget();
return true;
}
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index 9a15631..48113fa 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -611,4 +611,4 @@
return (Integer.decode(property) & VehicleArea.MASK) == VehicleArea.GLOBAL;
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/EmbeddedKitchenSinkApp/Android.mk b/tests/EmbeddedKitchenSinkApp/Android.mk
index 7a8c145..71adf6b 100644
--- a/tests/EmbeddedKitchenSinkApp/Android.mk
+++ b/tests/EmbeddedKitchenSinkApp/Android.mk
@@ -41,7 +41,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_STATIC_ANDROID_LIBRARIES += \
- android-support-car \
+ androidx.car_car \
car-service-lib-for-test
LOCAL_STATIC_JAVA_LIBRARIES += \
diff --git a/tests/EmbeddedKitchenSinkApp/res/layout/vhal_listitem.xml b/tests/EmbeddedKitchenSinkApp/res/layout/vhal_listitem.xml
new file mode 100644
index 0000000..7057660
--- /dev/null
+++ b/tests/EmbeddedKitchenSinkApp/res/layout/vhal_listitem.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
+ <TextView
+ android:id="@+id/textString"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="7"/>
+ <Button
+ android:id="@+id/infoButton"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="config"/>
+ <Button
+ android:id="@+id/valueButton"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="3"
+ android:text="value"/>
+</LinearLayout>
diff --git a/tests/EmbeddedKitchenSinkApp/res/values/strings.xml b/tests/EmbeddedKitchenSinkApp/res/values/strings.xml
index 452fec8..3fbbafb 100644
--- a/tests/EmbeddedKitchenSinkApp/res/values/strings.xml
+++ b/tests/EmbeddedKitchenSinkApp/res/values/strings.xml
@@ -237,6 +237,7 @@
<string name="sensor_ev_charge_port_is_open">EV Charge Port Is Open[%1$s]: %2$s</string>
<string name="sensor_ev_charge_port_is_connected">EV Charge Port Is Connected[%1$s]: %2$s</string>
<string name="sensor_ev_charge_rate">EV Charge Rate[%1$s]: %2$s</string>
+ <string name="sensor_oil_level">Oil Level[%1$s]: %2$s</string>
<string name="volume_test">Volume Test</string>
<string name="volume_up_logical">Vol +</string>
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/CarEmulator.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/CarEmulator.java
index ecb734d..ca2d6b3 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/CarEmulator.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/CarEmulator.java
@@ -17,6 +17,8 @@
package com.google.android.car.kitchensink;
+import com.google.android.collect.Lists;
+
import android.car.Car;
import android.content.Context;
import android.hardware.automotive.vehicle.V2_0.VehicleHwKeyInputAction;
@@ -24,6 +26,7 @@
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;
import android.os.SystemClock;
+import android.util.SparseIntArray;
import com.android.car.ICarImpl;
import com.android.car.systeminterface.SystemInterface;
@@ -32,6 +35,10 @@
import com.android.car.vehiclehal.test.MockedVehicleHal.VehicleHalPropertyHandler;
import com.android.car.vehiclehal.test.VehiclePropConfigBuilder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
public class CarEmulator {
private final Car mCar;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
index 7837f2e..0b0a878 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/KitchenSinkActivity.java
@@ -16,7 +16,6 @@
package com.google.android.car.kitchensink;
-
import android.car.hardware.CarSensorManager;
import android.car.hardware.hvac.CarHvacManager;
import android.car.hardware.power.CarPowerManager;
@@ -28,12 +27,12 @@
import android.support.car.CarAppFocusManager;
import android.support.car.CarConnectionCallback;
import android.support.car.CarNotConnectedException;
-import android.support.v4.app.Fragment;
import android.util.Log;
import androidx.car.drawer.CarDrawerActivity;
import androidx.car.drawer.CarDrawerAdapter;
import androidx.car.drawer.DrawerItemViewHolder;
+import androidx.fragment.app.Fragment;
import com.google.android.car.kitchensink.activityview.ActivityViewTestFragment;
import com.google.android.car.kitchensink.alertdialog.AlertDialogTestFragment;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/activityview/ActivityViewTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/activityview/ActivityViewTestFragment.java
index 2df0b07..a41427d 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/activityview/ActivityViewTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/activityview/ActivityViewTestFragment.java
@@ -21,12 +21,13 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
import java.util.Random;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/alertdialog/AlertDialogTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/alertdialog/AlertDialogTestFragment.java
index f2f5712..324df02 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/alertdialog/AlertDialogTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/alertdialog/AlertDialogTestFragment.java
@@ -19,12 +19,13 @@
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
/**
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/assistant/CarAssistantFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/assistant/CarAssistantFragment.java
index 4bee453..9f3ab1a 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/assistant/CarAssistantFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/assistant/CarAssistantFragment.java
@@ -18,8 +18,6 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
import android.view.View;
@@ -27,6 +25,9 @@
import android.widget.ImageView;
import android.widget.Toast;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
public class CarAssistantFragment extends Fragment {
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioPlayer.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioPlayer.java
index 50a5e9e..74345aa 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioPlayer.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioPlayer.java
@@ -23,6 +23,8 @@
import android.media.MediaPlayer;
import android.util.Log;
+import com.google.android.car.kitchensink.R;
+
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioTestFragment.java
index 626dc2a..6325512 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/audio/AudioTestFragment.java
@@ -31,7 +31,6 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -42,6 +41,8 @@
import android.widget.Toast;
import android.widget.ToggleButton;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.CarEmulator;
import com.google.android.car.kitchensink.R;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/BluetoothHeadsetFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/BluetoothHeadsetFragment.java
index a98d49e..2d57d28 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/BluetoothHeadsetFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/BluetoothHeadsetFragment.java
@@ -26,8 +26,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -35,6 +33,9 @@
import android.widget.Button;
import android.widget.TextView;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
public class BluetoothHeadsetFragment extends Fragment {
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/MapMceTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/MapMceTestFragment.java
index 6a72428..2d9df69 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/MapMceTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/bluetooth/MapMceTestFragment.java
@@ -32,8 +32,6 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.telecom.PhoneAccount;
import android.util.Log;
import android.view.LayoutInflater;
@@ -45,6 +43,9 @@
import android.widget.TextView;
import android.widget.Toast;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java
index 748ea68..8e4483e 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cluster/InstrumentClusterFragment.java
@@ -20,19 +20,20 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.support.annotation.Nullable;
import android.support.car.Car;
import android.support.car.CarAppFocusManager;
import android.support.car.CarConnectionCallback;
import android.support.car.CarNotConnectedException;
import android.support.car.navigation.CarNavigationStatusManager;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
/**
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cube/CubesTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cube/CubesTestFragment.java
index b149df5..209d98d 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cube/CubesTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/cube/CubesTestFragment.java
@@ -18,12 +18,13 @@
import android.opengl.GLSurfaceView;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
public class CubesTestFragment extends Fragment {
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/diagnostic/DiagnosticTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/diagnostic/DiagnosticTestFragment.java
index e2b452c..5569848 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/diagnostic/DiagnosticTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/diagnostic/DiagnosticTestFragment.java
@@ -24,13 +24,14 @@
import android.graphics.Color;
import android.os.Bundle;
import android.support.car.hardware.CarSensorManager;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/displayinfo/DisplayInfoFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/displayinfo/DisplayInfoFragment.java
index bae2253..ac0bdae 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/displayinfo/DisplayInfoFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/displayinfo/DisplayInfoFragment.java
@@ -20,7 +20,6 @@
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
@@ -28,6 +27,8 @@
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
/**
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/hvac/HvacTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/hvac/HvacTestFragment.java
index a1f8e1d..0b83f73 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/hvac/HvacTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/hvac/HvacTestFragment.java
@@ -25,7 +25,6 @@
import android.hardware.automotive.vehicle.V2_0.VehicleAreaSeat;
import android.hardware.automotive.vehicle.V2_0.VehicleAreaWindow;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -36,6 +35,8 @@
import android.widget.TextView;
import android.widget.ToggleButton;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/input/InputTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/input/InputTestFragment.java
index 19ad094..5128816 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/input/InputTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/input/InputTestFragment.java
@@ -36,7 +36,6 @@
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyType;
import android.os.Bundle;
import android.os.RemoteException;
-import android.support.v4.app.Fragment;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.KeyEvent;
@@ -48,6 +47,8 @@
import android.widget.TextView;
import android.widget.Toast;
+import androidx.fragment.app.Fragment;
+
import com.android.car.keventreader.EventReaderService;
import com.android.car.keventreader.IEventCallback;
import com.android.car.keventreader.KeypressEvent;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/job/JobSchedulerFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/job/JobSchedulerFragment.java
index 3cf96e4..b82818f 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/job/JobSchedulerFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/job/JobSchedulerFragment.java
@@ -22,8 +22,6 @@
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.PersistableBundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -35,6 +33,9 @@
import android.widget.TextView;
import android.widget.Toast;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
import java.util.List;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/notification/NotificationFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/notification/NotificationFragment.java
index 5f88259..7a26f93 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/notification/NotificationFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/notification/NotificationFragment.java
@@ -12,12 +12,13 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/orientation/OrientationTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/orientation/OrientationTestFragment.java
index ef49ae4..b81104b 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/orientation/OrientationTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/orientation/OrientationTestFragment.java
@@ -18,13 +18,14 @@
import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
public class OrientationTestFragment extends Fragment {
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/power/PowerTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/power/PowerTestFragment.java
index fed1fbd..e9c82a3 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/power/PowerTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/power/PowerTestFragment.java
@@ -22,7 +22,6 @@
import android.os.Bundle;
import android.os.PowerManager;
import android.os.SystemClock;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -30,6 +29,8 @@
import android.widget.Button;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/property/PropertyTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/property/PropertyTestFragment.java
index fc6621a..57a1785 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/property/PropertyTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/property/PropertyTestFragment.java
@@ -26,7 +26,6 @@
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyType;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -42,6 +41,8 @@
import android.widget.TextView;
import android.widget.Toast;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
@@ -74,7 +75,7 @@
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.property, container, false);
- mActivity = (KitchenSinkActivity) getHost();
+ mActivity = (KitchenSinkActivity) getActivity();
mMgr = mActivity.getPropertyManager();
// Get resource IDs
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/sensor/SensorsTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/sensor/SensorsTestFragment.java
index a6cc5ac..dea1639 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/sensor/SensorsTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/sensor/SensorsTestFragment.java
@@ -28,7 +28,6 @@
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
@@ -36,6 +35,8 @@
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
@@ -291,6 +292,9 @@
case CarSensorManager.SENSOR_TYPE_EV_BATTERY_CHARGE_RATE:
summary.add(getEvChargeRate(event));
break;
+ case CarSensorManager.SENSOR_TYPE_ENGINE_OIL_LEVEL:
+ summary.add(getEngineOilLevel(event));
+ break;
default:
// Should never happen.
Log.w(TAG, "Unrecognized event type: " + toHexString(i));
@@ -367,4 +371,14 @@
return getContext().getString(R.string.sensor_ev_charge_rate, getTimestamp(event),
evChargeRate);
}
+
+ private String getEngineOilLevel(CarSensorEvent event) {
+ String engineOilLevel = mNaString;
+ if(event != null) {
+ engineOilLevel = String.valueOf(event.getCarEngineOilLevelData(null).engineOilLevel);
+ }
+ return getContext().getString(R.string.sensor_oil_level, getTimestamp(event),
+ engineOilLevel);
+
+ }
}
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/setting/GarageModeSettingsFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/setting/GarageModeSettingsFragment.java
index 4ace656..df191b8 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/setting/GarageModeSettingsFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/setting/GarageModeSettingsFragment.java
@@ -15,13 +15,6 @@
*/
package com.google.android.car.kitchensink.setting;
-import static android.car.settings.CarSettings.Global.KEY_GARAGE_MODE_ENABLED;
-import static android.car.settings.CarSettings.Global.KEY_GARAGE_MODE_MAINTENANCE_WINDOW;
-import static android.car.settings.CarSettings.Global.KEY_GARAGE_MODE_WAKE_UP_TIME;
-import static android.car.settings.GarageModeSettingsObserver.GARAGE_MODE_ENABLED_URI;
-import static android.car.settings.GarageModeSettingsObserver.GARAGE_MODE_MAINTENANCE_WINDOW_URI;
-import static android.car.settings.GarageModeSettingsObserver.GARAGE_MODE_WAKE_UP_TIME_URI;
-
import android.app.TimePickerDialog;
import android.car.CarApiUtil;
import android.car.settings.GarageModeSettingsObserver;
@@ -40,6 +33,13 @@
import java.sql.Time;
+import static android.car.settings.CarSettings.Global.KEY_GARAGE_MODE_MAINTENANCE_WINDOW;
+import static android.car.settings.CarSettings.Global.KEY_GARAGE_MODE_ENABLED;
+import static android.car.settings.CarSettings.Global.KEY_GARAGE_MODE_WAKE_UP_TIME;
+import static android.car.settings.GarageModeSettingsObserver.GARAGE_MODE_ENABLED_URI;
+import static android.car.settings.GarageModeSettingsObserver.GARAGE_MODE_WAKE_UP_TIME_URI;
+import static android.car.settings.GarageModeSettingsObserver.GARAGE_MODE_MAINTENANCE_WINDOW_URI;
+
public class GarageModeSettingsFragment extends PreferenceFragment implements
TimePickerDialog.OnTimeSetListener, Preference.OnPreferenceChangeListener {
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java
index fc4052e..bf7af5d 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java
@@ -27,7 +27,6 @@
import android.car.storagemonitoring.IoStatsEntry;
import android.os.Bundle;
import android.os.StatFs;
-import android.support.v4.app.Fragment;
import android.system.ErrnoException;
import android.util.Log;
import android.view.LayoutInflater;
@@ -37,6 +36,8 @@
import android.widget.ListView;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/touch/TouchTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/touch/TouchTestFragment.java
index fe2c385..2cb0a64 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/touch/TouchTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/touch/TouchTestFragment.java
@@ -17,11 +17,12 @@
package com.google.android.car.kitchensink.touch;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
public class TouchTestFragment extends Fragment {
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 ac62505..c5998c9 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
@@ -17,23 +17,26 @@
import android.annotation.Nullable;
import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
+import android.content.Context;
import android.hardware.automotive.vehicle.V2_0.IVehicle;
+import android.hardware.automotive.vehicle.V2_0.StatusCode;
import android.hardware.automotive.vehicle.V2_0.VehiclePropConfig;
+import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.os.Bundle;
import android.os.RemoteException;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.LinearLayout;
import android.widget.ListView;
+import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.KitchenSinkActivity;
import com.google.android.car.kitchensink.R;
@@ -42,28 +45,12 @@
import java.util.stream.Collectors;
public class VehicleHalFragment extends Fragment {
+
private static final String TAG = "CAR.VEHICLEHAL.KS";
private KitchenSinkActivity mActivity;
private ListView mListView;
- private final OnClickListener mNopOnClickListener = new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) { }
- };
-
- private final OnItemClickListener mOnClickListener = new OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- HalPropertyInfo entry = (HalPropertyInfo)parent.getItemAtPosition(position);
- AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
- builder.setTitle("Info for " + entry.name)
- .setPositiveButton(android.R.string.yes, mNopOnClickListener)
- .setMessage(entry.config.toString())
- .show();
- }
- };
-
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,
@@ -72,8 +59,6 @@
View view = inflater.inflate(R.layout.vhal, container, false);
mActivity = (KitchenSinkActivity) getHost();
mListView = view.findViewById(R.id.hal_prop_list);
- mListView.setOnItemClickListener(mOnClickListener);
-
return view;
}
@@ -102,12 +87,11 @@
.sorted()
.collect(Collectors.toList());
- mListView.setAdapter(new ArrayAdapter<HalPropertyInfo>(mActivity,
- android.R.layout.simple_list_item_1,
- supportedProperties));
+ mListView.setAdapter(new ListAdapter(mActivity, vehicle, supportedProperties));
}
private static class HalPropertyInfo implements Comparable<HalPropertyInfo> {
+
public final int id;
public final String name;
public final VehiclePropConfig config;
@@ -125,10 +109,7 @@
@Override
public boolean equals(Object other) {
- if (other instanceof HalPropertyInfo) {
- return ((HalPropertyInfo)other).id == id;
- }
- return false;
+ return other instanceof HalPropertyInfo && ((HalPropertyInfo) other).id == id;
}
@Override
@@ -140,5 +121,79 @@
public int compareTo(HalPropertyInfo halPropertyInfo) {
return name.compareTo(halPropertyInfo.name);
}
+
+ public String getValue(IVehicle vehicle) {
+ String result[] = new String[] {"<unknown>"};
+
+ try {
+ VehiclePropValue request = new VehiclePropValue();
+ // TODO: add zones support
+ request.prop = id;
+
+ // NB: this call is synchronous
+ vehicle.get(request, (status, propValue) -> {
+ if (status == StatusCode.OK) {
+ result[0] = propValue.value.toString();
+ }
+ });
+ } catch (android.os.RemoteException e) {
+ Log.e(TAG, "unable to read property " + name, e);
+ }
+
+ return result[0];
+ }
+ }
+
+ private static final class ListAdapter extends ArrayAdapter<HalPropertyInfo> {
+ private static final int RESOURCE_ID = R.layout.vhal_listitem;
+
+ // cannot use superclass' LayoutInflater as it is private
+ private final LayoutInflater mLayoutInflater;
+ private final IVehicle mVehicle;
+
+ ListAdapter(Context context, IVehicle vehicle, List<HalPropertyInfo> properties) {
+ super(context, RESOURCE_ID, properties);
+ mVehicle = vehicle;
+ mLayoutInflater = LayoutInflater.from(context);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ final HalPropertyInfo item = getItem(position);
+
+ final LinearLayout viewLayout;
+ if (convertView != null && convertView instanceof LinearLayout) {
+ viewLayout = (LinearLayout)convertView;
+ } else {
+ // this is the value used by the superclass's view inflater
+ final boolean attachToRoot = false;
+
+ viewLayout =
+ (LinearLayout)mLayoutInflater.inflate(RESOURCE_ID, parent, attachToRoot);
+ }
+
+ TextView textString = viewLayout.findViewById(R.id.textString);
+ Button infoButton = viewLayout.findViewById(R.id.infoButton);
+ Button valueButton = viewLayout.findViewById(R.id.valueButton);
+
+ infoButton.setOnClickListener(btn -> {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+ builder.setTitle("Configuration for " + item.name)
+ .setPositiveButton(android.R.string.yes, (x, y) -> { })
+ .setMessage(item.config.toString())
+ .show();
+ });
+
+ valueButton.setOnClickListener(btn -> {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
+ builder.setTitle("Value for " + item.name)
+ .setPositiveButton(android.R.string.yes, (x, y) -> { })
+ .setMessage(item.getValue(mVehicle))
+ .show();
+ });
+
+ textString.setText(item.toString());
+ return viewLayout;
+ }
}
}
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/volume/VolumeTestFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/volume/VolumeTestFragment.java
index 800d650..066f46a 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/volume/VolumeTestFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/volume/VolumeTestFragment.java
@@ -26,8 +26,6 @@
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.util.SparseIntArray;
import android.view.LayoutInflater;
@@ -36,6 +34,9 @@
import android.widget.ListView;
import android.widget.SeekBar;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import com.google.android.car.kitchensink.R;
public class VolumeTestFragment extends Fragment {
diff --git a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/JsonVhalEventGenerator.java b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/JsonVhalEventGenerator.java
index 702f5f0..4560b8c 100644
--- a/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/JsonVhalEventGenerator.java
+++ b/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/JsonVhalEventGenerator.java
@@ -28,6 +28,9 @@
class JsonVhalEventGenerator implements VhalEventGenerator {
+ // Exactly one iteration is required for JSON-based end-to-end test
+ private static final int NUM_OF_ITERATION = 1;
+
private IVehicle mVehicle;
private File mFile;
@@ -47,7 +50,7 @@
public void start() throws RemoteException {
VehiclePropValue request =
VehiclePropValueBuilder.newBuilder(GENERATE_FAKE_DATA_CONTROLLING_PROPERTY)
- .addIntValue(CMD_START_JSON)
+ .addIntValue(CMD_START_JSON, NUM_OF_ITERATION)
.setStringValue(mFile.getAbsolutePath())
.build();
assertEquals(StatusCode.OK, mVehicle.set(request));
@@ -58,6 +61,7 @@
VehiclePropValue request =
VehiclePropValueBuilder.newBuilder(GENERATE_FAKE_DATA_CONTROLLING_PROPERTY)
.addIntValue(CMD_STOP_JSON)
+ .setStringValue(mFile.getAbsolutePath())
.build();
assertEquals(StatusCode.OK, mVehicle.set(request));
}