Commit Graph

119 Commits

Author SHA1 Message Date
Xiao Ma
bb0a8f2523 Remove InterfaceState and Role @IntDef from TetheredSettings.
@InterfaceState and @Role won't be exposed as module-lib APIs from
EthernetManager after migration, which are not visible for Settings
code, remove them as well.

Bug: 210586283
Test: m Settings
Change-Id: I49f0e8401681e66d6f5853c8eb3205fcef803c25
2022-03-04 06:09:33 +00:00
Xiao Ma
db7d7de3b4 Adapt new EthernetManager APIs in Settings.
EthernetManager is going to be moved to Connectivity mainline module and
new EthernetManager management APIs have been exposed. This CL adapts
new APIs in the settings in advance, the changes include:

1. use addInterfaceStateListener and removeInterfaceStateListener.
2. rely on the onInterfaceStateChanged callback to receive the Ethernet
   interface state update, to replace the getAvailableInterfaces and
   getConfiguration.
3. after the Ethernet mainline migration completes, Settings cannot
   access the platform resource such as config_ethernet_iface_regex,
   instead, check the availability of Ethernet interface by checking
   if either any of FEATURE_ETHERNET and FEATURE_USB_HOST is supported.

Bug: 210586283
Bug: 218798003
Test: m
Test: manually verify that device can access the Internet via Ethernet
Test: manually verify that device can share the Internet via Ethernet
      tethering
Test: make RunSettingsRoboTests ROBOTEST_FILTER=<modified test cases>
      EthernetTetherPreferenceControllerTest
      AllInOneTetherSettingsTest
Change-Id: I9e10481e1751975772a24db29568aa26bb85cd70
2022-02-24 01:49:57 +00:00
Xiao Ma
f621c4ba14 Fix EthernetManager.addListener dependency in Tethering settings.
Ethernet service related files are going to be moved into Connectivity
module. EthernetManager.addListener(listener, exectuor) will be exposed
out as module-lib API. Replace the current API usage with the one to be
exposed.

android.os.HandlerExecutor is a hidden API which isn't visible to modules,
try to replace HanlderExecutor class with Handler.post itself although
Setttings can still access this API.

Bug: 210586283
Test: m
Change-Id: I618b43769c68897f4724fae8213181be1cc770c6
2022-01-25 04:49:16 +00:00
Alex Johnston
685cacb540 Fix USB tether option
* USB tether option will be grayed out before
  USB cable is plugged in.

Bug: 192225597
Test: manual testing
Change-Id: Ibc87416b9aecb03f1ddd3df0d9f11a935f3a290e
2021-09-23 16:05:29 +00:00
Hugh Chen
a3a0661d1b Fix "USB tethering" will auto turn on then off when turn off "USB tethering"
This CL only updates the "USB tethering preference" when
onTetheredInterfacesChanged() is invoked to avoid the
"USB tethering preference" being changed when received
non-tethering change intent.

Bug: 185590309
Test: make -j42 RunSettingsRoboTests
Change-Id: Ifed9f5c7edef670eeb21baf3841999382ee10ff2
2021-08-02 10:34:56 +08:00
paulhu
6151c227e0 Replace ConnectivityManager hidden symbols on Settings
Connectivity is becoming a mainline module in S, so
ConnectivityManager hidden symbols can not be used for outside
components. Besides, most Tethering relevant methods or variables
on CM are migrated to TetheringManager. So replace all these
methods or variables from ConnectivityManager to TetheringManager
on Settings.

Bug: 180693313
Test: make RunSettingsRoboTests ROBOTEST_FILTER=<Modified Test>
Change-Id: Iba4b121a4ddf3f04252aa0355e0e6494a593682a
2021-02-24 06:17:17 +00:00
Alex Johnston
7d4db750e6 Disallow modifying USB in Settings
Background
* The admin can disable signaling over USB
  on corporate owned device.

