Skip to content

new: featureFlags support for SDK 35 apps #3706

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

Merged
merged 3 commits into from
Oct 3, 2024
Merged

new: featureFlags support for SDK 35 apps #3706

merged 3 commits into from
Oct 3, 2024

Conversation

IgorEisberg
Copy link
Contributor

@IgorEisberg IgorEisberg commented Oct 3, 2024

This records all featureFlag attrs that were enabled when the APK was originally built. This is now required by AAPT2 to pass these flags and their enabled/disabled state if they are used in AndroidManifest.xml.
The flags are recorded to apktool.yml and can be configured, if so desired. In normal usage, all flags should remain set to true (i.e. enabled).

This records all featureFlag attrs that were enabled when the APK was originally built.
This is now required by AAPT2 to pass these flags and their enabled/disabled state if
they are used in AndroidManifest.xml.
The flags are recorded to apktool.yml and can be configured, if so desired.
In normal usage, all flags should remain set to true (i.e. enabled).
Sample APK sourced from AOSP Android 15.

https://drive.google.com/file/d/1av7Ih7-YUXi73Hf0E3xlPv-V-nE_sXdt/view
Copy link
Owner

@iBotPeaches iBotPeaches left a comment

Choose a reason for hiding this comment

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

I believe we'll need to add a sample test for this to ensure we can decode/build it. So we can adapt the testapp or a new apk sample.

@IgorEisberg
Copy link
Contributor Author

I believe we'll need to add a sample test for this to ensure we can decode/build it. So we can adapt the testapp or a new apk sample.

Done. You'll notice that if you rename or remove "brut.feature.flag" from apktool.yml, AAPT2 will fail to rebuild the manifest.

@iBotPeaches iBotPeaches merged commit 5c99919 into iBotPeaches:master Oct 3, 2024
25 checks passed
@iBotPeaches
Copy link
Owner

thanks!

@iBotPeaches iBotPeaches added this to the v2.11.0 milestone Oct 3, 2024
@IgorEisberg IgorEisberg deleted the sdk35fix2 branch October 4, 2024 09:00
iBotPeaches added a commit that referenced this pull request Oct 4, 2024
@Jon8RFC
Copy link

Jon8RFC commented Jan 13, 2025

If it's helpful, the NFC apk from Android 15 on a Pixel 9 Pro XL fails to build with the current apktool snapshot:

I: Using Apktool v2.10.0-25-f8092846-SNAPSHOT on NfcNciApexGoogle_mod.apk with 8 threads
I: Smaling smali folder into classes.dex...
I: Building resources with aapt2...
W: error: attribute 'android:featureFlag' has flag 'com.android.nfc.flags.enable_direct_boot_aware' not found in flags from --feature_flags parameter.



If I remove both of these from the manifest entirely, then it builds without error:

android:featureFlag="com.android.nfc.flags.enable_direct_boot_aware"
android:featureFlag="!com.android.nfc.flags.enable_direct_boot_aware"



Attached is the apk in question, located here:

/apex/com.android.nfcservices/priv-app/[email protected]/NfcNciApexGoogle.apk
/apex/com.android.nfcservices@352090000/priv-app/[email protected]/NfcNciApexGoogle.apk

NfcNciApexGoogle.zip

@Tulsadiver
Copy link

Tulsadiver commented Jan 15, 2025

This update didn't seem to work on my Pixel 8 Pro on the SystemUIGoogle apk......Android 15 January update. No changes, just decompile, then recompile.

I: Using Apktool v2.11.0-3-4b2c9abe-SNAPSHOT on SystemUIGoogle.apk with 4 threads
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Building resources with aapt2...
W: error: attribute 'android:featureFlag' has flag 'com.android.wm.shell.enable_retrievable_bubbles' not found in flags from --feature_flags parameter.
W: error: attribute 'android:featureFlag' has flag 'com.android.wm.shell.enable_retrievable_bubbles' not found in flags from --feature_flags parameter.

SystemUIGoogle.zip
framework-res.zip

@iBotPeaches
Copy link
Owner

I turned this discussion into a new bug since we are just commenting on a merged PR and it got lost.

@Tulsadiver
Copy link

Tulsadiver commented Jan 15, 2025

Thank you, sir!

I was also wondering what happened to the missing attributes problem. Even after fixing the feature flag errors, the dozens of attribute problems show up....should I open a bug report or is this a known problem?

Compiling first pass...
I: Using Apktool v2.11.0-3-4b2c9abe-SNAPSHOT on SystemUIGoogle.apk with 4 threads
I: Smaling smali folder into classes.dex...
I: Smaling smali_classes2 folder into classes2.dex...
I: Building resources with aapt2...
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\animator\design_appbar_state_list_animator.xml:4: error: attribute state_liftable (aka com.android.systemui:state_liftable) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\animator\design_appbar_state_list_animator.xml:4: error: attribute state_lifted (aka com.android.systemui:state_lifted) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\animator\m3_appbar_state_list_animator.xml:4: error: attribute state_liftable (aka com.android.systemui:state_liftable) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\animator\m3_appbar_state_list_animator.xml:4: error: attribute state_lifted (aka com.android.systemui:state_lifted) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\animator\m3_card_elevated_state_list_anim.xml:7: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\animator\m3_card_state_list_anim.xml:7: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\animator\mtrl_card_state_list_anim.xml:4: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\color\m3_card_foreground_color.xml:5: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\color\m3_card_stroke_color.xml:9: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\color\mtrl_card_view_foreground.xml:5: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\color\mtrl_card_view_foreground.xml:6: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\color\mtrl_card_view_ripple.xml:5: error: attribute state_dragged (aka com.android.systemui:state_dragged) not found.
W: E:\3Custom14Pixelscript\SystemUIGoogle\res\layout\status_bar_expanded.xml:10: error: attribute viewType (aka com.android.systemui:viewType) not found.
W: error: failed linking file resources.

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.

4 participants