Merge "Add call accessibility activity."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 3be2bb0..b165ab1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -440,6 +440,17 @@
</intent-filter>
</receiver>
+ <!-- "Accessibility" settings UI. Referenced by Dialer application. -->
+ <activity android:name="com.android.phone.settings.AccessibilitySettingsActivity"
+ android:label="@string/accessibility_settings_activity_title"
+ android:theme="@style/DialerSettingsLight">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <action android:name="android.telecom.action.SHOW_CALL_ACCESSIBILITY_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
<!-- CDMA Emergency Callback Mode -->
<service android:name="EmergencyCallbackModeService">
</service>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3ae121c..2a3f3bd 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1261,6 +1261,11 @@
<string name="sim_label_emergency_calls">Emergency calls</string>
<string name="sim_description_emergency_calls">Emergency calling only</string>
<string name="sim_description_default">SIM card, slot: <xliff:g id="slot_id">%s</xliff:g></string>
+
+ <!-- Title for activity to control accessibility settings such as TTY mode and hearing aid
+ compatability. [CHAR LIMIT=40] -->
+ <string name="accessibility_settings_activity_title">Accessibility</string>
+
<!-- Configuration setting for world mode Format is <true;GID if any to be checked>-->
<string translatable="false" name="config_world_mode"/>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
new file mode 100644
index 0000000..a67e2ad
--- /dev/null
+++ b/res/xml/accessibility_settings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:phone="http://schemas.android.com/apk/res/com.android.phone"
+ android:title="@string/accessibility_settings_activity_title">
+
+ <com.android.phone.settings.TtyModeListPreference
+ android:key="@string/tty_mode_key"
+ android:title="@string/tty_mode_option_title"
+ android:summary="@string/tty_mode_option_summary"
+ android:persistent="false"
+ android:entries="@array/tty_mode_entries"
+ android:entryValues="@array/tty_mode_values"/>
+
+ <CheckBoxPreference
+ android:key="button_hac_key"
+ android:title="@string/hac_mode_title"
+ android:persistent="true"
+ android:summary="@string/hac_mode_summary"/>
+
+</PreferenceScreen>
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 5c90bc8..65611e8 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -94,20 +94,6 @@
android:persistent="false"
android:summary="@string/auto_retry_mode_summary"/>
- <com.android.phone.settings.TtyModeListPreference
- android:key="@string/tty_mode_key"
- android:title="@string/tty_mode_option_title"
- android:summary="@string/tty_mode_option_summary"
- android:persistent="false"
- android:entries="@array/tty_mode_entries"
- android:entryValues="@array/tty_mode_values"/>
-
- <CheckBoxPreference
- android:key="button_hac_key"
- android:title="@string/hac_mode_title"
- android:persistent="true"
- android:summary="@string/hac_mode_summary"/>
-
<PreferenceScreen
android:key="button_gsm_more_expand_key"
android:title="@string/labelGSMMore"
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 95d7510..6d3b252 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -26,7 +26,6 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
-import android.media.AudioManager;
import android.os.AsyncResult;
import android.os.Bundle;
import android.os.Handler;
@@ -41,7 +40,6 @@
import android.provider.Settings;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
-import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -56,7 +54,7 @@
import com.android.phone.common.util.SettingsUtil;
import com.android.phone.settings.AccountSelectionPreference;
import com.android.phone.settings.CallForwardInfoUtil;
-import com.android.phone.settings.TtyModeListPreference;
+import com.android.phone.settings.SettingsConstants;
import com.android.phone.settings.VoicemailDialogUtil;
import com.android.phone.settings.VoicemailNotificationSettingsUtil;
import com.android.phone.settings.VoicemailProviderListPreference;
@@ -155,8 +153,6 @@
private static final String BUTTON_FDN_KEY = "button_fdn_key";
private static final String BUTTON_RETRY_KEY = "button_auto_retry_key";
- private static final String BUTTON_TTY_KEY = "button_tty_mode_key";
- private static final String BUTTON_HAC_KEY = "button_hac_key";
private static final String BUTTON_GSM_UMTS_OPTIONS = "button_gsm_more_expand_key";
private static final String BUTTON_CDMA_OPTIONS = "button_cdma_more_expand_key";
@@ -173,24 +169,17 @@
private static final int EVENT_FORWARDING_CHANGED = 501;
private static final int EVENT_FORWARDING_GET_COMPLETED = 502;
- public static final String HAC_KEY = "HACSetting";
- public static final String HAC_VAL_ON = "ON";
- public static final String HAC_VAL_OFF = "OFF";
-
/** Handle to voicemail pref */
private static final int VOICEMAIL_PREF_ID = 1;
private static final int VOICEMAIL_PROVIDER_CFG_ID = 2;
private Phone mPhone;
- private AudioManager mAudioManager;
private SubscriptionInfoHelper mSubscriptionInfoHelper;
private EditPhoneNumberPreference mSubMenuVoicemailSettings;
private CheckBoxPreference mButtonAutoRetry;
- private CheckBoxPreference mButtonHAC;
- private TtyModeListPreference mButtonTTY;
private VoicemailProviderListPreference mVoicemailProviders;
private PreferenceScreen mVoicemailSettingsScreen;
private PreferenceScreen mVoicemailSettings;
@@ -276,13 +265,6 @@
public void onPause() {
super.onPause();
mForeground = false;
-
- if (ImsManager.isVolteEnabledByPlatform(this) &&
- !mPhone.getContext().getResources().getBoolean(
- com.android.internal.R.bool.config_carrier_volte_tty_supported)) {
- TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
- }
}
/**
@@ -303,23 +285,6 @@
*/
private boolean mSetupVoicemail = false;
- private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
- /**
- * Enable/disable the TTY setting when in/out of a call (and if carrier doesn't
- * support VoLTE with TTY).
- * @see android.telephony.PhoneStateListener#onCallStateChanged(int,
- * java.lang.String)
- */
- @Override
- public void onCallStateChanged(int state, String incomingNumber) {
- if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
- Preference pref = getPreferenceScreen().findPreference(BUTTON_TTY_KEY);
- if (pref != null) {
- pref.setEnabled(state == TelephonyManager.CALL_STATE_IDLE);
- }
- }
- };
-
/*
* Click Listeners, handle click based on objects attached to UI.
*/
@@ -329,22 +294,11 @@
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (preference == mSubMenuVoicemailSettings) {
return true;
- } else if (preference == mButtonTTY) {
- return true;
} else if (preference == mButtonAutoRetry) {
android.provider.Settings.Global.putInt(mPhone.getContext().getContentResolver(),
android.provider.Settings.Global.CALL_AUTO_RETRY,
mButtonAutoRetry.isChecked() ? 1 : 0);
return true;
- } else if (preference == mButtonHAC) {
- int hac = mButtonHAC.isChecked() ? 1 : 0;
- // Update HAC value in Settings database
- Settings.System.putInt(mPhone.getContext().getContentResolver(),
- Settings.System.HEARING_AID, hac);
-
- // Update HAC Value in AudioManager
- mAudioManager.setParameter(HAC_KEY, hac != 0 ? HAC_VAL_ON : HAC_VAL_OFF);
- return true;
} else if (preference.getKey().equals(mVoicemailSettings.getKey())) {
// Check key instead of comparing reference because closing the voicemail notification
// ringtone dialog invokes onResume(), but leaves the old preference screen up,
@@ -1134,8 +1088,6 @@
return;
}
- mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-
// Show the voicemail preference in onResume if the calling intent specifies the
// ACTION_ADD_VOICEMAIL action.
mShowVoicemailPreference = (icicle == null) &&
@@ -1178,9 +1130,6 @@
mSubMenuVoicemailSettings.setDialogTitle(R.string.voicemail_settings_number_label);
mButtonAutoRetry = (CheckBoxPreference) findPreference(BUTTON_RETRY_KEY);
- mButtonHAC = (CheckBoxPreference) findPreference(BUTTON_HAC_KEY);
- mButtonTTY = (TtyModeListPreference) findPreference(
- getResources().getString(R.string.tty_mode_key));
mVoicemailProviders = (VoicemailProviderListPreference) findPreference(
BUTTON_VOICEMAIL_PROVIDER_KEY);
@@ -1214,22 +1163,6 @@
mButtonAutoRetry = null;
}
- if (getResources().getBoolean(R.bool.hac_enabled)) {
- mButtonHAC.setOnPreferenceChangeListener(this);
- int hac = Settings.System.getInt(getContentResolver(), Settings.System.HEARING_AID, 0);
- mButtonHAC.setChecked(hac != 0);
- } else {
- prefSet.removePreference(mButtonHAC);
- mButtonHAC = null;
- }
-
- if (!telephonyManager.isMultiSimEnabled() && telecomManager.isTtySupported()) {
- mButtonTTY.init();
- } else {
- prefSet.removePreference(mButtonTTY);
- mButtonTTY = null;
- }
-
if (!getResources().getBoolean(R.bool.world_phone)) {
Preference cdmaOptions = prefSet.findPreference(BUTTON_CDMA_OPTIONS);
prefSet.removePreference(cdmaOptions);
@@ -1307,13 +1240,6 @@
} else {
prefSet.removePreference(mEnableVideoCalling);
}
-
- if (ImsManager.isVolteEnabledByPlatform(this) &&
- !mPhone.getContext().getResources().getBoolean(
- com.android.internal.R.bool.config_carrier_volte_tty_supported)) {
- TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
- }
}
@Override
diff --git a/src/com/android/phone/Constants.java b/src/com/android/phone/Constants.java
index 79a1e9a..64414e9 100644
--- a/src/com/android/phone/Constants.java
+++ b/src/com/android/phone/Constants.java
@@ -130,7 +130,4 @@
// OutgoingCallBroadcaster, OtaUtils, etc.)
//
- // Dtmf tone type setting value for CDMA phone
- public static final int DTMF_TONE_TYPE_NORMAL = 0;
- public static final int DTMF_TONE_TYPE_LONG = 1;
}
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index d13ebfe..94a4661 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -64,6 +64,7 @@
import com.android.internal.telephony.TelephonyCapabilities;
import com.android.internal.telephony.TelephonyIntents;
import com.android.phone.common.CallLogAsync;
+import com.android.phone.settings.SettingsConstants;
import com.android.server.sip.SipService;
import java.util.ArrayList;
@@ -456,9 +457,9 @@
android.provider.Settings.System.HEARING_AID,
0);
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
- audioManager.setParameter(CallFeaturesSetting.HAC_KEY, hac != 0 ?
- CallFeaturesSetting.HAC_VAL_ON :
- CallFeaturesSetting.HAC_VAL_OFF);
+ audioManager.setParameter(SettingsConstants.HAC_KEY,
+ hac == SettingsConstants.HAC_ENABLED
+ ? SettingsConstants.HAC_VAL_ON : SettingsConstants.HAC_VAL_OFF);
}
}
diff --git a/src/com/android/phone/settings/AccessibilitySettingsActivity.java b/src/com/android/phone/settings/AccessibilitySettingsActivity.java
new file mode 100644
index 0000000..769ef61
--- /dev/null
+++ b/src/com/android/phone/settings/AccessibilitySettingsActivity.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2015 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 com.android.phone.settings;
+
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.view.MenuItem;
+
+import com.android.phone.R;
+
+public class AccessibilitySettingsActivity extends PreferenceActivity {
+
+ @Override
+ protected void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ getActionBar().setTitle(R.string.accessibility_settings_activity_title);
+ getFragmentManager().beginTransaction().replace(
+ android.R.id.content, new AccessibilitySettingsFragment()).commit();
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ onBackPressed();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/src/com/android/phone/settings/AccessibilitySettingsFragment.java b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
new file mode 100644
index 0000000..4d78026
--- /dev/null
+++ b/src/com/android/phone/settings/AccessibilitySettingsFragment.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2015 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 com.android.phone.settings;
+
+import android.content.Context;
+import android.media.AudioManager;
+import android.os.Bundle;
+import android.preference.CheckBoxPreference;
+import android.preference.Preference;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+import android.telecom.TelecomManager;
+import android.telephony.PhoneStateListener;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+
+import com.android.ims.ImsManager;
+import com.android.phone.PhoneGlobals;
+import com.android.phone.R;
+import com.android.phone.settings.TtyModeListPreference;
+
+public class AccessibilitySettingsFragment extends PreferenceFragment {
+ private static final String LOG_TAG = AccessibilitySettingsFragment.class.getSimpleName();
+ private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
+
+ private static final String BUTTON_TTY_KEY = "button_tty_mode_key";
+ private static final String BUTTON_HAC_KEY = "button_hac_key";
+
+ private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
+ /**
+ * Enable/disable the TTY setting when in/out of a call (and if carrier doesn't
+ * support VoLTE with TTY).
+ * @see android.telephony.PhoneStateListener#onCallStateChanged(int,
+ * java.lang.String)
+ */
+ @Override
+ public void onCallStateChanged(int state, String incomingNumber) {
+ if (DBG) Log.d(LOG_TAG, "PhoneStateListener.onCallStateChanged: state=" + state);
+ Preference pref = getPreferenceScreen().findPreference(BUTTON_TTY_KEY);
+ if (pref != null) {
+ pref.setEnabled(state == TelephonyManager.CALL_STATE_IDLE);
+ }
+ }
+ };
+
+ private Context mContext;
+ private AudioManager mAudioManager;
+
+ private TtyModeListPreference mButtonTTY;
+ private CheckBoxPreference mButtonHAC;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mContext = getActivity().getApplicationContext();
+ mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+
+ addPreferencesFromResource(R.xml.accessibility_settings);
+
+ mButtonTTY = (TtyModeListPreference) findPreference(
+ getResources().getString(R.string.tty_mode_key));
+ mButtonHAC = (CheckBoxPreference) findPreference(BUTTON_HAC_KEY);
+
+ TelecomManager telecomManager = TelecomManager.from(mContext);
+ TelephonyManager telephonyManager =
+ (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+
+ if (!telephonyManager.isMultiSimEnabled() && telecomManager.isTtySupported()) {
+ mButtonTTY.init();
+ } else {
+ getPreferenceScreen().removePreference(mButtonTTY);
+ mButtonTTY = null;
+ }
+
+ if (getResources().getBoolean(R.bool.hac_enabled)) {
+ int hac = Settings.System.getInt(mContext.getContentResolver(),
+ Settings.System.HEARING_AID, SettingsConstants.HAC_DISABLED);
+ mButtonHAC.setChecked(hac == SettingsConstants.HAC_ENABLED);
+ } else {
+ getPreferenceScreen().removePreference(mButtonHAC);
+ mButtonHAC = null;
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (ImsManager.isVolteEnabledByPlatform(mContext) &&
+ mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_carrier_volte_tty_supported)) {
+ TelephonyManager tm =
+ (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
+ }
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+
+ if (ImsManager.isVolteEnabledByPlatform(mContext) &&
+ !mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_carrier_volte_tty_supported)) {
+ TelephonyManager tm =
+ (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
+ }
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ if (preference == mButtonTTY) {
+ return true;
+ } else if (preference == mButtonHAC) {
+ int hac = mButtonHAC.isChecked()
+ ? SettingsConstants.HAC_ENABLED : SettingsConstants.HAC_DISABLED;
+ // Update HAC value in Settings database.
+ Settings.System.putInt(mContext.getContentResolver(), Settings.System.HEARING_AID, hac);
+
+ // Update HAC Value in AudioManager.
+ mAudioManager.setParameter(SettingsConstants.HAC_KEY,
+ hac == SettingsConstants.HAC_ENABLED
+ ? SettingsConstants.HAC_VAL_ON : SettingsConstants.HAC_VAL_OFF);
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/com/android/phone/settings/SettingsConstants.java b/src/com/android/phone/settings/SettingsConstants.java
new file mode 100644
index 0000000..c17e6df
--- /dev/null
+++ b/src/com/android/phone/settings/SettingsConstants.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 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 com.android.phone.settings;
+
+/**
+ * Constants related to settings which are shared by two or more classes.
+ */
+public class SettingsConstants {
+ // Dtmf tone type setting value for CDMA phone
+ public static final int DTMF_TONE_TYPE_NORMAL = 0;
+ public static final int DTMF_TONE_TYPE_LONG = 1;
+
+ // Hearing Aid Compatability settings values.
+ public static final String HAC_KEY = "HACSetting";
+ public static final int HAC_DISABLED = 0;
+ public static final int HAC_ENABLED = 1;
+ public static final String HAC_VAL_ON = "ON";
+ public static final String HAC_VAL_OFF = "OFF";
+}
diff --git a/src/com/android/services/telephony/CdmaConnection.java b/src/com/android/services/telephony/CdmaConnection.java
index 0baa3cc..74e0673 100644
--- a/src/com/android/services/telephony/CdmaConnection.java
+++ b/src/com/android/services/telephony/CdmaConnection.java
@@ -27,7 +27,7 @@
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.Phone;
-import com.android.phone.Constants;
+import com.android.phone.settings.SettingsConstants;
import java.util.LinkedList;
import java.util.Queue;
@@ -234,8 +234,8 @@
int dtmfTypeSetting = Settings.System.getInt(
getPhone().getContext().getContentResolver(),
Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,
- Constants.DTMF_TONE_TYPE_NORMAL);
- return dtmfTypeSetting == Constants.DTMF_TONE_TYPE_NORMAL;
+ SettingsConstants.DTMF_TONE_TYPE_NORMAL);
+ return dtmfTypeSetting == SettingsConstants.DTMF_TONE_TYPE_NORMAL;
}
private void sendShortDtmfToNetwork(char digit) {