Changes
* If the admin has disabled signaling over
  USB, disable preferences in Settings to
  modify USB.
* Show policy transparency dialogs.

Manual Testing:
* Install TestDPC
* Set up as Device Owner
* Disable USB data signaling
* Verify Settings > Connected Devices
  > USB is disabled
* Verify Settings > Network & Internet
  > Hotspot & tethering > USB tethering
  is disabled
* Verify Developer options >
  USB debugging, default USB configurations
  and USB audio routing are disabled

Bug: 168301639
Test: Manual Testing
      make RunSettingsRoboTests -j ROBOTEST_FILTER=TetherSettingsTest
      make RunSettingsRoboTests -j
      ROBOTEST_FILTER=UsbAudioRoutingPreferenceControllerTest
      make RunSettingsRoboTests -j
      ROBOTEST_FILTER=UsbDefaultFragmentTest
      make RunSettingsRoboTests -j
      ROBOTEST_FILTER=DevelopmentSettingsDashboardFragmentTest
      make RunSettingsRoboTests -j
      ROBOTEST_FILTER=DefaultUsbConfigurationPreferenceControllerTest
      make RunSettingsLibRoboTests -j
      ROBOTEST_FILTER=EnableAdbPreferenceControllerTest

Change-Id: I3e8461ac37f406a407c874598335cde28fb89b2d
Merged-In: I3e8461ac37f406a407c874598335cde28fb89b2d
2021-02-16 15:29:49 +00:00
Tsung-Mao Fang
00956fb4e1 Apply top intro preference in Settings app (1/n)
Based on content in footer, we need to convert some footers
to top info prefernce.

Test: Run robo test and see the screens
Bug: 173087905
Change-Id: Ie62a503481f9d385f5468896fba8f607cb3437d3
2020-11-16 18:44:40 +08:00
Ted Wang
47f2ebb1af Update state when there is Bluetooth tethering state changed
Monitor Bluetooth Tethering state and update preference when there is
Bluetooth tethering state change.
Add test case to verify when recieve
BluetoothPan.TETHERING_STATE_CHANGED will update bluetooth state

Bug: 138688805
Test: make RunSettingsRoboTests
Change-Id: I8f468d1d99ed6d87f6cd8305ef56b0d7a5dec95b
2020-09-10 06:15:41 +00:00
Bonian Chen
a5f08854e3 [Settings] Inclusive language for Data Usage
Change wordings in data usage part into inclusive language.

Bug: 160707804
Test: make RunSettingsRoboTests
Change-Id: I713e52df8201413b884257a51bc1f71a0d43179d
2020-07-15 02:52:32 +00:00
markchien
92b09e825f Remove isProvisioningNeededButUnavailable usage
config_mobile_hotspot_provision_app would be move out of framework and
only private for tethering only. TetherUtil#isProvisioningNeeded and
isProvisioningNeededButUnavailable are no longer needed because
tethering would ensure entitlement app is valid if entitlement check is
needed. Otherwise, tethering would return not supported that tethering
settings would be hidden.

Bug: 146918263
Test: m
Change-Id: If0b0a3e6cadab3c4a4d2c003e2aa9e9f3dd7449c
2020-06-10 22:34:39 +08:00
Weilun Du
f8757b7112 [Settings] Fix crashes caused by null bluetooth adapter and ethernet
manager

Emulator system image doesn't support bluetooth and ethernet manager
yet.
BUG: 150408099

Signed-off-by: Weilun Du <wdu@google.com>
Change-Id: Iab4f7b962f01755fe7d84956f9b54374f1e17408
(cherry picked from commit 08e95d0db0)
2020-04-16 16:56:28 -07:00
Yuuki Habu
557e457278 Add Ethernet Tethering settings
Add Ethernet Tethering settings
 - Show prefernce if config_ethernet_iface_regex is set
 - Activate if tethered ethernet interface is exist

