If we try to start an application and got an errors as below in logcat,
ServiceManager: Permission failure: android.permission.ACCESS_SURFACE_FLINGER
ServiceManager: Permission failure: android.permission.ROTATE_SURFACE_FLINGER
Then, this error can be resolved by making the application as system application.
To make the application as system application, change the AndroidManifest.xml as below,
$ vim app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.app.package.name"
android:process="system"
android:sharedUserId="android.uid.system"
android:versionCode="xx"
android:versionName="xx.xx" >
Now, if we compile this application, install on device and start the activity / application, then above errors will be resolved.