android
android copied to clipboard
Handle Missing DeepLinks
- [x] Tests written, or not not needed
What this PR does?
It adds auto verify for intent filters Adds missing intent filters Calls handleOpenFileViaIntent() function in line 564 for missing case
Note: If we support only Android 12+ we can delete path patterns and http scheme
How to Test
Note: Works for Only Android 11 and Below
adb shell am start
-W -a android.intent.action.VIEW
-d "YOUR_INTERNAL_SHARE_LINK"\
Why It's Not Working For Android 12+
In Android 12 and beyond, it's not possible to provide generic host data, and you must add an assetlinks.json file to the .well-known directory of every potential host so we can't do that.
How It's Working For Android 12+
- Host URL must have assetlinks.json in .well-known directory with correct sha256_cert_fingerprints. Example -> https://example.cloud.com/.well-known/assetlinks.json
[
{
"relation": [
"delegate_permission/common.handle_all_urls"
],
"target": {
"namespace": "android_app",
"package_name": "com.nextcloud.client",
"sha256_cert_fingerprints": [
".............."
]
}
}
]
- In Android Manifest file for FileDisplayActivity intent filter must added. Example ->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="example.cloud.com" />
</intent-filter>
Useful links
Our previous topic Official Documentation Similar Documentation
Codacy
Lint
| Type | master | PR |
| Warnings | 72 | 72 |
| Errors | 3 | 3 |
SpotBugs
| Category | Base | New |
|---|---|---|
| Bad practice | 66 | 66 |
| Correctness | 73 | 73 |
| Dodgy code | 349 | 349 |
| Experimental | 1 | 1 |
| Internationalization | 7 | 7 |
| Malicious code vulnerability | 2 | 2 |
| Multithreaded correctness | 6 | 6 |
| Performance | 57 | 57 |
| Security | 19 | 19 |
| Total | 580 | 580 |
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12820.apk
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
Looks good, but can't tell if the app I'd in the manifest causes brander issues, hence cc @tobiasKaminsky
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12820.apk
To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.
Codacy
Lint
| Type | master | PR |
| Warnings | 62 | 62 |
| Errors | 3 | 3 |
SpotBugs
| Category | Base | New |
|---|---|---|
| Bad practice | 63 | 63 |
| Correctness | 64 | 64 |
| Dodgy code | 305 | 305 |
| Experimental | 1 | 1 |
| Internationalization | 7 | 7 |
| Multithreaded correctness | 6 | 6 |
| Performance | 52 | 52 |
| Security | 18 | 18 |
| Total | 516 | 516 |
blue-Light-Screenshot test failed: https://www.kaminsky.me/nc-dev/android-integrationTests/12820-Screenshot-blue-Light-07-07