Merge "Fix missing share context option in settings app" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
60b63d549a
@@ -116,6 +116,7 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
static final int MENU_ID_FORGET = Menu.FIRST + 3;
|
static final int MENU_ID_FORGET = Menu.FIRST + 3;
|
||||||
static final int MENU_ID_MODIFY = Menu.FIRST + 4;
|
static final int MENU_ID_MODIFY = Menu.FIRST + 4;
|
||||||
static final int MENU_FIX_CONNECTIVITY = Menu.FIRST + 5;
|
static final int MENU_FIX_CONNECTIVITY = Menu.FIRST + 5;
|
||||||
|
static final int MENU_ID_SHARE = Menu.FIRST + 6;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final int ADD_NETWORK_REQUEST = 2;
|
static final int ADD_NETWORK_REQUEST = 2;
|
||||||
@@ -535,7 +536,8 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mSelectedWifiEntry.canDisconnect()) {
|
if (mSelectedWifiEntry.canDisconnect()) {
|
||||||
menu.add(Menu.NONE, MENU_ID_DISCONNECT, 0 /* order */,
|
menu.add(Menu.NONE, MENU_ID_SHARE, 0 /* order */, R.string.share);
|
||||||
|
menu.add(Menu.NONE, MENU_ID_DISCONNECT, 1 /* order */,
|
||||||
R.string.wifi_disconnect_button_text);
|
R.string.wifi_disconnect_button_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,6 +576,10 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
case MENU_ID_FORGET:
|
case MENU_ID_FORGET:
|
||||||
forget(mSelectedWifiEntry);
|
forget(mSelectedWifiEntry);
|
||||||
return true;
|
return true;
|
||||||
|
case MENU_ID_SHARE:
|
||||||
|
WifiDppUtils.showLockScreen(getContext(),
|
||||||
|
() -> launchWifiDppConfiguratorActivity(mSelectedWifiEntry));
|
||||||
|
return true;
|
||||||
case MENU_ID_MODIFY:
|
case MENU_ID_MODIFY:
|
||||||
showDialog(mSelectedWifiEntry, WifiConfigUiBase2.MODE_MODIFY);
|
showDialog(mSelectedWifiEntry, WifiConfigUiBase2.MODE_MODIFY);
|
||||||
return true;
|
return true;
|
||||||
@@ -608,6 +614,23 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void launchWifiDppConfiguratorActivity(WifiEntry wifiEntry) {
|
||||||
|
final Intent intent = WifiDppUtils.getConfiguratorQrCodeGeneratorIntentOrNull(getContext(),
|
||||||
|
mWifiManager, wifiEntry);
|
||||||
|
|
||||||
|
if (intent == null) {
|
||||||
|
Log.e(TAG, "Launch Wi-Fi DPP QR code generator with a wrong Wi-Fi network!");
|
||||||
|
} else {
|
||||||
|
mMetricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN,
|
||||||
|
SettingsEnums.ACTION_SETTINGS_SHARE_WIFI_QR_CODE,
|
||||||
|
SettingsEnums.SETTINGS_WIFI_DPP_CONFIGURATOR,
|
||||||
|
/* key */ null,
|
||||||
|
/* value */ Integer.MIN_VALUE);
|
||||||
|
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void showDialog(WifiEntry wifiEntry, int dialogMode) {
|
private void showDialog(WifiEntry wifiEntry, int dialogMode) {
|
||||||
if (WifiUtils.isNetworkLockedDown(getActivity(), wifiEntry.getWifiConfiguration())
|
if (WifiUtils.isNetworkLockedDown(getActivity(), wifiEntry.getWifiConfiguration())
|
||||||
&& wifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED) {
|
&& wifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED) {
|
||||||
|
Reference in New Issue
Block a user