Commit Graph

108 Commits

Author SHA1 Message Date
Steven Wu
97915b15d9 Add a flashlight slice in settings.
- It retrieves the flashlight status from Settings.Secure.
- It uses the broadcast relay to update flashlight status
without action on the slice.

Test: robotests
Change-Id: Ib4d636541f5166b8634326cce76aed5665989b76
Fixes: 74913192
2018-06-06 02:59:37 +00:00
Naina Nalluri
6b1869351a Add Wifi calling Preference slice and other cleanup
WifiCallingPreference Slice Provider:
  1. If Wifi calling is not enabled - display message to user
     to enable Wifi calling
  2. Else if Wifi preference is not editable - return a null
     Slice
  3. Else provide a slice with rows - first row giving current pref
     information, followed by preference items (in each row).
     wifi_only is displayed only when it is allowed to display it.
     Each row with preference item has specific intent action.
WifiCallingPreference Slice BroadcastReceiver:
   1. If only Wifi calling is enabled & Wifi preference is editable &
      there is a change in current value modify wifi pref setting
   2. And Ask to re-query the slice in one second to display
      updated settings if 1 is valid or display appropriate message.
Clean-up:
   1. Return null instead of non-actionable slices.
   2. Use getText to get string resources.
   3. Remove unnecessary extra variables.

Bug: 79548264
Test: Use support-slices-demos-debug.apk to test on device
Change-Id: I186f19be2007c2331eaf6195e70b4a9c635adf9e
2018-06-01 11:02:59 -07:00
Josh Hou
606222da7f Add Slices for Enhanced 4G LTE
Add Slices for Enhanced 4G LTE
Enhanced 4G LTE Slice Provider:
Create slice to display appropriate message with further instructions
Enhanced 4G LTE Slice Broadcast Reciver:
1. Change the setting via ImsManager
2. Ask to requery the slice in one second to display updated settings if 1 is valid or display appropriate message

Bug: 79270171
Test: Robotests
Test: Use support-slices-demos-debug.apk to test on device
Change-Id: I48d412de94d5d9f1ad42a299691ec5cf8001c6a1
2018-05-31 10:34:00 -07:00
Fan Zhang
934de22622 2nd attempt to fix Slice strict mode.
1. Use real BluetoothAdapter instead of settingslib version. The
   settingslib version contains calls that violates strictmode rules.
