Permission denial: Can't access the SurfaceFlinger 
<p>I get this error when running my app. I also included the permission for surfaceFlinger in manifest.xml</p>

<p>"uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER"</p>

<p>but still it give the same error " can't access the SurfaceFlinger"  in LogCat.</p>

<p>Basically i want to run the Development setting code in Dev tools. </p>

<pre><code> public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            try {


                 Class partypes[] = new Class[1];

                  partypes[0] = String.class;


                            Method getService= ServiceManager.getMethod("getService", partypes );

                            Object arglist[] = new Object[1];
                            arglist[0] = "SurfaceFlinger";

                      IBinder flinger= (IBinder)getService.invoke(smObject, arglist );




            //    IBinder flinger = ServiceManager.getService("SurfaceFlinger");
                if (flinger != null) {
                    Parcel data = Parcel.obtain();
                    data.writeInterfaceToken("android.ui.ISurfaceComposer");
                    data.writeInt(isChecked ? 1 : 0);
                    flinger.transact(mCode, data, null, 0);
                    data.recycle();

                    updateFlingerOptions();
                }
            } catch (RemoteException ex) {
            } 
**catch (SecurityException e) {
                // TODO Auto-generated catch block
                String err=e.toString();

                Toast.makeText(DevelopmentSetting.this, err, Toast.LENGTH_SHORT).show();

            }**

            catch (NoSuchMethodException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }


    }
</code></pre>

<p>In catch SecurityException it gives the error java.lang.securityException but logcat it says  permission denied : can't access surfaceFlinger.</p>

<p>and the manifest.xml is here</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.nustian.android"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk android:minSdkVersion="10" /&gt;
    &lt;uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER"/&gt;


&lt;uses-permission  android:name="android.permission.SET_WALLPAPER"   /&gt;

&lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt; 

    &lt;application

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name" &gt;

        &lt;activity

             android:name=".DevelopmentSetting"

            android:label="@string/app_name" &gt;

            &lt;intent-filter&gt;

                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;

            &lt;/intent-filter&gt;

        &lt;/activity&gt;

    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>

<p>Somebody help me. </p>
