Merge "Added indication update mode support"

This commit is contained in:
Jack Yu
2018-03-01 20:04:29 +00:00
committed by Gerrit Code Review
2 changed files with 87 additions and 0 deletions

View File

@@ -7465,4 +7465,83 @@ public class TelephonyManager {
Log.e(TAG, "Error calling ITelephony#setUserDataEnabled", e);
}
}
/**
* In this mode, modem will not send specified indications when screen is off.
* @hide
*/
public static final int INDICATION_UPDATE_MODE_NORMAL = 1;
/**
* In this mode, modem will still send specified indications when screen is off.
* @hide
*/
public static final int INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF = 2;
/** @hide */
@IntDef(prefix = { "INDICATION_UPDATE_MODE_" }, value = {
INDICATION_UPDATE_MODE_NORMAL,
INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF
})
@Retention(RetentionPolicy.SOURCE)
public @interface IndicationUpdateMode{}
/**
* The indication for signal strength update.
* @hide
*/
public static final int INDICATION_FILTER_SIGNAL_STRENGTH = 0x1;
/**
* The indication for full network state update.
* @hide
*/
public static final int INDICATION_FILTER_FULL_NETWORK_STATE = 0x2;
/**
* The indication for data call dormancy changed update.
* @hide
*/
public static final int INDICATION_FILTER_DATA_CALL_DORMANCY_CHANGED = 0x4;
/** @hide */
@IntDef(flag = true, prefix = { "INDICATION_FILTER_" }, value = {
INDICATION_FILTER_SIGNAL_STRENGTH,
INDICATION_FILTER_FULL_NETWORK_STATE,
INDICATION_FILTER_DATA_CALL_DORMANCY_CHANGED
})
@Retention(RetentionPolicy.SOURCE)
public @interface IndicationFilters{}
/**
* Sets radio indication update mode. This can be used to control the behavior of indication
* update from modem to Android frameworks. For example, by default several indication updates
* are turned off when screen is off, but in some special cases (e.g. carkit is connected but
* screen is off) we want to turn on those indications even when the screen is off.
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* @param filters Indication filters. Should be a bitmask of INDICATION_FILTER_XXX.
* @see #INDICATION_FILTER_SIGNAL_STRENGTH
* @see #INDICATION_FILTER_FULL_NETWORK_STATE
* @see #INDICATION_FILTER_DATA_CALL_DORMANCY_CHANGED
* @param updateMode The voice activation state
* @see #INDICATION_UPDATE_MODE_NORMAL
* @see #INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void setRadioIndicationUpdateMode(@IndicationFilters int filters,
@IndicationUpdateMode int updateMode) {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
telephony.setRadioIndicationUpdateMode(getSubId(), filters, updateMode);
}
} catch (RemoteException ex) {
// This could happen if binder process crashes.
ex.rethrowAsRuntimeException();
}
}
}

View File

@@ -1479,4 +1479,12 @@ interface ITelephony {
* @return boolean Return true if the switch succeeds, false if the switch fails.
*/
boolean switchSlots(in int[] physicalSlots);
/**
* Sets radio indication update mode. This can be used to control the behavior of indication
* update from modem to Android frameworks. For example, by default several indication updates
* are turned off when screen is off, but in some special cases (e.g. carkit is connected but
* screen is off) we want to turn on those indications even when the screen is off.
*/
void setRadioIndicationUpdateMode(int subId, int filters, int mode);
}