Commit Graph

69 Commits

Author SHA1 Message Date
Yanting Yang
04e7423c7d Ignore failing test of SettingsSliceProviderTest
Bug: 314925256
Test: atest
Change-Id: Ifd72e07be6b5484b26b6918cb5d4b6c56575e2d9
2023-12-05 19:31:15 +08:00
Eric Rahm
802b922593 Revert "Test Fix SettingRobolectricTest Fail"
This reverts commit 818f77cd1f.

Reason for revert: Underlying issue fixed in ag/23454315.

Bug: b/275023433
Test: atest SettingsGlobalRoboTests

Change-Id: I1af272efd00b3c5bd35310512f5712d5d1c7d834
2023-09-11 13:38:36 +00:00
Mill Chen
d4eecf6132 Guard slices from being requested by guest user
According to patch of A-231987122, AOSP restricts app to modify relevant
mobile settings when user is a guest. This change intends to prevent the
slices related to mobile settings from being requested by guest user.

Bug: 278616139
Bug: 277333776
Bug: 262244832
Bug: 278616520
Bug: 278615120
Test: robotests
Change-Id: I4dc4bbfdb5cf76e188e6f62ebfd74ef6fa2fe33b
2023-06-15 14:29:01 +08:00
Vincent Wang
818f77cd1f Test Fix SettingRobolectricTest Fail
Bug: b/275023433
Test: NA
Change-Id: If2dcb8f6c196327129ccc9375b190e394c994efa
2023-05-09 06:26:39 +00:00
Xuanang Zhao
50f229903e Clean up ignored tests in Settings Slices provider.
Change-Id: Iad9102a5d23333d64976e0697f9438bccc77af0a
Bug: 253386051
2022-10-18 07:07:00 +00:00
Wei Wang
52ab48caa0 Reenable tests
The test testLoadSlice_cachedEntryRemovedOnUnpinned was ignored in
ag/20185792 but fixed in ag/20172765

Test: manual run passed m RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.slices.*"
Change-Id: I0bd0e7f7ed780ab24500c3fb102fd216486c34d9
Bug: 253386051
2022-10-17 05:54:27 +00:00
Wei Wang
fcd3c608bf Ignore all failing tests in Settings for now in order to unblock ATP V2
migration

Test: m RunSettingsRoboTests passed on desktop
Change-Id: I2450aaa083aabdf224e070f588441bb01206972b
Bug: 252671269
2022-10-13 17:29:36 +08:00
Xuanang Zhao
890d8d2940 Fix the slice provider test.
Change-Id: Ia711b6f66ef7737f57f388b16f9fb9586727e395
Bug: 249101421
2022-10-12 08:33:26 +00:00
Jason Chiu
d1101896db Enable ignored slice provider tests
Test: robotest
Bug: 199371852
Change-Id: I6c1ef3eb64ecb0d6bdd0e973bd4e4727111b3aef
2022-07-26 14:46:26 +08:00
Jason Chiu
61db863533 Fix broken SettingsSliceProviderTest
Fix: 214944418
Test: robotest
Change-Id: Ib96bbcecbe9fab91ecae6fcaf32f90c11c3caced
2022-01-26 16:06:55 +08:00
Tsung-Mao Fang
297fcb4031 Ignore broken tests
Test: Run tests
Bug: 214943221
Bug: 214944418
Bug: 214944992
Bug: 214944423
Bug: 214945263
Bug: 214945259
Change-Id: I958c003a15866a03b7d0c24210ae2c99f4ee2c47
2022-01-17 22:01:50 +08:00
Tsung-Mao Fang
8498760b07 Ignore broken tests related to wifi tracker lib
Test: Run entire robo tests
Bug: 214938188
Change-Id: Ic23c758737786c2294c400fd2746583fef426f2f
2022-01-17 21:27:25 +08:00
Jason Chiu
7f6b9e26c9 Merge changes from topic "slice-highlight" into sc-v2-dev am: 6821b6be32 am: 026b1b5df6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16151654

Change-Id: If46903bb26371ea90075d1c6cc063af4d10a88d4
2021-11-02 02:43:42 +00:00
Jason Chiu
594eb43159 Support slice deep links highlighting menu entries
- Add an interface to get highlight menu key resource in Sliceable
- Force implementing the new interface in TogglePreferenceController and
  CustomSliceable at syntax level
- Update the slice index db schema

