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

Specify android:exported to the activities having <intent-filter> #1516

Merged
merged 1 commit into from Apr 28, 2022

Conversation

PatilShreyas
Copy link

@PatilShreyas PatilShreyas commented Apr 28, 2022

While targetting to Android 12 SDK (API 31), there's a restriction to providing the flag android:exported to all the components (activity, service, receivers) having <intent-filter>. This PR sets this flag to all activities having intent filters which can be helpful for the client applications which are targeting to Android 12.

Closes: #1517

Set flag `android:exported` to all the activities having `<intent-filter>`.
@srowen
Copy link
Contributor

srowen commented Apr 28, 2022

I doubt this is all the change that is needed? IIRC the permissions model has to change too. Does it work?

@PatilShreyas
Copy link
Author

PatilShreyas commented Apr 28, 2022

Yeah this change is needed. Otherwise consumer apps will manually need to override entries in the manifest by exporting it as false and merging nodes.

@srowen
Copy link
Contributor

srowen commented Apr 28, 2022

Is it sufficient though to make the app work? I think there are other changes needed. The change itself seems fine, just not exporting the activities

@PatilShreyas
Copy link
Author

PatilShreyas commented Apr 28, 2022

As far as I saw, this change seems fine. What do you think what kind of other changes are needed which are mentioned here?

@srowen
Copy link
Contributor

srowen commented Apr 28, 2022

IIRC the main thing is the permissions model. If you target Android 9+ it won't work. I can't upload the app at this point as a result (but it's not going to be released further anyway)

@PatilShreyas
Copy link
Author

PatilShreyas commented Apr 28, 2022

But as you can see, I haven't updated SDK target or compile version. I've just specified exported flags. I don't thing it would cause any issues.

@srowen
Copy link
Contributor

srowen commented Apr 28, 2022

Right. I am saying that this is likely insufficient for Android 12 compatibility. Change the title?

@PatilShreyas
Copy link
Author

PatilShreyas commented Apr 28, 2022

So the thing is app is unable to compile when this library is included in app which is targetting android 12. Manifest issues are occurring because this library haven't specified this flag (exported). So this change will make sure that no compile time issues will occur whenever any app is using it. Otherwise, every app will need to override Manifest entries at their end manually.

@PatilShreyas PatilShreyas changed the title Support Android 12 compatibility Specify android:exported to the activities having <intent-filter> Apr 28, 2022
@PatilShreyas
Copy link
Author

PatilShreyas commented Apr 28, 2022

Cool, I've updated PR title

@srowen srowen merged commit 4f9f466 into zxing:master Apr 28, 2022
6 checks passed
@srowen srowen added this to the 3.5.0 milestone Apr 28, 2022
@PatilShreyas PatilShreyas deleted the fix-android12 branch May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants