in car_app_library/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationSession.java [232:278]
public void onNewIntent(@NonNull Intent intent) {
Log.i(TAG, "In onNewIntent() " + intent);
ScreenManager screenManager = getCarContext().getCarService(ScreenManager.class);
if (CarContext.ACTION_NAVIGATE.equals(intent.getAction())) {
Uri uri = Uri.parse("http://" + intent.getDataString());
screenManager.popToRoot();
screenManager.pushForResult(
new SearchResultsScreen(
getCarContext(),
mSettingsAction,
mNavigationCarSurface,
uri.getQueryParameter("q")),
(obj) -> {
if (obj != null) {
// Need to copy over each element to satisfy Java type safety.
List<?> results = (List<?>) obj;
List<Instruction> instructions = new ArrayList<Instruction>();
for (Object result : results) {
instructions.add((Instruction) result);
}
executeScript(instructions);
}
});
return;
}
// Process the intent from DeepLinkNotificationReceiver. Bring the routing screen back to
// the
// top if any other screens were pushed onto it.
Uri uri = intent.getData();
if (uri != null
&& URI_SCHEME.equals(uri.getScheme())
&& URI_HOST.equals(uri.getSchemeSpecificPart())) {
Screen top = screenManager.getTop();
switch (uri.getFragment()) {
case NavigationService.DEEP_LINK_ACTION:
if (!(top instanceof NavigationScreen)) {
screenManager.popToRoot();
}
break;
default:
// No-op
}
}
}