private void enforceProfileOwner(ComponentName admin) { if (!admin.equals(profileOwner)) { throw new SecurityException("[" + admin + "] is not a profile owner"); } }
private static <T extends ComponentInfo> T findMatchingComponent( ComponentName componentName, T[] components) { if (components == null) { return null; } for (T component : components) { if (componentName.equals(new ComponentName(component.packageName, component.name))) { return component; } } return null; }
@Implementation protected int[] getAppWidgetIds(ComponentName provider) { List<Integer> idList = new ArrayList<>(); for (int id : widgetInfos.keySet()) { WidgetInfo widgetInfo = widgetInfos.get(id); if (provider.equals(widgetInfo.providerComponent)) { idList.add(id); } } int ids[] = new int[idList.size()]; for (int i = 0; i < idList.size(); i++) { ids[i] = idList.get(i); } return ids; }
private TaskRecord findTaskByIntentLocked(int userId, Intent intent) { for (int i = 0; i < this.mHistory.size(); i++) { TaskRecord r = this.mHistory.valueAt(i); if (userId == r.userId && r.taskRoot != null && intent.getComponent().equals(r.taskRoot.getComponent())) { return r; } } return null; }
private boolean handleUserBroadcast(int vuid, ActivityInfo info, ComponentName component, Intent realIntent, PendingResultData result) { if (component != null && !ComponentUtils.toComponentName(info).equals(component)) { // Verify the component. return false; } String originAction = SpecialComponentList.unprotectAction(realIntent.getAction()); if (originAction != null) { // restore to origin action. realIntent.setAction(originAction); } handleStaticBroadcastAsUser(vuid, info, realIntent, result); return true; }
@HiddenApi @Implementation public void bindAppWidgetId(int appWidgetId, ComponentName provider) { WidgetInfo widgetInfo = new WidgetInfo(provider); widgetInfos.put(appWidgetId, widgetInfo); for (AppWidgetProviderInfo appWidgetProviderInfo : installedProviders) { if (provider != null && provider.equals(appWidgetProviderInfo.provider)) { widgetInfo.info = appWidgetProviderInfo; } } }
if (component1 != null && component2 == null) return 1; if (component1 != null && component2 != null) { if (!component1.equals(component2)) { return component1.compareTo(component2);
T info = componentInResolveInfo.apply(resolveInfo); if (isValidComponentInfo(info) && component.equals(new ComponentName(info.applicationInfo.packageName, info.name))) { result = copyConstructor.apply(info); if (appInfo == null) {
if (topRecord != null && !topRecord.marked && topRecord.component.equals(intent.getComponent())) { deliverNewIntentLocked(sourceRecord, topRecord, intent); delivered = true;
@Override public View display(final Context context, int position, View convertView, FuzzyScore fuzzyScore) { View view = convertView; if (convertView == null) { view = inflateFromId(context, R.layout.item_app); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); TextView appName = view.findViewById(R.id.item_app_name); displayHighlighted(appPojo.normalizedName, appPojo.getName(), fuzzyScore, appName, context); TextView tagsView = view.findViewById(R.id.item_app_tag); // Hide tags view if tags are empty if (appPojo.getTags().isEmpty()) { tagsView.setVisibility(View.GONE); } else if (displayHighlighted(appPojo.getNormalizedTags(), appPojo.getTags(), fuzzyScore, tagsView, context) || prefs.getBoolean("tags-visible", true)) { tagsView.setVisibility(View.VISIBLE); } else { tagsView.setVisibility(View.GONE); } final ImageView appIcon = view.findViewById(R.id.item_app_icon); if (!prefs.getBoolean("icons-hide", false)) { if (appIcon.getTag() instanceof ComponentName && className.equals(appIcon.getTag())) { icon = appIcon.getDrawable(); } this.setAsyncDrawable(appIcon); } else { appIcon.setImageDrawable(null); } return view; }
@Override public boolean equals(Object o) { ComponentKey other = (ComponentKey) o; return other.componentName.equals(componentName) && other.user.equals(user); } }
/** * Returns whether <em>apps</em> contains <em>component</em>. */ private static boolean findActivity(List<LauncherActivityInfoCompat> apps, ComponentName component) { for (LauncherActivityInfoCompat info : apps) { if (info.getComponentName().equals(component)) { return true; } } return false; }
@Override public boolean equals(Object obj) { if (obj instanceof AppLauncher) { return getComponentName().equals(((AppLauncher) obj).getComponentName()); } return super.equals(obj); }
private static List<IntentFilter> getIntentFiltersForComponent( List<? extends Component> components, ComponentName componentName) throws NameNotFoundException { for (Component component : components) { if (component.getComponentName().equals(componentName)) { return component.intents; } } throw new NameNotFoundException("unknown component " + componentName); }
@HiddenApi @Implementation public void bindAppWidgetId(int appWidgetId, ComponentName provider) { WidgetInfo widgetInfo = new WidgetInfo(provider); widgetInfos.put(appWidgetId, widgetInfo); for (AppWidgetProviderInfo appWidgetProviderInfo : installedProviders) { if (provider != null && provider.equals(appWidgetProviderInfo.provider)) { widgetInfo.info = appWidgetProviderInfo; } } }
@HiddenApi @Implementation public void bindAppWidgetId(int appWidgetId, ComponentName provider) { WidgetInfo widgetInfo = new WidgetInfo(provider); widgetInfos.put(appWidgetId, widgetInfo); for (AppWidgetProviderInfo appWidgetProviderInfo : installedProviders) { if (provider != null && provider.equals(appWidgetProviderInfo.provider)) { widgetInfo.info = appWidgetProviderInfo; } } }
@HiddenApi @Implementation public void bindAppWidgetId(int appWidgetId, ComponentName provider) { WidgetInfo widgetInfo = new WidgetInfo(provider); widgetInfos.put(appWidgetId, widgetInfo); for (AppWidgetProviderInfo appWidgetProviderInfo : installedProviders) { if (provider != null && provider.equals(appWidgetProviderInfo.provider)) { widgetInfo.info = appWidgetProviderInfo; } } }