@Test public void testDelete() { insertInstalledApp("com.example.app1", 10, "1.0"); insertInstalledApp("com.example.app2", 10, "1.0"); assertResultCount(contentResolver, 2, InstalledAppProvider.getContentUri()); contentResolver.delete(InstalledAppProvider.getAppUri("com.example.app1"), null, null); assertResultCount(contentResolver, 1, InstalledAppProvider.getContentUri()); assertIsInstalledVersionInDb(contentResolver, "com.example.app2", 10, "1.0"); }
@Override public int delete(@NonNull Uri uri, String where, String[] whereArgs) { if (MATCHER.match(uri) != CODE_SINGLE) { throw new UnsupportedOperationException("Delete not supported for " + uri + "."); } String packageName = uri.getLastPathSegment(); QuerySelection query = new QuerySelection(where, whereArgs); query = query.add(queryAppSubQuery(packageName)); int count = db().delete(getTableName(), query.getSelection(), query.getArgs()); AppProvider.Helper.calcSuggestedApk(getContext(), packageName); return count; }
InstalledAppProvider extends FDroidProvider { @Override public int delete(@NonNull Uri uri, String where, String[] whereArgs) { if (MATCHER.match(uri) != CODE_SINGLE) { throw new UnsupportedOperationException("Delete not supported for " + uri + "."); } String packageName = uri.getLastPathSegment(); QuerySelection query = new QuerySelection(where, whereArgs); query = query.add(queryAppSubQuery(packageName)); int count = db().delete(getTableName(), query.getSelection(), query.getArgs()); AppProvider.Helper.calcSuggestedApk(getContext(), packageName); return count; } }
InstalledAppProvider extends FDroidProvider { @Override public int delete(@NonNull Uri uri, String where, String[] whereArgs) { if (MATCHER.match(uri) != CODE_SINGLE) { throw new UnsupportedOperationException("Delete not supported for " + uri + "."); } String packageName = uri.getLastPathSegment(); QuerySelection query = new QuerySelection(where, whereArgs); query = query.add(queryAppSubQuery(packageName)); int count = db().delete(getTableName(), query.getSelection(), query.getArgs()); AppProvider.Helper.calcSuggestedApk(getContext(), packageName); return count; }  }
InstalledAppProvider extends FDroidProvider { @Override public int delete(@NonNull Uri uri, String where, String[] whereArgs) { if (MATCHER.match(uri) != CODE_SINGLE) { throw new UnsupportedOperationException("Delete not supported for " + uri + "."); } String packageName = uri.getLastPathSegment(); QuerySelection query = new QuerySelection(where, whereArgs); query = query.add(queryAppSubQuery(packageName)); int count = db().delete(getTableName(), query.getSelection(), query.getArgs()); AppProvider.Helper.calcSuggestedApk(getContext(), packageName); return count; }  static Uri getContentUri(); static Uri getAllAppsUri(); static Uri getAppUri(String packageName); static Uri getSearchUri(String keywords); static String getApplicationLabel(Context context, String packageName); static String getAuthority(); @Override Cursor query(@NonNull Uri uri, String[] projection,
                        String customSelection, String[] selectionArgs, String sortOrder); @Override int delete(@NonNull Uri uri, String where, String[] whereArgs); @Override Uri insert(@NonNull Uri uri, ContentValues values); @Override int update(@NonNull Uri uri, ContentValues values, String where, String[] whereArgs); }
InstalledAppProvider extends FDroidProvider { @Override public int delete(@NonNull Uri uri, String where, String[] whereArgs) { if (MATCHER.match(uri) != CODE_SINGLE) { throw new UnsupportedOperationException("Delete not supported for " + uri + "."); } String packageName = uri.getLastPathSegment(); QuerySelection query = new QuerySelection(where, whereArgs); query = query.add(queryAppSubQuery(packageName)); int count = db().delete(getTableName(), query.getSelection(), query.getArgs()); AppProvider.Helper.calcSuggestedApk(getContext(), packageName); return count; }  static Uri getContentUri(); static Uri getAllAppsUri(); static Uri getAppUri(String packageName); static Uri getSearchUri(String keywords); static String getApplicationLabel(Context context, String packageName); static String getAuthority(); @Override Cursor query(@NonNull Uri uri, String[] projection,
                        String customSelection, String[] selectionArgs, String sortOrder); @Override int delete(@NonNull Uri uri, String where, String[] whereArgs); @Override Uri insert(@NonNull Uri uri, ContentValues values); @Override int update(@NonNull Uri uri, ContentValues values, String where, String[] whereArgs);  }