InstalledAppProvider extends FDroidProvider { @Override public int update(@NonNull Uri uri, ContentValues values, String where, String[] whereArgs) { throw new UnsupportedOperationException("\"Update' not supported for installed appp provider." + " Instead, you should insert, and it will overwrite the relevant rows if one exists."); }  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);  }
@Test public void testUpdate() { insertInstalledApp("com.example.app1", 10, "1.0"); insertInstalledApp("com.example.app2", 10, "1.0"); assertResultCount(contentResolver, 2, InstalledAppProvider.getContentUri()); assertIsInstalledVersionInDb(contentResolver, "com.example.app2", 10, "1.0"); contentResolver.insert( InstalledAppProvider.getContentUri(), createContentValues("com.example.app2", 11, "1.1") ); assertResultCount(contentResolver, 2, InstalledAppProvider.getContentUri()); assertIsInstalledVersionInDb(contentResolver, "com.example.app2", 11, "1.1"); }