Commit Graph

498 Commits

Author SHA1 Message Date
Edgar Wang
6024953f02 Remove injecting multi-user settings into settings itself
- It can improve performance because we use less injected item

Bug: 242152448
Test: robotest
Change-Id: I892e1ac9c3f8297c489fc1fec934e9f5f2e2f5e9
2023-11-21 21:05:54 +08:00
Chaohui Wang
0d338cd1df Let SpaBridgeActivity support ActivityEmbedding
Move the multi pane shared logic into EmbeddedDeepLinkUtils.

Fix: 309075424
Test: manual - with SpaActivity
Test: unit tests
Test: m RunSettingsRoboTests ROBOTEST_FILTER=".*\.SettingsActivityTest"
Change-Id: I8c41c801b8a5009a3959c85b784ed9739d947a70
2023-11-07 13:24:59 +08:00
Chaohui Wang
58f0ee30fc Remove context from dashboardFeatureProvider
DashboardFeatureProviderImpl is created by using application context,
no need pass context in when get.

Bug: 286764889
Test: m Settings
Change-Id: Ia9672dfd9d3d71f64735cbc5979a6ad57c9429d3
2023-07-20 12:21:16 +08:00
Sunny Shao
4b1e982898 Fix back key display issue in the split-screen
- Move the back key display module into the onResume.

Fixes: 280005953
Test: manual test
Change-Id: I289c5fab678fde8345a35d7909307f153a0d812f
2023-06-26 11:23:28 +08:00
Nikhil Kumar
cb5dcaee3b SettingsActivity: Get profile parent using UserManager.getProfileParent
In the headless system user mode(hsum) non-primary users can also have a profile.
The existing implementation in SettingsActivity always gets the primary user as the profile parent, refactored the implementation to get profile parent using UserManager.getProfileParent.

Test: NA
Bug: 267162079
Change-Id: I2af581a4b7e3320f9351b862b7be3ef141b744b7
2023-02-10 09:12:33 +00:00
Chaohui Wang
b2344abd3b Redirect the TogglePermission App Info pages
To Spa, only when flag settings_enable_spa is enabled.

Bug: 263553430
Test: Manually with Settings
Change-Id: I12916989df5804e68fd82163b3670dfcb9241c1d
2023-01-04 08:19:54 +00:00
Jason Chiu
79d282bbfb Merge "Revert "Remove FLAG_ACTIVITY_FORWARD_RESULT in 2-pane flow"" 2022-12-14 02:49:17 +00:00
Jason Chiu
8b1e5d9d7d Revert "Remove FLAG_ACTIVITY_FORWARD_RESULT in 2-pane flow"
This reverts commit ea1580f92b.

Reason for revert:
1. Search result trampoline should have that result sent back to the
reply target of the original activity.
2. To leverage the behavior of handheld's deep link case, large
screen's deep link should forward the result.

Change-Id: I55303070e35fc9430063655e0a9a0fd72e0823ac
2022-12-13 08:05:49 +00:00
Edgar Wang
81aaba00e7 Change preference value changed metrics log format
- Pass metric category into SharedPreferenceLogger
- Update MainSwitchBar metric log format

Bug: 246483846
Test: Robotest

Change-Id: I91c7b89ee35ae4922aea0d8c998f7d0e33365da2
2022-11-14 18:05:42 +08:00
Arc Wang
3b1587d6b2 Remove Intent selector from 2-pane deep link Intent
To guard against the arbitrary Intent injection through Selector.

Bug: 246300272
Test: make RunSettingsRoboTests ROBOTEST_FILTER=SettingsActivityTest
Change-Id: I8b3b936de490f09f4be960fdafc6e66a1d858ee2
2022-11-02 07:37:45 +00:00
Arc Wang
ea1580f92b Remove FLAG_ACTIVITY_FORWARD_RESULT in 2-pane flow
Settings$CreateShortcutActivity does not necessary to be
displayed in 2-pane and it seems no scenario needs the flag
Intent.FLAG_ACTIVITY_FORWARD_RESULT.

Bug: 241346847
Test: build pass
Change-Id: I7a8fca61b453db70233b151711df516649424e3a
2022-08-10 16:14:11 +08:00
Jason Chiu
6dcbb25fa5 Make bluetooth not discoverable via large screen deep link flow
Deep links on large screen devices starts a homepage activity on the
left pane, and then starts the target activity on the right pane. This
flow overrides the calling package, and the target activity can't know
who initially calls it.

