Skip to content

Update baseline profile with DeckPicker onResume journey#8

Closed
Galal-20 wants to merge 87 commits into
criticalAY:baseline-profilesfrom
Galal-20:Baseline-Profile-Add-a-test
Closed

Update baseline profile with DeckPicker onResume journey#8
Galal-20 wants to merge 87 commits into
criticalAY:baseline-profilesfrom
Galal-20:Baseline-Profile-Add-a-test

Conversation

@Galal-20

Copy link
Copy Markdown

Purpose / Description

Add a baseline profile test to ensure that DeckPicker.onResume() is executed and captured during profile generation.

Fixes

Approach

  • Added a new test confirmOnResumeIsCalled

  • The test performs:

    • App launch
    • Navigates from DeckPicker to PreferencesActivity via the navigation drawer
    • Returns back to DeckPicker using back navigation
  • This guarantees that DeckPicker.onResume() is triggered during the baseline profile collection

  • Verified that the method is included in the generated baseline profile: SPLcom/ichi2/anki/DeckPicker;->onResume()V

How Has This Been Tested?

Steps:

  1. Run: ./gradlew :AnkiDroid:generateBaselineProfile
  2. Launch on a physical device (API 28+)
  3. Observe the test flow:
  • App launch
  • (Optional) Dismiss introduction screen
  • Open navigation drawer → Settings
  • Press back → return to DeckPicker
  1. Check generated file: AnkiDroid/src/main/generated/baselineProfiles/baseline-prof.txt

Result:

  • Confirmed that DeckPicker.onResume() is present in the baseline profile:
    SPLcom/ichi2/anki/DeckPicker;->onResume()V
  • Successfully added 1,190 new rules to the profile (an increase of ~7.6%).
  • Verified that the navigation flow works correctly without flakiness.

Test Environment:

  • Device: Pixel 9 Pro
  • API Level: 28+

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title.
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the [Google Accessibility Scanner]

david-allison and others added 24 commits April 18, 2026 09:00
Since the configuration cache was enabled in
6a87b7d, the CodeQL job has regularly
OOMed.

CodeQL appears to run its own JVM, stopping the Gradle daemon should
free ~3 GB for CodeQL with no downside.

Fixes 20768

Assisted-by: Claude Opus 4.7 (investigation)
Both the 'Right Click Context Menu' and the 'Long press context menu'
 shared the same output shape and type, so combine them

A data class is used to consolidate the result bundle processing

Assisted-by: Claude Opus 4.6
Extract the logic from the DeckPicker - the menus should be responsible
 for querying their required data

suspend factory methods are a better abstraction

`bundleOf()` will be deprecated, so remove a few instances

`withCol { decks.select(deckId) }` remains as this is a Deck Picker
concern - this shows the visual change of the deck when long-pressed

Assisted-by: Claude Opus 4.6
* remove unnecessary state
* define 'show' which handles DeckPicker specific logic

more verbose, but easier to understand

Assisted-by: Claude Opus 4.6
On API 32 and earlier, AppCompatDelegate.setApplicationLocales
 only works with AppCompatActivity.

Work around this by manually setting the app locale

Fixes 19048

Assisted-by: Claude Opus 4.6 - withAppLocale + investigation
On API 32 and earlier, AppCompatDelegate.setApplicationLocales
only works with AppCompatActivity.

Work around this by manually setting the app locale

Issue 19048

Assisted-by: Claude Opus 4.6 - most of the refactoring
`setup-gradle@v6` now hard-errors when it can't find files to build a
hash key.

Previously it had nothing to hash, now it hashes the selected PR

Fixes 20779

Assisted-by: Claude Opus 4.7 - diagnostics
Changes the method to accept a file instead of a collection object.
Obtaining the collection object requires opening the database, which
will propagate an exception if the collection file is indeed corrupt,
preventing the repair from executing.
Co-authored-by: ShaanNarendran <shaannaren06@gmail.com>
* Move 'SortType' to 'LegacySortType'
* Define and test the new 'SortType'

Prep for issue 17732
- onOptionsItemSelected(R.id.action_sync) : collapse toolbarSearchItem before starting the sync. That fires onMenuItemActionCollapse -> showFloatingActionButton(), so the FAB is back by the time the sync result snackbar appears.

- onMenuItemActionExpand: after hideFloatingActionButton(), null out activeSnackBar?.anchorView so a live snackbar drops to sit above the keyboard instead of hovering where the FAB used to be.

- onMenuItemActionCollapse: after showFloatingActionButton(), re-anchor activeSnackBar?.anchorView to fabMain so it sits above the FAB instead of being overlapped by it.
- unit test for profile guard

