Commit Graph

66 Commits

Author SHA1 Message Date
Yibo Wang
e20ddfa5f4 Add null check for mChannel object in WifiP2Settings
When user switch between settings of hotspot(Enable hotspot),
Internet(Enable Wifi) and Wifi-Direct(establish, disconnect and
forgot P2P connection).

mChannel becomes null during WiFi P2P user scenarios resulting
in Settings(com.android.settings) crash on enable Wifi.

This commit fixes mChannel IllegalArgumentException: Channel
needs to be initialized.

Test: manual test
Bug: 218608961
Change-Id: I72c67bcd1086afe2aa8d2c5521107e2d38e5b0bb
2022-03-18 15:08:51 +01:00
Les Lee
5294e3f9ab wifi direct: Close the channel after leaving the Setting page
Bug: 188375791
Bug: 184504089
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2pSettingsTest
Change-Id: I4eff0472fd3cb12e006b5e85f5cdb6b979c93fe5
2021-06-03 15:31:28 +08:00
Bonian Chen
234b698fb2 Revert "[Settings] Support getSystemService(Class<T>)"
This reverts commit d5ccde31a8.

Reason for revert: failure on test cases

Change-Id: I0a179a6ebb5ef1dec566ce6e8facd5f3b82d7c8a
2021-03-30 00:51:15 +00:00
Bonian Chen
d5ccde31a8 [Settings] Support getSystemService(Class<T>)
Add getSystemService(Class<T>) to align the capability with framework
part.

This is a back port from aosp/1639943, aosp/1645152 and aosp/1648047

Bug: 179640862
Test: local
Change-Id: I035db55a71f94000ca35f8d71f03c19208423c73
2021-03-24 00:59:46 +08:00
govenliu
1e0d40f2bd [Wi-Fi] Enhance Wifi Settings unit test cases.
Add new unit test cases in
1. WifiP2pSettingsTest.java
2. WifiConfigController2Test.java
3. WifiP2PPreferenceControllerTest.java
4. WifiP2pPeerTest.java

the coverage rate of
1. com.android.settings.wifi will raise from 44% to 45%
2. com.android.settings.wifi.P2p will raise from 69% to 85%

Bug: 151696220
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2pSettingsTest
      make RunSettingsRoboTests ROBOTEST_FILTER=WifiConfigController2Test
      make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2pPeerTest
      make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2PPreferenceControllerTest
Change-Id: I365494e1654376b23b08f18b1a799ffc59323a4c
2020-05-07 12:13:02 +08:00
govenliu
4d74ae2e67 [Wi-Fi] Enhance com.android.settings.wifi.p2p unit test cases.
Add new unit test cases in WifiP2pSettingsTest.java, the coverage rate will raise from 30% to 71%.

Bug: 151696220
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2pSettingsTest
Change-Id: I214866efae47a99e75178beca48deb398b70f9bd
2020-05-01 09:00:10 +08:00
govenliu
d59d32e106 [Wi-Fi] Add new unit test file WifiP2pSettingsTest.java.
Add new unit test file WifiP2pSettingsTest.java.

Bug: 151696220
Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiP2pSettingsTest
Change-Id: I686658969a801e385a102022c6854d8bb8972d3c
2020-04-24 13:03:09 +08:00
Edgar Wang
e19ee9a01f Revert "Settings search - Navigate user to exact page"
This reverts commit 08f2a58459.

Reason for revert: design changed, we decide to take the user to
the entry after clicking on a search result.
It's opposite with what we did, so we revert related CL first.

Test: robotest

Change-Id: Iadb9a94a7ef7838be34a54499e2d934d6396c336
2020-01-16 14:07:38 +08:00
Edgar Wang
08f2a58459 Settings search - Navigate user to exact page
- remove duplicate index preference
- default set searchable = false when the preference has fragment
- make some fragments indexable

Bug: 143057584
Test: robotest & manual

Change-Id: I4d64f6106d2f92f0a45e8c7e26388677f593f412
2019-12-24 21:04:11 +08:00
David Su
eb4b142e20 Merge "Rename WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTION intent" 2019-11-18 17:52:54 +00:00
David Su
5545f54e8a Rename WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTION intent
Rename WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTION intent
to ACTION_WIFI_P2P_PERSISTENT_GROUPS_CHANGED to conform
to naming conventions.

