add android.car
- instead of using binder as compatibility layer, add android.car
- apps using android.car should add it to LOCAL_JAVA_LIBRARIES
unless doing include
packages/services/Car/car-support-lib/car-support.mk
- support lib renamed to android.support.car
- UI stuffs only exist in android.support.car
UI has dependency on androud support library and not added to
android.car
- permission only uses android.car namespace even for support.car
- car-systemtest remains as static library. To use CarTestManager,
test app should get CarTestManagerBinderWrapper then create
CarTestManager.
bug: 27199752
Change-Id: I3522e11e958dade404443fbe2d45f576c827fa7a
diff --git a/car-libs/car-system/Android.mk b/car-lib/Android.mk
similarity index 80%
rename from car-libs/car-system/Android.mk
rename to car-lib/Android.mk
index cbece86..9af9498 100644
--- a/car-libs/car-system/Android.mk
+++ b/car-lib/Android.mk
@@ -18,13 +18,9 @@
include $(CLEAR_VARS)
-LOCAL_MODULE := car-system
+LOCAL_MODULE := android.car
LOCAL_MODULE_TAGS := optional
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src packages/services/Car/car-libs/car-core/src
-
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES += car-core
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
+include $(BUILD_JAVA_LIBRARY)
diff --git a/car-libs/car-core/src/android/support/car/Car.java b/car-lib/src/android/car/Car.java
similarity index 62%
rename from car-libs/car-core/src/android/support/car/Car.java
rename to car-lib/src/android/car/Car.java
index 421cf68..cb55d07 100644
--- a/car-libs/car-core/src/android/support/car/Car.java
+++ b/car-lib/src/android/car/Car.java
@@ -14,22 +14,32 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
-import android.support.annotation.IntDef;
-import android.support.annotation.Nullable;
+import android.annotation.IntDef;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
-import android.support.car.content.pm.CarPackageManager;
-import android.support.car.hardware.CarSensorManager;
-import android.support.car.navigation.CarNavigationStatusManager;
+import android.car.content.pm.CarPackageManager;
+import android.car.hardware.CarSensorManager;
+import android.car.hardware.hvac.CarHvacManager;
+import android.car.hardware.radio.CarRadioManager;
+import android.car.media.CarAudioManager;
+import android.car.navigation.CarNavigationManager;
+import android.car.test.CarTestManagerBinderWrapper;
+import android.car.CarLibLog;
import android.util.Log;
+import com.android.internal.annotations.GuardedBy;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
@@ -39,8 +49,6 @@
import java.util.HashSet;
import java.util.LinkedList;
-import javax.annotation.concurrent.GuardedBy;
-
/**
* Top level car API.
* This API works only for device with {@link PackageManager#FEATURE_AUTOMOTIVE} feature
@@ -65,60 +73,64 @@
/** Service name for {@link CarAudioManager} */
public static final String AUDIO_SERVICE = "audio";
/**
- * Service name for {@link CarNavigationStatusManager}
+ * Service name for {@link CarNavigationManager}
* @hide
*/
public static final String CAR_NAVIGATION_SERVICE = "car_navigation_service";
- /** Type of car connection: car emulator, not physical connection. */
- public static final int CONNECTION_TYPE_EMULATOR = 0;
- /** Type of car connection: connected to a car via USB. */
- public static final int CONNECTION_TYPE_USB = 1;
- /** Type of car connection: connected to a car via WIFI. */
- public static final int CONNECTION_TYPE_WIFI = 2;
- /** Type of car connection: on-device car emulator, for development (e.g. Local Head Unit). */
- public static final int CONNECTION_TYPE_ON_DEVICE_EMULATOR = 3;
- /** Type of car connection: car emulator, connected over ADB (e.g. Desktop Head Unit). */
- public static final int CONNECTION_TYPE_ADB_EMULATOR = 4;
+ @SystemApi
+ public static final String RADIO_SERVICE = "radio";
+
+ @SystemApi
+ public static final String HVAC_SERVICE = "hvac";
+
+ /**
+ * Service for testing. This is system app only feature.
+ * Service name for {@link CarTestManager}, to be used in {@link #getCarManager(String)}.
+ * @hide
+ */
+ @SystemApi
+ public static final String TEST_SERVICE = "car-service-test";
+
+ /** permission necessary to access car's mileage information */
+ public static final String PERMISSION_MILEAGE = "android.car.permission.CAR_MILEAGE";
+
+ /** permission necessary to access car's fuel level */
+ public static final String PERMISSION_FUEL = "android.car.permission.CAR_FUEL";
+
+ /** permission necessary to access car's speed */
+ public static final String PERMISSION_SPEED = "android.car.permission.CAR_SPEED";
+
+ /** permission necessary to access car specific communication channel */
+ @SystemApi
+ public static final String PERMISSION_VENDOR_EXTENSION =
+ "android.car.permission.CAR_VENDOR_EXTENSION";
+
+ @SystemApi
+ public static final String PERMISSION_CONTROL_APP_BLOCKING =
+ "android.car.permission.CONTROL_APP_BLOCKING";
+
+ /** Permission necessary to access Car HVAC APIs. */
+ @SystemApi
+ public static final String PERMISSION_CAR_HVAC = "android.car.permission.CAR_HVAC";
+
+ /** Permission necesary to access Car RADIO system APIs. */
+ @SystemApi
+ public static final String PERMISSION_CAR_RADIO = "android.car.permission.CAR_RADIO";
+
+ /** permission necessary to mock vehicle hal for testing */
+ @SystemApi
+ public static final String PERMISSION_MOCK_VEHICLE_HAL =
+ "android.car.permission.CAR_MOCK_VEHICLE_HAL";
+
/** Type of car connection: platform runs directly in car. */
public static final int CONNECTION_TYPE_EMBEDDED = 5;
/** @hide */
- @IntDef({CONNECTION_TYPE_EMULATOR, CONNECTION_TYPE_USB, CONNECTION_TYPE_WIFI,
- CONNECTION_TYPE_ON_DEVICE_EMULATOR, CONNECTION_TYPE_ADB_EMULATOR, CONNECTION_TYPE_EMBEDDED})
+ @IntDef({CONNECTION_TYPE_EMBEDDED})
@Retention(RetentionPolicy.SOURCE)
public @interface ConnectionType {}
- /** permission necessary to access car's mileage information */
- public static final String PERMISSION_MILEAGE = "android.support.car.permission.CAR_MILEAGE";
- /** permission necessary to access car's fuel level */
- public static final String PERMISSION_FUEL = "android.support.car.permission.CAR_FUEL";
- /** permission necessary to access car's speed */
- public static final String PERMISSION_SPEED = "android.support.car.permission.CAR_SPEED";
- /** permission necessary to access car specific communication channel */
- public static final String PERMISSION_VENDOR_EXTENSION =
- "android.support.car.permission.CAR_VENDOR_EXTENSION";
- /** @hide */
- public static final String PERMISSION_CONTROL_APP_BLOCKING =
- "android.support.car.permission.CONTROL_APP_BLOCKING";
-
- /** @hide */
- public static final String CAR_SERVICE_INTERFACE_NAME = "android.support.car.ICar";
-
- /**
- * PackageManager.FEATURE_AUTOMOTIVE from M. But redefine here to support L.
- * @hide
- */
- private static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
-
- /**
- * {@link CarServiceLoader} implementation for projected mode. Only available when projected
- * client library is linked.
- * @hide
- */
- private static final String PROJECTED_CAR_SERVICE_LOADER =
- "com.google.android.gms.car.GoogleCarServiceLoader";
-
/**
* CarXyzService throws IllegalStateException with this message is re-thrown as
* {@link CarNotConnectedException}.
@@ -127,7 +139,12 @@
*/
public static final String CAR_NOT_CONNECTED_EXCEPTION_MSG = "CarNotConnected";
- private static final int VERSION = 1;
+ /** @hide */
+ public static final String CAR_SERVICE_INTERFACE_NAME = "android.car.ICar";
+
+ private static final String CAR_SERVICE_PACKAGE = "com.android.car";
+
+ private static final String CAR_TEST_MANAGER_CLASS = "android.car.CarTestManager";
private final Context mContext;
private final Looper mLooper;
@@ -138,26 +155,13 @@
private static final int STATE_CONNECTED = 2;
@GuardedBy("this")
private int mConnectionState;
- @GuardedBy("this")
- private int mServiceVersion = 1; // default
- private final ServiceConnectionListener mServiceConnectionListener =
- new ServiceConnectionListener () {
+ private final ServiceConnection mServiceConnectionListener =
+ new ServiceConnection () {
public void onServiceConnected(ComponentName name, IBinder service) {
synchronized (Car.this) {
mService = ICar.Stub.asInterface(service);
mConnectionState = STATE_CONNECTED;
- // getVersion can fail but let it pass through as it is better to
- // throw right exception in next car api call.
- try {
- mServiceVersion = mService.getVersion();
- } catch (RemoteException e) {
- Log.w(CarLibLog.TAG_CAR, "RemoteException in getVersion", e);
- }
- }
- if (mServiceVersion < VERSION) {
- Log.w(CarLibLog.TAG_CAR, "Old service version:" + mServiceVersion +
- " for client lib:" + VERSION);
}
mServiceConnectionListenerClient.onServiceConnected(name, service);
}
@@ -170,36 +174,16 @@
}
mConnectionState = STATE_DISCONNECTED;
}
+ // unbind explicitly here.
+ disconnect();
mServiceConnectionListenerClient.onServiceDisconnected(name);
- connect();
- }
-
- public void onServiceSuspended(int cause) {
- mServiceConnectionListenerClient.onServiceSuspended(cause);
- }
-
- public void onServiceConnectionFailed(int cause) {
- mServiceConnectionListenerClient.onServiceConnectionFailed(cause);
}
};
- private final ServiceConnectionListener mServiceConnectionListenerClient;
+ private final ServiceConnection mServiceConnectionListenerClient;
private final Object mCarManagerLock = new Object();
@GuardedBy("mCarManagerLock")
private final HashMap<String, CarManagerBase> mServiceMap = new HashMap<>();
- private final CarServiceLoader mCarServiceLoader;
-
- /**
- * This defines CarServiceLoader that will be tried for FEATURE_AUTOMOTIVE case.
- * For system test and system api, there are separate static libraries. If those
- * libraries are linked, CarServiceLoader from those libraries are loaded so that
- * custom car managers can be populated from there.
- * This is done to prevent bloating the library which is not relevant for the app.
- */
- private static final String[] CAR_SERVICE_LOADERS_FOR_FEATURE_AUTOMOTIVE = {
- "android.support.car.SystemTestApiCarServiceLoader",
- "android.support.car.SystemApiCarServiceLoader",
- };
private final ICarConnectionListenerImpl mICarConnectionListenerImpl =
new ICarConnectionListenerImpl(this);
@@ -224,13 +208,17 @@
/**
* A factory method that creates Car instance for all Car API access.
* @param context
- * @param serviceConnectionListener listner for monitoring service connection.
+ * @param serviceConnectionListener listener for monitoring service connection.
* @param looper Looper to dispatch all listeners. If null, it will use main thread. Note that
* service connection listener will be always in main thread regardless of this Looper.
* @return Car instance if system is in car environment and returns {@code null} otherwise.
*/
- public static Car createCar(Context context, ServiceConnectionListener serviceConnectionListener,
+ public static Car createCar(Context context, ServiceConnection serviceConnectionListener,
@Nullable Looper looper) {
+ if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+ Log.e(CarLibLog.TAG_CAR, "FEATURE_AUTOMOTIVE not declared while android.car is used");
+ return null;
+ }
try {
return new Car(context, serviceConnectionListener, looper);
} catch (IllegalArgumentException e) {
@@ -245,11 +233,11 @@
*
* @see #createCar(Context, ServiceConnectionListener, Looper)
*/
- public static Car createCar(Context context, ServiceConnectionListener serviceConnectionListener) {
+ public static Car createCar(Context context, ServiceConnection serviceConnectionListener) {
return createCar(context, serviceConnectionListener, null);
}
- private Car(Context context, ServiceConnectionListener serviceConnectionListener,
+ private Car(Context context, ServiceConnection serviceConnectionListener,
@Nullable Looper looper) {
mContext = context;
mServiceConnectionListenerClient = serviceConnectionListener;
@@ -259,58 +247,6 @@
mLooper = looper;
}
mEventHandler = new Handler(mLooper);
- if (mContext.getPackageManager().hasSystemFeature(FEATURE_AUTOMOTIVE)) {
- CarServiceLoader loader = null;
- for (String classToTry : CAR_SERVICE_LOADERS_FOR_FEATURE_AUTOMOTIVE) {
- try {
- loader = loadCarServiceLoader(classToTry, context, mServiceConnectionListener,
- mLooper);
- } catch (IllegalArgumentException e) {
- // expected when only lower level libraries are linked.
- }
- if (loader != null) {
- break;
- }
- }
- if (loader == null) {
- mCarServiceLoader = new DefaultCarServiceLoader(context,
- mServiceConnectionListener, mLooper);
- } else {
- mCarServiceLoader = loader;
- }
- } else {
- mCarServiceLoader = loadCarServiceLoader(PROJECTED_CAR_SERVICE_LOADER, context,
- mServiceConnectionListener, mLooper);
- }
- }
-
- private CarServiceLoader loadCarServiceLoader(String carServiceLoaderClassName,
- Context context, ServiceConnectionListener serviceConnectionListener, Looper looper)
- throws IllegalArgumentException {
- Class carServiceLoaderClass = null;
- try {
- carServiceLoaderClass = Class.forName(carServiceLoaderClassName);
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("Cannot find CarServiceLoader implementation:" +
- carServiceLoaderClassName, e);
- }
- Constructor<?> ctor;
- try {
- ctor = carServiceLoaderClass.getDeclaredConstructor(Context.class,
- ServiceConnectionListener.class, Looper.class);
- } catch (NoSuchMethodException e) {
- throw new IllegalArgumentException("Cannot construct CarServiceLoader, no constructor: "
- + carServiceLoaderClassName, e);
- }
- try {
- return (CarServiceLoader) ctor.newInstance(context,
- serviceConnectionListener, looper);
- } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
- | InvocationTargetException e) {
- throw new IllegalArgumentException(
- "Cannot construct CarServiceLoader, constructor failed for "
- + carServiceLoaderClass.getName(), e);
- }
}
/**
@@ -331,7 +267,6 @@
mEventHandler = new Handler(mLooper);
mService = service;
mConnectionState = STATE_CONNECTED;
- mCarServiceLoader = null;
mServiceConnectionListenerClient = null;
}
@@ -346,7 +281,7 @@
throw new IllegalStateException("already connected or connecting");
}
mConnectionState = STATE_CONNECTING;
- mCarServiceLoader.connect();
+ startCarService();
}
}
@@ -363,7 +298,7 @@
tearDownCarManagers();
mService = null;
mConnectionState = STATE_DISCONNECTED;
- mCarServiceLoader.disconnect();
+ mContext.unbindService(mServiceConnectionListener);
}
}
@@ -389,15 +324,22 @@
}
/**
+ * Tells if connected to car. Same as isConnected. Necessary for compatibility with support lib.
+ * @return
+ */
+ public boolean isConnectedToCar() {
+ return isConnected();
+ }
+
+ /**
* Get car specific service as in {@link Context#getSystemService(String)}. Returned
* {@link Object} should be type-casted to the desired service.
* For example, to get sensor service,
* SensorManagerService sensorManagerService = car.getCarManager(Car.SENSOR_SERVICE);
* @param serviceName Name of service that should be created like {@link #SENSOR_SERVICE}.
* @return Matching service manager or null if there is no such service.
- * @throws CarNotConnectedException
*/
- public Object getCarManager(String serviceName) throws CarNotConnectedException {
+ public Object getCarManager(String serviceName) {
CarManagerBase manager = null;
ICar service = getICarOrThrow();
synchronized (mCarManagerLock) {
@@ -410,7 +352,7 @@
serviceName);
return null;
}
- manager = mCarServiceLoader.createCarManager(serviceName, binder);
+ manager = createCarManager(serviceName, binder);
if (manager == null) {
Log.w(CarLibLog.TAG_CAR,
"getCarManager could not create manager for service:" +
@@ -419,7 +361,7 @@
}
mServiceMap.put(serviceName, manager);
} catch (RemoteException e) {
- handleRemoteExceptionAndThrow(e);
+ handleRemoteException(e);
}
}
}
@@ -429,17 +371,10 @@
/**
* Return the type of currently connected car.
* @return
- * @throws CarNotConnectedException
*/
@ConnectionType
- public int getCarConnectionType() throws CarNotConnectedException {
- ICar service = getICarOrThrow();
- try {
- return service.getCarConnectionType();
- } catch (RemoteException e) {
- handleRemoteExceptionAndThrow(e);
- }
- return Car.CONNECTION_TYPE_EMULATOR;
+ public int getCarConnectionType() {
+ return CONNECTION_TYPE_EMBEDDED;
}
/**
@@ -453,30 +388,23 @@
public void registerCarConnectionListener(CarConnectionListener listener)
throws IllegalStateException {
ICar service = getICarOrThrow();
- int currentConnectionType;
synchronized (this) {
if (mCarConnectionNotConnectedListeners.size() == 0 &&
mCarConnectionConnectedListeners.size() == 0) {
try {
- service.registerCarConnectionListener(
- ICarConnectionListenerImpl.CAR_CONNECTION_LISTENER_VERSION,
- mICarConnectionListenerImpl);
+ service.registerCarConnectionListener(mICarConnectionListenerImpl);
} catch (RemoteException e) {
// ignore
}
}
mCarConnectionNotConnectedListeners.add(listener);
- currentConnectionType = mICarConnectionListenerImpl.getCurrentConnectionType();
}
- if (currentConnectionType != ICarConnectionListenerImpl.CONNECTION_TYPE_INVALID) {
- final int connectionToPost = currentConnectionType;
- mEventHandler.post(new Runnable() {
- @Override
- public void run() {
- handleCarConnected(connectionToPost);
- }
- });
- }
+ mEventHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ handleCarConnected();
+ }
+ });
}
/**
@@ -521,6 +449,50 @@
}
}
+ private CarManagerBase createCarManager(String serviceName, IBinder binder) {
+ CarManagerBase manager = null;
+ switch (serviceName) {
+ case AUDIO_SERVICE:
+ manager = new CarAudioManager(binder);
+ break;
+ case SENSOR_SERVICE:
+ manager = new CarSensorManager(binder, mContext, mLooper);
+ break;
+ case INFO_SERVICE:
+ manager = new CarInfoManager(binder);
+ break;
+ case APP_CONTEXT_SERVICE:
+ manager = new CarAppContextManager(binder, mLooper);
+ break;
+ case PACKAGE_SERVICE:
+ manager = new CarPackageManager(binder, mContext);
+ break;
+ case CAR_NAVIGATION_SERVICE:
+ manager = new CarNavigationManager(binder, mLooper);
+ break;
+ case HVAC_SERVICE:
+ manager = new CarHvacManager(binder, mContext, mLooper);
+ break;
+ case RADIO_SERVICE:
+ manager = new CarRadioManager(binder, mLooper);
+ break;
+ case TEST_SERVICE:
+ /* CarTestManager exist in static library. So instead of constructing it here,
+ * only pass binder wrapper so that CarTestManager can be constructed outside. */
+ manager = new CarTestManagerBinderWrapper(binder);
+ break;
+ }
+ return manager;
+ }
+
+ private void startCarService() {
+ Intent intent = new Intent();
+ intent.setPackage(CAR_SERVICE_PACKAGE);
+ intent.setAction(Car.CAR_SERVICE_INTERFACE_NAME);
+ mContext.startService(intent);
+ mContext.bindService(intent, mServiceConnectionListener, 0);
+ }
+
private synchronized ICar getICarOrThrow() throws IllegalStateException {
if (mService == null) {
throw new IllegalStateException("not connected");
@@ -533,11 +505,6 @@
disconnect();
}
- private void handleRemoteExceptionAndThrow(RemoteException e) throws CarNotConnectedException {
- handleRemoteException(e);
- throw new CarNotConnectedException(e);
- }
-
private void tearDownCarManagers() {
synchronized (mCarManagerLock) {
for (CarManagerBase manager: mServiceMap.values()) {
@@ -547,7 +514,7 @@
}
}
- private void handleCarConnected(int connectionType) {
+ private void handleCarConnected() {
synchronized (this) {
mCarConnectionListenersForEvent.clear();
mCarConnectionConnectedListeners.addAll(mCarConnectionNotConnectedListeners);
@@ -555,7 +522,7 @@
mCarConnectionNotConnectedListeners.clear();
}
for (CarConnectionListener listener : mCarConnectionListenersForEvent) {
- listener.onConnected(connectionType);
+ listener.onConnected(CONNECTION_TYPE_EMBEDDED);
}
}
@@ -572,22 +539,15 @@
}
private static class ICarConnectionListenerImpl extends ICarConnectionListener.Stub {
- private static final int CAR_CONNECTION_LISTENER_VERSION = 1;
- private static final int CONNECTION_TYPE_INVALID = -1;
private final WeakReference<Car> mCar;
- private int mCurrentConnectionType = CONNECTION_TYPE_INVALID;
private ICarConnectionListenerImpl(Car car) {
mCar = new WeakReference<>(car);
}
- public synchronized int getCurrentConnectionType() {
- return mCurrentConnectionType;
- }
-
@Override
- public void onConnected(final int connectionType) {
+ public void onConnected() {
final Car car = mCar.get();
if (car == null) {
return;
@@ -595,10 +555,7 @@
car.mEventHandler.post(new Runnable() {
@Override
public void run() {
- synchronized (this) {
- mCurrentConnectionType = connectionType;
- }
- car.handleCarConnected(connectionType);
+ car.handleCarConnected();
}
});
}
@@ -612,9 +569,6 @@
car.mEventHandler.post(new Runnable() {
@Override
public void run() {
- synchronized (this) {
- mCurrentConnectionType = CONNECTION_TYPE_INVALID;
- }
car.handleCarDisconnected();
}
});
diff --git a/car-libs/car-core/src/android/support/car/CarApiUtil.java b/car-lib/src/android/car/CarApiUtil.java
similarity index 95%
copy from car-libs/car-core/src/android/support/car/CarApiUtil.java
copy to car-lib/src/android/car/CarApiUtil.java
index f3d3dba..aea45d7 100644
--- a/car-libs/car-core/src/android/support/car/CarApiUtil.java
+++ b/car-lib/src/android/car/CarApiUtil.java
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
/**
* Internal helper utilities
* @hide
*/
-public class CarApiUtil {
+public final class CarApiUtil {
/**
* CarService throws IllegalStateException with this message is re-thrown as
@@ -77,4 +77,6 @@
}
}
+ /** do not use */
+ private CarApiUtil() {};
}
diff --git a/car-libs/car-core/src/android/support/car/CarAppContextManager.java b/car-lib/src/android/car/CarAppContextManager.java
similarity index 95%
rename from car-libs/car-core/src/android/support/car/CarAppContextManager.java
rename to car-lib/src/android/car/CarAppContextManager.java
index 54f09aa..3fb47a9 100644
--- a/car-libs/car-core/src/android/support/car/CarAppContextManager.java
+++ b/car-lib/src/android/car/CarAppContextManager.java
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
@@ -78,8 +79,8 @@
/**
* @hide
*/
- CarAppContextManager(IAppContext service, Looper looper) {
- mService = service;
+ CarAppContextManager(IBinder service, Looper looper) {
+ mService = IAppContext.Stub.asInterface(service);
mHandler = new Handler(looper);
mBinderListener = new IAppContextListenerImpl(this);
}
@@ -97,8 +98,7 @@
}
if (mListener == null || mContextFilter != contextFilter) {
try {
- mService.registerContextListener(IAppContextListenerImpl.CLIENT_VERSION,
- mBinderListener, contextFilter);
+ mService.registerContextListener(mBinderListener, contextFilter);
} catch (RemoteException e) {
//ignore as CarApi will handle disconnection anyway.
}
@@ -209,7 +209,6 @@
}
private static class IAppContextListenerImpl extends IAppContextListener.Stub {
- private static final int CLIENT_VERSION = 1;
private final WeakReference<CarAppContextManager> mManager;
diff --git a/car-lib/src/android/car/CarConnectionListener.java b/car-lib/src/android/car/CarConnectionListener.java
new file mode 100644
index 0000000..603f393
--- /dev/null
+++ b/car-lib/src/android/car/CarConnectionListener.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 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;
+
+/**
+ * Listener for monitoring car's connection status.
+ * Callbacks are called from the looper specified when constructing {@link Car}.
+ */
+public interface CarConnectionListener {
+ /**
+ * Car has been connected. Does not guarantee that the car is still connected whilst this
+ * callback is running, so {@link CarNotConnectedException}s may still be thrown from
+ * {@link Car} method calls.
+ * @param connectionType Type of car connected.
+ */
+ void onConnected(@Car.ConnectionType int connectionType);
+ /** Car disconnected */
+ void onDisconnected();
+}
diff --git a/car-libs/car-core/src/android/support/car/CarInfoManager.java b/car-lib/src/android/car/CarInfoManager.java
similarity index 96%
rename from car-libs/car-core/src/android/support/car/CarInfoManager.java
rename to car-lib/src/android/car/CarInfoManager.java
index 76302ba..3813bba 100644
--- a/car-libs/car-core/src/android/support/car/CarInfoManager.java
+++ b/car-lib/src/android/car/CarInfoManager.java
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
+import android.car.annotation.ValueTypeDef;
import android.os.Bundle;
+import android.os.IBinder;
import android.os.RemoteException;
-import android.support.car.annotation.ValueTypeDef;
import java.lang.reflect.Field;
import java.util.HashMap;
@@ -157,8 +158,8 @@
}
/** @hide */
- CarInfoManager(ICarInfo service) {
- mService = service;
+ CarInfoManager(IBinder service) {
+ mService = ICarInfo.Stub.asInterface(service);
}
/** @hide */
diff --git a/car-libs/car-core/src/android/support/car/IAppContextListener.aidl b/car-lib/src/android/car/CarLibLog.java
similarity index 72%
copy from car-libs/car-core/src/android/support/car/IAppContextListener.aidl
copy to car-lib/src/android/car/CarLibLog.java
index d170936..4817a36 100644
--- a/car-libs/car-core/src/android/support/car/IAppContextListener.aidl
+++ b/car-lib/src/android/car/CarLibLog.java
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
-/** {@CompatibilityApi} */
-oneway interface IAppContextListener {
- void onAppContextChange(int activeContexts) = 0;
- void onAppContextOwnershipLoss(int context) = 1;
+/** @hide */
+public class CarLibLog {
+ public static final String TAG_CAR = "CAR.L";
+ public static final String TAG_SENSOR = TAG_CAR + ".SENSOR";
+ public static final String TAG_NAV = TAG_CAR + ".NAV";
}
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.aidl b/car-lib/src/android/car/CarManagerBase.java
similarity index 80%
copy from car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.aidl
copy to car-lib/src/android/car/CarManagerBase.java
index 9013d63..737f356 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.aidl
+++ b/car-lib/src/android/car/CarManagerBase.java
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car;
-parcelable CarHvacEvent;
-
+/**
+ * Common interface for Car*Manager
+ * @hide
+ */
+public interface CarManagerBase {
+ void onCarDisconnected();
+}
diff --git a/car-lib/src/android/car/CarNotConnectedException.java b/car-lib/src/android/car/CarNotConnectedException.java
new file mode 100644
index 0000000..38d34cf
--- /dev/null
+++ b/car-lib/src/android/car/CarNotConnectedException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 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;
+
+
+/**
+ * Exception thrown when car is not connected for the API which requires car connection.
+ */
+public class CarNotConnectedException extends Exception {
+ private static final long serialVersionUID = -5629175439268813047L;
+
+ public CarNotConnectedException() {
+ }
+
+ public CarNotConnectedException(String name) {
+ super(name);
+ }
+
+ public CarNotConnectedException(String name, Throwable cause) {
+ super(name, cause);
+ }
+
+ public CarNotConnectedException(Exception cause) {
+ super(cause);
+ }
+}
diff --git a/car-lib/src/android/car/CarNotSupportedException.java b/car-lib/src/android/car/CarNotSupportedException.java
new file mode 100644
index 0000000..10deaef
--- /dev/null
+++ b/car-lib/src/android/car/CarNotSupportedException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 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;
+
+
+/**
+ * Exception thrown when car is not supporting the requested operation.
+ */
+public class CarNotSupportedException extends Exception {
+ private static final long serialVersionUID = -8120487541467522808L;
+
+ public CarNotSupportedException() {
+ }
+
+ public CarNotSupportedException(String name) {
+ super(name);
+ }
+
+ public CarNotSupportedException(String name, Throwable cause) {
+ super(name, cause);
+ }
+
+ public CarNotSupportedException(Exception cause) {
+ super(cause);
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/IAppContext.aidl b/car-lib/src/android/car/IAppContext.aidl
similarity index 76%
rename from car-libs/car-core/src/android/support/car/IAppContext.aidl
rename to car-lib/src/android/car/IAppContext.aidl
index 9553e99..5f63c9b 100644
--- a/car-libs/car-core/src/android/support/car/IAppContext.aidl
+++ b/car-lib/src/android/car/IAppContext.aidl
@@ -14,20 +14,19 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
-import android.support.car.IAppContextListener;
+import android.car.IAppContextListener;
-/** {@CompatibilityApi} */
+/** @hide */
interface IAppContext {
- int getVersion() = 0;
- void registerContextListener(int clientVersion, IAppContextListener listener, int filter) = 1;
- void unregisterContextListener(IAppContextListener listener) = 2;
- int getActiveAppContexts() = 3;
+ void registerContextListener(IAppContextListener listener, int filter) = 0;
+ void unregisterContextListener(IAppContextListener listener) = 1;
+ int getActiveAppContexts() = 2;
/** listener used as a token */
- boolean isOwningContext(IAppContextListener listener, int context) = 4;
+ boolean isOwningContext(IAppContextListener listener, int context) = 3;
/** listener used as a token */
- void setActiveContexts(IAppContextListener listener, int contexts) = 5;
+ void setActiveContexts(IAppContextListener listener, int contexts) = 4;
/** listener used as a token */
- void resetActiveContexts(IAppContextListener listener, int contexts) = 6;
+ void resetActiveContexts(IAppContextListener listener, int contexts) = 5;
}
diff --git a/car-libs/car-core/src/android/support/car/IAppContextListener.aidl b/car-lib/src/android/car/IAppContextListener.aidl
similarity index 92%
rename from car-libs/car-core/src/android/support/car/IAppContextListener.aidl
rename to car-lib/src/android/car/IAppContextListener.aidl
index d170936..0fdf103 100644
--- a/car-libs/car-core/src/android/support/car/IAppContextListener.aidl
+++ b/car-lib/src/android/car/IAppContextListener.aidl
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
-/** {@CompatibilityApi} */
+/** @hide */
oneway interface IAppContextListener {
void onAppContextChange(int activeContexts) = 0;
void onAppContextOwnershipLoss(int context) = 1;
diff --git a/car-libs/car-core/src/android/support/car/ICar.aidl b/car-lib/src/android/car/ICar.aidl
similarity index 66%
rename from car-libs/car-core/src/android/support/car/ICar.aidl
rename to car-lib/src/android/car/ICar.aidl
index fb5112c..01551bc 100644
--- a/car-libs/car-core/src/android/support/car/ICar.aidl
+++ b/car-lib/src/android/car/ICar.aidl
@@ -14,18 +14,16 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
import android.content.Intent;
-import android.support.car.ICarConnectionListener;
+import android.car.ICarConnectionListener;
-/** {@CompatibilityApi} */
+/** @hide */
interface ICar {
- int getVersion() = 0;
- IBinder getCarService(in String serviceName) = 1;
- boolean isConnectedToCar() = 2;
- int getCarConnectionType() = 3;
- void registerCarConnectionListener(int clientVersion, in ICarConnectionListener listener) = 4;
- void unregisterCarConnectionListener(in ICarConnectionListener listener) = 5;
+ IBinder getCarService(in String serviceName) = 0;
+ boolean isConnectedToCar() = 1;
+ void registerCarConnectionListener(in ICarConnectionListener listener) = 2;
+ void unregisterCarConnectionListener(in ICarConnectionListener listener) = 3;
}
diff --git a/car-libs/car-core/src/android/support/car/ICarConnectionListener.aidl b/car-lib/src/android/car/ICarConnectionListener.aidl
similarity index 85%
rename from car-libs/car-core/src/android/support/car/ICarConnectionListener.aidl
rename to car-lib/src/android/car/ICarConnectionListener.aidl
index 3867b6d..9504b68 100644
--- a/car-libs/car-core/src/android/support/car/ICarConnectionListener.aidl
+++ b/car-lib/src/android/car/ICarConnectionListener.aidl
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
/**
* Binder callback for CarConnectionListener.
- * {@CompatibilityApi}
+ * @hide
*/
oneway interface ICarConnectionListener {
- void onConnected(int connectionType);
- void onDisconnected();
+ void onConnected() = 0;
+ void onDisconnected() = 1;
}
diff --git a/car-libs/car-core/src/android/support/car/ICarInfo.aidl b/car-lib/src/android/car/ICarInfo.aidl
similarity index 80%
rename from car-libs/car-core/src/android/support/car/ICarInfo.aidl
rename to car-lib/src/android/car/ICarInfo.aidl
index 8184ea0..e69fe85 100644
--- a/car-libs/car-core/src/android/support/car/ICarInfo.aidl
+++ b/car-lib/src/android/car/ICarInfo.aidl
@@ -14,28 +14,27 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car;
import android.os.Bundle;
-/** {@CompatibilityApi} */
+/** @hide */
interface ICarInfo {
- int getVersion() = 0;
/**
* Even if it returns array, it will always be single element array. Array used to allow
* returning null if not supported.
*/
- int[] getInt(String key) = 1;
+ int[] getInt(String key) = 0;
/**
* Even if it returns array, it will always be single element array. Array used to allow
* returning null if not supported.
*/
- float[] getFloat(String key) = 2;
+ float[] getFloat(String key) = 1;
/**
* Even if it returns array, it will always be single element array. Array used to allow
* returning null if not supported.
*/
- long[] getLong(String key) = 3;
- String getString(String key) = 4;
- Bundle getBundle(String key) = 5;
+ long[] getLong(String key) = 2;
+ String getString(String key) = 3;
+ Bundle getBundle(String key) = 4;
}
diff --git a/car-libs/car-system/src/android/support/car/VehicleDoor.java b/car-lib/src/android/car/VehicleDoor.java
similarity index 94%
rename from car-libs/car-system/src/android/support/car/VehicleDoor.java
rename to car-lib/src/android/car/VehicleDoor.java
index f342f1f..f5a63d0 100644
--- a/car-libs/car-system/src/android/support/car/VehicleDoor.java
+++ b/car-lib/src/android/car/VehicleDoor.java
@@ -13,13 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car;
+package android.car;
+
+import android.annotation.SystemApi;
/**
* VehicleDoor is an abstraction for a door in a car. Some car APIs may provide control per
* door and values defined here should be used to distinguish different doors.
* @hide
*/
+@SystemApi
public class VehicleDoor {
public static final int DOOR_ROW_1_LEFT = 0x00000001;
public static final int DOOR_ROW_1_RIGHT = 0x00000004;
diff --git a/car-libs/car-system/src/android/support/car/VehicleSeat.java b/car-lib/src/android/car/VehicleSeat.java
similarity index 90%
rename from car-libs/car-system/src/android/support/car/VehicleSeat.java
rename to car-lib/src/android/car/VehicleSeat.java
index b6ea105..8ecf12f 100644
--- a/car-libs/car-system/src/android/support/car/VehicleSeat.java
+++ b/car-lib/src/android/car/VehicleSeat.java
@@ -13,14 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car;
+package android.car;
+
+import android.annotation.SystemApi;
/**
* VehicleSeat is an abstraction for a seat in a car. Some car APIs like
- * {@link android.support.car.hardware.hvac.CarHvacProperty} may provide control per seat and
+ * {@link android.car.hardware.hvac.CarHvacProperty} may provide control per seat and
* values defined here should be used to distinguish different seats.
* @hide
*/
+@SystemApi
public class VehicleSeat {
public static final int SEAT_DRIVER_LHD = 0x0001;
public static final int SEAT_DRIVER_RHD = 0x0002;
diff --git a/car-libs/car-system/src/android/support/car/VehicleWindow.java b/car-lib/src/android/car/VehicleWindow.java
similarity index 94%
rename from car-libs/car-system/src/android/support/car/VehicleWindow.java
rename to car-lib/src/android/car/VehicleWindow.java
index ef46062..1afa68c 100644
--- a/car-libs/car-system/src/android/support/car/VehicleWindow.java
+++ b/car-lib/src/android/car/VehicleWindow.java
@@ -13,13 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car;
+package android.car;
+
+import android.annotation.SystemApi;
/**
* VehicleWindow is an abstraction for a window in a car. Some car APIs may provide control per
* window and values defined here should be used to distinguish different windows.
* @hide
*/
+@SystemApi
public class VehicleWindow {
public static final int WINDOW_FRONT_WINDSHIELD = 0x0001;
public static final int WINDOW_REAR_WINDSHIELD = 0x0002;
diff --git a/car-libs/car-system/src/android/support/car/VehicleZone.java b/car-lib/src/android/car/VehicleZone.java
similarity index 91%
rename from car-libs/car-system/src/android/support/car/VehicleZone.java
rename to car-lib/src/android/car/VehicleZone.java
index 08296f5..a6d5eb5 100644
--- a/car-libs/car-system/src/android/support/car/VehicleZone.java
+++ b/car-lib/src/android/car/VehicleZone.java
@@ -13,14 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car;
+package android.car;
+
+import android.annotation.SystemApi;
/**
* VehicleZone is an abstraction for an area in a car. Some car APIs like
- * {@link android.support.car.hardware.hvac.CarHvacProperty} needs to handle zone and values defined
+ * {@link android.car.hardware.hvac.CarHvacProperty} needs to handle zone and values defined
* here should be used.
* @hide
*/
+@SystemApi
public class VehicleZone {
public static final int ZONE_ROW_1_LEFT = 0x00000001;
public static final int ZONE_ROW_1_CENTER = 0x00000002;
diff --git a/car-lib/src/android/car/annotation/ValueTypeDef.java b/car-lib/src/android/car/annotation/ValueTypeDef.java
new file mode 100644
index 0000000..3764fd2
--- /dev/null
+++ b/car-lib/src/android/car/annotation/ValueTypeDef.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 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.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for specifying value type for key - value pair.
+ * Key definition will have this annotation to specify what kind of value is expected from the key.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ValueTypeDef {
+ Class type() default Object.class;
+}
diff --git a/car-libs/car-core/src/android/support/car/app/menu/CarUiEntry.java b/car-lib/src/android/car/app/menu/CarUiEntry.java
similarity index 95%
copy from car-libs/car-core/src/android/support/car/app/menu/CarUiEntry.java
copy to car-lib/src/android/car/app/menu/CarUiEntry.java
index ee699d4..b4968c8 100644
--- a/car-libs/car-core/src/android/support/car/app/menu/CarUiEntry.java
+++ b/car-lib/src/android/car/app/menu/CarUiEntry.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.app.menu;
+package android.car.app.menu;
import android.content.Context;
import android.graphics.Bitmap;
@@ -28,13 +28,12 @@
*
* A CarUi provider provides essential ui elements that a car app may want to use. The CarUi is
* loaded by apps at runtime, similar to a shared library, but via reflection through a class that
- * extends {@link android.support.car.app.menu.CarUiEntry} from a separate apk
+ * extends {@link android.car.app.menu.CarUiEntry} from a separate apk
* called CarUiProvider. Depending on the different platforms, the CarUiProvider may
* be different and can be customized by different car makers. However, it is required that a
* set of basic ui elements and functionalities exist in the CarUiProvider. This class defines
* the set of must have functions in a CarUiProvider.
*/
-/** {@CompatibilityApi} */
public abstract class CarUiEntry {
protected Context mAppContext;
protected Context mUiLibContext;
diff --git a/car-libs/car-core/src/android/support/car/content/pm/AppBlockingPackageInfo.java b/car-lib/src/android/car/content/pm/AppBlockingPackageInfo.java
similarity index 88%
rename from car-libs/car-core/src/android/support/car/content/pm/AppBlockingPackageInfo.java
rename to car-lib/src/android/car/content/pm/AppBlockingPackageInfo.java
index e470645..d637c7d 100644
--- a/car-libs/car-core/src/android/support/car/content/pm/AppBlockingPackageInfo.java
+++ b/car-lib/src/android/car/content/pm/AppBlockingPackageInfo.java
@@ -13,15 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
+import android.annotation.IntDef;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.content.pm.Signature;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.IntDef;
-import android.support.annotation.Nullable;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -29,13 +28,11 @@
/**
* Parcelable to hold information on app blocking whitelist or blacklist for a package.
- * @hide
- * {@CompatibilityApi}
*/
-public class AppBlockingPackageInfo extends ExtendableParcelable {
+@SystemApi
+public class AppBlockingPackageInfo implements Parcelable {
/** Package name for the package to block or allow. */
- @VersionDef(version = 1)
public final String packageName;
/** Represents system app which does not need {@link #signature}. */
@@ -54,7 +51,6 @@
* @see #FLAG_SYSTEM_APP
* @see #FLAG_WHOLE_ACTIVITY
*/
- @VersionDef(version = 1)
public final int flags;
/**
@@ -62,7 +58,6 @@
* (package version > minRevisionCode)
* 0 means do not care min version.
*/
- @VersionDef(version = 1)
public final int minRevisionCode;
/**
@@ -70,7 +65,6 @@
* (package version < minRevisionCode)
* 0 means do not care max version.
*/
- @VersionDef(version = 1)
public final int maxRevisionCode;
/**
@@ -78,21 +72,17 @@
* name is enough to uniquely identify it (= {@link #flags} having {@link #FLAG_SYSTEM_APP}.
* Matching any member of array is considered as matching package.
*/
- @VersionDef(version = 1)
public final Signature[] signatures;
/** List of activities (full class name). This can be null if Activity is not blocked or
* allowed. Additionally, {@link #FLAG_WHOLE_ACTIVITY} set in {@link #flags} shall have
* null for this. */
- @VersionDef(version = 1)
public final String[] activities;
- private static final int VERSION = 1;
public AppBlockingPackageInfo(String packageName, int minRevisionCode, int maxRevisionCode,
@ConstrcutorFlags int flags, @Nullable Signature[] signatures,
@Nullable String[] activities) {
- super(VERSION);
if (packageName == null) {
throw new IllegalArgumentException("packageName cannot be null");
}
@@ -106,8 +96,6 @@
}
public AppBlockingPackageInfo(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
packageName = in.readString();
flags = in.readInt();
minRevisionCode= in.readInt();
@@ -115,7 +103,6 @@
signatures = in.createTypedArray(Signature.CREATOR);
activities = in.createStringArray();
verify();
- completeReading(in, lastPosition);
}
@Override
@@ -125,14 +112,12 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- int startingPosition = writeHeader(dest);
dest.writeString(packageName);
dest.writeInt(this.flags);
dest.writeInt(minRevisionCode);
dest.writeInt(maxRevisionCode);
dest.writeTypedArray(signatures, 0);
dest.writeStringArray(activities);
- completeWriting(dest, startingPosition);
}
public static final Parcelable.Creator<AppBlockingPackageInfo> CREATOR
@@ -176,7 +161,6 @@
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + version;
result = prime * result + Arrays.hashCode(activities);
result = prime * result + flags;
result = prime * result + maxRevisionCode;
@@ -198,9 +182,6 @@
return false;
}
AppBlockingPackageInfo other = (AppBlockingPackageInfo) obj;
- if (version != other.version) {
- return false;
- }
if (!Arrays.equals(activities, other.activities)) {
return false;
}
diff --git a/car-libs/car-core/src/android/support/car/content/pm/CarAppBlockingPolicy.aidl b/car-lib/src/android/car/content/pm/CarAppBlockingPolicy.aidl
similarity index 93%
rename from car-libs/car-core/src/android/support/car/content/pm/CarAppBlockingPolicy.aidl
rename to car-lib/src/android/car/content/pm/CarAppBlockingPolicy.aidl
index d0a130c..06348c8 100644
--- a/car-libs/car-core/src/android/support/car/content/pm/CarAppBlockingPolicy.aidl
+++ b/car-lib/src/android/car/content/pm/CarAppBlockingPolicy.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
parcelable CarAppBlockingPolicy;
diff --git a/car-libs/car-core/src/android/support/car/content/pm/CarAppBlockingPolicy.java b/car-lib/src/android/car/content/pm/CarAppBlockingPolicy.java
similarity index 75%
rename from car-libs/car-core/src/android/support/car/content/pm/CarAppBlockingPolicy.java
rename to car-lib/src/android/car/content/pm/CarAppBlockingPolicy.java
index 9f93779..fd60034 100644
--- a/car-libs/car-core/src/android/support/car/content/pm/CarAppBlockingPolicy.java
+++ b/car-lib/src/android/car/content/pm/CarAppBlockingPolicy.java
@@ -14,12 +14,11 @@
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
import android.util.Log;
import java.lang.reflect.InvocationTargetException;
@@ -28,19 +27,14 @@
/**
* Contains application blocking policy
- * @hide
- * {@CompatibilityApi}
*/
-public class CarAppBlockingPolicy extends ExtendableParcelable {
+@SystemApi
+public class CarAppBlockingPolicy implements Parcelable {
private static final String TAG = CarAppBlockingPolicy.class.getSimpleName();
- @VersionDef(version = 1)
public final AppBlockingPackageInfo[] whitelists;
- @VersionDef(version = 1)
public final AppBlockingPackageInfo[] blacklists;
- private static final int VERSION = 1;
-
private static final Method sReadBlobMethod;
private static final Method sWriteBlobMethod;
@@ -62,25 +56,12 @@
public CarAppBlockingPolicy(AppBlockingPackageInfo[] whitelists,
AppBlockingPackageInfo[] blacklists) {
- super(VERSION);
this.whitelists = whitelists;
this.blacklists = blacklists;
}
public CarAppBlockingPolicy(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
- byte[] payload;
- if (sReadBlobMethod != null) {
- try {
- payload = (byte[]) sReadBlobMethod.invoke(in);
- } catch (IllegalAccessException | InvocationTargetException e) {
- Log.e(TAG, ":cannot call readBlob", e);
- payload = in.createByteArray();
- }
- } else {
- payload = in.createByteArray();
- }
+ byte[] payload = in.readBlob();
Parcel payloadParcel = Parcel.obtain();
payloadParcel.unmarshall(payload, 0, payload.length);
// reset to initial position to read
@@ -88,7 +69,6 @@
whitelists = payloadParcel.createTypedArray(AppBlockingPackageInfo.CREATOR);
blacklists = payloadParcel.createTypedArray(AppBlockingPackageInfo.CREATOR);
payloadParcel.recycle();
- completeReading(in, lastPosition);
}
@Override
@@ -98,23 +78,12 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- int startingPosition = writeHeader(dest);
Parcel payloadParcel = Parcel.obtain();
payloadParcel.writeTypedArray(whitelists, 0);
payloadParcel.writeTypedArray(blacklists, 0);
byte[] payload = payloadParcel.marshall();
- if (sWriteBlobMethod != null) {
- try {
- sWriteBlobMethod.invoke(dest, payload);
- } catch (IllegalAccessException | InvocationTargetException e) {
- Log.e(TAG, ":cannot call writeBlob", e);
- dest.writeByteArray(payload);
- }
- } else {
- dest.writeByteArray(payload);
- }
+ dest.writeBlob(payload);
payloadParcel.recycle();
- completeWriting(dest, startingPosition);
}
public static final Parcelable.Creator<CarAppBlockingPolicy> CREATOR
diff --git a/car-libs/car-system/src/android/support/car/content/pm/CarAppBlockingPolicyService.java b/car-lib/src/android/car/content/pm/CarAppBlockingPolicyService.java
similarity index 90%
rename from car-libs/car-system/src/android/support/car/content/pm/CarAppBlockingPolicyService.java
rename to car-lib/src/android/car/content/pm/CarAppBlockingPolicyService.java
index bf092d9..1682a8f 100644
--- a/car-libs/car-system/src/android/support/car/content/pm/CarAppBlockingPolicyService.java
+++ b/car-lib/src/android/car/content/pm/CarAppBlockingPolicyService.java
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
+import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
@@ -25,19 +26,18 @@
/**
* Service to be implemented by Service which wants to control app blocking policy.
- * App should require android.support.car.permission.CONTROL_APP_BLOCKING to launch Service
+ * App should require android.car.permission.CONTROL_APP_BLOCKING to launch Service
* implementation. Additionally the APK should have the permission to be launched by Car Service.
* The implementing service should declare {@link #SERVICE_INTERFACE} in its intent filter as
* action.
*/
+@SystemApi
public abstract class CarAppBlockingPolicyService extends Service {
private static final String TAG = CarAppBlockingPolicyService.class.getSimpleName();
public static final String SERVICE_INTERFACE =
- "android.support.car.content.pm.CarAppBlockingPolicyService";
-
- private static final int VERSION = 1;
+ "android.car.content.pm.CarAppBlockingPolicyService";
private final ICarAppBlockingPoicyImpl mBinder = new ICarAppBlockingPoicyImpl();
private Handler mHandler;
diff --git a/car-libs/car-core/src/android/support/car/content/pm/CarPackageManager.java b/car-lib/src/android/car/content/pm/CarPackageManager.java
similarity index 92%
rename from car-libs/car-core/src/android/support/car/content/pm/CarPackageManager.java
rename to car-lib/src/android/car/content/pm/CarPackageManager.java
index 55af205..625f999 100644
--- a/car-libs/car-core/src/android/support/car/content/pm/CarPackageManager.java
+++ b/car-lib/src/android/car/content/pm/CarPackageManager.java
@@ -14,15 +14,17 @@
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
+import android.annotation.IntDef;
+import android.annotation.SystemApi;
+import android.car.CarApiUtil;
+import android.car.CarManagerBase;
+import android.car.CarNotConnectedException;
import android.content.Context;
+import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
-import android.support.annotation.IntDef;
-import android.support.car.CarApiUtil;
-import android.support.car.CarManagerBase;
-import android.support.car.CarNotConnectedException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -36,8 +38,8 @@
* Flag for {@link #setAppBlockingPolicy(String, CarAppBlockingPolicy, int)}. When this
* flag is set, the call will be blocked until policy is set to system. This can take time
* and the flag cannot be used in main thread.
- * @hide
*/
+ @SystemApi
public static final int FLAG_SET_POLICY_WAIT_FOR_CHANGE = 0x1;
/**
* Flag for {@link #setAppBlockingPolicy(String, CarAppBlockingPolicy, int)}. When this
@@ -45,16 +47,16 @@
* If none of {@link #FLAG_SET_POLICY_ADD} or {@link #FLAG_SET_POLICY_REMOVE} is set, existing
* policy is replaced. Note that policy per each package is always replaced and will not be
* added.
- * @hide
*/
+ @SystemApi
public static final int FLAG_SET_POLICY_ADD = 0x2;
/**
* Flag for {@link #setAppBlockingPolicy(String, CarAppBlockingPolicy, int)}. When this
* flag is set, passed policy is removed from existing policy set from the current package.
* If none of {@link #FLAG_SET_POLICY_ADD} or {@link #FLAG_SET_POLICY_REMOVE} is set, existing
* policy is replaced.
- * @hide
*/
+ @SystemApi
public static final int FLAG_SET_POLICY_REMOVE = 0x4;
/** @hide */
@@ -67,8 +69,8 @@
private final Context mContext;
/** @hide */
- public CarPackageManager(ICarPackageManager service, Context context) {
- mService = service;
+ public CarPackageManager(IBinder service, Context context) {
+ mService = ICarPackageManager.Stub.asInterface(service);
mContext = context;
}
@@ -96,8 +98,8 @@
* @throws IllegalArgumentException For wrong or invalid arguments.
* @throws IllegalStateException If {@link #FLAG_SET_POLICY_WAIT_FOR_CHANGE} is set while
* called from main thread.
- * @hide
*/
+ @SystemApi
public void setAppBlockingPolicy(String packageName, CarAppBlockingPolicy policy,
@SetPolicyFlags int flags) throws CarNotConnectedException, SecurityException,
IllegalArgumentException {
diff --git a/car-libs/car-system/src/android/support/car/content/pm/ICarAppBlockingPolicy.aidl b/car-lib/src/android/car/content/pm/ICarAppBlockingPolicy.aidl
similarity index 78%
rename from car-libs/car-system/src/android/support/car/content/pm/ICarAppBlockingPolicy.aidl
rename to car-lib/src/android/car/content/pm/ICarAppBlockingPolicy.aidl
index 7bfc0e9..0de26d5 100644
--- a/car-libs/car-system/src/android/support/car/content/pm/ICarAppBlockingPolicy.aidl
+++ b/car-lib/src/android/car/content/pm/ICarAppBlockingPolicy.aidl
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
-import android.support.car.content.pm.CarAppBlockingPolicy;
-import android.support.car.content.pm.ICarAppBlockingPolicySetter;
+import android.car.content.pm.CarAppBlockingPolicy;
+import android.car.content.pm.ICarAppBlockingPolicySetter;
/**
* Implemented by CarAppBlockingPolicyService
- * {@CompatibilityApi}
+ * @hide
*/
oneway interface ICarAppBlockingPolicy {
- void setAppBlockingPolicySetter(in ICarAppBlockingPolicySetter setter) = 1;
+ void setAppBlockingPolicySetter(in ICarAppBlockingPolicySetter setter) = 0;
}
diff --git a/car-libs/car-system/src/android/support/car/content/pm/ICarAppBlockingPolicySetter.aidl b/car-lib/src/android/car/content/pm/ICarAppBlockingPolicySetter.aidl
similarity index 85%
rename from car-libs/car-system/src/android/support/car/content/pm/ICarAppBlockingPolicySetter.aidl
rename to car-lib/src/android/car/content/pm/ICarAppBlockingPolicySetter.aidl
index 847ff17..101bfba 100644
--- a/car-libs/car-system/src/android/support/car/content/pm/ICarAppBlockingPolicySetter.aidl
+++ b/car-lib/src/android/car/content/pm/ICarAppBlockingPolicySetter.aidl
@@ -14,16 +14,15 @@
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
-import android.support.car.content.pm.CarAppBlockingPolicy;
+import android.car.content.pm.CarAppBlockingPolicy;
/**
* Passed to CarAppBlockingPolicyService to allow setting policy. This also works as a unique
token per each Service. Caller still needs permission to set policy.
- * {@CompatibilityApi}
+ * @hide
*/
interface ICarAppBlockingPolicySetter {
- int getVersion() = 0;
- void setAppBlockingPolicy(in CarAppBlockingPolicy policy) = 1;
+ void setAppBlockingPolicy(in CarAppBlockingPolicy policy) = 0;
}
diff --git a/car-libs/car-core/src/android/support/car/content/pm/ICarPackageManager.aidl b/car-lib/src/android/car/content/pm/ICarPackageManager.aidl
similarity index 77%
rename from car-libs/car-core/src/android/support/car/content/pm/ICarPackageManager.aidl
rename to car-lib/src/android/car/content/pm/ICarPackageManager.aidl
index 5a6c328..d451187 100644
--- a/car-libs/car-core/src/android/support/car/content/pm/ICarPackageManager.aidl
+++ b/car-lib/src/android/car/content/pm/ICarPackageManager.aidl
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-package android.support.car.content.pm;
+package android.car.content.pm;
-import android.support.car.content.pm.CarAppBlockingPolicy;
+import android.car.content.pm.CarAppBlockingPolicy;
-/** {@CompatibilityApi} */
+/** @hide */
interface ICarPackageManager {
- int getVersion() = 0;
- void setAppBlockingPolicy(in String packageName, in CarAppBlockingPolicy policy, int flags) = 1;
- boolean isActivityAllowedWhileDriving(in String packageName, in String className) = 2;
- boolean isServiceAllowedWhileDriving(in String packageName, in String className) = 3;
+ void setAppBlockingPolicy(in String packageName, in CarAppBlockingPolicy policy, int flags) = 0;
+ boolean isActivityAllowedWhileDriving(in String packageName, in String className) = 1;
+ boolean isServiceAllowedWhileDriving(in String packageName, in String className) = 2;
}
diff --git a/car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.aidl b/car-lib/src/android/car/hardware/CarSensorEvent.aidl
similarity index 94%
rename from car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.aidl
rename to car-lib/src/android/car/hardware/CarSensorEvent.aidl
index 433221b..df877f0 100644
--- a/car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.aidl
+++ b/car-lib/src/android/car/hardware/CarSensorEvent.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.support.car.hardware;
+package android.car.hardware;
parcelable CarSensorEvent;
diff --git a/car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.java b/car-lib/src/android/car/hardware/CarSensorEvent.java
similarity index 97%
copy from car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.java
copy to car-lib/src/android/car/hardware/CarSensorEvent.java
index e982671..afc655f 100644
--- a/car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.java
+++ b/car-lib/src/android/car/hardware/CarSensorEvent.java
@@ -14,15 +14,13 @@
* limitations under the License.
*/
-package android.support.car.hardware;
+package android.car.hardware;
import android.location.GpsSatellite;
import android.location.Location;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
/**
@@ -35,11 +33,8 @@
* returned. This parameter should be used to avoid unnecessary object churn whenever possible.
* Additionally, calling a conversion method on a CarSensorEvent object with an inappropriate type
* will result in an {@code UnsupportedOperationException} being thrown.
- * {@CompatibilityApi}
*/
-public class CarSensorEvent extends ExtendableParcelable {
-
- private static final int VERSION = 1;
+public class CarSensorEvent implements Parcelable {
/**
* Index in {@link #floatValues} for {@link CarSensorManager#SENSOR_TYPE_FUEL_LEVEL} type of
@@ -189,27 +184,21 @@
private static final long MILLI_IN_NANOS = 1000000L;
/** Sensor type for this event like {@link CarSensorManager#SENSOR_TYPE_CAR_SPEED}. */
- @VersionDef(version = 1)
public int sensorType;
/**
* When this data was acquired in car or received from car. It is elapsed real-time of data
* reception from car in nanoseconds since system boot.
*/
- @VersionDef(version = 1)
public long timeStampNs;
/**
* array holding float type of sensor data. If the sensor has single value, only floatValues[0]
* should be used. */
- @VersionDef(version = 1)
public final float[] floatValues;
/** array holding int type of sensor data */
- @VersionDef(version = 1)
public final int[] intValues;
public CarSensorEvent(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
sensorType = in.readInt();
timeStampNs = in.readLong();
int len = in.readInt();
@@ -219,7 +208,6 @@
intValues = new int[len];
in.readIntArray(intValues);
// version 1 up to here
- completeReading(in, lastPosition);
}
@Override
@@ -229,15 +217,12 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- int startingPosition = writeHeader(dest);
dest.writeInt(sensorType);
dest.writeLong(timeStampNs);
dest.writeInt(floatValues.length);
dest.writeFloatArray(floatValues);
dest.writeInt(intValues.length);
dest.writeIntArray(intValues);
- // version 1 up to here
- completeWriting(dest, startingPosition);
}
public static final Parcelable.Creator<CarSensorEvent> CREATOR
@@ -252,7 +237,6 @@
};
public CarSensorEvent(int sensorType, long timeStampNs, int floatValueSize, int intValueSize) {
- super(VERSION);
this.sensorType = sensorType;
this.timeStampNs = timeStampNs;
floatValues = new float[floatValueSize];
@@ -261,7 +245,6 @@
/** @hide */
CarSensorEvent(int sensorType, long timeStampNs, float[] floatValues, int[] intValues) {
- super(VERSION);
this.sensorType = sensorType;
this.timeStampNs = timeStampNs;
this.floatValues = floatValues;
diff --git a/car-libs/car-core/src/android/support/car/hardware/CarSensorManager.java b/car-lib/src/android/car/hardware/CarSensorManager.java
similarity index 94%
rename from car-libs/car-core/src/android/support/car/hardware/CarSensorManager.java
rename to car-lib/src/android/car/hardware/CarSensorManager.java
index 684521f..1573d69 100644
--- a/car-libs/car-core/src/android/support/car/hardware/CarSensorManager.java
+++ b/car-lib/src/android/car/hardware/CarSensorManager.java
@@ -14,21 +14,22 @@
* limitations under the License.
*/
-package android.support.car.hardware;
+package android.car.hardware;
import android.Manifest;
-import android.support.annotation.RequiresPermission;
+import android.annotation.RequiresPermission;
+import android.car.Car;
+import android.car.CarApiUtil;
+import android.car.CarLibLog;
+import android.car.CarManagerBase;
+import android.car.CarNotConnectedException;
import android.content.Context;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler.Callback;
-import android.support.car.Car;
-import android.support.car.CarApiUtil;
-import android.support.car.CarLibLog;
-import android.support.car.CarManagerBase;
-import android.support.car.CarNotConnectedException;
import android.util.Log;
import java.lang.ref.WeakReference;
@@ -154,9 +155,7 @@
private static final int MSG_SENSOR_EVENTS = 0;
- private static final int VERSION = 1;
private final ICarSensor mService;
- private final int mServiceVersion;
private CarSensorEventListenerToService mCarSensorEventListenerToService;
@@ -194,13 +193,8 @@
/** @hide */
- public CarSensorManager(Context context, ICarSensor service, Looper looper) {
- mService = service;
- mServiceVersion = getVersion();
- if (mServiceVersion < VERSION) {
- Log.w(CarLibLog.TAG_SENSOR, "Old service version:" + mServiceVersion +
- " for client lib:" + VERSION);
- }
+ public CarSensorManager(IBinder service, Context context, Looper looper) {
+ mService = ICarSensor.Stub.asInterface(service);
mHandler = new Handler(looper, mHandlerCallback);
}
@@ -213,15 +207,6 @@
}
}
- private int getVersion() {
- try {
- return mService.getVersion();
- } catch (RemoteException e) {
- Log.w(CarLibLog.TAG_SENSOR, "Exception in getVersion", e);
- }
- return 1;
- }
-
/**
* Give the list of CarSensors available in the connected car.
* @return array of all sensor types supported.
@@ -391,7 +376,7 @@
throws CarNotConnectedException {
try {
if (!mService.registerOrUpdateSensorListener(sensor, rate,
- VERSION, mCarSensorEventListenerToService)) {
+ mCarSensorEventListenerToService)) {
return false;
}
} catch (IllegalStateException e) {
diff --git a/car-libs/car-core/src/android/support/car/hardware/ICarSensor.aidl b/car-lib/src/android/car/hardware/ICarSensor.aidl
similarity index 76%
rename from car-libs/car-core/src/android/support/car/hardware/ICarSensor.aidl
rename to car-lib/src/android/car/hardware/ICarSensor.aidl
index e8c1887..c490531 100644
--- a/car-libs/car-core/src/android/support/car/hardware/ICarSensor.aidl
+++ b/car-lib/src/android/car/hardware/ICarSensor.aidl
@@ -14,16 +14,15 @@
* limitations under the License.
*/
-package android.support.car.hardware;
+package android.car.hardware;
-import android.support.car.hardware.CarSensorEvent;
-import android.support.car.hardware.ICarSensorEventListener;
+import android.car.hardware.CarSensorEvent;
+import android.car.hardware.ICarSensorEventListener;
-/** {@CompatibilityApi} */
+/** @hide */
interface ICarSensor {
- int getVersion() = 0;
- int[] getSupportedSensors() = 1;
+ int[] getSupportedSensors() = 0;
/**
* register a listener or update registration if already updated.
@@ -31,18 +30,18 @@
* @param rate sensor rate.
* @return false if requested sensors cannot be subscribed / started.
*/
- boolean registerOrUpdateSensorListener(int sensorType, int rate, int clientVersion,
- in ICarSensorEventListener listener) = 2;
+ boolean registerOrUpdateSensorListener(int sensorType, int rate,
+ in ICarSensorEventListener listener) = 1;
/**
* get latest sensor event for the type. If there was no update after car connection, it will
* return null immediately.
*/
- CarSensorEvent getLatestSensorEvent(int sensorType) = 3;
+ CarSensorEvent getLatestSensorEvent(int sensorType) = 2;
/**
* Stop listening for the given sensor type. All other sensors registered before will not
* be affected.
*/
- void unregisterSensorListener(int sensorType, in ICarSensorEventListener listener) = 4;
+ void unregisterSensorListener(int sensorType, in ICarSensorEventListener listener) = 3;
}
diff --git a/car-libs/car-core/src/android/support/car/hardware/ICarSensorEventListener.aidl b/car-lib/src/android/car/hardware/ICarSensorEventListener.aidl
similarity index 87%
rename from car-libs/car-core/src/android/support/car/hardware/ICarSensorEventListener.aidl
rename to car-lib/src/android/car/hardware/ICarSensorEventListener.aidl
index 7b687a9..fc5b07f 100644
--- a/car-libs/car-core/src/android/support/car/hardware/ICarSensorEventListener.aidl
+++ b/car-lib/src/android/car/hardware/ICarSensorEventListener.aidl
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package android.support.car.hardware;
+package android.car.hardware;
-import android.support.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorEvent;
/**
* Binder callback for CarSensorEventListener.
* This is generated per each CarClient.
- * {@CompatibilityApi}
+ * @hide
*/
oneway interface ICarSensorEventListener {
void onSensorChanged(in List<CarSensorEvent> events) = 0;
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.aidl b/car-lib/src/android/car/hardware/hvac/CarHvacEvent.aidl
similarity index 93%
rename from car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.aidl
rename to car-lib/src/android/car/hardware/hvac/CarHvacEvent.aidl
index 9013d63..801d0d3 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.aidl
+++ b/car-lib/src/android/car/hardware/hvac/CarHvacEvent.aidl
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car.hardware.hvac;
parcelable CarHvacEvent;
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.java b/car-lib/src/android/car/hardware/hvac/CarHvacEvent.java
similarity index 86%
rename from car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.java
rename to car-lib/src/android/car/hardware/hvac/CarHvacEvent.java
index d7840db..f000a4e 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacEvent.java
+++ b/car-lib/src/android/car/hardware/hvac/CarHvacEvent.java
@@ -14,48 +14,40 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car.hardware.hvac;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
-/** {@CompatibilityApi} */
-public class CarHvacEvent extends ExtendableParcelable {
+@SystemApi
+public class CarHvacEvent implements Parcelable {
public static final int HVAC_EVENT_PROPERTY_CHANGE = 0;
public static final int HVAC_EVENT_ERROR = 1;
- private static final int VERSION = 1;
/**
* EventType of this message
*/
- @VersionDef(version = 1)
private final int mEventType;
/**
* PropertyId is defined in {@link CarHvacProperty} and refers only to HVAC properties
*/
- @VersionDef(version = 1)
private final int mPropertyId;
/**
* Type denotes whether the property is a bool or integer.
*/
- @VersionDef(version = 1)
private final int mDataType;
/**
* Float value of the property
*/
- @VersionDef(version = 1)
private final float mFloatValue;
/**
* Integer value of the property
*/
- @VersionDef(version = 1)
private final int mIntValue;
/**
* Affected zone(s) for the property. Zone is a bitmask as defined in {@link CarHvacProperty}
*/
- @VersionDef(version = 1)
private final int mZone;
// Getters.
@@ -97,14 +89,12 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- int startingPosition = writeHeader(dest);
dest.writeInt(mEventType);
dest.writeInt(mPropertyId);
dest.writeInt(mDataType);
dest.writeFloat(mFloatValue);
dest.writeInt(mIntValue);
dest.writeInt(mZone);
- completeWriting(dest, startingPosition);
}
public static final Parcelable.Creator<CarHvacEvent> CREATOR
@@ -126,7 +116,6 @@
* @param value
*/
public CarHvacEvent(int eventType, int propertyId, int zone, boolean value) {
- super(VERSION);
mEventType = eventType;
mPropertyId = propertyId;
mDataType = CarHvacManager.PROPERTY_TYPE_BOOLEAN;
@@ -147,7 +136,6 @@
* @param value
*/
public CarHvacEvent(int eventType, int propertyId, int zone, float value) {
- super(VERSION);
mEventType = eventType;
mPropertyId = propertyId;
mDataType = CarHvacManager.PROPERTY_TYPE_FLOAT;
@@ -164,7 +152,6 @@
* @param value
*/
public CarHvacEvent(int eventType, int propertyId, int zone, int value) {
- super(VERSION);
mEventType = eventType;
mPropertyId = propertyId;
mDataType = CarHvacManager.PROPERTY_TYPE_INT;
@@ -174,15 +161,12 @@
}
private CarHvacEvent(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
mEventType = in.readInt();
mPropertyId = in.readInt();
mDataType = in.readInt();
mFloatValue = in.readFloat();
mIntValue = in.readInt();
mZone = in.readInt();
- completeReading(in, lastPosition);
}
public String toString() {
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacManager.java b/car-lib/src/android/car/hardware/hvac/CarHvacManager.java
similarity index 95%
rename from car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacManager.java
rename to car-lib/src/android/car/hardware/hvac/CarHvacManager.java
index de810cc..99eea23 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacManager.java
+++ b/car-lib/src/android/car/hardware/hvac/CarHvacManager.java
@@ -14,18 +14,19 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car.hardware.hvac;
import android.annotation.SystemApi;
+import android.car.Car;
+import android.car.CarManagerBase;
+import android.car.CarNotConnectedException;
import android.content.Context;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
-import android.support.car.Car;
-import android.support.car.CarManagerBase;
-import android.support.car.CarNotConnectedException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -228,7 +229,7 @@
private final Object mLock = new Object();
private CarHvacEventListener mListener = null;
private CarHvacEventListenerToService mListenerToService = null;
- private int mServiceVersion;
+
private static final class EventCallbackHandler extends Handler {
WeakReference<CarHvacManager> mMgr;
@@ -277,29 +278,15 @@
* Should not be obtained directly by clients, use {@link Car.getCarManager()} instead.
* @hide
*/
- public CarHvacManager(Context context, ICarHvac service, Looper looper) {
- mService = service;
+ public CarHvacManager(IBinder service, Context context, Looper looper) {
+ mService = ICarHvac.Stub.asInterface(service);
mHandler = new EventCallbackHandler(this, looper);
- mServiceVersion = getVersion();
- if (mServiceVersion < MIN_SUPPORTED_VERSION) {
- Log.w(TAG, "Old service version: " + mServiceVersion +
- " for client lib: " + MIN_SUPPORTED_VERSION);
- }
}
public static boolean isZonedProperty(int propertyId) {
return propertyId > MAX_GLOBAL_PROPETY_ID;
}
- private int getVersion() {
- try {
- return mService.getVersion();
- } catch (RemoteException e) {
- Log.w(TAG, "Exception in getVersion", e);
- }
- return 1;
- }
-
/**
* Register {@link CarHvacEventListener} to get HVAC property changes
*
@@ -316,7 +303,7 @@
mListener = listener;
try {
mListenerToService = new CarHvacEventListenerToService(this);
- mService.registerListener(mListenerToService, MIN_SUPPORTED_CALLBACK_VERSION);
+ mService.registerListener(mListenerToService);
} catch (RemoteException ex) {
Log.e(TAG, "Could not connect: " + ex.toString());
throw new CarNotConnectedException(ex);
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacProperty.aidl b/car-lib/src/android/car/hardware/hvac/CarHvacProperty.aidl
similarity index 93%
rename from car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacProperty.aidl
rename to car-lib/src/android/car/hardware/hvac/CarHvacProperty.aidl
index 631b7a2..706ec07 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacProperty.aidl
+++ b/car-lib/src/android/car/hardware/hvac/CarHvacProperty.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car.hardware.hvac;
parcelable CarHvacProperty;
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacProperty.java b/car-lib/src/android/car/hardware/hvac/CarHvacProperty.java
similarity index 91%
rename from car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacProperty.java
rename to car-lib/src/android/car/hardware/hvac/CarHvacProperty.java
index 4e45134..ff85bab 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/CarHvacProperty.java
+++ b/car-lib/src/android/car/hardware/hvac/CarHvacProperty.java
@@ -14,40 +14,29 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car.hardware.hvac;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
import java.util.Arrays;
import java.util.Objects;
/**
* CarHvacProperty object corresponds to a property of the car's HVAC system
- * {@CompatibilityApi}
*/
-public class CarHvacProperty extends ExtendableParcelable {
- private static final int VERSION = 1;
+@SystemApi
+public class CarHvacProperty implements Parcelable {
- @VersionDef(version = 1)
private final int mPropertyId;
- @VersionDef(version = 1)
private final int mType;
- @VersionDef(version = 1)
private int mZone;
- @VersionDef(version = 1)
private final float mFloatMax;
- @VersionDef(version = 1)
private final float mFloatMin;
- @VersionDef(version = 1)
private float[] mFloatValues;
- @VersionDef(version = 1)
private final int mIntMax;
- @VersionDef(version = 1)
private final int mIntMin;
- @VersionDef(version = 1)
private int[] mIntValues;
public int describeContents() {
@@ -55,7 +44,6 @@
}
public void writeToParcel(Parcel out, int flags) {
- int startingPosition = writeHeader(out);
out.writeInt(mPropertyId);
out.writeInt(mType);
out.writeInt(mZone);
@@ -65,7 +53,6 @@
out.writeInt(mIntMax);
out.writeInt(mIntMin);
out.writeIntArray(mIntValues);
- completeWriting(out, startingPosition);
}
public static final Parcelable.Creator<CarHvacProperty> CREATOR
@@ -80,8 +67,6 @@
};
private CarHvacProperty(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
mPropertyId = in.readInt();
mType = in.readInt();
mZone = in.readInt();
@@ -91,14 +76,12 @@
mIntMax = in.readInt();
mIntMin = in.readInt();
mIntValues = in.createIntArray();
- completeReading(in, lastPosition);
}
/**
* Copy constructor
*/
public CarHvacProperty(CarHvacProperty that) {
- super(VERSION);
mPropertyId = that.getPropertyId();
mType = that.getType();
mZone = that.getZone();
@@ -113,7 +96,6 @@
* Constructor for a boolean property
*/
public CarHvacProperty(int propertyId, int zone, boolean value) {
- super(VERSION);
mPropertyId = propertyId;
mType = CarHvacManager.PROPERTY_TYPE_BOOLEAN;
mZone = zone;
@@ -129,7 +111,6 @@
* Constructor for a float property
*/
public CarHvacProperty(int propertyId, int zone, float min, float max, float value) {
- super(VERSION);
mPropertyId = propertyId;
mType = CarHvacManager.PROPERTY_TYPE_FLOAT;
mZone = zone;
@@ -145,7 +126,6 @@
* Constructor for an integer property
*/
public CarHvacProperty(int propertyId, int zone, int min, int max, int value) {
- super(VERSION);
mPropertyId = propertyId;
mType = CarHvacManager.PROPERTY_TYPE_INT;
mZone = zone;
@@ -160,7 +140,6 @@
* Constructor for an integer vector property
*/
public CarHvacProperty(int propertyId, int zone, int min, int max, int[] values) {
- super(VERSION);
mPropertyId = propertyId;
mType = CarHvacManager.PROPERTY_TYPE_INT_VECTOR;
mZone = zone;
@@ -175,7 +154,6 @@
* Constructor for a float vector property
*/
public CarHvacProperty(int propertyId, int zone, float min, float max, float[] values) {
- super(VERSION);
mPropertyId = propertyId;
mType = CarHvacManager.PROPERTY_TYPE_FLOAT_VECTOR;
mZone = zone;
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/ICarHvac.aidl b/car-lib/src/android/car/hardware/hvac/ICarHvac.aidl
similarity index 60%
rename from car-libs/car-system/src/android/support/car/hardware/hvac/ICarHvac.aidl
rename to car-lib/src/android/car/hardware/hvac/ICarHvac.aidl
index b61af8b..9d51121 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/ICarHvac.aidl
+++ b/car-lib/src/android/car/hardware/hvac/ICarHvac.aidl
@@ -14,22 +14,21 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car.hardware.hvac;
-import android.support.car.hardware.hvac.CarHvacProperty;
-import android.support.car.hardware.hvac.ICarHvacEventListener;
+import android.car.hardware.hvac.CarHvacProperty;
+import android.car.hardware.hvac.ICarHvacEventListener;
-/** {@CompatibilityApi} */
+/** @hide */
interface ICarHvac {
- int getVersion() = 0;
- void registerListener(in ICarHvacEventListener listener, int version) = 1;
+ void registerListener(in ICarHvacEventListener listener) = 0;
- void unregisterListener(in ICarHvacEventListener listener) = 2;
+ void unregisterListener(in ICarHvacEventListener listener) = 1;
- List<CarHvacProperty> getHvacProperties() = 3;
+ List<CarHvacProperty> getHvacProperties() = 2;
- CarHvacProperty getProperty(int prop, int zone) = 4;
+ CarHvacProperty getProperty(int prop, int zone) = 3;
- void setProperty(in CarHvacProperty prop) = 5;
+ void setProperty(in CarHvacProperty prop) = 4;
}
diff --git a/car-libs/car-system/src/android/support/car/hardware/hvac/ICarHvacEventListener.aidl b/car-lib/src/android/car/hardware/hvac/ICarHvacEventListener.aidl
similarity index 84%
rename from car-libs/car-system/src/android/support/car/hardware/hvac/ICarHvacEventListener.aidl
rename to car-lib/src/android/car/hardware/hvac/ICarHvacEventListener.aidl
index ce7177a..1d5b99d 100644
--- a/car-libs/car-system/src/android/support/car/hardware/hvac/ICarHvacEventListener.aidl
+++ b/car-lib/src/android/car/hardware/hvac/ICarHvacEventListener.aidl
@@ -14,20 +14,20 @@
* limitations under the License.
*/
-package android.support.car.hardware.hvac;
+package android.car.hardware.hvac;
-import android.support.car.hardware.hvac.CarHvacEvent;
+import android.car.hardware.hvac.CarHvacEvent;
/**
* Binder callback for CarHvacEventListener.
* This is generated per each CarClient.
- * {@CompatibilityApi}
+ * @hide
*/
oneway interface ICarHvacEventListener {
/**
* Called when an event is triggered in response to one of the calls (such as on tune) or
* asynchronously (such as on announcement).
*/
- void onEvent(in CarHvacEvent event) = 1;
+ void onEvent(in CarHvacEvent event) = 0;
}
diff --git a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioEvent.aidl b/car-lib/src/android/car/hardware/radio/CarRadioEvent.aidl
similarity index 93%
rename from car-libs/car-system/src/android/support/car/hardware/radio/CarRadioEvent.aidl
rename to car-lib/src/android/car/hardware/radio/CarRadioEvent.aidl
index 14ea002..0865646 100644
--- a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioEvent.aidl
+++ b/car-lib/src/android/car/hardware/radio/CarRadioEvent.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.support.car.hardware.radio;
+package android.car.hardware.radio;
parcelable CarRadioEvent;
diff --git a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioEvent.java b/car-lib/src/android/car/hardware/radio/CarRadioEvent.java
similarity index 77%
rename from car-libs/car-system/src/android/support/car/hardware/radio/CarRadioEvent.java
rename to car-lib/src/android/car/hardware/radio/CarRadioEvent.java
index f4ba852..4187edb 100644
--- a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioEvent.java
+++ b/car-lib/src/android/car/hardware/radio/CarRadioEvent.java
@@ -14,37 +14,32 @@
* limitations under the License.
*/
-package android.support.car.hardware.radio;
+package android.car.hardware.radio;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
/**
* A CarRadioEvent object corresponds to a single radio event coming from the car.
*
- * This works in conjuction with the callbacks already defined in {@link RadioCallback.Callback}.
- * {@CompatibilityApi}
+ * This works in conjunction with the callbacks already defined in {@link RadioCallback.Callback}.
*/
-public class CarRadioEvent extends ExtendableParcelable {
+@SystemApi
+public class CarRadioEvent implements Parcelable {
/**
* Event specifying that a radio preset has been changed.
*/
public static final int RADIO_PRESET = 0;
- private static final int VERSION = 1;
-
/**
* Event type.
*/
- @VersionDef(version = 1)
private final int mType;
/**
* CarRadioPreset for the event type EVENT_RADIO_PRESET.
*/
- @VersionDef(version = 1)
private final CarRadioPreset mPreset;
// Getters.
@@ -63,10 +58,8 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- int startingPosition = writeHeader(dest);
dest.writeInt(mType);
dest.writeParcelable(mPreset, 0);
- completeWriting(dest, startingPosition);
}
public static final Parcelable.Creator<CarRadioEvent> CREATOR
@@ -81,17 +74,13 @@
};
public CarRadioEvent(int type, CarRadioPreset preset) {
- super(VERSION);
mType = type;
mPreset = preset;
}
private CarRadioEvent(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
mType = in.readInt();
mPreset = in.readParcelable(CarRadioPreset.class.getClassLoader());
- completeReading(in, lastPosition);
}
public String toString() {
diff --git a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioManager.java b/car-lib/src/android/car/hardware/radio/CarRadioManager.java
similarity index 86%
rename from car-libs/car-system/src/android/support/car/hardware/radio/CarRadioManager.java
rename to car-lib/src/android/car/hardware/radio/CarRadioManager.java
index af4ca4f..ca394b4 100644
--- a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioManager.java
+++ b/car-lib/src/android/car/hardware/radio/CarRadioManager.java
@@ -14,19 +14,20 @@
* limitations under the License.
*/
-package android.support.car.hardware.radio;
+package android.car.hardware.radio;
import android.annotation.SystemApi;
+import android.car.Car;
+import android.car.CarManagerBase;
+import android.car.CarNotConnectedException;
import android.content.Context;
import android.hardware.radio.RadioManager;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
-import android.support.car.Car;
-import android.support.car.CarManagerBase;
-import android.support.car.CarNotConnectedException;
import com.android.internal.annotations.GuardedBy;
@@ -45,12 +46,6 @@
public final static boolean DBG = true;
public final static String TAG = "CarRadioManager";
- // Minimum supported version of the service.
- private static final int MIN_SUPPORTED_VERSION = 1;
-
- // Minimum supported version of the callback.
- private static final int MIN_SUPPORTED_CALLBACK_VERSION = 1;
-
// Constants handled in the handler (see mHandler below).
private final static int MSG_RADIO_EVENT = 0;
@@ -118,18 +113,13 @@
* Should not be obtained directly by clients, use {@link Car.getCarManager()} instead.
* @hide
*/
- public CarRadioManager(Context context, ICarRadio service, Looper looper) {
- mService = service;
+ public CarRadioManager(IBinder service, Looper looper) {
+ mService = ICarRadio.Stub.asInterface(service);
mHandler = new EventCallbackHandler(this, looper);
- mServiceVersion = getVersion();
- if (mServiceVersion < MIN_SUPPORTED_VERSION) {
- Log.w(TAG, "Old service version: " + mServiceVersion +
- " for client lib: " + MIN_SUPPORTED_VERSION);
- }
// Populate the fixed values.
try {
- mCount = service.getPresetCount();
+ mCount = mService.getPresetCount();
} catch (RemoteException ex) {
// Do nothing.
Log.e(TAG, "Could not connect: " + ex.toString());
@@ -149,7 +139,7 @@
mListener = listener;
try {
mListenerToService = new CarRadioEventListenerToService(this);
- mService.registerListener(mListenerToService, MIN_SUPPORTED_CALLBACK_VERSION);
+ mService.registerListener(mListenerToService);
} catch (RemoteException ex) {
// Do nothing.
Log.e(TAG, "Could not connect: " + ex.toString());
@@ -242,15 +232,6 @@
mHandler.sendMessage(mHandler.obtainMessage(MSG_RADIO_EVENT, event));
}
- private int getVersion() {
- try {
- return mService.getVersion();
- } catch (RemoteException e) {
- Log.w(TAG, "Exception in getVersion", e);
- }
- return 1;
- }
-
/** @hide */
@Override
public synchronized void onCarDisconnected() {
diff --git a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioPreset.aidl b/car-lib/src/android/car/hardware/radio/CarRadioPreset.aidl
similarity index 93%
rename from car-libs/car-system/src/android/support/car/hardware/radio/CarRadioPreset.aidl
rename to car-lib/src/android/car/hardware/radio/CarRadioPreset.aidl
index ae72cd6..8a1c7b2 100644
--- a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioPreset.aidl
+++ b/car-lib/src/android/car/hardware/radio/CarRadioPreset.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.support.car.hardware.radio;
+package android.car.hardware.radio;
parcelable CarRadioPreset;
diff --git a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioPreset.java b/car-lib/src/android/car/hardware/radio/CarRadioPreset.java
similarity index 82%
rename from car-libs/car-system/src/android/support/car/hardware/radio/CarRadioPreset.java
rename to car-lib/src/android/car/hardware/radio/CarRadioPreset.java
index 82f55ad..cdbb99b 100644
--- a/car-libs/car-system/src/android/support/car/hardware/radio/CarRadioPreset.java
+++ b/car-lib/src/android/car/hardware/radio/CarRadioPreset.java
@@ -14,42 +14,36 @@
* limitations under the License.
*/
-package android.support.car.hardware.radio;
+package android.car.hardware.radio;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
/**
* CarPreset object corresponds to a preset that is stored on the car's Radio unit.
- * {@CompatibilityApi}
*/
-public class CarRadioPreset extends ExtendableParcelable {
- private static final int VERSION = 1;
+@SystemApi
+public class CarRadioPreset implements Parcelable {
/*
* Preset number at which this preset is stored.
*
* The value is 1 index based.
*/
- @VersionDef(version = 1)
private final int mPresetNumber;
/**
* Radio band this preset belongs to.
* See {@link RadioManager.BAND_FM}, {@link RadioManager.BAND_AM} etc.
*/
- @VersionDef(version = 1)
private final int mBand;
/**
* Channel number.
*/
- @VersionDef(version = 1)
private final int mChannel;
/**
* Sub channel number.
*/
- @VersionDef(version = 1)
private final int mSubChannel;
public int describeContents() {
@@ -57,12 +51,10 @@
}
public void writeToParcel(Parcel out, int flags) {
- int startingPosition = writeHeader(out);
out.writeInt(mPresetNumber);
out.writeInt(mBand);
out.writeInt(mChannel);
out.writeInt(mSubChannel);
- completeWriting(out, startingPosition);
}
public static final Parcelable.Creator<CarRadioPreset> CREATOR
@@ -77,17 +69,13 @@
};
private CarRadioPreset(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
mPresetNumber = in.readInt();
mBand = in.readInt();
mChannel = in.readInt();
mSubChannel = in.readInt();
- completeReading(in, lastPosition);
}
public CarRadioPreset(int presetNumber, int bandType, int channel, int subChannel) {
- super(VERSION);
mPresetNumber = presetNumber;
mBand = bandType;
mChannel = channel;
diff --git a/car-libs/car-system/src/android/support/car/hardware/radio/ICarRadio.aidl b/car-lib/src/android/car/hardware/radio/ICarRadio.aidl
similarity index 69%
rename from car-libs/car-system/src/android/support/car/hardware/radio/ICarRadio.aidl
rename to car-lib/src/android/car/hardware/radio/ICarRadio.aidl
index 45b6273..2de9476 100644
--- a/car-libs/car-system/src/android/support/car/hardware/radio/ICarRadio.aidl
+++ b/car-lib/src/android/car/hardware/radio/ICarRadio.aidl
@@ -14,40 +14,36 @@
* limitations under the License.
*/
-package android.support.car.hardware.radio;
+package android.car.hardware.radio;
-import android.support.car.hardware.radio.CarRadioPreset;
-import android.support.car.hardware.radio.ICarRadioEventListener;
+import android.car.hardware.radio.CarRadioPreset;
+import android.car.hardware.radio.ICarRadioEventListener;
-/** {@CompatibilityApi} */
+/** @hide */
interface ICarRadio {
/**
- * Returns the version number for this implementation of service.
- */
- int getVersion() = 0;
- /**
* Returns the number of hard presets on the radio unit that may be programmed.
*/
- int getPresetCount() = 1;
+ int getPresetCount() = 0;
/**
* Registers the client for updates to radio changes.
*/
- void registerListener(in ICarRadioEventListener listener, int version) = 2;
+ void registerListener(in ICarRadioEventListener listener) = 1;
/**
* Unregisters the client for updates to radio changes.
*/
- void unregisterListener(in ICarRadioEventListener listener) = 3;
+ void unregisterListener(in ICarRadioEventListener listener) = 2;
/**
* Gets the preset values stored for a particular preset number.
*/
- CarRadioPreset getPreset(int presetNumber) = 4;
+ CarRadioPreset getPreset(int presetNumber) = 3;
/**
* Sets a specified preset (hard button) in the car. In order to check for success listen to
* events using {@link registerOrUpdateRadioListener}.
*/
- boolean setPreset(in CarRadioPreset preset) = 5;
+ boolean setPreset(in CarRadioPreset preset) = 4;
}
diff --git a/car-libs/car-system/src/android/support/car/hardware/radio/ICarRadioEventListener.aidl b/car-lib/src/android/car/hardware/radio/ICarRadioEventListener.aidl
similarity index 84%
rename from car-libs/car-system/src/android/support/car/hardware/radio/ICarRadioEventListener.aidl
rename to car-lib/src/android/car/hardware/radio/ICarRadioEventListener.aidl
index 83d94cd..e006b65 100644
--- a/car-libs/car-system/src/android/support/car/hardware/radio/ICarRadioEventListener.aidl
+++ b/car-lib/src/android/car/hardware/radio/ICarRadioEventListener.aidl
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package android.support.car.hardware.radio;
+package android.car.hardware.radio;
-import android.support.car.hardware.radio.CarRadioEvent;
+import android.car.hardware.radio.CarRadioEvent;
/**
* Binder callback for CarRadioEventListener.
* This is generated per each CarClient.
- * {@CompatibilityApi}
+ * @hide
*/
oneway interface ICarRadioEventListener {
/**
* Called when an event is triggered in response to one of the calls (such as on tune) or
* asynchronously (such as on announcement).
*/
- void onEvent(in CarRadioEvent event) = 1;
+ void onEvent(in CarRadioEvent event) = 0;
}
diff --git a/car-libs/car-core/src/android/support/car/media/CarAudioManager.java b/car-lib/src/android/car/media/CarAudioManager.java
similarity index 93%
rename from car-libs/car-core/src/android/support/car/media/CarAudioManager.java
rename to car-lib/src/android/car/media/CarAudioManager.java
index 35d2c42..55c6ea2 100644
--- a/car-libs/car-core/src/android/support/car/media/CarAudioManager.java
+++ b/car-lib/src/android/car/media/CarAudioManager.java
@@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.media;
+package android.car.media;
+import android.annotation.IntDef;
import android.media.AudioAttributes;
+import android.os.IBinder;
import android.os.RemoteException;
-import android.support.annotation.IntDef;
-import android.support.car.CarManagerBase;
+import android.car.CarManagerBase;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -103,7 +104,7 @@
}
/** @hide */
- public CarAudioManager(ICarAudio service) {
- mService = service;
+ public CarAudioManager(IBinder service) {
+ mService = ICarAudio.Stub.asInterface(service);
}
}
diff --git a/car-libs/car-core/src/android/support/car/media/ICarAudio.aidl b/car-lib/src/android/car/media/ICarAudio.aidl
similarity index 73%
rename from car-libs/car-core/src/android/support/car/media/ICarAudio.aidl
rename to car-lib/src/android/car/media/ICarAudio.aidl
index 7b589b3..7a5e43d 100644
--- a/car-libs/car-core/src/android/support/car/media/ICarAudio.aidl
+++ b/car-lib/src/android/car/media/ICarAudio.aidl
@@ -14,17 +14,16 @@
* limitations under the License.
*/
-package android.support.car.media;
+package android.car.media;
import android.media.AudioAttributes;
/**
- * Binder interface for {@link android.support.car.media.CarAudioManager}.
- * Check {@link android.support.car.media.CarAudioManager} APIs for expected behavior of each calls.
+ * Binder interface for {@link android.car.media.CarAudioManager}.
+ * Check {@link android.car.media.CarAudioManager} APIs for expected behavior of each calls.
*
- * {@CompatibilityApi}
+ * @hide
*/
interface ICarAudio {
- int getVersion() = 0;
- AudioAttributes getAudioAttributesForCarUsage(int carUsage) = 1;
+ AudioAttributes getAudioAttributesForCarUsage(int carUsage) = 0;
}
diff --git a/car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.aidl b/car-lib/src/android/car/navigation/CarNavigationInstrumentCluster.aidl
similarity index 93%
rename from car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.aidl
rename to car-lib/src/android/car/navigation/CarNavigationInstrumentCluster.aidl
index b55d558..8141cb0 100644
--- a/car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.aidl
+++ b/car-lib/src/android/car/navigation/CarNavigationInstrumentCluster.aidl
@@ -13,6 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.navigation;
+package android.car.navigation;
parcelable CarNavigationInstrumentCluster;
\ No newline at end of file
diff --git a/car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.java b/car-lib/src/android/car/navigation/CarNavigationInstrumentCluster.java
similarity index 86%
copy from car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.java
copy to car-lib/src/android/car/navigation/CarNavigationInstrumentCluster.java
index 6495fcc..4ea88e0 100644
--- a/car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.java
+++ b/car-lib/src/android/car/navigation/CarNavigationInstrumentCluster.java
@@ -13,13 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.navigation;
+package android.car.navigation;
+import android.annotation.IntDef;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.annotation.IntDef;
-import android.support.car.annotation.VersionDef;
-import android.support.car.os.ExtendableParcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -27,11 +25,8 @@
/**
* Holds options related to navigation for the car's instrument cluster.
* @hide
- * {@CompatibilityApi}
*/
-public class CarNavigationInstrumentCluster extends ExtendableParcelable {
-
- private static final int VERSION = 1;
+public class CarNavigationInstrumentCluster implements Parcelable {
@Retention(RetentionPolicy.SOURCE)
@IntDef({
@@ -45,20 +40,15 @@
int IMAGE_CODES_ONLY = 2;
}
- @VersionDef(version = 1)
private int mMinIntervalMs;
- @VersionDef(version = 1)
@ClusterType
private int mType;
- @VersionDef(version = 1)
private int mImageWidth;
- @VersionDef(version = 1)
private int mImageHeight;
- @VersionDef(version = 1)
private int mImageColorDepthBits;
public static final Parcelable.Creator<CarNavigationInstrumentCluster> CREATOR
@@ -73,12 +63,14 @@
};
public static CarNavigationInstrumentCluster createCluster(int minIntervalMs) {
- return new CarNavigationInstrumentCluster(minIntervalMs, ClusterType.IMAGE_CODES_ONLY, 0, 0, 0);
+ return new CarNavigationInstrumentCluster(minIntervalMs, ClusterType.IMAGE_CODES_ONLY, 0, 0,
+ 0);
}
public static CarNavigationInstrumentCluster createCustomImageCluster(int minIntervalMs,
int imageWidth, int imageHeight, int imageColorDepthBits) {
- return new CarNavigationInstrumentCluster(minIntervalMs, ClusterType.CUSTOM_IMAGES_SUPPORTED,
+ return new CarNavigationInstrumentCluster(minIntervalMs,
+ ClusterType.CUSTOM_IMAGES_SUPPORTED,
imageWidth, imageHeight, imageColorDepthBits);
}
@@ -126,7 +118,6 @@
int imageWidth,
int imageHeight,
int imageColorDepthBits) {
- super(VERSION);
this.mMinIntervalMs = minIntervalMs;
this.mType = type;
this.mImageWidth = imageWidth;
@@ -141,24 +132,19 @@
@Override
public void writeToParcel(Parcel dest, int flags) {
- int startingPosition = writeHeader(dest);
dest.writeInt(mMinIntervalMs);
dest.writeInt(mType);
dest.writeInt(mImageWidth);
dest.writeInt(mImageHeight);
dest.writeInt(mImageColorDepthBits);
- completeWriting(dest, startingPosition);
}
private CarNavigationInstrumentCluster(Parcel in) {
- super(in, VERSION);
- int lastPosition = readHeader(in);
mMinIntervalMs = in.readInt();
mType = in.readInt();
mImageWidth = in.readInt();
mImageHeight = in.readInt();
mImageColorDepthBits = in.readInt();
- completeReading(in, lastPosition);
}
/** Converts to string for debug purpose */
diff --git a/car-libs/car-core/src/android/support/car/navigation/CarNavigationStatusManager.java b/car-lib/src/android/car/navigation/CarNavigationManager.java
similarity index 75%
rename from car-libs/car-core/src/android/support/car/navigation/CarNavigationStatusManager.java
rename to car-lib/src/android/car/navigation/CarNavigationManager.java
index 0acf000..090980b 100644
--- a/car-libs/car-core/src/android/support/car/navigation/CarNavigationStatusManager.java
+++ b/car-lib/src/android/car/navigation/CarNavigationManager.java
@@ -13,18 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.navigation;
+package android.car.navigation;
+import android.car.CarApiUtil;
+import android.car.CarLibLog;
+import android.car.CarManagerBase;
+import android.car.CarNotConnectedException;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Handler.Callback;
+import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
-import android.support.car.CarApiUtil;
-import android.support.car.CarLibLog;
-import android.support.car.CarManagerBase;
-import android.support.car.CarNotConnectedException;
import android.util.Log;
import java.lang.ref.WeakReference;
@@ -33,8 +34,18 @@
* API for providing navigation status for instrument cluster.
* @hide
*/
-public class CarNavigationStatusManager implements CarManagerBase {
- private static final String TAG = CarLibLog.TAG_NAV;
+public class CarNavigationManager implements CarManagerBase {
+
+ /**
+ * Listener navigation related events.
+ * Callbacks are called in the Looper context.
+ */
+ public interface CarNavigationListener {
+ /** Instrument Cluster started in navigation mode */
+ void onInstrumentClusterStart(CarNavigationInstrumentCluster instrumentCluster);
+ /** Instrument cluster ended */
+ void onInstrumentClusterStop();
+ }
/** Navigation status */
public static final int STATUS_UNAVAILABLE = 0;
@@ -67,23 +78,26 @@
private static final int START = 1;
private static final int STOP = 2;
- private final ICarNavigationStatus mService;
- private ICarNavigationStatusEventListenerImpl mICarNavigationStatusEventListenerImpl;
- private CarNavigationStatusListener mCarNavigationStatusListener;
+ private static final String TAG = CarLibLog.TAG_NAV;
+
+ private final ICarNavigation mService;
+ private ICarNavigationEventListenerImpl mICarNavigationEventListenerImpl;
+ private CarNavigationListener mCarNavigationListener;
private CarNavigationInstrumentCluster mInstrumentCluster;
private final Handler mHandler;
private final Callback mHandlerCallback = new Callback() {
@Override
public boolean handleMessage(Message msg) {
- Log.d(TAG, "handleMessage, listener: " + mCarNavigationStatusListener + ", msg.what: " + msg.what);
- if (mCarNavigationStatusListener != null) {
+ Log.d(TAG, "handleMessage, listener: " + mCarNavigationListener + ", msg.what: " +
+ msg.what);
+ if (mCarNavigationListener != null) {
switch (msg.what) {
case START:
- Log.d(TAG, "mCarNavigationStatusListener.onStart(mInstrumentCluster)");
- mCarNavigationStatusListener.onStart(mInstrumentCluster);
+ Log.d(TAG, "mCarNavigationListener.onInstrumentClusterStart()");
+ mCarNavigationListener.onInstrumentClusterStart(mInstrumentCluster);
break;
case STOP:
- mCarNavigationStatusListener.onStop();
+ mCarNavigationListener.onInstrumentClusterStop();
break;
}
}
@@ -95,9 +109,9 @@
* Only for CarServiceLoader
* @hide
*/
- public CarNavigationStatusManager(ICarNavigationStatus service, Looper looper) {
+ public CarNavigationManager(IBinder service, Looper looper) {
mHandler = new Handler(looper, mHandlerCallback);
- mService = service;
+ mService = ICarNavigation.Stub.asInterface(service);
}
/**
@@ -178,6 +192,17 @@
return true;
}
+ public boolean isInstrumentClusterSupported() throws CarNotConnectedException {
+ try {
+ return mService.isInstrumentClusterSupported();
+ } catch (IllegalStateException e) {
+ CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
+ } catch (RemoteException e) {
+ handleCarServiceRemoteExceptionAndThrow(e);
+ }
+ return false;
+ }
+
@Override
public void onCarDisconnected() {
Log.d(TAG, "onCarDisconnected");
@@ -185,26 +210,18 @@
}
/**
- * Listener for car instrument cluster start/stop requests.
- * Callbacks are called in the Looper context.
- */
- public interface CarNavigationStatusListener {
- void onStart(CarNavigationInstrumentCluster instrumentCluster);
- void onStop();
- }
-
- /**
* @param listener {@link CarNavigationStatusListener} to be registered, replacing any existing
* listeners.
* @throws CarNotConnectedException
*/
- public void registerListener(CarNavigationStatusListener listener)
+ public void registerListener(CarNavigationListener listener)
throws CarNotConnectedException {
- mCarNavigationStatusListener = listener;
- if (mICarNavigationStatusEventListenerImpl == null) {
- mICarNavigationStatusEventListenerImpl = new ICarNavigationStatusEventListenerImpl(this);
+ mCarNavigationListener = listener;
+ if (mICarNavigationEventListenerImpl == null) {
+ mICarNavigationEventListenerImpl =
+ new ICarNavigationEventListenerImpl(this);
try {
- mService.registerEventListener(mICarNavigationStatusEventListenerImpl);
+ mService.registerEventListener(mICarNavigationEventListenerImpl);
} catch (IllegalStateException e) {
CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
} catch (RemoteException e) {
@@ -218,14 +235,14 @@
*/
public void unregisterListener() {
try {
- mService.unregisterEventListener(mICarNavigationStatusEventListenerImpl);
+ mService.unregisterEventListener(mICarNavigationEventListenerImpl);
} catch (IllegalStateException e) {
// ignore
} catch (RemoteException e) {
// do not throw exception as this can happen during tearing down.
handleCarServiceRemoteException(e);
}
- mCarNavigationStatusListener = null;
+ mCarNavigationListener = null;
}
private void handleCarServiceRemoteExceptionAndThrow(RemoteException e)
@@ -249,25 +266,25 @@
mHandler.sendMessage(mHandler.obtainMessage(STOP));
}
- private static class ICarNavigationStatusEventListenerImpl extends
- ICarNavigationStatusEventListener.Stub {
- private final WeakReference<CarNavigationStatusManager> mManager;
+ private static class ICarNavigationEventListenerImpl extends
+ ICarNavigationEventListener.Stub {
+ private final WeakReference<CarNavigationManager> mManager;
- public ICarNavigationStatusEventListenerImpl(CarNavigationStatusManager manager) {
- mManager = new WeakReference<CarNavigationStatusManager>(manager);
+ public ICarNavigationEventListenerImpl(CarNavigationManager manager) {
+ mManager = new WeakReference<CarNavigationManager>(manager);
}
@Override
- public void onStart(CarNavigationInstrumentCluster instrumentClusterInfo) {
- CarNavigationStatusManager manager = mManager.get();
+ public void onInstrumentClusterStart(CarNavigationInstrumentCluster instrumentClusterInfo) {
+ CarNavigationManager manager = mManager.get();
if (manager != null) {
manager.handleOnStart(instrumentClusterInfo);
}
}
@Override
- public void onStop() {
- CarNavigationStatusManager manager = mManager.get();
+ public void onInstrumentClusterStop() {
+ CarNavigationManager manager = mManager.get();
if (manager != null) {
manager.handleOnStop();
}
diff --git a/car-libs/car-core/src/android/support/car/navigation/ICarNavigationStatus.aidl b/car-lib/src/android/car/navigation/ICarNavigation.aidl
similarity index 63%
rename from car-libs/car-core/src/android/support/car/navigation/ICarNavigationStatus.aidl
rename to car-lib/src/android/car/navigation/ICarNavigation.aidl
index d919c71..69a11c9 100644
--- a/car-libs/car-core/src/android/support/car/navigation/ICarNavigationStatus.aidl
+++ b/car-lib/src/android/car/navigation/ICarNavigation.aidl
@@ -13,24 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.navigation;
+package android.car.navigation;
import android.graphics.Bitmap;
-import android.support.car.navigation.CarNavigationInstrumentCluster;
-import android.support.car.navigation.ICarNavigationStatusEventListener;
+import android.car.navigation.CarNavigationInstrumentCluster;
+import android.car.navigation.ICarNavigationEventListener;
/**
- * Binder API for CarNavigationStatusManager.
+ * Binder API for CarNavigationManager.
* @hide
- * {@CompatibilityApi}
*/
-interface ICarNavigationStatus {
+interface ICarNavigation {
void sendNavigationStatus(int status) = 0;
void sendNavigationTurnEvent(
int event, String road, int turnAngle, int turnNumber, in Bitmap image, int turnSide) = 1;
void sendNavigationTurnDistanceEvent(int distanceMeters, int timeSeconds) = 2;
- boolean isSupported() = 3;
- CarNavigationInstrumentCluster getInfo() = 4;
- boolean registerEventListener(ICarNavigationStatusEventListener listener) = 5;
- boolean unregisterEventListener(ICarNavigationStatusEventListener listener) = 6;
+ boolean isInstrumentClusterSupported() = 3;
+ CarNavigationInstrumentCluster getInstrumentClusterInfo() = 4;
+ boolean registerEventListener(ICarNavigationEventListener listener) = 5;
+ boolean unregisterEventListener(ICarNavigationEventListener listener) = 6;
}
diff --git a/car-libs/car-core/src/android/support/car/navigation/ICarNavigationStatusEventListener.aidl b/car-lib/src/android/car/navigation/ICarNavigationEventListener.aidl
similarity index 64%
rename from car-libs/car-core/src/android/support/car/navigation/ICarNavigationStatusEventListener.aidl
rename to car-lib/src/android/car/navigation/ICarNavigationEventListener.aidl
index 1553146..10c14c8 100644
--- a/car-libs/car-core/src/android/support/car/navigation/ICarNavigationStatusEventListener.aidl
+++ b/car-lib/src/android/car/navigation/ICarNavigationEventListener.aidl
@@ -13,16 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car.navigation;
+package android.car.navigation;
-import android.support.car.navigation.CarNavigationInstrumentCluster;
+import android.car.navigation.CarNavigationInstrumentCluster;
/**
- * Binder callback for CarNavigationStatusEventListener.
+ * Binder callback for CarNavigationEventListener.
* @hide
- * {@CompatibilityApi}
*/
-oneway interface ICarNavigationStatusEventListener {
- void onStart(in CarNavigationInstrumentCluster instrumentCluster) = 0;
- void onStop() = 1;
+oneway interface ICarNavigationEventListener {
+ void onInstrumentClusterStart(in CarNavigationInstrumentCluster instrumentCluster) = 0;
+ void onInstrumentClusterStop() = 1;
}
diff --git a/car-lib/src/android/car/test/CarTestManagerBinderWrapper.java b/car-lib/src/android/car/test/CarTestManagerBinderWrapper.java
new file mode 100644
index 0000000..186951e
--- /dev/null
+++ b/car-lib/src/android/car/test/CarTestManagerBinderWrapper.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 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.test;
+
+import android.annotation.SystemApi;
+import android.car.CarManagerBase;
+import android.os.IBinder;
+
+/**
+ * Only for system testing
+ * @hide
+ */
+@SystemApi
+public class CarTestManagerBinderWrapper implements CarManagerBase {
+ public final IBinder binder;
+
+ public CarTestManagerBinderWrapper(IBinder binder) {
+ this.binder = binder;
+ }
+
+ @Override
+ public void onCarDisconnected() {
+ // nothing to do
+ }
+
+}
diff --git a/car-libs/Android.mk b/car-libs/Android.mk
deleted file mode 100644
index b45ca4f..0000000
--- a/car-libs/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2015 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.
-#
-#
-
-#disble build in PDK, should add prebuilts/fullsdk to make this work
-ifneq ($(TARGET_BUILD_PDK),true)
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-# Include the sub-makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
-endif #TARGET_BUILD_PDK
diff --git a/car-libs/car-core/Android.mk b/car-libs/car-core/Android.mk
deleted file mode 100644
index 8942003..0000000
--- a/car-libs/car-core/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (C) 2015 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.
-#
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := car-core
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-annotations \
- jsr305 \
- android-support-v4
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src)
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/car-libs/car-core/src/android/support/car/CarServiceLoader.java b/car-libs/car-core/src/android/support/car/CarServiceLoader.java
deleted file mode 100644
index 6ccd318..0000000
--- a/car-libs/car-core/src/android/support/car/CarServiceLoader.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2015 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.support.car;
-
-import android.content.Context;
-import android.os.IBinder;
-import android.os.Looper;
-import android.support.car.content.pm.ICarPackageManager;
-import android.support.car.content.pm.CarPackageManager;
-import android.support.car.hardware.CarSensorManager;
-import android.support.car.hardware.ICarSensor;
-import android.support.car.media.CarAudioManager;
-import android.support.car.media.ICarAudio;
-import android.support.car.navigation.CarNavigationStatusManager;
-import android.support.car.navigation.ICarNavigationStatus;
-
-/**
- * CarServiceLoader is the abstraction for loading different types of car service.
- * @hide
- */
-public abstract class CarServiceLoader {
-
- private final Context mContext;
- private final ServiceConnectionListener mListener;
- private final Looper mLooper;
-
- public CarServiceLoader(Context context, ServiceConnectionListener listener, Looper looper) {
- mContext = context;
- mListener = listener;
- mLooper = looper;
- }
-
- public abstract void connect() throws IllegalStateException;
- public abstract void disconnect();
-
- /**
- * Factory method to create Car*Manager for the given car service implementation.
- * Each implementation can add its own custom Car*Manager while default implementation will
- * handle all standard Car*Managers.
- * @param serviceName service name for the given Car*Manager.
- * @param binder binder implementation received from car service
- * @return Car*Manager instance for the given serviceName / binder. null if given service is
- * not supported.
- */
- public CarManagerBase createCarManager(String serviceName,
- IBinder binder) {
- CarManagerBase manager = null;
- switch (serviceName) {
- case Car.AUDIO_SERVICE:
- manager = new CarAudioManager(ICarAudio.Stub.asInterface(binder));
- break;
- case Car.SENSOR_SERVICE:
- manager = new CarSensorManager(mContext, ICarSensor.Stub.asInterface(binder),
- mLooper);
- break;
- case Car.INFO_SERVICE:
- manager = new CarInfoManager(ICarInfo.Stub.asInterface(binder));
- break;
- case Car.APP_CONTEXT_SERVICE:
- manager = new CarAppContextManager(IAppContext.Stub.asInterface(binder), mLooper);
- break;
- case Car.PACKAGE_SERVICE:
- manager = new CarPackageManager(ICarPackageManager.Stub.asInterface(binder),
- mContext);
- break;
- case Car.CAR_NAVIGATION_SERVICE:
- manager = new CarNavigationStatusManager(
- ICarNavigationStatus.Stub.asInterface(binder), mLooper);
- break;
- }
- return manager;
- }
-
- protected Context getContext() {
- return mContext;
- }
-
- protected ServiceConnectionListener getConnectionListener() {
- return mListener;
- }
-
- protected Looper getLooper() {
- return mLooper;
- }
-}
diff --git a/car-libs/car-core/src/android/support/car/DefaultCarServiceLoader.java b/car-libs/car-core/src/android/support/car/DefaultCarServiceLoader.java
deleted file mode 100644
index b008017..0000000
--- a/car-libs/car-core/src/android/support/car/DefaultCarServiceLoader.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2015 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.support.car;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.IBinder;
-import android.os.Looper;
-
-/**
- * Default CarServiceLoader for system with built-in car service.
- * @hide
- */
-public class DefaultCarServiceLoader extends CarServiceLoader {
-
- private static final String CAR_SERVICE_PACKAGE = "com.android.car";
-
- private final ServiceConnection mServiceConnection = new ServiceConnection() {
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- getConnectionListener().onServiceConnected(name, service);
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- // unbind explicitly here.
- disconnect();
- getConnectionListener().onServiceDisconnected(name);
- }
- };
-
- public DefaultCarServiceLoader(Context context, ServiceConnectionListener listener,
- Looper looper) {
- super(context, listener, looper);
- }
-
- @Override
- public void connect() throws IllegalStateException {
- startCarService();
- }
-
- @Override
- public void disconnect() {
- getContext().unbindService(mServiceConnection);
- }
-
- private void startCarService() {
- Intent intent = new Intent();
- intent.setPackage(CAR_SERVICE_PACKAGE);
- intent.setAction(Car.CAR_SERVICE_INTERFACE_NAME);
- getContext().startService(intent);
- getContext().bindService(intent, mServiceConnection, 0);
- }
-}
diff --git a/car-libs/car-system/src/android/support/car/CarSystem.java b/car-libs/car-system/src/android/support/car/CarSystem.java
deleted file mode 100644
index 9a20314..0000000
--- a/car-libs/car-system/src/android/support/car/CarSystem.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2015 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.support.car;
-
-/**
- * Container class to hold static definitions for system api for Car.
- * Client should still use Car api for all operations, and this class is only for defining
- * additional parameters available when car api becomes system api.
- * @hide
- */
-public class CarSystem {
- public static final String RADIO_SERVICE = "radio";
- public static final String HVAC_SERVICE = "hvac";
-
- /** Permission necessary to access Car HVAC APIs. */
- public static final String PERMISSION_CAR_HVAC =
- "android.support.car.permission.CAR_HVAC";
-
- /** Permission necesary to access Car RADIO system APIs. */
- public static final String PERMISSION_CAR_RADIO =
- "android.support.car.permission.CAR_RADIO";
-}
diff --git a/car-libs/car-system/src/android/support/car/SystemApiCarServiceLoader.java b/car-libs/car-system/src/android/support/car/SystemApiCarServiceLoader.java
deleted file mode 100644
index 4dd58e5..0000000
--- a/car-libs/car-system/src/android/support/car/SystemApiCarServiceLoader.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2015 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.support.car;
-
-import android.content.Context;
-import android.os.IBinder;
-import android.os.Looper;
-
-import android.support.car.hardware.hvac.CarHvacManager;
-import android.support.car.hardware.hvac.ICarHvac;
-import android.support.car.hardware.radio.CarRadioManager;
-import android.support.car.hardware.radio.ICarRadio;
-
-public class SystemApiCarServiceLoader extends DefaultCarServiceLoader {
-
- public SystemApiCarServiceLoader(Context context, ServiceConnectionListener listener,
- Looper looper) {
- super(context, listener, looper);
- }
-
- @Override
- public CarManagerBase createCarManager(String serviceName, IBinder binder) {
- CarManagerBase manager = null;
- switch (serviceName) {
- case CarSystem.HVAC_SERVICE:
- manager = new CarHvacManager(
- getContext(), ICarHvac.Stub.asInterface(binder), getLooper());
- break;
- case CarSystem.RADIO_SERVICE:
- manager =
- new CarRadioManager(
- getContext(), ICarRadio.Stub.asInterface(binder), getLooper());
- break;
- }
- if (manager == null) {
- return super.createCarManager(serviceName, binder);
- }
- return manager;
- }
-}
diff --git a/car-libs/car-systemtest/src/android/support/car/CarSystemTest.java b/car-libs/car-systemtest/src/android/support/car/CarSystemTest.java
deleted file mode 100644
index 092e43b..0000000
--- a/car-libs/car-systemtest/src/android/support/car/CarSystemTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2015 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.support.car;
-
-/**
- * Container class to hold static definitions for system test api for Car.
- * Client should still use Car api for all operations, and this class is only for defining
- * additional parameters available when car api becomes system api.
- * @hide
- */
-public class CarSystemTest {
- /**
- * Service for testing. This is system app only feature.
- * Service name for {@link CarTestManager}, to be used in {@link #getCarManager(String)}.
- * @hide
- */
- public static final String TEST_SERVICE = "car-service-test";
-
- /** permission necessary to mock vehicle hal for testing */
- public static final String PERMISSION_MOCK_VEHICLE_HAL =
- "android.support.car.permission.CAR_MOCK_VEHICLE_HAL";
-}
diff --git a/car-libs/car-systemtest/src/android/support/car/SystemTestApiCarServiceLoader.java b/car-libs/car-systemtest/src/android/support/car/SystemTestApiCarServiceLoader.java
deleted file mode 100644
index 4f257e1..0000000
--- a/car-libs/car-systemtest/src/android/support/car/SystemTestApiCarServiceLoader.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2015 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.support.car;
-
-import android.content.Context;
-import android.os.IBinder;
-import android.os.Looper;
-import android.support.car.CarManagerBase;
-import android.support.car.ServiceConnectionListener;
-
-public class SystemTestApiCarServiceLoader extends SystemApiCarServiceLoader {
-
- public SystemTestApiCarServiceLoader(Context context, ServiceConnectionListener listener,
- Looper looper) {
- super(context, listener, looper);
- }
-
- @Override
- public CarManagerBase createCarManager(String serviceName, IBinder binder) {
- switch (serviceName) {
- case CarSystemTest.TEST_SERVICE:
- return new CarTestManager(ICarTest.Stub.asInterface(binder));
- }
- return super.createCarManager(serviceName, binder);
- }
-}
diff --git a/car-libs/car-ui/car-ui.mk b/car-libs/car-ui/car-ui.mk
deleted file mode 100644
index 2fee4f2..0000000
--- a/car-libs/car-ui/car-ui.mk
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Include this make file to build your application with car ui.
-# This only applied to app which is not CarActivity based but wants to use car-ui.
-#
-# Make sure to include it after you've set all your desired LOCAL variables.
-# Note that you must explicitly set your LOCAL_RESOURCE_DIR before including this file.
-#
-# For example:
-#
-# LOCAL_RESOURCE_DIR := \
-# $(LOCAL_PATH)/res
-#
-# include packages/services/Car/car-libs/car-ui/car-ui.mk
-#
-
-# Check that LOCAL_RESOURCE_DIR is defined
-ifeq (,$(LOCAL_RESOURCE_DIR))
-$(error LOCAL_RESOURCE_DIR must be defined)
-endif
-
-# Add --auto-add-overlay flag if not present
-ifeq (,$(findstring --auto-add-overlay, $(LOCAL_AAPT_FLAGS)))
-LOCAL_AAPT_FLAGS += --auto-add-overlay
-endif
-
-# Include car ui library, if not already included
-ifeq (,$(findstring car-ui,$(LOCAL_STATIC_JAVA_LIBRARIES)))
-LOCAL_RESOURCE_DIR += \
- packages/services/Car/car-libs/car-ui/res
-LOCAL_AAPT_FLAGS += --extra-packages android.support.car.ui
-LOCAL_STATIC_JAVA_LIBRARIES += car-ui
-endif
-
-## Include transitive dependencies below
-
-# Include support-v7-appcompat, if not already included
-ifeq (,$(findstring android-support-v7-appcompat,$(LOCAL_STATIC_JAVA_LIBRARIES)))
-LOCAL_RESOURCE_DIR += frameworks/support/v7/appcompat/res
-LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
-endif
-
-# Include support-v7-recyclerview, if not already included
-ifeq (,$(findstring android-support-v7-recyclerview,$(LOCAL_STATIC_JAVA_LIBRARIES)))
-LOCAL_RESOURCE_DIR += frameworks/support/v7/recyclerview/res
-LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.recyclerview
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-recyclerview
-endif
-
-# Include support-v7-cardview, if not already included
-ifeq (,$(findstring android-support-v7-cardview,$(LOCAL_STATIC_JAVA_LIBRARIES)))
-LOCAL_RESOURCE_DIR += frameworks/support/v7/cardview/res
-LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.cardview
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-cardview
-endif
diff --git a/car-libs/car/Android.mk b/car-libs/car/Android.mk
deleted file mode 100644
index ec61ff6..0000000
--- a/car-libs/car/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2015 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.
-#
-#
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_AAPT_FLAGS := --auto-add-overlay \
- --extra-packages android.support.v7.appcompat \
- --extra-packages android.support.v7.recyclerview \
- --extra-packages android.support.v7.cardview
-
-LOCAL_MODULE := car
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../car-ui/res
-LOCAL_RESOURCE_DIR += frameworks/support/v7/appcompat/res
-LOCAL_RESOURCE_DIR += frameworks/support/v7/recyclerview/res
-LOCAL_RESOURCE_DIR += frameworks/support/v7/cardview/res
-LOCAL_SDK_VERSION := current
-
-LOCAL_MANIFEST_FILE := ../car-ui/AndroidManifest.xml
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-recyclerview
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-cardview
-LOCAL_STATIC_JAVA_LIBRARIES += car-core car-ui
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/car-libs/car-ui/Android.mk b/car-support-lib/Android.mk
similarity index 64%
rename from car-libs/car-ui/Android.mk
rename to car-support-lib/Android.mk
index 016b849..b3f6c89 100644
--- a/car-libs/car-ui/Android.mk
+++ b/car-support-lib/Android.mk
@@ -14,6 +14,9 @@
#
#
+#disble build in PDK, should add prebuilts/fullsdk to make this work
+ifneq ($(TARGET_BUILD_PDK),true)
+
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
@@ -22,7 +25,7 @@
--extra-packages android.support.v7.recyclerview \
--extra-packages android.support.v7.cardview
-LOCAL_MODULE := car-ui
+LOCAL_MODULE := android.support.car
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_RESOURCE_DIR += frameworks/support/v7/appcompat/res
@@ -30,11 +33,19 @@
LOCAL_RESOURCE_DIR += frameworks/support/v7/cardview/res
LOCAL_SDK_VERSION := current
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_MANIFEST_FILE := AndroidManifest.xml
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-recyclerview
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-cardview
+LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src)
-include $(BUILD_STATIC_JAVA_LIBRARY)
\ No newline at end of file
+LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4 \
+ android-support-v7-appcompat \
+ android-support-v7-recyclerview \
+ android-support-v7-cardview \
+ jsr305
+
+LOCAL_JAVA_LIBRARIES += android.car
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+endif #TARGET_BUILD_PDK
diff --git a/car-libs/car-ui/AndroidManifest.xml b/car-support-lib/AndroidManifest.xml
similarity index 100%
rename from car-libs/car-ui/AndroidManifest.xml
rename to car-support-lib/AndroidManifest.xml
diff --git a/car-libs/car.mk b/car-support-lib/car-support.mk
similarity index 89%
rename from car-libs/car.mk
rename to car-support-lib/car-support.mk
index 4be30ba..912b87b 100644
--- a/car-libs/car.mk
+++ b/car-support-lib/car-support.mk
@@ -9,7 +9,7 @@
# LOCAL_RESOURCE_DIR := \
# $(LOCAL_PATH)/res
#
-# include packages/services/Car/car-libs/car.mk
+# include packages/services/Car/car-support-lib/car-support.mk
#
# Check that LOCAL_RESOURCE_DIR is defined
@@ -25,9 +25,9 @@
# Include car ui library, if not already included
ifeq (,$(findstring car,$(LOCAL_STATIC_JAVA_LIBRARIES)))
LOCAL_RESOURCE_DIR += \
- packages/services/Car/car-libs/car-ui/res
+ packages/services/Car/car-support-lib/res
LOCAL_AAPT_FLAGS += --extra-packages android.support.car.ui
-LOCAL_STATIC_JAVA_LIBRARIES += car
+LOCAL_STATIC_JAVA_LIBRARIES += android.support.car
endif
## Include transitive dependencies below
@@ -52,3 +52,5 @@
LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.cardview
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-cardview
endif
+LOCAL_JAVA_LIBRARIES += android.car
+
diff --git a/car-libs/car-ui/res/anim/car_fab_state_list_animator.xml b/car-support-lib/res/anim/car_fab_state_list_animator.xml
similarity index 100%
rename from car-libs/car-ui/res/anim/car_fab_state_list_animator.xml
rename to car-support-lib/res/anim/car_fab_state_list_animator.xml
diff --git a/car-libs/car-ui/res/anim/car_list_in.xml b/car-support-lib/res/anim/car_list_in.xml
similarity index 100%
rename from car-libs/car-ui/res/anim/car_list_in.xml
rename to car-support-lib/res/anim/car_list_in.xml
diff --git a/car-libs/car-ui/res/anim/car_list_out.xml b/car-support-lib/res/anim/car_list_out.xml
similarity index 100%
rename from car-libs/car-ui/res/anim/car_list_out.xml
rename to car-support-lib/res/anim/car_list_out.xml
diff --git a/car-libs/car-ui/res/anim/car_list_pop_out.xml b/car-support-lib/res/anim/car_list_pop_out.xml
similarity index 100%
rename from car-libs/car-ui/res/anim/car_list_pop_out.xml
rename to car-support-lib/res/anim/car_list_pop_out.xml
diff --git a/car-libs/car-ui/res/anim/sdk_list_out.xml b/car-support-lib/res/anim/sdk_list_out.xml
similarity index 100%
rename from car-libs/car-ui/res/anim/sdk_list_out.xml
rename to car-support-lib/res/anim/sdk_list_out.xml
diff --git a/car-libs/car-ui/res/drawable-hdpi/drawer_shadow.9.png b/car-support-lib/res/drawable-hdpi/drawer_shadow.9.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/drawer_shadow.9.png
rename to car-support-lib/res/drawable-hdpi/drawer_shadow.9.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-hdpi/error_illustration.png b/car-support-lib/res/drawable-hdpi/error_illustration.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/error_illustration.png
rename to car-support-lib/res/drawable-hdpi/error_illustration.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-hdpi/ic_chevron_right.png b/car-support-lib/res/drawable-hdpi/ic_chevron_right.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/ic_chevron_right.png
rename to car-support-lib/res/drawable-hdpi/ic_chevron_right.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-hdpi/ic_down.png b/car-support-lib/res/drawable-hdpi/ic_down.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/ic_down.png
rename to car-support-lib/res/drawable-hdpi/ic_down.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-hdpi/ic_launcher.png b/car-support-lib/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/ic_launcher.png
rename to car-support-lib/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-hdpi/ic_remove_circle.png b/car-support-lib/res/drawable-hdpi/ic_remove_circle.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/ic_remove_circle.png
rename to car-support-lib/res/drawable-hdpi/ic_remove_circle.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-hdpi/ic_up.png b/car-support-lib/res/drawable-hdpi/ic_up.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/ic_up.png
rename to car-support-lib/res/drawable-hdpi/ic_up.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-hdpi/ic_up_dark.png b/car-support-lib/res/drawable-hdpi/ic_up_dark.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-hdpi/ic_up_dark.png
rename to car-support-lib/res/drawable-hdpi/ic_up_dark.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-mdpi/drawer_shadow.9.png b/car-support-lib/res/drawable-mdpi/drawer_shadow.9.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-mdpi/drawer_shadow.9.png
rename to car-support-lib/res/drawable-mdpi/drawer_shadow.9.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-mdpi/error_illustration.png b/car-support-lib/res/drawable-mdpi/error_illustration.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-mdpi/error_illustration.png
rename to car-support-lib/res/drawable-mdpi/error_illustration.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-mdpi/ic_chevron_right.png b/car-support-lib/res/drawable-mdpi/ic_chevron_right.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-mdpi/ic_chevron_right.png
rename to car-support-lib/res/drawable-mdpi/ic_chevron_right.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-mdpi/ic_down.png b/car-support-lib/res/drawable-mdpi/ic_down.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-mdpi/ic_down.png
rename to car-support-lib/res/drawable-mdpi/ic_down.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-mdpi/ic_remove_circle.png b/car-support-lib/res/drawable-mdpi/ic_remove_circle.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-mdpi/ic_remove_circle.png
rename to car-support-lib/res/drawable-mdpi/ic_remove_circle.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-mdpi/ic_up.png b/car-support-lib/res/drawable-mdpi/ic_up.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-mdpi/ic_up.png
rename to car-support-lib/res/drawable-mdpi/ic_up.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-mdpi/ic_up_dark.png b/car-support-lib/res/drawable-mdpi/ic_up_dark.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-mdpi/ic_up_dark.png
rename to car-support-lib/res/drawable-mdpi/ic_up_dark.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-v21/car_pagination_background.xml b/car-support-lib/res/drawable-v21/car_pagination_background.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable-v21/car_pagination_background.xml
rename to car-support-lib/res/drawable-v21/car_pagination_background.xml
diff --git a/car-libs/car-ui/res/drawable-v21/car_pagination_background_dark.xml b/car-support-lib/res/drawable-v21/car_pagination_background_dark.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable-v21/car_pagination_background_dark.xml
rename to car-support-lib/res/drawable-v21/car_pagination_background_dark.xml
diff --git a/car-libs/car-ui/res/drawable-v21/car_pagination_background_light.xml b/car-support-lib/res/drawable-v21/car_pagination_background_light.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable-v21/car_pagination_background_light.xml
rename to car-support-lib/res/drawable-v21/car_pagination_background_light.xml
diff --git a/car-libs/car-ui/res/drawable-xhdpi/drawer_shadow.9.png b/car-support-lib/res/drawable-xhdpi/drawer_shadow.9.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xhdpi/drawer_shadow.9.png
rename to car-support-lib/res/drawable-xhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xhdpi/error_illustration.png b/car-support-lib/res/drawable-xhdpi/error_illustration.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xhdpi/error_illustration.png
rename to car-support-lib/res/drawable-xhdpi/error_illustration.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xhdpi/ic_chevron_right.png b/car-support-lib/res/drawable-xhdpi/ic_chevron_right.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xhdpi/ic_chevron_right.png
rename to car-support-lib/res/drawable-xhdpi/ic_chevron_right.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xhdpi/ic_down.png b/car-support-lib/res/drawable-xhdpi/ic_down.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xhdpi/ic_down.png
rename to car-support-lib/res/drawable-xhdpi/ic_down.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xhdpi/ic_remove_circle.png b/car-support-lib/res/drawable-xhdpi/ic_remove_circle.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xhdpi/ic_remove_circle.png
rename to car-support-lib/res/drawable-xhdpi/ic_remove_circle.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xhdpi/ic_up.png b/car-support-lib/res/drawable-xhdpi/ic_up.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xhdpi/ic_up.png
rename to car-support-lib/res/drawable-xhdpi/ic_up.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xhdpi/ic_up_dark.png b/car-support-lib/res/drawable-xhdpi/ic_up_dark.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xhdpi/ic_up_dark.png
rename to car-support-lib/res/drawable-xhdpi/ic_up_dark.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xxhdpi/drawer_shadow.9.png b/car-support-lib/res/drawable-xxhdpi/drawer_shadow.9.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xxhdpi/drawer_shadow.9.png
rename to car-support-lib/res/drawable-xxhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xxhdpi/error_illustration.png b/car-support-lib/res/drawable-xxhdpi/error_illustration.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xxhdpi/error_illustration.png
rename to car-support-lib/res/drawable-xxhdpi/error_illustration.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xxhdpi/ic_chevron_right.png b/car-support-lib/res/drawable-xxhdpi/ic_chevron_right.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xxhdpi/ic_chevron_right.png
rename to car-support-lib/res/drawable-xxhdpi/ic_chevron_right.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xxhdpi/ic_down.png b/car-support-lib/res/drawable-xxhdpi/ic_down.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xxhdpi/ic_down.png
rename to car-support-lib/res/drawable-xxhdpi/ic_down.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xxhdpi/ic_remove_circle.png b/car-support-lib/res/drawable-xxhdpi/ic_remove_circle.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xxhdpi/ic_remove_circle.png
rename to car-support-lib/res/drawable-xxhdpi/ic_remove_circle.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xxhdpi/ic_up.png b/car-support-lib/res/drawable-xxhdpi/ic_up.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xxhdpi/ic_up.png
rename to car-support-lib/res/drawable-xxhdpi/ic_up.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable-xxhdpi/ic_up_dark.png b/car-support-lib/res/drawable-xxhdpi/ic_up_dark.png
similarity index 100%
rename from car-libs/car-ui/res/drawable-xxhdpi/ic_up_dark.png
rename to car-support-lib/res/drawable-xxhdpi/ic_up_dark.png
Binary files differ
diff --git a/car-libs/car-ui/res/drawable/car_empty.xml b/car-support-lib/res/drawable/car_empty.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable/car_empty.xml
rename to car-support-lib/res/drawable/car_empty.xml
diff --git a/car-libs/car-ui/res/drawable/car_header_button_background.xml b/car-support-lib/res/drawable/car_header_button_background.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable/car_header_button_background.xml
rename to car-support-lib/res/drawable/car_header_button_background.xml
diff --git a/car-libs/car-ui/res/drawable/car_list_item_background.xml b/car-support-lib/res/drawable/car_list_item_background.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable/car_list_item_background.xml
rename to car-support-lib/res/drawable/car_list_item_background.xml
diff --git a/car-libs/car-ui/res/drawable/car_pagination_background.xml b/car-support-lib/res/drawable/car_pagination_background.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable/car_pagination_background.xml
rename to car-support-lib/res/drawable/car_pagination_background.xml
diff --git a/car-libs/car-ui/res/drawable/car_pagination_background_dark.xml b/car-support-lib/res/drawable/car_pagination_background_dark.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable/car_pagination_background_dark.xml
rename to car-support-lib/res/drawable/car_pagination_background_dark.xml
diff --git a/car-libs/car-ui/res/drawable/car_pagination_background_light.xml b/car-support-lib/res/drawable/car_pagination_background_light.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable/car_pagination_background_light.xml
rename to car-support-lib/res/drawable/car_pagination_background_light.xml
diff --git a/car-libs/car-ui/res/drawable/rail_fab.xml b/car-support-lib/res/drawable/rail_fab.xml
similarity index 100%
rename from car-libs/car-ui/res/drawable/rail_fab.xml
rename to car-support-lib/res/drawable/rail_fab.xml
diff --git a/car-libs/car-ui/res/layout/car_imageview.xml b/car-support-lib/res/layout/car_imageview.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_imageview.xml
rename to car-support-lib/res/layout/car_imageview.xml
diff --git a/car-libs/car-ui/res/layout/car_list_item_1.xml b/car-support-lib/res/layout/car_list_item_1.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_list_item_1.xml
rename to car-support-lib/res/layout/car_list_item_1.xml
diff --git a/car-libs/car-ui/res/layout/car_list_item_1_card.xml b/car-support-lib/res/layout/car_list_item_1_card.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_list_item_1_card.xml
rename to car-support-lib/res/layout/car_list_item_1_card.xml
diff --git a/car-libs/car-ui/res/layout/car_list_item_1_small.xml b/car-support-lib/res/layout/car_list_item_1_small.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_list_item_1_small.xml
rename to car-support-lib/res/layout/car_list_item_1_small.xml
diff --git a/car-libs/car-ui/res/layout/car_list_item_1_small_card.xml b/car-support-lib/res/layout/car_list_item_1_small_card.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_list_item_1_small_card.xml
rename to car-support-lib/res/layout/car_list_item_1_small_card.xml
diff --git a/car-libs/car-ui/res/layout/car_list_item_2.xml b/car-support-lib/res/layout/car_list_item_2.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_list_item_2.xml
rename to car-support-lib/res/layout/car_list_item_2.xml
diff --git a/car-libs/car-ui/res/layout/car_list_item_2_card.xml b/car-support-lib/res/layout/car_list_item_2_card.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_list_item_2_card.xml
rename to car-support-lib/res/layout/car_list_item_2_card.xml
diff --git a/car-libs/car-ui/res/layout/car_list_item_empty.xml b/car-support-lib/res/layout/car_list_item_empty.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_list_item_empty.xml
rename to car-support-lib/res/layout/car_list_item_empty.xml
diff --git a/car-libs/car-ui/res/layout/car_menu_checkbox.xml b/car-support-lib/res/layout/car_menu_checkbox.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_menu_checkbox.xml
rename to car-support-lib/res/layout/car_menu_checkbox.xml
diff --git a/car-libs/car-ui/res/layout/car_menu_list_item.xml b/car-support-lib/res/layout/car_menu_list_item.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_menu_list_item.xml
rename to car-support-lib/res/layout/car_menu_list_item.xml
diff --git a/car-libs/car-ui/res/layout/car_paged_recycler_view.xml b/car-support-lib/res/layout/car_paged_recycler_view.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_paged_recycler_view.xml
rename to car-support-lib/res/layout/car_paged_recycler_view.xml
diff --git a/car-libs/car-ui/res/layout/car_paged_scrollbar_buttons.xml b/car-support-lib/res/layout/car_paged_scrollbar_buttons.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_paged_scrollbar_buttons.xml
rename to car-support-lib/res/layout/car_paged_scrollbar_buttons.xml
diff --git a/car-libs/car-ui/res/layout/car_textview.xml b/car-support-lib/res/layout/car_textview.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_textview.xml
rename to car-support-lib/res/layout/car_textview.xml
diff --git a/car-libs/car-ui/res/layout/car_unavailable_category.xml b/car-support-lib/res/layout/car_unavailable_category.xml
similarity index 100%
rename from car-libs/car-ui/res/layout/car_unavailable_category.xml
rename to car-support-lib/res/layout/car_unavailable_category.xml
diff --git a/car-libs/car-ui/res/values-night-wheel/colors.xml b/car-support-lib/res/values-night-wheel/colors.xml
similarity index 100%
rename from car-libs/car-ui/res/values-night-wheel/colors.xml
rename to car-support-lib/res/values-night-wheel/colors.xml
diff --git a/car-libs/car-ui/res/values-night/colors.xml b/car-support-lib/res/values-night/colors.xml
similarity index 100%
rename from car-libs/car-ui/res/values-night/colors.xml
rename to car-support-lib/res/values-night/colors.xml
diff --git a/car-libs/car-ui/res/values-notouch/bools.xml b/car-support-lib/res/values-notouch/bools.xml
similarity index 100%
rename from car-libs/car-ui/res/values-notouch/bools.xml
rename to car-support-lib/res/values-notouch/bools.xml
diff --git a/car-libs/car-ui/res/values-w1024dp/dimens.xml b/car-support-lib/res/values-w1024dp/dimens.xml
similarity index 100%
rename from car-libs/car-ui/res/values-w1024dp/dimens.xml
rename to car-support-lib/res/values-w1024dp/dimens.xml
diff --git a/car-libs/car-ui/res/values-wheel/bools.xml b/car-support-lib/res/values-wheel/bools.xml
similarity index 100%
rename from car-libs/car-ui/res/values-wheel/bools.xml
rename to car-support-lib/res/values-wheel/bools.xml
diff --git a/car-libs/car-ui/res/values-wheel/colors.xml b/car-support-lib/res/values-wheel/colors.xml
similarity index 100%
rename from car-libs/car-ui/res/values-wheel/colors.xml
rename to car-support-lib/res/values-wheel/colors.xml
diff --git a/car-libs/car-ui/res/values-wheel/dimens.xml b/car-support-lib/res/values-wheel/dimens.xml
similarity index 100%
rename from car-libs/car-ui/res/values-wheel/dimens.xml
rename to car-support-lib/res/values-wheel/dimens.xml
diff --git a/car-libs/car-ui/res/values/attrs.xml b/car-support-lib/res/values/attrs.xml
similarity index 100%
rename from car-libs/car-ui/res/values/attrs.xml
rename to car-support-lib/res/values/attrs.xml
diff --git a/car-libs/car-ui/res/values/bools.xml b/car-support-lib/res/values/bools.xml
similarity index 100%
rename from car-libs/car-ui/res/values/bools.xml
rename to car-support-lib/res/values/bools.xml
diff --git a/car-libs/car-ui/res/values/colors.xml b/car-support-lib/res/values/colors.xml
similarity index 100%
rename from car-libs/car-ui/res/values/colors.xml
rename to car-support-lib/res/values/colors.xml
diff --git a/car-libs/car-ui/res/values/dimens.xml b/car-support-lib/res/values/dimens.xml
similarity index 100%
rename from car-libs/car-ui/res/values/dimens.xml
rename to car-support-lib/res/values/dimens.xml
diff --git a/car-libs/car-ui/res/values/integers.xml b/car-support-lib/res/values/integers.xml
similarity index 100%
rename from car-libs/car-ui/res/values/integers.xml
rename to car-support-lib/res/values/integers.xml
diff --git a/car-libs/car-ui/res/values/strings.xml b/car-support-lib/res/values/strings.xml
similarity index 100%
rename from car-libs/car-ui/res/values/strings.xml
rename to car-support-lib/res/values/strings.xml
diff --git a/car-libs/car-ui/res/values/styles.xml b/car-support-lib/res/values/styles.xml
similarity index 100%
rename from car-libs/car-ui/res/values/styles.xml
rename to car-support-lib/res/values/styles.xml
diff --git a/car-support-lib/src/android/support/car/Car.java b/car-support-lib/src/android/support/car/Car.java
new file mode 100644
index 0000000..df2febd
--- /dev/null
+++ b/car-support-lib/src/android/support/car/Car.java
@@ -0,0 +1,423 @@
+/*
+ * Copyright (C) 2015 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.support.car;
+
+import android.support.annotation.IntDef;
+import android.support.annotation.Nullable;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Looper;
+import android.os.RemoteException;
+import android.support.car.content.pm.CarPackageManager;
+import android.support.car.hardware.CarSensorManager;
+import android.support.car.navigation.CarNavigationManager;
+import android.util.Log;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+
+import javax.annotation.concurrent.GuardedBy;
+
+/**
+ * Top level car API.
+ * This API works only for device with {@link PackageManager#FEATURE_AUTOMOTIVE} feature
+ * supported or device with Google play service.
+ * Calling this API with device with no such feature will lead into an exception.
+ *
+ */
+public class Car {
+
+ /** Service name for {@link CarSensorManager}, to be used in {@link #getCarManager(String)}. */
+ public static final String SENSOR_SERVICE = "sensor";
+
+ /** Service name for {@link CarInfoManager}, to be used in {@link #getCarManager(String)}. */
+ public static final String INFO_SERVICE = "info";
+
+ /** Service name for {@link CarAppContextManager}. */
+ public static final String APP_CONTEXT_SERVICE = "app_context";
+
+ /** Service name for {@link CarPackageManager} */
+ public static final String PACKAGE_SERVICE = "package";
+
+ /** Service name for {@link CarAudioManager} */
+ public static final String AUDIO_SERVICE = "audio";
+ /**
+ * Service name for {@link CarNavigationManager}
+ * @hide
+ */
+ public static final String CAR_NAVIGATION_SERVICE = "car_navigation_service";
+
+ /** Type of car connection: car emulator, not physical connection. */
+ public static final int CONNECTION_TYPE_EMULATOR = 0;
+ /** Type of car connection: connected to a car via USB. */
+ public static final int CONNECTION_TYPE_USB = 1;
+ /** Type of car connection: connected to a car via WIFI. */
+ public static final int CONNECTION_TYPE_WIFI = 2;
+ /** Type of car connection: on-device car emulator, for development (e.g. Local Head Unit). */
+ public static final int CONNECTION_TYPE_ON_DEVICE_EMULATOR = 3;
+ /** Type of car connection: car emulator, connected over ADB (e.g. Desktop Head Unit). */
+ public static final int CONNECTION_TYPE_ADB_EMULATOR = 4;
+ /** Type of car connection: platform runs directly in car. */
+ public static final int CONNECTION_TYPE_EMBEDDED = 5;
+
+ /** @hide */
+ @IntDef({CONNECTION_TYPE_EMULATOR, CONNECTION_TYPE_USB, CONNECTION_TYPE_WIFI,
+ CONNECTION_TYPE_ON_DEVICE_EMULATOR, CONNECTION_TYPE_ADB_EMULATOR, CONNECTION_TYPE_EMBEDDED})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ConnectionType {}
+
+ /** permission necessary to access car's mileage information */
+ public static final String PERMISSION_MILEAGE = "android.car.permission.CAR_MILEAGE";
+ /** permission necessary to access car's fuel level */
+ public static final String PERMISSION_FUEL = "android.car.permission.CAR_FUEL";
+ /** permission necessary to access car's speed */
+ public static final String PERMISSION_SPEED = "android.car.permission.CAR_SPEED";
+ /** permission necessary to access car specific communication channel */
+ public static final String PERMISSION_VENDOR_EXTENSION =
+ "android.car.permission.CAR_VENDOR_EXTENSION";
+
+ /**
+ * PackageManager.FEATURE_AUTOMOTIVE from M. But redefine here to support L.
+ * @hide
+ */
+ private static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
+
+ /**
+ * {@link CarServiceLoader} implementation for projected mode. Only available when projected
+ * client library is linked.
+ * @hide
+ */
+ private static final String PROJECTED_CAR_SERVICE_LOADER =
+ "com.google.android.gms.car.GoogleCarServiceLoader";
+
+ /**
+ * CarXyzService throws IllegalStateException with this message is re-thrown as
+ * {@link CarNotConnectedException}.
+ *
+ * @hide
+ */
+ public static final String CAR_NOT_CONNECTED_EXCEPTION_MSG = "CarNotConnected";
+
+ /** @hide */
+ public static final String CAR_SERVICE_INTERFACE_NAME = "android.car.ICar";
+
+ private final Context mContext;
+ private final Looper mLooper;
+ private static final int STATE_DISCONNECTED = 0;
+ private static final int STATE_CONNECTING = 1;
+ private static final int STATE_CONNECTED = 2;
+ @GuardedBy("this")
+ private int mConnectionState;
+
+ private final ServiceConnectionListener mServiceConnectionListener =
+ new ServiceConnectionListener () {
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ synchronized (Car.this) {
+ mConnectionState = STATE_CONNECTED;
+ }
+ mServiceConnectionListenerClient.onServiceConnected(name, service);
+ }
+
+ public void onServiceDisconnected(ComponentName name) {
+ synchronized (Car.this) {
+ if (mConnectionState == STATE_DISCONNECTED) {
+ return;
+ }
+ mConnectionState = STATE_DISCONNECTED;
+ }
+ mServiceConnectionListenerClient.onServiceDisconnected(name);
+ connect();
+ }
+
+ public void onServiceSuspended(int cause) {
+ mServiceConnectionListenerClient.onServiceSuspended(cause);
+ }
+
+ public void onServiceConnectionFailed(int cause) {
+ mServiceConnectionListenerClient.onServiceConnectionFailed(cause);
+ }
+ };
+
+ private final ServiceConnectionListener mServiceConnectionListenerClient;
+ private final Object mCarManagerLock = new Object();
+ @GuardedBy("mCarManagerLock")
+ private final HashMap<String, CarManagerBase> mServiceMap = new HashMap<>();
+ private final CarServiceLoader mCarServiceLoader;
+
+ /** Handler for generic event dispatching. */
+ private final Handler mEventHandler;
+
+ /**
+ * A factory method that creates Car instance for all Car API access.
+ * @param context
+ * @param serviceConnectionListener listner for monitoring service connection.
+ * @param looper Looper to dispatch all listeners. If null, it will use main thread. Note that
+ * service connection listener will be always in main thread regardless of this Looper.
+ * @return Car instance if system is in car environment and returns {@code null} otherwise.
+ */
+ public static Car createCar(Context context,
+ ServiceConnectionListener serviceConnectionListener, @Nullable Looper looper) {
+ try {
+ return new Car(context, serviceConnectionListener, looper);
+ } catch (IllegalArgumentException e) {
+ // Expected when car service loader is not available.
+ }
+ return null;
+ }
+
+ /**
+ * A factory method that creates Car instance for all Car API access using main thread {@code
+ * Looper}.
+ *
+ * @see #createCar(Context, ServiceConnectionListener, Looper)
+ */
+ public static Car createCar(Context context,
+ ServiceConnectionListener serviceConnectionListener) {
+ return createCar(context, serviceConnectionListener, null);
+ }
+
+ private Car(Context context, ServiceConnectionListener serviceConnectionListener,
+ @Nullable Looper looper) {
+ mContext = context;
+ mServiceConnectionListenerClient = serviceConnectionListener;
+ if (looper == null) {
+ mLooper = Looper.getMainLooper();
+ } else {
+ mLooper = looper;
+ }
+ mEventHandler = new Handler(mLooper);
+ if (mContext.getPackageManager().hasSystemFeature(FEATURE_AUTOMOTIVE)) {
+ mCarServiceLoader = new CarServiceLoaderEmbedded(context, mServiceConnectionListener,
+ mLooper);
+ } else {
+ mCarServiceLoader = loadCarServiceLoader(PROJECTED_CAR_SERVICE_LOADER, context,
+ mServiceConnectionListener, mLooper);
+ }
+ }
+
+ private CarServiceLoader loadCarServiceLoader(String carServiceLoaderClassName,
+ Context context, ServiceConnectionListener serviceConnectionListener, Looper looper)
+ throws IllegalArgumentException {
+ Class carServiceLoaderClass = null;
+ try {
+ carServiceLoaderClass = Class.forName(carServiceLoaderClassName);
+ } catch (ClassNotFoundException e) {
+ throw new IllegalArgumentException("Cannot find CarServiceLoader implementation:" +
+ carServiceLoaderClassName, e);
+ }
+ Constructor<?> ctor;
+ try {
+ ctor = carServiceLoaderClass.getDeclaredConstructor(Context.class,
+ ServiceConnectionListener.class, Looper.class);
+ } catch (NoSuchMethodException e) {
+ throw new IllegalArgumentException("Cannot construct CarServiceLoader, no constructor: "
+ + carServiceLoaderClassName, e);
+ }
+ try {
+ return (CarServiceLoader) ctor.newInstance(context,
+ serviceConnectionListener, looper);
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
+ throw new IllegalArgumentException(
+ "Cannot construct CarServiceLoader, constructor failed for "
+ + carServiceLoaderClass.getName(), e);
+ }
+ }
+
+ /**
+ * Car constructor when CarServiceLoader is already available.
+ * @param context
+ * @param service
+ * @param looper
+ *
+ * @hide
+ */
+ public Car(Context context, CarServiceLoader serviceLoader, @Nullable Looper looper) {
+ mContext = context;
+ if (looper == null) {
+ mLooper = Looper.getMainLooper();
+ } else {
+ mLooper = looper;
+ }
+ mEventHandler = new Handler(mLooper);
+ mConnectionState = STATE_CONNECTED;
+ mCarServiceLoader = serviceLoader;
+ mServiceConnectionListenerClient = null;
+ }
+
+ /**
+ * Connect to car service. This can be called while it is disconnected.
+ * @throws IllegalStateException If connection is still on-going from previous
+ * connect call or it is already connected
+ */
+ public void connect() throws IllegalStateException {
+ synchronized (this) {
+ if (mConnectionState != STATE_DISCONNECTED) {
+ throw new IllegalStateException("already connected or connecting");
+ }
+ mConnectionState = STATE_CONNECTING;
+ mCarServiceLoader.connect();
+ }
+ }
+
+ /**
+ * Disconnect from car service. This can be called while disconnected. Once disconnect is
+ * called, all Car*Managers from this instance becomes invalid, and
+ * {@link Car#getCarManager(String)} will return different instance if it is connected again.
+ */
+ public void disconnect() {
+ synchronized (this) {
+ if (mConnectionState == STATE_DISCONNECTED) {
+ return;
+ }
+ tearDownCarManagers();
+ mConnectionState = STATE_DISCONNECTED;
+ mCarServiceLoader.disconnect();
+ }
+ }
+
+ /**
+ * Tells if it is connected to the service or not. This will return false if it is still
+ * connecting.
+ * @return
+ */
+ public boolean isConnected() {
+ synchronized (this) {
+ return mConnectionState == STATE_CONNECTED;
+ }
+ }
+
+ /**
+ * Tells if this instance is already connecting to car service or not.
+ * @return
+ */
+ public boolean isConnecting() {
+ synchronized (this) {
+ return mConnectionState == STATE_CONNECTING;
+ }
+ }
+
+ /**
+ * Tells if car is connected to car or not. In some car environments, being connected to service
+ * does not necessarily mean being connected to car.
+ */
+ public boolean isConnectedToCar() {
+ return mCarServiceLoader.isConnectedToCar();
+ }
+
+ /**
+ * Get car specific service as in {@link Context#getSystemService(String)}. Returned
+ * {@link Object} should be type-casted to the desired service.
+ * For example, to get sensor service,
+ * SensorManagerService sensorManagerService = car.getCarManager(Car.SENSOR_SERVICE);
+ * @param serviceName Name of service that should be created like {@link #SENSOR_SERVICE}.
+ * @return Matching service manager or null if there is no such service.
+ */
+ public Object getCarManager(String serviceName) {
+ Object manager = null;
+ synchronized (mCarManagerLock) {
+ manager = mServiceMap.get(serviceName);
+ if (manager == null) {
+ manager = mCarServiceLoader.getCarManager(serviceName);
+ }
+ // do not store if it is not CarManagerBase. This can happen when system version
+ // is retrieved from this call.
+ if (manager != null && manager instanceof CarManagerBase) {
+ mServiceMap.put(serviceName, (CarManagerBase) manager);
+ }
+ }
+ return manager;
+ }
+
+ /**
+ * Return the type of currently connected car.
+ * @return
+ * @throws CarNotConnectedException
+ */
+ @ConnectionType
+ public int getCarConnectionType() throws CarNotConnectedException {
+ return mCarServiceLoader.getCarConnectionType();
+ }
+
+ /**
+ * Registers a {@link CarConnectionListener}.
+ *
+ * Avoid reregistering unregistered listeners. If an unregistered listener is reregistered,
+ * it may receive duplicate calls to {@link CarConnectionListener#onConnected}.
+ *
+ * @throws IllegalStateException if service is not connected.
+ */
+ public void registerCarConnectionListener(CarConnectionListener listener)
+ throws IllegalStateException {
+ assertCarConnection();
+ mCarServiceLoader.registerCarConnectionListener(listener);
+ }
+
+ /**
+ * Unregisters a {@link CarConnectionListener}.
+ *
+ * <b>Note:</b> If this method is called from a thread besides the client's looper thread,
+ * there is no guarantee that the unregistered listener will not receive callbacks after
+ * this method returns.
+ */
+ public void unregisterCarConnectionListener(CarConnectionListener listener) {
+ mCarServiceLoader.unregisterCarConnectionListener(listener);
+ }
+
+ /**
+ * IllegalStateException from XyzCarService with special message is re-thrown as a different
+ * exception. If the IllegalStateException is not understood then this message will throw the
+ * original exception.
+ *
+ * @param e exception from XyzCarService.
+ * @throws CarNotConnectedException
+ * @hide
+ */
+ public static void checkCarNotConnectedExceptionFromCarService(
+ IllegalStateException e) throws CarNotConnectedException, IllegalStateException {
+ String message = e.getMessage();
+ if (message.equals(CAR_NOT_CONNECTED_EXCEPTION_MSG)) {
+ throw new CarNotConnectedException();
+ } else {
+ throw e;
+ }
+ }
+
+ private synchronized void assertCarConnection() throws IllegalStateException {
+ if (!mCarServiceLoader.isConnectedToCar()) {
+ throw new IllegalStateException("not connected");
+ }
+ }
+
+ private void tearDownCarManagers() {
+ synchronized (mCarManagerLock) {
+ for (CarManagerBase manager: mServiceMap.values()) {
+ manager.onCarDisconnected();
+ }
+ mServiceMap.clear();
+ }
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/CarApiUtil.java b/car-support-lib/src/android/support/car/CarApiUtil.java
similarity index 97%
rename from car-libs/car-core/src/android/support/car/CarApiUtil.java
rename to car-support-lib/src/android/support/car/CarApiUtil.java
index f3d3dba..6f03f27 100644
--- a/car-libs/car-core/src/android/support/car/CarApiUtil.java
+++ b/car-support-lib/src/android/support/car/CarApiUtil.java
@@ -77,4 +77,6 @@
}
}
+ /** do not use */
+ private CarApiUtil() {};
}
diff --git a/car-support-lib/src/android/support/car/CarAppContextManager.java b/car-support-lib/src/android/support/car/CarAppContextManager.java
new file mode 100644
index 0000000..0ae9b8c
--- /dev/null
+++ b/car-support-lib/src/android/support/car/CarAppContextManager.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2015 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.support.car;
+
+/**
+ * CarAppContextManager allows applications to set and listen for the current application context
+ * like active navigation or active voice command. Usually only one instance of such application
+ * should run in the system, and other app setting the flag for the matching app should
+ * lead into other app to stop.
+ */
+public abstract class CarAppContextManager implements CarManagerBase {
+ /**
+ * Listener to get notification for app getting information on app context change or
+ * ownership loss.
+ */
+ public interface AppContextChangeListener {
+ /**
+ * Application context has changed. Note that {@link CarAppContextManager} instance
+ * causing the change will not get this notification.
+ * @param activeContexts
+ */
+ void onAppContextChange(int activeContexts);
+
+ /**
+ * Lost ownership for the context, which happens when other app has set the context.
+ * The app losing context should stop the action associated with the context.
+ * For example, navigaiton app currently running active navigation should stop navigation
+ * upon getting this for {@link CarAppContextManager#APP_CONTEXT_NAVIGATION}.
+ * @param context
+ */
+ void onAppContextOwnershipLoss(int context);
+ }
+
+ /** @hide */
+ public static final int APP_CONTEXT_START_FLAG = 0x1;
+ /**
+ * Flag for active navigation.
+ */
+ public static final int APP_CONTEXT_NAVIGATION = 0x1;
+ /**
+ * Flag for active voice command.
+ */
+ public static final int APP_CONTEXT_VOICE_COMMAND = 0x2;
+ /**
+ * Update this after adding a new flag.
+ * @hide
+ */
+ public static final int APP_CONTEXT_END_FLAG = 0x2;
+
+ /**
+ * Register listener to monitor app context change. Only one listener can be registered and
+ * registering multiple times will lead into only the last listener to be active.
+ * @param listener
+ * @param contextFilter Flags of contexts to get notification.
+ */
+ public abstract void registerContextListener(AppContextChangeListener listener,
+ int contextFilter);
+
+ /**
+ * Unregister listener and stop listening context change events. If app has owned a context
+ * by {@link #setActiveContext(int)}, it will be reset to inactive state.
+ */
+ public abstract void unregisterContextListener();
+
+ /**
+ * Retrieve currently active contexts.
+ * @return
+ */
+ public abstract int getActiveAppContexts();
+
+ /**
+ * Check if the current process is owning the given context.
+ * @param context
+ * @return
+ */
+ public abstract boolean isOwningContext(int context);
+
+ /**
+ * Set the given contexts as active. By setting this, the application is becoming owner
+ * of the context, and will get {@link AppContextChangeListener#onAppContextOwnershipLoss(int)}
+ * if ownership is given to other app by calling this. Fore-ground app will have higher priority
+ * and other app cannot set the same context while owner is in fore-ground.
+ * Before calling this, {@link #registerContextListener(AppContextChangeListener, int)} should
+ * be called first. Otherwise, it will throw IllegalStateException
+ * @param contexts
+ * @throws IllegalStateException If listener was not registered.
+ * @throws SecurityException If owner cannot be changed.
+ */
+ public abstract void setActiveContexts(int contexts)
+ throws IllegalStateException, SecurityException;
+
+ /**
+ * Reset the given contexts, i.e. mark them as inactive. This also involves releasing ownership
+ * for the context.
+ * @param contexts
+ */
+ public abstract void resetActiveContexts(int contexts);
+}
diff --git a/car-support-lib/src/android/support/car/CarAppContextManagerEmbedded.java b/car-support-lib/src/android/support/car/CarAppContextManagerEmbedded.java
new file mode 100644
index 0000000..1b20989
--- /dev/null
+++ b/car-support-lib/src/android/support/car/CarAppContextManagerEmbedded.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2016 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.support.car;
+
+import android.os.Looper;
+
+/**
+ * Implementation of {@link CarAppContextManager} for embedded.
+ * @hide
+ */
+public class CarAppContextManagerEmbedded extends CarAppContextManager {
+
+ private final android.car.CarAppContextManager mManager;
+ private AppContextChangeListenerProxy mListener;
+
+ /**
+ * @hide
+ */
+ CarAppContextManagerEmbedded(Object manager) {
+ mManager = (android.car.CarAppContextManager) manager;
+ }
+
+ @Override
+ public void registerContextListener(AppContextChangeListener listener, int contextFilter) {
+ if (listener == null) {
+ throw new IllegalArgumentException("null listener");
+ }
+ AppContextChangeListenerProxy proxy = new AppContextChangeListenerProxy(listener);
+ synchronized(this) {
+ mListener = proxy;
+ }
+ mManager.registerContextListener(proxy, contextFilter);
+ }
+
+ @Override
+ public void unregisterContextListener() {
+ synchronized(this) {
+ mListener = null;
+ }
+ mManager.unregisterContextListener();
+ }
+
+ @Override
+ public int getActiveAppContexts() {
+ return mManager.getActiveAppContexts();
+ }
+
+ @Override
+ public boolean isOwningContext(int context) {
+ return mManager.isOwningContext(context);
+ }
+
+ @Override
+ public void setActiveContexts(int contexts) throws IllegalStateException, SecurityException {
+ mManager.setActiveContexts(contexts);
+ }
+
+ @Override
+ public void resetActiveContexts(int contexts) {
+ mManager.resetActiveContexts(contexts);
+ }
+
+ @Override
+ public void onCarDisconnected() {
+ // nothing to do
+ }
+
+ private static class AppContextChangeListenerProxy implements
+ android.car.CarAppContextManager.AppContextChangeListener {
+
+ private final AppContextChangeListener mListener;
+
+ public AppContextChangeListenerProxy(AppContextChangeListener listener) {
+ mListener = listener;
+ }
+
+ @Override
+ public void onAppContextChange(int activeContexts) {
+ mListener.onAppContextChange(activeContexts);
+ }
+
+ @Override
+ public void onAppContextOwnershipLoss(int context) {
+ mListener.onAppContextOwnershipLoss(context);
+ }
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/CarConnectionListener.java b/car-support-lib/src/android/support/car/CarConnectionListener.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/CarConnectionListener.java
rename to car-support-lib/src/android/support/car/CarConnectionListener.java
diff --git a/car-support-lib/src/android/support/car/CarInfoManager.java b/car-support-lib/src/android/support/car/CarInfoManager.java
new file mode 100644
index 0000000..78eacac
--- /dev/null
+++ b/car-support-lib/src/android/support/car/CarInfoManager.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2015 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.support.car;
+
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.support.car.annotation.ValueTypeDef;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+
+/**
+ * Utility to retrieve various static information from car. For given string keys, there can be
+ * different types of values and right query API like {@link #getFloat(String)} for float
+ * type, and {@link #getInt(String)} for int type, should be used. Passing a key string to wrong
+ * API will lead into {@link IllegalArgumentException}. All get* apis return null if requested
+ * property is not supported by the car. So caller should always check for null result.
+ */
+public abstract class CarInfoManager implements CarManagerBase {
+
+ /**
+ * Manufacturer of the car.
+ */
+ @ValueTypeDef(type = String.class)
+ public static final String KEY_MANUFACTURER = "manufacturer";
+ /**
+ * Model name of the car. This information may not necessarily allow distinguishing different
+ * car models as the same name may be used for different cars depending on manufacturers.
+ */
+ @ValueTypeDef(type = String.class)
+ public static final String KEY_MODEL = "model";
+ /**
+ * Model year of the car in AC.
+ */
+ @ValueTypeDef(type = Integer.class)
+ public static final String KEY_MODEL_YEAR = "model-year";
+ /**
+ * Unique identifier for the car. This is not VIN, and id is persistent until user resets it.
+ */
+ @ValueTypeDef(type = String.class)
+ public static final String KEY_VEHICLE_ID = "vehicle-id";
+
+ /**
+ * Retrieve floating point information for car.
+ * @param key
+ * @return null if the key is not supported.
+ * @throws CarNotConnectedException
+ * @throws IllegalArgumentException
+ */
+ public abstract Float getFloat(String key)
+ throws CarNotConnectedException, IllegalArgumentException;
+
+ public abstract Integer getInt(String key)
+ throws CarNotConnectedException, IllegalArgumentException;
+
+ public abstract Long getLong(String key)
+ throws CarNotConnectedException, IllegalArgumentException;
+
+ public abstract String getString(String key)
+ throws CarNotConnectedException, IllegalArgumentException;
+
+ /**
+ * get Bundle for the given key. This is intended for passing vendor specific data for key
+ * defined only for the car vendor. Vendor extension can be used for other APIs like
+ * getInt / getString, but this is for passing more complex data.
+ * @param key
+ * @return
+ * @throws CarNotConnectedException
+ * @throws IllegalArgumentException
+ * @hide
+ */
+ public abstract Bundle getBundle(String key)
+ throws CarNotConnectedException, IllegalArgumentException;
+}
diff --git a/car-support-lib/src/android/support/car/CarInfoManagerEmbedded.java b/car-support-lib/src/android/support/car/CarInfoManagerEmbedded.java
new file mode 100644
index 0000000..03527b3
--- /dev/null
+++ b/car-support-lib/src/android/support/car/CarInfoManagerEmbedded.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2016 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.support.car;
+
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.support.car.annotation.ValueTypeDef;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+
+/** @hide */
+public class CarInfoManagerEmbedded extends CarInfoManager {
+
+ private final android.car.CarInfoManager mManager;
+
+
+ /** @hide */
+ CarInfoManagerEmbedded(Object manager) {
+ mManager = (android.car.CarInfoManager) manager;
+ }
+
+ @Override
+ public Float getFloat(String key) throws CarNotConnectedException, IllegalArgumentException {
+ try {
+ return mManager.getFloat(key);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public Integer getInt(String key) throws CarNotConnectedException, IllegalArgumentException {
+ try {
+ return mManager.getInt(key);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public Long getLong(String key) throws CarNotConnectedException, IllegalArgumentException {
+ try {
+ return mManager.getLong(key);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public String getString(String key) throws CarNotConnectedException, IllegalArgumentException {
+ try {
+ return mManager.getString(key);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ /**
+ * get Bundle for the given key. This is intended for passing vendor specific data for key
+ * defined only for the car vendor. Vendor extension can be used for other APIs like
+ * getInt / getString, but this is for passing more complex data.
+ * @param key
+ * @return
+ * @throws CarNotConnectedException
+ * @throws IllegalArgumentException
+ * @hide
+ */
+ @Override
+ public Bundle getBundle(String key) throws CarNotConnectedException, IllegalArgumentException {
+ try {
+ return mManager.getBundle(key);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ /** @hide */
+ @Override
+ public void onCarDisconnected() {
+ //nothing to do
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/CarLibLog.java b/car-support-lib/src/android/support/car/CarLibLog.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/CarLibLog.java
rename to car-support-lib/src/android/support/car/CarLibLog.java
diff --git a/car-libs/car-core/src/android/support/car/CarManagerBase.java b/car-support-lib/src/android/support/car/CarManagerBase.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/CarManagerBase.java
rename to car-support-lib/src/android/support/car/CarManagerBase.java
diff --git a/car-libs/car-core/src/android/support/car/CarNotConnectedException.java b/car-support-lib/src/android/support/car/CarNotConnectedException.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/CarNotConnectedException.java
rename to car-support-lib/src/android/support/car/CarNotConnectedException.java
diff --git a/car-libs/car-core/src/android/support/car/CarNotSupportedException.java b/car-support-lib/src/android/support/car/CarNotSupportedException.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/CarNotSupportedException.java
rename to car-support-lib/src/android/support/car/CarNotSupportedException.java
diff --git a/car-support-lib/src/android/support/car/CarServiceLoader.java b/car-support-lib/src/android/support/car/CarServiceLoader.java
new file mode 100644
index 0000000..82b6821
--- /dev/null
+++ b/car-support-lib/src/android/support/car/CarServiceLoader.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015 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.support.car;
+
+import android.content.Context;
+import android.os.Looper;
+import android.support.car.CarConnectionListener;
+import android.support.car.ServiceConnectionListener;
+
+/**
+ * CarServiceLoader is the abstraction for loading different types of car service.
+ * @hide
+ */
+public abstract class CarServiceLoader {
+
+ private final Context mContext;
+ private final ServiceConnectionListener mListener;
+ private final Looper mLooper;
+
+ public CarServiceLoader(Context context, ServiceConnectionListener listener, Looper looper) {
+ mContext = context;
+ mListener = listener;
+ mLooper = looper;
+ }
+
+ public abstract void connect() throws IllegalStateException;
+ public abstract void disconnect();
+ public abstract boolean isConnectedToCar();
+ public abstract int getCarConnectionType();
+ public abstract void registerCarConnectionListener(CarConnectionListener listener);
+ public abstract void unregisterCarConnectionListener(CarConnectionListener listener);
+ public abstract Object getCarManager(String serviceName);
+
+ protected Context getContext() {
+ return mContext;
+ }
+
+ protected ServiceConnectionListener getConnectionListener() {
+ return mListener;
+ }
+
+ protected Looper getLooper() {
+ return mLooper;
+ }
+}
diff --git a/car-support-lib/src/android/support/car/CarServiceLoaderEmbedded.java b/car-support-lib/src/android/support/car/CarServiceLoaderEmbedded.java
new file mode 100644
index 0000000..69e608c
--- /dev/null
+++ b/car-support-lib/src/android/support/car/CarServiceLoaderEmbedded.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2015 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.support.car;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.ServiceConnection;
+import android.os.IBinder;
+import android.os.Looper;
+import android.support.car.Car;
+import android.support.car.content.pm.CarPackageManagerEmbedded;
+import android.support.car.hardware.CarSensorManagerEmbedded;
+import android.support.car.media.CarAudioManagerEmbedded;
+import android.support.car.navigation.CarNavigationManagerEmbedded;
+import android.support.car.CarConnectionListener;
+
+import java.util.LinkedList;
+
+/**
+ * Default CarServiceLoader for system with built-in car service (=embedded).
+ * @hide
+ */
+public class CarServiceLoaderEmbedded extends CarServiceLoader {
+
+ private final ServiceConnection mServiceConnection = new ServiceConnection() {
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ getConnectionListener().onServiceConnected(name, service);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ getConnectionListener().onServiceDisconnected(name);
+ }
+ };
+
+ private final android.car.Car mCar;
+ private final LinkedList<CarConnectionListenerProxy> mCarConnectionListenerProxies =
+ new LinkedList<>();
+
+ public CarServiceLoaderEmbedded(Context context, ServiceConnectionListener listener,
+ Looper looper) {
+ super(context, listener, looper);
+ mCar = android.car.Car.createCar(context, mServiceConnection, looper);
+ }
+
+ @Override
+ public void connect() throws IllegalStateException {
+ mCar.connect();
+ }
+
+ @Override
+ public void disconnect() {
+ mCar.disconnect();
+ }
+
+ @Override
+ public boolean isConnectedToCar() {
+ return mCar.isConnectedToCar();
+ }
+
+ @Override
+ public int getCarConnectionType() {
+ return mCar.getCarConnectionType();
+ }
+
+ @Override
+ public void registerCarConnectionListener(CarConnectionListener listener) {
+ CarConnectionListenerProxy newProxy = null;
+ synchronized (this) {
+ boolean alreadyRegistered = false;
+ for (CarConnectionListenerProxy proxy : mCarConnectionListenerProxies) {
+ if (proxy.isSameListener(listener)) {
+ alreadyRegistered = true;
+ break;
+ }
+ }
+ if (!alreadyRegistered) {
+ newProxy = new CarConnectionListenerProxy(listener);
+ mCarConnectionListenerProxies.add(newProxy);
+ }
+ }
+ if (newProxy != null) {
+ mCar.registerCarConnectionListener(newProxy);
+ }
+ }
+
+ @Override
+ public void unregisterCarConnectionListener(CarConnectionListener listener) {
+ CarConnectionListenerProxy matchingProxy = null;
+ synchronized (this) {
+ for (CarConnectionListenerProxy proxy : mCarConnectionListenerProxies) {
+ if (proxy.isSameListener(listener)) {
+ matchingProxy = proxy;
+ break;
+ }
+ }
+ if (matchingProxy != null) {
+ mCarConnectionListenerProxies.remove(matchingProxy);
+ }
+ }
+ if (matchingProxy != null) {
+ mCar.unregisterCarConnectionListener(matchingProxy);
+ }
+ }
+
+ @Override
+ public Object getCarManager(String serviceName) {
+ Object manager = mCar.getCarManager(serviceName);
+ if (manager == null) {
+ return null;
+ }
+ // For publicly available versions, return wrapper version.
+ switch (serviceName) {
+ case Car.AUDIO_SERVICE:
+ return new CarAudioManagerEmbedded(manager);
+ case Car.SENSOR_SERVICE:
+ return new CarSensorManagerEmbedded(manager);
+ case Car.INFO_SERVICE:
+ return new CarInfoManagerEmbedded(manager);
+ case Car.APP_CONTEXT_SERVICE:
+ return new CarAppContextManagerEmbedded(manager);
+ case Car.PACKAGE_SERVICE:
+ return new CarPackageManagerEmbedded(manager);
+ case Car.CAR_NAVIGATION_SERVICE:
+ return new CarNavigationManagerEmbedded(manager);
+ default:
+ return manager;
+ }
+ }
+
+ private static class CarConnectionListenerProxy implements android.car.CarConnectionListener {
+ private final CarConnectionListener mListener;
+
+ public CarConnectionListenerProxy(CarConnectionListener listener) {
+ mListener = listener;
+ }
+
+ public boolean isSameListener(CarConnectionListener listener) {
+ return mListener == listener;
+ }
+
+ @Override
+ public void onConnected(int connectionType) {
+ mListener.onConnected(connectionType);
+ }
+
+ @Override
+ public void onDisconnected() {
+ mListener.onDisconnected();
+ }
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/ServiceConnectionListener.java b/car-support-lib/src/android/support/car/ServiceConnectionListener.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/ServiceConnectionListener.java
rename to car-support-lib/src/android/support/car/ServiceConnectionListener.java
diff --git a/car-libs/car-core/src/android/support/car/annotation/ValueTypeDef.java b/car-support-lib/src/android/support/car/annotation/ValueTypeDef.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/annotation/ValueTypeDef.java
rename to car-support-lib/src/android/support/car/annotation/ValueTypeDef.java
diff --git a/car-libs/car-core/src/android/support/car/annotation/VersionDef.java b/car-support-lib/src/android/support/car/annotation/VersionDef.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/annotation/VersionDef.java
rename to car-support-lib/src/android/support/car/annotation/VersionDef.java
diff --git a/car-libs/car-core/src/android/support/car/app/CarActivity.java b/car-support-lib/src/android/support/car/app/CarActivity.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/CarActivity.java
rename to car-support-lib/src/android/support/car/app/CarActivity.java
diff --git a/car-libs/car-core/src/android/support/car/app/CarFragmentActivity.java b/car-support-lib/src/android/support/car/app/CarFragmentActivity.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/CarFragmentActivity.java
rename to car-support-lib/src/android/support/car/app/CarFragmentActivity.java
diff --git a/car-libs/car-core/src/android/support/car/app/CarProxyActivity.java b/car-support-lib/src/android/support/car/app/CarProxyActivity.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/CarProxyActivity.java
rename to car-support-lib/src/android/support/car/app/CarProxyActivity.java
diff --git a/car-libs/car-core/src/android/support/car/app/menu/CarDrawerActivity.java b/car-support-lib/src/android/support/car/app/menu/CarDrawerActivity.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/CarDrawerActivity.java
rename to car-support-lib/src/android/support/car/app/menu/CarDrawerActivity.java
diff --git a/car-libs/car-core/src/android/support/car/app/menu/CarMenu.java b/car-support-lib/src/android/support/car/app/menu/CarMenu.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/CarMenu.java
rename to car-support-lib/src/android/support/car/app/menu/CarMenu.java
diff --git a/car-libs/car-core/src/android/support/car/app/menu/CarMenuCallbacks.java b/car-support-lib/src/android/support/car/app/menu/CarMenuCallbacks.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/CarMenuCallbacks.java
rename to car-support-lib/src/android/support/car/app/menu/CarMenuCallbacks.java
diff --git a/car-libs/car-core/src/android/support/car/app/menu/CarUiController.java b/car-support-lib/src/android/support/car/app/menu/CarUiController.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/CarUiController.java
rename to car-support-lib/src/android/support/car/app/menu/CarUiController.java
diff --git a/car-libs/car-core/src/android/support/car/app/menu/CarUiEntry.java b/car-support-lib/src/android/support/car/app/menu/CarUiEntry.java
similarity index 98%
rename from car-libs/car-core/src/android/support/car/app/menu/CarUiEntry.java
rename to car-support-lib/src/android/support/car/app/menu/CarUiEntry.java
index ee699d4..b042793 100644
--- a/car-libs/car-core/src/android/support/car/app/menu/CarUiEntry.java
+++ b/car-support-lib/src/android/support/car/app/menu/CarUiEntry.java
@@ -34,7 +34,6 @@
* set of basic ui elements and functionalities exist in the CarUiProvider. This class defines
* the set of must have functions in a CarUiProvider.
*/
-/** {@CompatibilityApi} */
public abstract class CarUiEntry {
protected Context mAppContext;
protected Context mUiLibContext;
diff --git a/car-libs/car-core/src/android/support/car/app/menu/Constants.java b/car-support-lib/src/android/support/car/app/menu/Constants.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/Constants.java
rename to car-support-lib/src/android/support/car/app/menu/Constants.java
diff --git a/car-libs/car-core/src/android/support/car/app/menu/ICarMenuCallbacks.aidl b/car-support-lib/src/android/support/car/app/menu/ICarMenuCallbacks.aidl
similarity index 97%
rename from car-libs/car-core/src/android/support/car/app/menu/ICarMenuCallbacks.aidl
rename to car-support-lib/src/android/support/car/app/menu/ICarMenuCallbacks.aidl
index f0536dc..a3da39c 100644
--- a/car-libs/car-core/src/android/support/car/app/menu/ICarMenuCallbacks.aidl
+++ b/car-support-lib/src/android/support/car/app/menu/ICarMenuCallbacks.aidl
@@ -19,7 +19,7 @@
import android.os.Bundle;
import android.support.car.app.menu.ISubscriptionCallbacks;
-/** {@CompatibilityApi} */
+/** @hide */
interface ICarMenuCallbacks {
int getVersion() = 0;
Bundle getRoot() = 1;
diff --git a/car-libs/car-core/src/android/support/car/app/menu/ISearchBoxEditListener.aidl b/car-support-lib/src/android/support/car/app/menu/ISearchBoxEditListener.aidl
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/ISearchBoxEditListener.aidl
rename to car-support-lib/src/android/support/car/app/menu/ISearchBoxEditListener.aidl
diff --git a/car-libs/car-core/src/android/support/car/app/menu/ISubscriptionCallbacks.aidl b/car-support-lib/src/android/support/car/app/menu/ISubscriptionCallbacks.aidl
similarity index 96%
rename from car-libs/car-core/src/android/support/car/app/menu/ISubscriptionCallbacks.aidl
rename to car-support-lib/src/android/support/car/app/menu/ISubscriptionCallbacks.aidl
index 1840c7a..772cc44 100644
--- a/car-libs/car-core/src/android/support/car/app/menu/ISubscriptionCallbacks.aidl
+++ b/car-support-lib/src/android/support/car/app/menu/ISubscriptionCallbacks.aidl
@@ -20,7 +20,7 @@
import java.util.List;
-/** {@CompatibilityApi} */
+/** @hide */
interface ISubscriptionCallbacks {
int getVersion() = 0;
void onChildrenLoaded(String parentId, in List<Bundle> items) = 1;
diff --git a/car-libs/car-core/src/android/support/car/app/menu/Root.java b/car-support-lib/src/android/support/car/app/menu/Root.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/Root.java
rename to car-support-lib/src/android/support/car/app/menu/Root.java
diff --git a/car-libs/car-core/src/android/support/car/app/menu/Utils.java b/car-support-lib/src/android/support/car/app/menu/Utils.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/app/menu/Utils.java
rename to car-support-lib/src/android/support/car/app/menu/Utils.java
diff --git a/car-support-lib/src/android/support/car/content/pm/CarPackageManager.java b/car-support-lib/src/android/support/car/content/pm/CarPackageManager.java
new file mode 100644
index 0000000..f211ff5
--- /dev/null
+++ b/car-support-lib/src/android/support/car/content/pm/CarPackageManager.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2015 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.support.car.content.pm;
+
+import android.support.car.CarManagerBase;
+import android.support.car.CarNotConnectedException;
+
+/**
+ * Provides car specific API related with package management.
+ */
+public abstract class CarPackageManager implements CarManagerBase {
+
+ /**
+ * Check if given activity is allowed while driving.
+ * @param packageName
+ * @param className
+ * @return
+ */
+ public abstract boolean isActivityAllowedWhileDriving(String packageName, String className)
+ throws CarNotConnectedException;
+
+ /**
+ * Check if given service is allowed while driving.
+ * @param packageName
+ * @param className
+ * @return
+ */
+ public abstract boolean isServiceAllowedWhileDriving(String packageName, String className)
+ throws CarNotConnectedException;
+}
diff --git a/car-support-lib/src/android/support/car/content/pm/CarPackageManagerEmbedded.java b/car-support-lib/src/android/support/car/content/pm/CarPackageManagerEmbedded.java
new file mode 100644
index 0000000..6bce420
--- /dev/null
+++ b/car-support-lib/src/android/support/car/content/pm/CarPackageManagerEmbedded.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2015 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.support.car.content.pm;
+
+import android.support.car.CarNotConnectedException;
+
+/**
+ * @hide
+ */
+public class CarPackageManagerEmbedded extends CarPackageManager {
+
+ private final android.car.content.pm.CarPackageManager mManager;
+
+ public CarPackageManagerEmbedded(Object manager) {
+ mManager = (android.car.content.pm.CarPackageManager) manager;
+ }
+
+ /** @hide */
+ public android.car.content.pm.CarPackageManager getManager() {
+ return mManager;
+ }
+
+ @Override
+ public boolean isActivityAllowedWhileDriving(String packageName, String className)
+ throws CarNotConnectedException {
+ try {
+ return mManager.isActivityAllowedWhileDriving(packageName, className);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public boolean isServiceAllowedWhileDriving(String packageName, String className)
+ throws CarNotConnectedException {
+ try {
+ return mManager.isServiceAllowedWhileDriving(packageName, className);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public void onCarDisconnected() {
+ // nothing to do
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.java b/car-support-lib/src/android/support/car/hardware/CarSensorEvent.java
similarity index 99%
rename from car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.java
rename to car-support-lib/src/android/support/car/hardware/CarSensorEvent.java
index e982671..e428a2f 100644
--- a/car-libs/car-core/src/android/support/car/hardware/CarSensorEvent.java
+++ b/car-support-lib/src/android/support/car/hardware/CarSensorEvent.java
@@ -35,7 +35,6 @@
* returned. This parameter should be used to avoid unnecessary object churn whenever possible.
* Additionally, calling a conversion method on a CarSensorEvent object with an inappropriate type
* will result in an {@code UnsupportedOperationException} being thrown.
- * {@CompatibilityApi}
*/
public class CarSensorEvent extends ExtendableParcelable {
diff --git a/car-support-lib/src/android/support/car/hardware/CarSensorManager.java b/car-support-lib/src/android/support/car/hardware/CarSensorManager.java
new file mode 100644
index 0000000..7949a46
--- /dev/null
+++ b/car-support-lib/src/android/support/car/hardware/CarSensorManager.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2015 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.support.car.hardware;
+
+import android.Manifest;
+import android.support.annotation.RequiresPermission;
+import android.content.Context;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.os.RemoteException;
+import android.os.Handler.Callback;
+import android.support.car.Car;
+import android.support.car.CarApiUtil;
+import android.support.car.CarLibLog;
+import android.support.car.CarManagerBase;
+import android.support.car.CarNotConnectedException;
+import android.util.Log;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * API for monitoring car sensor data.
+ */
+public abstract class CarSensorManager implements CarManagerBase {
+ /**
+ * SENSOR_TYPE_* represents type of sensor supported from the connected car.
+ * This sensor represents the direction of the car as an angle in degree measured clockwise
+ * with 0 degree pointing to north.
+ * Sensor data in {@link CarSensorEvent} is a float (floatValues[0]).
+ */
+ public static final int SENSOR_TYPE_COMPASS = 1;
+ /**
+ * This sensor represents vehicle speed in m/s.
+ * Sensor data in {@link CarSensorEvent} is a float which will be >= 0.
+ * This requires {@link Car#PERMISSION_SPEED} permission.
+ */
+ public static final int SENSOR_TYPE_CAR_SPEED = 2;
+ /**
+ * Represents engine RPM of the car. Sensor data in {@link CarSensorEvent} is a float.
+ */
+ public static final int SENSOR_TYPE_RPM = 3;
+ /**
+ * Total travel distance of the car in Kilometer. Sensor data is a float.
+ * This requires {@link Car#PERMISSION_MILEAGE} permission.
+ */
+ public static final int SENSOR_TYPE_ODOMETER = 4;
+ /**
+ * Indicates fuel level of the car.
+ * In {@link CarSensorEvent}, floatValues[{@link CarSensorEvent#INDEX_FUEL_LEVEL_IN_PERCENTILE}]
+ * represents fuel level in percentile (0 to 100) while
+ * floatValues[{@link CarSensorEvent#INDEX_FUEL_LEVEL_IN_DISTANCE}] represents estimated range
+ * in Kilometer with the remaining fuel.
+ * Note that the gas mileage used for the estimation may not represent the current driving
+ * condition.
+ * This requires {@link Car#PERMISSION_FUEL} permission.
+ */
+ public static final int SENSOR_TYPE_FUEL_LEVEL = 5;
+ /**
+ * Represents the current status of parking brake. Sensor data in {@link CarSensorEvent} is an
+ * intValues[0]. Value of 1 represents parking brake applied while 0 means the other way
+ * around. For this sensor, rate in {@link #registerListener(CarSensorEventListener, int, int)}
+ * will be ignored and all changes will be notified.
+ */
+ public static final int SENSOR_TYPE_PARKING_BRAKE = 6;
+ /**
+ * This represents the current position of transmission gear. Sensor data in
+ * {@link CarSensorEvent} is an intValues[0]. For the meaning of the value, check
+ * {@link CarSensorEvent#GEAR_NEUTRAL} and other GEAR_*.
+ */
+ public static final int SENSOR_TYPE_GEAR = 7;
+ public static final int SENSOR_TYPE_RESERVED8 = 8;
+ /**
+ * Day/night sensor. Sensor data is intValues[0].
+ */
+ public static final int SENSOR_TYPE_NIGHT = 9;
+ /**
+ * Sensor type for location. Sensor data passed in floatValues.
+ */
+ public static final int SENSOR_TYPE_LOCATION = 10;
+ /**
+ * Represents the current driving status of car. Different user interaction should be used
+ * depending on the current driving status. Driving status is intValues[0].
+ */
+ public static final int SENSOR_TYPE_DRIVING_STATUS = 11;
+ /**
+ * Environment like temperature and pressure.
+ */
+ public static final int SENSOR_TYPE_ENVIRONMENT = 12;
+
+ /** @hide */
+ public static final int SENSOR_TYPE_RESERVED13 = 13;
+ /** @hide */
+ public static final int SENSOR_TYPE_ACCELEROMETER = 14;
+ /** @hide */
+ public static final int SENSOR_TYPE_RESERVED15 = 15;
+ /** @hide */
+ public static final int SENSOR_TYPE_RESERVED16 = 16;
+ /** @hide */
+ public static final int SENSOR_TYPE_GPS_SATELLITE = 17;
+ /** @hide */
+ public static final int SENSOR_TYPE_GYROSCOPE = 18;
+ /** @hide */
+ public static final int SENSOR_TYPE_RESERVED19 = 19;
+ /** @hide */
+ public static final int SENSOR_TYPE_RESERVED20 = 20;
+ /** @hide */
+ public static final int SENSOR_TYPE_RESERVED21 = 21;
+
+ /**
+ * Sensor type bigger than this is invalid. Always update this after adding a new sensor.
+ * @hide
+ */
+ private static final int SENSOR_TYPE_MAX = SENSOR_TYPE_RESERVED21;
+
+ /**
+ * Sensors defined in this range [{@link #SENSOR_TYPE_VENDOR_EXTENSION_START},
+ * {@link #SENSOR_TYPE_VENDOR_EXTENSION_END}] is for each car vendor's to use.
+ * This should be only used for system app to access sensors not defined as standard types.
+ * So the sensor supproted in this range can vary depending on car models / manufacturers.
+ * 3rd party apps should not use sensors in this range as they are not compatible across
+ * different cars. Additionally 3rd party apps trying to access sensor in this range will get
+ * security exception as their access is restricted to system apps.
+ *
+ * @hide
+ */
+ public static final int SENSOR_TYPE_VENDOR_EXTENSION_START = 0x60000000;
+ public static final int SENSOR_TYPE_VENDOR_EXTENSION_END = 0x6fffffff;
+
+ /** Read sensor in default normal rate set for each sensors. This is default rate. */
+ public static final int SENSOR_RATE_NORMAL = 3;
+ public static final int SENSOR_RATE_UI = 2;
+ public static final int SENSOR_RATE_FAST = 1;
+ /** Read sensor at the maximum rate. Actual rate will be different depending on the sensor. */
+ public static final int SENSOR_RATE_FASTEST = 0;
+
+ /**
+ * Listener for car sensor data change.
+ * Callbacks are called in the Looper context.
+ */
+ public interface CarSensorEventListener {
+ /**
+ * Called when there is a new sensor data from car.
+ * @param event Incoming sensor event for the given sensor type.
+ */
+ void onSensorChanged(final CarSensorEvent event);
+ }
+
+ /**
+ * Give the list of CarSensors available in the connected car.
+ * @return array of all sensor types supported.
+ * @throws CarNotConnectedException
+ */
+ public abstract int[] getSupportedSensors() throws CarNotConnectedException;
+
+ /**
+ * Tells if given sensor is supported or not.
+ * @param sensorType
+ * @return true if the sensor is supported.
+ * @throws CarNotConnectedException
+ */
+ public abstract boolean isSensorSupported(int sensorType) throws CarNotConnectedException;
+
+ /**
+ * Check if given sensorList is including the sensorType.
+ * @param sensorList
+ * @param sensorType
+ * @return
+ */
+ public static boolean isSensorSupported(int[] sensorList, int sensorType) {
+ for (int sensorSupported: sensorList) {
+ if (sensorType == sensorSupported) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Register {@link CarSensorEventListener} to get repeated sensor updates. Multiple listeners
+ * can be registered for a single sensor or the same listener can be used for different sensors.
+ * If the same listener is registered again for the same sensor, it will be either ignored or
+ * updated depending on the rate.
+ * <p>
+ * Requires {@link android.Manifest.permission#ACCESS_FINE_LOCATION} for
+ * {@link #SENSOR_TYPE_LOCATION}, {@link Car#PERMISSION_SPEED} for
+ * {@link #SENSOR_TYPE_CAR_SPEED}, {@link Car#PERMISSION_MILEAGE} for
+ * {@link #SENSOR_TYPE_ODOMETER}, or {@link Car#PERMISSION_FUEL} for
+ * {@link #SENSOR_TYPE_FUEL_LEVEL}.
+ *
+ * @param listener
+ * @param sensorType sensor type to subscribe.
+ * @param rate how fast the sensor events are delivered. It should be one of
+ * {@link #SENSOR_RATE_FASTEST} or {@link #SENSOR_RATE_NORMAL}. Rate may not be respected
+ * especially when the same sensor is registered with different listener with different
+ * rates.
+ * @return if the sensor was successfully enabled.
+ * @throws CarNotConnectedException
+ * @throws IllegalArgumentException for wrong argument like wrong rate
+ * @throws SecurityException if missing the appropriate permission
+ */
+ @RequiresPermission(anyOf={Manifest.permission.ACCESS_FINE_LOCATION, Car.PERMISSION_SPEED,
+ Car.PERMISSION_MILEAGE, Car.PERMISSION_FUEL}, conditional=true)
+ public abstract boolean registerListener(CarSensorEventListener listener, int sensorType,
+ int rate) throws CarNotConnectedException, IllegalArgumentException;
+
+ /**
+ * Stop getting sensor update for the given listener. If there are multiple registrations for
+ * this listener, all listening will be stopped.
+ * @param listener
+ */
+ public abstract void unregisterListener(CarSensorEventListener listener);
+
+ /**
+ * Stop getting sensor update for the given listener and sensor. If the same listener is used
+ * for other sensors, those subscriptions will not be affected.
+ * @param listener
+ * @param sensorType
+ */
+ public abstract void unregisterListener(CarSensorEventListener listener, int sensorType);
+
+ /**
+ * Get the most recent CarSensorEvent for the given type.
+ * @param type A sensor to request
+ * @return null if there was no sensor update since connected to the car.
+ * @throws CarNotConnectedException
+ */
+ public abstract CarSensorEvent getLatestSensorEvent(int type) throws CarNotConnectedException;
+}
diff --git a/car-support-lib/src/android/support/car/hardware/CarSensorManagerEmbedded.java b/car-support-lib/src/android/support/car/hardware/CarSensorManagerEmbedded.java
new file mode 100644
index 0000000..8b57147
--- /dev/null
+++ b/car-support-lib/src/android/support/car/hardware/CarSensorManagerEmbedded.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2016 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.support.car.hardware;
+
+import android.support.car.CarNotConnectedException;
+
+import java.util.LinkedList;
+/**
+ * @hide
+ */
+public class CarSensorManagerEmbedded extends CarSensorManager {
+
+ private final android.car.hardware.CarSensorManager mManager;
+ private final LinkedList<CarSensorEventListenerProxy> mListeners = new LinkedList<>();
+
+ public CarSensorManagerEmbedded(Object manager) {
+ mManager = (android.car.hardware.CarSensorManager) manager;
+ }
+
+ @Override
+ public int[] getSupportedSensors() throws CarNotConnectedException {
+ try {
+ return mManager.getSupportedSensors();
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public boolean isSensorSupported(int sensorType) throws CarNotConnectedException {
+ try {
+ return mManager.isSensorSupported(sensorType);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public boolean registerListener(CarSensorEventListener listener, int sensorType,
+ int rate) throws CarNotConnectedException, IllegalArgumentException {
+ CarSensorEventListenerProxy proxy = null;
+ synchronized (this) {
+ proxy = findListenerLocked(listener);
+ if (proxy == null) {
+ proxy = new CarSensorEventListenerProxy(listener, sensorType);
+ } else {
+ proxy.sensors |= sensorType;
+ }
+ }
+ try {
+ return mManager.registerListener(proxy, sensorType, rate);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public void unregisterListener(CarSensorEventListener listener) {
+ CarSensorEventListenerProxy proxy = null;
+ synchronized (this) {
+ proxy = findListenerLocked(listener);
+ if (proxy == null) {
+ return;
+ }
+ mListeners.remove(proxy);
+ }
+ mManager.unregisterListener(proxy);
+ }
+
+ @Override
+ public void unregisterListener(CarSensorEventListener listener, int sensorType) {
+ CarSensorEventListenerProxy proxy = null;
+ synchronized (this) {
+ proxy = findListenerLocked(listener);
+ if (proxy == null) {
+ return;
+ }
+ proxy.sensors &= ~sensorType;
+ if (proxy.sensors == 0) {
+ mListeners.remove(proxy);
+ }
+ }
+ mManager.unregisterListener(proxy, sensorType);
+ }
+
+ @Override
+ public CarSensorEvent getLatestSensorEvent(int type) throws CarNotConnectedException {
+ try {
+ return convert(mManager.getLatestSensorEvent(type));
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public void onCarDisconnected() {
+ //nothing to do
+ }
+
+ private CarSensorEventListenerProxy findListenerLocked(CarSensorEventListener listener) {
+ for (CarSensorEventListenerProxy proxy : mListeners) {
+ if (proxy.listener == listener) {
+ return proxy;
+ }
+ }
+ return null;
+ }
+
+ private static CarSensorEvent convert(android.car.hardware.CarSensorEvent event) {
+ if (event == null) {
+ return null;
+ }
+ return new CarSensorEvent(event.sensorType, event.timeStampNs, event.floatValues,
+ event.intValues);
+ }
+
+ private static class CarSensorEventListenerProxy implements
+ android.car.hardware.CarSensorManager.CarSensorEventListener {
+
+ public final CarSensorEventListener listener;
+ public int sensors;
+
+ public CarSensorEventListenerProxy(CarSensorEventListener listener, int sensors) {
+ this.listener = listener;
+ this.sensors = sensors;
+ }
+
+ @Override
+ public void onSensorChanged(android.car.hardware.CarSensorEvent event) {
+ CarSensorEvent newEvent = convert(event);
+ listener.onSensorChanged(newEvent);
+ }
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/input/CarEditable.java b/car-support-lib/src/android/support/car/input/CarEditable.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/input/CarEditable.java
rename to car-support-lib/src/android/support/car/input/CarEditable.java
diff --git a/car-libs/car-core/src/android/support/car/input/CarEditableListener.java b/car-support-lib/src/android/support/car/input/CarEditableListener.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/input/CarEditableListener.java
rename to car-support-lib/src/android/support/car/input/CarEditableListener.java
diff --git a/car-libs/car-core/src/android/support/car/input/CarInputManager.java b/car-support-lib/src/android/support/car/input/CarInputManager.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/input/CarInputManager.java
rename to car-support-lib/src/android/support/car/input/CarInputManager.java
diff --git a/car-libs/car-core/src/android/support/car/input/CarRestrictedEditText.java b/car-support-lib/src/android/support/car/input/CarRestrictedEditText.java
similarity index 100%
rename from car-libs/car-core/src/android/support/car/input/CarRestrictedEditText.java
rename to car-support-lib/src/android/support/car/input/CarRestrictedEditText.java
diff --git a/car-libs/car-core/src/android/support/car/media/CarAudioManager.java b/car-support-lib/src/android/support/car/media/CarAudioManager.java
similarity index 78%
copy from car-libs/car-core/src/android/support/car/media/CarAudioManager.java
copy to car-support-lib/src/android/support/car/media/CarAudioManager.java
index 35d2c42..3b1ba21 100644
--- a/car-libs/car-core/src/android/support/car/media/CarAudioManager.java
+++ b/car-support-lib/src/android/support/car/media/CarAudioManager.java
@@ -26,7 +26,7 @@
/**
* APIs for handling car specific audio stuffs.
*/
-public class CarAudioManager implements CarManagerBase {
+public abstract class CarAudioManager implements CarManagerBase {
/**
* Audio usage for unspecified type.
@@ -80,30 +80,10 @@
@Retention(RetentionPolicy.SOURCE)
public @interface CarAudioUsage {}
- private final ICarAudio mService;
-
/**
* Get {@link AudioAttrbutes} relevant for the given usage in car.
* @param carUsage
* @return
*/
- public AudioAttributes getAudioAttributesForCarUsage(@CarAudioUsage int carUsage) {
- try {
- return mService.getAudioAttributesForCarUsage(carUsage);
- } catch (RemoteException e) {
- AudioAttributes.Builder builder = new AudioAttributes.Builder();
- return builder.setContentType(AudioAttributes.CONTENT_TYPE_UNKNOWN).
- setUsage(AudioAttributes.USAGE_UNKNOWN).build();
- }
- }
-
- @Override
- public void onCarDisconnected() {
- // TODO Auto-generated method stub
- }
-
- /** @hide */
- public CarAudioManager(ICarAudio service) {
- mService = service;
- }
+ public abstract AudioAttributes getAudioAttributesForCarUsage(@CarAudioUsage int carUsage);
}
diff --git a/car-support-lib/src/android/support/car/media/CarAudioManagerEmbedded.java b/car-support-lib/src/android/support/car/media/CarAudioManagerEmbedded.java
new file mode 100644
index 0000000..4fdac71
--- /dev/null
+++ b/car-support-lib/src/android/support/car/media/CarAudioManagerEmbedded.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 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.support.car.media;
+
+import android.media.AudioAttributes;
+
+/**
+ * @hide
+ */
+public class CarAudioManagerEmbedded extends CarAudioManager {
+
+ private final android.car.media.CarAudioManager mManager;
+
+ public CarAudioManagerEmbedded(Object manager) {
+ mManager = (android.car.media.CarAudioManager) manager;
+ }
+
+ @Override
+ public AudioAttributes getAudioAttributesForCarUsage(@CarAudioUsage int carUsage) {
+ return mManager.getAudioAttributesForCarUsage(carUsage);
+ }
+
+ @Override
+ public void onCarDisconnected() {
+ //nothing to do
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.java b/car-support-lib/src/android/support/car/navigation/CarNavigationInstrumentCluster.java
similarity index 96%
rename from car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.java
rename to car-support-lib/src/android/support/car/navigation/CarNavigationInstrumentCluster.java
index 6495fcc..baa17af 100644
--- a/car-libs/car-core/src/android/support/car/navigation/CarNavigationInstrumentCluster.java
+++ b/car-support-lib/src/android/support/car/navigation/CarNavigationInstrumentCluster.java
@@ -27,7 +27,6 @@
/**
* Holds options related to navigation for the car's instrument cluster.
* @hide
- * {@CompatibilityApi}
*/
public class CarNavigationInstrumentCluster extends ExtendableParcelable {
@@ -73,12 +72,14 @@
};
public static CarNavigationInstrumentCluster createCluster(int minIntervalMs) {
- return new CarNavigationInstrumentCluster(minIntervalMs, ClusterType.IMAGE_CODES_ONLY, 0, 0, 0);
+ return new CarNavigationInstrumentCluster(minIntervalMs, ClusterType.IMAGE_CODES_ONLY,
+ 0, 0, 0);
}
public static CarNavigationInstrumentCluster createCustomImageCluster(int minIntervalMs,
int imageWidth, int imageHeight, int imageColorDepthBits) {
- return new CarNavigationInstrumentCluster(minIntervalMs, ClusterType.CUSTOM_IMAGES_SUPPORTED,
+ return new CarNavigationInstrumentCluster(minIntervalMs,
+ ClusterType.CUSTOM_IMAGES_SUPPORTED,
imageWidth, imageHeight, imageColorDepthBits);
}
@@ -120,7 +121,8 @@
return mType == ClusterType.CUSTOM_IMAGES_SUPPORTED;
}
- private CarNavigationInstrumentCluster(
+ /** @hide */
+ CarNavigationInstrumentCluster(
int minIntervalMs,
@ClusterType int type,
int imageWidth,
diff --git a/car-support-lib/src/android/support/car/navigation/CarNavigationManager.java b/car-support-lib/src/android/support/car/navigation/CarNavigationManager.java
new file mode 100644
index 0000000..d723bc0
--- /dev/null
+++ b/car-support-lib/src/android/support/car/navigation/CarNavigationManager.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2016 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.support.car.navigation;
+
+import android.graphics.Bitmap;
+import android.support.car.CarManagerBase;
+import android.support.car.CarNotConnectedException;
+
+/**
+ * API for providing navigation status for instrument cluster.
+ * @hide
+ */
+public abstract class CarNavigationManager implements CarManagerBase {
+
+ /**
+ * Listener navigation related events.
+ * Callbacks are called in the Looper context.
+ */
+ public interface CarNavigationListener {
+ /** Instrument Cluster started in navigation mode */
+ void onInstrumentClusterStart(CarNavigationInstrumentCluster instrumentCluster);
+ /** Instrument cluster ended */
+ void onInstrumentClusterStop();
+ }
+
+ /** Navigation status */
+ public static final int STATUS_UNAVAILABLE = 0;
+ public static final int STATUS_ACTIVE = 1;
+ public static final int STATUS_INACTIVE = 2;
+ /** Turn Types */
+ public static final int TURN_UNKNOWN = 0;
+ public static final int TURN_DEPART = 1;
+ public static final int TURN_NAME_CHANGE = 2;
+ public static final int TURN_SLIGHT_TURN = 3;
+ public static final int TURN_TURN = 4;
+ public static final int TURN_SHARP_TURN = 5;
+ public static final int TURN_U_TURN = 6;
+ public static final int TURN_ON_RAMP = 7;
+ public static final int TURN_OFF_RAMP = 8;
+ public static final int TURN_FORK = 9;
+ public static final int TURN_MERGE = 10;
+ public static final int TURN_ROUNDABOUT_ENTER = 11;
+ public static final int TURN_ROUNDABOUT_EXIT = 12;
+ public static final int TURN_ROUNDABOUT_ENTER_AND_EXIT = 13;
+ public static final int TURN_STRAIGHT = 14;
+ public static final int TURN_FERRY_BOAT = 16;
+ public static final int TURN_FERRY_TRAIN = 17;
+ public static final int TURN_DESTINATION = 19;
+ /** Turn Side */
+ public static final int TURN_SIDE_LEFT = 1;
+ public static final int TURN_SIDE_RIGHT = 2;
+ public static final int TURN_SIDE_UNSPECIFIED = 3;
+
+ /**
+ * @param status new instrument cluster navigation status.
+ * @return true if successful.
+ * @throws CarNotConnectedException
+ */
+ public abstract boolean sendNavigationStatus(int status) throws CarNotConnectedException;
+
+ /**
+ * 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 event event type ({@link #TURN_TURN}, {@link #TURN_U_TURN},
+ * {@link #TURN_ROUNDABOUT_ENTER_AND_EXIT}, etc).
+ * @param road Name of the 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 (PNG format). Null if instrument
+ * cluster type is {@link #INSTRUMENT_CLUSTER_TYPE_ENUM}, or if
+ * the image parameters are malformed (length or width non-positive, or illegal
+ * imageColorDepthBits) in the initial NavigationStatusService call.
+ * @param turnSide turn side ({@link #TURN_SIDE_LEFT}, {@link #TURN_SIDE_RIGHT} or
+ * {@link #TURN_SIDE_UNSPECIFIED}).
+ * @return true if successful.
+ * @throws CarNotConnectedException
+ *
+ */
+ public abstract boolean sendNavigationTurnEvent(int event, String road, int turnAngle,
+ int turnNumber, Bitmap image, int turnSide) throws CarNotConnectedException;
+
+ /**
+ * 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.
+ * @return true if successful.
+ * @throws CarNotConnectedException
+ */
+ public abstract boolean sendNavigationTurnDistanceEvent(int distanceMeters, int timeSeconds)
+ throws CarNotConnectedException;
+
+ public abstract boolean isInstrumentClusterSupported() throws CarNotConnectedException;
+
+ /**
+ * @param listener {@link CarNavigationListener} to be registered, replacing any existing
+ * listeners.
+ * @throws CarNotConnectedException
+ */
+ public abstract void registerListener(CarNavigationListener listener)
+ throws CarNotConnectedException;
+
+ /**
+ * Unregisters {@link CarNavigationListener}.
+ */
+ public abstract void unregisterListener();
+}
diff --git a/car-support-lib/src/android/support/car/navigation/CarNavigationManagerEmbedded.java b/car-support-lib/src/android/support/car/navigation/CarNavigationManagerEmbedded.java
new file mode 100644
index 0000000..65b5211
--- /dev/null
+++ b/car-support-lib/src/android/support/car/navigation/CarNavigationManagerEmbedded.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2016 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.support.car.navigation;
+
+import android.graphics.Bitmap;
+import android.support.car.CarNotConnectedException;
+
+/**
+ * @hide
+ */
+public class CarNavigationManagerEmbedded extends CarNavigationManager {
+
+ private final android.car.navigation.CarNavigationManager mManager;
+ private CarNavigationListenerProxy mListener;
+
+ public CarNavigationManagerEmbedded(Object manager) {
+ mManager = (android.car.navigation.CarNavigationManager) manager;
+ }
+
+ /**
+ * @param status new instrument cluster navigation status.
+ * @return true if successful.
+ * @throws CarNotConnectedException
+ */
+ @Override
+ public boolean sendNavigationStatus(int status) throws CarNotConnectedException {
+ try {
+ return mManager.sendNavigationStatus(status);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public boolean sendNavigationTurnEvent(int event, String road, int turnAngle, int turnNumber,
+ Bitmap image, int turnSide) throws CarNotConnectedException {
+ try {
+ return mManager.sendNavigationTurnEvent(event, road, turnAngle, turnNumber, image,
+ turnSide);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public boolean sendNavigationTurnDistanceEvent(int distanceMeters, int timeSeconds)
+ throws CarNotConnectedException {
+ try {
+ return mManager.sendNavigationTurnDistanceEvent(distanceMeters, timeSeconds);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public boolean isInstrumentClusterSupported() throws CarNotConnectedException {
+ try {
+ return mManager.isInstrumentClusterSupported();
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public void onCarDisconnected() {
+ //nothing to do
+ }
+
+ @Override
+ public void registerListener(CarNavigationListener listener)
+ throws CarNotConnectedException {
+ CarNavigationListenerProxy proxy = null;
+ synchronized (this) {
+ proxy = new CarNavigationListenerProxy(listener);
+ mListener = proxy;
+ }
+ try {
+ mManager.registerListener(proxy);
+ } catch (android.car.CarNotConnectedException e) {
+ throw new CarNotConnectedException(e);
+ }
+ }
+
+ @Override
+ public void unregisterListener() {
+ synchronized (this) {
+ mListener = null;
+ }
+ mManager.unregisterListener();
+ }
+
+ private static CarNavigationInstrumentCluster convert(
+ android.car.navigation.CarNavigationInstrumentCluster ic) {
+ if (ic == null) {
+ return null;
+ }
+ return new CarNavigationInstrumentCluster(ic.getMinIntervalMs(), ic.getType(),
+ ic.getImageWidth(), ic.getImageHeight(), ic.getImageColorDepthBits());
+ }
+
+ private static class CarNavigationListenerProxy implements
+ android.car.navigation.CarNavigationManager.CarNavigationListener {
+
+ private final CarNavigationListener mListener;
+
+ private CarNavigationListenerProxy(CarNavigationListener listener) {
+ mListener = listener;
+ }
+
+ @Override
+ public void onInstrumentClusterStart(
+ android.car.navigation.CarNavigationInstrumentCluster instrumentCluster) {
+ mListener.onInstrumentClusterStart(convert(instrumentCluster));
+ }
+
+ @Override
+ public void onInstrumentClusterStop() {
+ mListener.onInstrumentClusterStop();
+ }
+ }
+}
diff --git a/car-libs/car-core/src/android/support/car/os/ExtendableParcelable.java b/car-support-lib/src/android/support/car/os/ExtendableParcelable.java
similarity index 99%
rename from car-libs/car-core/src/android/support/car/os/ExtendableParcelable.java
rename to car-support-lib/src/android/support/car/os/ExtendableParcelable.java
index 0ae7050..e107102 100644
--- a/car-libs/car-core/src/android/support/car/os/ExtendableParcelable.java
+++ b/car-support-lib/src/android/support/car/os/ExtendableParcelable.java
@@ -41,7 +41,6 @@
* - call {@link #writeHeader(Parcel)} before writing anything else.
* - call {@link #completeWriting(Parcel, int)} with second argument set to return value from
* {@link #writeHeader(Parcel)}.
- * {@CompatibilityApi}
*/
public abstract class ExtendableParcelable implements Parcelable {
/**
diff --git a/car-libs/car-ui/src/android/support/car/ui/AnimationListenerAdapter.java b/car-support-lib/src/android/support/car/ui/AnimationListenerAdapter.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/AnimationListenerAdapter.java
rename to car-support-lib/src/android/support/car/ui/AnimationListenerAdapter.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CarActionExtender.java b/car-support-lib/src/android/support/car/ui/CarActionExtender.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CarActionExtender.java
rename to car-support-lib/src/android/support/car/ui/CarActionExtender.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CarItemAnimator.java b/car-support-lib/src/android/support/car/ui/CarItemAnimator.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CarItemAnimator.java
rename to car-support-lib/src/android/support/car/ui/CarItemAnimator.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CarLayoutManager.java b/car-support-lib/src/android/support/car/ui/CarLayoutManager.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CarLayoutManager.java
rename to car-support-lib/src/android/support/car/ui/CarLayoutManager.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CarListItemViewHolder.java b/car-support-lib/src/android/support/car/ui/CarListItemViewHolder.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CarListItemViewHolder.java
rename to car-support-lib/src/android/support/car/ui/CarListItemViewHolder.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CarNavExtender.java b/car-support-lib/src/android/support/car/ui/CarNavExtender.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CarNavExtender.java
rename to car-support-lib/src/android/support/car/ui/CarNavExtender.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CarRecyclerView.java b/car-support-lib/src/android/support/car/ui/CarRecyclerView.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CarRecyclerView.java
rename to car-support-lib/src/android/support/car/ui/CarRecyclerView.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CarUiResourceLoader.java b/car-support-lib/src/android/support/car/ui/CarUiResourceLoader.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CarUiResourceLoader.java
rename to car-support-lib/src/android/support/car/ui/CarUiResourceLoader.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CheckboxWrapperView.java b/car-support-lib/src/android/support/car/ui/CheckboxWrapperView.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CheckboxWrapperView.java
rename to car-support-lib/src/android/support/car/ui/CheckboxWrapperView.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CircleBitmapDrawable.java b/car-support-lib/src/android/support/car/ui/CircleBitmapDrawable.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CircleBitmapDrawable.java
rename to car-support-lib/src/android/support/car/ui/CircleBitmapDrawable.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CircularClipAnimation.java b/car-support-lib/src/android/support/car/ui/CircularClipAnimation.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CircularClipAnimation.java
rename to car-support-lib/src/android/support/car/ui/CircularClipAnimation.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/ClippableFrameLayout.java b/car-support-lib/src/android/support/car/ui/ClippableFrameLayout.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/ClippableFrameLayout.java
rename to car-support-lib/src/android/support/car/ui/ClippableFrameLayout.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/ColorChecker.java b/car-support-lib/src/android/support/car/ui/ColorChecker.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/ColorChecker.java
rename to car-support-lib/src/android/support/car/ui/ColorChecker.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/Constants.java b/car-support-lib/src/android/support/car/ui/Constants.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/Constants.java
rename to car-support-lib/src/android/support/car/ui/Constants.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CursorFilter.java b/car-support-lib/src/android/support/car/ui/CursorFilter.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CursorFilter.java
rename to car-support-lib/src/android/support/car/ui/CursorFilter.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/CursorRecyclerViewAdapter.java b/car-support-lib/src/android/support/car/ui/CursorRecyclerViewAdapter.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/CursorRecyclerViewAdapter.java
rename to car-support-lib/src/android/support/car/ui/CursorRecyclerViewAdapter.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/DrawerArrowDrawable.java b/car-support-lib/src/android/support/car/ui/DrawerArrowDrawable.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/DrawerArrowDrawable.java
rename to car-support-lib/src/android/support/car/ui/DrawerArrowDrawable.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/FabDrawable.java b/car-support-lib/src/android/support/car/ui/FabDrawable.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/FabDrawable.java
rename to car-support-lib/src/android/support/car/ui/FabDrawable.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/GroupingCursorRecyclerViewAdapter.java b/car-support-lib/src/android/support/car/ui/GroupingCursorRecyclerViewAdapter.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/GroupingCursorRecyclerViewAdapter.java
rename to car-support-lib/src/android/support/car/ui/GroupingCursorRecyclerViewAdapter.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/GroupingRecyclerViewAdapter.java b/car-support-lib/src/android/support/car/ui/GroupingRecyclerViewAdapter.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/GroupingRecyclerViewAdapter.java
rename to car-support-lib/src/android/support/car/ui/GroupingRecyclerViewAdapter.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/LogDecelerateInterpolator.java b/car-support-lib/src/android/support/car/ui/LogDecelerateInterpolator.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/LogDecelerateInterpolator.java
rename to car-support-lib/src/android/support/car/ui/LogDecelerateInterpolator.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/MaxWidthLayout.java b/car-support-lib/src/android/support/car/ui/MaxWidthLayout.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/MaxWidthLayout.java
rename to car-support-lib/src/android/support/car/ui/MaxWidthLayout.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/PagedLayoutManager.java b/car-support-lib/src/android/support/car/ui/PagedLayoutManager.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/PagedLayoutManager.java
rename to car-support-lib/src/android/support/car/ui/PagedLayoutManager.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/PagedListView.java b/car-support-lib/src/android/support/car/ui/PagedListView.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/PagedListView.java
rename to car-support-lib/src/android/support/car/ui/PagedListView.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/PagedScrollBarView.java b/car-support-lib/src/android/support/car/ui/PagedScrollBarView.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/PagedScrollBarView.java
rename to car-support-lib/src/android/support/car/ui/PagedScrollBarView.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/PathClippingView.java b/car-support-lib/src/android/support/car/ui/PathClippingView.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/PathClippingView.java
rename to car-support-lib/src/android/support/car/ui/PathClippingView.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/QuantumInterpolator.java b/car-support-lib/src/android/support/car/ui/QuantumInterpolator.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/QuantumInterpolator.java
rename to car-support-lib/src/android/support/car/ui/QuantumInterpolator.java
diff --git a/car-libs/car-ui/src/android/support/car/ui/ReversibleInterpolator.java b/car-support-lib/src/android/support/car/ui/ReversibleInterpolator.java
similarity index 100%
rename from car-libs/car-ui/src/android/support/car/ui/ReversibleInterpolator.java
rename to car-support-lib/src/android/support/car/ui/ReversibleInterpolator.java
diff --git a/car-libs/car-systemtest/Android.mk b/car-systemtest-lib/Android.mk
similarity index 90%
rename from car-libs/car-systemtest/Android.mk
rename to car-systemtest-lib/Android.mk
index 24adc63..710a0d6 100644
--- a/car-libs/car-systemtest/Android.mk
+++ b/car-systemtest-lib/Android.mk
@@ -26,6 +26,8 @@
LOCAL_AIDL_INCLUDES += packages/services/Car/libvehiclenetwork/java/src/
-LOCAL_STATIC_JAVA_LIBRARIES += car-system libvehiclenetwork-java
+LOCAL_JAVA_LIBRARIES += android.car
+
+LOCAL_STATIC_JAVA_LIBRARIES += libvehiclenetwork-java
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/car-libs/car-systemtest/src/android/support/car/CarTestManager.java b/car-systemtest-lib/src/android/car/test/CarTestManager.java
similarity index 93%
rename from car-libs/car-systemtest/src/android/support/car/CarTestManager.java
rename to car-systemtest-lib/src/android/car/test/CarTestManager.java
index 24bd45d..df44894 100644
--- a/car-libs/car-systemtest/src/android/support/car/CarTestManager.java
+++ b/car-systemtest-lib/src/android/car/test/CarTestManager.java
@@ -13,8 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car;
+package android.car.test;
+import android.annotation.SystemApi;
+import android.car.CarManagerBase;
+import android.os.IBinder;
import android.os.RemoteException;
import com.android.car.vehiclenetwork.IVehicleNetworkHalMock;
@@ -27,6 +30,11 @@
import java.lang.ref.WeakReference;
+/**
+ * API for testing only. Allows mocking vehicle hal.
+ * @hide
+ */
+@SystemApi
public class CarTestManager implements CarManagerBase {
/**
@@ -49,8 +57,8 @@
private VehicleNetworkHalMock mHalMock;
private IVehicleNetworkHalMockImpl mHalMockImpl;
- public CarTestManager(ICarTest service) {
- mService = service;
+ public CarTestManager(CarTestManagerBinderWrapper wrapper) {
+ mService = ICarTest.Stub.asInterface(wrapper.binder);
}
@Override
diff --git a/car-libs/car-systemtest/src/android/support/car/ICarTest.aidl b/car-systemtest-lib/src/android/car/test/ICarTest.aidl
similarity index 91%
rename from car-libs/car-systemtest/src/android/support/car/ICarTest.aidl
rename to car-systemtest-lib/src/android/car/test/ICarTest.aidl
index 9417e54..2e763b7 100644
--- a/car-libs/car-systemtest/src/android/support/car/ICarTest.aidl
+++ b/car-systemtest-lib/src/android/car/test/ICarTest.aidl
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package android.support.car;
+package android.car.test;
import com.android.car.vehiclenetwork.IVehicleNetworkHalMock;
import com.android.car.vehiclenetwork.VehiclePropValueParcelable;
+/** @hide */
interface ICarTest {
- int getVersion() = 0;
/** For testing only. inject events. */
void injectEvent(in VehiclePropValueParcelable value) = 1;
/** For testing only. Start in mocking mode. */
diff --git a/car-libs/car-systemtest/src/android/support/car/VehicleHalEmulator.java b/car-systemtest-lib/src/android/car/test/VehicleHalEmulator.java
similarity index 97%
rename from car-libs/car-systemtest/src/android/support/car/VehicleHalEmulator.java
rename to car-systemtest-lib/src/android/car/test/VehicleHalEmulator.java
index 5157175..aaf1cd4 100644
--- a/car-libs/car-systemtest/src/android/support/car/VehicleHalEmulator.java
+++ b/car-systemtest-lib/src/android/car/test/VehicleHalEmulator.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package android.support.car;
+package android.car.test;
+import android.car.Car;
+import android.car.CarNotConnectedException;
import android.util.Log;
-import android.support.car.Car;
-import android.support.car.CarNotConnectedException;
import com.android.car.vehiclenetwork.VehicleNetwork.VehicleNetworkHalMock;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
@@ -71,11 +71,8 @@
* @param car
*/
public VehicleHalEmulator(Car car) {
- try {
- mCarTestManager = (CarTestManager) car.getCarManager(CarSystemTest.TEST_SERVICE);
- } catch (CarNotConnectedException e) {
- throw new IllegalStateException(e);
- }
+ mCarTestManager = new CarTestManager(
+ (CarTestManagerBinderWrapper) car.getCarManager(Car.TEST_SERVICE));
}
/**
diff --git a/car-ui-provider/Android.mk b/car-ui-provider/Android.mk
index e2cb7f9..6b9960e 100644
--- a/car-ui-provider/Android.mk
+++ b/car-ui-provider/Android.mk
@@ -30,7 +30,7 @@
LOCAL_SDK_VERSION := current
-include packages/services/Car/car-libs/car.mk
+include packages/services/Car/car-support-lib/car-support.mk
include $(BUILD_PACKAGE)
diff --git a/service/Android.mk b/service/Android.mk
index 7e5a3f1..f0dd68d 100644
--- a/service/Android.mk
+++ b/service/Android.mk
@@ -14,9 +14,6 @@
#
#
-#disble build in PDK, should add prebuilts/fullsdk to make this work
-ifneq ($(TARGET_BUILD_PDK),true)
-
# Build the Car service.
LOCAL_PATH:= $(call my-dir)
@@ -34,6 +31,7 @@
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_JAVA_LIBRARIES += android.car
LOCAL_STATIC_JAVA_LIBRARIES += libvehiclenetwork-java car-systemtest
include $(BUILD_PACKAGE)
@@ -48,10 +46,10 @@
LOCAL_MODULE := car-service-lib-for-test
+LOCAL_JAVA_LIBRARIES += android.car
LOCAL_STATIC_JAVA_LIBRARIES += libvehiclenetwork-java car-systemtest
include $(BUILD_STATIC_JAVA_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
-endif #TARGET_BUILD_PDK
diff --git a/service/AndroidManifest.xml b/service/AndroidManifest.xml
index 74c45c0..32647a3 100644
--- a/service/AndroidManifest.xml
+++ b/service/AndroidManifest.xml
@@ -23,57 +23,57 @@
<original-package android:name="com.android.car" />
<permission-group
- android:name="android.support.car.permission.CAR_INFORMATION"
+ android:name="android.car.permission.CAR_INFORMATION"
android:icon="@drawable/car_ic_mode"
android:description="@string/car_permission_desc"
android:label="@string/car_permission_label" />
<permission
- android:name="android.support.car.permission.CAR_FUEL"
- android:permissionGroup="android.support.car.permission.CAR_INFORMATION"
+ android:name="android.car.permission.CAR_FUEL"
+ android:permissionGroup="android.car.permission.CAR_INFORMATION"
android:protectionLevel="dangerous"
android:label="@string/car_permission_label_fuel"
android:description="@string/car_permission_desc_fuel" />
<permission
- android:name="android.support.car.permission.CAR_HVAC"
- android:permissionGroup="android.support.car.permission.CAR_INFORMATION"
+ android:name="android.car.permission.CAR_HVAC"
+ android:permissionGroup="android.car.permission.CAR_INFORMATION"
android:protectionLevel="system|signature"
android:label="@string/car_permission_label_hvac"
android:description="@string/car_permission_desc_hvac" />
<permission
- android:name="android.support.car.permission.CAR_MILEAGE"
- android:permissionGroup="android.support.car.permission.CAR_INFORMATION"
+ android:name="android.car.permission.CAR_MILEAGE"
+ android:permissionGroup="android.car.permission.CAR_INFORMATION"
android:protectionLevel="dangerous"
android:label="@string/car_permission_label_mileage"
android:description="@string/car_permission_desc_mileage" />
<permission
- android:name="android.support.car.permission.CAR_SPEED"
+ android:name="android.car.permission.CAR_SPEED"
android:permissionGroup="android.permission-group.LOCATION"
android:protectionLevel="dangerous"
android:label="@string/car_permission_label_speed"
android:description="@string/car_permission_desc_speed" />
<permission
- android:name="android.support.car.permission.CAR_VENDOR_EXTENSION"
- android:permissionGroup="android.support.car.permission.CAR_INFORMATION"
+ android:name="android.car.permission.CAR_VENDOR_EXTENSION"
+ android:permissionGroup="android.car.permission.CAR_INFORMATION"
android:protectionLevel="system|signature"
android:label="@string/car_permission_label_vendor_extension"
android:description="@string/car_permission_desc_vendor_extension" />
<permission
- android:name="android.support.car.permission.CAR_RADIO"
- android:permissionGroup="android.support.car.permission.CAR_INFORMATION"
+ android:name="android.car.permission.CAR_RADIO"
+ android:permissionGroup="android.car.permission.CAR_INFORMATION"
android:protectionLevel="system|signature"
android:label="@string/car_permission_label_radio"
android:description="@string/car_permission_desc_radio" />
<permission
- android:name="android.support.car.permission.CAR_MOCK_VEHICLE_HAL"
+ android:name="android.car.permission.CAR_MOCK_VEHICLE_HAL"
android:protectionLevel="system|signature"
android:label="@string/car_permission_label_mock_vehicle_hal"
android:description="@string/car_permission_desc_mock_vehicle_hal" />
<!-- may replace this with system permission if proper one is defined. -->
<permission
- android:name="android.support.car.permission.CONTROL_APP_BLOCKING"
+ android:name="android.car.permission.CONTROL_APP_BLOCKING"
android:protectionLevel="system|signature"
android:label="@string/car_permission_label_control_app_blocking"
android:description="@string/car_permission_desc_control_app_blocking" />
@@ -93,7 +93,7 @@
<service android:name=".CarService"
android:singleUser="true">
<intent-filter>
- <action android:name="android.support.car.ICar" />
+ <action android:name="android.car.ICar" />
</intent-filter>
</service>
<receiver android:name=".BootReceiver">
diff --git a/service/src/com/android/car/AppContextService.java b/service/src/com/android/car/AppContextService.java
index af05fc9..71bd539 100644
--- a/service/src/com/android/car/AppContextService.java
+++ b/service/src/com/android/car/AppContextService.java
@@ -15,6 +15,9 @@
*/
package com.android.car;
+import android.car.CarAppContextManager;
+import android.car.IAppContext;
+import android.car.IAppContextListener;
import android.content.Context;
import android.os.Binder;
import android.os.Handler;
@@ -22,9 +25,6 @@
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
-import android.support.car.CarAppContextManager;
-import android.support.car.IAppContext;
-import android.support.car.IAppContextListener;
import android.util.Log;
import com.android.car.hal.VehicleHal;
@@ -34,7 +34,6 @@
public class AppContextService extends IAppContext.Stub implements CarServiceBase,
BinderInterfaceContainer.BinderEventHandler<IAppContextListener> {
- private static final int VERSION = 1;
private static final boolean DBG = true;
private static final boolean DBG_EVENT = false;
@@ -55,17 +54,11 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
- public void registerContextListener(int clientVersion, IAppContextListener listener,
- int filter) {
+ public void registerContextListener(IAppContextListener listener, int filter) {
synchronized (this) {
ClientInfo info = (ClientInfo) mAllClients.getBinderInterface(listener);
if (info == null) {
- info = new ClientInfo(mAllClients, clientVersion, listener, Binder.getCallingUid(),
+ info = new ClientInfo(mAllClients, listener, Binder.getCallingUid(),
Binder.getCallingPid(), filter);
mAllClients.addBinderInterface(info);
} else {
@@ -294,9 +287,9 @@
/** contexts owned by this client */
private int mOwnedContexts;
- private ClientInfo(ClientHolder holder, int clientVersion, IAppContextListener binder,
- int uid, int pid, int filter) {
- super(holder, clientVersion, binder);
+ private ClientInfo(ClientHolder holder, IAppContextListener binder, int uid, int pid,
+ int filter) {
+ super(holder, binder);
this.uid = uid;
this.pid = pid;
this.mFilter = filter;
diff --git a/service/src/com/android/car/AudioRoutingPolicy.java b/service/src/com/android/car/AudioRoutingPolicy.java
index dcca8c5..39ad826 100644
--- a/service/src/com/android/car/AudioRoutingPolicy.java
+++ b/service/src/com/android/car/AudioRoutingPolicy.java
@@ -15,15 +15,15 @@
*/
package com.android.car;
-import java.io.PrintWriter;
-import java.util.Arrays;
-
+import android.car.media.CarAudioManager;
import android.content.Context;
import android.content.res.Resources;
import android.media.AudioAttributes;
-import android.support.car.media.CarAudioManager;
import android.util.Log;
+import java.io.PrintWriter;
+import java.util.Arrays;
+
/**
* Holds audio routing policy from config.xml. R.array.audioRoutingPolicy can contain
* multiple policies and VEHICLE_PROPERTY_AUDIO_HW_VARIANT decide which one to use.
diff --git a/service/src/com/android/car/BinderInterfaceContainer.java b/service/src/com/android/car/BinderInterfaceContainer.java
index c233afa..bf56706 100644
--- a/service/src/com/android/car/BinderInterfaceContainer.java
+++ b/service/src/com/android/car/BinderInterfaceContainer.java
@@ -31,14 +31,11 @@
public static class BinderInterface<T extends IInterface>
implements IBinder.DeathRecipient {
- public final int version;
public final T binderInterface;
private final BinderInterfaceContainer<T> mContainer;
- public BinderInterface(BinderInterfaceContainer<T> container, int version,
- T binderInterface) {
+ public BinderInterface(BinderInterfaceContainer<T> container, T binderInterface) {
mContainer = container;
- this.version = version;
this.binderInterface = binderInterface;
}
@@ -60,14 +57,14 @@
mEventHandler = eventHandler;
}
- public void addBinder(int version, T binderInterface) {
+ public void addBinder(T binderInterface) {
IBinder binder = binderInterface.asBinder();
synchronized (this) {
BinderInterface<T> bInterface = mBinders.get(binder);
if (bInterface != null) {
return;
}
- bInterface = new BinderInterface<T>(this, version, binderInterface);
+ bInterface = new BinderInterface<T>(this, binderInterface);
try {
binder.linkToDeath(bInterface, 0);
} catch (RemoteException e) {
diff --git a/service/src/com/android/car/BootReceiver.java b/service/src/com/android/car/BootReceiver.java
index 75cacaf..adedf7e 100644
--- a/service/src/com/android/car/BootReceiver.java
+++ b/service/src/com/android/car/BootReceiver.java
@@ -16,11 +16,11 @@
package com.android.car;
-import android.os.UserHandle;
-import android.support.car.Car;
+import android.car.Car;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.os.UserHandle;
import android.util.Log;
import com.android.car.hal.VehicleHal;
diff --git a/service/src/com/android/car/CarAudioAttributesUtil.java b/service/src/com/android/car/CarAudioAttributesUtil.java
index c51c9b7..97221d4 100644
--- a/service/src/com/android/car/CarAudioAttributesUtil.java
+++ b/service/src/com/android/car/CarAudioAttributesUtil.java
@@ -15,9 +15,9 @@
*/
package com.android.car;
+import android.car.media.CarAudioManager;
import android.media.AudioAttributes;
import android.os.Bundle;
-import android.support.car.media.CarAudioManager;
/**
* Utility class to map car usage into AudioAttributes and the other way around.
diff --git a/service/src/com/android/car/CarAudioService.java b/service/src/com/android/car/CarAudioService.java
index 0eee2e7..5bbad78 100644
--- a/service/src/com/android/car/CarAudioService.java
+++ b/service/src/com/android/car/CarAudioService.java
@@ -15,6 +15,8 @@
*/
package com.android.car;
+import android.car.media.CarAudioManager;
+import android.car.media.ICarAudio;
import android.content.Context;
import android.media.AudioAttributes;
import android.media.AudioFocusInfo;
@@ -25,8 +27,6 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
-import android.support.car.media.CarAudioManager;
-import android.support.car.media.ICarAudio;
import android.util.Log;
import com.android.car.hal.AudioHalService;
@@ -46,8 +46,6 @@
private static final boolean DBG = true;
- private static final int VERSION = 1;
-
private final AudioHalService mAudioHal;
private final Context mContext;
private final HandlerThread mFocusHandlerThread;
@@ -103,11 +101,6 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
public AudioAttributes getAudioAttributesForCarUsage(int carUsage) {
return CarAudioAttributesUtil.getAudioAttributesForCarUsage(carUsage);
}
diff --git a/service/src/com/android/car/CarHvacService.java b/service/src/com/android/car/CarHvacService.java
index 54358c8..30232b7 100644
--- a/service/src/com/android/car/CarHvacService.java
+++ b/service/src/com/android/car/CarHvacService.java
@@ -16,14 +16,14 @@
package com.android.car;
+import android.car.Car;
+import android.car.hardware.hvac.CarHvacEvent;
+import android.car.hardware.hvac.CarHvacProperty;
+import android.car.hardware.hvac.ICarHvac;
+import android.car.hardware.hvac.ICarHvacEventListener;
import android.content.Context;
import android.os.IBinder;
import android.os.RemoteException;
-import android.support.car.Car;
-import android.support.car.hardware.hvac.CarHvacEvent;
-import android.support.car.hardware.hvac.CarHvacProperty;
-import android.support.car.hardware.hvac.ICarHvac;
-import android.support.car.hardware.hvac.ICarHvacEventListener;
import android.util.Log;
import com.android.car.hal.VehicleHal;
@@ -37,7 +37,6 @@
implements CarServiceBase, HvacHalService.HvacHalListener {
public static final boolean DBG = true;
public static final String TAG = CarLog.TAG_HVAC + ".CarHvacService";
- public static final int VERSION = 1;
private HvacHalService mHvacHal;
private final HashMap<IBinder, ICarHvacEventListener> mListenersMap =
@@ -96,12 +95,7 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
- public synchronized void registerListener(ICarHvacEventListener listener, int version) {
+ public synchronized void registerListener(ICarHvacEventListener listener) {
if (DBG) {
Log.d(TAG, "registerListener");
}
diff --git a/service/src/com/android/car/CarInfoService.java b/service/src/com/android/car/CarInfoService.java
index 6957a3c..2f7185c 100644
--- a/service/src/com/android/car/CarInfoService.java
+++ b/service/src/com/android/car/CarInfoService.java
@@ -15,12 +15,12 @@
*/
package com.android.car;
+import android.car.CarInfoManager;
+import android.car.ICarInfo;
+import android.car.annotation.ValueTypeDef;
import android.content.Context;
import android.os.Bundle;
import android.provider.Settings;
-import android.support.car.CarInfoManager;
-import android.support.car.ICarInfo;
-import android.support.car.annotation.ValueTypeDef;
import com.android.car.hal.InfoHalService;
import com.android.car.hal.VehicleHal;
@@ -32,8 +32,6 @@
public class CarInfoService extends ICarInfo.Stub implements CarServiceBase {
- private static final int VERSION = 1;
-
private static final HashMap<String, Class> sKeyValueTypeMap;
static {
sKeyValueTypeMap = new HashMap<String, Class>();
@@ -60,11 +58,6 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
public int[] getInt(String key) {
assertType(key, Integer.class);
Object o = findFromCache(key);
diff --git a/service/src/com/android/car/CarNavigationStatusService.java b/service/src/com/android/car/CarNavigationService.java
similarity index 73%
rename from service/src/com/android/car/CarNavigationStatusService.java
rename to service/src/com/android/car/CarNavigationService.java
index 4b8c9ec..8351dbf 100644
--- a/service/src/com/android/car/CarNavigationStatusService.java
+++ b/service/src/com/android/car/CarNavigationService.java
@@ -15,16 +15,16 @@
*/
package com.android.car;
+import android.car.Car;
+import android.car.CarAppContextManager;
+import android.car.navigation.CarNavigationInstrumentCluster;
+import android.car.navigation.ICarNavigation;
+import android.car.navigation.ICarNavigationEventListener;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
-import android.support.car.Car;
-import android.support.car.CarAppContextManager;
-import android.support.car.navigation.CarNavigationInstrumentCluster;
-import android.support.car.navigation.ICarNavigationStatus;
-import android.support.car.navigation.ICarNavigationStatusEventListener;
import android.util.Log;
import java.io.PrintWriter;
@@ -35,17 +35,17 @@
* Service for talking to the instrument cluster.
* TODO: implement HAL integration.
*/
-public class CarNavigationStatusService extends ICarNavigationStatus.Stub
+public class CarNavigationService extends ICarNavigation.Stub
implements CarServiceBase {
private static final String TAG = CarLog.TAG_NAV;
- private final List<CarNavigationStatusEventListener> mListeners = new ArrayList<>();
+ private final List<CarNavigationEventListener> mListeners = new ArrayList<>();
private CarNavigationInstrumentCluster mInstrumentClusterInfo = null;
private AppContextService mAppContextService;
private Context mContext;
- public CarNavigationStatusService(Context context) {
+ public CarNavigationService(Context context) {
mContext = context;
}
@@ -89,23 +89,23 @@
}
@Override
- public boolean registerEventListener(ICarNavigationStatusEventListener listener) {
+ public boolean registerEventListener(ICarNavigationEventListener listener) {
synchronized(mListeners) {
if (findClientLocked(listener) == null) {
- CarNavigationStatusEventListener carInstrumentClusterEventListener =
- new CarNavigationStatusEventListener(listener);
+ CarNavigationEventListener eventListener =
+ new CarNavigationEventListener(listener);
try {
- listener.asBinder().linkToDeath(carInstrumentClusterEventListener, 0);
+ listener.asBinder().linkToDeath(eventListener, 0);
} catch (RemoteException e) {
Log.w(TAG, "Adding listener failed.");
return false;
}
- mListeners.add(carInstrumentClusterEventListener);
+ mListeners.add(eventListener);
// The new listener needs to be told the instrument cluster parameters.
try {
// TODO: onStart and onStop methods might be triggered from vehicle HAL as well.
- carInstrumentClusterEventListener.listener.onStart(mInstrumentClusterInfo);
+ eventListener.listener.onInstrumentClusterStart(mInstrumentClusterInfo);
} catch (RemoteException e) {
Log.e(TAG, "listener.onStart failed.");
return false;
@@ -116,8 +116,8 @@
}
@Override
- public boolean unregisterEventListener(ICarNavigationStatusEventListener listener) {
- CarNavigationStatusEventListener client;
+ public boolean unregisterEventListener(ICarNavigationEventListener listener) {
+ CarNavigationEventListener client;
synchronized (mListeners) {
client = findClientLocked(listener);
}
@@ -125,12 +125,12 @@
}
@Override
- public CarNavigationInstrumentCluster getInfo() {
+ public CarNavigationInstrumentCluster getInstrumentClusterInfo() {
return mInstrumentClusterInfo;
}
@Override
- public boolean isSupported() {
+ public boolean isInstrumentClusterSupported() {
return mInstrumentClusterInfo != null;
}
@@ -144,9 +144,9 @@
}
}
- private boolean removeClient(CarNavigationStatusEventListener listener) {
+ private boolean removeClient(CarNavigationEventListener listener) {
synchronized(mListeners) {
- for (CarNavigationStatusEventListener currentListener : mListeners) {
+ for (CarNavigationEventListener currentListener : mListeners) {
// Use asBinder() for comparison.
if (currentListener == listener) {
currentListener.listener.asBinder().unlinkToDeath(currentListener, 0);
@@ -157,9 +157,9 @@
return false;
}
- private CarNavigationStatusEventListener findClientLocked(
- ICarNavigationStatusEventListener listener) {
- for (CarNavigationStatusEventListener existingListener : mListeners) {
+ private CarNavigationEventListener findClientLocked(
+ ICarNavigationEventListener listener) {
+ for (CarNavigationEventListener existingListener : mListeners) {
if (existingListener.listener.asBinder() == listener.asBinder()) {
return existingListener;
}
@@ -168,10 +168,10 @@
}
- private class CarNavigationStatusEventListener implements IBinder.DeathRecipient {
- final ICarNavigationStatusEventListener listener;
+ private class CarNavigationEventListener implements IBinder.DeathRecipient {
+ final ICarNavigationEventListener listener;
- public CarNavigationStatusEventListener(ICarNavigationStatusEventListener listener) {
+ public CarNavigationEventListener(ICarNavigationEventListener listener) {
this.listener = listener;
}
diff --git a/service/src/com/android/car/CarNightService.java b/service/src/com/android/car/CarNightService.java
index b250b54..eb92fed 100644
--- a/service/src/com/android/car/CarNightService.java
+++ b/service/src/com/android/car/CarNightService.java
@@ -17,12 +17,12 @@
package com.android.car;
import android.app.UiModeManager;
+import android.car.Car;
+import android.car.CarNotConnectedException;
+import android.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorManager;
+import android.car.hardware.ICarSensorEventListener;
import android.content.Context;
-import android.support.car.Car;
-import android.support.car.CarNotConnectedException;
-import android.support.car.hardware.CarSensorEvent;
-import android.support.car.hardware.CarSensorManager;
-import android.support.car.hardware.ICarSensorEventListener;
import android.util.Log;
import java.io.PrintWriter;
@@ -32,7 +32,6 @@
public class CarNightService implements CarServiceBase {
public static final boolean DBG = true;
- private static final int VERSION = 1;
private int mNightSetting = UiModeManager.MODE_NIGHT_YES;
private final Context mContext;
private final UiModeManager mUiModeManager;
@@ -82,7 +81,7 @@
mCarSensorService = (CarSensorService) ICarImpl.getInstance(mContext).getCarService(
Car.SENSOR_SERVICE);
mCarSensorService.registerOrUpdateSensorListener(CarSensorManager.SENSOR_TYPE_NIGHT,
- CarSensorManager.SENSOR_RATE_NORMAL,VERSION,mICarSensorEventListener);
+ CarSensorManager.SENSOR_RATE_NORMAL, mICarSensorEventListener);
CarSensorEvent currentState = mCarSensorService.getLatestSensorEvent(
CarSensorManager.SENSOR_TYPE_NIGHT);
handleSensorEvent(currentState);
diff --git a/service/src/com/android/car/CarPowerManagementService.java b/service/src/com/android/car/CarPowerManagementService.java
index e748cc2..819e094 100644
--- a/service/src/com/android/car/CarPowerManagementService.java
+++ b/service/src/com/android/car/CarPowerManagementService.java
@@ -16,6 +16,7 @@
package com.android.car;
import android.annotation.NonNull;
+import android.car.Car;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Handler;
@@ -25,7 +26,6 @@
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
-import android.support.car.CarSystemTest;
import android.util.Log;
import android.view.Display;
@@ -523,8 +523,7 @@
if (!carImpl.isInMocking()) {
return false;
}
- CarTestService testService = (CarTestService) carImpl.getCarService(
- CarSystemTest.TEST_SERVICE);
+ CarTestService testService = (CarTestService) carImpl.getCarService(Car.TEST_SERVICE);
return !testService.shouldDoRealShutdownInMocking();
}
diff --git a/service/src/com/android/car/CarRadioService.java b/service/src/com/android/car/CarRadioService.java
index 7355d0f..3e5e6df 100644
--- a/service/src/com/android/car/CarRadioService.java
+++ b/service/src/com/android/car/CarRadioService.java
@@ -16,17 +16,16 @@
package com.android.car;
+import android.car.Car;
+import android.car.hardware.radio.CarRadioEvent;
+import android.car.hardware.radio.CarRadioPreset;
+import android.car.hardware.radio.ICarRadio;
+import android.car.hardware.radio.ICarRadioEventListener;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
-import android.support.car.Car;
-import android.support.car.CarSystem;
-import android.support.car.hardware.radio.CarRadioEvent;
-import android.support.car.hardware.radio.CarRadioPreset;
-import android.support.car.hardware.radio.ICarRadio;
-import android.support.car.hardware.radio.ICarRadioEventListener;
import android.util.Log;
import com.android.car.hal.VehicleHal;
@@ -39,7 +38,6 @@
implements CarServiceBase, RadioHalService.RadioListener {
public static boolean DBG = true;
public static String TAG = CarLog.TAG_RADIO + ".CarRadioService";
- public static final int VERSION = 1;
private RadioHalService mRadioHal;
private final HashMap<IBinder, ICarRadioEventListener> mListenersMap =
@@ -98,17 +96,12 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
public int getPresetCount() {
return mRadioHal.getPresetCount();
}
@Override
- public synchronized void registerListener(ICarRadioEventListener listener, int version) {
+ public synchronized void registerListener(ICarRadioEventListener listener) {
if (DBG) {
Log.d(TAG, "registerListener");
}
@@ -209,10 +202,10 @@
private void checkRadioPremissions() {
if (getCallingUid() != Process.SYSTEM_UID &&
- mContext.checkCallingOrSelfPermission(CarSystem.PERMISSION_CAR_RADIO) !=
+ mContext.checkCallingOrSelfPermission(Car.PERMISSION_CAR_RADIO) !=
PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("requires system app or " +
- CarSystem.PERMISSION_CAR_RADIO);
+ Car.PERMISSION_CAR_RADIO);
}
}
}
diff --git a/service/src/com/android/car/CarSensorEventFactory.java b/service/src/com/android/car/CarSensorEventFactory.java
index 7940f9a..e270eba 100644
--- a/service/src/com/android/car/CarSensorEventFactory.java
+++ b/service/src/com/android/car/CarSensorEventFactory.java
@@ -16,7 +16,7 @@
package com.android.car;
-import android.support.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorEvent;
//TODO add memory pool and recycling
public class CarSensorEventFactory {
diff --git a/service/src/com/android/car/CarSensorService.java b/service/src/com/android/car/CarSensorService.java
index 5e843f5..992c033 100644
--- a/service/src/com/android/car/CarSensorService.java
+++ b/service/src/com/android/car/CarSensorService.java
@@ -17,6 +17,12 @@
package com.android.car;
import android.Manifest;
+import android.car.Car;
+import android.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorManager;
+import android.car.hardware.ICarSensor;
+import android.car.hardware.ICarSensorEventListener;
+import android.car.hardware.CarSensorManager.CarSensorEventListener;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.SensorEvent;
@@ -29,12 +35,6 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.support.car.Car;
-import android.support.car.hardware.CarSensorEvent;
-import android.support.car.hardware.CarSensorManager;
-import android.support.car.hardware.ICarSensor;
-import android.support.car.hardware.ICarSensorEventListener;
-import android.support.car.hardware.CarSensorManager.CarSensorEventListener;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
@@ -79,8 +79,6 @@
*/
private static final boolean ENABLE_DISPATCHING_LIMIT = false;
- public static final int VERSION = 1;
-
/** {@link #mSensorLock} is not waited forever for handling disconnection */
private static final long MAX_SENSOR_LOCK_WAIT_MS = 1000;
@@ -279,15 +277,9 @@
return mSupportedSensors;
}
-
- @Override
- public int getVersion() {
- return VERSION;
- }
-
@Override
public boolean registerOrUpdateSensorListener(int sensorType, int rate,
- int clientVersion, ICarSensorEventListener listener) {
+ ICarSensorEventListener listener) {
boolean shouldStartSensors = false;
SensorRecord sensorRecord = null;
SensorClient sensorClient = null;
diff --git a/service/src/com/android/car/CarService.java b/service/src/com/android/car/CarService.java
index 8e0f74a..e0feb8a 100644
--- a/service/src/com/android/car/CarService.java
+++ b/service/src/com/android/car/CarService.java
@@ -21,7 +21,7 @@
import com.android.car.hal.VehicleHal;
import android.app.Service;
-import android.support.car.Car;
+import android.car.Car;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
diff --git a/service/src/com/android/car/CarTestService.java b/service/src/com/android/car/CarTestService.java
index b272bbd..59a12f4 100644
--- a/service/src/com/android/car/CarTestService.java
+++ b/service/src/com/android/car/CarTestService.java
@@ -15,10 +15,10 @@
*/
package com.android.car;
+import android.car.test.CarTestManager;
+import android.car.test.ICarTest;
import android.content.Context;
import android.util.Log;
-import android.support.car.CarTestManager;
-import android.support.car.ICarTest;
import com.android.car.hal.VehicleHal;
import com.android.car.vehiclenetwork.IVehicleNetworkHalMock;
@@ -33,7 +33,6 @@
* requires accessing that level directly.
*/
public class CarTestService extends ICarTest.Stub implements CarServiceBase {
- private static final int VERSION = 1;
private final Context mContext;
private final VehicleNetwork mVehicleNetwork;
@@ -66,11 +65,6 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
public void injectEvent(VehiclePropValueParcelable value) {
ICarImpl.assertVehicleHalMockPermission(mContext);
mVehicleNetwork.injectEvent(value.value);
diff --git a/service/src/com/android/car/DayNightModePolicy.java b/service/src/com/android/car/DayNightModePolicy.java
index c0859de..38a5332 100644
--- a/service/src/com/android/car/DayNightModePolicy.java
+++ b/service/src/com/android/car/DayNightModePolicy.java
@@ -16,11 +16,11 @@
package com.android.car;
+import android.car.Car;
+import android.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorManager;
import android.content.Context;
import android.os.SystemClock;
-import android.support.car.Car;
-import android.support.car.hardware.CarSensorEvent;
-import android.support.car.hardware.CarSensorManager;
import android.util.Log;
import com.android.car.hal.SensorHalServiceBase.SensorListener;
diff --git a/service/src/com/android/car/DrivingStatePolicy.java b/service/src/com/android/car/DrivingStatePolicy.java
index 41f1e1a..2b2402f 100644
--- a/service/src/com/android/car/DrivingStatePolicy.java
+++ b/service/src/com/android/car/DrivingStatePolicy.java
@@ -16,12 +16,12 @@
package com.android.car;
+import android.car.Car;
+import android.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorManager;
+import android.car.hardware.ICarSensorEventListener;
import android.content.Context;
import android.os.SystemClock;
-import android.support.car.Car;
-import android.support.car.hardware.CarSensorEvent;
-import android.support.car.hardware.CarSensorManager;
-import android.support.car.hardware.ICarSensorEventListener;
import android.util.Log;
import com.android.car.hal.SensorHalServiceBase.SensorListener;
@@ -141,7 +141,7 @@
return false;
}
return mSensorService.registerOrUpdateSensorListener(sensorType, rate,
- CarSensorService.VERSION, mICarSensorEventListener);
+ mICarSensorEventListener);
}
private synchronized void handleSensorEvent(CarSensorEvent event) {
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index 7f83db2..fe8d7ef 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -16,15 +16,13 @@
package com.android.car;
+import android.car.Car;
+import android.car.ICar;
+import android.car.ICarConnectionListener;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.RemoteException;
-import android.support.car.Car;
-import android.support.car.CarSystem;
-import android.support.car.CarSystemTest;
-import android.support.car.ICar;
-import android.support.car.ICarConnectionListener;
import android.util.Log;
import com.android.car.hal.VehicleHal;
@@ -35,7 +33,6 @@
import java.util.Collection;
public class ICarImpl extends ICar.Stub {
- private static final int VERSION = 1;
@GuardedBy("ICarImpl.class")
private static ICarImpl sInstance = null;
@@ -53,7 +50,7 @@
private final AppContextService mAppContextService;
private final CarPackageManagerService mCarPackageManagerService;
private final GarageModeService mGarageModeService;
- private final CarNavigationStatusService mCarNavigationStatusService;
+ private final CarNavigationService mCarNavigationStatusService;
/** Test only service. Populate it only when necessary. */
@GuardedBy("this")
@@ -93,7 +90,7 @@
mCarRadioService = new CarRadioService(serviceContext);
mCarNightService = new CarNightService(serviceContext);
mCarPackageManagerService = new CarPackageManagerService(serviceContext);
- mCarNavigationStatusService = new CarNavigationStatusService(serviceContext);
+ mCarNavigationStatusService = new CarNavigationService(serviceContext);
// Be careful with order. Service depending on other service should be inited later.
mAllServices = new CarServiceBase[] {
@@ -158,7 +155,7 @@
for (BinderInterfaceContainer.BinderInterface<ICarConnectionListener> client :
connectionListeners) {
try {
- client.binderInterface.onConnected(Car.CONNECTION_TYPE_EMBEDDED);
+ client.binderInterface.onConnected();
} catch (RemoteException e) {
//ignore
}
@@ -166,11 +163,6 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
public IBinder getCarService(String serviceName) {
switch (serviceName) {
case Car.AUDIO_SERVICE:
@@ -183,15 +175,15 @@
return mAppContextService;
case Car.PACKAGE_SERVICE:
return mCarPackageManagerService;
- case CarSystem.HVAC_SERVICE:
+ case Car.HVAC_SERVICE:
assertHvacPermission(mContext);
return mCarHvacService;
- case CarSystem.RADIO_SERVICE:
+ case Car.RADIO_SERVICE:
assertRadioPermission(mContext);
return mCarRadioService;
case Car.CAR_NAVIGATION_SERVICE:
return mCarNavigationStatusService;
- case CarSystemTest.TEST_SERVICE: {
+ case Car.TEST_SERVICE: {
assertVehicleHalMockPermission(mContext);
synchronized (this) {
if (mCarTestService == null) {
@@ -212,15 +204,10 @@
}
@Override
- public int getCarConnectionType() {
- return Car.CONNECTION_TYPE_EMBEDDED;
- }
-
- @Override
- public void registerCarConnectionListener(int clientVersion, ICarConnectionListener listener) {
- mCarConnectionListeners.addBinder(clientVersion, listener);
+ public void registerCarConnectionListener(ICarConnectionListener listener) {
+ mCarConnectionListeners.addBinder(listener);
try {
- listener.onConnected(Car.CONNECTION_TYPE_EMBEDDED);
+ listener.onConnected();
} catch (RemoteException e) {
//ignore
}
@@ -243,25 +230,25 @@
}
public static void assertVehicleHalMockPermission(Context context) {
- if (context.checkCallingOrSelfPermission(CarSystemTest.PERMISSION_MOCK_VEHICLE_HAL)
+ if (context.checkCallingOrSelfPermission(Car.PERMISSION_MOCK_VEHICLE_HAL)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("requires CAR_MOCK_VEHICLE_HAL permission");
}
}
public static void assertHvacPermission(Context context) {
- if (context.checkCallingOrSelfPermission(CarSystem.PERMISSION_CAR_HVAC)
+ if (context.checkCallingOrSelfPermission(Car.PERMISSION_CAR_HVAC)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException(
- "requires " + CarSystem.PERMISSION_CAR_HVAC);
+ "requires " + Car.PERMISSION_CAR_HVAC);
}
}
private static void assertRadioPermission(Context context) {
- if (context.checkCallingOrSelfPermission(CarSystem.PERMISSION_CAR_RADIO)
+ if (context.checkCallingOrSelfPermission(Car.PERMISSION_CAR_RADIO)
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException(
- "requires permission " + CarSystem.PERMISSION_CAR_RADIO);
+ "requires permission " + Car.PERMISSION_CAR_RADIO);
}
}
diff --git a/service/src/com/android/car/hal/AudioHalService.java b/service/src/com/android/car/hal/AudioHalService.java
index b19368f..68c4d11 100644
--- a/service/src/com/android/car/hal/AudioHalService.java
+++ b/service/src/com/android/car/hal/AudioHalService.java
@@ -15,7 +15,7 @@
*/
package com.android.car.hal;
-import android.support.car.media.CarAudioManager;
+import android.car.media.CarAudioManager;
import android.util.Log;
import com.android.car.AudioRoutingPolicy;
diff --git a/service/src/com/android/car/hal/HvacHalService.java b/service/src/com/android/car/hal/HvacHalService.java
index 060b637..958ce52 100644
--- a/service/src/com/android/car/hal/HvacHalService.java
+++ b/service/src/com/android/car/hal/HvacHalService.java
@@ -18,9 +18,9 @@
import static com.android.car.vehiclenetwork.VehiclePropValueUtil.toFloatArray;
import static com.android.car.vehiclenetwork.VehiclePropValueUtil.toIntArray;
-import android.support.car.hardware.hvac.CarHvacEvent;
-import android.support.car.hardware.hvac.CarHvacManager;
-import android.support.car.hardware.hvac.CarHvacProperty;
+import android.car.hardware.hvac.CarHvacEvent;
+import android.car.hardware.hvac.CarHvacManager;
+import android.car.hardware.hvac.CarHvacProperty;
import android.util.Log;
import com.android.car.CarLog;
diff --git a/service/src/com/android/car/hal/InfoHalService.java b/service/src/com/android/car/hal/InfoHalService.java
index 5540778..816e634 100644
--- a/service/src/com/android/car/hal/InfoHalService.java
+++ b/service/src/com/android/car/hal/InfoHalService.java
@@ -15,7 +15,7 @@
*/
package com.android.car.hal;
-import android.support.car.CarInfoManager;
+import android.car.CarInfoManager;
import android.util.Log;
import com.android.car.CarLog;
diff --git a/service/src/com/android/car/hal/RadioHalService.java b/service/src/com/android/car/hal/RadioHalService.java
index feec521..9c3a4a3 100644
--- a/service/src/com/android/car/hal/RadioHalService.java
+++ b/service/src/com/android/car/hal/RadioHalService.java
@@ -16,12 +16,11 @@
package com.android.car.hal;
+import android.car.hardware.radio.CarRadioEvent;
+import android.car.hardware.radio.CarRadioPreset;
import android.util.Log;
import android.hardware.radio.RadioManager;
-import android.support.car.hardware.radio.CarRadioEvent;
-import android.support.car.hardware.radio.CarRadioPreset;
-
import com.android.car.CarLog;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
import com.android.car.vehiclenetwork.VehicleNetworkConsts.VehicleValueType;
diff --git a/service/src/com/android/car/hal/SensorHalService.java b/service/src/com/android/car/hal/SensorHalService.java
index 6418d30..05e7571 100644
--- a/service/src/com/android/car/hal/SensorHalService.java
+++ b/service/src/com/android/car/hal/SensorHalService.java
@@ -16,8 +16,8 @@
package com.android.car.hal;
-import android.support.car.hardware.CarSensorEvent;
-import android.support.car.hardware.CarSensorManager;
+import android.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorManager;
import android.util.Log;
import android.util.SparseArray;
diff --git a/service/src/com/android/car/hal/SensorHalServiceBase.java b/service/src/com/android/car/hal/SensorHalServiceBase.java
index 3e2fee1..ff106fd 100644
--- a/service/src/com/android/car/hal/SensorHalServiceBase.java
+++ b/service/src/com/android/car/hal/SensorHalServiceBase.java
@@ -16,7 +16,7 @@
package com.android.car.hal;
-import android.support.car.hardware.CarSensorEvent;
+import android.car.hardware.CarSensorEvent;
import com.android.car.vehiclenetwork.VehicleNetworkProto.VehiclePropConfig;
import com.android.car.vehiclenetwork.VehicleNetworkProto.VehiclePropValue;
diff --git a/service/src/com/android/car/pm/AppBlockingPolicyProxy.java b/service/src/com/android/car/pm/AppBlockingPolicyProxy.java
index b9ea0f8..3ab7df4 100644
--- a/service/src/com/android/car/pm/AppBlockingPolicyProxy.java
+++ b/service/src/com/android/car/pm/AppBlockingPolicyProxy.java
@@ -15,6 +15,9 @@
*/
package com.android.car.pm;
+import android.car.content.pm.CarAppBlockingPolicy;
+import android.car.content.pm.ICarAppBlockingPolicy;
+import android.car.content.pm.ICarAppBlockingPolicySetter;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -24,9 +27,6 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
-import android.support.car.content.pm.CarAppBlockingPolicy;
-import android.support.car.content.pm.ICarAppBlockingPolicy;
-import android.support.car.content.pm.ICarAppBlockingPolicySetter;
import android.util.Log;
import com.android.car.CarLog;
@@ -149,11 +149,6 @@
}
private class ICarAppBlockingPolicySetterImpl extends ICarAppBlockingPolicySetter.Stub {
- private static final int VERSION = 1;
- @Override
- public int getVersion() {
- return VERSION;
- }
@Override
public void setAppBlockingPolicy(CarAppBlockingPolicy policy) {
diff --git a/service/src/com/android/car/pm/CarAppMetadataReader.java b/service/src/com/android/car/pm/CarAppMetadataReader.java
index 878dabc..b54e192 100644
--- a/service/src/com/android/car/pm/CarAppMetadataReader.java
+++ b/service/src/com/android/car/pm/CarAppMetadataReader.java
@@ -36,7 +36,7 @@
*/
public class CarAppMetadataReader {
/** Name of the meta-data attribute for the automotive application XML resource */
- private static final String METADATA_ATTRIBUTE = "android.support.car.application";
+ private static final String METADATA_ATTRIBUTE = "android.car.application";
/** Name of the tag to declare automotive usage */
private static final String USES_TAG = "uses";
/** Name of the attribute to name the usage type */
diff --git a/service/src/com/android/car/pm/CarPackageManagerService.java b/service/src/com/android/car/pm/CarPackageManagerService.java
index 627bba5..8816502 100644
--- a/service/src/com/android/car/pm/CarPackageManagerService.java
+++ b/service/src/com/android/car/pm/CarPackageManagerService.java
@@ -15,6 +15,12 @@
*/
package com.android.car.pm;
+import android.car.Car;
+import android.car.content.pm.AppBlockingPackageInfo;
+import android.car.content.pm.CarAppBlockingPolicy;
+import android.car.content.pm.CarAppBlockingPolicyService;
+import android.car.content.pm.CarPackageManager;
+import android.car.content.pm.ICarPackageManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
@@ -27,12 +33,6 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
-import android.support.car.Car;
-import android.support.car.content.pm.AppBlockingPackageInfo;
-import android.support.car.content.pm.CarAppBlockingPolicy;
-import android.support.car.content.pm.CarAppBlockingPolicyService;
-import android.support.car.content.pm.CarPackageManager;
-import android.support.car.content.pm.ICarPackageManager;
import android.util.ArraySet;
import android.util.Log;
import android.util.Pair;
@@ -53,7 +53,6 @@
//TODO monitor app installing and refresh policy
public class CarPackageManagerService extends ICarPackageManager.Stub implements CarServiceBase {
- private static final int VERSION = 1;
static final boolean DBG_POLICY_SET = true;
static final boolean DBG_POLICY_CHECK = false;
@@ -89,11 +88,6 @@
}
@Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
public void setAppBlockingPolicy(String packageName, CarAppBlockingPolicy policy, int flags) {
if (DBG_POLICY_SET) {
Log.i(CarLog.TAG_PACKAGE, "policy setting from binder call, client:" + packageName);
diff --git a/tests/Android.mk b/tests/Android.mk
index d114831..78fed19 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -13,8 +13,11 @@
# limitations under the License.
#
#
+ifneq ($(TARGET_BUILD_PDK),true)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Include the sub-makefiles
include $(call all-makefiles-under,$(LOCAL_PATH))
+
+endif #TARGET_BUILD_PDK
diff --git a/tests/api_test/Android.mk b/tests/api_test/Android.mk
index 201e4b4..e9d2827 100644
--- a/tests/api_test/Android.mk
+++ b/tests/api_test/Android.mk
@@ -32,8 +32,8 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES += car-systemtest
+LOCAL_STATIC_JAVA_LIBRARIES += android.support.car car-systemtest
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.car android.test.runner
include $(BUILD_PACKAGE)
diff --git a/tests/api_test/src/com/android/support/car/apitest/VehicleDoorTest.java b/tests/api_test/src/com/android/car/apitest/VehicleDoorTest.java
similarity index 95%
rename from tests/api_test/src/com/android/support/car/apitest/VehicleDoorTest.java
rename to tests/api_test/src/com/android/car/apitest/VehicleDoorTest.java
index 1597e7a..bb46797 100644
--- a/tests/api_test/src/com/android/support/car/apitest/VehicleDoorTest.java
+++ b/tests/api_test/src/com/android/car/apitest/VehicleDoorTest.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.support.car.apitest;
+package com.android.car.apitest;
-import android.support.car.VehicleDoor;
+import android.car.VehicleDoor;
import android.test.AndroidTestCase;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
diff --git a/tests/api_test/src/com/android/support/car/apitest/VehicleSeatTest.java b/tests/api_test/src/com/android/car/apitest/VehicleSeatTest.java
similarity index 96%
rename from tests/api_test/src/com/android/support/car/apitest/VehicleSeatTest.java
rename to tests/api_test/src/com/android/car/apitest/VehicleSeatTest.java
index 18ca392..28d626a 100644
--- a/tests/api_test/src/com/android/support/car/apitest/VehicleSeatTest.java
+++ b/tests/api_test/src/com/android/car/apitest/VehicleSeatTest.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.support.car.apitest;
+package com.android.car.apitest;
-import android.support.car.VehicleSeat;
+import android.car.VehicleSeat;
import android.test.AndroidTestCase;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
diff --git a/tests/api_test/src/com/android/support/car/apitest/VehicleWindowTest.java b/tests/api_test/src/com/android/car/apitest/VehicleWindowTest.java
similarity index 95%
rename from tests/api_test/src/com/android/support/car/apitest/VehicleWindowTest.java
rename to tests/api_test/src/com/android/car/apitest/VehicleWindowTest.java
index b0efa8c..ea9ab3d 100644
--- a/tests/api_test/src/com/android/support/car/apitest/VehicleWindowTest.java
+++ b/tests/api_test/src/com/android/car/apitest/VehicleWindowTest.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.support.car.apitest;
+package com.android.car.apitest;
-import android.support.car.VehicleWindow;
+import android.car.VehicleWindow;
import android.test.AndroidTestCase;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
diff --git a/tests/api_test/src/com/android/support/car/apitest/VehicleZoneTest.java b/tests/api_test/src/com/android/car/apitest/VehicleZoneTest.java
similarity index 97%
rename from tests/api_test/src/com/android/support/car/apitest/VehicleZoneTest.java
rename to tests/api_test/src/com/android/car/apitest/VehicleZoneTest.java
index 06793f3..85e7621 100644
--- a/tests/api_test/src/com/android/support/car/apitest/VehicleZoneTest.java
+++ b/tests/api_test/src/com/android/car/apitest/VehicleZoneTest.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.support.car.apitest;
+package com.android.car.apitest;
-import android.support.car.VehicleZone;
+import android.car.VehicleZone;
import android.test.AndroidTestCase;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
diff --git a/tests/api_test/src/com/android/support/car/apitest/AppBlockingPackageInfoTest.java b/tests/api_test/src/com/android/support/car/apitest/AppBlockingPackageInfoTest.java
index 39c2e16..1f29551 100644
--- a/tests/api_test/src/com/android/support/car/apitest/AppBlockingPackageInfoTest.java
+++ b/tests/api_test/src/com/android/support/car/apitest/AppBlockingPackageInfoTest.java
@@ -15,12 +15,12 @@
*/
package com.android.support.car.apitest;
+import android.car.content.pm.AppBlockingPackageInfo;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Parcel;
-import android.support.car.content.pm.AppBlockingPackageInfo;
import android.test.AndroidTestCase;
import android.util.Log;
diff --git a/tests/api_test/src/com/android/support/car/apitest/CarAppBlockingPolicyTest.java b/tests/api_test/src/com/android/support/car/apitest/CarAppBlockingPolicyTest.java
index 6b23279..c1a1e8e 100644
--- a/tests/api_test/src/com/android/support/car/apitest/CarAppBlockingPolicyTest.java
+++ b/tests/api_test/src/com/android/support/car/apitest/CarAppBlockingPolicyTest.java
@@ -15,13 +15,13 @@
*/
package com.android.support.car.apitest;
+import android.car.content.pm.AppBlockingPackageInfo;
+import android.car.content.pm.CarAppBlockingPolicy;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Parcel;
-import android.support.car.content.pm.AppBlockingPackageInfo;
-import android.support.car.content.pm.CarAppBlockingPolicy;
import android.test.AndroidTestCase;
import android.util.Log;
diff --git a/tests/api_test/src/com/android/support/car/apitest/CarNavigationStatusManagerTest.java b/tests/api_test/src/com/android/support/car/apitest/CarNavigationManagerTest.java
similarity index 78%
rename from tests/api_test/src/com/android/support/car/apitest/CarNavigationStatusManagerTest.java
rename to tests/api_test/src/com/android/support/car/apitest/CarNavigationManagerTest.java
index 715efc1..85e9caa 100644
--- a/tests/api_test/src/com/android/support/car/apitest/CarNavigationStatusManagerTest.java
+++ b/tests/api_test/src/com/android/support/car/apitest/CarNavigationManagerTest.java
@@ -23,8 +23,8 @@
import android.support.car.CarAppContextManager.AppContextChangeListener;
import android.support.car.navigation.CarNavigationInstrumentCluster;
import android.support.car.CarNotConnectedException;
-import android.support.car.navigation.CarNavigationStatusManager.CarNavigationStatusListener;
-import android.support.car.navigation.CarNavigationStatusManager;
+import android.support.car.navigation.CarNavigationManager;
+import android.support.car.navigation.CarNavigationManager.CarNavigationListener;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -32,17 +32,17 @@
/**
* Unit tests for {@link android.support.car.navigation.CarNavigationStatusManager}
*/
-public class CarNavigationStatusManagerTest extends CarApiTestBase {
+public class CarNavigationManagerTest extends CarApiTestBase {
- private CarNavigationStatusManager mCarNavigationStatusManager;
+ private CarNavigationManager mCarNavigationManager;
private CarAppContextManager mCarAppContextManager;
@Override
protected void setUp() throws Exception {
super.setUp();
- mCarNavigationStatusManager =
- (CarNavigationStatusManager) getCar().getCarManager(Car.CAR_NAVIGATION_SERVICE);
- assertNotNull(mCarNavigationStatusManager);
+ mCarNavigationManager =
+ (CarNavigationManager) getCar().getCarManager(Car.CAR_NAVIGATION_SERVICE);
+ assertNotNull(mCarNavigationManager);
mCarAppContextManager =
(CarAppContextManager) getCar().getCarManager(Car.APP_CONTEXT_SERVICE);
assertNotNull(mCarAppContextManager);
@@ -51,9 +51,9 @@
public void testStart() throws Exception {
final CountDownLatch onStartLatch = new CountDownLatch(1);
- mCarNavigationStatusManager.registerListener(new CarNavigationStatusListener() {
+ mCarNavigationManager.registerListener(new CarNavigationListener() {
@Override
- public void onStart(CarNavigationInstrumentCluster instrumentCluster) {
+ public void onInstrumentClusterStart(CarNavigationInstrumentCluster instrumentCluster) {
// TODO: we should use VehicleHalMock once we implement HAL support in
// CarNavigationStatusService.
assertFalse(instrumentCluster.supportsCustomImages());
@@ -62,7 +62,7 @@
}
@Override
- public void onStop() {
+ public void onInstrumentClusterStop() {
// TODO
}
});
@@ -70,7 +70,7 @@
assertTrue(onStartLatch.await(DEFAULT_WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS));
try {
- mCarNavigationStatusManager.sendNavigationStatus(10);
+ mCarNavigationManager.sendNavigationStatus(10);
fail();
} catch (IllegalStateException expected) {
// Expected. Client should acquire context ownership for APP_CONTEXT_NAVIGATION.
@@ -92,6 +92,6 @@
// TODO: we should use mocked HAL to be able to verify this, right now just make sure that
// it is not crashing and logcat has appropriate traces.
- mCarNavigationStatusManager.sendNavigationStatus(20);
+ mCarNavigationManager.sendNavigationStatus(20);
}
}
diff --git a/tests/car_activity_test_app/Android.mk b/tests/car_activity_test_app/Android.mk
index 8caf310..0b9add5 100644
--- a/tests/car_activity_test_app/Android.mk
+++ b/tests/car_activity_test_app/Android.mk
@@ -16,23 +16,6 @@
LOCAL_PATH:= $(call my-dir)
-# Add a static library target, so the src, and res can be reused by the hybrid car app
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_STATIC_JAVA_LIBRARIES += car-core
-
-LOCAL_MODULE := cartestapplib
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-##################################################
-
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -48,6 +31,6 @@
LOCAL_PROGUARD_ENABLED := disabled
-include packages/services/Car/car-libs/car.mk
+include packages/services/Car/car-support-lib/car-support.mk
include $(BUILD_PACKAGE)
diff --git a/tests/car_activity_test_app/AndroidManifest.xml b/tests/car_activity_test_app/AndroidManifest.xml
index bf25d71..5564954 100644
--- a/tests/car_activity_test_app/AndroidManifest.xml
+++ b/tests/car_activity_test_app/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-sdk
android:minSdkVersion="22"
android:targetSdkVersion='23'/>
- <uses-permission android:name="android.support.car.permission.CAR_SPEED" />
+ <uses-permission android:name="android.car.permission.CAR_SPEED" />
<application android:label="CarActivityTest"
android:icon="@drawable/ic_launcher">
<activity android:name=".HelloCarProxyActivity"
diff --git a/tests/carservice_test/Android.mk b/tests/carservice_test/Android.mk
index 1af63ae..2859469 100644
--- a/tests/carservice_test/Android.mk
+++ b/tests/carservice_test/Android.mk
@@ -32,9 +32,9 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES += car-systemtest
-LOCAL_STATIC_JAVA_LIBRARIES += car-service-lib-for-test
+LOCAL_STATIC_JAVA_LIBRARIES += android.support.car
+LOCAL_STATIC_JAVA_LIBRARIES += car-service-lib-for-test car-systemtest
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.car android.test.runner
include $(BUILD_PACKAGE)
diff --git a/tests/carservice_test/AndroidManifest.xml b/tests/carservice_test/AndroidManifest.xml
index 43ae623..0bea904 100644
--- a/tests/carservice_test/AndroidManifest.xml
+++ b/tests/carservice_test/AndroidManifest.xml
@@ -20,19 +20,19 @@
android:sharedUserId="android.uid.system" >
<uses-permission android:name="android.Manifest.permission.MODIFY_AUDIO_ROUTING" />
- <uses-permission android:name="android.support.car.permission.CAR_HVAC" />
- <uses-permission android:name="android.support.car.permission.CAR_RADIO" />
- <uses-permission android:name="android.support.car.permission.CONTROL_APP_BLOCKING" />
+ <uses-permission android:name="android.car.permission.CAR_HVAC" />
+ <uses-permission android:name="android.car.permission.CAR_RADIO" />
+ <uses-permission android:name="android.car.permission.CONTROL_APP_BLOCKING" />
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.android.support.car.carservicetest"
android:label="Tests for Car APIs"/>
<application android:label="CarServiceTest">
<uses-library android:name="android.test.runner" />
- <service android:name="com.android.support.car.test.TestAppBlockingPolicyService"
- android:permission="android.support.car.permission.CONTROL_APP_BLOCKING">
+ <service android:name="com.android.car.test.TestAppBlockingPolicyService"
+ android:permission="android.car.permission.CONTROL_APP_BLOCKING">
<intent-filter>
- <action android:name="android.support.car.content.pm.CarAppBlockingPolicyService"/>
+ <action android:name="android.car.content.pm.CarAppBlockingPolicyService"/>
</intent-filter>
</service>
</application>
diff --git a/tests/carservice_test/src/com/android/support/car/test/AudioRoutingPolicyTest.java b/tests/carservice_test/src/com/android/car/test/AudioRoutingPolicyTest.java
similarity index 97%
rename from tests/carservice_test/src/com/android/support/car/test/AudioRoutingPolicyTest.java
rename to tests/carservice_test/src/com/android/car/test/AudioRoutingPolicyTest.java
index 710493c..9ff5511 100644
--- a/tests/carservice_test/src/com/android/support/car/test/AudioRoutingPolicyTest.java
+++ b/tests/carservice_test/src/com/android/car/test/AudioRoutingPolicyTest.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.support.car.test;
+package com.android.car.test;
-import android.support.car.VehicleHalEmulator.VehicleHalPropertyHandler;
+import android.car.test.VehicleHalEmulator.VehicleHalPropertyHandler;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
import com.android.car.vehiclenetwork.VehicleNetworkConsts.VehicleAudioContextFlag;
@@ -27,6 +27,7 @@
import com.android.car.vehiclenetwork.VehicleNetworkProto.VehiclePropValue;
import com.android.car.vehiclenetwork.VehiclePropConfigUtil;
import com.android.car.vehiclenetwork.VehiclePropValueUtil;
+import com.android.support.car.test.MockedCarTestBase;
import java.util.LinkedList;
import java.util.concurrent.Semaphore;
diff --git a/tests/carservice_test/src/com/android/support/car/test/CarRadioManagerTest.java b/tests/carservice_test/src/com/android/car/test/CarRadioManagerTest.java
similarity index 94%
rename from tests/carservice_test/src/com/android/support/car/test/CarRadioManagerTest.java
rename to tests/carservice_test/src/com/android/car/test/CarRadioManagerTest.java
index e5091d3..ef7a371 100644
--- a/tests/carservice_test/src/com/android/support/car/test/CarRadioManagerTest.java
+++ b/tests/carservice_test/src/com/android/car/test/CarRadioManagerTest.java
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.android.support.car.test;
+package com.android.car.test;
+import android.car.Car;
+import android.car.test.VehicleHalEmulator;
+import android.car.hardware.radio.CarRadioEvent;
+import android.car.hardware.radio.CarRadioManager;
+import android.car.hardware.radio.CarRadioManager.CarRadioEventListener;
+import android.car.hardware.radio.CarRadioPreset;
import android.hardware.radio.RadioManager;
import android.util.Log;
-import android.support.car.CarSystem;
-import android.support.car.VehicleHalEmulator;
-import android.support.car.hardware.radio.CarRadioEvent;
-import android.support.car.hardware.radio.CarRadioManager;
-import android.support.car.hardware.radio.CarRadioManager.CarRadioEventListener;
-import android.support.car.hardware.radio.CarRadioPreset;
-
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
import com.android.car.vehiclenetwork.VehicleNetworkConsts.VehiclePropAccess;
import com.android.car.vehiclenetwork.VehicleNetworkConsts.VehiclePropChangeMode;
@@ -32,6 +31,7 @@
import com.android.car.vehiclenetwork.VehicleNetworkProto.VehiclePropValue;
import com.android.car.vehiclenetwork.VehiclePropConfigUtil;
import com.android.car.vehiclenetwork.VehiclePropValueUtil;
+import com.android.support.car.test.MockedCarTestBase;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@@ -146,7 +146,7 @@
new RadioPresetPropertyHandler());
getVehicleHalEmulator().start();
mCarRadioManager =
- (CarRadioManager) getCarApi().getCarManager(CarSystem.RADIO_SERVICE);
+ (CarRadioManager) getCar().getCarManager(Car.RADIO_SERVICE);
}
public void testPresetCount() throws Exception {
diff --git a/tests/carservice_test/src/com/android/support/car/test/TestAppBlockingPolicyService.java b/tests/carservice_test/src/com/android/car/test/TestAppBlockingPolicyService.java
similarity index 69%
rename from tests/carservice_test/src/com/android/support/car/test/TestAppBlockingPolicyService.java
rename to tests/carservice_test/src/com/android/car/test/TestAppBlockingPolicyService.java
index 580ada1..dc1ad8a 100644
--- a/tests/carservice_test/src/com/android/support/car/test/TestAppBlockingPolicyService.java
+++ b/tests/carservice_test/src/com/android/car/test/TestAppBlockingPolicyService.java
@@ -1,11 +1,26 @@
-package com.android.support.car.test;
+/*
+ * Copyright (C) 2015 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 com.android.car.test;
+import android.car.content.pm.AppBlockingPackageInfo;
+import android.car.content.pm.CarAppBlockingPolicy;
+import android.car.content.pm.CarAppBlockingPolicyService;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
-import android.support.car.content.pm.AppBlockingPackageInfo;
-import android.support.car.content.pm.CarAppBlockingPolicy;
-import android.support.car.content.pm.CarAppBlockingPolicyService;
import android.util.Log;
public class TestAppBlockingPolicyService extends CarAppBlockingPolicyService {
diff --git a/tests/carservice_test/src/com/android/support/car/test/AppContextTest.java b/tests/carservice_test/src/com/android/support/car/test/AppContextTest.java
index f5ff229..76da972 100644
--- a/tests/carservice_test/src/com/android/support/car/test/AppContextTest.java
+++ b/tests/carservice_test/src/com/android/support/car/test/AppContextTest.java
@@ -15,11 +15,11 @@
*/
package com.android.support.car.test;
+import android.car.test.VehicleHalEmulator.VehicleHalPropertyHandler;
import android.content.Context;
import android.media.AudioManager;
import android.support.car.Car;
import android.support.car.CarAppContextManager;
-import android.support.car.VehicleHalEmulator.VehicleHalPropertyHandler;
import android.util.Log;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
@@ -55,7 +55,7 @@
}
public void testCotextChange() throws Exception {
- CarAppContextManager manager = (CarAppContextManager) getCarApi().getCarManager(
+ CarAppContextManager manager = (CarAppContextManager) getSupportCar().getCarManager(
Car.APP_CONTEXT_SERVICE);
ContextChangeListerner listener = new ContextChangeListerner();
manager.registerContextListener(listener, CarAppContextManager.APP_CONTEXT_NAVIGATION |
diff --git a/tests/carservice_test/src/com/android/support/car/test/CarAudioFocusTest.java b/tests/carservice_test/src/com/android/support/car/test/CarAudioFocusTest.java
index f33ec06..2f6e284 100644
--- a/tests/carservice_test/src/com/android/support/car/test/CarAudioFocusTest.java
+++ b/tests/carservice_test/src/com/android/support/car/test/CarAudioFocusTest.java
@@ -15,12 +15,12 @@
*/
package com.android.support.car.test;
+import android.car.test.VehicleHalEmulator.VehicleHalPropertyHandler;
import android.content.Context;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.os.SystemClock;
import android.support.car.Car;
-import android.support.car.VehicleHalEmulator.VehicleHalPropertyHandler;
import android.support.car.media.CarAudioManager;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
@@ -337,7 +337,7 @@
// android radio
AudioFocusListener listenerRadio = new AudioFocusListener();
- CarAudioManager carAudioManager = (CarAudioManager) getCarApi().getCarManager(
+ CarAudioManager carAudioManager = (CarAudioManager) getSupportCar().getCarManager(
Car.AUDIO_SERVICE);
assertNotNull(carAudioManager);
AudioAttributes radioAttributes = carAudioManager.getAudioAttributesForCarUsage(
diff --git a/tests/carservice_test/src/com/android/support/car/test/CarHvacManagerTest.java b/tests/carservice_test/src/com/android/support/car/test/CarHvacManagerTest.java
index de05dd9..37fa0ec 100644
--- a/tests/carservice_test/src/com/android/support/car/test/CarHvacManagerTest.java
+++ b/tests/carservice_test/src/com/android/support/car/test/CarHvacManagerTest.java
@@ -18,13 +18,13 @@
import android.util.Log;
-import android.support.car.CarSystem;
-import android.support.car.VehicleHalEmulator;
-import android.support.car.hardware.hvac.CarHvacManager;
-import android.support.car.hardware.hvac.CarHvacManager.CarHvacEventListener;
-import android.support.car.hardware.hvac.CarHvacManager.CarHvacBooleanValue;
-import android.support.car.hardware.hvac.CarHvacManager.CarHvacFloatValue;
-import android.support.car.hardware.hvac.CarHvacManager.CarHvacIntValue;
+import android.car.Car;
+import android.car.test.VehicleHalEmulator;
+import android.car.hardware.hvac.CarHvacManager;
+import android.car.hardware.hvac.CarHvacManager.CarHvacEventListener;
+import android.car.hardware.hvac.CarHvacManager.CarHvacBooleanValue;
+import android.car.hardware.hvac.CarHvacManager.CarHvacFloatValue;
+import android.car.hardware.hvac.CarHvacManager.CarHvacIntValue;
import com.android.car.vehiclenetwork.VehicleNetworkConsts;
import com.android.car.vehiclenetwork.VehicleNetworkConsts.VehiclePropAccess;
@@ -80,7 +80,7 @@
VehicleZone.VEHICLE_ZONE_ROW_1_LEFT), handler);
getVehicleHalEmulator().start();
mCarHvacManager =
- (CarHvacManager) getCarApi().getCarManager(CarSystem.HVAC_SERVICE);
+ (CarHvacManager) getCar().getCarManager(Car.HVAC_SERVICE);
}
// Test a boolean property
diff --git a/tests/carservice_test/src/com/android/support/car/test/CarInfoManagerTest.java b/tests/carservice_test/src/com/android/support/car/test/CarInfoManagerTest.java
index 2e3a066..ae502d6 100644
--- a/tests/carservice_test/src/com/android/support/car/test/CarInfoManagerTest.java
+++ b/tests/carservice_test/src/com/android/support/car/test/CarInfoManagerTest.java
@@ -41,7 +41,7 @@
VehicleNetworkConsts.VEHICLE_PROPERTY_INFO_MAKE, MAKE_NAME, 0));
getVehicleHalEmulator().start();
mCarInfoManager =
- (CarInfoManager) getCarApi().getCarManager(Car.INFO_SERVICE);
+ (CarInfoManager) getSupportCar().getCarManager(Car.INFO_SERVICE);
}
public void testManufactuter() throws Exception {
diff --git a/tests/carservice_test/src/com/android/support/car/test/CarPackageManagerTest.java b/tests/carservice_test/src/com/android/support/car/test/CarPackageManagerTest.java
index 8ba2cb9..9776bff 100644
--- a/tests/carservice_test/src/com/android/support/car/test/CarPackageManagerTest.java
+++ b/tests/carservice_test/src/com/android/support/car/test/CarPackageManagerTest.java
@@ -15,14 +15,15 @@
*/
package com.android.support.car.test;
+import android.car.Car;
+import android.car.CarNotConnectedException;
+import android.car.content.pm.AppBlockingPackageInfo;
+import android.car.content.pm.CarAppBlockingPolicy;
+import android.car.content.pm.CarPackageManager;
import android.content.pm.PackageManager;
-import android.support.car.Car;
-import android.support.car.CarNotConnectedException;
-import android.support.car.content.pm.AppBlockingPackageInfo;
-import android.support.car.content.pm.CarAppBlockingPolicy;
-import android.support.car.content.pm.CarPackageManager;
import android.util.Log;
+import com.android.car.test.TestAppBlockingPolicyService;
public class CarPackageManagerTest extends MockedCarTestBase {
private static final String TAG = CarPackageManagerTest.class.getSimpleName();
@@ -44,7 +45,8 @@
private void init(boolean policyFromService) throws Exception {
TestAppBlockingPolicyService.controlPolicySettingFromService(policyFromService);
getVehicleHalEmulator().start();
- mCarPm = (CarPackageManager) getCarApi().getCarManager(Car.PACKAGE_SERVICE);
+ mCarPm = (CarPackageManager) getCar().getCarManager(Car.PACKAGE_SERVICE);
+ assertNotNull(mCarPm);
}
public void testServiceLaunched() throws Exception {
diff --git a/tests/carservice_test/src/com/android/support/car/test/CarPowerManagementTest.java b/tests/carservice_test/src/com/android/support/car/test/CarPowerManagementTest.java
index 9082875..6cb3113 100644
--- a/tests/carservice_test/src/com/android/support/car/test/CarPowerManagementTest.java
+++ b/tests/carservice_test/src/com/android/support/car/test/CarPowerManagementTest.java
@@ -15,12 +15,12 @@
*/
package com.android.support.car.test;
+import android.car.test.VehicleHalEmulator.VehicleHalPropertyHandler;
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
-import android.support.car.VehicleHalEmulator.VehicleHalPropertyHandler;
import android.util.Log;
import android.view.Display;
diff --git a/tests/carservice_test/src/com/android/support/car/test/MockedCarTestBase.java b/tests/carservice_test/src/com/android/support/car/test/MockedCarTestBase.java
index ce27cdf..05d7104 100644
--- a/tests/carservice_test/src/com/android/support/car/test/MockedCarTestBase.java
+++ b/tests/carservice_test/src/com/android/support/car/test/MockedCarTestBase.java
@@ -15,19 +15,20 @@
*/
package com.android.support.car.test;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
+import android.car.test.VehicleHalEmulator;
import android.content.ComponentName;
+import android.content.ServiceConnection;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.support.car.Car;
import android.support.car.ServiceConnectionListener;
-import android.support.car.VehicleHalEmulator;
import android.test.AndroidTestCase;
import android.util.Log;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
/**
* Base class for testing with mocked vehicle HAL (=car).
* It is up to each app to start emulation by getVehicleHalEmulator().start() as there will be
@@ -37,10 +38,12 @@
private static final String TAG = MockedCarTestBase.class.getSimpleName();
private static final long DEFAULT_WAIT_TIMEOUT_MS = 3000;
- private Car mCar;
+ private Car mSupportCar;
+ private android.car.Car mCar;
private VehicleHalEmulator mVehicleHalEmulator;
- private final Semaphore mConnectionWait = new Semaphore(0);
+ private final Semaphore mConnectionWaitForSupportCar = new Semaphore(0);
+ private final Semaphore mConnectionWaitForCar = new Semaphore(0);
private final Semaphore mWaitForMain = new Semaphore(0);
private final Handler mMainHalder = new Handler(Looper.getMainLooper());
@@ -61,16 +64,30 @@
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.i(TAG, "onServiceConnected, component" + name + " binder " + service);
- mConnectionWait.release();
+ mConnectionWaitForSupportCar.release();
}
};
@Override
protected synchronized void setUp() throws Exception {
super.setUp();
- mCar = Car.createCar(getContext(), mConnectionListener);
+ mSupportCar = Car.createCar(getContext(), mConnectionListener);
+ mSupportCar.connect();
+ mCar = android.car.Car.createCar(getContext(), new ServiceConnection() {
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ mConnectionWaitForCar.release();
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ }
+ });
mCar.connect();
assertTrue(waitForConnection(DEFAULT_WAIT_TIMEOUT_MS));
+ assertTrue(mConnectionWaitForCar.tryAcquire(DEFAULT_WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS)
+ );
mVehicleHalEmulator = new VehicleHalEmulator(mCar);
}
@@ -80,10 +97,15 @@
if (mVehicleHalEmulator.isStarted()) {
mVehicleHalEmulator.stop();
}
+ mSupportCar.disconnect();
mCar.disconnect();
}
- protected synchronized Car getCarApi() {
+ protected synchronized Car getSupportCar() {
+ return mSupportCar;
+ }
+
+ protected synchronized android.car.Car getCar() {
return mCar;
}
@@ -107,6 +129,6 @@
}
private boolean waitForConnection(long timeoutMs) throws InterruptedException {
- return mConnectionWait.tryAcquire(timeoutMs, TimeUnit.MILLISECONDS);
+ return mConnectionWaitForSupportCar.tryAcquire(timeoutMs, TimeUnit.MILLISECONDS);
}
}
diff --git a/tests/carservice_unit_test/Android.mk b/tests/carservice_unit_test/Android.mk
index a30afc2..1d67d2b 100644
--- a/tests/carservice_unit_test/Android.mk
+++ b/tests/carservice_unit_test/Android.mk
@@ -33,8 +33,6 @@
LOCAL_INSTRUMENTATION_FOR := CarService
-LOCAL_STATIC_JAVA_LIBRARIES += car-systemtest
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.car android.test.runner
include $(BUILD_PACKAGE)