Commit Graph

55 Commits

Author SHA1 Message Date
shaoweishen
fb164fe128 [Sound panel] Update Ui layout to match with mertial next
please check bug for before/after screenshot.

Bug: 191317779
Test: verified on device
Change-Id: Ia570dde71ce9f18376eaba48102cecde6adb85bb
2021-10-12 14:24:09 +00:00
Weng Su
7b8c367d4f [Provider model] Add "Turn off/on Wi-Fi" link to Internet Panel
- Replace the left menu button with "Turn off/on Wi-Fi"
  - Remove the TurnOnWifiSlice

- Show "Wi-Fi is off" sub-title when Wi-Fi is disabled
  - Remove the "Wi\u-Fi is turned on" sub-title when APM is on.

Bug: 188710392
Test: manual test
atest -c InternetConnectivityPanelTest
make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.panel

Change-Id: I53e200f6cadf8b712bf794bcbd5ff79f0f239cc0
2021-05-26 17:22:38 +08:00
Weng Su
c407a2d9f8 [Provider Model] Add progress bar to internet panel
- Show progress bar when Wi-Fi scanning

- Show "Searching for networks..." sub-title when Wi-Fi scanning

- Remove "Wi-Fi" from searching networks string

Bug: 178774497
Test: manual test
atest -c InternetConnectivityPanelTest
make RunSettingsRoboTests ROBOTEST_FILTER=PanelFragmentTest

Change-Id: Ic05b939bef3b106845fe90db41eb09f0e15756f4
2021-05-10 05:27:59 +00:00
Jason Chiu
c4cead363c Guard against NullPointerException when getActivity in PanelFragment
Fixes: 169729372
Test: build
Change-Id: I2f5bbb38015b71ecf82bc8ed7ab8e5815a2bd2f9
2021-04-08 16:39:27 +08:00
Weng Su
7a62ab1fff [Provider Model] Internet Panel - Airplane mode is on
- Add "Airplane mode is on" to sub-title
  - Set the header layout to CENTER_HORIZONTAL if it's no icon

- Hide "Settings" button

- Screenshot
  https://screenshot.googleplex.com/6m5dFVZu7ar4nKW

Bug: 178717651
Test: manual test
atest InternetConnectivityPanelTest \
      PanelFragmentTest \
      ProviderModelSliceTest

Change-Id: I899a817fd99415e9cad608aa4deac1e45365696a
2021-02-04 18:48:34 +08:00
Weng Su
28172b61c8 [Provider Model] Dynamically update the Internet Panel title
- Change from "Internet" to "Airplane mode networks"

- Screenshot:
  https://screenshot.googleplex.com/gk3RBcjPsXq5NTk

Bug: 176803442
Test: manual test
- atest InternetConnectivityPanelTest
- make RunSettingsRoboTests ROBOTEST_FILTER=PanelFragmentTest

Change-Id: Ifb2c24434e480861fc7c3eaece683d49eb99013e
2021-01-28 11:00:08 +00:00
SongFerngWang
19cd9506c7 Rephrase the see more button of Internet panel when ProviderModel is enabled
Bug: 176871139
Test: build Test and manaual test(check the UI)
make RunSettingsRoboTests -j ROBOTEST_FILTER=InternetConnectivityPanel
(PASS)

Change-Id: I5e601c6639d979ca776f4bdf7f5e870a0513c7f5
2021-01-12 16:31:41 +08:00
timhypeng
7c86980bf3 Remove unused variable
-remove VIEW_TYPE_SLIDER_LARGE_ICON
-remove MEDIA_OUTPUT_GROUP_SLICE_URI
-remove MEDIA_OUTPUT_SLICE_URI

Bug: 175850711
Test: build pass
Change-Id: Iecf987cc91934a7598762523814f5f575302dde2
2020-12-21 03:23:32 +00:00
timhypeng
82d45fa032 Redirect to output switcher panel to the new dialog
-Redirect for Cast button
-Send intent when call MediaOutputPanel::create()
-Return null to finish the activity

Bug: 172178632
Test: make -j50 RunSettingsRoboTests
Change-Id: I1038e237113f433c847aff98a45b1dd6089d80a8
2020-11-23 03:32:30 +00:00
TreeHugger Robot
34937eb21e Merge "Hide the icon if didn't have media session or album art" 2020-09-15 02:32:08 +00:00
Hugh Chen
30805af9de Hide the icon if didn't have media session or album art
- This CL before, output switcher panel will show default
  icon if there are no media session or album art.

  This CL will hide the icon if there are no media session
  or album art.
