@Override public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException { Bundle extra = new Bundle(); extra.putInt("app_badge_count", badgeCount); extra.putString("app_badge_component_name", componentName.flattenToString()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { context.getContentResolver().call( Uri.parse("content://com.android.launcher3.cornermark.unreadbadge"), "setAppUnreadCount", null, extra); } }
@Override protected void onListItemClick(ListView l, View v, int position, long id) { ResolveInfo launchable=adapter.getItem(position); ActivityInfo activity=launchable.activityInfo; ComponentName name=new ComponentName(activity.applicationInfo.packageName, activity.name); PreferenceManager .getDefaultSharedPreferences(this) .edit() .putString(SidecarTileService.PREF_TO_LAUNCH, name.flattenToString()) .apply(); Toast .makeText(this, R.string.msg_saved, Toast.LENGTH_LONG) .show(); finish(); }
@Override protected void onListItemClick(ListView l, View v, int position, long id) { ResolveInfo launchable=adapter.getItem(position); ActivityInfo activity=launchable.activityInfo; ComponentName name=new ComponentName(activity.applicationInfo.packageName, activity.name); PreferenceManager .getDefaultSharedPreferences(this) .edit() .putString(FreecarTileService.PREF_TO_LAUNCH, name.flattenToString()) .apply(); Toast .makeText(this, R.string.msg_saved, Toast.LENGTH_LONG) .show(); finish(); }
public IntentAssert hasComponent(ComponentName expected) { isNotNull(); ComponentName componentName = actual.getComponent(); assertThat(componentName).isNotNull() .overridingErrorMessage("Expected component name <%s> but was <%s>.", expected.flattenToString(), componentName.flattenToString()) .isEqualTo(expected); return this; }
private Intent startActivityProcess(int userId, ActivityRecord sourceRecord, Intent intent, ActivityInfo info) { intent = new Intent(intent); ProcessRecord targetApp = mService.startProcessIfNeedLocked(info.processName, userId, info.packageName); if (targetApp == null) { return null; } Intent targetIntent = new Intent(); targetIntent.setClassName(VirtualCore.get().getHostPkg(), fetchStubActivity(targetApp.vpid, info)); ComponentName component = intent.getComponent(); if (component == null) { component = ComponentUtils.toComponentName(info); } targetIntent.setType(component.flattenToString()); StubActivityRecord saveInstance = new StubActivityRecord(intent, info, sourceRecord != null ? sourceRecord.component : null, userId); saveInstance.saveToIntent(targetIntent); return targetIntent; }
LogManager.e( TAG, "Failed attempting to start service: " + intent.getComponent().flattenToString(),
private static ComponentName applyRedirect (ComponentName original) { if (COMPONENT_REDIRECT == null || !COMPONENT_REDIRECT.containsKey(original.flattenToString())) return original; return ComponentName.unflattenFromString(COMPONENT_REDIRECT.get(original.flattenToString())); }
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { List<ActivityManager.RunningTaskInfo> serviceInfoList = (List) param.getResult(); List<ActivityManager.RunningTaskInfo> resultList = new ArrayList<>(); for (ActivityManager.RunningTaskInfo runningTaskInfo : serviceInfoList) { String taskName = runningTaskInfo.baseActivity.flattenToString(); if (isTarget(taskName)) { log("Hid task: " + taskName); } else { resultList.add(runningTaskInfo); } } param.setResult(resultList); } });
/** * Encodes a component key as a string of the form [flattenedComponentString#userId]. */ @Override public String toString() { return componentName.flattenToString() + "#" + user; } }
/** * Encodes a component key as a string of the form [flattenedComponentString#userId]. */ @Override public String toString() { return componentName.flattenToString() + "#" + user; } }
public static boolean isServiceEnabled(Context context) { ComponentName componentName = new ComponentName(context, NotificationListener.class); String notificationListeners = Settings.Secure.getString(context.getContentResolver(), "enabled_notification_listeners"); return (notificationListeners != null && notificationListeners.contains(componentName.flattenToString())); }
private void setUnreadCount(ComponentName compName, int count) { unreadCount.put(compName, count); if (count==0) { prefs.edit().remove(compName.flattenToString()).apply(); } else { prefs.edit().putInt(compName.flattenToString(), count).apply(); } if (badgerCountChangeListener!=null) badgerCountChangeListener.badgerCountChanged(compName, count); }
@Override void onAddToDatabase(Context context, ContentValues values) { super.onAddToDatabase(context, values); values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId); values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, providerName.flattenToString()); values.put(LauncherSettings.Favorites.RESTORED, restoreStatus); }
@Override void onAddToDatabase(Context context, ContentValues values) { super.onAddToDatabase(context, values); values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId); values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, providerName.flattenToString()); values.put(LauncherSettings.Favorites.RESTORED, restoreStatus); }
@Override public void executeBadge(Context context, ComponentName componentName, int badgeCount) throws ShortcutBadgeException { Bundle extra = new Bundle(); extra.putInt("app_badge_count", badgeCount); extra.putString("app_badge_component_name", componentName.flattenToString()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { context.getContentResolver().call( Uri.parse("content://com.android.launcher3.cornermark.unreadbadge"), "setAppUnreadCount", null, extra); } }
@Override void onAddToDatabase(Context context, ContentValues values) { super.onAddToDatabase(context, values); values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId); values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, providerName.flattenToString()); values.put(LauncherSettings.Favorites.RESTORED, restoreStatus); values.put(LauncherSettings.Favorites.INTENT, bindOptions == null ? null : bindOptions.toUri(0)); }
@Override void onAddToDatabase(Context context, ContentValues values) { super.onAddToDatabase(context, values); values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId); values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, providerName.flattenToString()); values.put(LauncherSettings.Favorites.RESTORED, restoreStatus); values.put(LauncherSettings.Favorites.INTENT, bindOptions == null ? null : bindOptions.toUri(0)); }
/** * Updates {@param values} to contain versoning information and adds it to the DB. * @param values {@link ContentValues} containing icon & title */ private void addIconToDB(ContentValues values, ComponentName key, PackageInfo info, long userSerial) { values.put(IconDB.COLUMN_COMPONENT, key.flattenToString()); values.put(IconDB.COLUMN_USER, userSerial); values.put(IconDB.COLUMN_LAST_UPDATED, info.lastUpdateTime); values.put(IconDB.COLUMN_VERSION, info.versionCode); mIconDb.getWritableDatabase().insertWithOnConflict(IconDB.TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_REPLACE); }
/** * Encodes a component key as a string of the form [flattenedComponentString#userId]. */ public String flattenToString(Context context) { String flattened = componentName.flattenToString(); if (user != null) { flattened += "#" + UserManagerCompat.getInstance(context).getSerialNumberForUser(user); } return flattened; }
protected void startSystemUI(final Activity activity) { if (isSystemUIRunning()) { data.get(activity.getComponentName()).fullScreenState.set(false); return; } exec(false, activity, AM_PATH, "startservice", "-n", SYS_UI.flattenToString()); }