Skip to content
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

Simplify debug build check logic #885

Open
wants to merge 1 commit into
base: android15
Choose a base branch
from

Conversation

herobuxx
Copy link

@herobuxx herobuxx commented Mar 7, 2025

Since there only one non-debugging build variant, i think it's better to keep it simple

@grote grote requested review from chirayudesai and mikeNG March 7, 2025 13:56
@@ -193,7 +193,7 @@ const val ERROR_BACKUP_CANCELLED: Int = BackupManager.ERROR_BACKUP_CANCELLED
const val ERROR_BACKUP_NOT_ALLOWED: Int = BackupManager.ERROR_BACKUP_NOT_ALLOWED

// TODO this doesn't work for LineageOS as they do public debug builds
fun isDebugBuild() = Build.TYPE == "userdebug" || Build.TYPE == "eng"
fun isDebugBuild() = Build.TYPE != "user"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about possible build types, but it seems to me making debug builds explicit is safer than declaring everything a debug build which isn't user. Also considering that certain safety features are disabled in debug builds.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are only three build variants: user, userdebug, and eng.

Since userdebug and eng are both debugging builds, classifying any variant other than user as a debugging build would simplify code readability.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if there is ever a new build variant introduced?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only those 3 variants have existed in the ~17 years of android being public.

I am not sure if this change is worth making, it doesn't actually fix something and the TODO above is still valid, LineageOS and other downstream forks will still have to modify this check to just Build.TYPE == "eng"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants