From e3fec0f177f718489d7103270c85e6bd2bfec556 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 6 Sep 2018 16:26:31 -0700 Subject: [PATCH] Ignore any error when killing our process Bug: 113929153 Change-Id: Ie9a8b59fda1f813748404ed529269cccb1e28c61 --- src/com/android/launcher3/util/ConfigMonitor.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/util/ConfigMonitor.java b/src/com/android/launcher3/util/ConfigMonitor.java index 611931d28a..5dd0d08d67 100644 --- a/src/com/android/launcher3/util/ConfigMonitor.java +++ b/src/com/android/launcher3/util/ConfigMonitor.java @@ -111,8 +111,12 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayListener private void killProcess() { Log.d(TAG, "restarting launcher"); - mContext.unregisterReceiver(this); - mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); + try { + mContext.unregisterReceiver(this); + mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); + } catch (Exception e) { + // We are going to die anyway, ignore any error die to race condition in registering. + } android.os.Process.killProcess(android.os.Process.myPid()); }