VPN settings: grey out policy-restricted menus
setHasOptionsMenu seems unreliable at stopping onCreateOptoinsMenu from being called. Change-Id: Ie86da8e35dddb6e3a0e4678defc55bf5776f6c2f
This commit is contained in:
@@ -129,6 +129,11 @@ public class VpnSettings extends SettingsPreferenceFragment implements
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
|
||||
// Disable all actions if VPN configuration has been disallowed
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
menu.getItem(i).setEnabled(!mUnavailable);
|
||||
}
|
||||
|
||||
// Hide lockdown VPN on devices that require IMS authentication
|
||||
if (SystemProperties.getBoolean("persist.radio.imsregrequired", false)) {
|
||||
menu.findItem(R.id.vpn_lockdown).setVisible(false);
|
||||
|
Reference in New Issue
Block a user