aboutsummaryrefslogtreecommitdiff
path: root/car-lib/src/android/car/drivingstate
diff options
context:
space:
mode:
authorRam Periathiruvadi <ramperry@google.com>2018-01-24 13:00:54 -0800
committerRam Periathiruvadi <ramperry@google.com>2018-01-26 12:44:27 -0800
commit4526a43140177072b5543f3cf0f06bd72fd8e38e (patch)
tree15e1e2ca59bf9d61c776c87aa5303167dfea1762 /car-lib/src/android/car/drivingstate
parent132ccf84839326b37e2851409c1666453da2b922 (diff)
downloadCar-4526a43140177072b5543f3cf0f06bd72fd8e38e.tar.gz
Revise CarUxRestrictions API.
UX Restriction related classes are renamed to follow convention. UX Restriction related APIs - Manager and Event are renamed for readability. More granular UX Restrictions are added to the CarUxRestrictions. Bug: b/72321163, b/72287236 Test: Compiles and boots. KitchenSync can listen to the events. Change-Id: I0c3afdc9dd992f4247fd4a50816611a76d31ced8
Diffstat (limited to 'car-lib/src/android/car/drivingstate')
-rw-r--r--car-lib/src/android/car/drivingstate/CarUXRestrictionsEvent.java101
-rw-r--r--car-lib/src/android/car/drivingstate/CarUxRestrictions.aidl (renamed from car-lib/src/android/car/drivingstate/CarUXRestrictionsEvent.aidl)2
-rw-r--r--car-lib/src/android/car/drivingstate/CarUxRestrictions.java227
-rw-r--r--car-lib/src/android/car/drivingstate/CarUxRestrictionsManager.java (renamed from car-lib/src/android/car/drivingstate/CarUXRestrictionsManager.java)114
-rw-r--r--car-lib/src/android/car/drivingstate/ICarUxRestrictionsChangeListener.aidl (renamed from car-lib/src/android/car/drivingstate/ICarUXRestrictionsChangeListener.aidl)8
-rw-r--r--car-lib/src/android/car/drivingstate/ICarUxRestrictionsManager.aidl (renamed from car-lib/src/android/car/drivingstate/ICarUXRestrictions.aidl)16
6 files changed, 297 insertions, 171 deletions
diff --git a/car-lib/src/android/car/drivingstate/CarUXRestrictionsEvent.java b/car-lib/src/android/car/drivingstate/CarUXRestrictionsEvent.java
deleted file mode 100644
index a6fa1aaf42..0000000000
--- a/car-lib/src/android/car/drivingstate/CarUXRestrictionsEvent.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.car.drivingstate;
-
-import android.annotation.IntDef;
-import android.os.Parcel;
-import android.os.Parcelable;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Car UX Restrictions related event. This contains information on the set of UX restrictions
- * that is in place due to the car's driving state.
- */
-public class CarUXRestrictionsEvent implements Parcelable {
-
- // UXRestrictions TODO: (b/69859857) - make it configurable
- /**
- * No UX Restrictions. Vehicle Optimized apps are allowed to display non Drive Optimized
- * Activities.
- */
- public static final int UXR_NO_RESTRICTIONS = 0;
- /**
- * UX Restrictions fully in place. Only Drive Optimized Activities that are optimized to handle
- * the UX restrictions can run.
- * TODO: (b/72155508) - Finalize what these restrictions are
- */
- public static final int UXR_FULLY_RESTRICTED = 31;
-
- @IntDef({UXR_NO_RESTRICTIONS,
- UXR_FULLY_RESTRICTED})
- @Retention(RetentionPolicy.SOURCE)
- public @interface CarUXRestrictions {
- }
-
- /**
- * Time at which this UX restriction event was deduced based on the car's driving state.
- * It is the elapsed time in nanoseconds since system boot.
- */
- public final long timeStamp;
-
- /**
- * UX Restriction in effect.
- * TODO: (b/72155508) If/When we add more granular UX restrictions, this will be a list of
- * restrictions.
- */
- @CarUXRestrictions
- public final int eventValue;
-
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(eventValue);
- dest.writeLong(timeStamp);
- }
-
- public static final Parcelable.Creator<CarUXRestrictionsEvent> CREATOR
- = new Parcelable.Creator<CarUXRestrictionsEvent>() {
- public CarUXRestrictionsEvent createFromParcel(Parcel in) {
- return new CarUXRestrictionsEvent(in);
- }
-
- public CarUXRestrictionsEvent[] newArray(int size) {
- return new CarUXRestrictionsEvent[size];
- }
- };
-
- public CarUXRestrictionsEvent(int value, long time) {
- eventValue = value;
- timeStamp = time;
- }
-
- private CarUXRestrictionsEvent(Parcel in) {
- eventValue = in.readInt();
- timeStamp = in.readLong();
- }
-
- @Override
- public String toString() {
- return eventValue + " " + timeStamp;
- }
-}
diff --git a/car-lib/src/android/car/drivingstate/CarUXRestrictionsEvent.aidl b/car-lib/src/android/car/drivingstate/CarUxRestrictions.aidl
index 3e37dbbdd6..b80b94c8b0 100644
--- a/car-lib/src/android/car/drivingstate/CarUXRestrictionsEvent.aidl
+++ b/car-lib/src/android/car/drivingstate/CarUxRestrictions.aidl
@@ -16,4 +16,4 @@
package android.car.drivingstate;
-parcelable CarUXRestrictionsEvent;
+parcelable CarUxRestrictions;
diff --git a/car-lib/src/android/car/drivingstate/CarUxRestrictions.java b/car-lib/src/android/car/drivingstate/CarUxRestrictions.java
new file mode 100644
index 0000000000..93a05c8e80
--- /dev/null
+++ b/car-lib/src/android/car/drivingstate/CarUxRestrictions.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.car.drivingstate;
+
+import android.annotation.IntDef;
+import android.os.Parcel;
+import android.os.Parcelable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Car UX Restrictions event. This contains information on the set of UX restrictions
+ * that is in place due to the car's driving state.
+ * <p>
+ * The restriction information is organized as follows:
+ * <ul>
+ * <li> When there are no restrictions in place, for example when the car is parked,
+ * <ul>
+ * <li> {@link #mRequiresDistractionOptimization} is set to false. Apps can display activities
+ * that are not distraction optimized.
+ * <li> {@link #mActiveRestrictions} should contain UX_RESTRICTIONS_UNRESTRICTED. Apps don't
+ * have to check for this since {@code mRequiresDistractionOptimization} is false.
+ * </ul>
+ * <li> When the driving state changes, causing the UX restrictions to come in effect,
+ * <ul>
+ * <li> {@code mRequiresDistractionOptimization} is set to true. Apps can only display
+ * activities that are distraction optimized. Distraction optimized activities follow the base
+ * design guidelines that provide a distraction free driving user experience.
+ * <li> In addition, apps will have to check for the content of mActiveRestrictions.
+ * {@code mActiveRestrictions} will have additional granular information on the set of UX
+ * restrictions that are in place for the current driving state. The content of
+ * {@code mActiveRestrictions}, for the same driving state of the vehicle, could vary depending
+ * on the car maker and the market. For example, when the car is idling, the set of active
+ * UX restrictions contained in the {@code mActiveRestrictions} will depend on the car maker
+ * and the safety standards of the market that the vehicle is deployed in.
+ * </ul>
+ * </ul>
+ * <p>
+ * Apps that intend to be run when the car is being driven need to
+ * <ul>
+ * <li> Comply with the general distraction optimization guidelines.
+ * <li> Listen and react to the UX restrictions changes as detailed above. Since the restrictions
+ * could vary depending on the market, apps are expected to react to the restriction information
+ * and not to the absolute driving state.
+ * </ul>
+ */
+public class CarUxRestrictions implements Parcelable {
+
+ // UXRestrictions TODO(b/69859857): make it configurable
+ /**
+ * No UX Restrictions. Vehicle Optimized apps are allowed to display non Drive Optimized
+ * Activities.
+ */
+ public static final int UX_RESTRICTIONS_UNRESTRICTED = 0;
+
+ // Granular UX Restrictions that are imposed when distraction optimization is required.
+ // This list is still not final - b/72155508
+ /**
+ * No text based search allowed
+ */
+ public static final int UX_RESTRICTIONS_NO_TEXT_SEARCH = 1;
+
+ /**
+ * No text based filtering allowed
+ */
+ public static final int UX_RESTRICTIONS_NO_TEXT_FILTERING = 0x1 << 1;
+
+ /**
+ * Displayed string length is limited
+ */
+
+ public static final int UX_RESTRICTIONS_LIMIT_STRING_LENGTH = 0x1 << 2;
+
+ /**
+ * No field entry like login etc.
+ */
+ public static final int UX_RESTRICTIONS_NO_FIELD_ENTRY = 0x1 << 3;
+
+ /**
+ * No videos or animation allowed
+ */
+ public static final int UX_RESTRICTIONS_NO_VIDEO = 0x1 << 4;
+
+ /**
+ * Limit the number of content items displayed on the screen
+ */
+ public static final int UX_RESTRICTIONS_LIMIT_CONTENT_ITEMS = 0x1 << 5;
+
+ /**
+ * No setup configuration allowed
+ */
+ public static final int UX_RESTRICTIONS_NO_SETUP_CONFIG = 0x1 << 6;
+
+ /**
+ * All the above restrictions are in effect.
+ */
+ public static final int UX_RESTRICTIONS_FULLY_RESTRICTED =
+ UX_RESTRICTIONS_NO_TEXT_SEARCH | UX_RESTRICTIONS_NO_TEXT_FILTERING
+ | UX_RESTRICTIONS_LIMIT_STRING_LENGTH | UX_RESTRICTIONS_NO_FIELD_ENTRY
+ | UX_RESTRICTIONS_NO_VIDEO | UX_RESTRICTIONS_LIMIT_CONTENT_ITEMS
+ | UX_RESTRICTIONS_NO_SETUP_CONFIG;
+
+ @IntDef(flag = true,
+ prefix = { "UX_RESTRICTIONS_" },
+ value = {UX_RESTRICTIONS_UNRESTRICTED,
+ UX_RESTRICTIONS_NO_TEXT_SEARCH,
+ UX_RESTRICTIONS_NO_TEXT_FILTERING,
+ UX_RESTRICTIONS_LIMIT_STRING_LENGTH,
+ UX_RESTRICTIONS_NO_FIELD_ENTRY,
+ UX_RESTRICTIONS_NO_VIDEO,
+ UX_RESTRICTIONS_LIMIT_CONTENT_ITEMS,
+ UX_RESTRICTIONS_NO_SETUP_CONFIG})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface CarUxRestrictionsInfo {
+ }
+
+ private final long mTimeStamp;
+ private final boolean mRequiresDistractionOptimization;
+ @CarUxRestrictionsInfo
+ private final int mActiveRestrictions;
+
+ /**
+ * Time at which this UX restriction event was deduced based on the car's driving state.
+ *
+ * @return Elapsed time in nanoseconds since system boot.
+ */
+ public long getTimeStamp() {
+ return mTimeStamp;
+ }
+
+ /**
+ * Conveys if the foreground activity needs to be distraction optimized.
+ * Activities that can handle distraction optimization need to be tagged as a distraction
+ * optimized in the app's manifest.
+ * <p>
+ * If the app has a foreground activity that has not been distraction optimized, the app has
+ * to switch to another activity that is distraction optimized. Failing that, the system will
+ * stop the foreground activity.
+ *
+ * @return true if distraction optimization is required, false if not
+ */
+ public boolean isRequiresDistractionOptimization() {
+ return mRequiresDistractionOptimization;
+ }
+
+ /**
+ * A combination of the Car UX Restrictions that is active for the current state of driving.
+ *
+ * @return A combination of the above {@code @CarUxRestrictionsInfo}
+ */
+ @CarUxRestrictionsInfo
+ public int getActiveRestrictions() {
+ return mActiveRestrictions;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(mActiveRestrictions);
+ dest.writeLong(mTimeStamp);
+ dest.writeInt(mRequiresDistractionOptimization ? 1 : 0);
+ }
+
+ public static final Parcelable.Creator<CarUxRestrictions> CREATOR
+ = new Parcelable.Creator<CarUxRestrictions>() {
+ public CarUxRestrictions createFromParcel(Parcel in) {
+ return new CarUxRestrictions(in);
+ }
+
+ public CarUxRestrictions[] newArray(int size) {
+ return new CarUxRestrictions[size];
+ }
+ };
+
+ public CarUxRestrictions(boolean reqOpt, int restrictions, long time) {
+ mRequiresDistractionOptimization = reqOpt;
+ mActiveRestrictions = restrictions;
+ mTimeStamp = time;
+ }
+
+ private CarUxRestrictions(Parcel in) {
+ mActiveRestrictions = in.readInt();
+ mTimeStamp = in.readLong();
+ mRequiresDistractionOptimization = in.readInt() != 0;
+ }
+
+ @Override
+ public String toString() {
+ return "DO: " + mRequiresDistractionOptimization + " UxR: " + mActiveRestrictions
+ + " time: " + mTimeStamp;
+ }
+
+ /**
+ * Compares if the restrictions are the same. Doesn't compare the timestamps.
+ *
+ * @param other the other CarUxRestrictions object
+ * @return true if the restrictions are same, false otherwise
+ */
+ public boolean isSameRestrictions(CarUxRestrictions other) {
+ if (other == null) {
+ return false;
+ }
+ if (other == this) {
+ return true;
+ }
+ return other.mRequiresDistractionOptimization == mRequiresDistractionOptimization
+ && other.mActiveRestrictions == mActiveRestrictions;
+ }
+}
diff --git a/car-lib/src/android/car/drivingstate/CarUXRestrictionsManager.java b/car-lib/src/android/car/drivingstate/CarUxRestrictionsManager.java
index 10a39ac2b1..7bdf8eff48 100644
--- a/car-lib/src/android/car/drivingstate/CarUXRestrictionsManager.java
+++ b/car-lib/src/android/car/drivingstate/CarUxRestrictionsManager.java
@@ -21,7 +21,7 @@ import android.annotation.Nullable;
import android.car.Car;
import android.car.CarManagerBase;
import android.car.CarNotConnectedException;
-import android.car.drivingstate.ICarUXRestrictions;
+import android.car.drivingstate.ICarUxRestrictionsManager;
import android.content.Context;
import android.os.Handler;
import android.os.IBinder;
@@ -35,76 +35,77 @@ import java.lang.ref.WeakReference;
* API to register and get the User Experience restrictions imposed based on the car's driving
* state.
*/
-public final class CarUXRestrictionsManager implements CarManagerBase {
- private static final String TAG = "CarUXRManager";
+public final class CarUxRestrictionsManager implements CarManagerBase {
+ private static final String TAG = "CarUxRManager";
private static final boolean DBG = false;
private static final boolean VDBG = false;
private static final int MSG_HANDLE_UX_RESTRICTIONS_CHANGE = 0;
private final Context mContext;
- private final ICarUXRestrictions mUXRService;
+ private final ICarUxRestrictionsManager mUxRService;
private final EventCallbackHandler mEventCallbackHandler;
- private CarUXRestrictionsEventListener mUXRListener;
- private CarUXRestrictionsChangeListenerToService mListenerToService;
+ private onUxRestrictionsChangedListener mUxRListener;
+ private CarUxRestrictionsChangeListenerToService mListenerToService;
/** @hide */
- public CarUXRestrictionsManager(IBinder service, Context context, Handler handler) {
+ public CarUxRestrictionsManager(IBinder service, Context context, Handler handler) {
mContext = context;
- mUXRService = ICarUXRestrictions.Stub.asInterface(service);
+ mUxRService = ICarUxRestrictionsManager.Stub.asInterface(service);
mEventCallbackHandler = new EventCallbackHandler(this, handler.getLooper());
}
/** @hide */
@Override
public synchronized void onCarDisconnected() {
- mListenerToService = null;
- mUXRListener = null;
+ mListenerToService = null;
+ mUxRListener = null;
}
/**
* Listener Interface for clients to implement to get updated on driving state related
* changes.
*/
- public interface CarUXRestrictionsEventListener {
+ public interface onUxRestrictionsChangedListener {
/**
* Called when the UX restrictions due to a car's driving state changes.
- * @param event The new UX restriction event
+ *
+ * @param restrictionInfo The new UX restriction information
*/
- void onUXRestrictionsChanged(CarUXRestrictionsEvent event);
+ void onUxRestrictionsChanged(CarUxRestrictions restrictionInfo);
}
/**
- * Register a {@link CarUXRestrictionsEventListener} for listening to changes in the
+ * Register a {@link onUxRestrictionsChangedListener} for listening to changes in the
* UX Restrictions to adhere to.
* <p>
* If a listener has already been registered, it has to be unregistered before registering
* the new one.
*
- * @param listener {@link CarUXRestrictionsEventListener}
+ * @param listener {@link onUxRestrictionsChangedListener}
*/
- public synchronized void registerListener(@NonNull CarUXRestrictionsEventListener listener)
+ public synchronized void registerListener(@NonNull onUxRestrictionsChangedListener listener)
throws CarNotConnectedException, IllegalArgumentException {
if (listener == null) {
if (VDBG) {
- Log.v(TAG, "registerCarUXRestrictionsEventListener(): null listener");
+ Log.v(TAG, "registerListener(): null listener");
}
throw new IllegalArgumentException("Listener is null");
}
- // Check if the listener has been already registered for this event type
- if (mUXRListener != null) {
+ // Check if the listener has been already registered.
+ if (mUxRListener != null) {
if (DBG) {
Log.d(TAG, "Listener already registered listener");
}
return;
}
- mUXRListener = listener;
+ mUxRListener = listener;
try {
if (mListenerToService == null) {
- mListenerToService = new CarUXRestrictionsChangeListenerToService(this);
+ mListenerToService = new CarUxRestrictionsChangeListenerToService(this);
}
// register to the Service to listen for changes.
- mUXRService.registerUXRestrictionsChangeListener(mListenerToService);
+ mUxRService.registerUxRestrictionsChangeListener(mListenerToService);
} catch (RemoteException e) {
Log.e(TAG, "Could not register a listener to Driving State Service " + e);
throw new CarNotConnectedException(e);
@@ -115,19 +116,19 @@ public final class CarUXRestrictionsManager implements CarManagerBase {
}
/**
- * Unregister the registered {@link CarUXRestrictionsEventListener}
+ * Unregister the registered {@link onUxRestrictionsChangedListener}
*/
public synchronized void unregisterListener()
throws CarNotConnectedException {
- if (mUXRListener == null) {
+ if (mUxRListener == null) {
if (DBG) {
Log.d(TAG, "Listener was not previously registered");
}
return;
}
try {
- mUXRService.unregisterUXRestrictionsChangeListener(mListenerToService);
- mUXRListener = null;
+ mUxRService.unregisterUxRestrictionsChangeListener(mListenerToService);
+ mUxRListener = null;
} catch (RemoteException e) {
Log.e(TAG, "Could not unregister listener from Driving State Service " + e);
throw new CarNotConnectedException(e);
@@ -135,15 +136,15 @@ public final class CarUXRestrictionsManager implements CarManagerBase {
}
/**
- * Get the current UX restrictions {@link CarUXRestrictionsEvent} in place.
+ * Get the current UX restrictions {@link CarUxRestrictions} in place.
*
* @return current UX restrictions that is in effect.
*/
@Nullable
- public CarUXRestrictionsEvent getCurrentCarUXRestrictions()
+ public CarUxRestrictions getCurrentCarUxRestrictions()
throws CarNotConnectedException {
try {
- return mUXRService.getCurrentUXRestrictions();
+ return mUxRService.getCurrentUxRestrictions();
} catch (RemoteException e) {
Log.e(TAG, "Could not get current driving state " + e);
throw new CarNotConnectedException(e);
@@ -154,75 +155,74 @@ public final class CarUXRestrictionsManager implements CarManagerBase {
* Class that implements the listener interface and gets called back from the
* {@link com.android.car.CarDrivingStateService} across the binder interface.
*/
- private static class CarUXRestrictionsChangeListenerToService extends
- ICarUXRestrictionsChangeListener.Stub {
- private final WeakReference<CarUXRestrictionsManager> mUXRestrictionsManager;
+ private static class CarUxRestrictionsChangeListenerToService extends
+ ICarUxRestrictionsChangeListener.Stub {
+ private final WeakReference<CarUxRestrictionsManager> mUxRestrictionsManager;
- public CarUXRestrictionsChangeListenerToService(CarUXRestrictionsManager manager) {
- mUXRestrictionsManager = new WeakReference<>(manager);
+ public CarUxRestrictionsChangeListenerToService(CarUxRestrictionsManager manager) {
+ mUxRestrictionsManager = new WeakReference<>(manager);
}
@Override
- public void onUXRestrictionsChanged(CarUXRestrictionsEvent event) {
- CarUXRestrictionsManager manager = mUXRestrictionsManager.get();
+ public void onUxRestrictionsChanged(CarUxRestrictions restrictionInfo) {
+ CarUxRestrictionsManager manager = mUxRestrictionsManager.get();
if (manager != null) {
- manager.handleUXRestrictionsChanged(event);
+ manager.handleUxRestrictionsChanged(restrictionInfo);
}
}
}
/**
- * Gets the {@link CarUXRestrictionsEvent} from the service listener
- * {@link CarUXRestrictionsChangeListenerToService} and dispatches it to a handler provided
+ * Gets the {@link CarUxRestrictions} from the service listener
+ * {@link CarUxRestrictionsChangeListenerToService} and dispatches it to a handler provided
* to the manager
*
- * @param event {@link CarUXRestrictionsEvent} that has been registered to listen on
+ * @param restrictionInfo {@link CarUxRestrictions} that has been registered to listen on
*/
- private void handleUXRestrictionsChanged(CarUXRestrictionsEvent event) {
+ private void handleUxRestrictionsChanged(CarUxRestrictions restrictionInfo) {
// send a message to the handler
- mEventCallbackHandler.sendMessage(
- mEventCallbackHandler.obtainMessage(MSG_HANDLE_UX_RESTRICTIONS_CHANGE, event));
-
+ mEventCallbackHandler.sendMessage(mEventCallbackHandler.obtainMessage(
+ MSG_HANDLE_UX_RESTRICTIONS_CHANGE, restrictionInfo));
}
/**
- * Callback Handler to handle dispatching the driving event changes to the corresponding
+ * Callback Handler to handle dispatching the UX restriction changes to the corresponding
* listeners
*/
private static final class EventCallbackHandler extends Handler {
- private final WeakReference<CarUXRestrictionsManager> mUXRestrictionsManager;
+ private final WeakReference<CarUxRestrictionsManager> mUxRestrictionsManager;
- public EventCallbackHandler(CarUXRestrictionsManager manager, Looper looper) {
+ public EventCallbackHandler(CarUxRestrictionsManager manager, Looper looper) {
super(looper);
- mUXRestrictionsManager = new WeakReference<>(manager);
+ mUxRestrictionsManager = new WeakReference<>(manager);
}
@Override
public void handleMessage(Message msg) {
- CarUXRestrictionsManager mgr = mUXRestrictionsManager.get();
+ CarUxRestrictionsManager mgr = mUxRestrictionsManager.get();
if (mgr != null) {
- mgr.dispatchUXRChangeToClient((CarUXRestrictionsEvent) msg.obj);
+ mgr.dispatchUxRChangeToClient((CarUxRestrictions) msg.obj);
}
}
}
/**
- * Checks for the listeners to list of {@link CarUXRestrictionsEvent} and calls them back
+ * Checks for the listeners to list of {@link CarUxRestrictions} and calls them back
* in the callback handler thread
*
- * @param event {@link CarUXRestrictionsEvent}
+ * @param restrictionInfo {@link CarUxRestrictions}
*/
- private void dispatchUXRChangeToClient(CarUXRestrictionsEvent event) {
- if (event == null) {
+ private void dispatchUxRChangeToClient(CarUxRestrictions restrictionInfo) {
+ if (restrictionInfo == null) {
return;
}
- CarUXRestrictionsEventListener listener;
+ onUxRestrictionsChangedListener listener;
synchronized (this) {
- listener = mUXRListener;
+ listener = mUxRListener;
}
if (listener != null) {
- listener.onUXRestrictionsChanged(event);
+ listener.onUxRestrictionsChanged(restrictionInfo);
}
}
diff --git a/car-lib/src/android/car/drivingstate/ICarUXRestrictionsChangeListener.aidl b/car-lib/src/android/car/drivingstate/ICarUxRestrictionsChangeListener.aidl
index be411330bc..cf3f89f611 100644
--- a/car-lib/src/android/car/drivingstate/ICarUXRestrictionsChangeListener.aidl
+++ b/car-lib/src/android/car/drivingstate/ICarUxRestrictionsChangeListener.aidl
@@ -16,11 +16,11 @@
package android.car.drivingstate;
-import android.car.drivingstate.CarUXRestrictionsEvent;
+import android.car.drivingstate.CarUxRestrictions;
/**
- * Binder callback for onUXRestrictionsChanged.
+ * Binder callback for onUxRestrictionsChanged.
*/
-oneway interface ICarUXRestrictionsChangeListener {
- void onUXRestrictionsChanged(in CarUXRestrictionsEvent event) = 0;
+oneway interface ICarUxRestrictionsChangeListener {
+ void onUxRestrictionsChanged(in CarUxRestrictions event) = 0;
}
diff --git a/car-lib/src/android/car/drivingstate/ICarUXRestrictions.aidl b/car-lib/src/android/car/drivingstate/ICarUxRestrictionsManager.aidl
index 0e3f1c3ff9..e5c69b89a0 100644
--- a/car-lib/src/android/car/drivingstate/ICarUXRestrictions.aidl
+++ b/car-lib/src/android/car/drivingstate/ICarUxRestrictionsManager.aidl
@@ -16,18 +16,18 @@
package android.car.drivingstate;
-import android.car.drivingstate.CarUXRestrictionsEvent;
-import android.car.drivingstate.ICarUXRestrictionsChangeListener;
+import android.car.drivingstate.CarUxRestrictions;
+import android.car.drivingstate.ICarUxRestrictionsChangeListener;
/**
- * Binder interface for {@link android.car.drivingstate.CarUXRestrictionsManager}.
- * Check {@link android.car.drivingstate.CarUXRestrictionsManager} APIs for expected behavior of
+ * Binder interface for {@link android.car.drivingstate.CarUxRestrictionsManager}.
+ * Check {@link android.car.drivingstate.CarUxRestrictionsManager} APIs for expected behavior of
* each call.
*
* @hide
*/
-interface ICarUXRestrictions {
- void registerUXRestrictionsChangeListener(in ICarUXRestrictionsChangeListener listener) = 0;
- void unregisterUXRestrictionsChangeListener(in ICarUXRestrictionsChangeListener listener) = 1;
- CarUXRestrictionsEvent getCurrentUXRestrictions() = 2;
+interface ICarUxRestrictionsManager {
+ void registerUxRestrictionsChangeListener(in ICarUxRestrictionsChangeListener listener) = 0;
+ void unregisterUxRestrictionsChangeListener(in ICarUxRestrictionsChangeListener listener) = 1;
+ CarUxRestrictions getCurrentUxRestrictions() = 2;
}