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

Commit 3829e1a7 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Promotion of atel.lnx.2.0.c1-00006.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
837202   Id6c6b6231618378c27216dbf0e13a665cbae1022   Move main thread in IPBIM to other thread to fix deadloc

Change-Id: Icb54fe5ae7db902f23374c7668f1a604f2f24ca2
CRs-Fixed: 837202
parents 7687a133 314dac74
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.internal.telephony;
import android.content.ContentValues;
import android.content.pm.PackageManager;
import android.os.AsyncResult;
import android.os.HandlerThread;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -62,7 +63,18 @@ public class IccPhoneBookInterfaceManager {
    protected static final int EVENT_LOAD_DONE = 2;
    protected static final int EVENT_UPDATE_DONE = 3;

    protected Handler mBaseHandler = new Handler() {
    protected final IccPbHandler mBaseHandler;

    private static final HandlerThread  mHandlerThread  = new HandlerThread("IccPbHandlerLoader");
    static {
        mHandlerThread.start();
    }

    protected class IccPbHandler extends Handler {
        public IccPbHandler(Looper looper) {
            super(looper);
        }

        @Override
        public void handleMessage(Message msg) {
            AsyncResult ar;
@@ -132,6 +144,8 @@ public class IccPhoneBookInterfaceManager {
                        phone.getContext(), phone.getPhoneId(), phone.mCi);
            }
        }

        mBaseHandler = new IccPbHandler(mHandlerThread.getLooper());
    }

    public void dispose() {
@@ -421,7 +435,7 @@ public class IccPhoneBookInterfaceManager {
    protected void checkThread() {
        if (!ALLOW_SIM_OP_IN_UI_THREAD) {
            // Make sure this isn't the UI thread, since it will block
            if (mBaseHandler.getLooper().equals(Looper.myLooper())) {
            if (Looper.getMainLooper().equals(Looper.myLooper())) {
                loge("query() called on the main UI thread!");
                throw new IllegalStateException(
                        "You cannot call query on this provder from the main UI thread.");