[Wi-Fi] Use getUriHelpString() result to judge if Settings APP should register the help button click event and file related intent if need.
The Openroaming help button should show only when the getHelpUriString() value is not null, and need to handle the click event in Settings APP. Bug: 146669261 Test: Adjust unit test cases: 1. make RunSettingsRoboTests ROBOTEST_FILTER=WifiEntryPreferenceTest 2. make RunSettingsRoboTests ROBOTEST_FILTER=WifiSettings2Test Change-Id: I27a717c3014b01cc464908bac56f64bd08aa5da3
This commit is contained in:
@@ -769,9 +769,9 @@ public class WifiSettings2 extends RestrictedSettingsFragment
|
||||
pref.setOrder(index++);
|
||||
pref.refresh();
|
||||
|
||||
if (wifiEntry.canManageSubscription()) {
|
||||
if (wifiEntry.getHelpUriString() != null) {
|
||||
pref.setOnButtonClickListener(preference -> {
|
||||
openSubscriptionHelpPage();
|
||||
openSubscriptionHelpPage(wifiEntry);
|
||||
});
|
||||
}
|
||||
mWifiEntryPreferenceCategory.addPreference(pref);
|
||||
@@ -1095,8 +1095,8 @@ public class WifiSettings2 extends RestrictedSettingsFragment
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void openSubscriptionHelpPage() {
|
||||
final Intent intent = getHelpIntent(getContext());
|
||||
void openSubscriptionHelpPage(WifiEntry wifiEntry) {
|
||||
final Intent intent = getHelpIntent(getContext(), wifiEntry.getHelpUriString());
|
||||
if (intent != null) {
|
||||
try {
|
||||
startActivityForResult(intent, MANAGE_SUBSCRIPTION);
|
||||
@@ -1107,10 +1107,7 @@ public class WifiSettings2 extends RestrictedSettingsFragment
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
Intent getHelpIntent(Context context) {
|
||||
return HelpUtils.getHelpIntent(
|
||||
context,
|
||||
context.getString(R.string.help_url_manage_wifi_subscription),
|
||||
context.getClass().getName());
|
||||
Intent getHelpIntent(Context context, String helpUrlString) {
|
||||
return HelpUtils.getHelpIntent(context, helpUrlString, context.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user