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

fix(android): supports sdk-30 package visibility #684

Merged
merged 3 commits into from
Aug 9, 2021

Conversation

erisu
Copy link
Member

@erisu erisu commented Oct 27, 2020

Platforms affected

android

Motivation and Context

Fixes issues that were introduced with the new Android 11 (SDK 30) package visibility restrictions.

Description

Explicitly sets the package visibility for:

  • android.media.action.IMAGE_CAPTURE
  • android.intent.action.GET_CONTENT
  • android.intent.action.PICK

closes #673

Which is used by the camera and gallery.

Testing

  • Tested on an Android 11 SDK 30 AVD

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@jcesarmobile
Copy link
Member

I don’t think we should add this yet because cordova-android doesn’t support SDK 30.
Users targeting SDK 30 can add that to their manifest themselves with edit-config and config-file tags as they work in config.xml too.

Copy link
Member

@timbru31 timbru31 left a comment

Choose a reason for hiding this comment

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

could you amend the commit message, it contains a typo :)

@erisu erisu changed the title fix(android): Ssupports sdk-30 new package visibility fix(android): supports sdk-30 new package visibility Oct 27, 2020
@erisu
Copy link
Member Author

erisu commented Oct 27, 2020

Squash merge will amend it Went ahead and rebased.

@erisu erisu changed the title fix(android): supports sdk-30 new package visibility fix(android): supports new package visibility (sdk-29) Oct 27, 2020
@erisu erisu changed the title fix(android): supports new package visibility (sdk-29) fix(android): supports new package visibility (sdk-30) Oct 27, 2020
@erisu erisu force-pushed the fix/android-package-visibility branch from 65c95fc to c0a4243 Compare October 27, 2020 10:43
@erisu erisu changed the title fix(android): supports new package visibility (sdk-30) fix(android): supports sdk-30 package visibility Oct 27, 2020
@breautek
Copy link
Contributor

Personally as long as the changes aren't introducing breaking changes, I don't see why we shouldn't accept PRs that addresses issues in upcoming API levels. It help us stay ahead of the curve.

@jcesarmobile jcesarmobile removed their request for review October 27, 2020 13:27
@mickytroxxy
Copy link

Hello guys, may you please help with this error, when taking photos with cordova app Attempt to invoke virtual method 'boolean java.io.File.mkdirs()' on a null object reference. Please

@Perh0rd
Copy link

Perh0rd commented Dec 1, 2020

Hi . Is there any ETA for a release of this? It's not possible to use camera while target SDK 30, but Google now refuse apps (updates or new ones), that do not the SDK 30, so basically camera plugin do not work anymore on Android 11 to publish a public app.

Thank you!

@breautek
Copy link
Contributor

breautek commented Dec 1, 2020

Hi . Is there any ETA for a release of this? It's not possible to use camera while target SDK 30, but Google now refuse apps (updates or new ones), that do not the SDK 30, so basically camera plugin do not work anymore on Android 11 to publish a public app.

Thank you!

We cannot provide ETAs. Additionally that statement is inaccurate. Google currently requires all apps (new or updates) to be targeting API 29.

They will begin forcing API 30 on new apps starting August 2021 and on existing apps receiving updates starting November 2021. See their timeline here

@Perh0rd
Copy link

Perh0rd commented Dec 1, 2020

Hi . Is there any ETA for a release of this? It's not possible to use camera while target SDK 30, but Google now refuse apps (updates or new ones), that do not the SDK 30, so basically camera plugin do not work anymore on Android 11 to publish a public app.
Thank you!

We cannot provide ETAs. Additionally that statement is inaccurate. Google currently requires all apps (new or updates) to be targeting API 29.

They will begin forcing API 30 on new apps starting August 2021 and on existing apps receiving updates starting November 2021. See their timeline here

My bad, sorry you are right it's only in August. Safe then. Thank you for your answer

@Houdhey
Copy link

Houdhey commented Jan 27, 2021

Could you please explain how you implement this? (with code)

@jcesarmobile
Copy link
Member

I think android.intent.action.PICK should also be added since it's used when allowEdit is set to true

@noahcooper
Copy link

noahcooper commented Apr 24, 2021

Any chance of merging this any time soon? Android 11 will be required for all apps starting in November.

@erisu erisu requested a review from timbru31 July 17, 2021 08:15
@erisu erisu force-pushed the fix/android-package-visibility branch from c0a4243 to a0485d6 Compare July 17, 2021 08:17
@erisu erisu requested a review from jcesarmobile July 17, 2021 08:17
@jcesarmobile
Copy link
Member

jcesarmobile commented Aug 3, 2021

We also launch CROP intent here https://github.com/apache/cordova-plugin-camera/blob/master/src/android/CameraLauncher.java#L417, so should probably be added too

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

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

looks good

Copy link

@AdriVanHoudt AdriVanHoudt left a comment

Choose a reason for hiding this comment

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

LGTM, tested this on android 11 target sdk 30

@erisu erisu merged commit abfbbd3 into apache:master Aug 9, 2021
@erisu erisu deleted the fix/android-package-visibility branch August 9, 2021 11:57
steven-knock added a commit to trimorpheus-ltd/cordova-plugin-camera that referenced this pull request Dec 20, 2021
@ghost ghost mentioned this pull request Sep 26, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't open camera on Android 11 with targetSdkVersion=30
9 participants