title: Is it possible to get the package name of Activities' caller app when Interprocess Communication?
body: <p>I have an <code>Activity</code> A, which can be called by <code>Application1</code> and <code>Application2</code>, in my application.</p>
  
  <p>the config of <code>AcitivityA</code> in the <code>Manifest</code> file is below:</p>
  
  <pre><code>&lt;activity
     android :name=".activity.ActivityA"
     android :exported="true"
     android :screenOrientation="portrait"/&gt;
  </code></pre>
  
  <p>How do <code>Application1</code> and <code>Application2</code> call <code>ActivityA</code>:</p>
  
  <pre><code>PackageManager packageManager = getPackageManager();
  Intent intent = new Intent();
  intent.setClassName(“com.abc.test", “com.abc.test.activity.ActivityA" );
  List activities = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
  if (activities.size() &gt; 0 ) {
     startActivity(intent);
  }
  </code></pre>
  
  <p>For security, I want to add a whitelist containing <code>Application1</code> and <code>Application2</code>'s package name in <code>ActivityA</code>, which can be opened only if the package name of the <code>ActivityA's</code> caller is in the whitelist.</p>
  
  <p>So is it possible to get the package name of <code>Activities</code>' caller app in <code>ActivityA</code>?</p>
  
  <p>EDITED:</p>
  
  <p>if impossible without extra data in Intent, Any other idea to keep <code>Activity A</code> safety?</p>