Create module-specific Hal versions

Bug: 243072871
Test: cts test
Change-Id: Ib4bd4e42677b6d506a509a0097b86dd4a9acb012
This commit is contained in:
jimsun
2022-09-13 18:24:41 +08:00
parent 90e81227d9
commit a4c9bc8003
4 changed files with 137 additions and 6 deletions

View File

@@ -2622,13 +2622,23 @@ package android.telephony {
method public int getCarrierIdListVersion();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<java.lang.String> getCertsFromCarrierPrivilegeAccessRules();
method @NonNull public java.util.List<android.telephony.data.ApnSetting> getDevicePolicyOverrideApns(@NonNull android.content.Context);
method @NonNull public android.util.Pair<java.lang.Integer,java.lang.Integer> getHalVersion(int);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
method @Deprecated public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
method public boolean modifyDevicePolicyOverrideApn(@NonNull android.content.Context, int, @NonNull android.telephony.data.ApnSetting);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
method public void setCarrierTestOverride(String, String, String, String, String, String, String, String, String);
method @RequiresPermission(android.Manifest.permission.BIND_TELECOM_CONNECTION_SERVICE) public void setVoiceServiceStateOverride(boolean);
field public static final int HAL_SERVICE_DATA = 1; // 0x1
field public static final int HAL_SERVICE_IMS = 7; // 0x7
field public static final int HAL_SERVICE_MESSAGING = 2; // 0x2
field public static final int HAL_SERVICE_MODEM = 3; // 0x3
field public static final int HAL_SERVICE_NETWORK = 4; // 0x4
field public static final int HAL_SERVICE_SIM = 5; // 0x5
field public static final int HAL_SERVICE_VOICE = 6; // 0x6
field public static final android.util.Pair HAL_VERSION_UNKNOWN;
field public static final android.util.Pair HAL_VERSION_UNSUPPORTED;
field public static final int UNKNOWN_CARRIER_ID_LIST_VERSION = -1; // 0xffffffff
}

View File

@@ -567,6 +567,10 @@ MissingNullability: android.telephony.SmsManager#checkSmsShortCodeDestination(St
Missing nullability on parameter `destAddress` in method `checkSmsShortCodeDestination`
MissingNullability: android.telephony.SmsManager#checkSmsShortCodeDestination(String, String) parameter #1:
Missing nullability on parameter `countryIso` in method `checkSmsShortCodeDestination`
MissingNullability: android.telephony.TelephonyManager#HAL_VERSION_UNKNOWN:
Missing nullability on field `HAL_VERSION_UNKNOWN` in class `class android.telephony.TelephonyManager`
MissingNullability: android.telephony.TelephonyManager#HAL_VERSION_UNSUPPORTED:
Missing nullability on field `HAL_VERSION_UNSUPPORTED` in class `class android.telephony.TelephonyManager`
MissingNullability: android.telephony.TelephonyManager#getLine1AlphaTag():
Missing nullability on method `getLine1AlphaTag` return
MissingNullability: android.telephony.TelephonyManager#getRadioHalVersion():

View File

@@ -14957,21 +14957,132 @@ public class TelephonyManager {
* @return a Pair of (major version, minor version) or (-1,-1) if unknown.
*
* @hide
*
* @deprecated Use {@link #getHalVersion} instead.
*/
@Deprecated
@UnsupportedAppUsage
@TestApi
public Pair<Integer, Integer> getRadioHalVersion() {
return getHalVersion(HAL_SERVICE_RADIO);
}
/** @hide */
public static final int HAL_SERVICE_RADIO = 0;
/**
* HAL service type that supports the HAL APIs implementation of IRadioData
* {@link RadioDataProxy}
* @hide
*/
@TestApi
public static final int HAL_SERVICE_DATA = 1;
/**
* HAL service type that supports the HAL APIs implementation of IRadioMessaging
* {@link RadioMessagingProxy}
* @hide
*/
@TestApi
public static final int HAL_SERVICE_MESSAGING = 2;
/**
* HAL service type that supports the HAL APIs implementation of IRadioModem
* {@link RadioModemProxy}
* @hide
*/
@TestApi
public static final int HAL_SERVICE_MODEM = 3;
/**
* HAL service type that supports the HAL APIs implementation of IRadioNetwork
* {@link RadioNetworkProxy}
* @hide
*/
@TestApi
public static final int HAL_SERVICE_NETWORK = 4;
/**
* HAL service type that supports the HAL APIs implementation of IRadioSim
* {@link RadioSimProxy}
* @hide
*/
@TestApi
public static final int HAL_SERVICE_SIM = 5;
/**
* HAL service type that supports the HAL APIs implementation of IRadioVoice
* {@link RadioVoiceProxy}
* @hide
*/
@TestApi
public static final int HAL_SERVICE_VOICE = 6;
/**
* HAL service type that supports the HAL APIs implementation of IRadioIms
* {@link RadioImsProxy}
* @hide
*/
@TestApi
public static final int HAL_SERVICE_IMS = 7;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"HAL_SERVICE_"},
value = {
HAL_SERVICE_RADIO,
HAL_SERVICE_DATA,
HAL_SERVICE_MESSAGING,
HAL_SERVICE_MODEM,
HAL_SERVICE_NETWORK,
HAL_SERVICE_SIM,
HAL_SERVICE_VOICE,
HAL_SERVICE_IMS,
})
public @interface HalService {}
/**
* The HAL Version indicating that the version is unknown or invalid.
* @hide
*/
@TestApi
public static final Pair HAL_VERSION_UNKNOWN = new Pair(-1, -1);
/**
* The HAL Version indicating that the version is unsupported.
* @hide
*/
@TestApi
public static final Pair HAL_VERSION_UNSUPPORTED = new Pair(-2, -2);
/**
* Retrieve the HAL Version of a specific service for this device.
*
* Get the HAL version for a specific HAL interface for test purposes.
*
* @param halService the service id to query.
* @return a Pair of (major version, minor version), HAL_VERSION_UNKNOWN if unknown
* or HAL_VERSION_UNSUPPORTED if unsupported.
*
* @hide
*/
@TestApi
public @NonNull Pair<Integer, Integer> getHalVersion(@HalService int halService) {
try {
ITelephony service = getITelephony();
if (service != null) {
int version = service.getRadioHalVersion();
if (version == -1) return new Pair<Integer, Integer>(-1, -1);
return new Pair<Integer, Integer>(version / 100, version % 100);
int version = service.getHalVersion(halService);
if (version != -1) {
return new Pair<Integer, Integer>(version / 100, version % 100);
}
} else {
throw new IllegalStateException("telephony service is null.");
}
} catch (RemoteException e) {
Log.e(TAG, "getRadioHalVersion() RemoteException", e);
Log.e(TAG, "getHalVersion() RemoteException", e);
e.rethrowAsRuntimeException();
}
return new Pair<Integer, Integer>(-1, -1);
return HAL_VERSION_UNKNOWN;
}
/**

View File

@@ -2158,6 +2158,12 @@ interface ITelephony {
*/
int getRadioHalVersion();
/**
* Get the HAL Version of a specific service
* encoded as 100 * MAJOR_VERSION + MINOR_VERSION or -1 if unknown
*/
int getHalVersion(int service);
/**
* Get the current calling package name.
*/