Bug: 143892817
Test: compiles
Change-Id: I8fce665af122969a63dc6fafed137f349c12eb58
2019-11-04 20:20:08 +00:00
Inseob Kim
4db955ad57 Schematize Telephony System Properties
Properties accessed across partitions are now schematized and will
become APIs to make explicit interfaces among partitions.

Bug: 117924132
Bug: 141246285
Test: lunch blueline-userdebug; m checkbuild
Change-Id: Ic4f16a4475eb2870dcaeec41b38de90a0f6473bb
2019-11-01 13:10:51 +09:00
Arc Wang
4729d7f309 [Wi-Fi] Add padding to Wi-Fi direct rename dialog
Use R.layout.dialog_edittext which has padding for the EditText

Bug: 139106386
Test: visual
Change-Id: Ib2b0eed93abb4d20ff8793daae29ee98f11050cd
2019-08-21 15:12:54 +08:00
Bram Bonné
5d8d2fa5a8 Adapts P2P settings to work with with new MAC privacy restrictions.
With change ag/7340724, the device's P2P MAC adress will no longer be
included as part of the WIFI_P2P_THIS_DEVICE_CHANGED_ACTION broadcast.
This change makes WifiP2pSettings request the device info after
receiving that broadcast, to make it aware of the device's MAC.

Bug: 132055766
Test: atest
/media/sdb1/android/packages/apps/Settings/tests/robotests/src/com/android/settings/wifi/p2p/
Test: Open Wi-Fi Direct settings, clear device name, observe that the
device's MAC is displayed.

Change-Id: I524afb0c8061c90cd775af422b542213cf14640a
2019-05-06 14:29:44 +00:00
lesl
7818363e71 Use API to get necessary value when activity init
Framework change intent design from sticky to non-sticky due to
location sensitive data protect. Use APIs to get information when
activity resume.

Intents from sticy to non-sticy:
WifiP2pManager#WIFI_P2P_CONNECTION_CHANGED_ACTION
WifiP2pManager#WIFI_P2P_THIS_DEVICE_CHANGED_ACTION

Bug: 77228252
Test: Manually test Wi-Fi Direct settings
Change-Id: I115515d6832c5c5f290ef9f757ca94afa4e9f1bd
2019-01-29 16:25:52 +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
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
ChenChen Chen
8b4b27efb3 Merge "Always show items in options menu for Wi-Fi Direct settings" am: 1e160cc8bf am: 0173130d73
am: c31869a940

Change-Id: I545d38612f05c35949d37037c0744a57bcf8164f
2018-08-16 20:46:02 -07:00
ChenChen Chen
16d1bf0cde Always show items in options menu for Wi-Fi Direct settings
Remove MenuItem.SHOW_AS_ACTION_IF_ROOM flag for menu items
to avoid showing truncated texts on action bar.

Bug: 112671955
Test: Manual
Change-Id: I1c9678321442169bc86d719e820d4af68261dee1
2018-08-16 15:13:33 +09:00
tmfang
41ab6b4bf8 Migrate all AlertDialogs to AndroidX version
This CL only changed AlertDialog imports.
So, reviewer can review it easily.

Change-Id: I097bc44394195b14287f4f920c570ac8653f356a
Fixes: 111413092
Test: This CL can't pass Robo test.
2018-07-20 11:32:13 +08:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07: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
0cd2ccfe30 Create help link placeholder for Wifi Direct settings.
Change-Id: Ia22259d191d2663d7ef63438c680826d3fd590fb
Merged-In: Ia22259d191d2663d7ef63438c680826d3fd590fb
Fixes: 70854725
Test: robotests
2018-04-06 23:06:36 +00:00
Fan Zhang
1deac101a0 Create help link placeholder for Wifi Direct settings.
Change-Id: Ia22259d191d2663d7ef63438c680826d3fd590fb
Bug: 70854725
Test: robotests
2018-04-06 22:00:10 +00:00
Fan Zhang
f7843adabd More renaming in DashboardFragment
getPreferenceControllers() -> createPreferenceControllers() for the same
reason as in ag/3647936

