various fixes
- Commit
31bacfc57f0412696c6aabc9aaa45ca92747edd5- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-23 05:48 UTC (2 months ago)
- Parents
a7c75ab
Diff
Cargo.lock
diff --git a/Cargo.lock b/Cargo.lockindex 237bef2efd..2b5d75c0cf 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2110,6 +2110,7 @@ dependencies = [ "ash", "jni", "jni_http",+ "memmap2", "png", "serde_json", "sha2 0.11.0",@@ -2150,6 +2151,15 @@ version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +[[package]]+name = "memmap2"+version = "0.9.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0"+dependencies = [+ "libc",+]+ [[package]] name = "minimal-lexical" version = "0.2.1"
MmTelFeature.java
diff --git a/MmTelFeature.java b/MmTelFeature.javanew file mode 100644index 0000000000..c6b11d7b9c--- /dev/null+++ b/MmTelFeature.java@@ -0,0 +1,1941 @@+/*+ * 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.telephony.ims.feature;++import static com.android.internal.telephony.flags.Flags.FLAG_SUPPORT_IMS_MMTEL_INTERFACE;++import android.annotation.CallbackExecutor;+import android.annotation.FlaggedApi;+import android.annotation.IntDef;+import android.annotation.NonNull;+import android.annotation.Nullable;+import android.annotation.SystemApi;+import android.os.Binder;+import android.os.Bundle;+import android.os.Message;+import android.os.RemoteException;+import android.os.ServiceSpecificException;+import android.telecom.TelecomManager;+import android.telephony.AccessNetworkConstants;+import android.telephony.ims.ImsCallProfile;+import android.telephony.ims.ImsCallSession;+import android.telephony.ims.ImsCallSessionListener;+import android.telephony.ims.ImsException;+import android.telephony.ims.ImsReasonInfo;+import android.telephony.ims.ImsService;+import android.telephony.ims.MediaQualityStatus;+import android.telephony.ims.MediaThreshold;+import android.telephony.ims.RtpHeaderExtensionType;+import android.telephony.ims.SrvccCall;+import android.telephony.ims.aidl.IImsCallSessionListener;+import android.telephony.ims.aidl.IImsCapabilityCallback;+import android.telephony.ims.aidl.IImsMmTelFeature;+import android.telephony.ims.aidl.IImsMmTelListener;+import android.telephony.ims.aidl.IImsSmsListener;+import android.telephony.ims.aidl.IImsTrafficSessionCallback;+import android.telephony.ims.aidl.ISrvccStartedCallback;+import android.telephony.ims.stub.ImsCallSessionImplBase;+import android.telephony.ims.stub.ImsEcbmImplBase;+import android.telephony.ims.stub.ImsMultiEndpointImplBase;+import android.telephony.ims.stub.ImsRegistrationImplBase;+import android.telephony.ims.stub.ImsSmsImplBase;+import android.telephony.ims.stub.ImsUtImplBase;+import android.util.ArraySet;+import android.util.Log;++import com.android.ims.internal.IImsCallSession;+import com.android.ims.internal.IImsEcbm;+import com.android.ims.internal.IImsMultiEndpoint;+import com.android.ims.internal.IImsUt;+import com.android.internal.telephony.util.TelephonyUtils;+import com.android.server.telecom.flags.Flags;++import java.lang.annotation.Retention;+import java.lang.annotation.RetentionPolicy;+import java.lang.ref.WeakReference;+import java.util.HashMap;+import java.util.List;+import java.util.Set;+import java.util.concurrent.CancellationException;+import java.util.concurrent.CompletableFuture;+import java.util.concurrent.CompletionException;+import java.util.concurrent.ExecutionException;+import java.util.concurrent.Executor;+import java.util.concurrent.atomic.AtomicInteger;+import java.util.concurrent.atomic.AtomicReference;+import java.util.function.Consumer;+import java.util.function.Supplier;++/**+ * Base implementation for Voice and SMS (IR-92) and Video (IR-94) IMS support.+ *+ * Any class wishing to use MmTelFeature should extend this class and implement all methods that the+ * service supports.+ */+public class MmTelFeature extends ImsFeature {++ private static final String LOG_TAG = "MmTelFeature";+ private Executor mExecutor;+ private ImsSmsImplBase mSmsImpl;++ private HashMap<ImsTrafficSessionCallback, ImsTrafficSessionCallbackWrapper> mTrafficCallbacks =+ new HashMap<>();+ /**+ * Creates a new MmTelFeature using the Executor set in {@link ImsService#getExecutor}+ * @hide+ */+ @SystemApi+ public MmTelFeature() {+ }++ /**+ * Create a new MmTelFeature using the Executor specified for methods being called by the+ * framework.+ * @param executor The executor for the framework to use when executing the methods overridden+ * by the implementation of MmTelFeature.+ * @hide+ */+ @SystemApi+ public MmTelFeature(@NonNull Executor executor) {+ super();+ mExecutor = executor;+ }++ private final IImsMmTelFeature mImsMMTelBinder = new IImsMmTelFeature.Stub() {++ @Override+ public void setListener(IImsMmTelListener l) {+ executeMethodAsyncNoException(() -> MmTelFeature.this.setListener(l), "setListener");+ }++ @Override+ public int getFeatureState() throws RemoteException {+ return executeMethodAsyncForResult(() -> MmTelFeature.this.getFeatureState(),+ "getFeatureState");+ }++ @Override+ public ImsCallProfile createCallProfile(int callSessionType, int callType)+ throws RemoteException {+ return executeMethodAsyncForResult(() -> MmTelFeature.this.createCallProfile(+ callSessionType, callType), "createCallProfile");+ }++ @Override+ public void changeOfferedRtpHeaderExtensionTypes(List<RtpHeaderExtensionType> types)+ throws RemoteException {+ executeMethodAsync(() -> MmTelFeature.this.changeOfferedRtpHeaderExtensionTypes(+ new ArraySet<>(types)), "changeOfferedRtpHeaderExtensionTypes");+ }++ @Override+ public IImsCallSession createCallSession(ImsCallProfile profile) throws RemoteException {+ AtomicReference<RemoteException> exceptionRef = new AtomicReference<>();+ IImsCallSession result = executeMethodAsyncForResult(() -> {+ try {+ return createCallSessionInterface(profile);+ } catch (RemoteException e) {+ exceptionRef.set(e);+ return null;+ }+ }, "createCallSession");++ if (exceptionRef.get() != null) {+ throw exceptionRef.get();+ }++ return result;+ }++ @Override+ public int shouldProcessCall(String[] numbers) {+ Integer result = executeMethodAsyncForResultNoException(() ->+ MmTelFeature.this.shouldProcessCall(numbers), "shouldProcessCall");+ if (result != null) {+ return result.intValue();+ } else {+ return PROCESS_CALL_CSFB;+ }+ }++ @Override+ public IImsUt getUtInterface() throws RemoteException {+ AtomicReference<RemoteException> exceptionRef = new AtomicReference<>();+ IImsUt result = executeMethodAsyncForResult(() -> {+ try {+ return MmTelFeature.this.getUtInterface();+ } catch (RemoteException e) {+ exceptionRef.set(e);+ return null;+ }+ }, "getUtInterface");++ if (exceptionRef.get() != null) {+ throw exceptionRef.get();+ }++ return result;+ }++ @Override+ public IImsEcbm getEcbmInterface() throws RemoteException {+ AtomicReference<RemoteException> exceptionRef = new AtomicReference<>();+ IImsEcbm result = executeMethodAsyncForResult(() -> {+ try {+ return MmTelFeature.this.getEcbmInterface();+ } catch (RemoteException e) {+ exceptionRef.set(e);+ return null;+ }+ }, "getEcbmInterface");++ if (exceptionRef.get() != null) {+ throw exceptionRef.get();+ }++ return result;+ }++ @Override+ public void setUiTtyMode(int uiTtyMode, Message onCompleteMessage) throws RemoteException {+ executeMethodAsync(() -> MmTelFeature.this.setUiTtyMode(uiTtyMode, onCompleteMessage),+ "setUiTtyMode");+ }++ @Override+ public IImsMultiEndpoint getMultiEndpointInterface() throws RemoteException {+ AtomicReference<RemoteException> exceptionRef = new AtomicReference<>();+ IImsMultiEndpoint result = executeMethodAsyncForResult(() -> {+ try {+ return MmTelFeature.this.getMultiEndpointInterface();+ } catch (RemoteException e) {+ exceptionRef.set(e);+ return null;+ }+ }, "getMultiEndpointInterface");++ if (exceptionRef.get() != null) {+ throw exceptionRef.get();+ }++ return result;+ }++ @Override+ public int queryCapabilityStatus() {+ Integer result = executeMethodAsyncForResultNoException(() -> MmTelFeature.this+ .queryCapabilityStatus().mCapabilities, "queryCapabilityStatus");++ if (result != null) {+ return result.intValue();+ } else {+ return 0;+ }+ }++ @Override+ public void addCapabilityCallback(IImsCapabilityCallback c) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .addCapabilityCallback(c), "addCapabilityCallback");+ }++ @Override+ public void removeCapabilityCallback(IImsCapabilityCallback c) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .removeCapabilityCallback(c), "removeCapabilityCallback");+ }++ @Override+ public void changeCapabilitiesConfiguration(CapabilityChangeRequest request,+ IImsCapabilityCallback c) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .requestChangeEnabledCapabilities(request, c),+ "changeCapabilitiesConfiguration");+ }++ @Override+ public void queryCapabilityConfiguration(int capability, int radioTech,+ IImsCapabilityCallback c) {+ executeMethodAsyncNoException(() -> queryCapabilityConfigurationInternal(+ capability, radioTech, c), "queryCapabilityConfiguration");+ }++ @Override+ public void setMediaQualityThreshold(@MediaQualityStatus.MediaSessionType int sessionType,+ MediaThreshold mediaThreshold) {+ if (mediaThreshold != null) {+ executeMethodAsyncNoException(() -> setMediaThreshold(sessionType, mediaThreshold),+ "setMediaQualityThreshold");+ } else {+ executeMethodAsyncNoException(() -> clearMediaThreshold(sessionType),+ "clearMediaQualityThreshold");+ }+ }++ @Override+ public MediaQualityStatus queryMediaQualityStatus(+ @MediaQualityStatus.MediaSessionType int sessionType)+ throws RemoteException {+ return executeMethodAsyncForResult(() -> MmTelFeature.this.queryMediaQualityStatus(+ sessionType), "queryMediaQualityStatus");+ }++ @Override+ public void setSmsListener(IImsSmsListener l) {+ executeMethodAsyncNoException(() -> MmTelFeature.this.setSmsListener(l),+ "setSmsListener", getImsSmsImpl().getExecutor());+ }++ @Override+ public void sendSms(int token, int messageRef, String format, String smsc, boolean retry,+ byte[] pdu) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .sendSms(token, messageRef, format, smsc, retry, pdu), "sendSms",+ getImsSmsImpl().getExecutor());+ }++ @Override+ public void onMemoryAvailable(int token) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .onMemoryAvailable(token), "onMemoryAvailable", getImsSmsImpl().getExecutor());+ }++ @Override+ public void acknowledgeSms(int token, int messageRef, int result) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .acknowledgeSms(token, messageRef, result), "acknowledgeSms",+ getImsSmsImpl().getExecutor());+ }++ @Override+ public void acknowledgeSmsWithPdu(int token, int messageRef, int result, byte[] pdu) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .acknowledgeSms(token, messageRef, result, pdu), "acknowledgeSms",+ getImsSmsImpl().getExecutor());+ }++ @Override+ public void acknowledgeSmsReport(int token, int messageRef, int result) {+ executeMethodAsyncNoException(() -> MmTelFeature.this+ .acknowledgeSmsReport(token, messageRef, result), "acknowledgeSmsReport",+ getImsSmsImpl().getExecutor());+ }++ @Override+ public String getSmsFormat() {+ return executeMethodAsyncForResultNoException(() -> MmTelFeature.this+ .getSmsFormat(), "getSmsFormat", getImsSmsImpl().getExecutor());+ }++ @Override+ public void onSmsReady() {+ executeMethodAsyncNoException(() -> MmTelFeature.this.onSmsReady(),+ "onSmsReady", getImsSmsImpl().getExecutor());+ }++ @Override+ public void notifySrvccStarted(final ISrvccStartedCallback cb) {+ executeMethodAsyncNoException(+ () -> MmTelFeature.this.notifySrvccStarted(+ (profiles) -> {+ try {+ cb.onSrvccCallNotified(profiles);+ } catch (Exception e) {+ Log.e(LOG_TAG, "onSrvccCallNotified e=" + e);+ }+ }),+ "notifySrvccStarted");+ }++ @Override+ public void notifySrvccCompleted() {+ executeMethodAsyncNoException(+ () -> MmTelFeature.this.notifySrvccCompleted(), "notifySrvccCompleted");+ }++ @Override+ public void notifySrvccFailed() {+ executeMethodAsyncNoException(+ () -> MmTelFeature.this.notifySrvccFailed(), "notifySrvccFailed");+ }++ @Override+ public void notifySrvccCanceled() {+ executeMethodAsyncNoException(+ () -> MmTelFeature.this.notifySrvccCanceled(), "notifySrvccCanceled");+ }++ @Override+ public void setTerminalBasedCallWaitingStatus(boolean enabled) throws RemoteException {+ synchronized (mLock) {+ try {+ MmTelFeature.this.setTerminalBasedCallWaitingStatus(enabled);+ } catch (ServiceSpecificException se) {+ throw new ServiceSpecificException(se.errorCode, se.getMessage());+ } catch (Exception e) {+ throw new RemoteException(e.getMessage());+ }+ }+ }++ // Call the methods with a clean calling identity on the executor and wait indefinitely for+ // the future to return.+ private void executeMethodAsync(Runnable r, String errorLogName) throws RemoteException {+ try {+ CompletableFuture.runAsync(+ () -> TelephonyUtils.runWithCleanCallingIdentity(r), mExecutor).join();+ } catch (CancellationException | CompletionException e) {+ Log.w(LOG_TAG, "MmTelFeature Binder - " + errorLogName + " exception: "+ + e.getMessage());+ throw new RemoteException(e.getMessage());+ }+ }++ private void executeMethodAsyncNoException(Runnable r, String errorLogName) {+ try {+ CompletableFuture.runAsync(+ () -> TelephonyUtils.runWithCleanCallingIdentity(r), mExecutor).join();+ } catch (CancellationException | CompletionException e) {+ Log.w(LOG_TAG, "MmTelFeature Binder - " + errorLogName + " exception: "+ + e.getMessage());+ }+ }++ private void executeMethodAsyncNoException(Runnable r, String errorLogName,+ Executor executor) {+ try {+ CompletableFuture.runAsync(+ () -> TelephonyUtils.runWithCleanCallingIdentity(r), executor).join();+ } catch (CancellationException | CompletionException e) {+ Log.w(LOG_TAG, "MmTelFeature Binder - " + errorLogName + " exception: "+ + e.getMessage());+ }+ }++ private <T> T executeMethodAsyncForResult(Supplier<T> r,+ String errorLogName) throws RemoteException {+ CompletableFuture<T> future = CompletableFuture.supplyAsync(+ () -> TelephonyUtils.runWithCleanCallingIdentity(r), mExecutor);+ try {+ return future.get();+ } catch (ExecutionException | InterruptedException e) {+ Log.w(LOG_TAG, "MmTelFeature Binder - " + errorLogName + " exception: "+ + e.getMessage());+ throw new RemoteException(e.getMessage());+ }+ }++ private <T> T executeMethodAsyncForResultNoException(Supplier<T> r,+ String errorLogName) {+ CompletableFuture<T> future = CompletableFuture.supplyAsync(+ () -> TelephonyUtils.runWithCleanCallingIdentity(r), mExecutor);+ try {+ return future.get();+ } catch (ExecutionException | InterruptedException e) {+ Log.w(LOG_TAG, "MmTelFeature Binder - " + errorLogName + " exception: "+ + e.getMessage());+ return null;+ }+ }++ private <T> T executeMethodAsyncForResultNoException(Supplier<T> r,+ String errorLogName, Executor executor) {+ CompletableFuture<T> future = CompletableFuture.supplyAsync(+ () -> TelephonyUtils.runWithCleanCallingIdentity(r), executor);+ try {+ return future.get();+ } catch (ExecutionException | InterruptedException e) {+ Log.w(LOG_TAG, "MmTelFeature Binder - " + errorLogName + " exception: "+ + e.getMessage());+ return null;+ }+ }+ };++ /**+ * Contains the capabilities defined and supported by a MmTelFeature in the form of a Bitmask.+ * The capabilities that are used in MmTelFeature are defined as+ * {@link MmTelCapabilities#CAPABILITY_TYPE_VOICE},+ * {@link MmTelCapabilities#CAPABILITY_TYPE_VIDEO},+ * {@link MmTelCapabilities#CAPABILITY_TYPE_UT},+ * {@link MmTelCapabilities#CAPABILITY_TYPE_SMS}, and+ * {@link MmTelCapabilities#CAPABILITY_TYPE_CALL_COMPOSER}.+ *+ * The capabilities of this MmTelFeature will be set by the framework.+ */+ public static class MmTelCapabilities extends Capabilities {++ /**+ * Create a new empty {@link MmTelCapabilities} instance.+ * @see #addCapabilities(int)+ * @see #removeCapabilities(int)+ * @hide+ */+ @SystemApi+ public MmTelCapabilities() {+ super();+ }++ /**@deprecated Use {@link MmTelCapabilities} to construct a new instance instead.+ * @hide+ */+ @Deprecated+ @SystemApi+ public MmTelCapabilities(Capabilities c) {+ mCapabilities = c.mCapabilities;+ }++ /**+ * Create a new {link @MmTelCapabilities} instance with the provided capabilities.+ * @param capabilities The capabilities that are supported for MmTel in the form of a+ * bitfield.+ * @hide+ */+ @SystemApi+ public MmTelCapabilities(@MmTelCapability int capabilities) {+ super(capabilities);+ }++ /** @hide */+ @IntDef(flag = true,+ value = {+ CAPABILITY_TYPE_VOICE,+ CAPABILITY_TYPE_VIDEO,+ CAPABILITY_TYPE_UT,+ CAPABILITY_TYPE_SMS,+ CAPABILITY_TYPE_CALL_COMPOSER,+ CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY+ })+ @Retention(RetentionPolicy.SOURCE)+ public @interface MmTelCapability {}++ /**+ * Undefined capability type for initialization+ * This is used to check the upper range of MmTel capability+ * @hide+ */+ public static final int CAPABILITY_TYPE_NONE = 0;++ /**+ * This MmTelFeature supports Voice calling (IR.92)+ */+ public static final int CAPABILITY_TYPE_VOICE = 1 << 0;++ /**+ * This MmTelFeature supports Video (IR.94)+ */+ public static final int CAPABILITY_TYPE_VIDEO = 1 << 1;++ /**+ * This MmTelFeature supports XCAP over Ut for supplementary services. (IR.92)+ */+ public static final int CAPABILITY_TYPE_UT = 1 << 2;++ /**+ * This MmTelFeature supports SMS (IR.92)+ */+ public static final int CAPABILITY_TYPE_SMS = 1 << 3;++ /**+ * This MmTelFeature supports Call Composer (section 2.4 of RC.20). This is the superset+ * Call Composer, meaning that all subset types of Call Composers must be enabled when this+ * capability is enabled+ */+ public static final int CAPABILITY_TYPE_CALL_COMPOSER = 1 << 4;+++ /**+ * This MmTelFeature supports Business-only Call Composer. This is a subset of+ * {@code CAPABILITY_TYPE_CALL_COMPOSER} that only supports business related+ * information for calling (e.g. information to signal if the call is a business call) in+ * the SIP header. When enabling {@code CAPABILITY_TYPE_CALL_COMPOSER}, the+ * {@code CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY} capability must also be enabled.+ */+ @FlaggedApi(Flags.FLAG_BUSINESS_CALL_COMPOSER)+ public static final int CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY = 1 << 5;++ /**+ * This is used to check the upper range of MmTel capability+ * @hide+ */+ public static final int CAPABILITY_TYPE_MAX =+ CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY + 1;++ /**+ * @hide+ */+ @Override+ @SystemApi+ public final void addCapabilities(@MmTelCapability int capabilities) {+ super.addCapabilities(capabilities);+ }++ /**+ * @hide+ */+ @Override+ @SystemApi+ public final void removeCapabilities(@MmTelCapability int capability) {+ super.removeCapabilities(capability);+ }++ /**+ * @param capabilities a bitmask of one or more capabilities.+ *+ * @return true if all queried capabilities are true, otherwise false.+ */+ @Override+ public final boolean isCapable(@MmTelCapability int capabilities) {+ return super.isCapable(capabilities);+ }++ /**+ * @hide+ */+ @NonNull+ @Override+ public String toString() {+ StringBuilder builder = new StringBuilder("MmTel Capabilities - [");+ builder.append("Voice: ");+ builder.append(isCapable(CAPABILITY_TYPE_VOICE));+ builder.append(" Video: ");+ builder.append(isCapable(CAPABILITY_TYPE_VIDEO));+ builder.append(" UT: ");+ builder.append(isCapable(CAPABILITY_TYPE_UT));+ builder.append(" SMS: ");+ builder.append(isCapable(CAPABILITY_TYPE_SMS));+ builder.append(" CALL_COMPOSER: ");+ builder.append(isCapable(CAPABILITY_TYPE_CALL_COMPOSER));+ builder.append(" BUSINESS_COMPOSER_ONLY: ");+ builder.append(isCapable(CAPABILITY_TYPE_CALL_COMPOSER_BUSINESS_ONLY));+ builder.append("]");+ return builder.toString();+ }+ }++ /**+ * Listener that the framework implements for communication from the MmTelFeature.+ * @hide+ */+ public static class Listener extends IImsMmTelListener.Stub {++ /**+ * Called when the IMS provider receives an incoming call.+ * @param c The {@link ImsCallSession} associated with the new call.+ * @param callId The call ID of the session of the new incoming call.+ * @param extras A bundle containing extra parameters related to the call. See+ * {@link #EXTRA_IS_UNKNOWN_CALL} and {@link #EXTRA_IS_USSD} above.+ * @return the listener to listen to the session events. An {@link ImsCallSession} can only+ * hold one listener at a time. see {@link ImsCallSessionListener}.+ * If this method returns {@code null}, then the call could not be placed.+ * @hide+ */+ @Override+ @Nullable+ public IImsCallSessionListener onIncomingCall(IImsCallSession c,+ String callId, Bundle extras) {+ return null;+ }++ /**+ * Called when the IMS provider implicitly rejects an incoming call during setup.+ * @param callProfile An {@link ImsCallProfile} with the call details.+ * @param reason The {@link ImsReasonInfo} reason for call rejection.+ * @hide+ */+ @Override+ public void onRejectedCall(ImsCallProfile callProfile, ImsReasonInfo reason) {++ }++ /**+ * Updates the Listener when the voice message count for IMS has changed.+ * @param count an integer representing the new message count.+ * @hide+ */+ @Override+ public void onVoiceMessageCountUpdate(int count) {++ }++ /**+ * Called to set the audio handler for this connection.+ * @param imsAudioHandler an {@link ImsAudioHandler} used to handle the audio+ * for this IMS call.+ * @hide+ */+ @Override+ public void onAudioModeIsVoipChanged(int imsAudioHandler) {++ }++ /**+ * Called when the IMS triggers EPS fallback procedure.+ *+ * @param reason specifies the reason that causes EPS fallback.+ * @hide+ */+ @Override+ public void onTriggerEpsFallback(@EpsFallbackReason int reason) {++ }++ /**+ * Called when the IMS notifies the upcoming traffic type to the radio.+ *+ * @param token A nonce to identify the request+ * @param trafficType The {@link ImsTrafficType} type for IMS traffic.+ * @param accessNetworkType The {@link AccessNetworkConstants#RadioAccessNetworkType}+ * type of the radio access network.+ * @param trafficDirection Indicates whether traffic is originated by mobile originated or+ * mobile terminated use case eg. MO/MT call/SMS etc.+ * @param callback The callback to receive the result.+ * @hide+ */+ @Override+ public void onStartImsTrafficSession(int token,+ @ImsTrafficType int trafficType,+ @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType,+ @ImsTrafficDirection int trafficDirection,+ IImsTrafficSessionCallback callback) {++ }++ /**+ * Called when the IMS notifies the traffic type has been stopped.+ *+ * @param token A nonce registered with {@link #onStartImsTrafficSession}.+ * @param accessNetworkType The {@link AccessNetworkConstants#RadioAccessNetworkType}+ * type of the radio access network.+ * @hide+ */+ @Override+ public void onModifyImsTrafficSession(int token,+ @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType) {++ }++ /**+ * Called when the IMS notifies the traffic type has been stopped.+ *+ * @param token A nonce registered with {@link #onStartImsTrafficSession}.+ * @hide+ */+ @Override+ public void onStopImsTrafficSession(int token) {++ }++ /**+ * Called when the IMS provider notifies {@link MediaQualityStatus}.+ *+ * @param status media quality status currently measured.+ * @hide+ */+ @Override+ public void onMediaQualityStatusChanged(MediaQualityStatus status) {++ }+ }++ /**+ * A wrapper class of {@link ImsTrafficSessionCallback}.+ * @hide+ */+ public static class ImsTrafficSessionCallbackWrapper {+ public static final int INVALID_TOKEN = -1;++ private static final int MAX_TOKEN = 0x10000;++ private static final AtomicInteger sTokenGenerator = new AtomicInteger();++ /** Callback to receive the response */+ private IImsTrafficSessionCallbackStub mCallback = null;+ /** Identifier to distinguish each IMS traffic request */+ private int mToken = INVALID_TOKEN;++ private ImsTrafficSessionCallback mImsTrafficSessionCallback;++ private ImsTrafficSessionCallbackWrapper(ImsTrafficSessionCallback callback) {+ mImsTrafficSessionCallback = callback;+ }++ /**+ * Updates the callback.+ *+ * The mToken should be kept since it is used to identify the traffic notified to the modem+ * until calling {@link MmtelFEature#stopImsTrafficSession}.+ */+ final void update(@NonNull @CallbackExecutor Executor executor) {+ if (executor == null) {+ throw new IllegalArgumentException(+ "ImsTrafficSessionCallback Executor must be non-null");+ }++ if (mCallback == null) {+ // initial start of Ims traffic.+ mCallback = new IImsTrafficSessionCallbackStub(+ mImsTrafficSessionCallback, executor);+ mToken = generateToken();+ } else {+ // handover between cellular and Wi-Fi+ mCallback.update(executor);+ }+ }++ /**+ * Using a static class and weak reference here to avoid memory leak caused by the+ * {@link IImsTrafficSessionCallback.Stub} callback retaining references to the outside+ * {@link ImsTrafficSessionCallback}.+ */+ private static class IImsTrafficSessionCallbackStub+ extends IImsTrafficSessionCallback.Stub {+ private WeakReference<ImsTrafficSessionCallback> mImsTrafficSessionCallbackWeakRef;+ private Executor mExecutor;++ IImsTrafficSessionCallbackStub(ImsTrafficSessionCallback imsTrafficCallback,+ Executor executor) {+ mImsTrafficSessionCallbackWeakRef =+ new WeakReference<ImsTrafficSessionCallback>(imsTrafficCallback);+ mExecutor = executor;+ }++ void update(Executor executor) {+ mExecutor = executor;+ }++ @Override+ public void onReady() {+ ImsTrafficSessionCallback callback = mImsTrafficSessionCallbackWeakRef.get();+ if (callback == null) return;++ Binder.withCleanCallingIdentity(+ () -> mExecutor.execute(() -> callback.onReady()));+ }++ @Override+ public void onError(ConnectionFailureInfo info) {+ ImsTrafficSessionCallback callback = mImsTrafficSessionCallbackWeakRef.get();+ if (callback == null) return;++ Binder.withCleanCallingIdentity(+ () -> mExecutor.execute(() -> callback.onError(info)));+ }+ }++ /**+ * Returns the callback binder.+ */+ final IImsTrafficSessionCallbackStub getCallbackBinder() {+ return mCallback;+ }++ /**+ * Returns the token.+ */+ final int getToken() {+ return mToken;+ }++ /**+ * Resets the members.+ * It's called by {@link MmTelFeature#stopImsTrafficSession}.+ */+ final void reset() {+ mCallback = null;+ mToken = INVALID_TOKEN;+ }++ private static int generateToken() {+ int token = sTokenGenerator.incrementAndGet();+ if (token == MAX_TOKEN) sTokenGenerator.set(0);+ return token;+ }+ }++ /**+ * To be returned by {@link #shouldProcessCall(String[])} when the ImsService should process the+ * outgoing call as IMS.+ * @hide+ */+ @SystemApi+ public static final int PROCESS_CALL_IMS = 0;+ /**+ * To be returned by {@link #shouldProcessCall(String[])} when the telephony framework should+ * not process the outgoing call as IMS and should instead use circuit switch.+ * @hide+ */+ @SystemApi+ public static final int PROCESS_CALL_CSFB = 1;++ /** @hide */+ @IntDef(flag = true,+ value = {+ PROCESS_CALL_IMS,+ PROCESS_CALL_CSFB+ })+ @Retention(RetentionPolicy.SOURCE)+ public @interface ProcessCallResult {}++ /**+ * If the flag is present and true, it indicates that the incoming call is for USSD.+ * <p>+ * This is an optional boolean flag.+ * @hide+ */+ @SystemApi+ public static final String EXTRA_IS_USSD = "android.telephony.ims.feature.extra.IS_USSD";++ /**+ * If this flag is present and true, this call is marked as an unknown dialing call instead+ * of an incoming call. An example of such a call is a call that is originated by sending+ * commands (like AT commands) directly to the modem without Android involvement or dialing+ * calls appearing over IMS when the modem does a silent redial from circuit-switched to IMS in+ * certain situations.+ * <p>+ * This is an optional boolean flag.+ * @hide+ */+ @SystemApi+ public static final String EXTRA_IS_UNKNOWN_CALL =+ "android.telephony.ims.feature.extra.IS_UNKNOWN_CALL";++ /** @hide */+ @IntDef(+ prefix = "AUDIO_HANDLER_",+ value = {+ AUDIO_HANDLER_ANDROID,+ AUDIO_HANDLER_BASEBAND+ })+ @Retention(RetentionPolicy.SOURCE)+ public @interface ImsAudioHandler {}++ /**+ * Audio Handler - Android+ * @hide+ */+ @SystemApi+ public static final int AUDIO_HANDLER_ANDROID = 0;++ /**+ * Audio Handler - Baseband+ * @hide+ */+ @SystemApi+ public static final int AUDIO_HANDLER_BASEBAND = 1;++ /** @hide */+ @Retention(RetentionPolicy.SOURCE)+ @IntDef(+ prefix = "EPS_FALLBACK_REASON_",+ value = {+ EPS_FALLBACK_REASON_INVALID,+ EPS_FALLBACK_REASON_NO_NETWORK_TRIGGER,+ EPS_FALLBACK_REASON_NO_NETWORK_RESPONSE,+ })+ public @interface EpsFallbackReason {}++ /**+ * Default value. Internal use only.+ * This value should not be used to trigger EPS fallback.+ * @hide+ */+ public static final int EPS_FALLBACK_REASON_INVALID = -1;++ /**+ * If the network only supports the EPS fallback in 5G NR SA for voice calling and the EPS+ * Fallback procedure by the network during the call setup is not triggered, UE initiated+ * fallback will be triggered with this reason. The modem shall locally release the 5G NR+ * SA RRC connection and acquire the LTE network and perform a tracking area update+ * procedure. After the EPS fallback procedure is completed, the call setup for voice will+ * be established if there is no problem.+ *+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int EPS_FALLBACK_REASON_NO_NETWORK_TRIGGER = 1;++ /**+ * If the UE doesn't receive any response for SIP INVITE within a certain timeout in 5G NR+ * SA for MO voice calling, the device determines that voice call is not available in 5G and+ * terminates all active SIP dialogs and SIP requests and enters IMS non-registered state.+ * In that case, UE initiated fallback will be triggered with this reason. The modem shall+ * reset modem's data buffer of IMS PDU to prevent the ghost call. After the EPS fallback+ * procedure is completed, VoLTE call could be tried if there is no problem.+ *+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int EPS_FALLBACK_REASON_NO_NETWORK_RESPONSE = 2;++ /** @hide */+ @Retention(RetentionPolicy.SOURCE)+ @IntDef(+ prefix = "IMS_TRAFFIC_TYPE_",+ value = {+ IMS_TRAFFIC_TYPE_NONE,+ IMS_TRAFFIC_TYPE_EMERGENCY,+ IMS_TRAFFIC_TYPE_EMERGENCY_SMS,+ IMS_TRAFFIC_TYPE_VOICE,+ IMS_TRAFFIC_TYPE_VIDEO,+ IMS_TRAFFIC_TYPE_SMS,+ IMS_TRAFFIC_TYPE_REGISTRATION,+ IMS_TRAFFIC_TYPE_UT_XCAP+ })+ public @interface ImsTrafficType {}++ /**+ * Default value for initialization. Internal use only.+ * @hide+ */+ public static final int IMS_TRAFFIC_TYPE_NONE = -1;+ /**+ * Emergency call+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_TYPE_EMERGENCY = 0;+ /**+ * Emergency SMS+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_TYPE_EMERGENCY_SMS = 1;+ /**+ * Voice call+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_TYPE_VOICE = 2;+ /**+ * Video call+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_TYPE_VIDEO = 3;+ /**+ * SMS over IMS+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_TYPE_SMS = 4;+ /**+ * IMS registration and subscription for reg event package (signaling)+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_TYPE_REGISTRATION = 5;+ /**+ * Ut/XCAP (XML Configuration Access Protocol)+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_TYPE_UT_XCAP = 6;++ /** @hide */+ @Retention(RetentionPolicy.SOURCE)+ @IntDef(+ prefix = { "IMS_TRAFFIC_DIRECTION_" },+ value = {IMS_TRAFFIC_DIRECTION_INCOMING, IMS_TRAFFIC_DIRECTION_OUTGOING})+ public @interface ImsTrafficDirection {}++ /**+ * Indicates that the traffic is an incoming traffic.+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_DIRECTION_INCOMING = 0;+ /**+ * Indicates that the traffic is an outgoing traffic.+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public static final int IMS_TRAFFIC_DIRECTION_OUTGOING = 1;++ private IImsMmTelListener mListener;++ /**+ * @param listener A {@link Listener} used when the MmTelFeature receives an incoming call and+ * notifies the framework.+ */+ private void setListener(IImsMmTelListener listener) {+ synchronized (mLock) {+ mListener = listener;+ if (mListener != null) {+ onFeatureReady();+ }+ }+ }++ /**+ * @return the listener associated with this MmTelFeature. May be null if it has not been set+ * by the framework yet.+ */+ private IImsMmTelListener getListener() {+ synchronized (mLock) {+ return mListener;+ }+ }++ /**+ * The current capability status that this MmTelFeature has defined is available. This+ * configuration will be used by the platform to figure out which capabilities are CURRENTLY+ * available to be used.+ *+ * Should be a subset of the capabilities that are enabled by the framework in+ * {@link #changeEnabledCapabilities}.+ * @return A copy of the current MmTelFeature capability status.+ * @hide+ */+ @Override+ @SystemApi+ public @NonNull final MmTelCapabilities queryCapabilityStatus() {+ return new MmTelCapabilities(super.queryCapabilityStatus());+ }++ /**+ * Notify the framework that the status of the Capabilities has changed. Even though the+ * MmTelFeature capability may be enabled by the framework, the status may be disabled due to+ * the feature being unavailable from the network.+ * @param c The current capability status of the MmTelFeature. If a capability is disabled, then+ * the status of that capability is disabled. This can happen if the network does not currently+ * support the capability that is enabled. A capability that is disabled by the framework (via+ * {@link #changeEnabledCapabilities}) should also show the status as disabled.+ * @hide+ */+ @SystemApi+ public final void notifyCapabilitiesStatusChanged(@NonNull MmTelCapabilities c) {+ if (c == null) {+ throw new IllegalArgumentException("MmTelCapabilities must be non-null!");+ }+ super.notifyCapabilitiesStatusChanged(c);+ }++ /**+ * Notify the framework that the measured media quality has crossed a threshold set by {@link+ * MmTelFeature#setMediaThreshold}+ *+ * @param status current media quality status measured.+ * @hide+ */+ @SystemApi+ public final void notifyMediaQualityStatusChanged(+ @NonNull MediaQualityStatus status) {+ if (status == null) {+ throw new IllegalArgumentException(+ "MediaQualityStatus must be non-null!");+ }+ Log.i(LOG_TAG, "notifyMediaQualityStatusChanged " + status);+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ listener.onMediaQualityStatusChanged(status);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Notify the framework of an incoming call.+ * @param c The {@link ImsCallSessionImplBase} of the new incoming call.+ * @param extras A bundle containing extra parameters related to the call. See+ * {@link #EXTRA_IS_UNKNOWN_CALL} and {@link #EXTRA_IS_USSD} above.+ * @hide+ *+ * @deprecated use {@link #notifyIncomingCall(ImsCallSessionImplBase, String, Bundle)} instead+ */+ @Deprecated+ @SystemApi+ public final void notifyIncomingCall(@NonNull ImsCallSessionImplBase c,+ @NonNull Bundle extras) {+ if (c == null || extras == null) {+ throw new IllegalArgumentException("ImsCallSessionImplBase and Bundle can not be "+ + "null.");+ }+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ c.setDefaultExecutor(MmTelFeature.this.mExecutor);+ listener.onIncomingCall(c.getServiceImpl(), null, extras);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Notify the framework of an incoming call.+ * @param c The {@link ImsCallSessionImplBase} of the new incoming call.+ * @param callId The call ID of the session of the new incoming call.+ * @param extras A bundle containing extra parameters related to the call. See+ * {@link #EXTRA_IS_UNKNOWN_CALL} and {@link #EXTRA_IS_USSD} above.+ * @return The listener used by the framework to listen to call session events created+ * from the ImsService.+ * If this method returns {@code null}, then the call could not be placed.+ * @hide+ */+ @SystemApi+ @Nullable+ public final ImsCallSessionListener notifyIncomingCall(+ @NonNull ImsCallSessionImplBase c, @NonNull String callId, @NonNull Bundle extras) {+ if (c == null || callId == null || extras == null) {+ throw new IllegalArgumentException("ImsCallSessionImplBase, callId, and Bundle can "+ + "not be null.");+ }+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ c.setDefaultExecutor(MmTelFeature.this.mExecutor);+ IImsCallSessionListener isl =+ listener.onIncomingCall(c.getServiceImpl(), callId, extras);+ if (isl != null) {+ ImsCallSessionListener iCSL = new ImsCallSessionListener(isl);+ iCSL.setDefaultExecutor(MmTelFeature.this.mExecutor);+ return iCSL;+ } else {+ return null;+ }+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Notify the framework that a call has been implicitly rejected by this MmTelFeature+ * during call setup.+ * @param callProfile The {@link ImsCallProfile} IMS call profile with details.+ * This can be null if no call information is available for the rejected call.+ * @param reason The {@link ImsReasonInfo} call rejection reason.+ * @hide+ */+ @SystemApi+ public final void notifyRejectedCall(@NonNull ImsCallProfile callProfile,+ @NonNull ImsReasonInfo reason) {+ if (callProfile == null || reason == null) {+ throw new IllegalArgumentException("ImsCallProfile and ImsReasonInfo must not be "+ + "null.");+ }+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ listener.onRejectedCall(callProfile, reason);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ *+ * @hide+ */+ public final void notifyIncomingCallSession(IImsCallSession c, Bundle extras) {+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ listener.onIncomingCall(c, null, extras);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Notify the framework of a change in the Voice Message count.+ * @link count the new Voice Message count.+ * @hide+ */+ @SystemApi+ public final void notifyVoiceMessageCountUpdate(int count) {+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ listener.onVoiceMessageCountUpdate(count);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Sets the audio handler for this connection. The vendor IMS stack will invoke this API+ * to inform Telephony/Telecom layers about which audio handlers i.e. either Android or Modem+ * shall be used for handling the IMS call audio.+ *+ * @param imsAudioHandler {@link MmTelFeature#ImsAudioHandler} used to handle the audio+ * for this IMS call.+ * @hide+ */+ @SystemApi+ public final void setCallAudioHandler(@ImsAudioHandler int imsAudioHandler) {+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ listener.onAudioModeIsVoipChanged(imsAudioHandler);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Triggers the EPS fallback procedure.+ *+ * @param reason specifies the reason that EPS fallback was triggered.+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public final void triggerEpsFallback(@EpsFallbackReason int reason) {+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ try {+ listener.onTriggerEpsFallback(reason);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Starts a new IMS traffic session with the framework.+ *+ * This API notifies the NAS and RRC layers of the modem that IMS traffic of type+ * {@link ImsTrafficType} is starting for the IMS session represented by a+ * {@link ImsTrafficSessionCallback}. The {@link ImsTrafficSessionCallback}+ * will notify the caller when IMS traffic is ready to start via the+ * {@link ImsTrafficSessionCallback#onReady()} callback. If there was an error starting+ * IMS traffic for the specified traffic type, {@link ImsTrafficSessionCallback#onError()} will+ * be called, which will also notify the caller of the reason of the failure.+ *+ * If there is a handover that changes the {@link AccessNetworkConstants#RadioAccessNetworkType}+ * of this IMS traffic session, then {@link #modifyImsTrafficSession} should be called. This is+ * used, for example, when a WiFi <-> cellular handover occurs.+ *+ * Once the IMS traffic session is finished, {@link #stopImsTrafficSession} must be called.+ *+ * Note: This API will be used to prioritize RF resources in case of DSDS. The service priority+ * is EMERGENCY > EMERGENCY SMS > VOICE > VIDEO > SMS > REGISTRATION > Ut/XCAP. RF+ * shall be prioritized to the subscription which handles the higher priority service.+ * When both subscriptions are handling the same type of service, then RF shall be+ * prioritized to the voice preferred sub.+ *+ * @param trafficType The {@link ImsTrafficType} type for IMS traffic.+ * @param accessNetworkType The {@link AccessNetworkConstants#RadioAccessNetworkType} type of+ * the radio access network.+ * @param trafficDirection Indicates whether traffic is originated by mobile originated or+ * mobile terminated use case eg. MO/MT call/SMS etc.+ * @param executor The Executor that will be used to call the {@link ImsTrafficSessionCallback}.+ * @param callback The session representing the IMS Session associated with a specific+ * trafficType. This callback instance should only be used for the specified traffic type+ * until {@link #stopImsTrafficSession} is called.+ *+ * @see modifyImsTrafficSession+ * @see stopImsTrafficSession+ *+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public final void startImsTrafficSession(@ImsTrafficType int trafficType,+ @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType,+ @ImsTrafficDirection int trafficDirection,+ @NonNull Executor executor, @NonNull ImsTrafficSessionCallback callback) {+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ // TODO: retrieve from the callback list+ ImsTrafficSessionCallbackWrapper callbackWrapper = mTrafficCallbacks.get(callback);+ if (callbackWrapper == null) {+ callbackWrapper = new ImsTrafficSessionCallbackWrapper(callback);+ mTrafficCallbacks.put(callback, callbackWrapper);+ }+ try {+ callbackWrapper.update(executor);+ listener.onStartImsTrafficSession(callbackWrapper.getToken(),+ trafficType, accessNetworkType, trafficDirection,+ callbackWrapper.getCallbackBinder());+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Modifies an existing IMS traffic session represented by the associated+ * {@link ImsTrafficSessionCallback}.+ *+ * The {@link ImsTrafficSessionCallback} will notify the caller when IMS traffic is ready to+ * start after modification using the {@link ImsTrafficSessionCallback#onReady()} callback.+ * If there was an error modifying IMS traffic for the new radio access network type type,+ * {@link ImsTrafficSessionCallback#onError()} will be called, which will also notify the+ * caller of the reason of the failure.+ *+ * @param accessNetworkType The {@link AccessNetworkConstants#RadioAccessNetworkType} type of+ * the radio access network.+ * @param callback The callback registered with {@link #startImsTrafficSession}.+ *+ * @see startImsTrafficSession+ * @see stopImsTrafficSession+ *+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public final void modifyImsTrafficSession(+ @AccessNetworkConstants.RadioAccessNetworkType int accessNetworkType,+ @NonNull ImsTrafficSessionCallback callback) {+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ ImsTrafficSessionCallbackWrapper callbackWrapper = mTrafficCallbacks.get(callback);+ if (callbackWrapper == null) {+ // should not reach here.+ throw new IllegalStateException("Unknown ImsTrafficSessionCallback instance.");+ }+ try {+ listener.onModifyImsTrafficSession(callbackWrapper.getToken(), accessNetworkType);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Notifies the framework that the IMS traffic session represented by the associated+ * {@link ImsTrafficSessionCallback} has ended.+ *+ * @param callback The callback registered with {@link #startImsTrafficSession}.+ *+ * @see startImsTrafficSession+ * @see modifyImsTrafficSession+ *+ * @hide+ */+ @FlaggedApi(FLAG_SUPPORT_IMS_MMTEL_INTERFACE)+ @SystemApi+ public final void stopImsTrafficSession(@NonNull ImsTrafficSessionCallback callback) {+ IImsMmTelListener listener = getListener();+ if (listener == null) {+ throw new IllegalStateException("Session is not available.");+ }+ ImsTrafficSessionCallbackWrapper callbackWrapper = mTrafficCallbacks.get(callback);+ if (callbackWrapper == null) {+ // should not reach here.+ throw new IllegalStateException("Unknown ImsTrafficSessionCallback instance.");+ }+ try {+ listener.onStopImsTrafficSession(callbackWrapper.getToken());+ callbackWrapper.reset();+ mTrafficCallbacks.remove(callback);+ } catch (RemoteException e) {+ throw new RuntimeException(e);+ }+ }++ /**+ * Provides the MmTelFeature with the ability to return the framework Capability Configuration+ * for a provided Capability. If the framework calls {@link #changeEnabledCapabilities} and+ * includes a capability A to enable or disable, this method should return the correct enabled+ * status for capability A.+ * @param capability The capability that we are querying the configuration for.+ * @return true if the capability is enabled, false otherwise.+ * @hide+ */+ @Override+ @SystemApi+ public boolean queryCapabilityConfiguration(@MmTelCapabilities.MmTelCapability int capability,+ @ImsRegistrationImplBase.ImsRegistrationTech int radioTech) {+ // Base implementation - Override to provide functionality+ return false;+ }++ /**+ * The MmTelFeature should override this method to handle the enabling/disabling of+ * MmTel Features, defined in {@link MmTelCapabilities.MmTelCapability}. The framework assumes+ * the {@link CapabilityChangeRequest} was processed successfully. If a subset of capabilities+ * could not be set to their new values,+ * {@link CapabilityCallbackProxy#onChangeCapabilityConfigurationError} must be called+ * individually for each capability whose processing resulted in an error.+ *+ * Enabling/Disabling a capability here indicates that the capability should be registered or+ * deregistered (depending on the capability change) and become available or unavailable to+ * the framework.+ * @hide+ */+ @Override+ @SystemApi+ public void changeEnabledCapabilities(@NonNull CapabilityChangeRequest request,+ @NonNull CapabilityCallbackProxy c) {+ // Base implementation, no-op+ }++ /**+ * Called by the framework to pass {@link MediaThreshold}. The MmTelFeature should override this+ * method to get Media quality threshold. This will pass the consolidated threshold values from+ * Telephony framework. IMS provider needs to monitor media quality of active call and notify+ * media quality {@link #notifyMediaQualityStatusChanged(MediaQualityStatus)} when the measured+ * media quality crosses at least one of {@link MediaThreshold} set by this.+ *+ * @param mediaSessionType media session type for this Threshold info.+ * @param mediaThreshold media threshold information+ * @hide+ */+ @SystemApi+ public void setMediaThreshold(+ @MediaQualityStatus.MediaSessionType int mediaSessionType,+ @NonNull MediaThreshold mediaThreshold) {+ // Base Implementation - Should be overridden.+ Log.d(LOG_TAG, "setMediaThreshold is not supported." + mediaThreshold);+ }++ /**+ * The MmTelFeature should override this method to clear Media quality thresholds that were+ * registered and stop media quality status updates.+ *+ * @param mediaSessionType media session type+ * @hide+ */+ @SystemApi+ public void clearMediaThreshold(@MediaQualityStatus.MediaSessionType int mediaSessionType) {+ // Base Implementation - Should be overridden.+ Log.d(LOG_TAG, "clearMediaThreshold is not supported." + mediaSessionType);+ }++ /**+ * IMS provider should override this method to return currently measured media quality status.+ *+ * <p/>+ * If media quality status is not yet measured after call is active, it needs to notify media+ * quality status {@link #notifyMediaQualityStatusChanged(MediaQualityStatus)} when the first+ * measurement is done.+ *+ * @param mediaSessionType media session type+ * @return Current media quality status. It could be null if media quality status is not+ * measured yet or {@link MediaThreshold} was not set corresponding to the media session+ * type.+ *+ * @hide+ */+ @SystemApi+ @Nullable+ public MediaQualityStatus queryMediaQualityStatus(+ @MediaQualityStatus.MediaSessionType int mediaSessionType) {+ // Base Implementation - Should be overridden.+ Log.d(LOG_TAG, "queryMediaQualityStatus is not supported." + mediaSessionType);+ return null;+ }++ /**+ * Creates a {@link ImsCallProfile} from the service capabilities & IMS registration state.+ *+ * @param callSessionType a service type that is specified in {@link ImsCallProfile}+ * {@link ImsCallProfile#SERVICE_TYPE_NONE}+ * {@link ImsCallProfile#SERVICE_TYPE_NORMAL}+ * {@link ImsCallProfile#SERVICE_TYPE_EMERGENCY}+ * @param callType a call type that is specified in {@link ImsCallProfile}+ * {@link ImsCallProfile#CALL_TYPE_VOICE}+ * {@link ImsCallProfile#CALL_TYPE_VT}+ * {@link ImsCallProfile#CALL_TYPE_VT_TX}+ * {@link ImsCallProfile#CALL_TYPE_VT_RX}+ * {@link ImsCallProfile#CALL_TYPE_VT_NODIR}+ * {@link ImsCallProfile#CALL_TYPE_VS}+ * {@link ImsCallProfile#CALL_TYPE_VS_TX}+ * {@link ImsCallProfile#CALL_TYPE_VS_RX}+ * @return a {@link ImsCallProfile} object+ * @hide+ */+ @SystemApi+ public @Nullable ImsCallProfile createCallProfile(int callSessionType, int callType) {+ // Base Implementation - Should be overridden+ return null;+ }++ /**+ * Called by the framework to report a change to the RTP header extension types which should be+ * offered during SDP negotiation (see RFC8285 for more information).+ * <p>+ * The {@link ImsService} should report the RTP header extensions which were accepted during+ * SDP negotiation using {@link ImsCallProfile#setAcceptedRtpHeaderExtensionTypes(Set)}.+ *+ * @param extensionTypes The RTP header extensions the framework wishes to offer during+ * outgoing and incoming call setup. An empty list indicates that there+ * are no framework defined RTP header extension types to offer.+ * @hide+ */+ @SystemApi+ public void changeOfferedRtpHeaderExtensionTypes(+ @NonNull Set<RtpHeaderExtensionType> extensionTypes) {+ // Base implementation - should be overridden if RTP header extension handling is supported.+ }++ /**+ * @hide+ */+ public IImsCallSession createCallSessionInterface(ImsCallProfile profile)+ throws RemoteException {+ ImsCallSessionImplBase s = MmTelFeature.this.createCallSession(profile);+ if (s != null) {+ s.setDefaultExecutor(mExecutor);+ return s.getServiceImpl();+ } else {+ return null;+ }+ }++ /**+ * Creates an {@link ImsCallSession} with the specified call profile.+ * Use other methods, if applicable, instead of interacting with+ * {@link ImsCallSession} directly.+ *+ * @param profile a call profile to make the call+ * @hide+ */+ @SystemApi+ public @Nullable ImsCallSessionImplBase createCallSession(@NonNull ImsCallProfile profile) {+ // Base Implementation - Should be overridden+ return null;+ }++ /**+ * Called by the framework to determine if the outgoing call, designated by the outgoing+ * {@link String}s, should be processed as an IMS call or CSFB call. If this method's+ * functionality is not overridden, the platform will process every call as IMS as long as the+ * MmTelFeature reports that the {@link MmTelCapabilities#CAPABILITY_TYPE_VOICE} capability is+ * available.+ * @param numbers An array of {@link String}s that will be used for placing the call. There can+ * be multiple {@link String}s listed in the case when we want to place an outgoing+ * call as a conference.+ * @return a {@link ProcessCallResult} to the framework, which will be used to determine if the+ * call will be placed over IMS or via CSFB.+ * @hide+ */+ @SystemApi+ public @ProcessCallResult int shouldProcessCall(@NonNull String[] numbers) {+ return PROCESS_CALL_IMS;+ }++ /**+ *+ * @hide+ */+ protected IImsUt getUtInterface() throws RemoteException {+ ImsUtImplBase utImpl = getUt();+ if (utImpl != null) {+ utImpl.setDefaultExecutor(mExecutor);+ return utImpl.getInterface();+ } else {+ return null;+ }+ }++ /**+ * @hide+ */+ protected IImsEcbm getEcbmInterface() throws RemoteException {+ ImsEcbmImplBase ecbmImpl = getEcbm();+ if (ecbmImpl != null) {+ ecbmImpl.setDefaultExecutor(mExecutor);+ return ecbmImpl.getImsEcbm();+ } else {+ return null;+ }+ }++ /**+ * @hide+ */+ public IImsMultiEndpoint getMultiEndpointInterface() throws RemoteException {+ ImsMultiEndpointImplBase multiendpointImpl = getMultiEndpoint();+ if (multiendpointImpl != null) {+ multiendpointImpl.setDefaultExecutor(mExecutor);+ return multiendpointImpl.getIImsMultiEndpoint();+ } else {+ return null;+ }+ }++ /**+ * @hide+ */+ public @NonNull ImsSmsImplBase getImsSmsImpl() {+ synchronized (mLock) {+ if (mSmsImpl == null) {+ mSmsImpl = getSmsImplementation();+ mSmsImpl.setDefaultExecutor(mExecutor);+ }+ return mSmsImpl;+ }+ }++ /**+ * @return The {@link ImsUtImplBase} Ut interface implementation for the supplementary service+ * configuration.+ * @hide+ */+ @SystemApi+ public @NonNull ImsUtImplBase getUt() {+ // Base Implementation - Should be overridden+ return new ImsUtImplBase();+ }++ /**+ * @return The {@link ImsEcbmImplBase} Emergency call-back mode interface for emergency VoLTE+ * calls that support it.+ * @hide+ */+ @SystemApi+ public @NonNull ImsEcbmImplBase getEcbm() {+ // Base Implementation - Should be overridden+ return new ImsEcbmImplBase();+ }++ /**+ * @return The {@link ImsMultiEndpointImplBase} implementation for implementing Dialog event+ * package processing for multi-endpoint.+ * @hide+ */+ @SystemApi+ public @NonNull ImsMultiEndpointImplBase getMultiEndpoint() {+ // Base Implementation - Should be overridden+ return new ImsMultiEndpointImplBase();+ }++ /**+ * Sets the current UI TTY mode for the MmTelFeature.+ * @param mode An integer containing the new UI TTY Mode, can consist of+ * {@link TelecomManager#TTY_MODE_OFF},+ * {@link TelecomManager#TTY_MODE_FULL},+ * {@link TelecomManager#TTY_MODE_HCO},+ * {@link TelecomManager#TTY_MODE_VCO}+ * @param onCompleteMessage If non-null, this MmTelFeature should call this {@link Message} when+ * the operation is complete by using the associated {@link android.os.Messenger} in+ * {@link Message#replyTo}. For example:+ * {@code+ * // Set UI TTY Mode and other operations...+ * try {+ * // Notify framework that the mode was changed.+ * Messenger uiMessenger = onCompleteMessage.replyTo;+ * uiMessenger.send(onCompleteMessage);+ * } catch (RemoteException e) {+ * // Remote side is dead+ * }+ * }+ * @hide+ */+ @SystemApi+ public void setUiTtyMode(int mode, @Nullable Message onCompleteMessage) {+ // Base Implementation - Should be overridden+ }++ /**+ * Notifies the MmTelFeature of the enablement status of terminal based call waiting+ *+ * If the terminal based call waiting is provisioned,+ * IMS controls the enablement of terminal based call waiting which is defined+ * in 3GPP TS 24.615.+ *+ * @param enabled user setting controlling whether or not call waiting is enabled.+ *+ * @hide+ */+ @SystemApi+ public void setTerminalBasedCallWaitingStatus(boolean enabled) {+ // Base Implementation - Should be overridden by IMS service+ throw new ServiceSpecificException(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION,+ "Not implemented on device.");+ }++ /**+ * Notifies the MmTelFeature that the network has initiated an SRVCC (Single radio voice+ * call continuity) for all IMS calls. When the network initiates an SRVCC, calls from+ * the LTE domain are handed over to the legacy circuit switched domain. The modem requires+ * knowledge of ongoing calls in the IMS domain in order to complete the SRVCC operation.+ * <p>+ * @param consumer The callback used to notify the framework of the list of IMS calls and their+ * state at the time of the SRVCC.+ *+ * @hide+ */+ @SystemApi+ public void notifySrvccStarted(@NonNull Consumer<List<SrvccCall>> consumer) {+ // Base Implementation - Should be overridden by IMS service+ }++ /**+ * Notifies the MmTelFeature that the SRVCC is completed and the calls have been moved+ * over to the circuit-switched domain.+ * {@link android.telephony.CarrierConfigManager.ImsVoice#KEY_SRVCC_TYPE_INT_ARRAY}+ * specifies the calls can be moved. Other calls will be disconnected.+ * <p>+ * The MmTelFeature may now release all resources related to the IMS calls.+ *+ * @hide+ */+ @SystemApi+ public void notifySrvccCompleted() {+ // Base Implementation - Should be overridden by IMS service+ }++ /**+ * Notifies the MmTelFeature that the SRVCC has failed.+ *+ * The handover can fail by encountering a failure at the radio level+ * or temporary MSC server internal errors in handover procedure.+ * Refer to 3GPP TS 23.216 section 8 Handover Failure.+ * <p>+ * IMS service will recover and continue calls over IMS.+ * Per TS 24.237 12.2.4.2, UE shall send SIP UPDATE request containing the reason-text+ * set to "failure to transition to CS domain".+ *+ * @hide+ */+ @SystemApi+ public void notifySrvccFailed() {+ // Base Implementation - Should be overridden by IMS service+ }++ /**+ * Notifies the MmTelFeature that the SRVCC has been canceled.+ *+ * Since the state of network can be changed, the network can decide to terminate+ * the handover procedure before its completion and to return to its state before the handover+ * procedure was triggered.+ * Refer to 3GPP TS 23.216 section 8.1.3 Handover Cancellation.+ *+ * <p>+ * IMS service will recover and continue calls over IMS.+ * Per TS 24.237 12.2.4.2, UE shall send SIP UPDATE request containing the reason-text+ * set to "handover canceled".+ *+ * @hide+ */+ @SystemApi+ public void notifySrvccCanceled() {+ // Base Implementation - Should be overridden by IMS service+ }++ private void setSmsListener(IImsSmsListener listener) {+ getImsSmsImpl().registerSmsListener(listener);+ }++ private void sendSms(int token, int messageRef, String format, String smsc, boolean isRetry,+ byte[] pdu) {+ getImsSmsImpl().sendSms(token, messageRef, format, smsc, isRetry, pdu);+ }++ private void onMemoryAvailable(int token) {+ getImsSmsImpl().onMemoryAvailable(token);+ }++ private void acknowledgeSms(int token, int messageRef,+ @ImsSmsImplBase.DeliverStatusResult int result) {+ getImsSmsImpl().acknowledgeSms(token, messageRef, result);+ }++ private void acknowledgeSms(int token, int messageRef,+ @ImsSmsImplBase.DeliverStatusResult int result, byte[] pdu) {+ getImsSmsImpl().acknowledgeSms(token, messageRef, result, pdu);+ }++ private void acknowledgeSmsReport(int token, int messageRef,+ @ImsSmsImplBase.StatusReportResult int result) {+ getImsSmsImpl().acknowledgeSmsReport(token, messageRef, result);+ }++ private void onSmsReady() {+ getImsSmsImpl().onReady();+ }++ /**+ * Must be overridden by IMS Provider to be able to support SMS over IMS. Otherwise a default+ * non-functional implementation is returned.+ *+ * @return an instance of {@link ImsSmsImplBase} which should be implemented by the IMS+ * Provider.+ * @hide+ */+ @SystemApi+ public @NonNull ImsSmsImplBase getSmsImplementation() {+ return new ImsSmsImplBase();+ }++ private String getSmsFormat() {+ return getImsSmsImpl().getSmsFormat();+ }++ /**+ * {@inheritDoc}+ * @hide+ */+ @Override+ @SystemApi+ public void onFeatureRemoved() {+ // Base Implementation - Should be overridden+ }++ /**+ * {@inheritDoc}+ * @hide+ */+ @Override+ @SystemApi+ public void onFeatureReady() {+ // Base Implementation - Should be overridden+ }++ /**+ * @hide+ */+ @Override+ public final IImsMmTelFeature getBinder() {+ return mImsMMTelBinder;+ }++ /**+ * Set default Executor from ImsService.+ * @param executor The default executor for the framework to use when executing the methods+ * overridden by the implementation of MmTelFeature.+ * @hide+ */+ public final void setDefaultExecutor(@NonNull Executor executor) {+ if (mExecutor == null) {+ mExecutor = executor;+ }+ }+}
compile_p24.log
diff --git a/compile_p24.log b/compile_p24.lognew file mode 100644index 0000000000..5ae4345093--- /dev/null+++ b/compile_p24.log@@ -0,0 +1,94 @@+Reusing configuration cache.+> Task :library:ui:preBuild UP-TO-DATE+> Task :library:image:preBuild UP-TO-DATE+> Task :library:network:preBuild UP-TO-DATE+> Task :sdk:games:preBuild UP-TO-DATE+> Task :library:preBuild UP-TO-DATE+> Task :library:ui:preReleaseBuild UP-TO-DATE+> Task :library:image:preReleaseBuild UP-TO-DATE+> Task :library:downloadservice:preBuild UP-TO-DATE+> Task :library:preReleaseBuild UP-TO-DATE+> Task :library:network:preReleaseBuild UP-TO-DATE+> Task :sdk:games:preReleaseBuild UP-TO-DATE+> Task :maps:generateDevLauncherIcon UP-TO-DATE+> Task :library:downloadservice:preReleaseBuild UP-TO-DATE+> Task :library:processReleaseNavigationResources UP-TO-DATE+> Task :library:generateReleaseResources UP-TO-DATE+> Task :library:extractReleaseSupportedLocales UP-TO-DATE+> Task :sdk:games:processReleaseNavigationResources UP-TO-DATE+> Task :library:image:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:network:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:javaPreCompileRelease UP-TO-DATE+> Task :sdk:games:generateReleaseResources UP-TO-DATE+> Task :library:ui:extractReleaseSupportedLocales UP-TO-DATE+> Task :sdk:games:javaPreCompileRelease UP-TO-DATE+> Task :sdk:games:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:downloadservice:processReleaseNavigationResources UP-TO-DATE+> Task :library:downloadservice:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:network:processReleaseNavigationResources UP-TO-DATE+> Task :library:image:processReleaseNavigationResources UP-TO-DATE+> Task :library:downloadservice:javaPreCompileRelease UP-TO-DATE+> Task :library:ui:processReleaseNavigationResources UP-TO-DATE+> Task :library:image:generateReleaseResources UP-TO-DATE+> Task :library:downloadservice:generateReleaseResources UP-TO-DATE+> Task :library:network:generateReleaseResources UP-TO-DATE+> Task :library:network:javaPreCompileRelease UP-TO-DATE+> Task :library:image:javaPreCompileRelease UP-TO-DATE+> Task :maps:cargoBuild_arm64_v8a UP-TO-DATE+> Task :library:ui:generateReleaseResources UP-TO-DATE+> Task :library:ui:javaPreCompileRelease UP-TO-DATE+> Task :maps:cargoNdkBuild UP-TO-DATE+> Task :maps:preBuild UP-TO-DATE+> Task :maps:preDevBuild UP-TO-DATE+> Task :library:packageReleaseResources UP-TO-DATE+> Task :maps:generateDevBuildConfig UP-TO-DATE+> Task :sdk:games:packageReleaseResources UP-TO-DATE+> Task :library:downloadservice:packageReleaseResources UP-TO-DATE+> Task :library:network:packageReleaseResources UP-TO-DATE+> Task :library:parseReleaseLocalResources UP-TO-DATE+> Task :sdk:games:parseReleaseLocalResources UP-TO-DATE+> Task :library:ui:packageReleaseResources UP-TO-DATE+> Task :library:image:packageReleaseResources UP-TO-DATE+> Task :library:downloadservice:parseReleaseLocalResources UP-TO-DATE+> Task :library:network:parseReleaseLocalResources UP-TO-DATE+> Task :library:image:parseReleaseLocalResources UP-TO-DATE+> Task :library:ui:parseReleaseLocalResources UP-TO-DATE+> Task :sdk:games:generateReleaseRFile UP-TO-DATE+> Task :library:generateReleaseRFile UP-TO-DATE+> Task :library:downloadservice:generateReleaseRFile UP-TO-DATE+> Task :library:network:generateReleaseRFile UP-TO-DATE+> Task :library:image:generateReleaseRFile UP-TO-DATE+> Task :library:ui:generateReleaseRFile UP-TO-DATE+> Task :maps:mapDevSourceSetPaths+> Task :maps:extractDevSupportedLocales+> Task :maps:generateDevResources+> Task :maps:generateDevLocaleConfig UP-TO-DATE+> Task :library:network:compileReleaseKotlin UP-TO-DATE+> Task :sdk:games:compileReleaseKotlin UP-TO-DATE+> Task :library:network:compileReleaseJavaWithJavac NO-SOURCE+> Task :sdk:games:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:network:bundleLibCompileToJarRelease UP-TO-DATE+> Task :sdk:games:bundleLibCompileToJarRelease UP-TO-DATE+> Task :maps:processDevNavigationResources+> Task :library:kspReleaseKotlin UP-TO-DATE+> Task :maps:packageDevResources+> Task :library:compileReleaseKotlin UP-TO-DATE+> Task :library:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:downloadservice:compileReleaseKotlin UP-TO-DATE+> Task :library:downloadservice:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:downloadservice:bundleLibCompileToJarRelease UP-TO-DATE+> Task :maps:parseDevLocalResources+> Task :library:ui:compileReleaseKotlin UP-TO-DATE+> Task :library:ui:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:ui:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:image:compileReleaseKotlin UP-TO-DATE+> Task :library:image:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:image:bundleLibCompileToJarRelease UP-TO-DATE+> Task :maps:generateDevRFile+> Task :maps:kspDevKotlin SKIPPED+> Task :maps:compileDevKotlin++BUILD SUCCESSFUL in 13s+67 actionable tasks: 8 executed, 59 up-to-date+Configuration cache entry reused.
kotlin_only_build.log
diff --git a/kotlin_only_build.log b/kotlin_only_build.lognew file mode 100644index 0000000000..8e92db7763--- /dev/null+++ b/kotlin_only_build.log@@ -0,0 +1,275 @@+Calculating task graph as no cached configuration is available for tasks: :maps:assembleDev+> Task :build-logic:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :build-logic:generateExternalPluginSpecBuilders UP-TO-DATE+> Task :build-logic:extractPrecompiledScriptPluginPlugins UP-TO-DATE+> Task :build-logic:compilePluginsBlocks UP-TO-DATE+> Task :build-logic:generatePrecompiledScriptPluginAccessors UP-TO-DATE+> Task :build-logic:generateScriptPluginAdapters UP-TO-DATE+> Task :build-logic:compileKotlin UP-TO-DATE+> Task :build-logic:compileJava NO-SOURCE+> Task :build-logic:pluginDescriptors UP-TO-DATE+> Task :build-logic:processResources UP-TO-DATE+> Task :build-logic:classes UP-TO-DATE+> Task :build-logic:jar UP-TO-DATE++> Configure project :appstore+WARNING: The option setting 'android.experimental.enableScreenshotTest=true' is experimental.+The current default is 'false'.+Add android.sync.suppressAgpWarnings=UNSUPPORTED_PROJECT_OPTION_USE to the gradle.properties file to suppress this warning.++> Task :maps:cargoNdkBuild UP-TO-DATE+> Task :library:preBuild UP-TO-DATE+> Task :library:preReleaseBuild UP-TO-DATE+> Task :library:generateReleaseResources UP-TO-DATE+> Task :library:packageReleaseResources UP-TO-DATE+> Task :library:processReleaseNavigationResources UP-TO-DATE+> Task :library:parseReleaseLocalResources UP-TO-DATE+> Task :library:generateReleaseRFile UP-TO-DATE+> Task :sdk:games:preBuild UP-TO-DATE+> Task :sdk:games:preReleaseBuild UP-TO-DATE+> Task :sdk:games:generateReleaseResources UP-TO-DATE+> Task :sdk:games:packageReleaseResources UP-TO-DATE+> Task :sdk:games:processReleaseNavigationResources UP-TO-DATE+> Task :sdk:games:parseReleaseLocalResources UP-TO-DATE+> Task :sdk:games:generateReleaseRFile UP-TO-DATE+> Task :maps:rustFileLength+> Task :maps:preBuild+> Task :maps:preDevBuild+> Task :maps:mergeDevNativeDebugMetadata NO-SOURCE+> Task :sdk:games:javaPreCompileRelease UP-TO-DATE+> Task :library:javaPreCompileRelease UP-TO-DATE+> Task :maps:generateDevBuildConfig UP-TO-DATE+> Task :maps:generateDevLauncherIcon UP-TO-DATE+> Task :library:extractReleaseSupportedLocales UP-TO-DATE+> Task :maps:extractDevSupportedLocales UP-TO-DATE+> Task :maps:mapDevSourceSetPaths UP-TO-DATE+> Task :library:downloadservice:preBuild UP-TO-DATE+> Task :library:downloadservice:preReleaseBuild UP-TO-DATE+> Task :library:downloadservice:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:image:preBuild UP-TO-DATE+> Task :sdk:games:compileReleaseKotlin UP-TO-DATE+> Task :library:image:preReleaseBuild UP-TO-DATE+> Task :library:image:extractReleaseSupportedLocales UP-TO-DATE+> Task :sdk:games:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:map:cargoNdkBuild UP-TO-DATE+> Task :sdk:games:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:kspReleaseKotlin UP-TO-DATE+> Task :library:compileReleaseKotlin UP-TO-DATE+> Task :library:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:network:preBuild UP-TO-DATE+> Task :library:network:preReleaseBuild UP-TO-DATE+> Task :library:network:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:ui:preBuild UP-TO-DATE+> Task :library:ui:preReleaseBuild UP-TO-DATE+> Task :library:ui:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:work:preBuild UP-TO-DATE+> Task :library:work:preReleaseBuild UP-TO-DATE+> Task :library:map:rustFileLength+> Task :library:map:preBuild+> Task :library:map:preReleaseBuild+> Task :library:work:extractReleaseSupportedLocales UP-TO-DATE+> Task :library:map:extractReleaseSupportedLocales UP-TO-DATE+> Task :sdk:games:extractReleaseSupportedLocales UP-TO-DATE+> Task :maps:generateDevResources UP-TO-DATE+> Task :library:downloadservice:processReleaseNavigationResources UP-TO-DATE+> Task :library:image:processReleaseNavigationResources UP-TO-DATE+> Task :library:map:processReleaseNavigationResources UP-TO-DATE+> Task :library:network:processReleaseNavigationResources UP-TO-DATE+> Task :library:ui:processReleaseNavigationResources UP-TO-DATE+> Task :library:work:processReleaseNavigationResources UP-TO-DATE+> Task :maps:generateDevLocaleConfig UP-TO-DATE+> Task :maps:packageDevResources UP-TO-DATE+> Task :library:downloadservice:generateReleaseResources UP-TO-DATE+> Task :library:downloadservice:packageReleaseResources UP-TO-DATE+> Task :library:downloadservice:parseReleaseLocalResources UP-TO-DATE+> Task :library:downloadservice:generateReleaseRFile UP-TO-DATE+> Task :library:work:generateReleaseResources UP-TO-DATE+> Task :library:work:packageReleaseResources UP-TO-DATE+> Task :library:work:parseReleaseLocalResources UP-TO-DATE+> Task :library:work:generateReleaseRFile UP-TO-DATE+> Task :library:work:compileReleaseKotlin UP-TO-DATE+> Task :library:work:javaPreCompileRelease UP-TO-DATE+> Task :library:work:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:work:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:downloadservice:compileReleaseKotlin UP-TO-DATE+> Task :library:downloadservice:javaPreCompileRelease UP-TO-DATE+> Task :library:downloadservice:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:downloadservice:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:image:generateReleaseResources UP-TO-DATE+> Task :library:image:packageReleaseResources UP-TO-DATE+> Task :library:image:parseReleaseLocalResources UP-TO-DATE+> Task :library:image:generateReleaseRFile UP-TO-DATE+> Task :library:network:generateReleaseResources UP-TO-DATE+> Task :library:network:packageReleaseResources UP-TO-DATE+> Task :library:network:parseReleaseLocalResources UP-TO-DATE+> Task :library:network:generateReleaseRFile UP-TO-DATE+> Task :library:network:compileReleaseKotlin UP-TO-DATE+> Task :library:network:javaPreCompileRelease UP-TO-DATE+> Task :library:network:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:network:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:image:compileReleaseKotlin UP-TO-DATE+> Task :library:image:javaPreCompileRelease UP-TO-DATE+> Task :library:image:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:image:bundleLibCompileToJarRelease UP-TO-DATE+> Task :library:map:generateReleaseResources UP-TO-DATE+> Task :library:map:packageReleaseResources UP-TO-DATE+> Task :library:map:parseReleaseLocalResources UP-TO-DATE+> Task :library:map:generateReleaseRFile UP-TO-DATE+> Task :maps:processDevNavigationResources UP-TO-DATE+> Task :maps:parseDevLocalResources UP-TO-DATE+> Task :maps:generateDevRFile UP-TO-DATE+> Task :library:map:javaPreCompileRelease UP-TO-DATE+> Task :library:ui:generateReleaseResources UP-TO-DATE+> Task :library:ui:packageReleaseResources UP-TO-DATE+> Task :library:ui:parseReleaseLocalResources UP-TO-DATE+> Task :library:ui:generateReleaseRFile UP-TO-DATE+> Task :library:ui:compileReleaseKotlin UP-TO-DATE+> Task :library:ui:javaPreCompileRelease UP-TO-DATE+> Task :library:ui:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:ui:bundleLibCompileToJarRelease UP-TO-DATE+> Task :maps:javaPreCompileDev UP-TO-DATE+> Task :library:generateReleaseAssets UP-TO-DATE+> Task :library:mergeReleaseAssets UP-TO-DATE+> Task :maps:generateDevAssets UP-TO-DATE+> Task :library:downloadservice:generateReleaseAssets UP-TO-DATE+> Task :library:downloadservice:mergeReleaseAssets UP-TO-DATE+> Task :library:image:generateReleaseAssets UP-TO-DATE+> Task :library:image:mergeReleaseAssets UP-TO-DATE+> Task :library:map:generateReleaseAssets UP-TO-DATE+> Task :library:map:mergeReleaseAssets UP-TO-DATE+> Task :library:network:generateReleaseAssets UP-TO-DATE+> Task :library:network:mergeReleaseAssets UP-TO-DATE+> Task :library:ui:generateReleaseAssets UP-TO-DATE+> Task :library:ui:mergeReleaseAssets UP-TO-DATE+> Task :library:work:generateReleaseAssets UP-TO-DATE+> Task :library:work:mergeReleaseAssets UP-TO-DATE+> Task :sdk:games:generateReleaseAssets UP-TO-DATE+> Task :sdk:games:mergeReleaseAssets UP-TO-DATE+> Task :maps:mergeDevAssets UP-TO-DATE+> Task :maps:compressDevAssets UP-TO-DATE+> Task :maps:generateDevGlobalSynthetics UP-TO-DATE+> Task :library:compressReleaseJavaRes UP-TO-DATE+> Task :library:downloadservice:compressReleaseJavaRes UP-TO-DATE+> Task :library:image:compressReleaseJavaRes UP-TO-DATE+> Task :library:network:compressReleaseJavaRes UP-TO-DATE+> Task :library:ui:compressReleaseJavaRes UP-TO-DATE+> Task :library:work:compressReleaseJavaRes UP-TO-DATE+> Task :sdk:games:compressReleaseJavaRes UP-TO-DATE+> Task :maps:checkDevDuplicateClasses UP-TO-DATE+> Task :maps:desugarDevFileDependencies UP-TO-DATE+> Task :maps:mergeExtDexDev UP-TO-DATE+> Task :library:ui:bundleLibRuntimeToDirRelease UP-TO-DATE+> Task :library:image:bundleLibRuntimeToDirRelease UP-TO-DATE+> Task :library:downloadservice:bundleLibRuntimeToDirRelease UP-TO-DATE+> Task :library:work:bundleLibRuntimeToDirRelease UP-TO-DATE+> Task :library:bundleLibRuntimeToDirRelease UP-TO-DATE+> Task :library:network:bundleLibRuntimeToDirRelease UP-TO-DATE+> Task :sdk:games:bundleLibRuntimeToDirRelease UP-TO-DATE+> Task :library:mapReleaseSourceSetPaths UP-TO-DATE+> Task :library:compileReleaseLibraryResources UP-TO-DATE+> Task :library:writeReleaseAarMetadata UP-TO-DATE+> Task :library:downloadservice:writeReleaseAarMetadata UP-TO-DATE+> Task :library:image:writeReleaseAarMetadata UP-TO-DATE+> Task :library:map:writeReleaseAarMetadata UP-TO-DATE+> Task :library:network:writeReleaseAarMetadata UP-TO-DATE+> Task :library:ui:writeReleaseAarMetadata UP-TO-DATE+> Task :library:work:writeReleaseAarMetadata UP-TO-DATE+> Task :sdk:games:writeReleaseAarMetadata UP-TO-DATE+> Task :maps:checkDevAarMetadata UP-TO-DATE+> Task :maps:compileDevNavigationResources UP-TO-DATE+> Task :maps:mergeDevResources UP-TO-DATE+> Task :maps:createDevCompatibleScreenManifests UP-TO-DATE+> Task :library:extractDeepLinksRelease UP-TO-DATE+> Task :library:processReleaseManifest UP-TO-DATE+> Task :maps:extractDeepLinksDev UP-TO-DATE+> Task :library:downloadservice:extractDeepLinksRelease UP-TO-DATE+> Task :library:downloadservice:processReleaseManifest UP-TO-DATE+> Task :library:image:extractDeepLinksRelease UP-TO-DATE+> Task :library:image:processReleaseManifest UP-TO-DATE+> Task :library:map:extractDeepLinksRelease UP-TO-DATE+> Task :library:map:processReleaseManifest UP-TO-DATE+> Task :library:network:extractDeepLinksRelease UP-TO-DATE+> Task :library:network:processReleaseManifest UP-TO-DATE+> Task :library:ui:extractDeepLinksRelease UP-TO-DATE+> Task :library:ui:processReleaseManifest UP-TO-DATE+> Task :library:work:extractDeepLinksRelease UP-TO-DATE+> Task :library:work:processReleaseManifest UP-TO-DATE+> Task :sdk:games:extractDeepLinksRelease UP-TO-DATE+> Task :sdk:games:processReleaseManifest UP-TO-DATE+> Task :maps:processDevMainManifest UP-TO-DATE+> Task :maps:processDevManifest UP-TO-DATE+> Task :maps:processDevManifestForPackage UP-TO-DATE+> Task :library:downloadservice:mapReleaseSourceSetPaths UP-TO-DATE+> Task :library:downloadservice:compileReleaseLibraryResources UP-TO-DATE+> Task :library:image:mapReleaseSourceSetPaths UP-TO-DATE+> Task :library:image:compileReleaseLibraryResources UP-TO-DATE+> Task :library:map:mapReleaseSourceSetPaths UP-TO-DATE+> Task :library:map:compileReleaseLibraryResources UP-TO-DATE+> Task :library:network:mapReleaseSourceSetPaths UP-TO-DATE+> Task :library:network:compileReleaseLibraryResources UP-TO-DATE+> Task :library:ui:mapReleaseSourceSetPaths UP-TO-DATE+> Task :library:ui:compileReleaseLibraryResources UP-TO-DATE+> Task :library:work:mapReleaseSourceSetPaths UP-TO-DATE+> Task :library:work:compileReleaseLibraryResources UP-TO-DATE+> Task :sdk:games:mapReleaseSourceSetPaths UP-TO-DATE+> Task :sdk:games:compileReleaseLibraryResources UP-TO-DATE+> Task :maps:processDevResources UP-TO-DATE+> Task :library:mergeReleaseJniLibFolders UP-TO-DATE+> Task :library:mergeReleaseNativeLibs NO-SOURCE+> Task :library:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :maps:mergeDevJniLibFolders UP-TO-DATE+> Task :library:downloadservice:mergeReleaseJniLibFolders UP-TO-DATE+> Task :library:downloadservice:mergeReleaseNativeLibs NO-SOURCE+> Task :library:downloadservice:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :library:image:mergeReleaseJniLibFolders UP-TO-DATE+> Task :library:image:mergeReleaseNativeLibs NO-SOURCE+> Task :library:image:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :library:map:mergeReleaseJniLibFolders UP-TO-DATE+> Task :library:map:mergeReleaseNativeLibs UP-TO-DATE+> Task :library:map:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :library:network:mergeReleaseJniLibFolders UP-TO-DATE+> Task :library:network:mergeReleaseNativeLibs NO-SOURCE+> Task :library:network:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :library:ui:mergeReleaseJniLibFolders UP-TO-DATE+> Task :library:ui:mergeReleaseNativeLibs NO-SOURCE+> Task :library:ui:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :library:work:mergeReleaseJniLibFolders UP-TO-DATE+> Task :library:work:mergeReleaseNativeLibs NO-SOURCE+> Task :library:work:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :sdk:games:mergeReleaseJniLibFolders UP-TO-DATE+> Task :sdk:games:mergeReleaseNativeLibs NO-SOURCE+> Task :sdk:games:copyReleaseJniLibsProjectOnly UP-TO-DATE+> Task :maps:mergeDevNativeLibs UP-TO-DATE+> Task :maps:stripDevDebugSymbols UP-TO-DATE+> Task :maps:validateSigningDev UP-TO-DATE+> Task :maps:writeDevAppMetadata UP-TO-DATE+> Task :maps:writeDevSigningConfigVersions UP-TO-DATE++> Task :library:map:compileReleaseKotlin+w: Opt-in requirement marker 'androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi' is unresolved. Make sure it's present in the module dependencies.++> Task :library:map:compileReleaseJavaWithJavac NO-SOURCE+> Task :library:map:compressReleaseJavaRes UP-TO-DATE+> Task :library:map:bundleLibRuntimeToDirRelease+> Task :library:map:bundleLibCompileToJarRelease+> Task :maps:kspDevKotlin+> Task :maps:mergeLibDexDev++> Task :maps:compileDevKotlin+w: file:///C:/Users/Vayun/Documents/code/Modern-Apps/maps/src/main/java/com/vayunmathur/maps/car/CarSearchScreen.kt:93:14 'fun setActionStrip(p0: ActionStrip): ListTemplate.Builder' is deprecated. Deprecated in Java.++> Task :maps:compressDevJavaRes UP-TO-DATE+> Task :maps:mergeDevJavaResource UP-TO-DATE+> Task :maps:compileDevJavaWithJavac UP-TO-DATE+> Task :maps:dexBuilderDev+> Task :maps:mergeProjectDexDev+> Task :maps:packageDev+> Task :maps:assembleDev+> Task :maps:createDevApkListingFileRedirect UP-TO-DATE++[Incubating] Problems report is available at: file:///C:/Users/Vayun/Documents/code/Modern-Apps/build/reports/problems/problems-report.html++BUILD SUCCESSFUL in 47s+207 actionable tasks: 11 executed, 196 up-to-date+Configuration cache entry stored.
library/map/src/main/java/com/vayunmathur/library/map/MapMarker.kt
diff --git a/library/map/src/main/java/com/vayunmathur/library/map/MapMarker.kt b/library/map/src/main/java/com/vayunmathur/library/map/MapMarker.ktindex 4f7a4d6837..4f0c7c3619 100644--- a/library/map/src/main/java/com/vayunmathur/library/map/MapMarker.kt+++ b/library/map/src/main/java/com/vayunmathur/library/map/MapMarker.kt@@ -16,12 +16,16 @@ package com.vayunmathur.library.map * @param color route colour packed as `0xRRGGBB` for the ring drawn under a * transit-vehicle sprite so it reads in its line's colour; `0` draws no * ring. Only vehicles carry one today — app pins leave the default.+ * @param label optional name drawn beside the pin like a POI label (family-member+ * names, search titles, saved-place names); `null` draws the icon alone.+ * Carried as a parallel string array across JNI (see `MapNative.setMarkers`). */ data class MapMarker( val id: Long, val position: GeoPoint, val icon: Int, val color: Int = 0,+ val label: String? = null, ) /**
library/map/src/main/java/com/vayunmathur/library/map/MapNative.kt
diff --git a/library/map/src/main/java/com/vayunmathur/library/map/MapNative.kt b/library/map/src/main/java/com/vayunmathur/library/map/MapNative.ktindex 6d91b7f961..db67243028 100644--- a/library/map/src/main/java/com/vayunmathur/library/map/MapNative.kt+++ b/library/map/src/main/java/com/vayunmathur/library/map/MapNative.kt@@ -242,11 +242,13 @@ internal object MapNative { * Replace the app's pins with a marker set the renderer draws as billboarded sprites. * * [ids] holds each marker's stable host id (echoed back by [pickAt]), [lonLat] is a flat- * `[lon0, lat0, lon1, lat1, …]`, and [icons] is each marker's icon id (see the native+ * `[lon0, lat0, lon1, lat1, …]`, [icons] is each marker's icon id (see the native * `crate::marker::icon` table: parking/transit/search/saved/family, plus the transit-vehicle- * ids WS-F reuses). Three parallel bulk arrays, the same convention as [setRoute] and- * [setTrafficSpeeds]: a viewport of pins crosses the boundary in a few reads with no per-pin- * traffic. `Float` coordinates for the same reason [render]'s are.+ * ids WS-F reuses), and [labels] is each marker's optional display name drawn beside the+ * pin like a POI label (an empty string draws the icon alone). Four parallel bulk arrays,+ * the same convention as [setRoute] and [setTrafficSpeeds]: a viewport of pins crosses the+ * boundary in a few reads with no per-pin traffic. `Float` coordinates for the same reason+ * [render]'s are. * * Free in the [setPalette] sense: the geometry is the shared unit quad billboarded per marker, * so nothing is tessellated or uploaded. The whole set is replaced each call — a stale pin left@@ -254,7 +256,13 @@ internal object MapNative { * basemap on a pan or tilt. Mismatched array lengths are truncated to the shortest; an empty set * is the same as [clearMarkers]. */- external fun setMarkers(handle: Long, ids: LongArray, lonLat: FloatArray, icons: IntArray)+ external fun setMarkers(+ handle: Long,+ ids: LongArray,+ lonLat: FloatArray,+ icons: IntArray,+ labels: Array<String>,+ ) /** Take every marker away: the host cleared its pins. */ external fun clearMarkers(handle: Long)
library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapOverlays.kt
diff --git a/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapOverlays.kt b/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapOverlays.ktindex 7090c85108..6d8b2eb784 100644--- a/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapOverlays.kt+++ b/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapOverlays.kt@@ -5,24 +5,35 @@ import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.unit.DpRect /**- * Packs marker lists into the three parallel bulk arrays the native side reads:- * ids, then interleaved lon/lat, then icon ids. Packed once per push rather than- * crossing the JNI boundary per pin.+ * Packs marker lists into the four parallel bulk arrays the native side reads:+ * ids, then interleaved lon/lat, then icon ids, then labels. Packed once per push rather than+ * crossing the JNI boundary per pin. A null label packs as the empty string, which the native+ * side reads as "icon alone". */-internal fun packMapMarkers(pins: List<MapMarker>): Triple<LongArray, FloatArray, IntArray> {+internal fun packMapMarkers(pins: List<MapMarker>): MarkerArrays { val ids = LongArray(pins.size) val lonLat = FloatArray(pins.size * 2) val icons = IntArray(pins.size)+ val labels = Array(pins.size) { "" } for (i in pins.indices) { val pin = pins[i] ids[i] = pin.id lonLat[i * 2] = pin.position.longitude.toFloat() lonLat[i * 2 + 1] = pin.position.latitude.toFloat() icons[i] = pin.icon+ labels[i] = pin.label ?: "" }- return Triple(ids, lonLat, icons)+ return MarkerArrays(ids, lonLat, icons, labels) } +/** The four parallel marker arrays crossing JNI in [MapNative.setMarkers]. */+internal data class MarkerArrays(+ val ids: LongArray,+ val lonLat: FloatArray,+ val icons: IntArray,+ val labels: Array<String>,+)+ /** * Packs vehicle lists into the four parallel bulk arrays the native vehicle * path reads: the three marker arrays plus per-vehicle route colours packed
library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapRenderer.kt
diff --git a/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapRenderer.kt b/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapRenderer.ktindex cdafd76d91..ba49bee738 100644--- a/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapRenderer.kt+++ b/library/map/src/main/java/com/vayunmathur/library/map/SurfaceMapRenderer.kt@@ -750,8 +750,8 @@ class SurfaceMapRenderer( MapNative.clearMarkers(handle) return }- val (ids, lonLat, icons) = packMapMarkers(pins)- MapNative.setMarkers(handle, ids, lonLat, icons)+ val packed = packMapMarkers(pins)+ MapNative.setMarkers(handle, packed.ids, packed.lonLat, packed.icons, packed.labels) } private fun applyVehicles() {
library/map/src/main/rust/assets/sprites/[email protected]
diff --git a/library/map/src/main/rust/assets/sprites/[email protected] b/library/map/src/main/rust/assets/sprites/[email protected]index d9d65af65a..5d573aa9d8 100644--- a/library/map/src/main/rust/assets/sprites/[email protected]+++ b/library/map/src/main/rust/assets/sprites/[email protected]@@ -1 +1 @@-{"NL:S-road-1char":{"height":42,"pixelRatio":2,"width":42,"x":0,"y":72},"NL:S-road-2char":{"height":42,"pixelRatio":2,"width":44,"x":76,"y":42},"NL:S-road-3char":{"height":42,"pixelRatio":2,"width":50,"x":404,"y":36},"NL:S-road-4char":{"height":42,"pixelRatio":2,"width":58,"x":346,"y":0},"NL:S-road-5char":{"height":42,"pixelRatio":2,"width":64,"x":158,"y":0},"US:I-1char":{"height":42,"pixelRatio":2,"width":40,"x":168,"y":42},"US:I-2char":{"height":42,"pixelRatio":2,"width":46,"x":454,"y":36},"US:I-3char":{"height":42,"pixelRatio":2,"width":60,"x":286,"y":0},"US:I-4char":{"height":42,"pixelRatio":2,"width":64,"x":222,"y":0},"US:I-5char":{"height":42,"pixelRatio":2,"width":68,"x":90,"y":0},"aerodrome":{"height":38,"pixelRatio":2,"width":38,"x":120,"y":78},"animal":{"height":38,"pixelRatio":2,"width":38,"x":42,"y":84},"arrow":{"height":38,"pixelRatio":2,"width":38,"x":0,"y":114},"artwork":{"height":38,"pixelRatio":2,"width":38,"x":80,"y":84},"attraction":{"height":38,"pixelRatio":2,"width":38,"x":208,"y":42},"bar":{"height":38,"pixelRatio":2,"width":38,"x":246,"y":42},"beach":{"height":38,"pixelRatio":2,"width":38,"x":284,"y":42},"beauty":{"height":38,"pixelRatio":2,"width":38,"x":322,"y":42},"bench":{"height":38,"pixelRatio":2,"width":38,"x":360,"y":42},"books":{"height":38,"pixelRatio":2,"width":38,"x":398,"y":78},"building":{"height":34,"pixelRatio":2,"width":34,"x":386,"y":154},"bus_stop":{"height":38,"pixelRatio":2,"width":38,"x":436,"y":78},"cafe":{"height":38,"pixelRatio":2,"width":38,"x":474,"y":78},"capital":{"height":20,"pixelRatio":2,"width":20,"x":420,"y":154},"clothes":{"height":38,"pixelRatio":2,"width":38,"x":208,"y":80},"convenience":{"height":38,"pixelRatio":2,"width":38,"x":158,"y":84},"drinking_water":{"height":38,"pixelRatio":2,"width":38,"x":118,"y":116},"electronics":{"height":38,"pixelRatio":2,"width":38,"x":38,"y":122},"fast_food":{"height":38,"pixelRatio":2,"width":38,"x":0,"y":152},"ferry_terminal":{"height":38,"pixelRatio":2,"width":38,"x":76,"y":122},"forest":{"height":38,"pixelRatio":2,"width":38,"x":246,"y":80},"garden":{"height":38,"pixelRatio":2,"width":38,"x":284,"y":80},"generic_shield-1char":{"height":36,"pixelRatio":2,"width":38,"x":470,"y":0},"generic_shield-2char":{"height":36,"pixelRatio":2,"width":48,"x":120,"y":42},"generic_shield-3char":{"height":36,"pixelRatio":2,"width":66,"x":404,"y":0},"generic_shield-4char":{"height":36,"pixelRatio":2,"width":76,"x":0,"y":36},"generic_shield-5char":{"height":36,"pixelRatio":2,"width":90,"x":0,"y":0},"library":{"height":38,"pixelRatio":2,"width":38,"x":322,"y":80},"marina":{"height":38,"pixelRatio":2,"width":38,"x":360,"y":80},"museum":{"height":38,"pixelRatio":2,"width":38,"x":398,"y":116},"park":{"height":38,"pixelRatio":2,"width":38,"x":436,"y":116},"peak":{"height":38,"pixelRatio":2,"width":38,"x":474,"y":116},"post_office":{"height":38,"pixelRatio":2,"width":38,"x":196,"y":118},"restaurant":{"height":38,"pixelRatio":2,"width":38,"x":156,"y":122},"school":{"height":38,"pixelRatio":2,"width":38,"x":114,"y":154},"stadium":{"height":38,"pixelRatio":2,"width":38,"x":38,"y":160},"supermarket":{"height":38,"pixelRatio":2,"width":38,"x":0,"y":190},"theatre":{"height":38,"pixelRatio":2,"width":38,"x":76,"y":160},"toilets":{"height":38,"pixelRatio":2,"width":38,"x":234,"y":118},"townspot":{"height":20,"pixelRatio":2,"width":20,"x":440,"y":154},"train_station":{"height":38,"pixelRatio":2,"width":38,"x":272,"y":118},"university":{"height":38,"pixelRatio":2,"width":38,"x":310,"y":118},"zoo":{"height":38,"pixelRatio":2,"width":38,"x":348,"y":118},"fuel":{"x":0,"y":228,"width":38,"height":38,"pixelRatio":2},"hotel":{"x":38,"y":228,"width":38,"height":38,"pixelRatio":2},"bank":{"x":76,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-bus":{"x":114,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-tram":{"x":152,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-train":{"x":190,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-ferry":{"x":228,"y":228,"width":38,"height":38,"pixelRatio":2},"atm":{"x":76,"y":228,"width":38,"height":38,"pixelRatio":2}}\ No newline at end of file+{"NL:S-road-1char":{"height":42,"pixelRatio":2,"width":42,"x":0,"y":72},"NL:S-road-2char":{"height":42,"pixelRatio":2,"width":44,"x":76,"y":42},"NL:S-road-3char":{"height":42,"pixelRatio":2,"width":50,"x":404,"y":36},"NL:S-road-4char":{"height":42,"pixelRatio":2,"width":58,"x":346,"y":0},"NL:S-road-5char":{"height":42,"pixelRatio":2,"width":64,"x":158,"y":0},"US:I-1char":{"height":42,"pixelRatio":2,"width":40,"x":168,"y":42},"US:I-2char":{"height":42,"pixelRatio":2,"width":46,"x":454,"y":36},"US:I-3char":{"height":42,"pixelRatio":2,"width":60,"x":286,"y":0},"US:I-4char":{"height":42,"pixelRatio":2,"width":64,"x":222,"y":0},"US:I-5char":{"height":42,"pixelRatio":2,"width":68,"x":90,"y":0},"aerodrome":{"height":38,"pixelRatio":2,"width":38,"x":120,"y":78},"animal":{"height":38,"pixelRatio":2,"width":38,"x":42,"y":84},"arrow":{"height":38,"pixelRatio":2,"width":38,"x":0,"y":114},"artwork":{"height":38,"pixelRatio":2,"width":38,"x":80,"y":84},"attraction":{"height":38,"pixelRatio":2,"width":38,"x":208,"y":42},"bar":{"height":38,"pixelRatio":2,"width":38,"x":246,"y":42},"beach":{"height":38,"pixelRatio":2,"width":38,"x":284,"y":42},"beauty":{"height":38,"pixelRatio":2,"width":38,"x":322,"y":42},"bench":{"height":38,"pixelRatio":2,"width":38,"x":360,"y":42},"books":{"height":38,"pixelRatio":2,"width":38,"x":398,"y":78},"building":{"height":34,"pixelRatio":2,"width":34,"x":386,"y":154},"bus_stop":{"height":38,"pixelRatio":2,"width":38,"x":436,"y":78},"cafe":{"height":38,"pixelRatio":2,"width":38,"x":474,"y":78},"capital":{"height":20,"pixelRatio":2,"width":20,"x":420,"y":154},"clothes":{"height":38,"pixelRatio":2,"width":38,"x":208,"y":80},"convenience":{"height":38,"pixelRatio":2,"width":38,"x":158,"y":84},"drinking_water":{"height":38,"pixelRatio":2,"width":38,"x":118,"y":116},"electronics":{"height":38,"pixelRatio":2,"width":38,"x":38,"y":122},"fast_food":{"height":38,"pixelRatio":2,"width":38,"x":0,"y":152},"ferry_terminal":{"height":38,"pixelRatio":2,"width":38,"x":76,"y":122},"forest":{"height":38,"pixelRatio":2,"width":38,"x":246,"y":80},"garden":{"height":38,"pixelRatio":2,"width":38,"x":284,"y":80},"generic_shield-1char":{"height":36,"pixelRatio":2,"width":38,"x":470,"y":0},"generic_shield-2char":{"height":36,"pixelRatio":2,"width":48,"x":120,"y":42},"generic_shield-3char":{"height":36,"pixelRatio":2,"width":66,"x":404,"y":0},"generic_shield-4char":{"height":36,"pixelRatio":2,"width":76,"x":0,"y":36},"generic_shield-5char":{"height":36,"pixelRatio":2,"width":90,"x":0,"y":0},"library":{"height":38,"pixelRatio":2,"width":38,"x":322,"y":80},"marina":{"height":38,"pixelRatio":2,"width":38,"x":360,"y":80},"museum":{"height":38,"pixelRatio":2,"width":38,"x":398,"y":116},"park":{"height":38,"pixelRatio":2,"width":38,"x":436,"y":116},"peak":{"height":38,"pixelRatio":2,"width":38,"x":474,"y":116},"post_office":{"height":38,"pixelRatio":2,"width":38,"x":196,"y":118},"restaurant":{"height":38,"pixelRatio":2,"width":38,"x":156,"y":122},"school":{"height":38,"pixelRatio":2,"width":38,"x":114,"y":154},"stadium":{"height":38,"pixelRatio":2,"width":38,"x":38,"y":160},"supermarket":{"height":38,"pixelRatio":2,"width":38,"x":0,"y":190},"theatre":{"height":38,"pixelRatio":2,"width":38,"x":76,"y":160},"toilets":{"height":38,"pixelRatio":2,"width":38,"x":234,"y":118},"townspot":{"height":20,"pixelRatio":2,"width":20,"x":440,"y":154},"train_station":{"height":38,"pixelRatio":2,"width":38,"x":272,"y":118},"university":{"height":38,"pixelRatio":2,"width":38,"x":310,"y":118},"zoo":{"height":38,"pixelRatio":2,"width":38,"x":348,"y":118},"fuel":{"x":0,"y":228,"width":38,"height":38,"pixelRatio":2},"hotel":{"x":38,"y":228,"width":38,"height":38,"pixelRatio":2},"bank":{"x":76,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-bus":{"x":114,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-tram":{"x":152,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-train":{"x":190,"y":228,"width":38,"height":38,"pixelRatio":2},"vehicle-ferry":{"x":228,"y":228,"width":38,"height":38,"pixelRatio":2},"atm":{"x":76,"y":228,"width":38,"height":38,"pixelRatio":2},"family":{"x":266,"y":228,"width":38,"height":38,"pixelRatio":2}}\ No newline at end of file
library/map/src/main/rust/assets/sprites/[email protected]
diff --git a/library/map/src/main/rust/assets/sprites/[email protected] b/library/map/src/main/rust/assets/sprites/[email protected]index 25e7533b5c..002622f70c 100644Binary files a/library/map/src/main/rust/assets/sprites/[email protected] and b/library/map/src/main/rust/assets/sprites/[email protected] differ
library/map/src/main/rust/src/bridge/markers.rs
diff --git a/library/map/src/main/rust/src/bridge/markers.rs b/library/map/src/main/rust/src/bridge/markers.rsindex 1206ae8676..3d0533de3a 100644--- a/library/map/src/main/rust/src/bridge/markers.rs+++ b/library/map/src/main/rust/src/bridge/markers.rs@@ -4,35 +4,39 @@ use super::handle::handle_mut; use super::log::log; use crate::marker::Marker;-use jni::objects::{JClass, JFloatArray, JIntArray, JLongArray};+use jni::objects::{JClass, JFloatArray, JIntArray, JLongArray, JObjectArray, JString}; use jni::sys::jlong; use jni::JNIEnv; /// Replace the app's pins with a marker set, drawn by the renderer as billboarded sprites. ///-/// Three parallel bulk arrays, the same convention as+/// Four parallel bulk arrays, the same convention as /// [`setRoute`](Java_com_vayunmathur_library_map_MapNative_setRoute) and /// [`setTrafficSpeeds`](Java_com_vayunmathur_library_map_MapNative_setTrafficSpeeds): `ids[i]` is /// the host's own stable id for marker `i` (echoed back by /// [`pickAt`](Java_com_vayunmathur_library_map_MapNative_pickAt)), `lonLat` holds-/// `[lon0, lat0, lon1, lat1, …]`, and `icons[i]` is the icon id (see `crate::marker::icon`). Bulk-/// arrays rather than a list of objects so a viewport's worth of pins crosses the boundary in a-/// few `get_*_array_region` reads with no per-pin JNI traffic; `float` coordinates for the same-/// reason the camera's are.+/// `[lon0, lat0, lon1, lat1, …]`, `icons[i]` is the icon id (see `crate::marker::icon`), and+/// `labels[i]` is the optional display name drawn beside the pin like a POI label (an empty+/// string draws the icon alone). Bulk arrays rather than a list of objects so a viewport's worth+/// of pins crosses the boundary in a few `get_*_array_region` reads with no per-pin JNI traffic;+/// `float` coordinates for the same reason the camera's are. /// /// The whole set is replaced each call, not merged — a stale pin left behind would sit under the /// finger and pick wrong. Moving the pins into the renderer is what stops them trailing the basemap /// on a pan or tilt the way the Compose overlays did. Mismatched lengths are truncated to the /// shortest; an empty set is the same as /// [`clearMarkers`](Java_com_vayunmathur_library_map_MapNative_clearMarkers). Arrays that cannot be-/// read leave the markers **unchanged** rather than blanking them.+/// read leave the markers **unchanged** rather than blanking them. A label that cannot be read+/// degrades to the empty string (icon alone) rather than failing the whole push. #[no_mangle]+#[allow(clippy::too_many_arguments)] pub extern "system" fn Java_com_vayunmathur_library_map_MapNative_setMarkers<'l>(- env: JNIEnv<'l>,+ mut env: JNIEnv<'l>, _class: JClass<'l>, handle: jlong, ids: JLongArray<'l>, lon_lat: JFloatArray<'l>, icons: JIntArray<'l>,+ labels: JObjectArray<'l>, ) { let Some(map) = handle_mut(handle) else { return;@@ -40,10 +44,11 @@ pub extern "system" fn Java_com_vayunmathur_library_map_MapNative_setMarkers<'l> let id_len = env.get_array_length(&ids).unwrap_or(0).max(0) as usize; let icon_len = env.get_array_length(&icons).unwrap_or(0).max(0) as usize; let coord_len = env.get_array_length(&lon_lat).unwrap_or(0).max(0) as usize;+ let label_len = env.get_array_length(&labels).unwrap_or(0).max(0) as usize; // Each marker consumes two floats (lon, lat), so the coordinate array bounds the count too.- let n = id_len.min(icon_len).min(coord_len / 2);+ let n = id_len.min(icon_len).min(coord_len / 2).min(label_len); if n == 0 {- map.renderer.set_markers(Vec::new());+ map.renderer.set_markers(Vec::new(), Vec::new()); return; } let mut id_buf = vec![0i64; n];@@ -71,7 +76,12 @@ pub extern "system" fn Java_com_vayunmathur_library_map_MapNative_setMarkers<'l> colour: 0, }) .collect();- map.renderer.set_markers(markers);+ let marker_labels: Vec<String> = (0..n)+ .map(|i| {+ read_marker_label(&mut env, &labels, i as i32)+ })+ .collect();+ map.renderer.set_markers(markers, marker_labels); } /// Take every marker away: the host cleared its pins.@@ -82,8 +92,26 @@ pub extern "system" fn Java_com_vayunmathur_library_map_MapNative_clearMarkers<' handle: jlong, ) { if let Some(map) = handle_mut(handle) {- map.renderer.set_markers(Vec::new());+ map.renderer.set_markers(Vec::new(), Vec::new());+ }+}++/// One marker's display name from the parallel labels array.+///+/// Any failure — a null element, an object that is not a string, an undecodable+/// string — degrades to the empty string (icon alone) rather than failing the+/// whole push: a label is decoration, and a malformed one must not blank pins.+fn read_marker_label(env: &mut JNIEnv<'_>, labels: &JObjectArray<'_>, index: i32) -> String {+ let Ok(obj) = env.get_object_array_element(labels, index) else {+ return String::new();+ };+ if obj.is_null() {+ return String::new(); }+ let string = JString::from(obj);+ env.get_string(&string)+ .map(Into::into)+ .unwrap_or_default() } /// Replace the simulated transit vehicles with a set the renderer draws as billboarded sprites.
library/map/src/main/rust/src/marker.rs
diff --git a/library/map/src/main/rust/src/marker.rs b/library/map/src/main/rust/src/marker.rsindex c67844ed0e..2e6f0957d0 100644--- a/library/map/src/main/rust/src/marker.rs+++ b/library/map/src/main/rust/src/marker.rs@@ -54,6 +54,45 @@ pub struct Marker { /// by a tile matrix. A touch larger than a POI icon (19 Dp) so an app pin reads as foreground. pub const MARKER_SIZE_DP: f32 = 28.0; +/// The screen size a marker's name label is drawn at, in Dp.+///+/// Screen-constant like the icon beside it: a pin is not tile data, so its label cannot follow+/// a zoom ramp the way a POI's does. 12 Dp is the `places-locality` size at browse zooms, which+/// is what a pin label reads alongside.+pub const MARKER_LABEL_DP: f32 = 12.0;++/// The gap between a marker icon's edge and its name label's start, in Dp.+///+/// The POI `text-offset` of 1.1 em is measured from the anchor (the icon's centre) for a 19 Dp+/// icon; scaled to a 28 Dp icon that same daylight is this gap past the half-extent.+pub const MARKER_LABEL_GAP_DP: f32 = 4.0;++/// A marker label's text colour, light and dark.+///+/// The neutral `places-locality` recipe verbatim: markers span kinds (parking, search, saved,+/// family) so no kind colour fits, and this grey is the proven legible neutral on both+/// basemaps with the halos below.+pub const MARKER_LABEL_LIGHT: u32 = 0xFF5C_5C5C;+/// A marker label's text colour on the dark basemap (see [`MARKER_LABEL_LIGHT`]).+pub const MARKER_LABEL_DARK: u32 = 0xFF5C_5C5C;+/// A marker label's halo colour on the light basemap (see [`MARKER_LABEL_LIGHT`]).+pub const MARKER_LABEL_HALO_LIGHT: u32 = 0xFFFF_FFFF;+/// A marker label's halo colour on the dark basemap (see [`MARKER_LABEL_LIGHT`]).+pub const MARKER_LABEL_HALO_DARK: u32 = 0xFF0D_1B2A;++/// A drawn marker icon's half-extents in Dp for `sprite`.+///+/// The single definition both the icon draw and the POI-placement blocker read: the icon+/// draws at [`MARKER_SIZE_DP`] on its larger side keeping its aspect ratio, so the box the+/// placer blocks with is the box the GPU draws — never a second implementation of it.+pub fn marker_icon_half_extents(sprite: crate::tile::sprite::Sprite) -> (f32, f32) {+ let scale = MARKER_SIZE_DP / sprite.width_dp.max(sprite.height_dp).max(1e-3);+ (+ sprite.width_dp * scale * 0.5,+ sprite.height_dp * scale * 0.5,+ )+}+ /// Icon ids: the shared contract with WS-F. Kotlin passes these as ints; the renderer resolves /// each to a sprite-atlas name via [`icon_sprite_name`]. ///@@ -87,17 +126,20 @@ pub mod icon { /// # Provisional pin art /// /// The current sprite sheet (`assets/sprites/[email protected]`) carries the Protomaps POI icons,-/// which have no dedicated *pin* pictograms, so the pin ids map to the closest existing sprite so a-/// marker is visible today rather than blank. A follow-up build-side asset pass can add dedicated-/// `pin-*` sprites and repoint these names with no code change beyond this table — the JNI ids stay-/// the same.+/// which have no dedicated *pin* pictograms, so the remaining pin ids map to the closest+/// existing sprite so a marker is visible today rather than blank. A follow-up build-side+/// asset pass can add dedicated `pin-*` sprites and repoint these names with no code change+/// beyond this table — the JNI ids stay the same. ///-/// # Vehicle art+/// # Vehicle and family art /// /// The vehicle ids resolve to dedicated `vehicle-*` sprites: solid transport-blue badges with /// white Maki glyphs, built by `analysis/spritepack/pack.py` alongside the `fuel`/`hotel`/`bank` /// POI additions. Solid rather than the pale POI badge on purpose — vehicles dwell exactly on /// stops, and pale badges read as duplicated station POIs (seen on-device 2026-09-14).+///+/// The family id resolves to a dedicated `family` sprite the same way: a solid family-indigo+/// badge with a white person glyph, so a family member never reads as a starred POI. pub fn icon_sprite_name(icon: u32) -> Option<&'static str> { let name = match icon { // Pins — provisional mappings onto existing POI sprites (see the doc above).@@ -105,7 +147,7 @@ pub fn icon_sprite_name(icon: u32) -> Option<&'static str> { icon::TRANSIT_STOP => "bus_stop", icon::SEARCH => "attraction", icon::SAVED => "artwork",- icon::FAMILY => "attraction",+ icon::FAMILY => "family", // Vehicles (WS-F) — dedicated solid-badge sprites, not POI icons. icon::VEHICLE_BUS => "vehicle-bus", icon::VEHICLE_TRAM => "vehicle-tram",@@ -164,4 +206,34 @@ mod tests { assert_eq!(icon_sprite_name(icon::VEHICLE_TRAIN), Some("vehicle-train")); assert_eq!(icon_sprite_name(icon::VEHICLE_FERRY), Some("vehicle-ferry")); }++ /// The family pin draws the dedicated indigo person badge, not the provisional+ /// `attraction` star it shared with search pins — a family member must never read+ /// as a starred POI.+ #[test]+ fn the_family_id_maps_to_its_own_sprite() {+ assert_eq!(icon_sprite_name(icon::FAMILY), Some("family"));+ }++ /// The family sprite draws at the POI icon size (38 sheet px at ratio 2 = 19 Dp),+ /// so the pin scales to `MARKER_SIZE_DP` on its larger side exactly like the rest.+ #[test]+ fn the_family_sprite_is_drawn_at_poi_icon_size() {+ let family = crate::tile::sprite::atlas()+ .get("family")+ .expect("family is in the sheet");+ assert!((family.width_dp - 19.0).abs() < 1e-6, "{}", family.width_dp);+ assert!((family.height_dp - 19.0).abs() < 1e-6, "{}", family.height_dp);+ }++ /// Half-extents scale the larger side to `MARKER_SIZE_DP`: a square sprite yields the+ /// 14 Dp half-box the icon draw and the POI-placement blocker both cover.+ #[test]+ fn icon_half_extents_scale_the_larger_side_to_marker_size() {+ let atlas = crate::tile::sprite::atlas();+ let family = atlas.get("family").expect("family is in the sheet");+ let (hw, hh) = marker_icon_half_extents(family);+ assert!((hw - 14.0).abs() < 1e-6, "{hw}");+ assert!((hh - 14.0).abs() < 1e-6, "{hh}");+ } }
library/map/src/main/rust/src/overlay.rs
diff --git a/library/map/src/main/rust/src/overlay.rs b/library/map/src/main/rust/src/overlay.rsindex d439614365..074880fc00 100644--- a/library/map/src/main/rust/src/overlay.rs+++ b/library/map/src/main/rust/src/overlay.rs@@ -180,283 +180,3 @@ pub use crate::overlay_parts::tessellate; #[cfg(test)] #[path = "overlay_tests.rs"] mod tests;- use super::*;- use crate::camera::Camera;-- /// The car's route paint: `#1A73E8` over a white casing, at the phone's authored route- /// width (`maps/.../ui/map/RouteOverlayBuilder.kt`). The old renderer's `12f`/`18f` were- /// physical px and have no Dp equivalent — see `RouteStyle`'s KDoc on the Kotlin side.- fn style() -> RouteStyle {- RouteStyle {- width_dp: 8.0,- casing_dp: 2.0,- casing_color: 0xFFFF_FFFF,- }- }-- /// The fill colour the car draws: what a single-run route is painted.- const FILL: u32 = 0xFF1A_73E8;-- /// Wrap a bare polyline as the one coloured run a single-colour route is.- fn one(points: &[(f64, f64)]) -> Vec<RouteSegment> {- vec![RouteSegment {- points: points.to_vec(),- color: FILL,- }]- }-- /// A three-point route across San Francisco.- fn sf_route() -> Vec<(f64, f64)> {- vec![- (-122.4194, 37.7749),- (-122.3894, 37.7949),- (-122.3694, 37.7849),- ]- }-- fn camera(zoom: f64, bearing: f64) -> Camera {- Camera {- center_lon: -122.4194,- center_lat: 37.7749,- zoom,- width_dp: 411.0,- height_dp: 891.0,- density: 3.0,- bearing_deg: bearing,- pitch_deg: 0.0,- time_seconds: 0.0,- globe: false,- moon: false,- }- }-- /// Where a local `(u, v)` in the route's square lands on screen, in Dp from the- /// viewport centre — the same arithmetic the vertex shader and the viewport transform- /// do between them.- fn screen_dp(mesh: &RouteMesh, camera: &Camera, u: f32, v: f32) -> (f64, f64) {- let (origin, span) = mesh.placement.at_zoom(camera.zoom);- let m = camera.world_quad_to_clip(origin, span);- let x = m[0] * u + m[4] * v + m[12];- let y = m[1] * u + m[5] * v + m[13];- (- x as f64 * camera.width_dp as f64 / 2.0,- y as f64 * camera.height_dp as f64 / 2.0,- )- }-- #[test]- fn a_route_becomes_a_stroked_band() {- let mesh = tessellate(&one(&sf_route()), style()).expect("three points stroke");- assert_eq!(- mesh.vertices.len() / stroke::FLOATS_PER_VERTEX,- 6,- "two vertices per point, one band",- );- assert_eq!(mesh.indices.len(), 12, "two triangles per segment");- assert!(mesh.vertices.iter().all(|f| f.is_finite()));- // One run, owning the whole index buffer, in the fill colour.- assert_eq!(mesh.segments.len(), 1);- assert_eq!(mesh.segments[0].color, FILL);- assert_eq!(mesh.segments[0].index_offset, 0);- assert_eq!(mesh.segments[0].index_count, mesh.indices.len() as u32);- }-- #[test]- fn coloured_runs_each_get_their_own_index_slice() {- // Two runs, two colours: the mesh is one buffer, but each run owns a contiguous,- // non-overlapping slice of the indices that together cover the whole thing — which- // is what lets the casing draw the lot once and each fill draw its own slice.- let segments = vec![- RouteSegment {- points: vec![(-122.42, 37.77), (-122.40, 37.79)],- color: 0xFF00_FF00,- },- RouteSegment {- points: vec![(-122.40, 37.79), (-122.38, 37.78)],- color: 0xFFFF_0000,- },- ];- let mesh = tessellate(&segments, style()).expect("two runs");- assert_eq!(mesh.segments.len(), 2);- assert_eq!(mesh.segments[0].color, 0xFF00_FF00);- assert_eq!(mesh.segments[1].color, 0xFFFF_0000);- assert_eq!(mesh.segments[0].index_offset, 0);- assert_eq!(- mesh.segments[1].index_offset, mesh.segments[0].index_count,- "the second run starts where the first ends",- );- assert_eq!(- mesh.segments[1].index_offset + mesh.segments[1].index_count,- mesh.indices.len() as u32,- "the runs together cover every index",- );- assert!(mesh.vertices.iter().all(|f| f.is_finite()));- }-- #[test]- fn a_degenerate_run_is_skipped_without_failing_the_route() {- // One good run and one glitchy single-point run: the good one still draws, and the- // degenerate one contributes no range rather than blanking the whole route.- let segments = vec![- RouteSegment {- points: vec![(-122.42, 37.77), (-122.40, 37.79)],- color: FILL,- },- RouteSegment {- points: vec![(-122.40, 37.79)],- color: 0xFFFF_0000,- },- ];- let mesh = tessellate(&segments, style()).expect("the good run draws");- assert_eq!(mesh.segments.len(), 1);- assert_eq!(mesh.segments[0].color, FILL);- }-- #[test]- fn a_degenerate_route_draws_nothing_rather_than_dividing_by_zero() {- assert!(tessellate(&[], style()).is_none());- assert!(tessellate(&one(&[(-122.4, 37.7)]), style()).is_none());- // Every point in the same place: no bounding box, no direction, no line.- assert!(tessellate(- &one(&[(-122.4, 37.7), (-122.4, 37.7), (-122.4, 37.7)]),- style()- )- .is_none());- }-- #[test]- fn a_route_running_due_north_still_has_a_square_to_live_in() {- // Zero width on x, which is what squaring the bounding box exists to survive.- let mesh =- tessellate(&one(&[(-122.4, 37.7), (-122.4, 37.8)]), style()).expect("a meridian");- assert!(mesh.placement.span > 0.0);- assert!(mesh.vertices.iter().all(|f| f.is_finite()));- }-- #[test]- fn repeated_points_do_not_produce_a_nan() {- // A router emits coincident points, and a zero-length segment has no direction —- // a NaN normal takes the whole strip off screen, not just that segment.- let doubled = vec![- (-122.4194, 37.7749),- (-122.4194, 37.7749),- (-122.3894, 37.7949),- (-122.3894, 37.7949),- (-122.3694, 37.7849),- ];- let mesh = tessellate(&one(&doubled), style()).expect("a route");- for (at, value) in mesh.vertices.iter().enumerate() {- assert!(value.is_finite(), "float {at} is {value}");- }- }-- #[test]- fn the_local_geometry_is_the_same_number_at_every_zoom() {- // The claim the whole design rests on: Mercator is a pure scale in zoom, so- // normalising by the bounding box divides that scale out and the mesh never needs- // rebuilding. If this stops holding, a route in a car starts re-tessellating on- // every pinch — which is the cost this design exists to avoid.- let route = sf_route();- let mesh = tessellate(&one(&route), style()).expect("a route");- let reference: Vec<(f64, f64)> = route- .iter()- .map(|&(lon, lat)| {- let p = project(lon, lat, 0.0);- (- (p.x - mesh.placement.origin.x) / mesh.placement.span,- (p.y - mesh.placement.origin.y) / mesh.placeme
Diff truncated.