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
Conversation
@@ -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) { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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".
return ImmutableSet.of(normalRestriction); | ||
} | ||
return ImmutableSet.of(normalRestriction, domainSpecificApiFlags[(domainSpecificPart >> 3) - 1]); | ||
return ImmutableSet.of(normalRestriction, domainSpecificApiFlags[(domainSpecificPart >> 4) - 1]); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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" | |
There was a problem hiding this comment.
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.
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. |
@JesusFreke, happy New Year! |
My changes not correct. |
Support for the new test-api hidden api restriction was added in 812bf35 |
Fix #798