title: Android : how to create componentName in code using <activity-alias>
body: <p>I have a feature that I only want to be available only when certain conditions are met so I have this activity alias:</p>
  
  <pre><code>&lt;activity-alias android:name="share-files-text"
                      android:targetActivity=".MyActivity"
                      android:exported="true"
                      android:enabled="false"&gt;
          &lt;intent-filter android:label="@string/open_with"&gt;
              &lt;action android:name="android.intent.action.VIEW" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
              &lt;data android:mimeType="application/pdf" /&gt;
              &lt;data android:mimeType="image/*" /&gt;
              &lt;data android:mimeType="text/plain" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity-alias&gt;
  </code></pre>
  
  <p>Once in activity I have this code to enable the component</p>
  
  <pre><code>        String packageName = getPackageName();
          ComponentName componentWithTextFiles = new ComponentName(packageName, "share-files-text");
          ComponentName componentWithoutTextFiles = new ComponentName(packageName, "share-files");
          if(DebugAndTestSettings.ENABLE_TEXT_SLIDE){
              getPackageManager().setComponentEnabledSetting(componentWithTextFiles, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
              getPackageManager().setComponentEnabledSetting(componentWithoutTextFiles, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
          } else {
              getPackageManager().setComponentEnabledSetting(componentWithTextFiles, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
              getPackageManager().setComponentEnabledSetting(componentWithoutTextFiles, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0);
          }
  </code></pre>
  
  <p>The problem is it crashes saying the package blabla doesn't contain an activity named share-files-text, how can disable/enable this element suing the alias name?
  Thanks</p>
  
  <p>EDIT: I got the idea from this post:
  <a href="https://stackoverflow.com/questions/6408086/android-can-i-enable-disable-an-activitys-intent-filter-programmatically/10403074#10403074">Android: Can I enable/disable an activity&#39;s intent filter programmatically?</a></p>