Skip to content

Fix lint issues in Android samples#16350

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
hannesa2:fixLintIssuesAndroid
Jan 18, 2020
Merged

Fix lint issues in Android samples#16350
opencv-pushbot merged 1 commit intoopencv:masterfrom
hannesa2:fixLintIssuesAndroid

Conversation

@hannesa2
Copy link
Copy Markdown
Contributor

It fixes lint errors and warnings in Android samples.
Because library uses functions which requires camera permission, it makes more sense to move permissions to library instead of apply it to each sample separat

@asmorkalov
Copy link
Copy Markdown
Contributor

@hannesa2 I think that's bad idea to move permissions to library project. I understand that most popular case is application with camera as input, but OpenCV can be used for apps without camera, e.g. Gallery analysis or for apps for alternative camera configuration. I propose to presume current layout.

@hannesa2
Copy link
Copy Markdown
Contributor Author

hannesa2 commented Jan 15, 2020

@asmorkalov In my point of view it's not that bad. If you run ./gradlew lint you will run into an error too because library uses camera features.
Please have a view on the other side: You use the library and have to specify the permissions by your own everytime. It's a source of error on runtime (not build time).
To add permission in AndroidManifest is one thing, but request it from the user is an other thing.
Your gallery analysis example does not need to request it from the user.

Anyway, I add this is an own commit to easy remove it again, because I expect such doubt.
Please confirm the removement of this commit and I will do it immediate

@asmorkalov
Copy link
Copy Markdown
Contributor

@alalek what do you think?

@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 15, 2020

I believe permissions should be defined by application, not by used library.

BTW, "camera" is not single required permission to run apps, there is also "storage" access permissions in some samples.

@hannesa2 hannesa2 force-pushed the fixLintIssuesAndroid branch from d794adb to 4057e81 Compare January 15, 2020 21:41
@hannesa2
Copy link
Copy Markdown
Contributor Author

BTW, "camera" is not single required permission to run apps, there is also "storage" access permissions in some samples.

But "camera" is the only permission which causes a lint issue here.
I removed the commit with the camera permission

@asmorkalov
Copy link
Copy Markdown
Contributor

👍

@asmorkalov asmorkalov self-assigned this Jan 16, 2020
@asmorkalov asmorkalov self-requested a review January 16, 2020 04:41
@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 16, 2020

But "camera" is the only permission which causes a lint issue here.

Is it possible to have separate manifest for lint tool? or configure lint tool to skip manifest issues?

@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 16, 2020

This patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

So, please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

@asmorkalov asmorkalov added the pr: needs rebase Rebase patch (and squash fixup commits) on the top of target branch label Jan 16, 2020
@hannesa2
Copy link
Copy Markdown
Contributor Author

or configure lint tool to skip manifest issues

I can/will ignore them.

But step by step.

What I want to do, is a error free lint and targetSdk 29
For this several steps are needed.

  1. this PR
  2. ignore remaining lint errors (as less as possible)
  3. targetSdk 29
  4. for this Android X is needed.

but I'm not sure if it works for non Gradle 3.4 as well

@hannesa2 hannesa2 changed the base branch from master to 3.4 January 17, 2020 05:41
@hannesa2 hannesa2 force-pushed the fixLintIssuesAndroid branch from 4057e81 to c9884d6 Compare January 17, 2020 05:44
@hannesa2
Copy link
Copy Markdown
Contributor Author

hannesa2 commented Jan 17, 2020

@alalek
I changed the base to 3.4.
What's your change-base-short-tutorial would make perfect, is the missing command how to generate a Android (3.4) release localy on my machine for test purpose.
How to do so ?

@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 17, 2020

OpenCV 3.4 requires Java 6 on Android, so some changes don't fit well.
I will backport them separately (update: done #16372).

Please revert "rebase" back:

git checkout -B fixLintIssuesAndroid 4057e81b7649d8d814908157478456c6889271cd
git push origin fixLintIssuesAndroid --force

@hannesa2 hannesa2 force-pushed the fixLintIssuesAndroid branch from c9884d6 to 4057e81 Compare January 17, 2020 16:17
@opencv-pushbot opencv-pushbot merged commit 4057e81 into opencv:master Jan 18, 2020
@hannesa2 hannesa2 deleted the fixLintIssuesAndroid branch January 18, 2020 22:16
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.

4 participants