Bug: 204695404
Test: manual, robotest build pass, unit
Change-Id: I0b5068bccd04f1590023de7f3385bc0a4c6fa47b
2021-11-01 14:27:34 +08:00
Bonian Chen
4e13b47e15 [Settings] Ignore failed test case
Ignore failed test case.

Bug: 201021453
Test: build pass
Change-Id: I14569daa801851dac201a38650652acd21c2b8aa
2021-09-24 12:49:21 +08:00
Yi-Ling Chuang
843616eb69 Add the mutability flag for SettingsSliceProvider
Starting Android S, all PendingIntent should have the mutability flag
assigned to prevent from vulnerability.

Fixes: 172811605
Fixes: 172206649
Test: 1. Play on the slices in Settings search.
2. Make a permission request intent of Settings wifi slice in the
slice-viewer app, clicking on it and make sure it gets redirect to
Settings without crashes.

Change-Id: I86f915bc062a6e632b5ca9c74e232db1036f08de
2021-01-07 16:00:08 +08:00
Edgar Wang
a8742aa7ab Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: Ia8625091a107fc3fb652d3ba3f75ea3cc1a8d9f5
2020-08-12 11:29:07 +08:00
Edgar Wang
c2e4513fb6 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual
Change-Id: I36829e0055437dab79d9e5339ac002a87a4b874f
2020-08-04 18:12:48 +08:00
Jason Chiu
98a8640de2 Fix failed test cases
Test: robotest
Fixes: 159688624
Change-Id: I28d53e38000d2dfb00bde900647eb38eda279c9a
2020-06-24 10:55:31 +08:00
Jason Chiu
8ac1e4d49d Update icon tint color when the user toggles Dark theme
- Reload theme in slice provider when Dark theme mode changes for slices
- Reload theme in onCreate of Panel activity for its non-slice header
- Remove applyTheme from individual slices

Test: robotest
Fixes: 153700819
Change-Id: I40a7d2817c4b9100d7b2f2962a69c8a9ce6f7906
2020-05-12 10:58:54 +08:00
Tsung-Mao Fang
2fc9fed89c Fix pendingIntent in SettingsSliceProvider could be Hijacked
A malicious app is able to obtain this pending intent.
It can then mutate all fields except for the action and
launch the intent. This can be used to launch any activity
with the ACTION_SETTINGS action.

So, we enfore assign the package name for this intent,
it only can launch the settings app.

Fix: 147355897
Test: a) Install the new settings apk, and it won't launch other screen.
(See details in bug)
b) Start the settings search, slice search results work as normal.

Change-Id: Ie954d8a4b7153d6a4cac40621f363b45185990f2
(cherry picked from commit b3c0a2a6c1)
Merged-In: Ie954d8a4b7153d6a4cac40621f363b45185990f2
2020-03-05 05:38:55 +00:00
Yi-Ling Chuang
d57e5a5d1a Add the impl for the ability to query non-public Slices
Apps get Settings Slices through onGetSliceDescendants(), so adding some
codes here to make us be capable returning non-public Slices. As these
SliceData come from slice_index.db, where SliceDatabaseAccessor is the
middleman for us to access those data, so adding a parameter in
getSliceUris() to determine what data should be returned.

Bug: 141088937
Test: robotests
Change-Id: I411eb1ff194b7c8915b9e7309c684046dbde29fb
2019-11-26 17:06:15 +08:00
Raff Tsai
85e1218b31 Add wifi calling slice to settings search and AGSA
Fixes: 121041498
Test: test if wifi calling slice is appeared in Settings Search
Change-Id: I4892da6e7d396f28bb232f8e520a8c946f35570d
2019-07-12 23:40:27 +08:00
Fan Zhang
d71835125a Clean up ShadowTheadUtils.
Individual tests don't need to specify it in their own @Config

Bug: 135698296
Test: robotests
Change-Id: I66dc0bfdaec9c6cac9b48f3e7906f71dfb3a6b28
2019-06-20 15:17:42 -07:00
Fan Zhang
13cf250be5 Remove "platform_slice" attribute from Settings.
Bug: 126222433
Test: robo
Change-Id: I05beec7d3e3ec713c40740a1adbcacaee88237b5
2019-06-10 14:05:43 -07:00
Fan Zhang
aa08a2cc0e Use slice uri from slice index db directly.
During SettingsSliceProvider#onGetSliceDescendants, use the uris from
database directly instead of getting the key and construct the uris
manually.