Bug: 73668763
Test: robotests
Change-Id: I97670a91a2a38d1c844d1b9d37f4222c5e6f45a0
2018-02-23 16:56:30 -08:00
Fan Zhang
53bf174d30 Use app context to init WifiP2pManager.
Change-Id: Ib1a2ef1c0b8c3e72557aafb68b8b5e8677fbacc7
Fix: 32767308
Test: heapdump
2017-07-14 13:05:23 -07:00
Tony Mantler
1d583e125f Make PreferenceController a mixin
Bug: 62912136
Test: Existing tests in BaseSearchIndexProviderTest
Change-Id: Ieda359806c09a019840b2005446c7ec8b61fdb00
2017-06-26 10:58:36 -07:00
Fan Zhang
82be5f0c3f Misc fixes to search and UI.
- Use prefContext to create preference.
- rename "Gestures" to "Gesture shortcuts"
- Add search keyword to individual gesture settings so when search
  "gesture" they also show up.
- call super() for all getNonIndexableKeys() in search provider

Fix: 38327387
Fix: 36621897
Fix: 36685646
Test: make RunSettingsRoboTests

Change-Id: Ia5ddfeae08cb27c278dfb8d2376594e21d8f283c
2017-05-23 14:55:23 -07:00
Fan Zhang
022ef86f1a Update UI for Wifi Direct settings
- Change the launching preference from using an intent to directly a
fragemnt
- Partially convert WifiP2pSettings to a DashboardFragment
- Add a controller to control each pref category, when they have no
child, hide.
- Add a controller to control device's own AP name.

Change-Id: I23685c4d4a85f80ceab5a576005e693e6f8b7cc4
Fix: 36859626
Test: make RunSettingsRoboTests
2017-04-26 15:54:07 -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
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
Chris Wren
9d1bfd1e8d port settings over to new metrics enum
Change-Id: I0b3efd2f4db773ccbc52bfe59ee8eb0dab9584fb
2016-01-27 10:58:58 -05:00
Jason Monk
39b467482d Depend on support lib preferences
Bug: 24576551
Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
2015-10-13 10:12:20 -04:00
Sanket Padawe
7186a47ef3 Check for special char when renaming device for Wi-Fi direct.
Bug: 21141820
Change-Id: I78231d95e5ba3f505325d5657f8e6106a887f11e
2015-05-18 11:39:01 -07:00
Chris Wren
8a963babe2 log visibility of views
Depends-On: I5b1dccb5d103ece3112acf38889bae16273b092f
Change-Id: I116aed2bb805f723a5bf2ec9eb94257de0b4a7b5
2015-03-27 13:39:07 -04:00
Fabrice Di Meglio
263bcc8b73 Use Drawer in Settings app
- get rid of PreferenceActivity as much as we can and use fragments instead
- add Drawer widget
- add Dashboard high level entry into the Drawer (but this is work in progress and would be done in another CL)
- add bypass of fragment's Header  validation when launched from the Drawer but *force* validation if external
call thru an Intent

Be aware that WifiPickerActivity should remain for now a PreferenceActivity. It is used by SetupWizard and should
not trigger running the SettingsActivity's header building code. SetupWizard is a Home during the provisionnig process
and then deactivate itself as a Home but would make the Home header to appear in the Drawer (because momentarily we
would have two Home).

Also, verified that:

- the WiFi settings still work when called from SetupWizard
- when you have multiple Launchers, the Home header will appear in the list of Headers in the Drawer

Change-Id: I407a5e0fdd843ad7615d3d511c416a44e3d97c90
2014-02-03 16:36:46 -08:00
Yuhao Zheng
5d2169eb6f Refresh peer list when entering wifi p2p settings
When wifi p2p is connected, entering Wi-Fi Direct UI won't show any peer devices
until a WIFI_P2P_PEERS_CHANGED_ACTION broadcast is received (long after or never).
Users may be confused and think p2p is disconnected. It's more user friendly to
display connected devices right at the beginning.

In addition, this CL removes the useless mWifiP2pManager.requestGroupInfo call.

Bug: 11175553
Change-Id: I0f0834043a2cf6e8fc20319e6861b62484478146
2013-10-11 14:08:48 -07:00
Yuhao Zheng
acac38011b Wi-Fi Direct setting UI: handle p2p disable state
This is not a normal use case as we can't enter Wi-Fi Direct setting when p2p
is disabled. However we can make this happen by entering Wi-Fi Direct setting
screen then disabling wifi via quick settings.

