Add tests scripts
diff --git a/tests/blacklist b/tests/blacklist
new file mode 100644
index 0000000..19bb255
--- /dev/null
+++ b/tests/blacklist
@@ -0,0 +1,2 @@
+config_useRoundIcon
+config_swipe_up_gesture_setting_available
diff --git a/tests/knownKeys b/tests/knownKeys
new file mode 100644
index 0000000..7aacaca
--- /dev/null
+++ b/tests/knownKeys
@@ -0,0 +1,87 @@
+config_allowAllRotations
+config_allowAutoBrightnessWhileDozing
+config_autoBrightnessAdjustmentMaxGamma
+config_autoBrightnessBrighteningLightDebounce
+config_autoBrightnessButtonBacklightValues
+config_autoBrightnessDarkeningLightDebounce
+config_autoBrightnessInitialLightSensorRate
+config_autoBrightnessLcdBacklightValues
+config_autoBrightnessLevels
+config_autoBrightnessLightSensorRate
+config_autoBrightnessResetAmbientLuxAfterWarmUp
+config_autoPowerModeAnyMotionSensor
+config_auto_attach_data_on_creation
+config_automatic_brightness_available
+config_bluetooth_hfp_inband_ringing_support
+config_bluetooth_idle_cur_ma
+config_bluetooth_le_peripheral_mode_supported
+config_bluetooth_operating_voltage_mv
+config_bluetooth_rx_cur_ma
+config_bluetooth_tx_cur_ma
+config_brightness_ramp_rate_fast
+config_brightness_ramp_rate_slow
+config_cameraDoubleTapPowerGestureEnabled
+config_cameraLaunchGestureSensorStringType
+config_cameraLaunchGestureSensorType
+config_carrier_volte_available
+config_carrier_wfc_ims_available
+config_cellBroadcastAppLinks
+config_defaultPinnerServiceFiles
+config_device_volte_available
+config_device_vt_available
+config_device_wfc_ims_available
+config_displayBlanksAfterDoze
+config_doublePressOnPowerBehavior
+config_dozeAfterScreenOffByDefault
+config_dozeAlwaysOnDisplayAvailable
+config_dozeComponent
+config_dynamic_bind_ims
+config_enableAutoPowerModes
+config_enableMultiUserUI
+config_gpsParameters
+config_hotswapCapable
+config_ims_package
+config_intrusiveNotificationLed
+config_keyboardTapVibePattern
+config_lidControlsSleep
+config_longPressVibePattern
+config_mainBuiltInDisplayCutout
+config_maximumScreenDimRatio
+config_mobile_mtu
+config_multiuserMaximumUsers
+config_nightDisplayAvailable
+config_overrideHasPermanentMenuKey
+config_pinnerCameraApp
+config_powerDecoupleAutoSuspendModeFromDisplay
+config_powerDecoupleInteractiveModeFromDisplay
+config_screenBrightnessDark
+config_screenBrightnessDim
+config_screenBrightnessDoze
+config_screenBrightnessSettingDefault
+config_screenBrightnessSettingMaximum
+config_screenBrightnessSettingMinimum
+config_setColorTransformAccelerated
+config_showNavigationBar
+config_shutdownBatteryTemperature
+config_speed_up_audio_on_mt_calls
+config_supportAudioSourceUnprocessed
+config_supportSystemNavigationKeys
+config_suspendWhenScreenOffDueToProximity
+config_sustainedPerformanceModeSupported
+config_switch_phone_on_voice_reg_state_change
+config_tether_bluetooth_regexs
+config_tether_upstream_types
+config_tether_usb_regexs
+config_tether_wifi_regexs
+config_useDevInputEventForAudioJack
+config_use_sim_language_file
+config_virtualKeyVibePattern
+config_wifiDisplaySupportsProtectedBuffers
+config_wifi_background_scan_support
+config_wifi_batched_scan_supported
+config_wifi_dual_band_support
+config_wifi_enable_disconnection_debounce
+config_wifi_fast_bss_transition_enabled
+skip_restoring_network_selection
+status_bar_height_landscape
+status_bar_height_portrait
diff --git a/tests/tests.sh b/tests/tests.sh
new file mode 100644
index 0000000..29b31f7
--- /dev/null
+++ b/tests/tests.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+base="$(dirname "$(readlink -f -- $0)")/.."
+cd $base
+
+#Keep knownKeys
+rm -f tests/priorities
+touch tests/priorities tests/knownKeys
+result=0
+find -name AndroidManifest.xml |while read manifest;do
+	folder="$(dirname "$manifest")"
+	#Ensure this overlay doesn't override blacklist-ed properties
+	for b in $(cat tests/blacklist);do
+		if grep -qRF "$b" $folder;then
+			echo "Overlay $folder is defining $b which is forbidden"
+			result=1
+		fi
+	done
+
+	#Everything after that is specifically for static overlays, targetting framework-res
+	isStatic="$(xmlstarlet sel -t -m '//overlay' -v @android:isStatic -n $manifest)"
+	[ "$isStatic" != "true" ] && continue
+
+	#Ensure priorities unique-ness
+	priority="$(xmlstarlet sel -t -m '//overlay' -v @android:priority -n $manifest)"
+	if grep -qE '^'$priority'$' tests/priorities;then
+		echo $manifest priority $priority conflicts with another manifest
+		result=1
+	fi
+	echo $priority >> tests/priorities
+
+	systemPropertyName="$(xmlstarlet sel -t -m '//overlay' -v @android:requiredSystemPropertyName -n $manifest)"
+	if [ "$systemPropertyName" == "ro.vendor.product.name" ];then
+		echo "$manifest: ro.vendor.product.name is deprecated. Please use ro.vendor.build.fingerprint"
+	fi
+
+	#Ensure the overloaded properties exist in AOSP
+	find "$folder" -name \*.xml |while read xml;do
+		keys="$(xmlstarlet sel -t -m '//resources/*' -v @name -n $xml)"
+
+		for key in $keys;do
+			grep -q $key tests/knownKeys && continue
+			if ag '"'$key'"' /build/AOSP-9.0/frameworks/base/core/res/res > /dev/null;then
+				echo $key >> tests/knownKeys
+			else
+				echo $xml defines a non-existing attribute $key
+			fi
+		done
+	done
+done
+rm -f tests/priorities
+
+exit $result