Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-DeskClock: Commit

packages/apps/DeskClock


Commit MetaInfo

Révision5d1b236620eec1456ca1e9a30085ce2ae27e984d (tree)
l'heure2010-04-27 22:17:40
AuteurDaniel Sandler <dsandler@andr...>
CommiterDaniel Sandler

Message de Log

Switch to explicitly managed cursors for weather query.

Previously, DeskClock used Activity.managedQuery, which
didn't exactly leak cursors, but it allowed them to
accumulate as long as the DeskClock Activity was running.
When used overnight as a bedside clock, the Activity can run
for a very long time without being paused.

Bug: 2627720
Change-Id: If4d53d3d6cba9dd96b41a3e25f4c8fad75339c42

Change Summary

Modification

--- a/src/com/android/deskclock/DeskClock.java
+++ b/src/com/android/deskclock/DeskClock.java
@@ -23,6 +23,7 @@ import android.app.PendingIntent;
2323 import android.app.UiModeManager;
2424 import android.content.BroadcastReceiver;
2525 import android.content.Context;
26+import android.content.ContentResolver;
2627 import android.content.DialogInterface;
2728 import android.content.Intent;
2829 import android.content.IntentFilter;
@@ -389,7 +390,7 @@ public class DeskClock extends Activity {
389390
390391 Cursor cur;
391392 try {
392- cur = managedQuery(
393+ cur = getContentResolver().query(
393394 queryUri,
394395 WEATHER_CONTENT_COLUMNS,
395396 null,
@@ -447,6 +448,11 @@ public class DeskClock extends Activity {
447448 mWeatherLowTemperatureString = "";
448449 }
449450
451+ if (cur != null) {
452+ // clean up cursor
453+ cur.close();
454+ }
455+
450456 mHandy.sendEmptyMessage(UPDATE_WEATHER_DISPLAY_MSG);
451457 }
452458
Afficher sur ancien navigateur de dépôt.