Refined the CardContentProvider unused operations

updated delete and update operations to throw UnsupportedOperationException

Bug: 119647595
Test: robotest
Change-Id: If77662213b89dc91b9ca2d6b028c635a46266eab
This commit is contained in:
Sunny Shao
2018-11-16 15:44:53 +08:00
parent 4fa2b88556
commit 8e5807fcc9
2 changed files with 4 additions and 82 deletions

View File

@@ -98,17 +98,7 @@ public class CardContentProvider extends ContentProvider {
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
final StrictMode.ThreadPolicy oldPolicy = StrictMode.getThreadPolicy();
try {
maybeEnableStrictMode();
final SQLiteDatabase database = mDBHelper.getWritableDatabase();
final String table = getTableFromMatch(uri);
final int rowsDeleted = database.delete(table, selection, selectionArgs);
getContext().getContentResolver().notifyChange(uri, null /* observer */);
return rowsDeleted;
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
throw new UnsupportedOperationException("delete operation not supported currently.");
}
@Override
@@ -140,18 +130,7 @@ public class CardContentProvider extends ContentProvider {
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
final StrictMode.ThreadPolicy oldPolicy = StrictMode.getThreadPolicy();
try {
maybeEnableStrictMode();
final SQLiteDatabase database = mDBHelper.getWritableDatabase();
final String table = getTableFromMatch(uri);
final int rowsUpdated = database.update(table, values, selection, selectionArgs);
getContext().getContentResolver().notifyChange(uri, null /* observer */);
return rowsUpdated;
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
throw new UnsupportedOperationException("update operation not supported currently.");
}
@VisibleForTesting