Ignore any error when killing our process

Bug: 113929153
Change-Id: Ie9a8b59fda1f813748404ed529269cccb1e28c61
This commit is contained in:
Sunny Goyal 2018-09-06 16:26:31 -07:00
parent cf300fc980
commit e3fec0f177
1 changed files with 6 additions and 2 deletions

View File

@ -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());
}