OSDN Git Service

Fix 3379239: Catch exceptions from workaround for OOM.
authorJim Miller <jaggies@google.com>
Sun, 23 Jan 2011 21:40:31 +0000 (13:40 -0800)
committerJim Miller <jaggies@google.com>
Sun, 23 Jan 2011 21:40:31 +0000 (13:40 -0800)
This catches possible exceptions caused by attempting to
unregister a receiver that may have already been unregistered.
This is related to the OOM issue workaround in Change I99a7e0c3.

Change-Id: Ib69a8acc6b12659125c958a03efac0a8a68a3859

core/java/com/android/internal/widget/DigitalClock.java

index 303a1bf..7289751 100644 (file)
@@ -80,7 +80,11 @@ public class DigitalClock extends LinearLayout {
                     }
                 });
             } else {
-                mContext.unregisterReceiver(this);
+                try {
+                    mContext.unregisterReceiver(this);
+                } catch (RuntimeException e) {
+                    // Shouldn't happen
+                }
             }
         }
     };
@@ -124,7 +128,11 @@ public class DigitalClock extends LinearLayout {
                 digitalClock.setDateFormat();
                 digitalClock.updateTime();
             } else {
-                mContext.getContentResolver().unregisterContentObserver(this);
+                try {
+                    mContext.getContentResolver().unregisterContentObserver(this);
+                } catch (RuntimeException e) {
+                    // Shouldn't happen
+                }
             }
         }
     }