Your main use case appears to be as follows (from your question)
Even if some other applications try to change above functionalities
then they should not be able to do so
You can write a system service to trigger the PowerManager.WakeLock at regular intervals. (Source)
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
wl.acquire();
// screen and CPU will stay awake during this section
wl.release();
To optimize the service you can also try setting the screen timeout the the maximum possible again at regular intervals so that even if changed manually it gets reset. (not sure how much max is allowed, you'll need to check with trial and error)
/**
* set screen off timeout
* @param screenOffTimeout int 0~6
*/
private void setTimeout(int screenOffTimeout) {
int time;
switch (screenOffTimeout) {
case 0:
time = 15000;
break;
case 1:
time = 30000;
break;
case 2:
time = 60000;
break;
case 3:
time = 120000;
break;
case 4:
time = 600000;
break;
case 5:
time = 1800000;
break;
default:
time = -1;
}
android.provider.Settings.System.putInt(getContentResolver(),
Settings.System.SCREEN_OFF_TIMEOUT, time);
}
(Source)