Merge "Close slice cursor when done using."

This commit is contained in:
TreeHugger Robot
2019-02-05 22:57:45 +00:00
committed by Android (Google) Code Review

View File

@@ -75,8 +75,9 @@ public class SlicesDatabaseAccessor {
if (pathData == null) { if (pathData == null) {
throw new IllegalStateException("Invalid Slices uri: " + uri); throw new IllegalStateException("Invalid Slices uri: " + uri);
} }
Cursor cursor = getIndexedSliceData(pathData.second /* key */); try (Cursor cursor = getIndexedSliceData(pathData.second /* key */)) {
return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */); return buildSliceData(cursor, uri, pathData.first /* isIntentOnly */);
}
} }
/** /**
@@ -85,8 +86,9 @@ public class SlicesDatabaseAccessor {
* Used when handling the action of the {@link Slice}. * Used when handling the action of the {@link Slice}.
*/ */
public SliceData getSliceDataFromKey(String key) { public SliceData getSliceDataFromKey(String key) {
Cursor cursor = getIndexedSliceData(key); try (Cursor cursor = getIndexedSliceData(key)) {
return buildSliceData(cursor, null /* uri */, false /* isIntentOnly */); return buildSliceData(cursor, null /* uri */, false /* isIntentOnly */);
}
} }
/** /**