2. Override StrictMode rules in SettingsSliceProvider when it's called
   in background thread. When in background, the enforcement from Slice
   framework (StrictMode#ThreadPolicy) is not useful and can be safely
   ignored.

Change-Id: I68523148f4c1dc88a54e207447d21ec439478cdf
Bug: 79985175
Test: robotests
2018-05-25 10:39:59 -07:00
Matthew Fritze
8e54e4a0f5 Merge "Hook up blocked keys" into pi-dev am: a60ea38f67
am: a8e1a02bfa

Change-Id: Ib79a5fe4721086f400477dc159e14ab5e641e304
2018-05-23 16:06:57 -07:00
TreeHugger Robot
a60ea38f67 Merge "Hook up blocked keys" into pi-dev 2018-05-23 20:41:22 +00:00
Matthew Fritze
4242ed2171 Hook up blocked keys
Block any slice in onBind that is the in the blacklist

Change-Id: I9687d07cbfef5fcb94842046bc5dc3296eed4252
Fixes: 80195653
Test: robotests
2018-05-23 12:25:23 -07:00
Matthew Fritze
e31e60ce94 Add Location Slice
Location is an intent-only Slice.

Test: Robotests
Change-Id: Ie9ed05be2224f2c4b393ed201d5f313f80183edc
Merged-In: I07e27683b46fe4ded8215009a983bb909555fb59
Fixes: 67997314
2018-05-23 08:09:07 -07:00
Matthew Fritze
f1a7006d31 Add Location Slice
Location is an intent-only Slice.

Test: Robotests
Bug: 67997314
Change-Id: I07e27683b46fe4ded8215009a983bb909555fb59
2018-05-22 21:13:47 -07:00
Matthew Fritze
1dd25fd87c Add isSliceable API to BasePrefController
Only support explicitly approved Settings Slices,
dictated by controllers which return true for the new
method isSliceable.

Updating the supported settings to a whitelist means that
the method to return all available slices must be updated,
and checking slicability when we index slices.

Test: robotests
Change-Id: I85848c2cdf3e151fa94b33dd1dc5c0374ef94b5b
Merged-In: Ib2b9690cdd0036b5cc4a1cb846c52bce7c824ab9
Fixes: 79779103
2018-05-22 22:43:24 +00:00
Matthew Fritze
bf1f5b5813 Add isSliceable API to BasePrefController
Only support explicitly approved Settings Slices,
dictated by controllers which return true for the new
method isSliceable.

Updating the supported settings to a whitelist means that
the method to return all available slices must be updated,
and checking slicability when we index slices.

Test: robotests
Bug: 79779103
Change-Id: Ib2b9690cdd0036b5cc4a1cb846c52bce7c824ab9
2018-05-22 11:06:42 -07:00
Matthew Fritze
25fc14c607 Add Bluetooth Slice
Bluetooth slice is added a special case, due to the migration of
bluetooth to a Switch Bar instead of a preference with a controller.

Change-Id: I8b70bb66c862255a4e8d2426ac09939ba6197624
Merged-In: Icfdcd77601ad1e64e0f6c352a8d691f0181515c8
Fixes: 67997327
Test: robotests
2018-05-22 06:59:49 -07:00
Matthew Fritze
d2bb2ab259 Add Bluetooth Slice
Bluetooth slice is added a special case, due to the migration of
bluetooth to a Switch Bar instead of a preference with a controller.

Bug: 67997327
Test: robotests
Change-Id: Icfdcd77601ad1e64e0f6c352a8d691f0181515c8
2018-05-21 20:03:24 -07:00
Matthew Fritze
4a6f058552 Add Intentfilter BasePreferenceController
For settings which can change in the framework, outside of
the settings app and a slice, a Slice needs to be able to
register a listener for these changes.

Adding a getter for an IntentFilter in BasePreferenceControllers
allows us to use the SliceBroadcastRelay in SysUi to listen for
these changes.

Test: robotests
Fixes: 78138654

Change-Id: I579375069ca98fd21b60cd3a69c1a122cabf96e2
Merged-In: Ifa05b651aaa3458c54866f71469964b1a070e458
2018-05-18 08:06:08 -07:00
Matthew Fritze
097dc80fc1 Add Intentfilter BasePreferenceController
For settings which can change in the framework, outside of
the settings app and a slice, a Slice needs to be able to
register a listener for these changes.

Adding a getter for an IntentFilter in BasePreferenceControllers
allows us to use the SliceBroadcastRelay in SysUi to listen for
these changes.

Test: robotests
Bug: 78138654
Change-Id: Ifa05b651aaa3458c54866f71469964b1a070e458
2018-05-18 08:04:18 -07:00
Matthew Fritze
e8b62714af Add DnD as a special case Slice
Add DND Slice as a special case, since there is an existing
inheritance structures in the zen mode preference controllers which
would be too risky to change at this point in the release.

Change-Id: If4b7013be35c89695786af2dbbea2edcf7a189f3
Merged-In: Ice608b9a7bd6f38b73e581eb3723f0a2fae96f2b
Test: make RunSettingsRoboTests
Fixes: 67997377
2018-05-17 18:20:36 -07:00
Matthew Fritze
4710917aa4 Add DnD as a special case Slice
Add DND Slice as a special case, since there is an existing
inheritance structures in the zen mode preference controllers which
would be too risky to change at this point in the release.

Test: make RunSettingsRoboTests
Bug: 67997377
Change-Id: Ice608b9a7bd6f38b73e581eb3723f0a2fae96f2b
2018-05-17 18:20:07 -07:00
Matthew Fritze
6feddd6954 Add Wifi Slice
Add a custom Wifi Slice to the Settings Slice Provider.
It needs a custom Slice because of the complicated listener logic
in the MasterSwitchPreferenceController, which makes it hard to
work-in synchronous set/get logic.

The one-off Slice requires extra changes, including:
- Including it in getDescendants
- Handling changes to wifi by the framework

This is the first change that uses SettingsLib's broadcast relay,
which allows settings to (un)register IntentFilters to a Uri,
allowing Settings Slices affected by the framework (quicksettings,
connectivity related, volume, etc) to be updated without action
on the Slice.

Bug: 70622039
Bug: 67997332
Test: robotests
Change-Id: Ibfe4736beecb833e3f6bb871b2eb5228a5fd3a34
2018-05-17 10:16:55 -07:00
Matthew Fritze
46aa586610 Add Wifi Slice
Add a custom Wifi Slice to the Settings Slice Provider.
It needs a custom Slice because of the complicated listener logic
in the MasterSwitchPreferenceController, which makes it hard to
work-in synchronous set/get logic.

The one-off Slice requires extra changes, including:
- Including it in getDescendants
- Handling changes to wifi by the framework

This is the first change that uses SettingsLib's broadcast relay,
which allows settings to (un)register IntentFilters to a Uri,
allowing Settings Slices affected by the framework (quicksettings,
connectivity related, volume, etc) to be updated without action
on the Slice.

Fixes: 70622039
Fixes: 67997332
Test: robotests
Change-Id: Ia76738dd6baacd5522d52df2c61ebad86a600282
Merged-In: Ibfe4736beecb833e3f6bb871b2eb5228a5fd3a34
2018-05-17 09:58:19 -07:00
Naina Nalluri
15602b3f48 Merge "DO NOT MERGE Add Slices for WifiCalling" into pi-dev 2018-05-14 22:59:11 +00:00
Naina Nalluri
e6bf71abed DO NOT MERGE Add Slices for WifiCalling
Add Slices for WifiCalling
WifiCalling Slice Provider:
  1. If there is no activation needed or if the Wifi calling
     is currently turned on - provide the slice to toggle the
     value
  2. Else display appropriate message with further instructions
WifiCalling Slice Broadcast Receiver:
  1. If the action is turning off wifi or if there is no
     activation needed. Change the setting with ImsManager.
  2. And Ask to requery the slice in one second to display
     updated settings if 1 is valid or display appropriate message

Bug: 63731862
Bug: 78192106
Test: Use support-slices-demos-debug.apk to test on device
Test: Robotests
Change-Id: I29e1822fd24ebcff575fa48ad93f84ed91bf4d87
2018-05-14 20:16:01 +00:00
Naina Nalluri
6885d85a7c Add Slices for WifiCalling
Add Slices for WifiCalling
WifiCalling Slice Provider:
  1. If there is no activation needed or if the Wifi calling
     is currently turned on - provide the slice to toggle the
     value
  2. Else display appropriate message with further instructions
WifiCalling Slice Broadcast Receiver:
  1. If the action is turning off wifi or if there is no
     activation needed. Change the setting with ImsManager.
  2. And Ask to requery the slice in one second to display
     updated settings if 1 is valid or display appropriate message

Bug: 63731862
Bug: 78192106
Test: Use support-slices-demos-debug.apk to test on device
Test: Robotests
Change-Id: I29e1822fd24ebcff575fa48ad93f84ed91bf4d87
2018-05-14 10:19:15 -07:00
Fan Zhang
80376a5b46 Make pref unsearchable for more availibility status.
Bug: 72748524
Test: robotest
Change-Id: I12b13ac3503f851857787df98a2d2f599c71b9b7
2018-05-11 11:45:02 -07:00
Fan Zhang
93d3b5174d Fix a strict mode violation in SystemUpdatePrefController
Change-Id: I4770b878b6f69318f08f8974c5c4d2690c5611d4
Bug: 78626509
Test: robotests
2018-05-11 03:45:48 +00:00
Fan Zhang
4ca363470b Fix a strict mode violation in SystemUpdatePrefController
Change-Id: I4770b878b6f69318f08f8974c5c4d2690c5611d4
Merged-In: I4770b878b6f69318f08f8974c5c4d2690c5611d4
Fixes: 78626509
Test: robotests
2018-05-11 00:32:01 +00:00
Fan Zhang
33b585a831 Merge "Fix a concurrent modification exception in Slice provider." into pi-dev am: 350c5b3c40
am: b8b9e69a94

Change-Id: I7827b526be72fb2678d7bb662e6c13f722a8aaa9
2018-05-09 16:53:43 -07:00
Salvador Martinez
bfcedc54b0 Merge "Remove the Settings search keywords from Slices" into pi-dev am: 26453818b9
am: 7e34ffdb6a

Change-Id: Ib4abbf9c4b4db45ab99846b7377ecaea4c0e9745
2018-05-09 13:45:05 -07:00
Fan Zhang
a55993c12c Fix a concurrent modification exception in Slice provider.
Change-Id: I87449dda9a56b5e8932dc4c6bec462195cb89348
Fixes: 79372493
Test: monkey
2018-05-09 12:51:20 -07:00
Matthew Fritze
ff865c898f Remove the Settings search keywords from Slices
The keywords used for settings search are good when we are highly
confident the user is searching for as setting (settings search),
but not effective in a more general search setting (launcher,
an assistant). Thus, we should not index these keywords as Slice
keywords, and rely on the setting title and screen title as baseline
keywords.

Change-Id: I99e44834454b5949c4883f877e02be47498e06e2
Fixes: 78911847
Test: robotests
2018-05-09 09:01:58 -07:00
Jason Monk
069bfaa33d Merge "Add auto-granting of slice permissions" into pi-dev am: f778a91a88
am: 8ead7e26f2

Change-Id: I27cf09c0875b72d9e9478eed410884fa3813daf1
2018-04-26 15:38:21 -07:00
Jason Monk
f778a91a88 Merge "Add auto-granting of slice permissions" into pi-dev 2018-04-26 22:05:19 +00:00
Jason Monk
0d3322a57b Merge "Push full slice index to device index" into pi-dev am: 3d29ca2893
am: 2332aad2a6

Change-Id: I3563eb7ed2ab93b35b1a950d89ca2466abaa59e3
2018-04-26 14:26:38 -07:00
Jason Monk
fcd5f0f1aa Push full slice index to device index
Test: make RunSettingsRoboTests
Bug: 74555610
Change-Id: I3f0aa1218e1d7e736dc918d83e76423fa81ac6ab
2018-04-26 11:16:04 -04:00
Jason Monk
50e2a99a43 Merge "Fix settings slice caching" into pi-dev am: ab3aa6989a
am: fa5e0ece68

Change-Id: Ia88dc12ead0cab4b335062cba4fbf7db8066e285
2018-04-26 05:56:47 -07:00
Jason Monk
4913183def Fix settings slice caching
Previously if there were multiple clients it would trigger an infinite
loop as the cache gits dropped after the first bind, and the second
client would trigger another load. Instead now cache as long as slices
are pinned since thats the intended behavior of caching.

Test: make RunSettingsRoboTests
Change-Id: I7d29fab87573120b34cd55e1696c4c5b70fc891c
Fixes: 78471335
2018-04-24 17:08:26 -04:00
Jason Monk
0ef0c367e9 Add auto-granting of slice permissions
Allow things that can read the index to access slices too.

Test: existing tests unaffected
Bug: 77313888
Change-Id: I54c4b89eefb4354aa6b7dcafb7ac09dc96cbdbeb
2018-04-23 18:42:21 -04:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Jason Monk
28af23680e Fix wifi launch intent
Test: manual
Bug: 76162313
Change-Id: Ie4d4235026ed72afc68f0e513ec34c8f188badb9
2018-04-18 10:54:35 -04:00
TreeHugger Robot
bc4c392ff4 Merge "Add A11y Slices" into pi-dev 2018-04-18 01:44:58 +00:00
Matthew Fritze
6730a061b1 Add getDescendants to Settings Slice Provider
getDescendants allows another app to collect a list
of all valid Uris for Settings Slices. Important for search,
assistant or launcher apps.

This means searching our database for all valid keys and building
a list of Uris for each of those keys.

Fixes: 77808328
Test: robotests
Change-Id: I3ae27e4661a7dcaab50b091ae2730013118af8a2
2018-04-17 10:48:53 -07:00
Matthew Fritze
a711ed8330 Add A11y Slices
Add AccessibilityPreferenceController, which wraps all a11y settings
since they are share common infrastructure for enabling, current value,
and availability.

We add an overlay for OEMs to declare their bundled a11y services.
This is the only list of services that will be possible to enabled via
Settings slices.

Accessibility Slices are built by getting a list of valid services,
and indexing the service names as a key in the Slices DB. When they are
built at runtime, they use the generic A11yPrefController to get the status
and enable/disable the service.

Bug: 67997836
Bug: 67997672
Test: robotests
Change-Id: I66f905bf1c55eecb937945c4675c12bcbc96d698
2018-04-17 10:27:02 -07:00
Jason Monk
20210122bd Updates to match prebuilts drop
Test: build
Bug: 77482321
Change-Id: I65a2cffb0a921ef6acb58ff500a7da8a8f870e76
2018-04-04 16:08:17 -04:00
Matthew Fritze
fcdfc2d83f Return back-up slices for unavailable settings
When an inline slice is requested, and the setting is unavailable,
we should present more useful information to the user. This CL handles:
- Unsupported: return intent slice to Settings home page
- Disabled for user: intent to the setting page
- Unknown reason: intent to setting page
- Disabled dependency: Create intent-based Slice rather
than the requested inline slice.

Bug: 71640747
Test: robotests
Change-Id: I9c1a0ee36119d4f9f3b205e0824c251f4356db55
2018-03-23 12:47:36 -07:00
Jason Monk
f6edc7c80a Add option for settings to push to a device index
The index implementation is optional and left up to the OEM.

Test: Open settings, see content in index
Test: robo tests
Bug: 68378569
Bug: 76102600
Change-Id: Idb8bb1e0cabbbe92e7a852e2eadbdcd8c2ab7d56
2018-03-23 09:36:57 -04:00
Matthew Fritze
ad6678f9fc Add Slider template for Slices
Add the Seekbar preference equivalent
to the TwoStatePreference (toggle) preference
controller abstract controller.

Change-Id: I6ff91f2f72a7f72c18ddbc27b2b1fda4b6ce6ca9
Fixes: 67996707
Test: Robotests
2018-03-22 11:46:47 -07:00
Alan Viverette
4734b3448a Restore "Update for 1.0.0-beta1"
This reverts commit b4fe52343c.

Bug: 74950017
Test: manual
Change-Id: I9749b9ae8f2f75b1bbdf7c6686a036db1f6f8a74
2018-03-16 02:13:11 +00:00
Alan Viverette
b4fe52343c Revert "Update for 1.0.0-beta1"
This reverts commit 6b1fd5cfa9.

Reason for revert: broke Settings

Bug: 74950017
Test: revert only
Change-Id: If56a4dcac4671d8e2c5f2c0de30d13e3cf58666a
2018-03-15 18:48:00 +00:00
Alan Viverette
6b1fd5cfa9 Update for 1.0.0-beta1
Bug: 74449147
Test: make
Change-Id: I664b5f29efbb5d6c40420c0d8aaa8629ddfcd31b
2018-03-12 23:08:35 +00:00
Matthew Fritze
a4a3dfffa2 Declare official platform slice
Create the notion of an official platform slice.
This includes:
- Adding a second authority to the provider
- tagging slices in xml with a platform slice flag
- Including authority in the getUri method

Bug:73359139
Test: robotests
Change-Id: I5382be138a262dbc5a8324c34aab131c5d0d5516
Merged-In: I581ee6dfcdf935f452a15e89e5d055e375ff1877
2018-03-09 18:04:06 +00:00
Alan Viverette
24ac51ce3a Revert "Revert "Update to match now slice APIs""
This reverts commit 80c806abd6.

Bug: 73250914
Test: make && make checkbuild, manual testing
2018-02-27 22:12:02 +00:00