Thus, we store the initial calling package in the intent, so the
Connected devices page is able to make bluetooth not discoverable when
it's called from unintended apps on large screen devices.

Bug: 234440688
Test: robotest, manual
Change-Id: I4ddcd4e083c002ece9d10aabdb4af4a41de55ce7
2022-06-24 08:15:22 +00:00
Bonian Chen
d10618d489 [Settings] Adjusted the API of Settings app
The API of Settings app get changed in order to support large screen.
This is a fix to adopt the change related to this work.

A short brief:
1. Accept ACTION_MAIN for launching MobileNetworkActivity.
2. Support deep-link intent while MobileNetworkActivity in foreground.
3. Avoid from binding MobileNetworkActivity as a single instance.

Bug: 230047450
Bug: 234406562
Bug: 229371407
Test: local & unittest
Change-Id: Ifcb9d4c564839199d998bd503f390f021c6bf3ad
2022-06-22 07:51:47 +08:00
Jason Chiu
0c732f2a80 Don't start two pane for singleInstance deep links
If the activity's launch mode is "singleInstance", it can't be embedded
in Settings since it will be created in a new task.

Bug: 229371407
Test: adb shell am start -a android.settings.NETWORK_OPERATOR_SETTINGS
Change-Id: I1689d860151182cd9e97d9e4fd65d30a8804a570
2022-05-26 17:47:18 +08:00
Jason Chiu
26588fc2e5 Fix the work profile's deep link problem
- Settings shows the work Homepage while starting the work profile's
  icon, which is not allowed.
- Clicking work apps' App info plays an unsmooth window transition
  animation.

Fix: 233296965
Test: manual, robotest
Change-Id: I3d12f6c59692c4a4cc718ea7022b60be50235abb
2022-05-20 12:05:32 +08:00
Jason Chiu
1b1c07afc4 Support the managed profile deep links for large screen
Homepage is not allowed to be started as a non-primary user.

In the managed profile deep link case, we create a bridge to start the
homepage as the primary user, and then start the target page as the
given managed user.

Bug: 222447112
Test: manual, robotest
Change-Id: I07dbec3b7eaff983f9860480a0a2f7b0e6f1fb43
2022-05-13 17:00:45 +08:00
Jason Chiu
177573c892 Enhance Settings deep link transition
Since the deep link mechanism uses a trampoline activity to redirect the
target activity, and the targeting activity is launched in a separate
task, there will be two transitions played, where one is the splash
screen with the trampoline acitvity and another one is the task
transition. This makes the UX weird.

To avoid this, this CL tries to make the targeting activity launch in
the same task as the trampoline acitivity by removing the taskAffinity,
so there won't be a task transition.

Fix: 215275940
Test: Create a settings shortcut on the home screen and launch it.
Change-Id: I7621ab9f1132acbf619495801a3b985c5c3b1b5d
2022-03-24 12:42:01 +08:00
Tsung-Mao Fang
00cbd72c60 Rename back button to navigate up button
A minor wording review.

Test: build pass
Bug: 219000314
Change-Id: I23bc580b193cc891b659514d13705db2c55b756a
Merged-In: I23bc580b193cc891b659514d13705db2c55b756a
2022-03-07 08:47:30 +00:00
Arc Wang
9ba80e76b3 Only show 2-pane deep link when homepage is available
DeepLinkHomepageActivity is disabled by default and may be
enabled after receiving the PRE_BOOT_COMPLETED broadcast.

On some virtual devices, DeepLinkHomepageActivity may not
be enabled for test cases. This is a fallback option to
show a full screen Activity to pass tests.

Bug: 221149428
Test: make RunSettingsRoboTests ROBOTEST_FILTER=SettingsActivityTest
Change-Id: I4bbe785176fe3fe8831484141aff7367e4ca25ce
2022-03-02 01:24:14 +00:00
Tsung-Mao Fang
2df79641cb Show/hide back button for 2nd page
By design, we want to show/hide back button for 2nd
layer page when it's in two pane mode.

Test: Manual test
Bug: 219000314
Change-Id: I14d8d7ee08280d5ce80c0b59e1e91d077f0b6d09
2022-02-16 18:01:42 +08:00
Jason Chiu
209df88d9d Set the package name to the deep link intent
If a deep link intent is not specified a package name, the intent action
will be resolved to ForwardIntentToParent in some cases.

Fix: 209928944
Test: manual
Change-Id: I502be6be550ba817b4337f2d0793a7b3678fc8d2
2021-12-09 10:20:34 +00:00
Jason Chiu
a3b21cf017 Start deep link page synchronously in SettingsActivity
- Use a synchronous API to make SettingsActivity start deep link intent
  in onCreate
- Change SettingsHomepageActivity from an alias to a real activity
- Clean up redundant codes

Fix: 206585572
Test: Manual, robotest build pass
Change-Id: Idf42c026f593bb5801a13cae250d1523030b7092
2021-11-18 12:20:08 +08:00
Arc Wang
0f5e75e098 [Large sceen] Don't go Settings 2-pane deep link flow if not task root
When a full screen or a non-Settings-app ActivityA starts ActivityB of
a SettingsActivity, splitInfos will be empty and it unexpectedly goes
Settings 2-pane deep link flow.

This change checks if an Activity is not task root, don't go Settings
2-pane deep link flow.

Bug: 205497007
Test: manual
      SUW -> Vision settings
      Check if it goes Settings 2-pane deep link flow.
Change-Id: I0822fbe71fdde47ce7c070986371a4dfea84992c
2021-11-10 08:50:10 +00:00
Arc Wang
488f79cab5 [Large screen] SplitListener may not provide correct information
SettingsActivity may send Settings 2-pane deep link Intent to
SettingsHomepageActivity if split callback tells that there is no
SplitInfo.

Wallpaper app sends deep link Intent to SettingsHomepageActivity,
and then SettingsHomepageActivity starts Wallpaper app page.
The flow should be 2-pane organized but the split callback tells
that splitInfos is empty.

This change checks if the Intent is from SettingsHomepageActivity
to prevent the Intent loop by the bug.

Bug: 205206004
Test: manual
      Long click Launcher -> Wallpaper & style
Change-Id: I6b9d76c136238e556384e891ae1700ae7c1bb41f
2021-11-05 11:07:33 +08:00
Arc Wang
e80b74de3a [Large screen] Check if it's in 2-pane before 2-pane deep link flow
The callback of SplitStateObserver.SplitStateListener can have one
or more active splits when there is already 2-pane in Activity stack.

This change prevent unnecessary 2-pane deep link flow if the Activity
is already in 2-pane activity stack.

This solution does not work if the Activity was started in a new task.
(e.g., Intent.FLAG_ACTIVITY_NEW_TASK, launchMode singleTask).

Bug: 201379454
Bug: 201620626
Bug: 204398432
Bug: 204397936
Bug: 197609195
Bug: 197609197
Bug: 204501179
Bug: 204959335
Bug: 204845334
Test: manual
      1. Settings -> Apps > Default apps > Opening links.
      2. Click back button should back to Default apps page.
Change-Id: I04aaceed47a8f2754a4e17c53b49252f61e0a1d1
2021-11-04 17:20:17 +08:00
Jason Chiu
e427cc6752 Search experience improvement for large screen
- Support fragment and direct link in SearchResultTrampoline
- Start activity for SI case and start deep link trampoline for others
- Disable menu highlight whenever the search bar is clicked
- Don't overwrite SettingsApplication's homepage activity in
  SliceDeepLinkHomepageActivity
- Scroll to highlighted menu entry after homepage is loaded to prevent
  UI overlapping

Bug: 201724410
Test: manual, robotest build pass
Change-Id: I5115d17d829e85036000da2e80f0e5b0598c733f
2021-11-03 18:44:01 +08:00
Arc Wang
a63e9c625d [Large screen] Make slice deep linking to Settings show in 2-pane
- add a standalone home activity for slice deep link.
- add EXTRA_IS_FROM_SLICE to control the slice deep link flow.
- Intent#parseUri fails if the intent data schema is set.
  Add EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_DATA to relay the
  data schema.

Bug: 201397123
Test: manual, robotest
      1.  Say 'Enable NFC'/'Enable Bluetooth'to Google assistant.
      2.  Click the the NFC/BT Slice.
Change-Id: Ia3216956328c32b2109cb2d70ad1105327661f26
2021-10-31 20:12:27 +08:00
TreeHugger Robot
541f0e447f Merge "Catch a resource not found exception" into sc-v2-dev 2021-10-19 07:26:40 +00:00
Arc Wang
499d8b26bd Merge "Improve scalability of Settings deep link API" into sc-v2-dev 2021-10-19 03:56:28 +00:00
Tsung-Mao Fang
78267b2f2f Catch a resource not found exception
Test: not see a crash
Bug: 198296421
Change-Id: I469a726a32d7bb2f6f81fc0dae27d5b1d1ac0933
2021-10-18 22:47:42 +08:00
Arc Wang
19052cb45e [Large Screen] Fix deep link 2 tasks bug
When launching a Settings deep link, it will close
Activity of the deep link and start both
DeepLinkHomepageActivity & the deep link.

