use of android.content.pm.ComponentInfo in project VirtualApp by asLody.
the class GetIntentSender method redirectIntentSender.
private Intent redirectIntentSender(int type, String creator, Intent intent) {
Intent newIntent = intent.cloneFilter();
switch(type) {
case ActivityManagerCompat.INTENT_SENDER_ACTIVITY:
{
ComponentInfo info = VirtualCore.get().resolveActivityInfo(intent, VUserHandle.myUserId());
if (info != null) {
newIntent.setClass(getHostContext(), StubPendingActivity.class);
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
}
break;
case ActivityManagerCompat.INTENT_SENDER_SERVICE:
{
ComponentInfo info = VirtualCore.get().resolveServiceInfo(intent, VUserHandle.myUserId());
if (info != null) {
newIntent.setClass(getHostContext(), StubPendingService.class);
}
}
break;
case ActivityManagerCompat.INTENT_SENDER_BROADCAST:
{
newIntent.setClass(getHostContext(), StubPendingReceiver.class);
}
break;
default:
return null;
}
newIntent.putExtra(StubManifest.IDENTITY_PREFIX + "_user_id_", VUserHandle.myUserId());
newIntent.putExtra(StubManifest.IDENTITY_PREFIX + "_intent_", intent);
newIntent.putExtra(StubManifest.IDENTITY_PREFIX + "_creator_", creator);
newIntent.putExtra(StubManifest.IDENTITY_PREFIX + "_from_inner_", true);
return newIntent;
}
use of android.content.pm.ComponentInfo in project qksms by moezbhatti.
the class MainActivity method showDialogIfNeeded.
/**
* Shows at most one dialog using the intent extras and the restored state of the activity.
*
* @param savedInstanceState restored state
*/
private void showDialogIfNeeded(Bundle savedInstanceState) {
// Check if the intent has the ICON_COLOR_CHANGED action; if so, show a new dialog.
if (getIntent().getBooleanExtra(IconColorReceiver.EXTRA_ICON_COLOR_CHANGED, false)) {
// Clear the flag in the intent so that the dialog doesn't show up anymore
getIntent().putExtra(IconColorReceiver.EXTRA_ICON_COLOR_CHANGED, false);
// Display a dialog showcasing the new icon!
ImageView imageView = new ImageView(this);
PackageManager manager = getPackageManager();
try {
ComponentInfo info = manager.getActivityInfo(getComponentName(), 0);
imageView.setImageDrawable(ContextCompat.getDrawable(getBaseContext(), info.getIconResource()));
} catch (PackageManager.NameNotFoundException ignored) {
}
new QKDialog().setContext(this).setTitle(getString(R.string.icon_ready)).setMessage(R.string.icon_ready_message).setCustomView(imageView).setPositiveButton(R.string.okay, null).show();
// Only show the MMS setup fragment if it hasn't already been dismissed
} else if (!wasMmsSetupFragmentDismissed(savedInstanceState)) {
beginMmsSetup();
}
}
Aggregations