Do not close cursor in onLoadFinished
Apparently in cursor loaders you don't need to manually close the cursor because it does it for you at the end. doing so can also cause crashes on device configuration changes since it will call the method again with the same cursor. Test: robotests still pass Bug: 38208727 Change-Id: I285e56546daf726e74b903856b17dc034d6fd538
This commit is contained in:
@@ -181,13 +181,9 @@ public class PowerUsageSummary extends PowerUsageBase implements
|
||||
if (cursor == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (cursor.moveToFirst()) {
|
||||
mEnhancedEstimate =
|
||||
mPowerFeatureProvider.getTimeRemainingEstimate(cursor);
|
||||
}
|
||||
} finally {
|
||||
cursor.close();
|
||||
if (cursor.moveToFirst()) {
|
||||
mEnhancedEstimate =
|
||||
mPowerFeatureProvider.getTimeRemainingEstimate(cursor);
|
||||
}
|
||||
final long elapsedRealtimeUs = SystemClock.elapsedRealtime() * 1000;
|
||||
Intent batteryBroadcast = getContext().registerReceiver(null,
|
||||
|
Reference in New Issue
Block a user