Fixed
Status Update
Comments
uc...@google.com <uc...@google.com>
rp...@google.com <rp...@google.com> #2
Also this should be handled like Activities with results. Some stubbing of intent should be possible and then checking permission result. just like the espresso intents are done.
es...@google.com <es...@google.com> #3
I've implemented a solution which leverages wrapper classes, overriding and build variant configuration. The solution is quite long to explain and is found over here: https://github.com/ahasbini/AndroidTestMockPermissionUtils .
It is not yet packed in an sdk but the main idea is to override the functionalities of ContextWrapper.checkSelfPermission and ActivityCompat.requestPermissions to be manipulated and return mocked results tricking the app into the different scenarios to be tested like: permission was denied hence the app requested it and ended with granted permission. This scenario will occur even if the app had the permission all along but the idea is that it was tricked by the mocked results from the overriding implementation.
It is not yet packed in an sdk but the main idea is to override the functionalities of ContextWrapper.checkSelfPermission and ActivityCompat.requestPermissions to be manipulated and return mocked results tricking the app into the different scenarios to be tested like: permission was denied hence the app requested it and ended with granted permission. This scenario will occur even if the app had the permission all along but the idea is that it was tricked by the mocked results from the overriding implementation.
es...@google.com <es...@google.com> #4
This bug has not been updated in over a year. Please reopen if this is still an issue or requires addition inspection.
es...@google.com <es...@google.com> #5
This is most definitely still an issue.
With permission checks (rightly!) being encouraged contextually, the need to be able to test the various different pathways and permutations of requesting permissions, having them granted or denied, requesting again and ensuring that rationale messages are displayed etc. is more important than ever.
The lack of espresso to be able to provide the ability to reset the permissions mid-suite is a pretty major deficiency.
na...@dekaresearch.com <na...@dekaresearch.com> #6
Yes, I originally saw the issue on API 25, but I can also reproduce on API 23 (Nexus 5).
na...@dekaresearch.com <na...@dekaresearch.com> #7
I can't even upgrade packages on Nougat. I get the following error in logcat when trying to update a package from version 31 to version 1:
2019-04-02 18:01:55.648 2018-2018/? I/studio.deploy: package
2019-04-02 18:01:55.648 2018-2018/? I/studio.deploy: install-commit
2019-04-02 18:01:55.662 2018-2018/? I/studio.deploy: 781611559
2019-04-02 18:01:55.862 392-504/system_process E/PackageInstaller: Commit of session 781611559 failed: Existing base version code 31 inconsistent with 1
Updating the package via adb install -r works perfectly.
2019-04-02 18:01:55.648 2018-2018/? I/studio.deploy: package
2019-04-02 18:01:55.648 2018-2018/? I/studio.deploy: install-commit
2019-04-02 18:01:55.662 2018-2018/? I/studio.deploy: 781611559
2019-04-02 18:01:55.862 392-504/system_process E/PackageInstaller: Commit of session 781611559 failed: Existing base version code 31 inconsistent with 1
Updating the package via adb install -r works perfectly.
na...@dekaresearch.com <na...@dekaresearch.com> #8
I of course meant version 1 to version 31.
na...@dekaresearch.com <na...@dekaresearch.com> #9
Any update on this?
es...@google.com <es...@google.com> #10
As usual the fix will take around a week to make it to the canary channel
Description
1. Build and run Android app
2. Change the app's version code to be smaller
3. Press AS run button again
4. The progress bars go through the build and install motions, but the app is not updated or relaunched. Logcat reveals that the app was not installed because a downgrade was detected.
5. AS does not detect this error, and launches the previously installed version of the app
Expected behavior: Prompt the user to uninstall the existing app first, as AS 3.4 RC 1 does.
Build: AI-183.5429.30.35.5326993, 201902211332, AI-183.5429.30.35.5326993, JRE 1.8.0_152-release-1343-b16-5323222x64 JetBrains s.r.o, OS Linux(amd64) v4.15.0-45-generic, screens 1920x1080, 1920x1080AS: 3.5 Canary 6; Android Gradle Plugin: 3.2.1; Gradle: 4.6; NDK: from local.properties: 19.1.5304403, latest from SDK: 19.1.5304403; LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: 3.5.1 IMPORTANT: Please read