Bug: 148824036
Test: manual test
 - update prefernce plug-in, plug-out
Change-Id: Ia4f365ddc1a53a926d716046db3e6ac463c978b9
2020-03-20 01:16:43 +09:00
Arc Wang
005fe6951c [Wi-Fi] Add STA+AP information in Hotspot & tethering footer
Use WifiManager#isStaApConcurrencySupported() to check if a
device supports STA+AP and shows the footer information.

Bug: 121328949
Test: make RunSettingsRoboTests ROBOTEST_FILTER=TetherSettingsTest
      make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherFooterPreferenceControllerTest
Change-Id: I3446abb5cc9cdf76da8d17f5de31bd65715c165c
2020-03-10 18:15:13 +08:00
Zhen Zhang
d2a7f9ae79 Use feature flag to show/hide AllInOneTetherSettings
This partially reverts commit 0ccc849de7
which added a config value. Instead, we will use feature flag to switch
between the fragments.

This CL also adds a postfix to keys in all_tether_prefs to
de-duplicate with keys in tether_prefs and wifi_tether_settings.

Bug: 148182953
Change-Id: I92832c786473990065a965409072e4117a7e75a8
Fix: 148618984
Test: make RunSettingsRoboTests
Test: make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest
2020-01-30 16:01:42 -08:00
Zhen Zhang
0ccc849de7 Add config value to switch between Tether Settings UIs.
Adding this config value to make it easy to switch to developing
Tethering settings UI. Also, using this config value to make sure
that preferences from new AllInOneTetherSettings screen won't show up in
the search results.

Bug: 147915366
Test: make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=TetherSettingsTest
Test: make RunSettingsRoboTests
ROBOTEST_FILTER=TetehrPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest

Change-Id: I8c88816a8f2b40fc219cae8d0d442454c5270b2b
2020-01-21 07:37:56 +00:00
Raff Tsai
966fa01423 Use SettingsLib Indexable
- Use SettingsLib Indexable
- Directly use resource id in getPreferenceScreenResId

Bug: 135053028
Test: roboletric
Change-Id: I05f493b55e8b6e2091301e9231ba5615215618e6
2019-09-25 18:24:56 +08:00
Raff Tsai
ac3e0d0988 Directly use BaseIndexableProvider
- Add function getXmlResourceId, Fragments don't need to write
xml resource id twice.
- Remove getPreferenceControllers from Indexable.java. Because it will
move to SettingsLib later for other apps which don't need this function

Bug: 135053028
Test: robolectric
Change-Id: I1e74519aecdea3dde64a5aea79f08d766dbc0003
2019-09-24 00:35:52 +08:00
Sunny Shao
a6c0bd5346 Use FooterPreference in xml explicitly
Removed the FooterPreferenceMixin from the TetherSettings page.

Fixes: 139397226
Test: manual test
Change-Id: Ice7f97881df9cc17177ed7fcc1da9f3124c445a9
2019-08-14 14:46:23 +08:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -08:00
Chienyuan
bad5898fb6 Don't update state after stop bluetooth tethering
After using ConnectivityManager.stopTethering(), TetheringSettings may
update state before PanService set mTetherOn to false. This makes the
toggle button checked again and user need click it twice to disable it.

Bug: 111578971
Test: on/off bluetooth tethering from settings UI
Change-Id: I6873d762d2a290080d844b7a44e54f4bd532347e
2018-09-05 11:10:01 +08:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -07:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Chilun Huang
f4b094d13a Merge "Add index for Hotspot settings page into search" 2018-05-15 03:59:15 +00:00
Lei Yu
107467550f Merge "Remove the dynamic summary for bt preference." into pi-dev am: 912af577ab
am: bb975a5751

Change-Id: I5a2bc49e143b4bdc7370bc9660796735ae1fb81d
2018-05-14 19:07:19 -07:00
Lei Yu
80f6aab9b1 Remove the dynamic summary for bt preference.
Starting from b/62069132, we should use static summary for it.

