use of android.content.ComponentName in project VirtualApp by asLody.
the class VPackageManagerService method queryIntentContentProviders.
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, String resolvedType, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
ComponentName comp = intent.getComponent();
if (comp == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
if (intent.getSelector() != null) {
intent = intent.getSelector();
comp = intent.getComponent();
}
}
}
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
final ProviderInfo pi = getProviderInfo(comp, flags, userId);
if (pi != null) {
final ResolveInfo ri = new ResolveInfo();
ri.providerInfo = pi;
list.add(ri);
}
return list;
}
// reader
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
return mProviders.queryIntent(intent, resolvedType, flags, userId);
}
final VPackage pkg = mPackages.get(pkgName);
if (pkg != null) {
return mProviders.queryIntentForPackage(intent, resolvedType, flags, pkg.providers, userId);
}
return null;
}
}
use of android.content.ComponentName in project VirtualApp by asLody.
the class VPackageManagerService method queryIntentReceivers.
@Override
public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
ComponentName comp = intent.getComponent();
if (comp == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
if (intent.getSelector() != null) {
intent = intent.getSelector();
comp = intent.getComponent();
}
}
}
if (comp != null) {
List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
ActivityInfo ai = getReceiverInfo(comp, flags, userId);
if (ai != null) {
ResolveInfo ri = new ResolveInfo();
ri.activityInfo = ai;
list.add(ri);
}
return list;
}
// reader
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
return mReceivers.queryIntent(intent, resolvedType, flags, userId);
}
final VPackage pkg = mPackages.get(pkgName);
if (pkg != null) {
return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers, userId);
}
return null;
}
}
use of android.content.ComponentName in project Talon-for-Twitter by klinker24.
the class TouchableSpan method onClick.
@Override
public void onClick(View widget) {
if (Patterns.WEB_URL.matcher(mValue).find()) {
String url = "http://" + full.replace("http://", "").replace("https://", "").replace("\"", "");
new WebIntentBuilder(mContext).setUrl(url).setShouldForceExternal(extBrowser).build().start();
} else if (Regex.HASHTAG_PATTERN.matcher(mValue).find()) {
// found a hashtag, so open the hashtag search
Intent search;
if (!fromLauncher) {
search = new Intent(mContext, SearchedTrendsActivity.class);
} else {
search = new Intent("android.intent.action.MAIN");
search.setComponent(new ComponentName("com.klinker.android.twitter", "com.klinker.android.twitter.ui.drawer_activities.discover.trends.LauncherSearchedTrends"));
search.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
search.putExtra("current_account", settings.currentAccount);
}
search.setAction(Intent.ACTION_SEARCH);
search.putExtra(SearchManager.QUERY, full);
mContext.startActivity(search);
} else if (Regex.MENTION_PATTERN.matcher(mValue).find()) {
Intent user;
if (!fromLauncher) {
user = new Intent(mContext, ProfilePager.class);
} else {
user = new Intent("android.intent.action.MAIN");
user.setComponent(new ComponentName("com.klinker.android.twitter", "com.klinker.android.twitter.ui.profile_viewer.LauncherProfilePager"));
user.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
user.putExtra("current_account", settings.currentAccount);
}
user.putExtra("screenname", full.replace("@", "").replaceAll(" ", ""));
user.putExtra("proPic", "");
mContext.startActivity(user);
} else if (Regex.CASHTAG_PATTERN.matcher(mValue).find()) {
// found a cashtag, so open the search
Intent search;
if (!fromLauncher) {
search = new Intent(mContext, SearchedTrendsActivity.class);
} else {
search = new Intent("android.intent.action.MAIN");
search.setComponent(new ComponentName("com.klinker.android.twitter", "com.klinker.android.twitter.ui.drawer_activities.discover.trends.LauncherSearchedTrends"));
search.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
search.putExtra("current_account", settings.currentAccount);
}
search.setAction(Intent.ACTION_SEARCH);
search.putExtra(SearchManager.QUERY, full);
mContext.startActivity(search);
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
TouchableMovementMethod.touched = false;
}
}, 500);
}
use of android.content.ComponentName in project Lazy by l123456789jy.
the class AppUtils method isApplicationInBackground.
/**
* whether application is in background
* <ul>
* <li>need use permission android.permission.GET_TASKS in Manifest.xml</li>
* </ul>
*
* @param context 上下文
* @return if application is in background return true, otherwise return
* false
*/
public static boolean isApplicationInBackground(Context context) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> taskList = am.getRunningTasks(1);
if (taskList != null && !taskList.isEmpty()) {
ComponentName topActivity = taskList.get(0).topActivity;
if (topActivity != null && !topActivity.getPackageName().equals(context.getPackageName())) {
return true;
}
}
return false;
}
use of android.content.ComponentName in project goro by stanfy.
the class BaseBindingGoroTest method init.
@Before
public void init() {
context = Robolectric.setupActivity(Activity.class);
shadowContext = Shadows.shadowOf(context);
testingQueues = new TestingQueues();
serviceInstance = spy(new Goro.GoroImpl(testingQueues));
serviceCompName = new ComponentName(context, GoroService.class);
GoroService service = new GoroService();
binder = new GoroService.GoroBinderImpl(serviceInstance, service.new GoroTasksListener());
ShadowApplication.getInstance().setComponentNameAndServiceForBindService(serviceCompName, binder);
reset(serviceInstance);
}
Aggregations