Add access permission for CarNavigationManager
Bug:27547330
Change-Id: I79966b078631b98902dadaeaecbfea2604ffe1a9
diff --git a/service/src/com/android/car/ICarImpl.java b/service/src/com/android/car/ICarImpl.java
index 89ee5da..68ceb79 100644
--- a/service/src/com/android/car/ICarImpl.java
+++ b/service/src/com/android/car/ICarImpl.java
@@ -184,6 +184,7 @@
assertRadioPermission(mContext);
return mCarRadioService;
case Car.CAR_NAVIGATION_SERVICE:
+ assertInstrumentClusterPermission(mContext);
return mCarNavigationService;
case Car.PROJECTION_SERVICE:
assertProjectionPermission(mContext);
@@ -249,6 +250,14 @@
}
}
+ public static void assertInstrumentClusterPermission(Context context) {
+ if (context.checkCallingOrSelfPermission(Car.PERMISSION_CAR_NAVIGATION_MANAGER)
+ != PackageManager.PERMISSION_GRANTED) {
+ throw new SecurityException(
+ "requires " + Car.PERMISSION_CAR_NAVIGATION_MANAGER);
+ }
+ }
+
public static void assertHvacPermission(Context context) {
if (context.checkCallingOrSelfPermission(Car.PERMISSION_CAR_HVAC)
!= PackageManager.PERMISSION_GRANTED) {