Since 1st launched deep link page is finished,
should also remove its task.

Bug: 203385355
Test: manual
      1. Create a Settings shortcut on launcher.
      2. Click the shortcut.
      3. Move Activity of the shortcut to background.
Change-Id: I04b3243bf51f3940167e4dca6f5a32d9e3cf2841
2021-10-18 17:50:38 +08:00
Arc Wang
8b2dd65738 Improve scalability of Settings deep link API
Avoid using 'two pane' and 'large screen' because
they are implementation details exposure.

Bug: 201662312
Test: build pass
Change-Id: Id3555f734ff11e31d2f4db0479331c4f27e9e715
2021-10-12 21:31:54 +08:00
Jason Chiu
29a09e55ba Revert "Revert "Support highlightable Settings homepage menu for 2-pane""
This reverts commit 096c090b80.

Reason for revert: crash is fixed in this change

Bug: 202510128
Test: manual, build
Change-Id: Ifff8d58cfdcf43e123b11dee308665b2617cb4b3
2021-10-12 09:32:07 +00:00
Greg Kaiser
096c090b80 Revert "Support highlightable Settings homepage menu for 2-pane"
This reverts commit 9037ceabd3.

Reason for revert: Presumed cause of b/202510128

Change-Id: I0daaab95d9bc57229c0c8c916cbe3ada7aafb6fa
2021-10-08 14:29:06 +00:00
Jason Chiu
9037ceabd3 Support highlightable Settings homepage menu for 2-pane
1. Add a preference group adapter to perform highlighting
2. Add a class for mapping highlighable menu keys and preference keys
3. Add an API to determine if the screen is in split mode

Bug: 199017944
Test: manual, build
Change-Id: I8e3fe5fb96480a31ee0f3b3afb6ad78999d3d2bc
2021-10-08 12:52:52 +08:00
Arc Wang
3e8164647c [Large screen] Show full screen CreateShortcutActivity
Show full screen for CreateShortcutActivity because

-Launcher startActivityForResult for Intent.ACTION_CREATE_SHORTCUT and
 activity stack starts from launcher, CreateShortcutActivity will not
 follows SplitPaitRule registered by Settings.

- There is no CreateShortcutActivity entry point from Settings app UI.

Bug: 200916507
Test: manual
      Launcher menu ->  Widgets -> Settings -> select an item.
      Observe if it goes back go launcher.
Change-Id: I437ff9b82d5a4548e10aed7bd083fd01352433f4
2021-09-27 17:44:41 +08:00
Arc Wang
4dd3f11349 Fix not able to add Settings shortcut widget problem
After users select a shortcut item in CreateShortcutActivity,
launchers need to get result from CreateShortcutActivity.

For large screen devices, Settings deep link will start
DeepLinkHomepageActivity and then DeepLinkHomepageActivity
starts the deep link page. The CreateShortcutActivity result
deos not forward to launcher and there is no shortcut added.

This change uses Intent.FLAG_ACTIVITY_FORWARD_RESULT to
forward result from CreateShortcutActivity to launcher.

Bug: 200889769
Test: manual
      Long click launcher -> Widget -> Settings ->
      select an item and check if it adds a short on launcher.
Change-Id: Idd5fc642be5c1fb2f747316c3ddcd9b7f0b33852
2021-09-23 06:54:36 +00:00
Arc Wang
e4084028b3 Merge intent extra to deep link intent target for large screen devices
Sender of deep link intent may want to send intent extra data to the
deep link target Activity by merging intent extra.

Bug: 197048599
Bug: 197926040
Test: manual
      1. Click quick Setting 'Internet button'.
      2. Click the gear button of a connected Wi-Fi.
      3. Observe if the Wi-Fi detail page shows the connected Wi-Fi.
Change-Id: I32040ee21a747cae710df2e12a8f5b66aff086fa
2021-09-23 02:05:55 +00:00
Arc Wang
f6a8f6c8af Extends the criteria width of 2-pane mode
Follow UI spec, we extend criteria width from 600dp -> 720dp

