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

Add support Android 11 #799

Closed
wants to merge 1 commit into from
Closed

Add support Android 11 #799

wants to merge 1 commit into from

Conversation

MrIkso
Copy link

@MrIkso MrIkso commented Dec 30, 2020

Fix #798

@@ -105,10 +107,10 @@ public boolean isDomainSpecificApiFlag() {
HiddenApiRestriction normalRestriction = hiddenApiFlags[value & HIDDENAPI_FLAG_MASK];

int domainSpecificPart = (value & ~HIDDENAPI_FLAG_MASK);
if (domainSpecificPart == 0) {
if (domainSpecificPart == 0 | domainSpecificPart != value) {

Choose a reason for hiding this comment

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

Should this not be a logical or (||) instead of a bitwise or (|)?

@@ -533,7 +533,7 @@ private void writeClasses(@Nonnull DexDataStore dataStore, @Nonnull DexDataWrite
}

private boolean shouldWriteHiddenApiRestrictions() {
return hasHiddenApiRestrictions && opcodes.api >= 29;
Copy link
Owner

Choose a reason for hiding this comment

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

I'm pretty sure this should stay as 29? Otherwise this will change the behavior for api 29.

@@ -208,9 +208,9 @@ import static org.jf.smali.smaliParser.*;
}

private String processQuotedSimpleNameWithSpaces(String text) {
if (apiLevel < 30) {
Copy link
Owner

Choose a reason for hiding this comment

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

Ditto above comment

@@ -45,15 +45,17 @@
GREYLIST_MAX_O(3, "greylist-max-o", false),
GREYLIST_MAX_P(4, "greylist-max-p", false),
GREYLIST_MAX_Q(5, "greylist-max-q", false),
CORE_PLATFORM_API(8, "core-platform-api", true);
GREYLIST_MAX_R(6, "greylist-max-r", false),
CORE_PLATFORM_API(9, "core-platform-api", true);
Copy link
Owner

Choose a reason for hiding this comment

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

Why are you changing the value of core-platform-api? The first 3 bits are for the api white/black/greylist values, and then the 4th bit (mask value 8) is for the core-platform-api flag. And it looks like there's a new flag value for android 11, for "test-api".

See, e.g. https://android.googlesource.com/platform/art/+/267366ca19e7b71a63d3c4a02976cc56a6e58adc/libartbase/base/hiddenapi_flags.h#110

return ImmutableSet.of(normalRestriction);
}
return ImmutableSet.of(normalRestriction, domainSpecificApiFlags[(domainSpecificPart >> 3) - 1]);
return ImmutableSet.of(normalRestriction, domainSpecificApiFlags[(domainSpecificPart >> 4) - 1]);
Copy link
Owner

Choose a reason for hiding this comment

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

The normal api flags still use the first 3 bits, with the domain specific flags starting on the 4th bit. Shifting by 4 will shift off the first bit of the domain specific part.

@@ -105,10 +107,10 @@ public boolean isDomainSpecificApiFlag() {
HiddenApiRestriction normalRestriction = hiddenApiFlags[value & HIDDENAPI_FLAG_MASK];

int domainSpecificPart = (value & ~HIDDENAPI_FLAG_MASK);
if (domainSpecificPart == 0) {
if (domainSpecificPart == 0 | domainSpecificPart != value) {
Copy link
Owner

Choose a reason for hiding this comment

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

???

@@ -252,8 +252,8 @@ access_or_restriction_list returns[int value, Set<HiddenApiRestriction> hiddenAp
|
HIDDENAPI_RESTRICTION
{
if (opcodes.api < 29) {
Copy link
Owner

Choose a reason for hiding this comment

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

ditto above comment.

@@ -479,7 +479,7 @@ Type = {PrimitiveType} | {ClassDescriptor} | {ArrayPrefix} ({ClassDescriptor} |
return newToken(ACCESS_SPEC);
}

"whitelist" | "greylist" | "blacklist" | "greylist-max-o" | "greylist-max-p" | "greylist-max-q" |
"whitelist" | "greylist" | "blacklist" | "greylist-max-o" | "greylist-max-p" | "greylist-max-q" | "greylist-max-r" |
Copy link
Owner

Choose a reason for hiding this comment

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

The new value needs to be added to smali as well.

@MrIkso
Copy link
Author

MrIkso commented Dec 31, 2020

Yes, maybe changes incorrect, but it works on dex from android 11. I think about close this pull, so that @JesusFreke create normal and correct fix.

@pashamcr
Copy link

pashamcr commented Dec 31, 2020

@JesusFreke, happy New Year!
I will assume the presence of dex040
https://source.android.com/devices/tech/dalvik/dex-format#simplename
VersionMap.java

@MrIkso
Copy link
Author

MrIkso commented Jan 1, 2021

My changes not correct.

@MrIkso MrIkso closed this Jan 1, 2021
@JesusFreke
Copy link
Owner

Support for the new test-api hidden api restriction was added in 812bf35

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.

Support Android 11 (dex 039)
4 participants