I need android.permission.WRITE_SETTINGS for my Android application's junit tests. I am using IntelliJ Idea 11.1.2 and the unit tests in their own module, which contains second AndroidManifest.xml for the tests.
I added <uses-permission android:name="android.permission.WRITE_SETTINGS" /> to the test module's AndroidManifest.xml.
Error:java.lang.SecurityException: Permission Denial: writing com.android.providers.settings.SettingsProvider uri content://settings/system from pid=1063, uid=10035 requires android.permission.WRITE_SETTINGS
Ugly quick fix: I add the same permission also to the application's AndroidManifest.xml. Tests run without a single error.
The problem: I DO NOT want to give the whole application permission to change settings.
Is there a way to give permissions only for the tests?