Original code checks if there is only one Activity in
Activity stack to decide if it's a deep link intent,
it has problem at configurationChange.

This change checks if the intent is from Settings app
itself to decide if it's a deep link intent.

Bug: 197716926
Bug: 199808997
Test: Build apk and run on the device.
Change-Id: Ide8ef2ccffa87b9ee4fab41ab4f395b00def9bd6
2021-09-15 12:13:49 +08:00
Arc Wang
22ce392b91 2 panes deep link for large screen devices
This change supports deep link to Settings app internal pages
and external pages outside Settings app.

Apps need android.permission.ALLOW_TWO_PANES_DEEP_LINK_IN_SETTINGS
to send the intent of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK.
Settings app will startActivity for the intent from
Settings#EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI.

Bug: 197048599
Test: build pass
Change-Id: Idaf4a8be4603c1308f16fb4e378266c1e52acb40
2021-09-09 13:04:31 +08:00
Jason Chiu
c38978f3e1 Guard against the exceptions when launching a non-existing fragment
Test: robotest
Bug: 190371550
Change-Id: I2bb7d4bdb23756634526db7e272563a1587c9640
2021-06-30 18:33:59 +08:00
Jason Chiu
c713c3e8ea Support category changed mechanism in homepage
- Homepage cannot referesh UI whenever an injected component is changed
- Extract categories related codes to a mixin

Test: manual, robotest
Fixes: 179792445
Change-Id: I1c13c541ce07b9c36fe984a035623985b5603560
2021-06-18 16:00:29 +08:00
Yi-Ling Chuang
81226a2431 Refactor some transition codes.
- Make the transition logic simpler in SettingsBaseActivity.
- Remove the redundant transition code in SettingsActivity.

Bug: 177479937
Test: rebuild and click on pages.
Change-Id: I65cae59d4eae99e3b9c324c9b6ce89f2349aaf8b
2021-05-20 16:20:28 +08:00
Jan Tomljanovic
07bffff454 Launch SecurityHub fragment on SECURITY_SETTINGS intent when available.
Test: atest SettingsUnitTests
Test: adb shell am start -a android.settings.SECURITY_SETTINGS opens
SecurityHub screen (when SecurityHub enabled)
Test: assistant opens SecurityHub screen (when SecurityHub enabled) when
given instrucion to "open security settings"
Bug: 183930061

Change-Id: Ie8fcb2f2dce4cd0a2a84c6cd21a0a1c0b2b3665e
2021-04-29 17:38:52 +01:00
Stanley Wang
3b70c6c41a Fix the overlap issue of MainSwitch and list view.
This issue happen on Developer and Wi-Fi pages, so the problem
should be solved on SettingsActivity.

Fix: 181341927
Test: Run robotest and see the ui
Change-Id: I57722cfcbeb6390c88101d808429346045e57c92
2021-03-04 15:08:18 +08:00
Yi-Ling Chuang
c55901d2c0 Fix the transition of the up-button.
We've applied a new transition from Search to Settings, where if users
click on the up-button, the transition will not be applied. Hence, this
CL makes the up-button behave the same as the back key to address this.

- Also remove the transition target as it is not necessary.

Fixes: 177968777
Test: 1. Search "Gesture"
2. Click on "Gesture"
3. Tap the up-button and see the applied transition

Change-Id: I046424f244426750d98046703c05ae0a1d567c67
2021-01-29 15:40:36 +08:00
TreeHugger Robot
0cb063c9e4 Merge "Remove redundant toolbar from CollapsingToolbarLayout" 2021-01-15 10:21:38 +00:00
Mill Chen
7b163e2566 Remove redundant toolbar from CollapsingToolbarLayout
The new material library has been updated to be able to support
android.widget.Toolbar, so the redundant toolbar has to be removed.

Bug: 176882938
Test: visual verified
Change-Id: Ibada6b9d315c14d79e9f9f8015cbb5e00fbeea38
2021-01-15 14:43:30 +08:00
TreeHugger Robot
6987b78782 Merge "Redirect users from Search to Settings with transition." 2021-01-15 06:12:49 +00:00
Stanley Wang
b87ddba6cd Use SettingsLib's MainSwitchBar to replace SwitchBar in Settings.
To log Settings metrics, the MainSwitch extends MainSwitchBar and
replace the SwitchBar in SettingsActivity.

Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui

Change-Id: I3add3702e9058ad9192b5172c7cf0e2ccfb55a70
2021-01-14 22:48:31 +08:00