From 2a2e475bdc7dac044bb23069ae6e447954c09a13 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 22 Mar 2017 13:53:50 +0100 Subject: [PATCH] index-v1 future proof test for uses-permission The parser should accept additional elements to each uses-permission entry, in case more XML attributes is added to . has had two attributes since the beginning. Other changes to this JSON data structure are bad index-v1 format, and will cause crashes: * Removing an element e.g. null from a uses-permission entry would be invalid index-v1 JSON, since that structure mirrors the uses-permission AndroidManifest.xml element, which has a long standing fixed definition of name/maxSdkVersion. That should crash so that fdroidserver authors know they are generating invalid index-v1. * setting versionCode to anything but an int is invalid index-v1 JSON, and should crash. versionCode has been defined as an 32-bit signed integer value since the beginning of Android. * has been defined as a string since the beginning of Android. https://developer.android.com/guide/topics/manifest/uses-permission-element.html --- app/src/test/resources/guardianproject_index-v1.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/test/resources/guardianproject_index-v1.json b/app/src/test/resources/guardianproject_index-v1.json index 750325ce1..9b86356c7 100644 --- a/app/src/test/resources/guardianproject_index-v1.json +++ b/app/src/test/resources/guardianproject_index-v1.json @@ -889,11 +889,15 @@ ], [ "android.permission.WRITE_EXTERNAL_STORAGE", - 18 + 18, + null, + "another fake future proofing test" ], [ "android.permission.VIBRATE", - 18 + 18, + 1234567, + "future proof test" ] ], "versionCode": 100,