Open Bug 1633590 Opened 6 years ago Updated 2 years ago

Make Android resources match SDK restrictions

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect, P3)

defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: jstockdale20, Unassigned)

Details

+++ This bug was initially created as a clone of Bug #1355616 +++

Right now, mobile/android/base/resources contains some resources folders that contain qualifiers (like hdpi, xhdpi, etc) but no versions. These are accepted, but they have a "secret" version qualifier -- in the case of hdpi, it's v4, since that's the first Android version that discriminated on screen density. The set of versions is small; I reverse engineered it from [1] and some of the outputs of a Gradle build.

In addition, we have resources that we can statically prove will never be accessed because there's a more recent version that is less than the minimum SDK version we run on. For example, drawable-v12/toast_button_background.xml will always be preferred to drawable/toast_button_background.xml, since v12 is less than our minimum SDK version v15 (and since drawable-v12 overrides the unqualified drawable).

This ticket tracks adding the version qualifiers, and purging the inaccessible resources.

The motivation for doing so is simple: by adding the qualifiers, we get closer to the set of merged resources that the Gradle build process ends up using. Future work will converge the set of resources used by moz.build to exactly the same set used by Gradle, making it easier to "flip the switch". In addition, we save a small amount of APK space by purging the unused resources.

[1] https://android.googlesource.com/platform/tools/base/+/588c433884c745cba0e09eb16a7f269dfee2c1aa/sdk-common/src/main/java/com/android/ide/common/resources/configuration/FolderConfiguration.java

Severity: normal → S3
Flags: needinfo?(zmckenney)
Type: task → defect
Flags: needinfo?(zmckenney)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.