- Add test case

Bug: 161495909
Test: make -j42 RunSettingsRoboTests
Change-Id: I5f80158b12f89c8499fb97d0b203ebeffefbc18b
2020-09-14 17:17:04 +08:00
Jason Chiu
6a8d2c5e55 Fix the endless panel loading
Re-launching volume panel continuously will trigger an endless panel
loading, show a transparent unfinished UI, and then block the user's
screen.

Root cause:
When the activity receives a new intent from user's clicking, it will
call PanelFragment#createPanelContent to update the current fragment.
The method triggers an animation and then loads the panel content. If
multiple invocations run concurrently before the animation or the
loading finish, the loader's countdown latch will be increased
abnormally and lead to the endless loading.

Solution:
1. Since the invocations are in UI thread, simply add a flag to avoid
reentrance when the panel is animating or loading.
2. Filter out the same panel's creation request when the panel is still
visible.
3. Do not force a panel's recreation when it's under construction.

Bug: 143889510
Bug: 160491854
Test: robotest, manual
Change-Id: I821faedeb62354929f3af9804cbbe44ee5bb8a53
2020-09-03 07:10:21 +00: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
tim peng
593d62d992 Merge "Add a separate line at the bottom of list area in output switcher" into rvc-dev am: 02e311e537 am: 9ff43d2fa3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11900663

Change-Id: Ibcab4ea712bcf00fa380c2f449713e6304e766b2
2020-06-20 10:48:25 +00:00
Tim Peng
aeabfc3050 Add a separate line at the bottom of list area in output switcher
-Bottom divider is not showed when there are more than 7 devices exist in output switcher
-Check panel type in isDividerAllowedBelow()
-Hide the Slice bottom divider of Output switcher panel
-Show divider in panel layout only for output switcher panel

Bug: 159177275
Test: make -j42 RunSettingsRoboTests

Change-Id: I49396a0ee0543b494a2b3d714ec248ebab08e7ba
2020-06-20 03:44:43 +00:00
tim peng
79b4ddeb4c Merge "Refine layout for output switcher panel" into rvc-dev am: 7874c0fdc4 am: bdd31f4508
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11596546

Change-Id: Iec1e3cc7e53a2a2062dd7fdfdb4fdd17a3bfbb68
2020-06-15 01:42:40 +00:00
Tim Peng
9bdeef43fd Refine layout for output switcher panel
1. only make the output switcher tall enough to show 6.5 devices
2. enlarge album art to 52*52 and keep same size on group panel
3. reduce panel header top padding
4. enlarge slice first item top padding
5. update slider bar right padding
6. update panel height
7. align slice title item left with panel title icon
8. enlarge slice end item right padding

Bug: 156045699
Test: manual test
Change-Id: I51321d98ef483665689b7e258d6071df76382759
2020-06-12 15:15:00 +08:00
Yi-Ling Chuang
7837f1824d Merge "Fix Talkback annoucement for Media Output panel." into rvc-dev am: ba85ecdf06 am: 4aa4c7119a
Change-Id: I26429420ad47b8e6dd787a0e05fdefa9efe646c8
2020-05-26 09:47:11 +00:00
Yi-Ling Chuang
350affcdfa Fix Talkback annoucement for Media Output panel.
The sound panel and media panel are using the same window, so when it
transit from the sound panel to media panel, no window-change event will
be sent. Therefore, Talkback won't be able to re-focus the panel header
which lead to the lack of the announcement.

Fix this by adding setAccessibilityPanelTitle() to trigger Talkback.

Fixes: 140459762
Test: rebuild and test talkback on the media output panel.
Change-Id: I1442434315374dbbfe1d47ca8638180577c93168
2020-05-25 13:51:06 +08:00
Jason Chiu
fe32005e88 Merge "Fix the incorrect title of Panel" into rvc-dev am: 1f91111c3a am: 2fee6f3d1e
Change-Id: I8d1e8c8197025068112a37bd6ae590b3228ff59d
2020-04-22 07:00:05 +00:00
Jason Chiu
4bbc85eb54 Fix the incorrect title of Panel
Since panel activity is singleInstance, a newer panel will reuse the
same fragment as the previous panel when they are displayed one after
another.

Panel fragment has two kinds of exclusive header layout which shouldn't
be showed at the same time, so we have to reset their visible states
when creating panel content.

Fixes: 154668079
Test: robotest
Change-Id: I701a7cde4b43322fbc63ae1cb74c41dd23b37c0c
2020-04-22 06:29:57 +00:00
TreeHugger Robot
35adcca607 Merge "Update customize button title when state changed" into rvc-dev am: b11a46cfd5
Change-Id: Ida02e3e49ab0210d8494d6e919b5048895f1eae0
2020-03-27 03:28:47 +00:00
hughchen
bc5f2fad33 Update customize button title when state changed
- This CL update customize button title when
  onCustomizedButtonStateChanged() is called.
- Add test case

Bug: 152002708
Test: make -j42 RunSettingsRoboTests
Change-Id: I85c9cf90305757e279c058db2875e303b4add437
2020-03-26 10:40:16 +08:00
tim peng
8e8ac25c41 Merge "Close panel when media stop" into rvc-dev am: 91ad46fa60
Change-Id: I0015e42b8a6e1bf4fd0c96807e2465a12af84df9
2020-03-19 06:26:54 +00:00
Tim Peng
650eda307b Close panel when media stop
-Add forceClose callback to finish panel
-Add test cases

Bug: 151396986
Test: make -j50 RunSettingsRoboTests
Change-Id: Ic0ac2880a4ff412382816ccb41b4fbb60dbdf519
2020-03-19 10:02:35 +08:00
Automerger Merge Worker
bd59e9ad27 Merge "Output switcher header is not updated with the latest media content" into rvc-dev am: 95cd4c9414
Change-Id: Iada645d9939d5b7343d1ebef27ccba669e9dc268
2020-03-17 03:45:43 +00:00
Tim Peng
36c4949414 Output switcher header is not updated with the latest media content
-Register media controller callback
-Update panel header when medadata changes
-Add test cases

Bug: 151396986
Test: make -j50 RunSettingsRoboTests
Change-Id: Id0b8f997899a96c0c94ca6bf099e624a9e87795b
2020-03-17 09:02:34 +08:00
Automerger Merge Worker
a6b501c926 Merge "Adjust layout for Slice InputRange" into rvc-dev am: af4d55e7dd
Change-Id: I54caf734aa1e1e43ac5d85c5bdcc736cbcc75aff
2020-03-10 03:21:11 +00:00
Tim Peng
db7d61d0a2 Adjust layout for Slice InputRange
-Make title to slider aligned
-Add test cases

Bug: 147462114
Test: make -j50 RunSettingsRoboTests
Change-Id: Ib1d076f77eae75e4f861a80873117b6254729fe5
2020-03-09 21:50:58 +08:00
Automerger Merge Worker
b856ed655c Merge "Add dynamic group panel" into rvc-dev am: 9a1701b42f
Change-Id: I57a4099c7aca8c366bf2740c29f8a17577ef1cc0
2020-03-04 02:39:02 +00:00
Automerger Merge Worker
6ad23a342d Merge "Fix NPE in PanelFragment" am: 06cafcd733 am: 98e3ed4e5d
Change-Id: I710a54c16476313e83bf8ee9c12c0712a184c65c
2020-03-02 11:52:50 +00:00
Daniel Hunt
26aaf07e9d Fix NPE in PanelFragment
When updating the panel after getting a second intent to the
activity, there is a small window of opportunity for the user
to close the activity before the animation ends, causing an
NPE when onFinish is called as the activity already closed down.
This change will check that there is an activity before trying
to finish it.

Bug: 150322041
Test:
For an easy way to reproduce this, turn the screen on and run the
following in a terminal:
 while true; do adb shell am start -a \
 android.settings.panel.action.INTERNET_CONNECTIVITY; \
 sleep 0.1; done
Then press the back button while the screen is attempting to
display the fragment. There should be no Settings crash.
Change-Id: I4ca831d71a7221a7a4a62bb29e802f507ce5213c
2020-02-27 15:47:38 +01:00
Tim Peng
a87985c4ae Add dynamic group panel
-Rename PanelCustomizedButtonCallback to PanelContentCallback
-Add onGroupChanged in PanelContentCallback
-Add test cases

Bug: 146813761
Test: make -j42 RunSettingsRoboTests
Change-Id: I60888efbbd0fc2878467418e55c70887a9d3f405
2020-02-27 06:29:01 +00:00
hughchen
201b48b885 Add stop casting button for output switch
This CL add a customize button to stop casting when media
is transferred to info device.

This CL include following change:
- Add new methods to PanelContent.java. Let panels to
  customize "see more button".
- MediaOutputPanel will check which device is used to
  transfer media currently. The customize button will
  shown on when transfer device is info device.
  Then user can use this button to stop casting.
- Add test case.

Bug: 147856563
Test: make -j42 RunSettingsRoboTests
Change-Id: I8b201a10339f39f1d938d99b5659a82014e5bb89
2020-02-19 10:05:44 +08:00
timhypeng
cc0069e42f Add listener for panel header icon
Bug: 146813761
Test: make -j42 RunSettingsRoboTests
Change-Id: I473b535593d4ecb445027d6c7dafbb235a70ffcf
2020-02-14 10:38:27 +08:00
timhypeng
0c4db3170d Add title and icon in output switcher panel header
-title shows artist
-subtitle shows album
-add test cases

Bug: 147776885
Test: make -j42 RunSettingsRoboTests
Change-Id: Ib33e5550e668d8cc5d70051ea2e7dd74d61c767a
2020-02-05 21:52:03 +08:00
timhypeng
0206434667 Define ICON_UNAVAILABLE for no icon status
Bug: 147776885
Test: make -j42 RunSettingsRoboTests
Change-Id: I0fd0e203bb7590955d0caf2679ebc78be68b4e50
2020-01-20 13:57:02 +08:00
timhypeng
adae7475b0 Add title and icon in panel header
- Add getIcon() and getSubTitle() in PanelContent
- Check icon avalibility to decide header layout
- Add test cases

Bug: 147776885
Test: make -j42 RunSettingsRoboTests
Change-Id: Idb51e81359b6037ca9b90965dd9b370fc5e22c84
2020-01-20 13:43:19 +08:00
Raff Tsai
dfba9a0f6d Change Panels creation interface to take a bundle
Fixes: 124399577
Test: robolectric
adb shell am start -a android.settings.panel.action.WIFI
adb shell am start -a android.settings.panel.action.VOLUME

Change-Id: I9e13357444e4ebeee50fb8cc68fbc974ce5fffb6
2019-10-18 13:21:18 +08:00
TreeHugger Robot
62aa86145c Merge "Fix volume panel hang" 2019-09-18 06:04:53 +00:00
Raff Tsai
d9cfbaf3b5 Fix volume panel hang
SliceLiveData changed its behavior, if slice is null, it will not
notify LiveData observer but callback to onErrorListener. We only
reduce PanelSlicesLoaderCountdownLatch in LiveData observer.
Therefore the error slice caused PanelSlicesLoaderCountdownLatch
never count to 0, the UI was not displayed. It is solved by reducing
PanelSlicesLoaderCountdownLatch in onErrorListener and also not return
null in MediaOutputIndicatorSlice.

Test: manual
Fixes: 141084035
Change-Id: Iddb2dbdc0e0d2ac3e26071960bb667937f181121
2019-09-18 11:40:46 +08:00
Tsung-Mao Fang
b455d58c03 Only add divider in recyclerView once
Only add divider in recyclerView once or more and more dividers
will be set in recyclerView.

Change-Id: I765ed888d460be221341dafe3521a849b8dd3889
Fix: 139452947
Test: Show panel many times and see the divider.
2019-09-16 15:31:42 +08:00
Raff Tsai
ad004e9beb Fix media switch slice doesn't display in panel
Fixes: 140396725
Test: manual
Change-Id: Idf0b766ce5f4316ff90a23faf3083cdee9854562
2019-09-04 11:34:23 +08:00
lindatseng
be70aaa6c4 Add null check to precent crash in monkey test
Fixes: 133259172
Test: manual
Change-Id: Ib4dd24965fda40a7a917397bf558309e0424bf16
2019-05-22 10:36:50 -07:00
lindatseng
2943c1de7a Set panel launch mode to singleInstance and fix animation
Set panel launch mode to singleInstance to avoid panel can show up
infinite time when user keep launching panels (Easy repro by
pressing volume hard key > settings again and again).

After changing launch mode to singleInstance, we will need to do
some refactors, to avoid weirdness when adding/changing/closing
panels:
1. Move and refactor logic in SettingsPanelActivity#onCreate.
   We will need onNewIntent here to handle Panel launching, since
   we only have one instance of SettingsPanelActivity now.

   Also do refactor here to reuse the PanelFragment instead of
   creating one every single time, to better handle the exit
   animation, avoid janky exit behavior from the old PanelFragment

2. Move logic from PanelFragment#onCreateView, to reuse it when
   updating panel content.

   Also add exiting animation when we are transitioning the panel
   from one to another.  Also add alpha animation to make it move
   more smoothly.

