From 7ae19636cadde50f879100c55aa63a06443d11d3 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Tue, 27 Feb 2018 15:15:14 -0800 Subject: [PATCH] Added indication update mode support Adde the indication update mode support so that a system component can control the behavior of indication update. This will be used by the bluetooth stack when some BT devices such like carkit is connected, modem will continue update the signal strength even when the screen is off. Test: Manual Bug: 65112388 Merged-In: I4bb4894eaaba401f655e5dc25138275f5e8498e1 Change-Id: I4bb4894eaaba401f655e5dc25138275f5e8498e1 (cherry picked from commit 1a1c35750b2612e040c9392b4d0d6f4e1a2b3b8a) --- .../android/telephony/TelephonyManager.java | 79 +++++++++++++++++++ .../internal/telephony/ITelephony.aidl | 8 ++ 2 files changed, 87 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 29f8eb40ba24c..6c948f0d4a89a 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -7400,4 +7400,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. + * + *

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(); + } + } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 2b4c059cf69f0..aaa84a51177a9 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -1468,4 +1468,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); }