title: Error using StatusBarManagerService - java.lang.SecurityException on android.permission.STATUS_BAR_SERVICE
body: <p>I wanted to use the StatusBarManagerService, but it's not available on the SDK, so I tried "cheating", using reflection to access it.</p>
  
  <p>I was able to access it, but now it's giving me an error when accessing one of its methods:</p>
  
  <pre><code>java.lang.SecurityException: StatusBarManagerService: Neither user 10139 nor current process has android.permission.STATUS_BAR_SERVICE.
  </code></pre>
  
  <p>Is it possible to be granted this permission, or is it simply not possible?</p>
  
  <p>This is my code:</p>
  
  <pre><code>    try {
          Class serviceManagerClass = Class.forName("android.os.ServiceManager");
          Method getService = serviceManagerClass.getMethod("getService", String.class);
          IBinder retbinder = (IBinder) getService.invoke(serviceManagerClass, "statusbar");
          Class statusBarClass = Class.forName(retbinder.getInterfaceDescriptor());
          Object statusBarObject = statusBarClass.getClasses()[0].getMethod("asInterface", IBinder.class).invoke(null, new Object[] { retbinder });
          Method clearAll = statusBarClass.getMethod("onClearAllNotifications");
          clearAll.setAccessible(true);
          clearAll.invoke(statusBarObject);
      } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (SecurityException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } 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();
      } catch (RemoteException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  
  <p>And this is what I added in the AndroidManifest:</p>
  
  <pre><code>  &lt;uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /&gt;
  </code></pre>
  
  <p>Is it possible to be granted this permission, or is it simply not possible?</p>