Make "personal+work" conditions explicit

Historically sometimes we assume that "having tabs" means we have
these two particular tabs, or that the "inactive tab" is the work
profile when the personal profile is "active" and vice versa. These
assumptions won't hold in the future, so this CL switches such uses
to refer explicitly to the personal/work configuration they were
built for. There are no behavior changes included in this CL.

These changes are as prototyped in ag/25335069 and described in
go/chooser-ntab-refactoring, in particular the changes from "snapshot
10" to "snapshot 15" (skipping #14 which will depend on some other
changes in the series). See below for a "by-snapshot" breakdown of
the incremental changes composed in this CL.

Snapshot 1:
Switch "mini-resolver" to use explicit personal/work configurations.
The legacy `ResolverActivityTest.testMiniResolver` covers the basic
use case (e.g. failing if `shouldUseMiniResolver()` switches up which
tab is considered "active" vs. "inactive").

Snapshot 2:
Move remaining cross-profile autolaunch conditions over as guard
clauses in `maybeAutolaunchIfCrossProfileSupported()`. Now
that we have more explicit requirements about *which* profiles we're
 talking about, it's easier to refer to them all in one place -- the
other partitioning was going to get a little clumsy. This change is
minimally tested, e.g. having the cross-profile "maybe autolaunch"
method always return true (->autolaunch) causes test failures in both
IntentResolver-tests-activity and the legacy ResolverActivityTests.

Snapshot 3:
Specify that cross-profile autolaunch only applies in the specific
"two-tab personal-and-work profiles" case. This doesn't change any
behavior for now, but makes it easy to adjust the legacy logic from
"active and inactive" tabs to "work and personal" tabs (in the next
snapshot). As in the previous snapshot this is minimally covered in
tests; in particular, inverting the "two-page configuration" condition
from this CL causes `ResolverActivityTest` to fail.

Snapshot 4:
Implement cross-profile autolaunch explicitly in terms of "personal"
and "work" tabs, so we don't have to refer to an "inactive tab."

Snapshot 5:
Fix a few places where `ResolverActivity` was relying on the
`shouldShowTabs()` condition when it really explicitly meant to refer
to (i.e. inline) the `hasWorkProfile()` check.

Bug: 310211468
Test: `ResolverActivityTest` & IntentResolver activity tests. Notes ^
Change-Id: I95e383e2822917198425acf9ba8bfbea76fdf948
2 files changed
tree: 7edfc23366f90cdca5852209a6ac207b7de884a4
  1. aconfig/
  2. java/
  3. tests/
  4. Android.bp
  5. AndroidManifest-app.xml
  6. AndroidManifest-lib.xml
  7. OWNERS
  8. PREUPLOAD.cfg
  9. proguard.flags
  10. README.md
  11. TEST_MAPPING
README.md

IntentResolver

About

IntentResolver provides the implementation for Intent ACTION_CHOOSER

See also: ShareCompat.IntentBuilder