Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / SPEC.md

SPEC.md70.0 KiBRenderedCodeRaw
1# Android Auto / Android Automotive — App-to-Car Interface Spec
2
3> **Library:** `androidx.car.app:app-*` **`1.9.0-alpha02`** (9 Sept 2026)
4> **Car App API Level:** **9** (`androidx.car.app.versioning.CarAppApiLevels.LEVEL_9`)
5> **Release page:** `https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha02`
6> **Sources used:** `androidx/car/app/{app,app-automotive,app-projected,app-testing}/1.9.0-alpha02/*-sources.jar`
7> from `https://dl.google.com/dl/android/maven2/androidx/car/app/`
8> (325 `.java` files; this file is generated purely from those sources, not from any repo checkout)
9>
10> **Artifacts:**
11>
12> | Artifact | Gradle coordinate | Contains |
13> |---|---|---|
14> | `app` | `androidx.car.app:app:1.9.0-alpha02` | ALL core framework: service, session, screen, context, templates, models, managers |
15> | `app-projected` | `androidx.car.app:app-projected:1.9.0-alpha02` | Android Auto / CarPlay projection: `ProjectedCarHardwareManager`, `ProjectedCarAudioRecord` |
16> | `app-automotive` | `androidx.car.app:app-automotive:1.9.0-alpha02` | Android Automotive OS: `CarAppActivity` stack, `AutomotiveCarHardwareManager`, `AutomotiveCarAudioRecord` |
17> | `app-testing` | `androidx.car.app:app-testing:1.9.0-alpha02` | `TestCarContext`, `TestScreenManager`, `FakeHost`, etc. |
18>
19> Dependencies:
20>
21> ```groovy
22> implementation "androidx.car.app:app:1.9.0-alpha02" // always
23> implementation "androidx.car.app:app-projected:1.9.0-alpha02" // Android Auto specific
24> implementation "androidx.car.app:app-automotive:1.9.0-alpha02" // Automotive OS specific
25> testImplementation "androidx.car.app:app-testing:1.9.0-alpha02"
26> ```
27
28---
29
30## Table of contents
31
32- [0. How an app talks to the car (mental model)](#0-how-an-app-talks-to-the-car-mental-model)
33- [1. Manifest, service entry, host trust, versioning](#1-manifest-service-entry-host-trust-versioning)
34- [2. Core runtime: Session / Screen / CarContext / managers](#2-core-runtime-session--screen--carcontext--managers)
35- [3. Shared UI vocabulary (all app types)](#3-shared-ui-vocabulary-all-app-types)
36- [4. Template × app-type matrix](#4-template--app-type-matrix)
37- [5. Navigation apps](#5-navigation-apps-navigation)
38- [6. POI / Parking / Charging apps](#6-poi--parking--charging-apps-poi)
39- [7. Media apps](#7-media-apps-media-experimental-stable-hybrid)
40- [8. Messaging apps](#8-messaging-apps-messaging)
41- [9. Calling / Dialer apps](#9-calling--dialer-apps-calling)
42- [10. Weather apps](#10-weather-apps-weather)
43- [11. IoT apps](#11-iot-apps-iot)
44- [12. Settings / sign-in / search / suggestions / notifications](#12-settings--sign-in--search--suggestions--notifications)
45- [13. Vehicle hardware (all app types, API-gated)](#13-vehicle-hardware-all-app-types-api-gated)
46- [14. Automotive-only vs Projected-only](#14-automotive-only-vs-projected-only)
47- [15. Testing surface](#15-testing-surface)
48- [16. Permissions, constraints, quotas](#16-permissions-constraints-quotas)
49- [Appendix A: 1.9.0-alpha02 + alpha01 changelog](#appendix-a-190-alpha02--alpha01-changelog)
50- [Appendix B: Full class index](#appendix-b-full-class-index)
51
52---
53
54## 0. How an app talks to the car (mental model)
55
56```
57Phone / head-unit app process Car host process (Auto / AAOS / CP)
58───────────────────────────── ────────────────────────────────────
59CarAppService (manifest-declared)
60 └─ Session (per display: MAIN + CLUSTER)
61 └─ Screen stack (ScreenManager push/pop)
62 └─ Screen.onGetTemplate() ──Binder IPC──▶ host renders template
63CarContext.getCarService(XxxManager) ◀──Binder IPC── host events (nav stop,
64 AppManager / NavigationManager / pan, alert cancel, search text,
65 ConstraintManager / CarHardwareManager / voice reply, keypad, etc.)
66 SuggestionManager / MediaPlaybackManager
67SurfaceCallback ──Surface──▶ app draws map itself (nav/POI only)
68Notifications (CarAppExtender) ──▶ host HUN / rail / TBT
69MediaSession token ──▶ host media UI (out-of-band via MediaCompat/Media3)
70CarHardwareManager ──▶ vehicle properties (AAOS: VehiclePropertyIds; projected: host dispatch)
71```
72
73Rules that apply to **every** app type:
74
751. You never draw car UI directly (except a map `Surface`). You return **templates**
76 (`androidx.car.app.model.*`, `navigation.model.*`, `media.model.*`, `dialer.*`,
77 `model.signin.*`) from `Screen.onGetTemplate()` and the host renders them.
782. You never call the host directly. You call **managers** obtained from
79 `CarContext.getCarService(...)` and receive host callbacks through delegates.
803. Everything is **API-level gated**. `CarContext.getCarAppApiLevel()` returns the
81 negotiated level (1–9). Guard every `@RequiresCarApi(n)` call.
824. Every template/model validates client-side (`validateOrThrow`) — illegal combos throw
83 before IPC. Host limits (list counts) come from `ConstraintManager.getContentLimit()`.
845. The task stack quota: max **5 templates per task**, last must be
85 `NavigationTemplate | PaneTemplate | MessageTemplate`. Refreshes
86 (same type + same main content) don't count; pops restore quota;
87 `NavigationTemplate` resets quota.
88
89---
90
91## 1. Manifest, service entry, host trust, versioning
92
93### 1.1 `androidx.car.app.CarAppService` (abstract, `app`)
94
95The single entry point. The host binds to it.
96
97```xml
98<service android:name=".YourAppService" android:exported="true">
99 <intent-filter>
100 <action android:name="androidx.car.app.CarAppService" />
101 <!-- exactly one (or more) of the categories below -->
102 <category android:name="androidx.car.app.category.NAVIGATION" />
103 </intent-filter>
104</service>
105<!-- required: declares oldest API your app understands -->
106<meta-data android:name="androidx.car.app.minCarApiLevel" android:value="1" />
107<!-- optional: theme for permission UI + brand opt-in (API 9) -->
108<meta-data android:name="androidx.car.app.theme" android:resource="@style/CarAppTheme" />
109```
110
111Constants on `CarAppService`:
112
113| Constant | Value | Since |
114|---|---|---|
115| `SERVICE_INTERFACE` | `androidx.car.app.CarAppService` | 1 |
116| `CATEGORY_NAVIGATION_APP` | `androidx.car.app.category.NAVIGATION` | 1 |
117| `CATEGORY_POI_APP` | `androidx.car.app.category.POI` | 1 (replaces parking/charging) |
118| `CATEGORY_PARKING_APP` | `androidx.car.app.category.PARKING` | **@Deprecated** → use `POI` |
119| `CATEGORY_CHARGING_APP` | `androidx.car.app.category.CHARGING` | **@Deprecated** → use `POI` |
120| `CATEGORY_IOT_APP` | `androidx.car.app.category.IOT` | API 6 |
121| `CATEGORY_SETTINGS_APP` | `androidx.car.app.category.SETTINGS` | API 6 |
122| `CATEGORY_FEATURE_CLUSTER` | `androidx.car.app.category.FEATURE_CLUSTER` | API 6 |
123| `CATEGORY_MESSAGING_APP` | `androidx.car.app.category.MESSAGING` | `@ExperimentalCarApi` |
124| `CATEGORY_CALLING_APP` | `androidx.car.app.category.CALLING` | `@ExperimentalCarApi` |
125| `CATEGORY_WEATHER_APP` | `androidx.car.app.category.WEATHER` | API 7 |
126| `CATEGORY_MEDIA_APP` | `androidx.car.app.category.MEDIA` | API 8 |
127
128Methods to override / final:
129
130```java
131public abstract HostValidator createHostValidator();
132public Session onCreateSession(); // legacy
133public Session onCreateSession(SessionInfo sessionInfo); // API 6, per-display
134@RequiresCarApi(9) @ExperimentalCarApi
135public @ThemeSource int getCarAppThemeSource(); // default THEME_SOURCE_SYSTEM
136// @IntDef: THEME_SOURCE_SYSTEM = 0, THEME_SOURCE_APP = 1
137public final IBinder onBind(Intent intent); // do NOT override
138public final boolean onUnbind(Intent intent); // returns true (asks onRebind)
139public void onDestroy(); // @CallSuper
140public final HostInfo getHostInfo();
141public final Session getSession(SessionInfo sessionInfo);
142@Deprecated public final Session getCurrentSession();
143```
144
145 host `dump(AUTO_DRIVE)` → `CarAppBinder.onAutoDriveEnabled()` (AutoDrive test harness).
146
147### 1.2 `androidx.car.app.validation.HostValidator` (`app`)
148
149```java
150TEMPLATE_RENDERER_PERMISSION = "android.car.permission.TEMPLATE_RENDERER";
151ALLOW_ALL_HOSTS_VALIDATOR; // debug only!
152boolean isValidHost(HostInfo host);
153Map<String,List<String>> getAllowedHosts();
154new HostValidator.Builder(context)
155 .addAllowedHost("com.google.android.projection.gearhead", "<sha256>")
156 .addAllowedHosts(R.array.hosts_allowlist_sample) // "digest,package" lines
157 .build();
158```
159
160Semantics: same-UID → allow; allowlisted (package + SHA-256 DER lowercase hex) → allow;
161`SYSTEM_UID` → allow; holds `TEMPLATE_RENDERER` (automotive API 31+) → allow.
162
163### 1.3 `androidx.car.app.AppInfo`, `SessionInfo`, `HostInfo`, `HandshakeInfo`
164
165```java
166// AppInfo (@CarProtocol @KeepFields)
167MIN_API_LEVEL_METADATA_KEY = "androidx.car.app.minCarApiLevel";
168static AppInfo create(Context ctx); // throws if minCarApiLevel missing
169int getMinCarAppApiLevel(); int getLatestCarAppApiLevel(); String getLibraryDisplayVersion();
170
171// SessionInfo (@RequiresCarApi(6))
172DISPLAY_TYPE_MAIN = 0; DISPLAY_TYPE_CLUSTER = 1; // cluster: NavigationTemplate only
173SessionInfo(@DisplayType int displayType, String sessionId);
174String getSessionId(); int getDisplayType();
175List<Class<? extends Template>> getSupportedTemplates(@CarAppApiLevel int apiLevel);
176DEFAULT_SESSION_INFO;
177
178// HostInfo — HostInfo(String pkg, int uid); getPackageName(); getUid()
179// HandshakeInfo — getHostCarAppApiLevel()
180// SessionInfoIntentEncoder — containsSessionInfo(Intent); decode(Intent)
181```
182
183### 1.4 `androidx.car.app.versioning.CarAppApiLevels` / `CarAppApiLevel`
184
185`CarAppApiLevel` is an `@IntDef{UNKNOWN, LEVEL_1..LEVEL_9}`.
186`CarAppApiLevels`: `LEVEL_1=1 … LEVEL_9=9`, `UNKNOWN=0`,
187`static int getLatest()`, `getOldest()=1`, `isValid(int)`.
188
189| Level | What it unlocked |
190|---|---|
191| 1 | core services + parking/charging/nav templates |
192| 2 | `SignInTemplate`, `LongMessageTemplate`, multi-variant `CarText`, `ConstraintManager`, `setCarAppResult`, map `ActionStrip`, pan/zoom |
193| 3 | `CarHardwareManager` (`HARDWARE_SERVICE`) |
194| 4 | AAOS, QR sign-in, `PlaceListMapTemplate.setCurrentLocationEnabled`, contrast check |
195| 5 | voice/mic, `Alert`/`showAlert`, map-pane detail, responsive turn cards, map tap, nav-list non-places, POI zoom/pan, `OnContentRefreshListener` |
196| 6 | cluster `SessionInfo`, `TabTemplate`, list FAB `addAction`, `Row.addAction/numericDecoration`, app-driven refresh flag |
197| 7 | `Header`, `MapWithContentTemplate` (replaces `MapTemplate`/`PlaceListNavigationTemplate`/`RoutePreviewNavigationTemplate`), `GridTemplate.addAction/itemSize`, `COMPOSE_MESSAGE` |
198| 8 | `SectionedItemTemplate` (+ Row/Grid/Chip/Condensed/Spotlight/Banner sections), `MediaPlaybackTemplate`, `MediaPlaybackManager.registerMediaPlaybackToken`, `TYPE_MEDIA_PLAYBACK`, `GridItem.Badge`, `Row.endImage`, indexable rows |
199| **9** (this release, mostly `@ExperimentalCarApi`) | `THEME_SOURCE_SYSTEM/APP` + `getCarAppThemeSource()`; `Header.subtitle/background/startHeaderImage`; `SearchHeader` on `SectionedItemTemplate`; `TabStyle` + `TabTemplate.setStyle/setEndAction`; `Banner/BannerStyle/BannerElement/BannerSection`; `Background/Shape`; `CarIconStyle.setShape`; `MediaPlaybackStyle` + `MediaPlaybackTemplate.setBanner/setStyle`; `PaneTemplate.setBanner`; `CarProgressBar` on `Row/GridItem`; `NavigationManager.canSetVoiceAssistantCapabilities/setVoiceAssistantCapabilities` |
200
201Annotations: `annotations.RequiresCarApi`, `annotations.ExperimentalCarApi`,
202`annotations.CarProtocol`, `annotations.KeepFields`.
203
204### 1.5 `androidx.car.app.features.CarFeatures` + `connection.CarConnection`
205
206```java
207// CarFeatures — PackageManager.hasSystemFeature wrapper
208FEATURE_BACKGROUND_AUDIO_WHILE_DRIVING = "com.android.car.background_audio_while_driving";
209FEATURE_CAR_APP_LIBRARY_MEDIA = "android.software.car.templates_host.media";
210static boolean isFeatureEnabled(Context ctx, String feature);
211// NOTE: no FEATURE_PARKING/CHARGING/IOT/WEATHER exists — gating is via categories.
212
213// CarConnection — Auto vs AAOS detection
214CAR_CONNECTION_STATE = "CarConnectionState";
215ACTION_CAR_CONNECTION_UPDATED = "androidx.car.app.connection.action.CAR_CONNECTION_UPDATED";
216CONNECTION_TYPE_NOT_CONNECTED = 0; CONNECTION_TYPE_NATIVE = 1; // AAOS
217CONNECTION_TYPE_PROJECTION = 2; // AA / CP
218new CarConnection(ctx).getType() : LiveData<Integer>
219```
220
221---
222
223## 2. Core runtime: Session / Screen / CarContext / managers
224
225### 2.1 `androidx.car.app.Session implements LifecycleOwner` (`app`)
226
227```java
228public Session();
229public abstract Screen onCreateScreen(Intent intent); // first screen; may pre-push
230public void onNewIntent(Intent intent); // default no-op
231public void onCarConfigurationChanged(Configuration cfg);
232public Lifecycle getLifecycle(); // ON_CREATE→onCreateScreen; START=visible; RESUME=interactive
233public final CarContext getCarContext(); // valid iff State >= CREATED
234```
235
236### 2.2 `androidx.car.app.Screen implements LifecycleOwner` (`app`)
237
238```java
239protected Screen(CarContext carContext);
240public abstract Template onGetTemplate();
241public final void invalidate(); // → AppManager.invalidate(); no-op if State < STARTED
242public final void finish(); // → ScreenManager.remove(this); no-op if root
243public void setResult(Object result);
244public String getMarker(); public void setMarker(String marker); // popTo(marker)
245public final CarContext getCarContext();
246public final ScreenManager getScreenManager();
247public final Lifecycle getLifecycle();
248```
249
250`onGetTemplate()` quota (enforced host-side, documented on `Screen`):
251max 5 templates/task; last must be `NavigationTemplate|PaneTemplate|MessageTemplate`;
252refresh = same type + same main content (not counted); pop restores quota;
253`NavigationTemplate` resets quota; notification/launcher intent resets quota;
254host throttles rapid `invalidate()`.
255
256### 2.3 `androidx.car.app.ScreenManager implements Manager` (`app`)
257
258`CarContext.SCREEN_SERVICE = "screen"`.
259
260```java
261Screen getTop(); int getStackSize(); Collection<Screen> getScreenStack();
262void push(Screen screen); // move-to-top if present; single-use (DESTROYED throws)
263void pushForResult(Screen screen, OnScreenResultListener listener);
264void pop(); // no-op if size<=1; new top reuses last template id
265void popTo(String marker);
266void popToRoot();
267void remove(Screen screen); // direct remove → immediate ON_DESTROY
268```
269
270### 2.4 `androidx.car.app.CarContext extends ContextWrapper` (`app`)
271
272```java
273// service names
274APP_SERVICE = "app"; // AppManager
275NAVIGATION_SERVICE = "navigation"; // NavigationManager
276SCREEN_SERVICE = "screen"; // ScreenManager
277CONSTRAINT_SERVICE = "constraints"; // ConstraintManager (API 2)
278CAR_SERVICE = "car"; // internal
279HARDWARE_SERVICE = "hardware"; // CarHardwareManager (API 3)
280SUGGESTION_SERVICE = "suggestion"; // SuggestionManager (API 5)
281MEDIA_PLAYBACK_SERVICE = "media_playback"; // MediaPlaybackManager (API 8)
282
283Object getCarService(String name);
284<T> T getCarService(Class<T> clz);
285String getCarServiceName(Class<?> clz);
286
287void startCarApp(Intent intent); // ACTION_NAVIGATE geo:…, ACTION_DIAL/ACTION_CALL tel:…, own CarAppService
288void finishCarApp();
289static void startCarApp(Intent notifIntent, Intent appIntent); // @Deprecated → CarPendingIntent
290@RequiresCarApi(2) void setCarAppResult(int resultCode, Intent data); // AAOS only (Auto: no-op)
291@RequiresCarApi(2) ComponentName getCallingComponent(); // AAOS only (Auto: null)
292boolean isDarkMode(); // nav apps MUST redraw map; change via Session.onCarConfigurationChanged
293OnBackPressedDispatcher getOnBackPressedDispatcher(); // default: pop
294int getCarAppApiLevel(); // throws if handshake incomplete
295HostInfo getHostInfo();
296void requestPermissions(List<String> perms, OnRequestPermissionsListener l);
297void requestPermissions(List<String> perms, Executor ex, OnRequestPermissionsListener l);
298// branding: androidx.car.app.theme → carPermissionActivityLayout
299EXTRA_START_CAR_APP_BINDER_KEY;
300ACTION_NAVIGATE = "androidx.car.app.action.NAVIGATE"; // geo:lat,lng · geo:0,0?q=addr
301```
302
303### 2.5 `androidx.car.app.AppManager` (`APP_SERVICE`, `app`)
304
305```java
306void setSurfaceCallback(SurfaceCallback cb); // needs ACCESS_SURFACE; main thread; null to clear
307void invalidate(); // re-query onGetTemplate()
308void showToast(CharSequence text, @CarToast.Duration int duration);
309@RequiresCarApi(5) void showAlert(Alert alert); // nav templates only
310@RequiresCarApi(5) void dismissAlert(int alertId);
311// @RestrictTo(LIBRARY) openMicrophone(OpenMicrophoneRequest) — voice entry
312```
313
314`androidx.car.app.SurfaceCallback`:
315
316```java
317void onSurfaceAvailable(SurfaceContainer sc); // MUST Surface#release() when done
318void onVisibleAreaChanged(Rect r); void onStableAreaChanged(Rect r);
319void onSurfaceDestroyed(SurfaceContainer sc);
320@RequiresCarApi(2) void onScroll(float dx, float dy);
321@RequiresCarApi(2) void onFling(float vx, float vy);
322@RequiresCarApi(2) void onScale(float fx, float fy, float scale);
323@RequiresCarApi(5) void onClick(float x, float y); // touch not universal — always offer zoom strip
324```
325
326`androidx.car.app.SurfaceContainer`: `getSurface()`, `getWidth/Height/Dpi()`.
327
328`androidx.car.app.CarToast`: `LENGTH_SHORT/LONG`,
329`makeText(CarContext, CharSequence|@StringRes, int).setText().setDuration().show()`.
330
331---
332
333## 3. Shared UI vocabulary (all app types)
334
335### 3.1 `androidx.car.app.model.Action` (`@CarProtocol`, `app`)
336
337Types: `TYPE_CUSTOM=1`, `TYPE_APP_ICON`, `TYPE_BACK`, `TYPE_PAN`,
338`TYPE_COMPOSE_MESSAGE` (API 7), `TYPE_MEDIA_PLAYBACK` (API 8; **API 9: row-only, FAB ignored**),
339`TYPE_IN_CALL_HEADER` (dialer). Flags: `FLAG_PRIMARY` (API 4),
340`FLAG_IS_PERSISTENT` / `FLAG_DEFAULT` (API 5).
341Singletons: `APP_ICON / BACK / PAN / COMPOSE_MESSAGE / MEDIA_PLAYBACK`.
342
343```java
344CarText getTitle(); CarIcon getIcon(); CarColor getBackgroundColor();
345int getType(); int getFlags(); boolean isStandard();
346@RequiresCarApi(5) boolean isEnabled();
347OnClickDelegate getOnClickDelegate();
348new Action.Builder()
349 .setTitle(CharSequence|CarText).setIcon(CarIcon)
350 .setOnClickListener(OnClickListener) // or ParkedOnlyOnClickListener
351 .setBackgroundColor(CarColor).setEnabled(boolean).setFlags(int).build();
352```
353
354`ActionStrip`: `getActions()`, `getFirstActionOfType(int)`;
355`Builder.addAction(Action)` rejects duplicate non-custom types.
356
357### 3.2 `androidx.car.app.model.Header` (API 5) + `SearchHeader` (API 9)
358
359```java
360// Header (@RequiresCarApi(5))
361CarText getTitle(); Action getStartHeaderAction(); // APP_ICON|BACK only
362List<Action> getEndHeaderActions();
363@RequiresCarApi(9) CarText getSubtitle(); Background getBackground(); CarIcon getStartHeaderImage();
364new Header.Builder()
365 .setTitle(CharSequence|CarText).setStartHeaderAction(Action)
366 .addEndHeaderAction(Action) // icon-only inside map content
367 .setSubtitle(...) // API 9 experimental
368 .setBackground(Background) // API 9 experimental
369 .setStartHeaderImage(CarIcon custom) // API 9 experimental
370 .build(); // requires title OR start action
371
372// SearchHeader (@RequiresCarApi(9) @ExperimentalCarApi) — SectionedItemTemplate only
373new SearchHeader.Builder(SearchCallback cb)
374 .setInitialSearchText(String).setSearchHint(String)
375 .setShowKeyboardByDefault(boolean) // default true
376 .setStartHeaderAction(Action).setEndHeaderActions(List<Action>).build();
377```
378
379`SearchCallback` (shared): `default onSearchTextChanged(String)` (coalesced),
380`default onSearchSubmitted(String)`.
381
382### 3.3 Rows / lists / grids / text / icons
383
384```java
385// Row implements Item
386IMAGE_TYPE_SMALL / IMAGE_TYPE_LARGE; IMAGE_TYPE_EXTRA_SMALL / IMAGE_TYPE_MEDIUM (API 8);
387@Deprecated IMAGE_TYPE_ICON → use SMALL/MEDIUM (untinted by default);
388NO_DECORATION = -1;
389getTitle()/getTexts()/getImage()/getRowImageType();
390getEndImage()/getRowEndImageType(); // API 8
391getActions(); // API 6, max 2 getNumericDecoration(); // API 6
392getToggle(); getOnClickDelegate(); getMetadata(); isBrowsable(); isEnabled(); // API 5
393isIndexable(); // API 8
394getProgressBar(); // API 9 CarProgressBar
395new Row.Builder()
396 .setTitle(...).addText(...).setImage(CarIcon[,type]).setEndImage(...)
397 .setBrowsable(...).setToggle(Toggle).setOnClickListener(...)
398 .setMetadata(Metadata|Place).setEnabled(...).setIndexable(...)
399 .setProgressBar(CarProgressBar).addAction(Action).setNumericDecoration(int).build();
400
401// GridItem implements Item
402getTitle()/getText()/getImage()/getBadge(); // Badge API 8
403isIndexable(); // API 8 getProgressBar(); // API 9 (mutually exclusive with text)
404isLoading(); getOnClickDelegate();
405new GridItem.Builder().setTitle(...).setText(...).setImage(CarIcon[,Badge])
406 .setOnClickListener(...).setIndexable(...).setProgressBar(...).setLoading(...).build();
407
408// Pane — getRows()/getActions()/getImage() (API 4)/isLoading()
409// ItemList — getItems()/getSelectedIndex()/getOnSelectedDelegate()/
410// getOnItemVisibilityChangedDelegate()/getNoItemsMessage()
411// OnSelectedListener.onSelected(int); OnItemVisibilityChangedListener.onItemVisibilityChanged(int,int)
412// Item (marker); SectionedItemList.create(ItemList, CharSequence header);
413// Section<?> + RowSection/GridSection/ChipSection/CondensedSection/SpotlightSection/BannerSection
414// CondensedItem (dense 1-line), Chip (+ChipStyle), Toggle, Metadata,
415// Place/PlaceMarker/CarLocation, Alert/AlertCallback,
416// CarText/CarSpan/DistanceSpan/DurationSpan/ForegroundCarColorSpan/CarIconSpan/ClickableSpan/TimerSpan,
417// Distance.create(double,@Unit int) [UNIT_METERS/KILOMETERS/KILOMETERS_P1/MILES/MILES_P1/FEET/YARDS],
418// DateTimeWithZone.create(long,int,String|TimeZone|ZonedDateTime),
419// CarColor (STANDARD_ONLY vs UNCONSTRAINED), CarIcon (see below)
420
421// CarIcon
422Types: CUSTOM/BACK/ALERT/APP_ICON/ERROR/PAN(API2)/COMPOSE_MESSAGE(API7)/MEDIA_PLAYBACK(API8);
423Singletons: APP_ICON/BACK/ALERT/ERROR/PAN/COMPOSE_MESSAGE/MEDIA_PLAYBACK;
424createTintedIcon(IconCompat) / createOriginalIcon(IconCompat);
425new CarIcon.Builder(IconCompat[,CarIconStyle]|CarIcon).setTint[deprecated].setStyle(CarIconStyle).build();
426
427// CarIconStyle — TINTED (default tint) / ORIGINAL (no tint: avatars/art)
428// getTint(); getShape(); // API 9 new Builder(base).setTint(CarColor).setShape(Shape).build()
429// Background (API 9 exp) — TRANSPARENT; getColor()/getImage() (exactly one);
430// Builder.setColor(CarColor)/setImage(CarIcon TYPE_CUSTOM).build() (COLOR_ONLY)
431// Shape (API 9 exp) — NONE/CORNER_EXTRA_SMALL/SMALL/MEDIUM/LARGE/EXTRA_LARGE/FULL
432// CarProgressBar (API 9 exp) — for Row/GridItem; + CarProgressBarStyle/StrokeCap
433```
434
435### 3.4 `androidx.car.app.model.Tab / TabContents / TabStyle` (API 6 / style API 9)
436
437```java
438// TabContents implements Content — CONTENT_ID="TAB_CONTENTS_CONTENT_ID"
439new TabContents.Builder(Template t).build();
440// API 6: List|Pane|Grid|Message|Search; API 7: +Navigation; API 8: +SectionedItem
441// Tab implements Content — getTitle()/getIcon()/getContentId()/getStyle() (API 9)
442// Builder.setTitle/setIcon/setContentId/setStyle(TabStyle)
443// TabStyle (API 9 exp) — getShape()/getSelectedBackgroundColor()/getTextColor()
444// Builder.setShape(Shape).setSelectedBackgroundColor(CarColor).setTextColor(CarColor).build() (≥1)
445```
446
447---
448
449## 4. Template × app-type matrix
450
451Base: `androidx.car.app.model.Template` (marker interface).
452
453| Template | Min API | Used by app types |
454|---|---|---|
455| `model.PaneTemplate` (+`Pane`) | 1 (banner API 9) | NAV, POI, WEATHER, IOT, SETTINGS |
456| `model.ListTemplate` (single `ItemList` or `SectionedItemList`s, ≤100 items) | 1 (FAB API 6, Header API 7) | NAV, POI, WEATHER, IOT, MEDIA (browse lists), MESSAGING (conversations) |
457| `model.SectionedItemTemplate` (+ Row/Grid/Chip/Condensed/Spotlight/Banner sections) | 8 (`SearchHeader`/styles API 9) | POI, WEATHER, IOT, MEDIA, MESSAGING |
458| `model.GridTemplate` (`GridItem`-only) | 1 (actions API 7, size/shape API 8) | POI, WEATHER, IOT, MEDIA |
459| `model.MessageTemplate` | 1 | ALL (task end / empty / error) |
460| `model.LongMessageTemplate` (parked-only) | 2 | SETTINGS, POI (terms, details) |
461| `model.SearchTemplate` | 1 | NAV, POI, MEDIA, MESSAGING |
462| `model.PlaceListMapTemplate` (host map + list) | 1 (refresh API 5) | NAV, POI |
463| `navigation.model.NavigationTemplate` (active nav) | 1 | NAV only |
464| `navigation.model.MapWithContentTemplate` (app map + overlay) | 7 (SectionedItem content API 8) | NAV (+ POI map via `MAP_TEMPLATES`) |
465| `navigation.model.MapTemplate` | 5, **@Deprecated** → `MapWithContentTemplate` | NAV |
466| `navigation.model.PlaceListNavigationTemplate` | 1, **@Deprecated** | NAV |
467| `navigation.model.RoutePreviewNavigationTemplate` | 1, **@Deprecated** | NAV |
468| `model.TabTemplate` (2–4 tabs) | 6 (style/endAction API 9) | POI, WEATHER, IOT, MEDIA, NAV |
469| `media.model.MediaPlaybackTemplate` | 8 (banner/style API 9) | MEDIA |
470| `model.signin.SignInTemplate` (parked-only) | 2 (QR API 4) | ALL (login) |
471| `dialer.InCallTemplate` | `@ExperimentalCarApi` | CALLING |
472| `dialer.TelephoneKeypadTemplate` | `@ExperimentalCarApi` | CALLING |
473
474`model.TemplateInfo(Class<? extends Template>, String)` / `TemplateWrapper` are host-only.
475
476---
477
478## 5. Navigation apps (`NAVIGATION`)
479
480Manifest: `androidx.car.app.category.NAVIGATION`.
481Permissions: `androidx.car.app.NAVIGATION_TEMPLATES` (nav templates),
482`androidx.car.app.MAP_TEMPLATES` (`PlaceListMapTemplate` / map side of `MapWithContentTemplate`;
483self-drawn nav maps exempt), `androidx.car.app.ACCESS_SURFACE` (custom map surface).
484
485### 5.1 `androidx.car.app.navigation.NavigationManager` (`NAVIGATION_SERVICE`)
486
487```java
488NavigationManager mgr = carContext.getCarService(NavigationManager.class);
489mgr.setNavigationManagerCallback(cb); // or (Executor, cb)
490mgr.clearNavigationManagerCallback(); // throws if navigating
491mgr.navigationStarted(); // idempotent; needs callback; claims single-active-nav
492mgr.updateTrip(Trip trip); // only after started; dropped after ended/onStopNavigation
493mgr.navigationEnded(); // idempotent
494@RequiresCarApi(9) @ExperimentalCarApi
495boolean canSetVoiceAssistantCapabilities(); // api>=9 && FEATURE_AUTOMOTIVE
496void setVoiceAssistantCapabilities(NavigationVoiceAssistantCapabilities caps); // AAOS only
497
498interface NavigationManagerCallback {
499 default void onStopNavigation(); // stop routing + voice + notifications + updateTrip
500 default void onAutoDriveEnabled(); // AutoDrive test: simulate until finishCarApp()
501}
502```
503
504There is **no** `startNavigation/stopNavigation`, **no** `SurfaceRenderer`, **no** `CameraMode`,
505**no** `TripPreview`, **no** `AlertManager` in 1.9.0-alpha02 — use the names above.
506
507### 5.2 Trip graph (`navigation.model.*`)
508
509```java
510// Trip — getDestinations()/getSteps()/getDestinationTravelEstimates()/
511// getStepTravelEstimates()/getCurrentRoad()/isLoading()
512new Trip.Builder()
513 .addDestination(Destination, TravelEstimate).addStep(Step, TravelEstimate) // in order
514 .setCurrentRoad(CharSequence) // spans ignored
515 .setLoading(boolean) // true + steps → IllegalArgumentException
516 .build(); // size-match checks; floating bar = Step[0].cue + Estimate[0].distance + Maneuver.icon
517
518// Step — getManeuver()/getLanes()/getLanesImage()/getCue()/getRoad()
519new Step.Builder() | Builder(CharSequence|CarText cue)
520 .setManeuver(Maneuver).addLane(Lane) // left→right; cluster/HUD primary
521 .setLanesImage(CarIcon) // 500×74dp bbox; needs lanes data
522 .setCue(CharSequence) // CarIconSpan|DistanceSpan|DurationSpan
523 .setRoad(CharSequence) // TEXT_ONLY
524 .build();
525
526// TravelEstimate — REMAINING_TIME_UNKNOWN = -1
527getRemainingDistance()/getRemainingTimeSeconds()/getArrivalTimeAtDestination()/
528// getRemainingTimeColor()/getRemainingDistanceColor() (STANDARD_ONLY)/
529// getTripText()/getTripIcon() (API 5)
530new TravelEstimate.Builder(Distance, DateTimeWithZone|ZonedDateTime)
531 .setRemainingTimeSeconds(long).setRemainingTime(Duration) // API 26
532 .setRemainingTimeColor(CarColor).setRemainingDistanceColor(CarColor)
533 .setTripText(CarText).setTripIcon(CarIcon).build();
534
535// Destination — getName()/getAddress()/getImage() (128×128dp)
536new Destination.Builder().setName(...).setAddress(...).setImage(CarIcon).build();
537// (name or address non-empty required)
538
539// RoutingInfo implements NavigationTemplate.NavigationInfo
540getCurrentStep()/getCurrentDistance()/getNextStep()/getJunctionImage()/isLoading();
541new RoutingInfo.Builder()
542 .setCurrentStep(Step, Distance) // cue images 216×72dp
543 .setNextStep(Step).setJunctionImage(CarIcon) // 500×312dp, aspect ≥ 1.6
544 .setLoading(boolean).build();
545
546// MessageInfo implements NavigationTemplate.NavigationInfo — off-route / guidance text
547new MessageInfo.Builder(CharSequence|CarText title).setTitle(...).setText(...).setImage(...).build();
548```
549
550### 5.3 Voice assistant (API 9, AAOS only)
551
552```java
553// navigation.model.NavigationVoiceAssistantCapabilities (@ExperimentalCarApi @RequiresCarApi(9))
554boolean isVoiceAssistantConsentGranted();
555Set<Integer> getSupportedActions(); Set<Integer> getSupportedDisruptions();
556new Builder()
557 .setVoiceAssistantConsentGranted(boolean) // default false
558 .addSupportedAction(@VoiceAssistantAction int)
559 .addSupportedDisruption(@VoiceAssistantDisruption int).build();
560// Actions: ACTION_UNDEFINED=0, ALLOW_AND_AVOID_FERRIES=1, ALLOW_AND_AVOID_HIGHWAYS=2,
561// ALLOW_AND_AVOID_TOLLS=3, CLEAR_SEARCH_RESULTS=4, EXIT_NAVIGATION=5, FOLLOW_MODE=6,
562// MUTE_AND_UNMUTE=7, ROUTE_OVERVIEW=8, SHOW_ALTERNATES=9, SHOW_DIRECTIONS_LIST=10,
563// SHOW_SATELLITE=11, SHOW_TRAFFIC=12
564// Disruptions: DISRUPTION_REPORT_UNDEFINED=0, CONSTRUCTION=1, CRASH=2, FLOODING=3, FOG=4,
565// OBJECT_ON_ROAD=5, POLICE=6, POTHOLE=7, ROAD_CLOSURE=8, SNOW=9, TRAFFIC=10, VEHICLE=11
566```
567
568### 5.4 Map rendering
569
570```java
571// navigation.model.NavigationTemplate implements Template — active guidance
572// requires NAVIGATION_TEMPLATES; any-content refresh (quota-exempt + quota-reset);
573// NO own surface — draw via AppManager.setSurfaceCallback
574interface NavigationInfo {} // impls: RoutingInfo, MessageInfo
575getNavigationInfo()/getDestinationTravelEstimate()/getBackgroundColor()/
576getActionStrip() // required, NAVIGATION max 4
577getMapActionStrip()/getPanModeDelegate(); // API 2
578new NavigationTemplate.Builder()
579 .setNavigationInfo(NavigationInfo).setDestinationTravelEstimate(TravelEstimate)
580 .setBackgroundColor(CarColor) // UNCONSTRAINED
581 .setActionStrip(ActionStrip).setMapActionStrip(ActionStrip) // MAP max 4 icon-only
582 .setPanModeListener(PanModeListener).build();
583
584// navigation.model.MapController (@RequiresCarApi(5))
585getMapActionStrip()/getPanModeDelegate();
586new MapController.Builder().setMapActionStrip(ActionStrip).setPanModeListener(...).build();
587// without Action.PAN: no SurfaceCallback pan gestures, host exits pan
588
589// navigation.model.MapWithContentTemplate (@RequiresCarApi(7)) — REPLACES all below
590// requires NAVIGATION_TEMPLATES *or* MAP_TEMPLATES
591getContentTemplate()/getMapController()/getActionStrip();
592new Builder().setContentTemplate(Template)
593 // API 7: List|Pane|Grid|Message; API 8+: +SectionedItemTemplate
594 .setMapController(MapController).setActionStrip(ActionStrip).build();
595
596// @Deprecated (use MapWithContentTemplate):
597// navigation.model.MapTemplate (API 5) — getMapController/getPane/getItemList/getHeader/getActionStrip
598// navigation.model.PlaceListNavigationTemplate — rows: small images only, no image+marker,
599// non-browsable require DistanceSpan
600// navigation.model.RoutePreviewNavigationTemplate — needs OnSelectedListener,
601// every row DistanceSpan|DurationSpan; do NOT continuously refresh while moving
602// Generic (non-NAV permission): model.PlaceListMapTemplate — see §6.
603
604// navigation.model.Maneuver — getType()/getRoundaboutExitNumber()/getRoundaboutExitAngle()/getIcon()
605new Maneuver.Builder(@Type int).setIcon(CarIcon 128×128dp)
606 .setRoundaboutExitNumber(1..).setRoundaboutExitAngle(1..360).build();
607// Types 0..50 incl. UNKNOWN/DEPART/NAME_CHANGE/KEEP_LEFT/RIGHT/TURN_*_LEFT/RIGHT/
608// U_TURN_*/ON_RAMP_*/OFF_RAMP_*/FORK_*/MERGE_*/ROUNDABOUT_*_CW/CCW/STRAIGHT/
609// FERRY_BOAT/TRAIN/DESTINATION* — full list in sources (Maneuver.java).
610
611// navigation.model.Lane — getDirections(); Builder.addDirection(LaneDirection).build()
612// navigation.model.LaneDirection — create(@Shape int, boolean recommended)
613// SHAPE_UNKNOWN=1, STRAIGHT=2, SLIGHT_LEFT=3, SLIGHT_RIGHT=4, NORMAL_LEFT=5,
614// NORMAL_RIGHT=6, SHARP_LEFT=7, SHARP_RIGHT=8, U_TURN_LEFT=9, U_TURN_RIGHT=10
615// PanModeListener.onPanModeChanged(boolean);
616// PanModeDelegate.sendPanModeChanged(boolean, OnDoneCallback) (API 2)
617
618// Map anchors/markers:
619// model.Place — new Place.Builder(CarLocation).setMarker(PlaceMarker).build()
620// model.PlaceMarker — TYPE_ICON=0 (64×64dp, tintable) / TYPE_IMAGE=1 (72×72dp, no color)
621// setIcon(CarIcon,@MarkerIconType).setLabel(CharSequence ≤3).setColor(CarColor).build()
622// model.CarLocation — create(lat,lng) / create(Location)
623```
624
625### 5.5 Alerts (nav only — no `AlertManager`; via `AppManager`)
626
627```java
628// AppManager.showAlert(Alert) / dismissAlert(int) (@RequiresCarApi(5))
629// only navigation templates; unsupported template → REASON_NOT_SUPPORTED; same id replaces.
630// model.Alert (@RequiresCarApi(5)) — DURATION_SHOW_INDEFINITELY = MAX_VALUE; MAX_ACTION_COUNT = 2
631getId()/getTitle()/getSubtitle()/getIcon() (88×88dp)/getActions()/getDurationMillis()/getCallbackDelegate();
632new Alert.Builder(int alertId, CarText title, long durationMillis)
633 .setSubtitle(CarText).setIcon(CarIcon).addAction(Action max 2).setCallback(AlertCallback).build();
634// model.AlertCallback — REASON_TIMEOUT=1/REASON_USER_ACTION=2/REASON_NOT_SUPPORTED=3
635// onCancel(@Reason int); onDismiss()
636// Frequent driving alerts discouraged — prefer notification channel + CarAppExtender (see §12).
637```
638
639---
640
641## 6. POI / Parking / Charging apps (`POI`)
642
643Manifest: `androidx.car.app.category.POI`
644(current name for deprecated `PARKING` / `CHARGING`).
645Permissions: `MAP_TEMPLATES` (for `PlaceListMapTemplate`), `ACCESS_SURFACE` (custom map),
646location (`ACCESS_FINE/COARSE_LOCATION`) for `setCurrentLocationEnabled`.
647
648Primary templates: `SectionedItemTemplate` (API 8),
649`TabTemplate` (API 6), `GridTemplate`, `ListTemplate`, `PaneTemplate`,
650`PlaceListMapTemplate`, `MapWithContentTemplate` (map side via `MAP_TEMPLATES`),
651`SearchTemplate`, `SignInTemplate`, `MessageTemplate`.
652
653```java
654// model.PlaceListMapTemplate — host-drawn map + ItemList
655// refresh iff: prior loading, or title + row count/titles unchanged, or OnContentRefreshListener (API 5, quota-exempt)
656isCurrentLocationEnabled()/getTitle()/getHeaderAction()/getActionStrip()/
657isLoading()/getItemList()/getAnchor()/getOnContentRefreshDelegate(); // API 5
658new PlaceListMapTemplate.Builder()
659 .setCurrentLocationEnabled(boolean) // needs location perm; host may pull location
660 .setLoading(boolean).setHeaderAction(APP_ICON|BACK).setTitle(CharSequence|CarText TEXT_ONLY)
661 .setItemList(ItemList) // ROW_LIST_CONSTRAINTS_SIMPLE + non-browsable need DistanceSpan
662 // + small images only + no image+marker; limit CONTENT_LIMIT_TYPE_PLACE_LIST
663 .setActionStrip(ActionStrip) // NAVIGATION max 4
664 .setAnchor(Place) // viewport reference (e.g. search centre)
665 .setOnContentRefreshListener(OnContentRefreshListener) // API 5
666 .build();
667
668// model.SectionedItemTemplate (@RequiresCarApi(8)) — the POI workhorse
669getSections()/getActions() (FAB)/getHeader()/getSearchHeader() (API 9)/
670isLoading()/getAlphabeticalIndexingStrategy()/getScrollStatePersistenceStrategy();
671new SectionedItemTemplate.Builder()
672 .setSections(List)/addSection(Section)/clearSections()
673 // only ChipSection (first, max 1) | RowSection | GridSection |
674 // CondensedSection | SpotlightSection | BannerSection
675 .setActions/addAction (FAB: max 2 CUSTOM/COMPOSE_MESSAGE/MEDIA_PLAYBACK, icon+bg)
676 .setHeader(Header) / .setSearchHeader(SearchHeader) // mutually exclusive
677 .setLoading(boolean)
678 .setAlphabeticalIndexingStrategy(DISABLED/TITLE_AS_IS/TITLE_IGNORE_ARTICLES_AND_SYMBOLS)
679 .setScrollStatePersistenceStrategy(RESET_TO_TOP/PRESERVE_INDEX).build();
680
681// Sections (model.*):
682// GridSection (API 8): ITEM_SIZE_SMALL/MEDIUM/LARGE/EXTRA_LARGE,
683// ITEM_IMAGE_SHAPE_UNSET/CIRCLE, getIncompleteLastRowStrategy() (API 9)
684// ChipSection (API 9 exp): ≥1 Chip; getStyle():ChipStyle
685// CondensedSection (API 9 exp): CondensedItem dense rows; INCOMPLETE_LAST_ROW_AS_IS/TRUNCATE
686// SpotlightSection (API 8/9): hero cards (hero image + condensed items)
687// BannerSection (API 9 exp): exactly 1 Banner; Banner/BannerElement/BannerStyle
688// BannerStyle: getShape()/getBackground(); Builder.setShape(Shape).setBackground(Background)
689// RowSection, Section<T>, SectionHeader, SectionedItemList
690```
691
692---
693
694## 7. Media apps (`MEDIA`, experimental-stable hybrid)
695
696Manifest: `androidx.car.app.category.MEDIA` (API 8).
697Permissions: `androidx.car.app.MEDIA_TEMPLATES`.
698Feature: `CarFeatures.FEATURE_CAR_APP_LIBRARY_MEDIA`.
699**Browse is delegated** — `MediaBrowserServiceCompat` / Media3 `MediaLibraryService`.
700The car-app lib only transports hints, extras, token, and the playback template.
701`PlaybackStateCompat` is never referenced directly — the host reads the session out-of-band.
702
703```java
704// media.model.MediaPlaybackTemplate (@RequiresCarApi(8) @CarProtocol)
705// PREREQUISITE: MediaPlaybackManager.registerMediaPlaybackToken()
706// API 9+: host renders persistent entrypoint; app MUST handle
707// MediaConstants.ACTION_SHOW_MEDIA_PLAYBACK in Session.onNewIntent
708getHeader()/getBanner() (API 9 exp)/getStyle() (API 9 exp);
709new MediaPlaybackTemplate.Builder()
710 .setHeader(Header).setBanner(Banner).setStyle(MediaPlaybackStyle).build();
711// constraint: header/banner/style only; media apps max 1 FAB on API 9+ (host drops extras)
712
713// media.model.MediaPlaybackStyle (@RequiresCarApi(9) @ExperimentalCarApi)
714getMediaAccentColor()/getProgressBarStrokeCap();
715new MediaPlaybackStyle.Builder()
716 .setMediaAccentColor(CarColor|null) // UNCONSTRAINED
717 .setProgressBarStrokeCap(@StrokeCap int) // default StrokeCap.DEFAULT
718 .build(); // progress mirrors active MediaSession/MediaSessionCompat
719
720// media.MediaPlaybackManager (@RequiresCarApi(8)) — CarContext.MEDIA_PLAYBACK_SERVICE
721MediaPlaybackManager m = carContext.getCarService(MediaPlaybackManager.class);
722m.registerMediaPlaybackToken(MediaSessionCompat.Token token); // @MainThread
723
724// media.MediaConstants (Kotlin object)
725ACTION_SHOW_MEDIA_PLAYBACK = "androidx.car.app.media.action.SHOW_MEDIA_PLAYBACK";
726
727// Voice/mic shared with messaging + nav search:
728// media.CarAudioRecord (@RequiresCarApi(5) abstract) — CarContext.create →
729// AutomotiveCarAudioRecord (automotive) | ProjectedCarAudioRecord (projected)
730AUDIO_CONTENT_SAMPLING_RATE=16000; AUDIO_CONTENT_BUFFER_SIZE=512; AUDIO_CONTENT_MIME="audio/l16";
731startRecording(); stopRecording(); read(byte[],off,size):int; // -1 = dismissed
732// + CarAudioCallback.onStopRecording(), OpenMicrophoneRequest(CarAudioCallback),
733// OpenMicrophoneResponse(InputStream + PFD), delegates
734
735// mediaextensions.* — hints/extras only, no UI:
736// MediaBrowserExtras: KEY_ROOT_HINT_MEDIA_HOST_VERSION,
737// KEY_ROOT_HINT_MEDIA_SESSION_API (1/2/3), KEY_ROOT_HINT_MAX_QUEUE_ITEMS_WHILE_RESTRICTED,
738// KEY_HINT_VIEW_MAX_ITEMS_WHILE_RESTRICTED, ..._PER_ROW / ..._CATEGORY_... variants
739// MediaIntentExtras: ACTION_MEDIA_TEMPLATE_V2, EXTRA_KEY_MEDIA_COMPONENT/_MEDIA_ID/
740// EXTRA_KEY_SEARCH_QUERY/_SEARCH_ACTION (0=NONE, 1=PLAY_FIRST_ITEM_FROM_SEARCH)
741// MetadataExtras (MediaMetadataCompat / media3 MediaMetadata extras):
742// KEY_SUBTITLE_LINK_MEDIA_ID, KEY_DESCRIPTION_LINK_MEDIA_ID,
743// KEY_IMMERSIVE_AUDIO, KEY_EXCLUDE_MEDIA_ITEM_FROM_MIXED_APP_LIST,
744// KEY_CONTENT_FORMAT_TINTABLE_LARGE_ICON_URI/SMALL_ICON_URI,
745// KEY_TINTABLE_INDICATOR_ICON_URI_LIST
746// mediaextensions.analytics.*: BrowseChangeEvent/ErrorEvent/MediaClickedEvent/
747// ViewChangeEvent/VisibleItemsEvent + client.AnalyticsCallback/Parser/RootHintsPopulator
748```
749
750---
751
752## 8. Messaging apps (`MESSAGING`)
753
754Manifest: `androidx.car.app.category.MESSAGING` (`@ExperimentalCarApi`).
755Messaging support also declared via an `IntentService` intent-filter:
756
757```xml
758<service android:name=".MessagingService">
759 <intent-filter>
760 <action android:name="androidx.car.app.messaging.action.HANDLE_CAR_MESSAGING" />
761 </intent-filter>
762</service>
763```
764
765There is **no** `MessagingManager`, **no** `MessagingTemplate`, **no** `RemoteInput` wrapper.
766App implements `ConversationCallback`; host invokes via `ConversationCallbackDelegate`.
767Lists use `ConversationItem` inside `ListTemplate` / `SectionedItemTemplate`.
768Notifications use `CarNotificationManager` + `CarAppExtender` (see §12).
769
770```java
771// messaging.MessagingServiceConstants (@RequiresCarApi(8))
772ACTION_HANDLE_CAR_MESSAGING = "androidx.car.app.messaging.action.HANDLE_CAR_MESSAGING";
773
774// messaging.model.ConversationItem (@RequiresCarApi(7) implements Item)
775// allowed by RowListConstraints alongside Row/Banner
776getId()/getTitle()/getSelf() (name+key required)/getIcon()/isGroupConversation() (3+ vs 1:1)/
777// getMessages() (oldest→newest, non-empty)/getConversationCallbackDelegate()/
778// getActions()/isIndexable() (API 8);
779new ConversationItem.Builder(String id, CarText title, Person self,
780 List<CarMessage> messages, ConversationCallback cb)
781 .setId/setTitle/setIcon/setSelf/setGroupConversation/setMessages/setConversationCallback
782 .addAction(Action) // max 1, ACTIONS_CONSTRAINTS_CONVERSATION_ITEM (TYPE_CUSTOM icon-required)
783 .setIndexable(boolean).build();
784
785// messaging.model.CarMessage (@RequiresCarApi(7))
786getSender() (null|self = self-sent; else name+key)/getBody()/
787// getMultimediaMimeType()+getMultimediaUri() (both or neither)/
788// getReceivedTimeEpochMillis()/isRead();
789new CarMessage.Builder()
790 .setSender(Person|null).setBody(CarText|null)
791 .setMultimediaMimeType(String).setMultimediaUri(Uri)
792 .setReceivedTimeEpochMillis(long).setRead(boolean).build();
793
794// messaging.model.ConversationCallback — host→client
795void onMarkAsRead(); void onTextReply(String replyText);
796// messaging.model.ConversationCallbackDelegate (@RequiresCarApi(7))
797// sendMarkAsRead(OnDoneCallback); sendTextReply(String, OnDoneCallback)
798// (+ ConversationCallbackDelegateImpl, PersonsEqualityHelper.kt)
799```
800
801---
802
803## 9. Calling / Dialer apps (`CALLING`)
804
805Manifest: `androidx.car.app.category.CALLING` (`@ExperimentalCarApi`).
806There is **no** `DialerManager` / `CallingManager` — only templates + keypad callback.
807
808```java
809// dialer.InCallTemplate implements Template (@ExperimentalCarApi)
810getHeader()/getIcon()/getTitle()/getTexts()/getActions()/isLoading();
811new InCallTemplate.Builder()
812 .setTitle(CarText|CharSequence TEXT_ONLY).setIcon(CarIcon DEFAULT)
813 .setHeader(Header) // start → ACTION_CONSTRAINTS_IN_CALL_HEADER (max 1 APP_ICON/BACK/CUSTOM icon, no click)
814 .addText(CarText|CharSequence) // max MAX_TEXTS_SIZE=2, TEXT_AND_ICON
815 .addAction(Action) // max 5, IN_CALL_CONTENT (TYPE_CUSTOM icon 0-titles, max 1 FLAG_PRIMARY)
816 .setLoading(boolean).build(); // content xor loading
817
818// dialer.TelephoneKeypadTemplate implements Template (@ExperimentalCarApi)
819// Keys KEY_ZERO..KEY_NINE=0..9, KEY_STAR=10, KEY_POUND=11
820getHeader()/getPhoneNumber() (editable, reset on refresh)/getPrimaryAction() (call/hangup)/
821// getTelephoneKeypadCallbackDelegate()/getPhoneNumberChangedDelegate()/getKeySecondaryTexts();
822new TelephoneKeypadTemplate.Builder(Action primaryAction, PhoneNumberChangeListener l)
823 // primary: TELEPHONE_KEYPAD_PRIMARY (max 1 TYPE_CUSTOM icon 0-titles)
824 .setHeader(Header) // TELEPHONE_KEYPAD_HEADER (max 1 APP_ICON/BACK)
825 .setPhoneNumber(String|null).setTelephoneKeypadCallback(TelephoneKeypadCallback|null)
826 .addKeySecondaryText(@KeypadKey int, CarText TEXT_AND_ICON).setKeySecondaryTexts(Map).build();
827
828// dialer.TelephoneKeypadCallback (@ExperimentalCarApi)
829void onKeyDown(@KeypadKey int key); void onKeyUp(@KeypadKey int key); // once per gesture, no repeat
830void onKeyLongPress(@KeypadKey int key); // down → longPress → up
831// dialer.TelephoneKeypadCallbackDelegate/Impl
832// PhoneNumberChangeListener.onPhoneNumberChanged(String) — backspace updates without keypad event
833```
834
835---
836
837## 10. Weather apps (`WEATHER`)
838
839Manifest: `androidx.car.app.category.WEATHER` (API 7).
840No dedicated weather manager/template — compose from shared templates:
841
842- `ListTemplate` / `SectionedItemTemplate` (forecast rows: `Row` + `CarIcon` + `DistanceSpan`/`DurationSpan`)
843- `GridTemplate` (`GridItem` per day/hour, `setItemSize/setItemImageShape` API 8)
844- `TabTemplate` (Current | Hourly | Daily; `TabStyle` API 9)
845- `PaneTemplate` (alert detail), `MessageTemplate` (no data), `PlaceListMapTemplate`
846 (radar city list; `MAP_TEMPLATES`)
847- `Header` + `CarText` variants; `CarProgressBar` (precipitation chance, API 9)
848
849---
850
851## 11. IoT apps (`IOT`)
852
853Manifest: `androidx.car.app.category.IOT` (API 6).
854No `IoTManager` — manifest-only category. Compose from:
855
856- `GridTemplate` (device grid), `ListTemplate` (`Row` + `Toggle` for switches),
857 `SectionedItemTemplate` (`RowSection` per room + `ChipSection` filters, API 9),
858 `PaneTemplate` (device detail), `MessageTemplate` (offline),
859 `SignInTemplate` (account link), `SearchTemplate` (device search)
860- `Row.Builder.setToggle(Toggle)`; `Action` with `ParkedOnlyOnClickListener` where required
861
862---
863
864## 12. Settings / sign-in / search / suggestions / notifications
865
866### 12.1 Settings
867
868Manifest: `androidx.car.app.category.SETTINGS` (API 6).
869Templates: `ListTemplate`, `PaneTemplate`, `MessageTemplate`, `SignInTemplate`,
870`LongMessageTemplate` (parked-only ToS).
871
872### 12.2 `model.signin.SignInTemplate` (parked-only, API 2)
873
874```java
875isLoading()/getTitle()/getHeaderAction()/getInstructions()/getAdditionalText()/
876getActionStrip()/getActions()/getSignInMethod():SignInMethod (marker);
877new SignInTemplate.Builder(SignInMethod m)
878 .setLoading(...).setHeaderAction(APP_ICON|BACK).setActionStrip(SIMPLE max 2/1-titled)
879 .addAction(Action) // max 2 BODY_WITH_PRIMARY_ACTION, MUST ParkedOnlyOnClickListener
880 .setTitle(CharSequence TEXT_ONLY).setInstructions(CharSequence TEXT_WITH_COLORS)
881 .setAdditionalText(CharSequence CLICKABLE_TEXT_ONLY).build();
882
883// ProviderSignInMethod(Action action TYPE_CUSTOM + ParkedOnlyOnClickListener)
884// PinSignInMethod(CharSequence pin 1..MAX_PIN_LENGTH=12)
885// QRCodeSignInMethod(Uri uri) (API 4)
886// InputSignInMethod: INPUT_TYPE_DEFAULT=1/PASSWORD=2; KEYBOARD_DEFAULT=1/EMAIL=2/PHONE=3/NUMBER=4
887// getHint()/getDefaultValue()/getErrorMessage()/getInputType()/getKeyboardType()/
888// getInputCallbackDelegate()/isShowKeyboardByDefault();
889// new InputSignInMethod.Builder(InputCallback cb).setHint/setDefaultValue/
890// setInputType/setErrorMessage(≤2 lines)/setKeyboardType/setShowKeyboardByDefault.build()
891// InputCallback: onInputSubmitted/onInputTextChanged (both default no-op, API 2)
892```
893
894### 12.3 Search (POI / media / messaging shared)
895
896`model.SearchTemplate`: refresh-friendly (typing changes not counted).
897`Builder(SearchCallback)` + `setHeaderAction(APP_ICON|BACK)` +
898`setActionStrip(SIMPLE max 2/1-titled)` + `setInitialSearchText` +
899`setSearchHint` (hidden while initial text) + `setLoading` +
900`setItemList(ItemList ROW_LIST_CONSTRAINTS_SIMPLE: CONTENT_LIMIT_TYPE_LIST, not selectable,
901ROW_CONSTRAINTS_SIMPLE max 2 texts, image+toggle allowed, no Toggle)` +
902`setShowKeyboardByDefault` (default true).
903
904`model.SearchHeader` (API 9 exp): same but for `SectionedItemTemplate`
905(mutually exclusive with `Header`).
906
907### 12.4 `suggestion.SuggestionManager` (API 5, `SUGGESTION_SERVICE`)
908
909```java
910SuggestionManager s = carContext.getCarService(SuggestionManager.class);
911s.updateSuggestions(List<Suggestion> list); // @MainThread; HostException if not nav-manifest
912// suggestion.model.Suggestion (@CarProtocol)
913getIdentifier()/getTitle()/getSubtitle()/getIcon() (128×128dp)/getAction():PendingIntent;
914new Suggestion.Builder().setIdentifier/setTitle/setSubtitle/setAction(required)/setIcon/build();
915```
916
917### 12.5 `notification.*` (all app types)
918
919```java
920// notification.CarNotificationManager — wrapper over NotificationManagerCompat
921static CarNotificationManager from(Context ctx);
922notify(int, NotificationCompat.Builder) / notify(String,int,Builder)
923// auto-extends with CarAppExtender if missing; automotive unwraps extender
924cancel(int)/cancel(String,int)/cancelAll();
925areNotificationsEnabled(); getImportance();
926createNotificationChannel(ChannelCompat)/createNotificationChannelGroup/
927createNotificationChannels/createNotificationChannelGroups/
928deleteNotificationChannel/deleteNotificationChannelGroup/deleteUnlistedNotificationChannels/
929getNotificationChannel(String[,conversationId])/getNotificationChannelGroup/
930getNotificationChannels()/getNotificationChannelGroups();
931static getEnabledListenerPackages(Context);
932
933// notification.CarAppExtender implements NotificationCompat.Extender — MUST extend or not shown on car
934// HUN if IMPORTANCE_HIGH/PRIORITY_HIGH+; badge if DEFAULT+; TBT nav if ongoing+CATEGORY_NAVIGATION
935// (suppressed if not active nav or already in nav template; setOnlyAlertOnce(true) recommended)
936extend(NotificationCompat.Builder|Notification.Builder);
937static boolean isExtended(Notification n);
938getContentTitle/Text(); getSmallIcon():@DrawableRes; getLargeIcon():Bitmap|null;
939getContentIntent()/getDeleteIntent():PendingIntent|null; getActions(); getImportance();
940getColor():CarColor|null (nav HUN only); getChannelId():String|null (AAOS only);
941new CarAppExtender.Builder()
942 .setContentTitle/setContentText/setSmallIcon(int)/setLargeIcon(Bitmap)/
943 setContentIntent/setDeleteIntent/addAction(int,title,PendingIntent)|addAction(Action) (max 2)/
944 setImportance(int AA only)/setColor(CarColor nav only)/setChannelId(String AAOS only).build();
945
946// notification.CarPendingIntent + CarAppNotificationBroadcastReceiver
947static PendingIntent getCarApp(Context ctx, int reqCode, Intent intent, int flags);
948// validates: ACTION_NAVIGATE geo: | ACTION_DIAL/ACTION_CALL tel: | own CarAppService;
949// strips IMMUTABLE→mutable (+ALLOW_UNSAFE_IMPLICIT_INTENT on U+);
950// automotive → getActivity(CarAppActivity); projected → getBroadcast(CarAppNotificationBroadcastReceiver)
951```
952
953### 12.6 Cluster (`FEATURE_CLUSTER`, API 6)
954
955Manifest: `androidx.car.app.category.FEATURE_CLUSTER` with
956`SessionInfo.DISPLAY_TYPE_CLUSTER`. Only `NavigationTemplate` is allowed;
957feed it via the same `NavigationManager.updateTrip(Trip)` cluster path.
958
959### 12.7 Theming (API 9, all app types)
960
961```java
962// opt-in: override CarAppService.getCarAppThemeSource()
963// THEME_SOURCE_SYSTEM (default, OEM styling) vs THEME_SOURCE_APP (brand styling, CAL defaults)
964// manifest: <meta-data android:name="androidx.car.app.theme" .../> (also permission-UI drawables)
965// styles: TabStyle / BannerStyle / MediaPlaybackStyle / CarIconStyle.setShape(Shape) /
966// Background / Shape / CarProgressBar — see §3.3; host may enforce contrast + fallback
967```
968
969---
970
971## 13. Vehicle hardware (all app types, API-gated)
972
973### 13.1 `hardware.CarHardwareManager` (API 3, `HARDWARE_SERVICE`)
974
975```java
976CarHardwareManager hw = carContext.getCarService(CarHardwareManager.class);
977CarInfo getCarInfo(); CarSensors getCarSensors();
978@ExperimentalCarApi CarClimate getCarClimate();
979// static create(CarContext, HostDispatcher) resolves impl via
980// CarAppMetadataHolderService.CAR_HARDWARE_MANAGER metadata;
981// throws if host < LEVEL_3 or missing app-automotive|app-projected dep.
982```
983
984### 13.2 `hardware.common.*`
985
986```java
987// CarValue<T> (API 3) — STATUS_UNKNOWN=0/SUCCESS=1/UNIMPLEMENTED=2/UNAVAILABLE=3
988T getValue(); long getTimestampMillis(); // elapsedRealtime base
989int getStatus(); List<CarZone> getCarZones();
990// sentinels: UNKNOWN_INTEGER/BOOLEAN/FLOAT/STRING/LIST/ARRAY, UNIMPLEMENTED_INTEGER/FLOAT_LIST
991// CarUnit — CarDistanceUnit{MILLIMETER=1,METER=2,KILOMETER=3,MILE=4},
992// CarSpeedUnit{METERS_PER_SEC=101,KILOMETERS_PER_HOUR=102,MILES_PER_HOUR=103},
993// CarVolumeUnit{MILLILITER=201,LITER=202,US_GALLON=203,IMPERIAL_GALLON=204} (exp)
994// CarZone (API 5) — rows ROW_ALL/FIRST/SECOND/THIRD/EXCLUDE_FIRST,
995// cols COLUMN_ALL/LEFT/CENTER/RIGHT/DRIVER/PASSENGER, CAR_ZONE_GLOBAL
996// getRow/getColumn; Builder.setRow/setColumn.build()
997// OnCarDataAvailableListener<T>.onCarDataAvailable(T)
998// CarSetOperationStatusCallback (API 5) — OPERATION_STATUS_SUCCESS/
999// FEATURE_UNIMPLEMENTED/UNSUPPORTED/TEMPORARILY_UNAVAILABLE/SETTING_NOT_ALLOWED/
1000// UNSUPPORTED_VALUE/INSUFFICIENT_PERMISSION/ILLEGAL_CAR_HARDWARE_STATE/UPDATE_TIMEOUT
1001// + onSetCarClimateState{...}(int) per climate feature
1002```
1003
1004### 13.3 `hardware.info.*`
1005
1006```java
1007// CarInfo (API 3)
1008fetchModel/fetchEnergyProfile/fetchExteriorDimensions(Executor, OnCarDataAvailableListener) // dims API 7
1009add/removeTollListener; add/removeEnergyLevelListener; add/removeSpeedListener;
1010add/removeMileageListener; add/removeEvStatusListener (exp);
1011// CarSensors (API 3) — UPDATE_RATE_NORMAL=1/UI=2/FASTEST=3
1012add/removeAccelerometerListener; add/removeGyroscopeListener; add/removeCompassListener;
1013add/removeCarHardwareLocationListener(int rate, Executor, OnCarDataAvailableListener);
1014// Model — getName/getYear/getManufacturer():CarValue
1015// EnergyProfile — EvConnectorType{UNKNOWN/J1772/MENNEKES/CHADEMO/COMBO_1/COMBO_2/
1016// TESLA_ROADSTER/HPWC/SUPERCHARGER/GBT/GBT_DC/SCAME/OTHER=101},
1017// FuelType{UNKNOWN/UNLEADED/LEADED/DIESEL_1/DIESEL_2/BIODIESEL/E85/LPG/CNG/LNG/ELECTRIC/HYDROGEN/OTHER}
1018// EnergyLevel — getBatteryPercent/getFuelPercent/getEnergyIsLow/getRangeRemainingMeters,
1019// getDistanceDisplayUnit(), getFuelVolumeDisplayUnit() (exp)
1020// Speed — getRawSpeedMetersPerSecond/getDisplaySpeedMetersPerSecond/getSpeedDisplayUnit()
1021// Mileage — getOdometerInKilometers() (+@Deprecated getOdometerMeters alias)
1022// EvStatus (exp) — getEvChargePortOpen/getEvChargePortConnected
1023// TollCard.getCardState(); ExteriorDimensions (API 7, needs android.car.permission.CAR_INFO)
1024// Accelerometer/Gyroscope/Compass (float-list vectors); CarHardwareLocation (UNIMPLEMENTED_LOCATION)
1025```
1026
1027### 13.4 `hardware.climate.*` (API 5, experimental)
1028
1029```java
1030// CarClimate
1031registerClimateStateCallback(Executor, RegisterClimateStateRequest, CarClimateStateCallback);
1032unregisterClimateStateCallback(CarClimateStateCallback);
1033fetchClimateProfile(Executor, ClimateProfileRequest, CarClimateProfileCallback);
1034setClimateState<E>(Executor, ClimateStateRequest<E>, CarSetOperationStatusCallback);
1035// ClimateProfileRequest / RegisterClimateStateRequest features:
1036// FEATURE_HVAC_POWER=1/AC=2/MAX_AC=3/CABIN_TEMPERATURE=4/FAN_SPEED=5/FAN_DIRECTION=6/
1037// SEAT_TEMPERATURE_LEVEL=7/SEAT_VENTILATION_LEVEL=8/STEERING_WHEEL_HEAT=9/
1038// RECIRCULATION=10/AUTO_RECIRCULATION=11/AUTO_MODE=12/DUAL_MODE=13/
1039// DEFROSTER=14/MAX_DEFROSTER=15/ELECTRIC_DEFROSTER=16/CAR_ZONE_MAPPING=17
1040// CarClimateFeature/Builder(feature).addCarZones(CarZone...)
1041// ClimateStateRequest<T>: getRequestedFeature/getCarZones/getRequestedValue
1042// CarClimateStateCallback + CarClimateProfileCallback — onHvacPower/Ac/MaxAcMode/
1043// CabinTemperature/FanSpeedLevel/FanDirection/SeatTemperatureLevel/SeatVentilationLevel/
1044// SteeringWheelHeat/HvacRecirculation/HvacAutoRecirculation/HvacAutoMode/HvacDualMode/
1045// Defroster/MaxDefroster/ElectricDefroster[StateAvailable](CarValue<...>) (all default {})
1046// Profiles: HvacPower/Ac/MaxAc/Recirculation/AutoRecirculation/AutoMode/DualMode/
1047// Defroster/MaxDefroster/ElectricDefroster/CabinTemperature (ranges+increments+zone maps)/
1048// FanSpeedLevel/FanDirection/SeatTemperature/SeatVentilation/SteeringWheelHeat/CarZoneMappingInfo
1049```
1050
1051---
1052
1053## 14. Automotive-only vs Projected-only
1054
1055| Capability | `app-automotive` | `app-projected` |
1056|---|---|---|
1057| `CarInfo/Sensors` | `AutomotiveCarInfo/Sensors` via `android.car` + `PropertyManager` | `ProjectedCarInfo/Sensors` via `CarHardwareHostDispatcher` → host |
1058| `CarClimate` | `AutomotiveCarClimate` supported | unsupported (throws) |
1059| UI host | `CarAppActivity/BaseCarAppActivity/LauncherActivity + TemplateSurfaceView` natively | phone renders via projected host (AA/CP); no activity in lib |
1060| Connection | `AutomotiveCarConnectionTypeLiveData = NATIVE` | `CarConnectionTypeLiveData` provider + broadcast (`PROJECTION`) |
1061| Result | `ResultManagerAutomotive` (real `setActivityResult`) | base `ResultManager` (AA: no-op / null caller) |
1062| Audio | `AutomotiveCarAudioRecord` | `ProjectedCarAudioRecord` |
1063| Wiring | `CAR_HARDWARE_MANAGER=AutomotiveCarHardwareManager` | `CAR_HARDWARE_MANAGER=ProjectedCarHardwareManager` |
1064
1065### 14.1 Automotive activities (`app-automotive/activity.*`)
1066
1067```java
1068// activity.CarAppActivity extends BaseCarAppActivity — automotive-only entry
1069// ACTION_RENDER="android.car.template.host.RendererService"
1070// onCreate → bindToViewModel(new SessionInfo(DISPLAY_TYPE_MAIN, intent.identifier))
1071// activity.BaseCarAppActivity extends FragmentActivity
1072// bindToViewModel(SessionInfo); getServiceComponentName()/retrieveServiceComponentName()
1073// (queries SERVICE_INTERFACE in own package; exactly 1 required)
1074// ICarAppActivity.Stub{setSurfacePackage/registerRendererCallback/setInsetsListener/
1075// setSurfaceListener/onStartInput/onStopInput/startCarApp/finishCarApp/onUpdateSelection/showAssist}
1076// insets fan-out; takeSurfaceSnapshot() via PixelCopy;
1077// state IDLE/CONNECTING/CONNECTED/ERROR (TemplateSurfaceView/ErrorMessageView/LoadingView)
1078// activity.LauncherActivity (@ExperimentalCarApi) — FEATURE_AUTOMOTIVE ? CarAppActivity : MAIN/DEFAULT
1079// activity.ActivityLifecycleDelegate — registerRendererCallback(IRendererCallback) →
1080// ServiceDispatcher.dispatch(ON_CREATE/START/RESUME/PAUSE/STOP/DESTROY)
1081// activity.ServiceDispatcher — dispatch(String,OneWayCall)/fetch(...)
1082// DeadObject→HOST_CONNECTION_LOST, Remote→HOST_ERROR, Bundler→CLIENT_SIDE_ERROR
1083// activity.HostUpdateReceiver — PACKAGE_REPLACED → CarAppViewModel.onHostUpdated()
1084// activity.ResultManagerAutomotive — setCarAppResult→ViewModel; getCallingComponent (AA: null)
1085// + CarAppViewModel/Factory/ServiceConnectionManager/ErrorHandler/LogTags,
1086// ui.ErrorMessageView/LoadingView,
1087// renderer.surface.TemplateSurfaceView/SurfaceWrapper/Provider/HolderListener/
1088// ControlCallback/LegacySurfacePackage/OnBackPressed/OnCreateInputConnection/RemoteProxyInputConnection
1089// renderer.ICarAppActivity/IRendererCallback/IRendererService/ISurfaceListener/IInsetsListener
1090// hardware.AutomotiveCarHardwareManager + climate/info/common (PropertyManager,
1091// CarPropertyProfile<T> (HvacFanDirection…), CarPropertyResponse, GetPropertyRequest,
1092// PropertyIdAreaId, PropertyRequestProcessor, PropertyResponseCache, PropertyUtils,
1093// CarValueUtils, OnCarPropertyResponseListener, CarInternalError, CarZone*Converter/Utils)
1094// media.AutomotiveCarAudioRecord
1095// Automotive manifest:
1096// <activity android:name="androidx.car.app.activity.CarAppActivity" android:exported="true"
1097// android:launchMode="singleTask" android:label="...">
1098// <intent-filter><action android:name="android.intent.action.MAIN" />
1099// <category android:name="android.intent.category.LAUNCHER" /></intent-filter>
1100// <meta-data android:name="distractionOptimized" android:value="true" />
1101// </activity>
1102```
1103
1104### 14.2 Projected (`app-projected/*`)
1105
1106```java
1107// hardware.ProjectedCarHardwareManager implements CarHardwareManager (@RestrictTo(LIBRARY) @CarProtocol)
1108// getCarInfo():ProjectedCarInfo; getCarSensors():ProjectedCarSensors;
1109// NO getCarClimate() (UnsupportedOperationException); ctor (CarContext, HostDispatcher)
1110// hardware.common.CarHardwareHostDispatcher (+CarResultStub/Map) — host-IPC fan-out
1111// hardware.info.ProjectedCarInfo / ProjectedCarSensors — host-dispatched
1112// media.ProjectedCarAudioRecord
1113// No activities, no renderer/, no PropertyManager/CarPropertyProfile, no AutomotiveCar*
1114```
1115
1116---
1117
1118## 15. Testing surface
1119
1120`app-testing` (`androidx.car.app.testing.*`, `testing.navigation.*`).
1121**No `CarAppTestRule`** in this drop — compose the fakes directly:
1122
1123```java
1124TestCarContext.create(); // fake CarContext + service overrides
1125TestScreenManager / ScreenController // drive Screen.onGetTemplate/invalidate + lifecycle
1126SessionController // drive Session.onCreateScreen/onNewIntent/lifecycle
1127TestAppManager / navigation.TestNavigationManager // record invalidate/navigationStarted/…
1128FakeHost // stub ICarHost
1129TestOnDoneCallbackStub, TestLifecycleOwner, TestDelegateInvoker.kt
1130```
1131
1132---
1133
1134## 16. Permissions, constraints, quotas
1135
1136### Permissions (`androidx.car.app.CarAppPermission`)
1137
1138| Permission | Needed for |
1139|---|---|
1140| `androidx.car.app.ACCESS_SURFACE` | `AppManager.setSurfaceCallback` / custom map |
1141| `androidx.car.app.NAVIGATION_TEMPLATES` | `NavigationTemplate`, legacy nav templates, nav side of `MapWithContentTemplate` |
1142| `androidx.car.app.MAP_TEMPLATES` | `PlaceListMapTemplate`, map side of `MapWithContentTemplate` (self-drawn nav maps exempt) |
1143| `androidx.car.app.MEDIA_TEMPLATES` | media templates (triggers API 9 1-FAB limit) |
1144
1145```java
1146static boolean checkHasPermission(Context ctx, String perm);
1147static boolean checkHasLibraryPermission(Context ctx, @LibraryPermission String perm);
1148```
1149
1150Platform-adjacent: `android.car.permission.CAR_INFO` (exterior dims etc.);
1151vehicle-property read perms in `PropertyManager.checkPermissions()`
1152(`CAR_INFO / CAR_EXTERIOR_ENVIRONMENT / CAR_ENERGY / CAR_SPEED / READ_*`);
1153host-side `android.car.permission.TEMPLATE_RENDERER` (auto API 31+);
1154`RECORD_AUDIO` for `CarAudioRecord`; location for current-location.
1155
1156### Constraints (`model.constraints.*`, all `@RestrictTo(LIBRARY)`)
1157
1158- `ActionsConstraints`: `HEADER`(1 icon, no click) / `MULTI_HEADER`(2) / `BODY`(2/2-titled
1159 `COLOR_ONLY`) / `BODY_WITH_PRIMARY_ACTION`(1 primary) / `SIMPLE`(strip 2/1-titled
1160 `TEXT_ONLY`) / `NAVIGATION`(map strips 4/4-titled/1-primary `TEXT_AND_ICON`) /
1161 `MAP`(4/1-primary icon-only) / `ROW`(2 `CUSTOM/MEDIA_PLAYBACK`, 1 primary) /
1162 `CONVERSATION_ITEM`(1 `CUSTOM` icon) / `FAB`(2 `CUSTOM/COMPOSE_MESSAGE/MEDIA_PLAYBACK`
1163 icon+bg; media 1 on API 9+) / `TABS`(needs `APP_ICON`) / `TAB_ACTIONS`(1 custom icon) /
1164 `IN_CALL_HEADER`(1 `APP_ICON/BACK/CUSTOM`) / `IN_CALL_CONTENT`(5 custom 0-titled 1-primary) /
1165 `TELEPHONE_KEYPAD_HEADER`(1 `APP_ICON/BACK`) / `TELEPHONE_KEYPAD_PRIMARY`(1 custom icon) /
1166 `BANNER_TRAILING`(2) / `BANNER_BELOW`(3/2-titled) — via `validateOrThrow(List<Action>)`.
1167- `RowListConstraints`: `CONSERVATIVE` / `PANE` / `SIMPLE` / `MAP_ROW_LIST_CONSTRAINTS_ALLOW_SELECTABLE`
1168 (+`ROUTE_PREVIEW` alias) / `FULL_LIST`; allows `Row|ConversationItem|Banner`.
1169- `RowConstraints`: `UNCONSTRAINED / CONSERVATIVE / PANE / SIMPLE / FULL_LIST`.
1170- `CarTextConstraints`: `CONSERVATIVE`(none) / `UNCONSTRAINED` /
1171 `CLICKABLE_TEXT_ONLY` / `COLOR_ONLY`(FgColor) / `TEXT_ONLY`(Distance/Duration/Timer) /
1172 `TEXT_AND_ICON` / `TEXT_WITH_COLORS` / `TEXT_WITH_COLORS_AND_ICON`.
1173- `CarIconConstraints`: `UNCONSTRAINED`(bitmap/resource/uri-content) /
1174 `DEFAULT`(bitmap/resource only; URI must be `content:`).
1175- `ModelUtils`: `validateAllNonBrowsableRowsHaveDistance` (PlaceListMap),
1176 `validateAllRowsHaveDistanceOrDuration` (route preview),
1177 `validateAllRowsHaveOnlySmallImages` (no LARGE), `validateNoRowsHaveBothMarkersAndImages`.
1178- `navigation.model.constraints.ContentTemplateConstraints`:
1179 `MAP_WITH_CONTENT_TEMPLATE_CONSTRAINTS` (API 7 Grid/Message/List/Pane),
1180 `..._API_8` (+SectionedItem).
1181- `constraints.ConstraintManager` (API 2): `CONTENT_LIMIT_TYPE_LIST=0/GRID=1/
1182 PLACE_LIST=2/ROUTE_LIST=3/PANE=4`; `getContentLimit(type)` (host or
1183 `R.integer.content_limit_*` fallback); `isAppDrivenRefreshEnabled()` (API 6).
1184- Template flow (`Screen`): 5-task quota; refresh vs push rules in §2.2;
1185 `ListTemplate` truncates to 100; `MAX_MESSAGES_PER_CONVERSATION=10`.
1186
1187---
1188
1189## Appendix A: 1.9.0-alpha02 + alpha01 changelog
1190
1191**`1.9.0-alpha02` (Sept 2026)** — theming + search + styling release:
1192
1193- App theming: `CarAppThemeSource` + `CarAppService.onGetAppTheme` (+ IPC) — apps opt into
1194 brand theming, hosts query preferred config.
1195- Search header: `SearchHeader` for `SectionedItemTemplate` (API 9 search replacement).
1196- Component styling: `TabStyle` (bg/content/corner radii), `BannerStyle` (shape/corners),
1197 `MediaPlaybackStyle` + `setMediaAccentColor` + standalone `StrokeCap`, `CarProgressBarStyle`
1198 (nullable colours; deprecated colour methods removed from `CarProgressBar`).
1199- Tabs: custom bg/content/text colours + corner radii.
1200- Icons/images: `IMAGE_TYPE_ICON` deprecated across `Row/GridItem/Banner/CondensedItem`
1201 → `IMAGE_TYPE_SMALL/MEDIUM` (untinted default); `CarIconStyle` rework + custom `Shape` on `CarIcon`.
1202- Banners: `BannerStyle` shapes/corners, `IMAGE_TYPE_SMALL/LARGE` variants, deprecated
1203 icon/bg APIs removed → `setLeadingImage/addTrailingImage`.
1204- Headers/layout: `SearchHeader` (API 9), `startHeaderImage` on `Header`,
1205 `incompleteLastRowStrategy` for grid/condensed/spotlight partial rows.
1206- Bug fix: `Action.TYPE_MEDIA_PLAYBACK` ignored as template FAB on Car API 9+ hosts.
1207
1208**`1.9.0-alpha01` (May 2026)** — content-flexibility release:
1209
1210- `Banner` + `BannerSection` for `SectionedItemTemplate`.
1211- `NavigationManager.setVoiceAssistantCapabilities` + `NavigationVoiceAssistantCapabilities`
1212 (voice actions/disruptions/consent → host).
1213- `CarAppApiLevel` 9.
1214- `Chip`/`ChipSection` shape via `ChipStyle`.
1215- `CondensedItem`/`CondensedSection` high-density layouts.
1216- Experimental `Header` subtitles + `Background` model.
1217- Spotlight section (hero image + condensed items), minimized control panel (NPV),
1218 section headers (titles/overlines/brand icons/trailing actions), expanded header layout
1219 (collapsing background image + secondary actions).
1220
1221---
1222
1223## Appendix B: Full class index
1224
1225All FQCNs are `androidx.car.app.*` unless noted; `(P)` = `app-projected`,
1226`(A)` = `app-automotive`, `(T)` = `app-testing`.
1227
1228**Core:** `CarAppService`, `CarAppBinder`, `Session`, `Screen`, `ScreenManager`,
1229`CarContext`, `AppManager`, `SurfaceCallback`, `SurfaceContainer`, `CarToast`,
1230`CarAppPermission`, `HostInfo`, `HandshakeInfo`, `AppInfo`, `SessionInfo`,
1231`SessionInfoIntentEncoder`, `CarAppMetadataHolderService`, `MainThread`/`Manager`/
1232`ManagerFactory`/`ManagerCache` (`managers.*`), `ResultManager` (`managers.*`),
1233`validation.HostValidator`, `versioning.CarAppApiLevel(s)`,
1234`annotations.{RequiresCarApi,ExperimentalCarApi,CarProtocol,KeepFields}`,
1235`features.CarFeatures`, `connection.{CarConnection,CarConnectionTypeLiveData,
1236AutomotiveCarConnectionTypeLiveData}`, `constraints.ConstraintManager`,
1237`suggestion.SuggestionManager`, `suggestion.model.Suggestion`,
1238`serialization.*`, `utils.*`.
1239
1240**Model (`model.*`):** `Template`, `TemplateInfo`, `TemplateWrapper`, `Action`,
1241`ActionStrip`, `Header`, `SearchHeader` (9), `Tab`, `TabContents`, `TabStyle` (9),
1242`Pane`, `PaneTemplate`, `ListTemplate`, `SectionedItemTemplate` (8),
1243`GridTemplate`, `MessageTemplate`, `LongMessageTemplate` (2), `SearchTemplate`,
1244`SearchCallback`, `PlaceListMapTemplate`, `TabTemplate` (6),
1245`Item`, `ItemList`, `SectionedItemList`, `Section`, `SectionHeader`,
1246`RowSection`, `GridSection` (8), `ChipSection` (9), `CondensedSection` (9),
1247`SpotlightSection` (8/9), `BannerSection` (9), `Row`, `GridItem`,
1248`CondensedItem`, `Chip`, `ChipStyle`, `Banner`, `BannerElement`, `BannerStyle` (9),
1249`Toggle`, `Metadata`, `Place`, `PlaceMarker`, `CarLocation`, `Alert` (5),
1250`AlertCallback` (5), `AlertCallbackDelegate` (5), `CarText`, `CarSpan`,
1251`DistanceSpan`, `DurationSpan`, `ForegroundCarColorSpan`, `CarIconSpan`,
1252`ClickableSpan`, `TimerSpan`, `Distance`, `DateTimeWithZone`, `CarColor`,
1253`CarIcon`, `CarIconStyle`, `Background` (9), `Shape` (9), `CarProgressBar` (9),
1254`CarProgressBarStyle`, `StrokeCap`, `OnClickListener`,
1255`ParkedOnlyOnClickListener`, `InputCallback`, `OnContentRefreshListener`,
1256`constraints.{ActionsConstraints,RowConstraints,RowListConstraints,
1257CarTextConstraints,CarIconConstraints,TabsConstraints,TabContentsConstraints}`,
1258`ModelUtils`, `model.signin.{SignInTemplate,SignInMethod,ProviderSignInMethod,
1259PinSignInMethod,QRCodeSignInMethod,InputSignInMethod}`.
1260
1261**Navigation (`navigation.*`):** `NavigationManager`, `NavigationManagerCallback`,
1262`navigation.model.{NavigationTemplate,MapWithContentTemplate (7),MapTemplate (5,dep),
1263PlaceListNavigationTemplate (dep),RoutePreviewNavigationTemplate (dep),Trip,Step,
1264TravelEstimate,Destination,RoutingInfo,MessageInfo,Maneuver,Lane,LaneDirection,
1265MapController (5),PanModeListener,PanModeDelegate,PanModeDelegateImpl,
1266NavigationVoiceAssistantCapabilities (9),
1267constraints.ContentTemplateConstraints}`.
1268
1269**Media (`media.*`, `media.model.*`, `mediaextensions.*`):**
1270`MediaPlaybackManager` (8), `MediaPlaybackTemplate` (8, `media.model`),
1271`MediaPlaybackStyle` (9), `MediaConstants`, `CarAudioRecord` (5),
1272`CarAudioCallback`, `OpenMicrophoneRequest/Response`, `CarAudioCallbackDelegate`,
1273`AutomotiveCarAudioRecord` (A), `ProjectedCarAudioRecord` (P),
1274`MediaBrowserExtras`, `MediaIntentExtras`, `MetadataExtras`,
1275`mediaextensions.analytics.{Constants,ThreadUtils,client.*,event.*}`.
1276
1277**Messaging / notifications:** `messaging.MessagingServiceConstants` (8),
1278`messaging.model.{ConversationItem (7),CarMessage (7),ConversationCallback,
1279ConversationCallbackDelegate}`, `notification.{CarNotificationManager,
1280CarAppExtender,CarPendingIntent,CarAppNotificationBroadcastReceiver}`.
1281
1282**Dialer (`dialer.*`):** `InCallTemplate`, `TelephoneKeypadTemplate`,
1283`TelephoneKeypadCallback`, `TelephoneKeypadCallbackDelegate` (all experimental).
1284
1285**Hardware (`hardware.*`):** `CarHardwareManager`,
1286`common.{CarValue,CarUnit,CarZone (5),OnCarDataAvailableListener,
1287CarSetOperationStatusCallback (5)}`,
1288`info.{CarInfo,CarSensors,Model,EnergyProfile,EnergyLevel,Speed,Mileage,
1289EvStatus,TollCard,ExteriorDimensions (7),Accelerometer,Gyroscope,Compass,
1290CarHardwareLocation}`, `climate.{CarClimate,ClimateProfileRequest,
1291CarClimateFeature,RegisterClimateStateRequest,ClimateStateRequest,
1292CarClimateStateCallback,CarClimateProfileCallback,Hvac*Profile,
1293CabinTemperatureProfile,FanSpeedLevelProfile,FanDirectionProfile,
1294SeatTemperatureProfile,SeatVentilationProfile,SteeringWheelHeatProfile,
1295CarZoneMappingInfoProfile}` (all 5, experimental),
1296`AutomotiveCarHardwareManager` (A), `automotive info/climate/common`
1297(`AutomotiveCarInfo/Sensors/Climate`, `CarPropertyProfile`, `PropertyManager`,
1298`CarPropertyResponse`, `GetPropertyRequest`, `PropertyIdAreaId`,
1299`PropertyRequestProcessor`, `PropertyResponseCache`, `PropertyUtils`,
1300`CarValueUtils`, `OnCarPropertyResponseListener`, `CarInternalError`,
1301`CarZone*Converter/Utils`) (A),
1302`ProjectedCarHardwareManager`, `common.CarHardwareHostDispatcher`,
1303`info.ProjectedCarInfo/Sensors` (P).
1304
1305**Automotive activity (A):** `activity.{CarAppActivity,BaseCarAppActivity,
1306LauncherActivity,ActivityLifecycleDelegate,ServiceDispatcher,HostUpdateReceiver,
1307ResultManagerAutomotive,CarAppViewModel,CarAppViewModelFactory,
1308ServiceConnectionManager,ErrorHandler,LogTags,ui.ErrorMessageView/LoadingView,
1309renderer.surface.* (TemplateSurfaceView/SurfaceWrapper/Provider/HolderListener/
1310ControlCallback/LegacySurfacePackage/OnBackPressed/OnCreateInputConnection/
1311RemoteProxyInputConnection), renderer.ICarAppActivity/IRendererCallback/
1312IRendererService/ISurfaceListener/IInsetsListener}`.
1313
1314**Testing (T):** `testing.{TestCarContext,TestAppManager,TestScreenManager,
1315ScreenController,SessionController,FakeHost,TestOnDoneCallbackStub,
1316TestLifecycleOwner,TestDelegateInvoker.kt,navigation.TestNavigationManager}`.