Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89a0c21b authored by Maunik Shah's avatar Maunik Shah Committed by Linux Build Service Account
Browse files

Add looper to the thread to fix system_server crash

Toast message internally creates handler and we can't create
handler inside thread that has not called Looper.prepare().
Thus, we added looper to the thread to avoid system_server
carsh.

Change-Id: I09b9c4923c109f0b2707f8346e091efbd24b5089
CRs-Fixed: 669467
parent f8b59f39
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ import android.os.storage.StorageVolume;
import android.util.Log;
import android.view.WindowManager;
import android.widget.Toast;
import android.os.Looper;

import com.android.internal.R;
import java.util.ArrayList;
@@ -260,6 +261,7 @@ public class ExternalStorageFormatter extends Service
                            mIsFormatSuccess = true;
                            success = true;
                        } catch (Exception e) {
                            Looper.prepare();
                            Toast.makeText(ExternalStorageFormatter.this,
                                    R.string.format_error, Toast.LENGTH_LONG).show();
                        }