Bug: 126222433
Test: robotest
Change-Id: Iad4e9fc28ec4442b6bb323878503d743582b35ac
2019-05-31 16:03:33 -07:00
Fan Zhang
f36ca50ec7 Add slice uri to slice index db
And slightly refactored the SliceDataConverter to remove 1 reflection.

Bug: 126222433
Test: robotest
Change-Id: Ic5782bdd71f5c9cb77879a35de81dc61c01d1912
2019-05-30 16:47:31 -07:00
Matthew Fritze
2bdea1d922 Prevent bad apps from getting Setting Slices
SettingsSliceProvider no longer allows apps to request permission
from the user for Settings Slices. Instead, the PrimaryAction on the
permission slice will be an intent into Settings.

This is because the dialog for granting apps Settings Slices would act
as a replacement for regular permission dialogs, which we want to avoid.

Fixes: 130795282
Test: robolectrico
Change-Id: I6848215bab2bf10ee5e53814b765d04f04f53f4e
2019-04-18 08:51:17 -07:00
Jason Chiu
53d147dd5c Refactor WifiScanWorker
Extracted WifiScanWorker from WifiSlice

Bug: 128056349
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.wifi
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.slices
Change-Id: I9b3c809ee6c2b7466c959631840b257b91b49d88
2019-04-01 16:40:59 +08:00
Fan Zhang
a8291be3a9 Clean up the hard cache in SettingSliceProvider.
It doesn't need to be a map.

Bug: 129002750
Test: manual
Change-Id: If784dfe4fb497414a04dc5fa8c8374731539d8ed
2019-03-21 14:12:38 -07:00
Fan Zhang
4cb2727989 Tie ContextualWifiSlice to UI instead of garbage collector
- Introduce a static long in SliceFeatureProvider that updates once
  every "session". A session is when user is in an UI (screen rotation,
  going to subpage, etc does not break the continuation of session).

- Use session token in ContextualWifiSlice to determine when to refresh,
  instead of relying on WeakHashMap from CustomSliceManager.
  WeakHashMap can be cleaned up at any time by gc so it doesn't match
  what we want on the UI.

- Also as a side fix, merged CustomSliceManager into
  SliceFeatureProvider.

Fixes: 123937830
Test: robo
Change-Id: I199bceceb208b99a32f3f08e624787b5a03e73a9
2019-03-14 14:45:59 -07:00
Matthew Fritze
9e50419c75 Remove NFC Slice jank
The NFC Slice would jank on enable and disable, because of the
intent filter it registered with SysUI. The intent filter would
broadcast an update for four states:
1) On
2) Off
3) Turning On
4) Turning off

The first two caused no problems. The third and fourth caused jank,
since when clicked, the switch in the NFC slice would turn on / off
asynchronously - that is, it turned on or off based on the previous
state of the switch, rather than on the actual value of NFC. It does
this to feel fluid in the app in which it is rendered.

From the off state, the order of events is:
1.  Switch clicked
2.  Switch animates on
2.  Background intent is fired to settings to turn on Nfc (happens at
       the same time as animation)
3.  Settings calls the NFC enable API
4.  A broadcast for Turning On is sent
5.  The receiver in SysUI gets the broadcast and forwards it to settings
6.  Settings tells the Slice to make sure it is up to date
7.  The Slice checks for the current value - IMPORTANTLY - which is
        currently off, it is only in the process of being enabled.
8.  The Slice flips back off
9.  Nfc finishes getting enabled in the background
10. The framework pushes the NFC ON broadcast
11. SysUI gets the broadcast, and forwards it to settings
12. Settings tells the slice to update
13. The slice checks again and finds that NFC is on, flipping on.

This CL creates a new background slice worker for NFC and registers
the intent filter there, rather than in SysUI. When the background
worker gets the broadcast, it checks if it is in state 3/4, and if so,
it drops the update silently.

Fixes: 115737701
Test: robotests
Change-Id: I17043828ad3a67a2a5acdf5c75d9cc51ff7e91d0
2019-02-26 08:20:38 -08:00
TreeHugger Robot
d611df7c48 Merge "Misc ui tweaks." 2019-02-13 02:15:54 +00:00
Fan Zhang
07207c0113 Misc ui tweaks.
- Update conditional card layout
  - move action button from right side to bottom.
  - Get rid of the forking between small/big screens.

