title: Android PackageManager enable any application
body: <p>I have developed an application in which I have enabled that any application which we have can be installed manually</p>
  
  <p>But my problem is that I only want to enable my own package name and rather not any other application package name.</p>
  
  <p>Here is the code I have used.</p>
  
  <pre><code>try {
      PackageManager pm1 = getPackageManager();
  
      pm1.setComponentEnabledSetting(new ComponentName("com.service",
      "com.service.EnableActivity"),
      PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
          PackageManager.DONT_KILL_APP
      );
  } catch (SecurityException e) {
      e.printStackTrace();
  } 
  </code></pre>
  
  <p>here "com.service" is the package name that I install and "com.service.EnableActivity" is my first app launcherActivity.</p>
  
  <p><strong>Log</strong></p>
  
  <pre><code>java.lang.SecurityException: Permission Denial: attempt to change component state from pid=3354, uid=10056, package uid=10058 at
  android.os.Parcel.readException(Parcel.java:1322) at
  android.os.Parcel.readException(Parcel.java:1276) at
  android.content.pm.IPackageManager$Stub$Proxy.setComponentEnabledSettingIPackageManager.java:2217)
  </code></pre>
  
  <p>But when I use the same application packagename and classname then it's working fine.</p>