Previous UI implementation didn't handle p2p enable->disable change completely,
leaving the screen out-of-date until we change the screen orientation.

Now we always attach mThisDevicePref/mPeersGroup/mPersistentGroup to the screen,
but just disable them when p2p is disabled. Another advantage of doing this is
to avoid b/11050625, which occurs when a PreferenceGroup is not attached to the
PreferenceScreen.

Bug: 11133069
Change-Id: I9be7b6e396d7677b5a33df8e6294b4a0aa6bd389
2013-10-10 10:08:45 -07:00
Yuhao Zheng
6271cd01de Fix NPE in Wi-Fi Direct Setting UI
After a PreferenceGroup is created, attach it to a PreferenceScreen right away.
Otherwise, if PreferenceGroup.addPreference is accidentally called before being
attached, it will result in an NPE and a UI crash.

Bug: 11050625
Change-Id: I68fa8b67ab807c0729c43c1b5cdabdbcd4f2c230
2013-10-08 10:26:37 -07:00
Vinit Deshapnde
1a9819df16 Fix an NPE in WifiP2pSettings UI
The NPE happens becase we save a references to the group that is to be
deleted, when the confirmation dialog is being shown to the user. We lose
that reference if orientation is changed (because the UI creates a new
WifiP2pSettings to interact with).

The fix is to save the name of the group that is being deleted in
persistent store, and re-select the group based on that.

Bug: 9004915
Change-Id: I1387a5b17fa2773748f4c8b34adddfc9516cfcf3
2013-06-10 12:28:48 -07:00
Irfan Sheriff
540f75aa92 Limit device name length
Bug: 8599677
Change-Id: Ifce5579c0a65c98a4faaad286a7255b2e63d2a76
2013-04-11 22:26:28 -07:00
Irfan Sheriff
bd4e10579b am 5c879e48: am 414d9e9c: Merge "P2PSetting:Avoid p2p_find on group removal event"
# By sunil duttu
# Via Android Git Automerger (1) and others
* commit '5c879e48eddfe617125733f2be46854a0266a23b':
  P2PSetting:Avoid p2p_find on group removal event
2013-02-06 11:20:40 -08:00
sunil duttu
7c872478eb P2PSetting:Avoid p2p_find on group removal event
Immediately after group termination p2p_find is being issued
from settings and this causing issue whenever user sends
connection request immediately after group_removal_event.

Change-Id: I41e5f520f7d9475d0ec890d40eea172d9d66d06e
2013-02-06 23:18:30 +05:30
Irfan Sheriff
9f86b5df78 Use updated API
Fetch peer details from broadcast instead of querying the whole list
each time

Change-Id: I57d82c9dc977d91675b5e5c99979732c80fb1a09
2012-12-11 22:18:59 -08:00
Irfan Sheriff
fb6faab59e Fix strings
Bug: 7182012
Bug: 7071211
Change-Id: I34aa508d5e4151ffdc538a3ab9ae1ddf3749b345
2012-09-18 21:03:42 -07:00
Yoshihiko Ikenaga
f3f14665a3 Enable to delete a stored persistent group from p2p settings.
Enable to delete a stored persistent group from p2p settings.
The multilingualization has NOT been done yet.

Change-Id: I84bd89343c9e3ce5e62b8b96dfce9d286675b145
Signed-off-by: Yoshihiko Ikenaga <yoshihiko.ikenaga@jp.sony.com>
2012-08-28 15:16:38 +09:00
Irfan Sheriff
c26c2f2204 Merge "Fetch peers after preferenceScreen is ready" into jb-dev 2012-05-31 15:04:53 -07:00
Irfan Sheriff
a9d76b3bcc Fetch peers after preferenceScreen is ready
Bug: 6450152
Change-Id: Ic95c7fdba5fa7cb54b0c54ed9a423e0e0683ad2f
2012-05-31 12:44:03 -07:00
Amith Yamasani
5864701197 Retain text in Rename Device dialog.
Also, show the current device name in the dialog, if available.

Bug: 6508967
Change-Id: I34d420e197796352aeab74121bdee55c2d2854d7
2012-05-29 13:19:26 -07:00