Change-Id: I8ba5a9d6e8b5bcbcd9f4369cdf44004d557257a3
Fixes: 79666649
Test: Manual
2018-05-14 14:09:25 -07:00
Chilun
d3358d8a6f Add index for Hotspot settings page into search
Added index provider into TetherSettings and WifiTetherSettings pages.
Added robotests to check the keys returned by getNonIndexableKeys.
Move repeated code into utility class.

Bug: 74777873
Test: make -j RunSettingsRoboTests
Test: atest UniquePreferenceTest
Change-Id: I6cb09d735afa4867d25a79de733ce8c59634e49b
2018-05-09 14:05:15 +08:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Fan Zhang
defb1183ec Remove code for old wifi tether feature
Change-Id: If92798ddf075801e66cd97ecacff2f8df1e41985
Fix: 64032458
Test: rerun robotests
2017-08-01 16:18:24 -07:00
Fan Zhang
78d5efdfea Refactor hotspot into a full page
- Deprecated WifiAPEnabler, and copied most of its logic into various
  controllers and WifiTetherSettings.
- Added tests

Fix: 37253404
Fix: 36181835

Test: make RunSettingsRoboTests
Change-Id: Iad994d61b694ad7f1113d045a3e7500eeaec178b
2017-06-14 12:32:44 -07:00
Doris Ling
1e914eb875 Update summary for Hotspot & Tethering.
- change summary for Bluetooth tethering and USB tethering to static
text.
- add strings for Wi-Fi hotspot settings page.

Bug: 62069132
Test: manual
Change-Id: Ibc550da33c192c604b65eb75d16c6c15a8b1ff7a
2017-05-30 17:28:06 -07:00
Fan Zhang
d80117dcea Tether screen cleanup
- Add a summary placeholder reserving 2 lines for wifi tether pref
- Replace DividerPreference with regular Preference

Change-Id: I2e0c36f27abe2c17625d00d80c816b526f59a6fd
Fix: 37518463
Test: visual
2017-05-04 18:37:04 +00:00
Doris Ling
dd5693c6f4 Fix crash in TetherSettings.
In onCreate(), it checkes whether ui is restricted, and try to show an
empty screen by creating a new preference screen. However, when the
preference is not attached, it failed to get the next preference id.
Instead of replacing the current screen with a new one, remove all the
preferences on the screen.

Change-Id: I085bee025cfeabaf4aefacb717d145e668bd85e1
Fix: 36589767
Test: manual
2017-03-24 13:10:09 -07:00
Doris Ling
47ec3857a5 Update preference text for Network & internet screen.
- Add footer info to Hotspot & tethering
- Add summary text for Data usage -> Network restrictions
- Update summary for Hotspot & tethering -> Portable Wi-Fi hotspot
- Remove quotes from Wi-Fi summary

Bug: 36296257
Test: make RunSettingsRoboTests

Change-Id: Ibab61b089521a3339e660e9df0db0cd1b316712b
2017-03-21 18:00:59 -07:00
Tamas Berghammer
265d3c2a0c Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:17 +00:00
Fan Zhang
d65184faef Log visibility change for DialogCreatable in Settings.
Bug: 30681529
Test: adb logcat -b events | egrep "(sysui_|notification_)"
Test: make RunSettingsRoboTests
Change-Id: I51754d258ba1ddfae24323681f21cd02de4dbb4e
2016-09-21 16:30:32 -07:00
Rebecca Silberstein
c2f6141093 TetherSettings: check provisionApp array length am: 39f0e41ec7 am: 02602b9b2c
am: 2534a478a6

Change-Id: Ibdd4041fb89cace2e3e9734a243ce4d85a922188
2016-08-31 21:22:21 +00:00
Rebecca Silberstein
2534a478a6 TetherSettings: check provisionApp array length am: 39f0e41ec7
am: 02602b9b2c