3. Adding flags to launch see more intent in settings.

Fixes: 131225920
Fixes: 131254399
Test: manual
Change-Id: I93d3708bd02a2d736e38685475f2d9988ef62d31
2019-05-10 07:14:13 +00:00
Matthew Fritze
b6fdd25c23 Add entry animation to Settings Panels.
Settings Panels as a dialog have a default animation for entering the
screen, but Slices complicate the animation. While the dialog enters the
screen, Slices begin to bind, thus changing the height of the dialog as
it enters, causing perceived bounce / jank in the animation.

This CL is cherry-picked/based on ag/6671083 but do the following modification:
(See the original commit message for the whole concept)

When trying to load all the Slices, there are few possible situations:
1. Slice starts loading slowly, starting at state LOADED_NONE
2. Slice is loading in progress, having state LOADED_PARTIAL
3. Slice is loaded, but there's error return from the Slice data (We don't
need to show the Slice in this case)
4. Slice is loaded, progress to state LOADED_ALL
5. Slice starts from state LOADED_NONE, but never progress to the next state
because it crashes at setting backend.

Notice that there are two cases that the state will stay at LOADED_NONE and
we can't distinguish them.

Hence, we decide to do the following:

If Slice is with error (case 3) we remove the slice from the list and mark it
loaded.

If Slice is loaded with LOADED_ALL (case 4, which is the ideal case), we mark
it as loaded.

In the other cases, we fire a handler to mark the slice loaded anyway after
250ms timeout.

When all the slices are marked loaded (which should happen after 250ms timeout,
we will animate the panel out.  Although there might be slices which are still
partial loaded, we can still have the slice in the panel once it is ready.
The panel might bounce/jank in this case, but at least it will still showing
correctly, and should show up smoothly in most cases.

The solution to this problem is twofold:
1. Load all Slices first
2. Create a custom animation to draw the panel once the recyclerview has
been laid out.

Test: Manual/Visual inspection
Test: make -j40 RunSettingsRobotests
Bug: 123942159

Change-Id: I639a707aa4ba3f906bd6f9752c92727aaba28142
2019-04-16 16:29:04 +00:00
lindatseng
79957c3217 Update panel logging to include all hide page cases
The old logging only include see_more, done, and clicked_out when hiding
the panel page.  We were missing many cases that user might use back
button, app switch button to close the page.

Update the hide page keys to change the clicked_out to others to
include all the other cases which hide the page.

Test: Manual verification
Test: atest PanelFragmentTest SettingsPanelActivityTest
Fixes: 130169553
Change-Id: Icede9a8dcb84565cba183963c9fb554507631c98
2019-04-12 11:33:41 -07:00
lindatseng
cf93c8bc92 Remove divider above device switcher in panel
Remove the divider above the media device switcher Slice per the request.

Do a little refactor in Panel View, to use DividerItemDecoration instead of adding
divider views in layout file as the recycler view items divider.

Since dividers should be shown in most cases, we are setting DividerCondition to
DIVIDER_CONDITION_BOTH and default true to allow divider.  For the slice we don't
need divider (media device switch in this case) we are setting the the target
direction of isDividerAllowed (above in this case) to false.  Since we have
DIVIDER_CONDITION_BOTH, if one of the item view set the divider not allow, the
divider won't be shown.

Test: Visual/Manual inspection
Fixes: 126205139
Change-Id: Ic857705c90819ef9375f877a44bb32987b5d4438
2019-04-05 14:15:16 -07:00
Matthew Fritze
e435b062a0 Fix NPE in constructor
Move getActivity() call and fetching of metrics feature provider into
onCreateView rathre than the Constructor of the fragment (where Activity
is not yet created).

Test: manual
Test: existing robotests
Fixes: 128808444
Change-Id: I88586b0ca3ebda60f8933041322541cc5911de68
2019-03-20 08:29:23 -07:00
Matthew Fritze
b197110f71 Add logging for SettingsPanels
The 3 main categories are:
- Panel Opened
- Panel Closed
- Panel Slice interaction

There are 3 close events:
- See more button
- Done button
- Clicking outside the panel

Slice interactions will log the Uri of the Slice and the ActionType,
such as Toggle, Slider, Content (intent).

Change-Id: Iecad948f39f50dd12ae1bcb23a5d523e0df8bb98
Fixes: 117804231
Test: robotests
2019-02-13 16:06:24 -08:00