Merge "Add Radio Interface Capabilities" am: e44156cfd6 am: c24ad90810
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1522306 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I18cccffb56b7c6fd1c056075c914634235457722
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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;
|
||||
|
||||
import android.util.ArraySet;
|
||||
|
||||
/**
|
||||
* Contains the set of supported capabilities that the Radio Interface supports on this device.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public class RadioInterfaceCapabilities {
|
||||
|
||||
private final ArraySet<String> mSupportedCapabilities;
|
||||
|
||||
|
||||
public RadioInterfaceCapabilities() {
|
||||
mSupportedCapabilities = new ArraySet<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a capability as supported
|
||||
*
|
||||
* @param capabilityName the name of the capability
|
||||
*/
|
||||
public void addSupportedCapability(
|
||||
@TelephonyManager.RadioInterfaceCapability String capabilityName) {
|
||||
mSupportedCapabilities.add(capabilityName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the capability is supported
|
||||
*
|
||||
* @param capabilityName the name of the capability
|
||||
*/
|
||||
public boolean isSupported(String capabilityName) {
|
||||
return mSupportedCapabilities.contains(capabilityName);
|
||||
}
|
||||
}
|
||||
@@ -14344,6 +14344,40 @@ public class TelephonyManager {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = {"RADIO_INTERFACE_CAPABILITY_"},
|
||||
value = {})
|
||||
public @interface RadioInterfaceCapability {}
|
||||
|
||||
/**
|
||||
* Whether the device supports a given capability on the radio interface.
|
||||
*
|
||||
* If the capability is not in the set of radio interface capabilities, false is returned.
|
||||
*
|
||||
* @param capability the name of the capability to check for
|
||||
* @return the availability of the capability
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public boolean isRadioInterfaceCapabilitySupported(
|
||||
@NonNull @RadioInterfaceCapability String capability) {
|
||||
try {
|
||||
if (capability == null) return false;
|
||||
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.isRadioInterfaceCapabilitySupported(capability);
|
||||
} else {
|
||||
throw new IllegalStateException("telephony service is null.");
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
if (!isSystemProcess()) {
|
||||
ex.rethrowAsRuntimeException();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that the thermal mitigation request was completed successfully.
|
||||
*
|
||||
|
||||
@@ -2279,6 +2279,14 @@ interface ITelephony {
|
||||
*/
|
||||
CarrierBandwidth getCarrierBandwidth(int subId);
|
||||
|
||||
/**
|
||||
* Checks whether the device supports the given capability on the radio interface.
|
||||
*
|
||||
* @param capability the name of the capability
|
||||
* @return the availability of the capability
|
||||
*/
|
||||
boolean isRadioInterfaceCapabilitySupported(String capability);
|
||||
|
||||
/**
|
||||
* Thermal mitigation request to control functionalities at modem.
|
||||
*
|
||||
|
||||
@@ -520,6 +520,7 @@ public interface RILConstants {
|
||||
int RIL_REQUEST_START_HANDOVER = 217;
|
||||
int RIL_REQUEST_CANCEL_HANDOVER = 218;
|
||||
int RIL_REQUEST_GET_SYSTEM_SELECTION_CHANNELS = 219;
|
||||
int RIL_REQUEST_GET_HAL_DEVICE_CAPABILITIES = 220;
|
||||
int RIL_REQUEST_SET_DATA_THROTTLING = 221;
|
||||
int RIL_REQUEST_SET_ALLOWED_NETWORK_TYPE_BITMAP = 222;
|
||||
int RIL_REQUEST_GET_ALLOWED_NETWORK_TYPE_BITMAP = 223;
|
||||
|
||||
Reference in New Issue
Block a user