Change-Id: I51d5a3094a575254489d734c823e10608ddb369b
2016-08-31 20:51:31 +00:00
Fan Zhang
6507613ebc Log visibility change for all fragments.
Bug: 30681771
Test: SettingsUnitTests

Refactor visibility logging from InstrumentedFragment into a mixin. And
apply mixin in remaining fragments.

Change-Id: Ibbb59904336254a3e4bb9e8c7d0b36e5a6bc2622
2016-08-18 14:04:13 -07:00
Rebecca Silberstein
39f0e41ec7 TetherSettings: check provisionApp array length
Before attempting to get values from the provisionApp array, check to
make sure there are at least two elements.

BUG: 30889755
Change-Id: I42d6f8754910c12acf7bb3fbcc12e3f7be30d5e9
TEST: manually tried to open settings and it did not crash
2016-08-16 09:06:48 -07:00
Jason Monk
e0d330f138 Merge \\"Fix tethering re-enable after edit.\\" into nyc-dev am: dbb5a0b918
am: c04ac8415a

Change-Id: I130760913149185f5cef084d9a239ad35a4fad04
2016-06-22 15:29:14 +00:00
Jason Monk
cf7c2374a9 Fix tethering re-enable after edit.
Sometimes the tether state change comes in late (or seemingly not
at all).  Also listen for wifi ap state changes as a fallback for
this case.

Change-Id: I6677c4277453be881967a3cf2234de11cd0237b8
Fixes: 28851179
2016-06-21 14:06:48 -04:00
Robert Greenwalt
89b8babe6a resolve merge conflicts of b34cf86 to nyc-dev-plus-aosp
Change-Id: Ie6a95224a62023a2a19054aa95382d24365124f5
2016-06-13 13:01:36 -07:00
宋凯伦
0fb2f2bd00 Fix the memory leak in TetherSettings
https://code.google.com/p/android/issues/detail?id=210848

We need to close the bluetooth adapter's profile proxy in OnDestroy 
method, or it will cause TetherSettings object to be held and won't
release. And finally it will cause OOM issue.
Change-Id: Id7667f751697c8ef9fccaaabfed28a91d4fa4960
Signed-off-by: 宋凯伦 <songkailun@xiaomi.com>
2016-06-01 02:13:50 +00:00
Felipe Leme
5c09184e00 Disable tethering when Data Saver mode is on.
BUG: 28313291
Change-Id: Idbedd440a1baa41f1407b32e86f5ae0080e60798
2016-04-22 14:25:35 -07:00
Jason Monk
245bbaf205 Make sure mWifiManager gets initialized
To avoid crashing.

Bug: 27561590
Change-Id: I417b8382cb3d1b6c22fa33e05e9b4bf35e048e7e
2016-03-09 10:49:33 -05:00
Rebecca Silberstein
ffb4fbb1a7 Save WifiAp config changes when hotspot is enabled
We need to properly handle asynchronous events when WifiAp for hotspot
is enabled and the user changes the config.  This CL changes the
behavior to:
1 - mark local boolean indicating a restart is needed
2 - trigger the WifiAp to stop
3 - save the new config
4 - when the stop is complete (and the boolean is set), restart the
WifiAp.

Also fix a few style issues in the file.

BUG:27460194
Change-Id: I7e49ab9c49e125017cf83866a396701e440bf383
2016-03-07 09:49:52 -08:00
Sudheer Shanka
7dbbe13168 Add disabled by policy empty views to more screens.
Bug: 27214401
Change-Id: I6cd4292a63610671070bf2134105e9e348c3ab32
2016-02-19 20:18:43 +00:00
Jeremy Klein
e3e7b95312 Make TetherSettings use the new tether api.
The new API handles all the provisioning logic so this area can
get significant code cleanup.

Change-Id: I4bcffb14b3ce26a01d17ec149599d63b0b4392f1
2016-02-04 18:58:14 -08:00