[WifiSetup] Don't show menu during setup

Hides the menu during Wi-Fi setup -- we removed the menu button from
the UI but the menu can still be started with a hardware menu button.
This change removes that ability as well (during setup).

If you want to test on a device without a hardware menu button, you
can use the command
    adb shell input keyevent 82

Change-Id: Ibe3cc679353a83c995e24680c3e7dc1575d32fe0
This commit is contained in:
Maurice Lam
2014-12-18 11:36:16 -08:00
parent 50f2081f6b
commit d9165c06a4

View File

@@ -17,17 +17,14 @@
package com.android.settings.wifi; package com.android.settings.wifi;
import android.content.Intent; import android.content.Intent;
import android.content.res.TypedArray;
import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration;
import android.os.Bundle; import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AbsListView.LayoutParams;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
@@ -35,9 +32,9 @@ import com.android.settings.R;
/** /**
* This customized version of WifiSettings is shown to the user only during Setup Wizard. Menu * This customized version of WifiSettings is shown to the user only during Setup Wizard. Menu
* selections are limited, clicking on an access point will auto-advance to the next screen (once * is not shown, clicking on an access point will auto-advance to the next screen (once connected),
* connected), and, if the user opts to skip ahead without a wifi connection, a warning message * and, if the user opts to skip ahead without a wifi connection, a warning message alerts of
* alerts of possible carrier data charges or missing software updates. * possible carrier data charges or missing software updates.
*/ */
public class WifiSettingsForSetupWizard extends WifiSettings { public class WifiSettingsForSetupWizard extends WifiSettings {
@@ -115,18 +112,8 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
} }
@Override @Override
/* package */ void addOptionsMenuItems(Menu menu) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
final boolean wifiIsEnabled = mWifiManager.isWifiEnabled(); // Do not show menu during setup wizard
final TypedArray ta = getActivity().getTheme()
.obtainStyledAttributes(new int[] {R.attr.ic_wps});
menu.add(Menu.NONE, MENU_ID_WPS_PBC, 0, R.string.wifi_menu_wps_pbc)
.setIcon(ta.getDrawable(0))
.setEnabled(wifiIsEnabled)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add(Menu.NONE, MENU_ID_ADD_NETWORK, 0, R.string.wifi_add_network)
.setEnabled(wifiIsEnabled)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
ta.recycle();
} }
@Override @Override