- Update a few icons

Fixes: 121189136
Fixes: 124315564
Fixes: 124316920

Test: visual
Change-Id: I205d9995a2d7ed06ad9d32f3cea74f2840a28aed
2019-02-12 16:14:21 -08:00
Matthew Fritze
1138218abe Create special case mobile data slice
Build the special case mobile data slice for general use,
and for the Internet Connectivity Panel. The Slice controls
the default data subscription, and links to the subscriptions
page.

Bug: 117804089
Fixse: 119411534
Test: robotests & test app.

Change-Id: I31b524a8fe3182a244d940848090e97250632f39
2019-02-08 13:13:28 -08:00
Fan Zhang
0db4ead2b3 Hide wifi card sometimes.
When there is a connected wifi, we now hide the wifi slice card.

However, if we initially shows this card but later wifi is connected
while the card is visible, we keep showing this card to avoid janky
animation. The card will be gone if user nagivates to a different UI and
comes back.

- Create a new slice ContextualWifiSlice for homepage use case, all
  special logic for homepage are added here.
- Change reference for WIFI_SLICE to CONTEXTUAL_WIFI_SLICE where make
  sense.

Change-Id: Ibd87f88058f357aabef0f7d68a5bf48350d75b06
Fixes: 121040746
Test: robotests
2018-12-18 10:18:08 -08:00
James Lemieux
f1dade40d2 Use binary resource support in robolectric
The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
2018-12-12 19:53:49 -08:00
Fan Zhang
53f75f0df9 Move all custom slice uris to a registry class.
Change-Id: I192320f95ac81d14c8891ce2531d603912e59f56
Fixes: 119776308
Test: robotests
2018-11-29 16:41:21 -08:00
Jason Chiu
a68f81540e Enforce all the SliceBackgroundWorkers being singletons at syntax level
- Create workers via reflection in SliceBackgroundWorker
- Store the workers in a static container and release then at shutdown()

Fixes: 118228009
Test: robolectric
Change-Id: I564277d3a12b2d7d3b50cef091bdfedb3397c145
2018-11-05 21:41:30 +00:00
Fan Zhang
cdf284b732 Make Settings robotest work with tot Robolectric
Bug: 116278591
Test: make -j RunSettingsRoboTests
Change-Id: I32cb2fcf6094675f79d2fc24702ef6298a9691e4
2018-10-31 17:59:17 -07:00
Jason Chiu
89b15785c7 Fix crash on Wi-Fi Slice when it's continuously pinned and unpinned
It's because WifiTracker's initialization and onStop is on different
thread. Fine tune the thread logic in SliceBackgroundWorker.

Fixes: 118165942
Test: manual
Change-Id: Icc86b5df7ec3c6fd0e4a79a62ea0c84465e9528d
2018-10-26 18:47:51 +08:00
Jason Chiu
f17233ba7d Slice background worker with Wi-Fi Slice
Test: manual

Change-Id: Ic4fdc5713f511ff80f03728c99c68fda3d0cab02
2018-10-18 18:00:11 +08:00
Fan Zhang
d480c0e41a Grant permission on slice uris based on whitelist
Bug: 112587202
Test: robotests
Change-Id: I4e12a73f0acd848153f32c2569358dd55bed3f92
2018-08-28 18:13:25 -07: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
Matthew Fritze
7f0a30226a Refactor WifiSlice to CustomSliceManager
Modify the WifiSliceCode to follow the pattern for
Slices that do not match existing UI components.

Test: robotests
Bug: 80263568
Change-Id: Id69e019608777282f4b64ff945e8c30c97aaf577
2018-08-20 08:03:34 -07:00
Jason Monk
fee23c456a Follow slice API finalization
Test: build
Change-Id: I5671b180a949d5038f9a73caf84a6d266ef90cfa
2018-08-09 17:03:33 -07:00
Matthew Fritze
56b2bad05e Handle special case slices
Create a handler for any slice that doesn't include anything
from a PreferenceController.

Test: robotests
Change-Id: If23947152d61877537d0cac6240e96b9ab977bce
Bug: 80263568
2018-07-09 11:21:25 -07:00
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
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
TreeHugger Robot
a60ea38f67 Merge "Hook up blocked keys" into pi-dev 2018-05-23 20:41:22 +00:00