packages/apps/Settings
Revisão | 829122e78837bd3f3bc69b6412510e47bff0e7a1 (tree) |
---|---|
Hora | 2016-10-01 21:12:31 |
Autor | Dan Elkouby <streetwalrus@code...> |
Commiter | Dan Elkouby |
Revert "Open WiFi network when pull out the USB line."
This reverts commit adce6ee6b751b7fa51e13d13ba5a5435f2461a9c.
- Tethering from WiFi to USB is a perfectly legit use case, nuke that
- That extra xml key + check is useless and breaks USB tethering
Change-Id: I8c1c5d267a16df310f944234235234076787cd03
@@ -56,10 +56,6 @@ | ||
56 | 56 | <!-- show tethering help begin --> |
57 | 57 | <bool name="tethering_show_help_for_first_using">false</bool> |
58 | 58 | <bool name="tethering_show_help_menu">false</bool> |
59 | - | |
60 | - <!-- Config to enable/disable the USB line--> | |
61 | - <bool name="config_usb_line_enable">false</bool> | |
62 | - | |
63 | 59 | <!-- show tethering help end --> |
64 | 60 | <!-- Config voice over lte in wireless settings begin --> |
65 | 61 | <bool name="config_voice_over_lte_enabled">false</bool> |
@@ -72,8 +68,6 @@ | ||
72 | 68 | |
73 | 69 | <bool name="config_regional_usb_tethering_quick_start_enable">false</bool> |
74 | 70 | <bool name="config_regional_hotspot_tether_help_enable">false</bool> |
75 | - <!-- Config to enable/disable the USB line--> | |
76 | - <bool name="config_usb_line_enable">false</bool> | |
77 | 71 | <bool name="config_show_dialog_open_wifi_when_tethering_open">false</bool> |
78 | 72 | <bool name="config_regional_account_check_dialog_enable">false</bool> |
79 | 73 | <!-- Tethering & Mobile HotSpots display summary on Tmoblie --> |
@@ -150,10 +150,6 @@ public class TetherSettings extends RestrictedSettingsFragment | ||
150 | 150 | private DataSaverBackend mDataSaverBackend; |
151 | 151 | private boolean mDataSaverEnabled; |
152 | 152 | private Preference mDataSaverFooter; |
153 | - /* Record the wifi status before usb tether is on */ | |
154 | - private boolean mUsbEnable = false; | |
155 | - private WifiManager mWifiStatusManager; | |
156 | - private boolean mIsWifiEnabled = false; | |
157 | 153 | |
158 | 154 | @Override |
159 | 155 | protected int getMetricsCategory() { |
@@ -272,9 +268,6 @@ public class TetherSettings extends RestrictedSettingsFragment | ||
272 | 268 | } |
273 | 269 | // Set initial state based on Data Saver mode. |
274 | 270 | onDataSaverChanged(mDataSaverBackend.isDataSaverEnabled()); |
275 | - mUsbEnable = getResources().getBoolean(R.bool.config_usb_line_enable); | |
276 | - mWifiStatusManager= (WifiManager) getActivity().getSystemService( | |
277 | - Context.WIFI_SERVICE); | |
278 | 271 | } |
279 | 272 | |
280 | 273 | @Override |
@@ -371,12 +364,6 @@ public class TetherSettings extends RestrictedSettingsFragment | ||
371 | 364 | updateState(); |
372 | 365 | } else if (action.equals(UsbManager.ACTION_USB_STATE)) { |
373 | 366 | mUsbConnected = intent.getBooleanExtra(UsbManager.USB_CONNECTED, false); |
374 | - mMassStorageActive = Environment.MEDIA_SHARED.equals( | |
375 | - Environment.getExternalStorageState()); | |
376 | - boolean usbAvailable = mUsbConnected && !mMassStorageActive; | |
377 | - if(!usbAvailable && mIsWifiEnabled && mUsbEnable){ | |
378 | - mWifiManager.setWifiEnabled(true); | |
379 | - } | |
380 | 367 | updateState(); |
381 | 368 | } else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { |
382 | 369 | if (mBluetoothEnableForTether) { |
@@ -700,29 +687,16 @@ public class TetherSettings extends RestrictedSettingsFragment | ||
700 | 687 | } |
701 | 688 | } |
702 | 689 | |
703 | - if (choice == TETHERING_USB) { | |
704 | - if(mUsbTether.isChecked()) { | |
705 | - mWifiManager.setWifiEnabled(false); | |
706 | - } | |
707 | - } | |
708 | 690 | mCm.startTethering(choice, true, mStartTetheringCallback, mHandler); |
709 | 691 | } |
710 | 692 | |
711 | 693 | @Override |
712 | 694 | public boolean onPreferenceTreeClick(Preference preference) { |
713 | 695 | if (preference == mUsbTether) { |
714 | - if (mUsbTether.isChecked() && mUsbEnable) { | |
715 | - //get the wifi status | |
716 | - mIsWifiEnabled = mWifiStatusManager.isWifiEnabled(); | |
717 | - IntentFilter filter = new IntentFilter(); | |
718 | - filter.addAction(UsbManager.ACTION_USB_STATE); | |
719 | - getActivity().registerReceiver(mTetherChangeReceiver, filter); | |
696 | + if (mUsbTether.isChecked()) { | |
720 | 697 | startTethering(TETHERING_USB); |
721 | 698 | } else { |
722 | 699 | mCm.stopTethering(TETHERING_USB); |
723 | - if (mIsWifiEnabled) { | |
724 | - mWifiManager.setWifiEnabled(true); | |
725 | - } | |
726 | 700 | } |
727 | 701 | } else if (preference == mBluetoothTether) { |
728 | 702 | if (mBluetoothTether.isChecked()) { |