Skip to content

Use native Bundle.toString() implementation #12173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: refactor
Choose a base branch
from

Conversation

Isira-Seneviratne
Copy link
Member

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Use the native Bundle.toString() implementation.

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

@github-actions github-actions bot added the size/small PRs with less than 50 changed lines label Apr 11, 2025
@Stypox
Copy link
Member

Stypox commented Apr 11, 2025

iirc I created that function because the normal .toString() printed just Bundle{hash} or didn't include all items. Or maybe it did so only on older Android versions. But I remember definitely considering the native .toString() and not being able to get enough information. So I'd leave it as before, but please try out the two methods on both an old (e.g. API22) and a new android version and post the 4 outputs here, then we can decide. If we decide to keep the previous bevavior, a comment should be added (I should have done so when I implemented it initally, sorry about it).

@Isira-Seneviratne
Copy link
Member Author

The implementation has been around since the very first Android version: https://developer.android.com/reference/android/os/Bundle#toString()

@Isira-Seneviratne
Copy link
Member Author

I made some changes to unparcel the extras so that their contents are actually displayed.

The format is as follows:

Bundle[{should_start_foreground_extra=true, play_queue_key=c56f58e4-2606-495e-a59c-f2d7fb3ce910, resume_playback=true, play_when_ready=true, player_type=0}]

@ShareASmile ShareASmile added the codequality Improvements to the codebase to improve the code quality label Apr 14, 2025
@Stypox
Copy link
Member

Stypox commented Apr 15, 2025

I don't see any advantage of the new implementation with respect to the old one. The new one even uses more lines of code where you just want to print logs. It's just a debugging method anyway, so I'd keep the previous.

@Isira-Seneviratne
Copy link
Member Author

I don't see any advantage of the new implementation with respect to the old one. The new one even uses more lines of code where you just want to print logs. It's just a debugging method anyway, so I'd keep the previous.

Alternatively, the extension could be updated to take an Intent type, since that's what's being used anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codequality Improvements to the codebase to improve the code quality size/small PRs with less than 50 changed lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants