I'm looking for some assistance in modifying Android system settings via an app.
I'm having some trouble getting a custom Android app to run properly under Kitkat 4.4.2. I'm not sure what the source of my frustrations is, but I'm thinking I'm missing some kind of security setting or trick in the Manifest.
Background: I am not a developer, but this project has fallen into my lap. Before deploying our tablets, we install our MDM and company apk to the tablet, and also run a simple program to configure some of the system settings. We perform a root on the tablet and install the SU binaries along this process.
I've added ACCESS_SUPERUSER to my manifest, but I am not being prompted by SuperSU requesting SU access for this app. Additionally, if I try to run the app, I recieve a "App isn't installed" toast message. (I replaced the application name with APPLICATION below)
Java Code
Settings.Global.putInt(MainActivity.this.getContentResolver(), Settings.Global.INSTALL_NON_MARKET_APPS, 1);
Settings.Global.putInt(MainActivity.this.getContentResolver(), Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 1);
Settings.Secure.putInt(MainActivity.this.getContentResolver(), Settings.Secure.LOCK_PATERN_ENABLED, 0);
Settings.Secure.putInt(MainActivity.this.getContentResolver(), Settings.Secure.LOCK_PATTERN_VISIBLE, 0);
Settings.System.putInt(MainActivity.this.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 300000);
Settings.Secure.putInt(MainActivity.this.getContentResolver(), Settings.Global.ADB_ENABLED, 0);
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.APPLICATION"
android:versionCode="1"
android:versionName="1.2" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:persistent="false"
android:permission="android.permission.WRITE_SECURE_SETTINGS"
android:exported="true" >
<activity
android:name="com.example.APPLICATION.MainActivity"
android:label="@string/app_name"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Logcat Errors
11-20 17:17:51.749: E/Launcher(686): Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.APPLICATION/.MainActivity }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity. tag=ApplicationInfo(title=SetSet id=-1 type=0 container=-1 screen=-1 cellX=-1 cellY=-1 spanX=1 spanY=1 dropPos=null) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.setset/.MainActivity }
11-20 17:32:16.169: E/AndroidRuntime(4744): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.setset/com.example.APPLICATION.MainActivity}: java.lang.SecurityException: Permission denial: writing to secure settings requires android.permission.WRITE_SECURE_SETTINGS