Fix voice access problem on location page.

- Remove the seletcable attribute on footer preference so that
voice access can identify learn more.
- Apply latest footer preference API to set an action on learn more.
- Remove unuse string resource.

Test: Verify that talkback and voice access work well.
Fix: 189652942
Change-Id: I45fcd21d6a2d693d8b5eaa446aaccb769f1c0c7f
This commit is contained in:
Tsung-Mao Fang
2021-06-01 14:58:21 +08:00
parent 4abbe80385
commit 47bd62bdab
3 changed files with 16 additions and 10 deletions

View File

@@ -695,9 +695,8 @@
emergency responders when you call or text an emergency number.
</string>
<!-- Location settings footer link to support page [CHAR LIMIT=NONE] -->
<string name="location_settings_footer_learn_more">
&lt;a href="<xliff:g example="http://www.google.com"
id="url"> https://support.google.com/android/answer/3467281</xliff:g>">Learn more&lt;/a>
<string name="location_settings_footer_learn_more_link" translatable="false">
https://support.google.com/android/answer/3467281
</string>
<!-- Location settings footer link content description [CHAR LIMIT=NONE] -->
<string name="location_settings_footer_learn_more_content_description">

View File

@@ -71,7 +71,6 @@
<com.android.settingslib.widget.FooterPreference
android:title="@string/location_settings_footer_general"
android:key="location_footer"
android:selectable="false"
settings:searchable="false"
settings:controller="com.android.settings.location.LocationSettingsFooterPreferenceController"/>
</PreferenceScreen>

View File

@@ -31,6 +31,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.HelpUtils;
import com.android.settingslib.widget.FooterPreference;
import java.util.ArrayList;
@@ -104,15 +105,22 @@ public class LocationSettingsFooterPreferenceController extends LocationBasePref
+ footerString;
}
if (mFooterPreference != null) {
mFooterPreference.setTitle(Html.fromHtml(footerString
+ PARAGRAPH_SEPARATOR
+ mContext.getString(
R.string.location_settings_footer_learn_more)));
mFooterPreference.setContentDescription(Html.fromHtml(footerString + mContext.getString(
R.string.location_settings_footer_learn_more_content_description)));
mFooterPreference.setTitle(Html.fromHtml(footerString));
mFooterPreference.setLearnMoreAction(v -> openLocationLearnMoreLink());
mFooterPreference.setLearnMoreContentDescription(mContext.getString(
R.string.location_settings_footer_learn_more_content_description));
}
}
private void openLocationLearnMoreLink() {
mFragment.startActivityForResult(
HelpUtils.getHelpIntent(
mContext,
mContext.getString(R.string.location_settings_footer_learn_more_link),
/*backupContext=*/""),
/*requestCode=*/ 0);
}
/**
* Location footer preference group should always be displayed.
*/