Assisted-by: Gemini 3.1 Pro
- Unit test: ProfileSwitchGuardTest
Refine card field docs and tests

test: fix nullable cursor handling in provider tests

docs: refine card field KDoc in FlashCardsContract

docs: clarify FlashCardsContract.Card.TYPE KDoc
- test: unit test for renaming method
david-allison and others added 24 commits April 19, 2026 19:48
This one has caused me multiple issues in the past

Assisted-by: Claude Opus 4.6
* Based on tags.tree()
* Delete/clear unused/rename are supported
* Collapsed/expanded state is synced with the collection
* A 'TagName' abstraction acts as a guardrail against logging tag names
* Introduces a Compose-style 'Channel' for UI state notifications

Part of issue 10397

Assisted-by: Claude Opus 4.6
  Almost entirely written by Claude, with hours of
  back-and-forth over design
  I drove the ideas, Claude wrote the code
`:common` will be moved to a `java-library`. SLF4J is bridged to Timber
via slf4j-timber in the app, so logs will continue to work.

Due to this, fewer classes will need to move to `:common:android`

Using 1.7.30 as this is the current transitive dependency

Assisted-by: Claude Opus 4.6
It's better to remove the opt-in flag, rather than add the library
We want to move Android dependencies to ':common:android', these files
 can remain in a `jvm-library` if we fixup a few annotations

Related to https://redirect.github.com/ankidroid/Anki-Android-Backend/issues/674
In preparation for moving libanki to be pure JVM, we need :common to be
a java-library.

JSON is supported by both android and JVM (with slightly differing apis
so it can remain in `:common`

Assisted-by: Claude Opus 4.6

Related to https://redirect.github.com/ankidroid/Anki-Android-Backend/issues/674
`com.ichi2.anki.utils.android` should be
`com.ichi2.anki.common.utils.android`
Otherwise it's easy to forget to add it to androidModulesToUnitTest

Assisted-by: Claude Opus 4.6 - tests
For now, this only shows the status, not the checks

* Adds a menu item on reminders to open troubleshooting
* Display the overall status of checks

Influenced by Google 'Battery Health'

Assisted-by: Claude Opus 4.6
Allow a user to tap a troubleshooting issue and open an appropriate
screen to fix the issue

Assisted-by: Claude Opus 4.6
Extract CrashReportService.initialize() and isProperServiceProcess()
into top-level functions.
As we move towards a multi-module architecture, feature modules need
crash reporting without depending on the app module. Without this,
each feature module would need its own bridge interface (e.g.
WidgetCrashReporter, BrowserCrashReporter) duplicating the same
pattern everywhere.

This does use android dependencies though and those don't seem
removable, so it gets the android-capable sub-module of common
Move CrashReportService from com.ichi2.anki to
com.ichi2.anki.common.crashreporting and update imports.

Assisted-by: Claude Opus 4 (1M context)
Users must now explicitly opt in to analytics rather than having
consent pre-checked. Aligns the dialog default with an opt-in
(rather than opt-out) consent model.
Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
Code from 1a3effd

Related to issue 1862
Fixes 20529
If an old intent for a review reminder notification somehow sticks around after a schema migration update, the ReviewReminder stored in the intent will become out of date. While we could implement custom logic to migrate that reminder, that would duplicate the logic for schema migrations currently present in ReviewRemindersDatabase. It's simpler to just fallback on that already-existing logic by triggering a total review reminder schedule and returning early. Hence, this code change.
A bit of an embarrassing bug.
Fixes bug in DeckPicker:
open toolbar SearchView -> FAB is hidden -> long click deck ->
delete deck -> Info SnackBar appears, SearchView is closed, FAB is still missing

Deleting the deck would refresh the menu so the SearchView gets
rebuilt and its listeners(which handle the FAB) would not get triggered.

The fix sets the the FAB as visible when the delete deck handler is hit, just
before the SnackBar is requested.
@Galal-20

Galal-20 commented Apr 21, 2026

Copy link
Copy Markdown
Author

@criticalAY hello, can you merge my work in your branch to make someone review it?

@criticalAY

Copy link
Copy Markdown
Owner

This can go as a separate PR in AnkiDroid. Please wait until the original PR is merged

@Galal-20 Galal-20 force-pushed the Baseline-Profile-Add-a-test branch from 40353f9 to 857c493 Compare April 21, 2026 10:52
@Galal-20 Galal-20 force-pushed the Baseline-Profile-Add-a-test branch from 857c493 to 21d58d0 Compare April 21, 2026 11:02
@Galal-20 Galal-20 closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.