Status Update
Comments
il...@google.com <il...@google.com> #2
Chris
ur...@gmail.com <ur...@gmail.com> #3
lo...@gmail.com <lo...@gmail.com> #4
GCP does include this Ubuntu version image, but users cannot monitor it with Stackdriver.
an...@zappos.com <an...@zappos.com> #5
il...@google.com <il...@google.com> #6
re...@gmail.com <re...@gmail.com> #7
ne...@gmail.com <ne...@gmail.com> #8
be...@gmail.com <be...@gmail.com> #9
vi...@gmail.com <vi...@gmail.com> #10
ma...@gmail.com <ma...@gmail.com> #11
bm...@gmail.com <bm...@gmail.com> #12
an...@backx.org <an...@backx.org> #13
il...@google.com <il...@google.com> #14
This is the thuggest thing I've seen from Google in a long time - considering the footage Stackdriver gets in the GCP console Navigation menu.
mi...@gmail.com <mi...@gmail.com> #15
ev...@willowtreeapps.com <ev...@willowtreeapps.com> #16
il...@google.com <il...@google.com> #17
at...@gmail.com <at...@gmail.com> #18
tt...@appbird.com <tt...@appbird.com> #19
tt...@appbird.com <tt...@appbird.com> #20
Anything is going to happen here?
[Deleted User] <[Deleted User]> #21
ig...@gmail.com <ig...@gmail.com> #22
mi...@gmail.com <mi...@gmail.com> #23
[Deleted User] <[Deleted User]> #24
il...@google.com <il...@google.com> #25
nobody@google.com <nobody@google.com> #26
se...@gmail.com <se...@gmail.com> #27
jo...@powerschool.com <jo...@powerschool.com> #28
il...@google.com <il...@google.com> #29
de...@gmail.com <de...@gmail.com> #30
il...@google.com <il...@google.com> #31
[Deleted User] <[Deleted User]> #32
[Deleted User] <[Deleted User]> #33
de...@gmail.com <de...@gmail.com> #34
ja...@google.com <ja...@google.com> #35
va...@gmail.com <va...@gmail.com> #36
ni...@gmail.com <ni...@gmail.com> #37
mo...@gmail.com <mo...@gmail.com> #38
um...@gmail.com <um...@gmail.com> #39
ph...@bayfmail.com <ph...@bayfmail.com> #40
rm...@gmail.com <rm...@gmail.com> #41
ri...@gmail.com <ri...@gmail.com> #42
ag...@gmail.com <ag...@gmail.com> #43
dt...@gmail.com <dt...@gmail.com> #44
[Deleted User] <[Deleted User]> #45
mo...@gmail.com <mo...@gmail.com> #46
da...@gmail.com <da...@gmail.com> #47
iv...@gmail.com <iv...@gmail.com> #48
ho...@gmail.com <ho...@gmail.com> #49
[Deleted User] <[Deleted User]> #50
al...@gmail.com <al...@gmail.com> #51
mi...@joyn.de <mi...@joyn.de> #52
te...@googlemail.com <te...@googlemail.com> #53
ro...@gmail.com <ro...@gmail.com> #54
ke...@gmail.com <ke...@gmail.com> #55
ph...@visibacare.com <ph...@visibacare.com> #56
il...@google.com <il...@google.com>
so...@gmail.com <so...@gmail.com> #57
ad...@gmail.com <ad...@gmail.com> #58
ro...@gmail.com <ro...@gmail.com> #59
ha...@live.com <ha...@live.com> #60
mo...@gmail.com <mo...@gmail.com> #61
ki...@gmail.com <ki...@gmail.com> #62
sh...@gmail.com <sh...@gmail.com> #63
mo...@gmail.com <mo...@gmail.com> #64
il...@google.com <il...@google.com> #65
aa...@marinosoftware.com <aa...@marinosoftware.com> #66
am...@gmail.com <am...@gmail.com> #67
il...@google.com <il...@google.com> #68
as...@gmail.com <as...@gmail.com> #69
va...@gmail.com <va...@gmail.com> #70
il...@google.com <il...@google.com> #71
as...@gmail.com <as...@gmail.com> #72
jo...@gmail.com <jo...@gmail.com> #73
(WRONG:)
(WRONG:)I have not tried it yet.
This was wrong. There is a difference between Monitoring agent and Logging agent. The Monitoring agent is still not supported on Ubuntu 18.04 LTS.
af...@gmail.com <af...@gmail.com> #74
STACKDRIVER MONITORING AGENT
-----------------------------------------------------
Nov 30 13:34:41 ubuntu-1804 startup-script: INFO startup-script-url: ==============================================================================
Nov 30 13:34:41 ubuntu-1804 startup-script: INFO startup-script-url: Starting installation of stackdriver-agent
Nov 30 13:34:41 ubuntu-1804 startup-script: INFO startup-script-url: ==============================================================================
Nov 30 13:34:41 ubuntu-1804 startup-script: INFO startup-script-url: Installing agent for Debian or Ubuntu.
Nov 30 13:34:41 ubuntu-1804 startup-script: INFO startup-script-url: Warning: apt-key output should not be parsed (stdout is not a terminal)
Nov 30 13:34:41 ubuntu-1804 startup-script: INFO startup-script-url: OK
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: E: The repository '
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: Could not update apt repositories.
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: Please check your network connectivity and
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: make sure you are running a supported Ubuntu/Debian distribution.
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: See
STACKDRIVER LOGGING AGENT
-----------------------------------------------
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: Installing StackDriver logging.
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: ==============================================================================
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: Starting installation of google-fluentd
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: ==============================================================================
Nov 30 13:35:28 ubuntu-1804 startup-script: INFO startup-script-url: Installing agents for Debian or Ubuntu.
Nov 30 13:35:30 ubuntu-1804 startup-script: INFO startup-script-url: Warning: apt-key output should not be parsed (stdout is not a terminal)
Nov 30 13:35:30 ubuntu-1804 startup-script: INFO startup-script-url: OK
Nov 30 13:36:03 ubuntu-1804 startup-script: INFO startup-script-url: Selecting previously unselected package google-fluentd.
Nov 30 13:36:03 ubuntu-1804 startup-script: INFO startup-script-url: (Reading database ... #015(Reading database ... 5%#015(Reading database ... 10%#015(Reading database ... 15%#015(Reading database ... 20%#015(Reading database ... 25%#015(Reading database ... 30%#015(Reading database ... 35%#015(Reading database ... 40%#015(Reading database ... 45%#015(Reading database ... 50%#015(Reading database ... 55%#015(Reading database ... 60%#015(Reading database ... 65%#015(Reading database ... 70%#015(Reading database ... 75%#015(Reading database ... 80%#015(Reading database ... 85%#015(Reading database ... 90%#015(Reading database ... 95%#015(Reading database ... 100%#015(Reading database ... 60686 files and directories currently installed.)
Nov 30 13:36:03 ubuntu-1804 startup-script: INFO startup-script-url: Preparing to unpack .../google-fluentd_1.6.1-1_amd64.deb ...
Nov 30 13:36:03 ubuntu-1804 startup-script: INFO startup-script-url: Unpacking google-fluentd (1.6.1-1) ...
Nov 30 13:36:45 ubuntu-1804 startup-script: INFO startup-script-url: Selecting previously unselected package google-fluentd-catch-all-config.
Nov 30 13:36:45 ubuntu-1804 startup-script: INFO startup-script-url: Preparing to unpack .../google-fluentd-catch-all-config_0.7_all.deb ...
Nov 30 13:36:45 ubuntu-1804 startup-script: INFO startup-script-url: Unpacking google-fluentd-catch-all-config (0.7) ...
Nov 30 13:36:45 ubuntu-1804 startup-script: INFO startup-script-url: Setting up google-fluentd (1.6.1-1) ...
Nov 30 13:36:45 ubuntu-1804 startup-script: INFO startup-script-url: Adding system user `google-fluentd' (UID 112) ...
Nov 30 13:36:45 ubuntu-1804 startup-script: INFO startup-script-url: Adding new group `google-fluentd' (GID 116) ...
Nov 30 13:36:46 ubuntu-1804 startup-script: INFO startup-script-url: Adding new user `google-fluentd' (UID 112) with group `google-fluentd' ...
Nov 30 13:36:46 ubuntu-1804 startup-script: INFO startup-script-url: Not creating home directory `/home/google-fluentd'.
Nov 30 13:36:46 ubuntu-1804 startup-script: INFO startup-script-url: Installing default conffile /etc/google-fluentd/google-fluentd.conf ...
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: ==============================================================================
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: Installation of google-fluentd complete.
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: Logs from this machine should be visible in the log viewer at:
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url:
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: A test message has been sent to syslog to help verify proper operation.
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: Please consult the documentation for troubleshooting advice:
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url:
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: You can monitor the logging agent's logfile at:
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: /var/log/google-fluentd/google-fluentd.log
Nov 30 13:37:31 ubuntu-1804 startup-script: INFO startup-script-url: ==============================================================================
yg...@gmail.com <yg...@gmail.com> #75
yg...@gmail.com <yg...@gmail.com> #76
il...@google.com <il...@google.com> #77
ya...@gmail.com <ya...@gmail.com> #78
[Deleted User] <[Deleted User]> #79
E: Unable to locate package stackdriver-agent
al...@gmail.com <al...@gmail.com> #80
lv...@gmail.com <lv...@gmail.com> #81
am...@gmail.com <am...@gmail.com> #82
RoadBlock Item:
- AWS RDS equivalent - CloudSQL. Postgres version (GCP supports 9.6.x, postgres latest version 11, AWS supports 10.6 - i am using AWS 10.6)
- AWS DMS equivalent - NONE. There is no seamless Database Migrator for postgres (there is for MySQL). Meaning i have to suffer doing all those manual migration task, moving from servers to servers.
- AWS ElastiCache equivalent - MemoryStore. Redis version (GCP supports redis V3, AWS supports V5 - i am using an app with V4, which is not backward compatible with V3), I know it's easy to spin up a redis on GCE using image, but lets not go there.
- CloudSQL Postgres connection limit (Google has well under < 400 max connections, RDS allows up to thousands)
- Now this, the monitoring tool/agent is not supported on Ubuntu 18.04, my company just updated all Ubuntu instances on AWS to 18.04. So without monitoring tool support, this is a very major roadblock.
PS: My team has engaged Google sales team (we had several meetings), we raised some major issues to them about lack of support of major services (be it version, or customization limit), they sounded very positive about the migration but in fact, they offered us some consultation services which will cost alot, using some hacks and workaround just to cover that Google lacks (mentioned in above points). IMO, all they care is about Sales and profit, not really solving customers' issue. If you really want to compete with AWS, what you have to do is offer great tools for seamless migrations, but not forwarding customers who want to migrate to a "workaround" consulting service.
co...@gmail.com <co...@gmail.com> #83
vu...@gmail.com <vu...@gmail.com> #84
he...@gmail.com <he...@gmail.com> #85
To do this, simply edit "/etc/apt/sources.list.d/google-cloud-monitoring.list"
and change the line from
"deb
in
"deb
and then update the package cache with "apt-update".
I could then install the agent with "apt install stackdriver-agent" and start it successfully with "/etc/init.d/stackdriver-agent restart".
I haven't tested the whole thing yet, but the agent starts and data is transferred to Stackdriver Monitoring.
Greetings
VK
ma...@gmail.com <ma...@gmail.com> #86
below example output:
root@dev-15-hz9b:~# cat /etc/apt/sources.list.d/google-cloud-monitoring.list
#deb
# unstable
deb
root@dev-15-hz9b:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
root@dev-15-hz9b:~# apt search stackdriver
Sorting... Done
Full Text Search... Done
stackdriver-agent/google-cloud-monitoring-bionic-unstable 5.5.2-383.bionic amd64
Stackdriver system metrics collection daemon
root@dev-15-hz9b:~# apt-cache policy stackdriver-agent
stackdriver-agent:
Installed: (none)
Candidate: 5.5.2-383.bionic
Version table:
5.5.2-383.bionic 500
500
root@dev-15-hz9b:~#
ia...@gmail.com <ia...@gmail.com> #87
an...@gmail.com <an...@gmail.com> #88
Here's an installation one-liner, which simplifies the above steps:
curl -sS -o -
There still seem to be some quirks though. For example, when I monitor VM disk utilization, I can filter by instance name, but it is displayed as "${metadata.system_labels\.name}" on the chart. So I guess the whole thing is indeed still a beta on bionic and should not be considered production grade.
gr...@gmail.com <gr...@gmail.com> #89
As far as I see, the monitoring-agent is only a re-packaged/re-named collectd using the module write_gcm (has been renamed to write-srackdriver in the offiical source of collectd:
I'm running collectd on most of our on-premise machines, gathering the data in carbon/whisper. It's a pretty straight forward tool.
I should be possible to debug your issue. Where exactly do you try to filter by instance name?
ib...@gmail.com <ib...@gmail.com> #90
so...@gmail.com <so...@gmail.com> #91
Must be something specific to your VM. Me is a Debian 9 Image.
gu...@gmail.com <gu...@gmail.com> #92
There must be some difference between Xenial and Bionic versions. I cannot see much difference in syslog journal for stackdriver-agent.
The charts in staskdriver monitoring look different even with identical set-up.
But the alerting policy reports instance name correctly (which is a good thing!).
The "dodgy" VM with an "unstable" version of stackdriver-agent:
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
# dpkg -s stackdriver-agent
Package: stackdriver-agent
Status: install ok installed
Priority: optional
Section: misc
Installed-Size: 3107
Maintainer: Stackdriver Agents <stackdriver-agents@google.com>
Architecture: amd64
Version: 5.5.2-383.bionic
<..>
The fully working one is:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
$ dpkg -s stackdriver-agent
Package: stackdriver-agent
Status: install ok installed
Priority: optional
Section: misc
Installed-Size: 5628
Maintainer: Stackdriver Agents <stackdriver-agents@google.com>
Architecture: amd64
Version: 5.5.2-382.xenial
<...>
ka...@salesforce.com <ka...@salesforce.com> #93
il...@google.com <il...@google.com> #94
ap...@google.com <ap...@google.com> #95
ap...@google.com <ap...@google.com> #96
ap...@google.com <ap...@google.com> #97
al...@gmail.com <al...@gmail.com> #98
ap...@google.com <ap...@google.com> #99
ap...@google.com <ap...@google.com> #100
ap...@google.com <ap...@google.com> #101
ap...@google.com <ap...@google.com> #102
Branch: androidx-main
commit f54b6d3d78139605391592d689f2f3c5c9e55197
Author: Ian Lake <ilake@google.com>
Date: Thu Feb 25 17:19:43 2021
Add infra for saving/restoring BackStackStates
Each FragmentManager is responsible for tracking
the set of BackStackState objects that have been
saved via saveBackStack() and the associated name.
This state needs to be saved and restored alongside
the rest of the FragmentManager's state to ensure
that the state is available for later restoration
even after one or more configuration changes.
This adds the underlying infrastructure for saving
and restoring the state objects that will later be
populated by saveBackStack().
Test: existing tests that save/restore state still pass
BUG: 80029773
Change-Id: I5776c50143deb4d7679c581a2e7655d5c2655443
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerState.java
di...@gmail.com <di...@gmail.com> #103
je...@gmail.com <je...@gmail.com> #104
[Deleted User] <[Deleted User]> #105
ap...@google.com <ap...@google.com> #106
Branch: androidx-main
commit a7835d060734f7a3dc7acc457c822330ef64d5a2
Author: Ian Lake <ilake@google.com>
Date: Mon Mar 15 16:54:08 2021
Build infrastructure for collapsing transactions
Right before a FragmentTransaction is executed,
operations like replace() and setPrimaryNavigationFragment()
are expanded into multiple operations:
- A replace() becomes one or more remove() operations
plus an add() (unless you specifically call add()
earlier in the transaction...for some reason).
- setPrimaryNavigationFragment() becomes an unset of the
previous primary navigation fragment and then the set
of the new primary navigation fragment
These expanded operations can reference previously
created fragments, despite them not being explicitly
mentioned when building the FragmentTransaction. When
it comes to saving and later restoring these transactions,
we need to collapse the transactions back down into their
original form so that:
1) they don't reference other fragments not being saved
2) they can be re-expanded later onto a new back stack
This CL swaps out the term 'topmost fragment' with
'from expanded op' to better mark which operations
came from one of these expansions. This then allows
us to write the infrastructure and tests to ensure
that a collapse puts the transaction back into
the previous state that will later be used by
saveBackStack().
Test: updated and new BackStackRecordTest tests pass
BUG: 80029773
Change-Id: Iadd95c557b759bd95f07d89cadf62b44d4971956
M fragment/fragment/src/androidTest/java/androidx/fragment/app/BackStackRecordTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackRecord.java
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackRecordState.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransaction.java
su...@gmail.com <su...@gmail.com> #107
I am facing issue with explicit deeplinking, which is not launching the respected screen, Any update on this issue, or any workaround.
[Deleted User] <[Deleted User]> #108
ap...@google.com <ap...@google.com> #109
Branch: androidx-main
commit cac5a59e08bff1fc47a721d112fa5289d3ddf5bc
Author: Ian Lake <ilake@google.com>
Date: Thu Mar 25 17:43:49 2021
Make saveBackStack() actually save the back stack state
The saveBackStack() API is responsible for a number of
things:
1) Popping the saved FragmentTransactions off the back
stack - this was done in previous CLs.
2) Saving the actual FragmentTransactions themselves
so that they can later to restored
3) Save the state of each Fragment included in
those FragmentTransactions
This change seeks to address the core points of #2
and #3. Now, when saveBackStack() is called, all
Fragments will go through onSaveInstanceState(), either
immediately after onStop() (mirroring the behavior of
the activity being torn down due to a configuration
change, etc.) or immediately before onDestroy() (in
cases where the Fragment is already stopped - such as
when it is on the back stack).
The FragmentTransactions themselves are also
collapsed (i.e., replacing the expanded set of
REMOVE+ADD operations with the original REPLACE operation)
and have their state saved, readying them for later
restoration.
Note that this change does *not* handle nonconfig state
(ViewModels). That will be done in a follow up CL.
Test: saveBackStack test passes
BUG: 80029773
Change-Id: I37327ab6a7deab0d72d5be1a251c0d5e3a280362
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveRestoreBackStackTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackRecord.java
M fragment/fragment/src/main/java/androidx/fragment/app/Fragment.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransaction.java
ap...@google.com <ap...@google.com> #110
Branch: androidx-main
commit 5104c7c386ea69551616e8723cb87e5dbd27f6ad
Author: Ian Lake <ilake@google.com>
Date: Mon Mar 29 13:43:30 2021
Add the API to restore a saved back stack
Saving the back stack is only half of the API;
the other half is the ability to later restore
that back stack onto the FragmentManager. This
is the role of the restoreBackStack() API. It
takes a name (the same name passed to
addToBackStack() and then later passed to
saveBackStack()) and re-instantiates all of the
FragmentTransaction and Fragment instances and
re-applies them to the FragmentManager.
Particularly, this builds on the state saving
done by saveBackStack() to ensure that every
fragment that was saved has its saved state
restored when you call restoreBackStack().
The addition of this API did expose some issues
in the previously added code, namely:
- saveBackStack() needs a callback immediately
after the FragmentTransaction pop is executed and
*before* the Fragments are destroyed. This ensures
that the right internal IDs of Fragments are saved
in the BackStackRecordState and means we can't use
the on commit runnables list and need to maintain
our own list.
- As the population of the BackStackRecordState
is asynchronous, BackStackState needs to keep a
reference to the original list created by
saveBackStack() rather than copying the entries
into its own ArrayList.
Relnote: N/A
Test: new tests pass
BUG: 80029773
Change-Id: Ib8c35cea758379374cde7c1253922e345544b3c5
M fragment/fragment/api/current.txt
M fragment/fragment/api/public_plus_experimental_current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveRestoreBackStackTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackRecord.java
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackState.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransaction.java
ap...@google.com <ap...@google.com> #111
Branch: androidx-main
commit 3645a0d738376c0035c2436ba5c53c750fe84d86
Author: Ian Lake <ilake@google.com>
Date: Tue Mar 30 16:02:51 2021
Save ViewModels when saving and restore the back stack
The most important part of calling saveBackStack() is
that the state of the fragments must be saved.
This can be roughly summarized in three parts:
1) The Fragment's saved instance state
2) The Fragment's View state
3) The Fragment's non-config state
The first two are already handled by the previous
changes, but the later one is just as important,
particularly when it comes to immediately showing
cached data. As retained fragments are not
supported when using saveBackStack(), the only
non-config state is that of ViewModels.
Besides just avoiding clearing the ViewModels when
the fragment is destroyed as part of saving the
back stack, special attention was taken to the
case where the Activity / parent Fragment is itself
destroyed. In this case, any ViewModels associated
with saved fragments must be specifically cleared as
they would not automatically be cleaned up on their
own (as their containing fragment no longer exists,
just its saved state).
Test: updated tests pass
BUG: 80029773
Change-Id: Idafc0af58e1a43893774f6ae6d7caac8bd56efb4
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveRestoreBackStackTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManagerViewModel.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentStateManager.java
il...@google.com <il...@google.com> #112
As per saveBackStack(name: String)
and restoreBackStack(name: String)
APIs have been added to FragmentManager
in
With the Fragment work complete, the implementation work on the Navigation side of multiple back stacks is next up - you'll continue to see changes added to this CL as that work continues.
As a reminder, that Navigation work includes:
- The generic Navigation API that will allow any Navigator (be it Fragments, Compose, etc) to support multiple back stacks
- Rework of the existing Navigators to support multiple back stacks out of the box
- The APIs in
NavigationUI
and other surfaces to allow you to easily opt in to using multiple back stacks
Also as mentioned before:
I'd ask that you hold your comments on the intermediate steps along the way as much of it will make more sense when taken as a whole once we release the first alphas (still planned for Fragment 1.4.0-alpha01
and Navigation 2.4.0-alpha01
). Definitely expect a more thorough run through of how to use of these APIs via documentation, samples (including updating the NavigationAdvancedSample
to use the new APIs), blog posts, videos, and everything else at that point and onward. Besides seeing each commit come through on this issue, we'll also make sure to point out when a first snapshot is available with working APIs for those of you who would like an early preview before the first alpha releases.
Again, please keep in mind the many people who get emailed for each comment on this issue - let's continue to keep this as a good channel for updates and not for general discussion or requests for additional progress updates. If you'd like to receive updates, please star the issue, not comment on it.
ap...@google.com <ap...@google.com> #113
Branch: androidx-main
commit b3588b98629d9552c5666a0e3a3984927ba80b0d
Author: Ian Lake <ilake@google.com>
Date: Mon Apr 05 15:51:01 2021
Add NavOptions for saving and restoring the back stack
When navigating with the NavController, the primary
mechanism is via calls to navigate(), which simply
adds the new destination to the back stack. NavOptions
are the existing mechanism for modifying that default
behavior (e.g., using launchSingleTop to ensure only
one copy of the destination is on the top of the
back stack).
Therefore NavOptions is one of the surfaces that needs
to be updated to support multiple back stacks in two ways:
- the restoreState boolean controls whether any previously
saved back stack and destination states associated with
the destination you're navigating to should be restored
- the popUpToSaveState boolean controls whether the back
stack and destination states between the current destination
and your popUpTo destination (inclusive or not) should be
saved for later restoration
Note: these APIs are not currently plugged into the
NavController or Navigators. That will be done in
follow up CLs.
Relnote: N/A
Test: Updated tests pass
BUG: 80029773
Change-Id: I7f4db810f027dd83f34c4906d4d21e73e051b35c
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavOptionsBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptionsBuilder.kt
M navigation/navigation-common/src/main/res-public/values/public_attrs.xml
M navigation/navigation-common/src/main/res/values/attrs.xml
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavInflater.kt
ap...@google.com <ap...@google.com> #114
Branch: androidx-main
commit 17366f6b6a267b39bcf9fab5f3b4b1dec793e748
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Apr 06 17:08:18 2021
Upgrade Navigation to use Activity 1.2.2, ToT Fragments
In preparation for navigation-fragment using the
multiple back stacks APIs added in the latest
version of Fragments, update the dependencies in
Navigation to use the latest stable Activity release
(1.2.2) and the tip-of-tree version of Fragments.
By necessity, this updates usages of deprecated
Fragment APIs (namely, startIntentSenderForResult()
and onActivityResult) to their replacements.
Relnote: "Navigation Runtime now depends on
[Activity `1.2.2`](/jetpack/androidx/releases/activity#1.2.2)."
Test: existing navigation-fragment tests still pass
BUG: 80029773
Change-Id: Iad6bec4af04c4ad748277fe7f99b87c7f5698ec6
M navigation/navigation-dynamic-features-fragment/src/main/java/androidx/navigation/dynamicfeatures/fragment/ui/AbstractProgressFragment.kt
M navigation/navigation-fragment/build.gradle
M navigation/navigation-runtime/build.gradle
ap...@google.com <ap...@google.com> #115
Branch: androidx-main
commit 95261600fd07bdfc22af2cf64c3ef58034192a1d
Author: Ian Lake <ilake@google.com>
Date: Mon Apr 12 13:57:58 2021
Add saveState parameter to popBackStack()
In addition to being able to add the
popUpToSaveState value to NavOptions, it
should also be possible to save state when
manually popping the stack via popBackStack().
Relnote: N/A
Test: ./gradlew checkApi
BUG: 80029773
Change-Id: I5517c9e86cac63266c4742c67415afdc026d8c34
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/public_plus_experimental_current.txt
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #116
Branch: androidx-main
commit bbb3729f948ca4995b15296a40cd9db6353088ee
Author: Ian Lake <ilake@google.com>
Date: Tue Apr 13 11:30:48 2021
Save the NavBackStackEntry state
When using the saveState flag on the pop operation,
all of the state associated with the popped destinations
should be saved. That includes both the saved
instance state (calling saveState() once the destination
is stopped) as well as non-config state in the form of
any ViewModels associated with the destination.
This involves associating that saved state with
the ID of the destination you've popped up to
as well as ensuring that ViewModels are not cleared
as part of the pop (but are still cleared when the
hosting ViewModelStore is cleared).
Relnote: N/A
Test: new NavBackStackEntryTest tests pass
BUG: 80029773
Change-Id: Ia5a35ec712cf5a58c3c310999bacb3c87e8cc522
M navigation/navigation-runtime/api/public_plus_experimental_current.txt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntryState.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #117
Branch: androidx-main
commit fde7cd4bf112f37061e036cfdd8c44c3af98ee77
Author: Ian Lake <ilake@google.com>
Date: Wed Apr 21 15:31:38 2021
Decouple NavBackStackEntry from NavControllerViewModel
Rather than having a compile time dependency
on the concrete NavControllerViewModel class
in NavBackStackEntry, create a new interface
that NavBackStackEntry can depend on.
Test: NavBackStackEntry tests still pass
BUG: 80029773
Change-Id: I4345c5d93359b8f0d0c21d68c12912f3ea16112b
M navigation/navigation-common/build.gradle
A navigation/navigation-common/src/main/java/androidx/navigation/NavViewModelStoreProvider.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntry.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavControllerViewModel.kt
ap...@google.com <ap...@google.com> #118
Branch: androidx-main
commit f57cd370acf055e004eb4bfb1e95904624a83dca
Author: Ian Lake <ilake@google.com>
Date: Wed Apr 21 15:52:15 2021
Move NavBackStackEntry to navigation-common
Move NavBackStackEntry to live in the same
artifact as Navigator.
Relnote: N/A
Test: existing tests still pass
BUG: 80029773
Change-Id: I84167184c3356e0c27cd61ae191e5ea995d40d26
M navigation/navigation-common/api/api_lint.ignore
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/build.gradle
M navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
A navigation/navigation-runtime/api/current.ignore
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/public_plus_experimental_current.txt
A navigation/navigation-runtime/api/restricted_current.ignore
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/build.gradle
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntryState.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #119
Branch: androidx-main
commit 4ab8db7d2ca746a38bdde67e3ef495e83ddb0aa5
Author: Ian Lake <ilake@google.com>
Date: Fri Apr 23 14:25:17 2021
Build connection between NavController and Navigator state
Introduce the NavigatorState class. This state is owned
by the NavController, but is specifically set at the
Navigator level. Besides giving the Navigator read access
to the set of destinations on its own back stack, it
also encapsulates the add and pop operations in such
a way as to allow the Navigator to push changes back
to the NavController.
To allow for testing of a Navigator independently
of a NavController, a TestNavigatorState, provides
an alternate implementation specifically for testing
purposes.
Relnote: N/A
Test: updated and existing tests pass
BUG: 80029773
Change-Id: Id2afe4c8d428894826d0391173a162cf8c977328
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
M navigation/navigation-common/src/main/java/androidx/navigation/Navigator.kt
A navigation/navigation-common/src/main/java/androidx/navigation/NavigatorState.kt
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/BaseNavControllerTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigator.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M navigation/navigation-testing/api/current.txt
M navigation/navigation-testing/api/public_plus_experimental_current.txt
M navigation/navigation-testing/api/restricted_current.txt
M navigation/navigation-testing/build.gradle
A navigation/navigation-testing/src/main/java/androidx/navigation/testing/TestNavigatorState.kt
M testutils/testutils-navigation/build.gradle
M testutils/testutils-navigation/src/main/java/androidx/testutils/TestNavigator.kt
M testutils/testutils-navigation/src/test/java/androidx/testutils/TestNavigatorTest.kt
ap...@google.com <ap...@google.com> #120
Branch: androidx-main
commit ff14ae5dd8a1767597622e9d2c5deb27078b8a01
Author: Ian Lake <ilake@google.com>
Date: Thu Apr 22 13:12:35 2021
Add attach API to Navigators
Rather than doing initialization in the
Navigator's init, give Navigators an initial
callback on when the NavController has started
using the Navigator.
This also changes the behavior such that replacing
a Navigator after the NavController has restored
its state results in an error.
Relnote: N/A
Test: existing tests pass
BUG: 80029773
Change-Id: I2f2b8aac0541d4e084cb4b53175b6a0195a4cc59
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/Navigator.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavigatorProvider.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/DialogFragmentNavigator.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #121
Branch: androidx-main
commit 5c911ea7cbe26bff5091a2d0b2f9b126678eb04b
Author: Ian Lake <ilake@google.com>
Date: Mon Apr 26 17:04:31 2021
Introduce multiple back stack compatible Navigator APIs
The current Navigator APIs operated on a single
destination at a time, which made it impossible to
coordinate a set of navigate() calls or a popBackStack()
that would pop multiple destinations at once - both
of which are required to fully support the saving
and restoring of state needed to support
multiple back stacks.
In addition to supporting batch operations, these
new Navigator APIs give the Navigator direct access
to the NavBackStackEntry instance that is being
navigated to. This allows the new APIs to be
backward compatible - translating calls to the new
APIs back into the old API internally while still
allowing a Navigator to fully switch over to the
new APIs (and just not call the superclass
implementation).
The NavController was fully rebuilt to only call
the new APIs while continuing to work with
existing Navigator implementations without any
changes. The previous temporary solution required
for TestNavigator (calling the NavigatorState APIs
from the old navigate/popBackStack() methods) was
removed entirely as the default implementations
correctly update the NavigatorState.
Relnote: N/A
BUG: 80029773
Test: existing tests for all Navigators pass
Change-Id: Ia1ff09a4b76f15a35d6a9c520687033d6f1565a7
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/Navigator.kt
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/public_plus_experimental_current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-dynamic-features-runtime/api/current.ignore
M navigation/navigation-dynamic-features-runtime/api/current.txt
M navigation/navigation-dynamic-features-runtime/api/public_plus_experimental_current.txt
M navigation/navigation-dynamic-features-runtime/api/restricted_current.ignore
M navigation/navigation-dynamic-features-runtime/api/restricted_current.txt
M navigation/navigation-fragment/api/current.ignore
M navigation/navigation-fragment/api/current.txt
M navigation/navigation-fragment/api/public_plus_experimental_current.txt
M navigation/navigation-fragment/api/restricted_current.ignore
M navigation/navigation-fragment/api/restricted_current.txt
M navigation/navigation-runtime/api/current.ignore
M navigation/navigation-runtime/api/current.txt
M navigation/navigation-runtime/api/public_plus_experimental_current.txt
M navigation/navigation-runtime/api/restricted_current.ignore
M navigation/navigation-runtime/api/restricted_current.txt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M navigation/navigation-testing/src/main/java/androidx/navigation/testing/TestNavigatorProvider.kt
M testutils/testutils-navigation/src/main/java/androidx/testutils/TestNavigator.kt
M testutils/testutils-navigation/src/test/java/androidx/testutils/TestNavigatorTest.kt
ap...@google.com <ap...@google.com> #122
Branch: androidx-main
commit cf47135438d553629daa94c42f3d37502eb2fba7
Author: Ian Lake <ilake@google.com>
Date: Tue Apr 27 17:50:04 2021
Convert ComposeNavigator+NavHost to new Navigator APIs
Utilize the new Navigator APIs and specifically
the NavigatorState within ComposeNavigator and
NavHost. This ensures a single source of truth from
the NavController to the NavigatorState to the
NavHost.
Due to the use of DisposableEffect, the NavHost
composes at least once before the graph is set
(and therefore before the NavigatorState is available).
This logic is encapsulated within ComposeNavigator
such that the NavHost can always assume the
back stack is available.
The ComposeNavigatorTest suite was redone to
focus on the logic that ComposeNavigator now contains
around the back stack, thus avoiding duplicating the
logic already tested in the base NavController and
Navigator tests.
Relnote: N/A
BUG: 80029773
Test: updated ComposeNavigatorTest tests pass
Change-Id: I0698d2a5e0e7bf8379bab8636f54882d33a464b3
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/public_plus_experimental_current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/ComposeNavigatorTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/ComposeNavigator.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
ap...@google.com <ap...@google.com> #123
Branch: androidx-main
commit 6bd5c055e363ec648db8e1c9afa781935d6542ae
Author: Ian Lake <ilake@google.com>
Date: Thu Apr 29 15:17:37 2021
Add support for restoring state
Hook up the restoreState to calls to navigate(),
allowing the NavBackStackEntry state to be restored
back to the state it was originally saved in.
This means that even if the underlying Navigator
does not participate in saving state, the
NavController will still navigate() to the same set
of destinations with the same NavBackStackEntry state
when the saveState/restoreState APIs are used.
BUG: 80029773
Test: New NavControllerTest tests pass
Change-Id: I4b69f189314e6edc998391c29c35ab1c4d35fa2c
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #124
Branch: androidx-main
commit b4edb9532c81542cdc62fb384d9bfb06bfcb73e0
Author: Ian Lake <ilake@google.com>
Date: Mon May 03 16:40:01 2021
Fix popUpTo+restoreState when inclusive=false
In cases where you use popUpTo and inclusive=false,
the back stack state needs to be associated not only
with the destination you've directly passed to
popUpTo, but also with the destination that was
actually popped.
In addition, this state also needs to be associated
with the parents of those destinations specifically
when the destination is the start destination of the
graph so that navigating to the graph itself is
treated the same as navigating to the start destination
when it comes to restoring state.
E.g., let's say you have three nested graphs: A, B, and C,
each with a respective start destination of A', B', and
C'. As per the Principles of Navigation, you should
always keep the start destination of your graph (A') on
the back stack. Therefore, the much more common case
is to use popUpTo(A') with inclusive=false when navigating
to B or C (or back to A). By adjusting the logic around
saving the state, navigating from B to C will save the
state of B to B, even though the popUpTo was set to A'.
Similarly, the state of A' (and notably, any destinations
stacked on top of it) will be restored when you navigate
to A with restoreState=true.
With this change, the BottomBarNavDemo for Navigation Compose
was updated to use the new restoreState and saveState flags
and now the state of the Scrollable destination is properly
saved and restored when you swap between the Scrollable
and Dashboard tabs by tapping on the bottom nav.
BUG: 80029773
Test: new NavControllerTest tests passes
Change-Id: I4ce337d269fe0db5ee424d5f47e64868c5a1a3a9
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #125
Branch: androidx-main
commit ff325dad7ef332217b2cb9ae1428d24bb10fbc3b
Author: Ian Lake <ilake@google.com>
Date: Wed May 05 14:55:58 2021
Ensure TestNavigatorState updates the Lifecycle correctly
The TestNavigatorState serves the role of
"NavController" when building isolated tests
for a Navigator. As such, it owns the logic for
updating and maintaining the state of each
NavBackStackEntry added to it.
As such, the TestNavigatorState now updates
the Lifecycle of each NavBackStackEntry
as it is added and popped from the state's
back stack, mirroring the behavior of
NavController.
Relnote: N/A
Test: new TestNavigatorStateTest
BUG: 80029773
Change-Id: I92b09989a7d9bc63d52747eef40f04d75a43cc0d
M navigation/navigation-testing/api/current.txt
M navigation/navigation-testing/api/public_plus_experimental_current.txt
M navigation/navigation-testing/api/restricted_current.txt
A navigation/navigation-testing/src/androidTest/java/androidx/navigation/testing/TestNavigatorStateTest.kt
M navigation/navigation-testing/src/main/java/androidx/navigation/testing/TestNavigatorState.kt
M testutils/testutils-navigation/build.gradle
M testutils/testutils-navigation/src/test/java/androidx/testutils/TestNavigatorTest.kt
ap...@google.com <ap...@google.com> #126
Branch: androidx-main
commit ce44b5214ef9ce0a2b478298554c98854d27f1b6
Author: Ian Lake <ilake@google.com>
Date: Thu May 06 15:04:48 2021
Make NavBackStackEntry's ID public
Rather than rely on each Navigator to
construct its own idea of a unique
key for a NavBackStackEntry (e.g., using
its position in the back stack or the
destination ID), we'd like to encourage
using the unique ID of the NavBackStackEntry.
Relnote: "The unique ID of a `NavBackStackEntry`
is now exposed as part of its public API."
Test: ./gradlew checkApi
BUG: 80029773
Change-Id: Ie033a9056cead23ef9bcff1c52e67172c459b0f2
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/main/java/androidx/navigation/NavBackStackEntry.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavViewModelStoreProvider.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerViewModelTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavBackStackEntryState.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavControllerViewModel.kt
M navigation/navigation-testing/src/main/java/androidx/navigation/testing/TestNavigatorState.kt
ap...@google.com <ap...@google.com> #127
Branch: androidx-main
commit 4485a5102b93d0551db020bdbf1f78baa6b47b3b
Author: Ian Lake <ilake@google.com>
Date: Thu May 06 21:55:58 2021
Convert FragmentNavigator to Navigator v2 APIs
Convert FragmentNavigator and its subclass,
DynamicFragmentNavigator, to the Navigator v2 APIs.
Relnote: N/A
BUG: 80029773
Test: updated tests pass
Change-Id: I983269785ad2b5c9e74bd6b52cfee5d5698b0fa4
M navigation/navigation-dynamic-features-fragment/src/main/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigator.kt
M navigation/navigation-fragment/api/current.ignore
M navigation/navigation-fragment/api/current.txt
M navigation/navigation-fragment/api/public_plus_experimental_current.txt
M navigation/navigation-fragment/api/restricted_current.ignore
M navigation/navigation-fragment/api/restricted_current.txt
M navigation/navigation-fragment/build.gradle
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.kt
ap...@google.com <ap...@google.com> #128
Branch: androidx-main
commit d4f6ac6d46cec08ee9a11b44955da4c69ec6aec3
Author: Ian Lake <ilake@google.com>
Date: Thu May 06 16:51:03 2021
Convert NavGraphNavigator to Navigator v2 APIs
Convert NavGraphNavigator and its subclass,
DynamicGraphNavigator, to the Navigation v2 APIs.
Relnote: N/A
BUG: 80029773
Test: updated tests pass
Change-Id: I735b94efb92a0275c931af30c4a669be388f9186
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/build.gradle
M navigation/navigation-common/src/main/java/androidx/navigation/NavGraphNavigator.kt
M navigation/navigation-common/src/test/java/androidx/navigation/NavGraphNavigatorTest.kt
M navigation/navigation-dynamic-features-runtime/build.gradle
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicGraphNavigator.kt
M navigation/navigation-dynamic-features-runtime/src/main/java/androidx/navigation/dynamicfeatures/DynamicInstallManager.kt
M navigation/navigation-dynamic-features-runtime/src/test/java/androidx/navigation/dynamicfeatures/DynamicNavGraphTest.kt
ap...@google.com <ap...@google.com> #129
Branch: androidx-main
commit 5236d8017f82fcf8f193f7ab1bced55d485508e5
Author: Ian Lake <ilake@google.com>
Date: Fri May 07 11:43:37 2021
Connect Navigation and FragmentManager's state save/restore
Update FragmentNavigator to correctly save and restore
the Fragment's state when the NavController uses the
restoreState and saveState APIs.
To enable testing the save/restore separately from
NavController, this added a new restoreBackStackEntry()
API to TestNavigatorState.
Relnote: N/A
Test: new FragmentNavigatorTest tests pass
BUG: 80029773
Change-Id: I4ac261ab2195e276c93ffd63152fe2bcefa3651a
M navigation/navigation-fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.kt
M navigation/navigation-testing/api/current.txt
M navigation/navigation-testing/api/public_plus_experimental_current.txt
M navigation/navigation-testing/api/restricted_current.txt
M navigation/navigation-testing/src/main/java/androidx/navigation/testing/TestNavigatorState.kt
ap...@google.com <ap...@google.com> #130
Branch: androidx-main
commit 19cf489673a84b939bc676ba247d983f07c9959a
Author: Ian Lake <ilake@google.com>
Date: Sun May 09 15:39:23 2021
Add restoreBackStack records to the back stack
Delegate to BackStackRecord's generateOps call
in restoreBackStackState() to ensure that
restoreBackStack() results in the exact same
behavior as manually executing each
FragmentTransactions.
Importantly, this ensures that each record
is added to the FragmentManager's back stack.
Test: updated SaveRestoreBackStackTest tests pass
BUG: 80029773
Change-Id: I9f2484c9244f4cca20745623184c695ca842d3d7
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveRestoreBackStackTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
bo...@gmail.com <bo...@gmail.com> #131
A question: with all due respect, are these automatic comments really necessary or useful? I'd like to keep my "star" on this issue, and know when it will be fixed. But the noise doesn't help. Thanks a lot!
il...@google.com <il...@google.com> #132
Re #131 - yes, they are necessary. As stated multiple times and seen in the hotlists this bug is associated with, this will be fixed with Fragment 1.4.0-alpha01 and Navigation 2.4.0-alpha01, so if you're looking for only an update on when those are released and not for updates on the progress leading up to that point, you can use the
ap...@google.com <ap...@google.com> #133
Branch: androidx-main
commit 98e0bfd1a040eb1f9f0755f0152a5f30195ea3df
Author: Ian Lake <ilake@google.com>
Date: Sun May 09 16:35:27 2021
Fix restoreBackStack() when saveBackStack() is pending
Any FragmentTransaction happens as separate stages:
1) Generate the set of transactions that need to be applied
2) Execute the transactions
3) Move the Fragments to their expected state
When calling saveBackStack() followed by restoreBackStack()
without any intervening time or specifically calls to
executePendingTransactions(), step 1 is applied to both
the saveBackStack() and restoreBackStack() commands without
step 2 and 3 actually being executed yet.
This means that saveBackStack() needs to capture enough
state while executing step 1 such that the
restoreBackStack() has enough information to generate
the proper set of FragmentTransactions. As such, the
previous approach of using an "execute runnable"
(which would only run in step 2) is not sufficient.
Instead, saveBackStack() now creates a deep copy of
the full BackStackRecord and immediately saves its
state as part of step 1, thus ensuring that it is already
available when step 1 for restoreBackStack() is available.
On the flip side, because step 2 and 3 haven't been
executed yet when restoreBackStack()'s step 1 executes,
the Fragments that would not have had their state saved
and been destroyed, meaning that BackStackState must
now consider the case where the Fragment still exists
prior to trying to find the saved state of the previously
destroyed fragment.
Test: new SaveRestoreBackStackTest test passes
BUG: 80029773
Change-Id: I147cc168d712d49f7533f51e56776506b3c7698c
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SaveRestoreBackStackTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackRecord.java
M fragment/fragment/src/main/java/androidx/fragment/app/BackStackState.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentManager.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransaction.java
ap...@google.com <ap...@google.com> #134
Branch: androidx-main
commit 62c022f23c6bcd52fa94150eba8ef3e6c09e742b
Author: Ian Lake <ilake@google.com>
Date: Sun May 09 16:49:28 2021
Enable saving state in NavigationUI by default
Ensure that any usages of NavigationUI's
onNavDestinationSelected() API or APIs that
use it internally (such as the
setupWithNavController() methods for
NavigationView and BottomNavigationView)
use the popUpTo API with saveState = true
and setRestoreState(true) to ensure that
any popped destinations have their state saved
and restored when you navigate back to that
destination (either via selecting the
same menu item again or manually using the
setRestoreState(true) API.
This means that BottomNavigationView and
NavigationView users will automatically get
multiple back stack support just by using
NavigationUI and upgrading their version
of Navigation to one that supports multiple
back stacks.
Relnote: "The `NavigationUI` methods of
`onNavDestinationSelected()`,
`BottomNavigationView.setupWithNavController()` and
`NavigationView.setupWithNavController()` now
automatically save and restore the state of
popped destinations, enabling automatic support
for multiple back stacks."
Test: tested in navigation-integration-tests testapp
BUG: 80029773
Change-Id: Ie07ca3089faca25e56e58293b49f32b795e1f30a
M navigation/navigation-ui/src/main/java/androidx/navigation/ui/NavigationUI.kt
ap...@google.com <ap...@google.com> #135
Branch: androidx-main
commit a55cf6688ef4c844adb5718331d367a8ceceefe6
Author: Ian Lake <ilake@google.com>
Date: Mon May 10 13:12:16 2021
Re-enable launchSingleTop in BottomBarNavDemo
When returning to the first item, we still
only want one instance - this is the exact
use case for launchSingleTop.
Test: manual testing of the demo app
BUG: 80029773
Change-Id: If71dfec3986c70e064c28535944118a93c5f7974
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
il...@google.com <il...@google.com> #136
With these last changes and snapshot build #7351514, we've completed all of the required changes to support multiple back stacks in:
-
Fragments (i.e., without using the Navigation Component at all): this is an opt in change by using the new FragmentManager APIs of
saveBackStack
andrestoreBackStack
. -
The core Navigation Runtime: adds opt-in new
NavOptions
methods forrestoreState
andsaveState
and a new overload ofpopBackStack()
that also accepts asaveState
boolean (defaults to false). -
Navigation with Fragments: the
FragmentNavigator
now utilizes the newNavigator
APIs to properly translate the Navigation Runtime APIs into the Fragment APIs by using the Navigation Runtime APIs. -
NavigationUI
: TheonNavDestinationSelected()
,BottomNavigationView.setupWithNavController()
andNavigationView.setupWithNavController()
now use the newrestoreState
andsaveState
NavOptions
by default whenever they would pop the back stack. This means that every app using thoseNavigationUI
APIs will get multiple back stacks without any code changes on their part after upgrading the Navigation 2.4.0-alpha01. -
Navigation Compose:
NavHost
and theComposeNavigator
have also been updated to support saving and restoring the state by using the Navigation Runtime APIs. An example of using therestoreState
+saveState
APIs with a bottom nav can be seen in the .BottomBarNavDemo
All of these changes will be available in the upcoming Fragment 1.4.0-alpha01 and Navigation 2.4.0-alpha01 releases. (Note that Navigation Compose versioning has been merged into the rest of Navigation as per
That being said:
- there's a lot more documentation and samples that need to be updated. We'll be tackling as much of this as possible between now and the alpha01 release.
- As you may have seen, there's been a huge number of changes needed to make this happen across all levels. As such, please file separate bugs as you discover any edge cases that we need to handle and we'll make sure those changes are addressed in an alpha02 release.
I'd like to thank you for your patience and respectfulness in not spamming this issue with comments.
al...@gmail.com <al...@gmail.com> #137
so...@gmail.com <so...@gmail.com> #138
em...@gmail.com <em...@gmail.com> #139
ga...@gmail.com <ga...@gmail.com> #140
sh...@gmail.com <sh...@gmail.com> #141
ar...@gmail.com <ar...@gmail.com> #142
bo...@gmail.com <bo...@gmail.com> #143
to...@appsfactory.de <to...@appsfactory.de> #144
mi...@gmail.com <mi...@gmail.com> #145
With the new version, how can I navigate to the destination in another graph? Let's say, I would want to navigate from Title to UserProfile screen in the NavigationAdvancedSample app.
Calling navigate() throws an exception "Navigation action/destination xx cannot be found from the current destination". Is it supported by 2.4.0-alpha01 release?
th...@gmail.com <th...@gmail.com> #146
il...@gmail.com <il...@gmail.com> #147
I'm also facing a couple of new issues. The first one is related to a transition crash:
java.lang.IndexOutOfBoundsException: Index: 10, Size: 10
at java.util.ArrayList.get(ArrayList.java:437)
at androidx.fragment.app.FragmentTransitionImpl.setNameOverridesReordered(FragmentTransitionImpl.java:182)
at androidx.fragment.app.DefaultSpecialEffectsController.startTransitions(DefaultSpecialEffectsController.java:665)
at androidx.fragment.app.DefaultSpecialEffectsController.executeOperations(DefaultSpecialEffectsController.java:114)
at androidx.fragment.app.SpecialEffectsController.executePendingOperations(SpecialEffectsController.java:294)
at androidx.fragment.app.Fragment$3.run(Fragment.java:2760)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
MaterialContainerTransform
is used here.
And the second one is related to a significant performance drop. It seems like the app is almost freezing for a fraction of a second on the bottom navigation stacks swap.
br...@gmail.com <br...@gmail.com> #148
java.lang.IllegalArgumentException:
at androidx.fragment.app.FragmentManager.saveBackStackState (FragmentManager.java:2052)
at androidx.fragment.app.FragmentManager$SaveBackStackState.generateOps (FragmentManager.java:3172)
at androidx.fragment.app.FragmentManager.generateOpsForPendingActions (FragmentManager.java:1953)
at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1643)
at androidx.fragment.app.FragmentManager$4.run (FragmentManager.java:480)
at android.os.Handler.handleCallback (Handler.java:883)
at android.os.Handler.dispatchMessage (Handler.java:100)
at android.os.Looper.loop (Looper.java:241)
at android.app.ActivityThread.main (ActivityThread.java:7617)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:941)
I appreciate the work you guys are putting on this, thanks ;)
il...@google.com <il...@google.com> #149
Please always file a new issue instead of commenting on already marked as Fixed bugs.
mi...@iotashome.com <mi...@iotashome.com> #150
il...@google.com <il...@google.com> #151
Re #150 - no, please always file a new issue. That way each issue can be triaged separately for the appropriate release and deduped against one another.
dh...@bacancy.com <dh...@bacancy.com> #152
lk...@gmail.com <lk...@gmail.com> #153
ph...@gmail.com <ph...@gmail.com> #154
sa...@google.com <sa...@google.com> #155
Re #154: Please file a separate issue so we can more appropriately track your issue.
ph...@gmail.com <ph...@gmail.com> #156
am...@gmail.com <am...@gmail.com> #157
What if I don't want to use popUpTo() and want to keep my bottomNavBar stack growing?
Is it too crazy to ask for a backstack in each destination? - The destination itself will have its own backstack without the need to save/restore. Soon as the destination is visible/active it will query its internal Backstack and present the proper child screen it host. That will make a lot easier to design Apps like Instagram, which is probably the reason why many of us are here.
Description
- scroll position should be maintained between tabs
- pressing the tab again should reset its' backstack and scroll
- pressing back should go back in the current tab's backstack and then exit the app (it should not switch between tabs)
- each tab should have it's own backstack
(I am not sure which parts of this are already implemented, but the scroll/backstack support isn't there)."