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

Commit c5c4019f authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5335706 from 6cb1e946 to qt-release

Change-Id: I1c309ce057689286dd72ef6aa2529c696370705a
parents 0ee20673 6cb1e946
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -619,6 +619,24 @@ message RilDataCall {

  // The network interface name e.g. wlan0, rmnet_data0.
  optional string iframe = 3;

  // State of the Data Call connection
  optional State state = 4;

  // Bitmask of APN types
  optional int32 apn_type_bitmask = 5;

  enum State {

    // Unknown event
    UNKNOWN = 0;

    // Connected event
    CONNECTED = 1;

    // Disconnected event
    DISCONNECTED = 2;
  }
}

message TelephonyEvent {
+76 −89
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
import com.android.internal.telephony.uicc.IccConstants;
import com.android.internal.telephony.uicc.IccFileHandler;
import com.android.internal.telephony.uicc.IccRecords;
import com.android.internal.telephony.uicc.UiccCardApplication;

import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -43,76 +42,67 @@ public class IccPhoneBookInterfaceManager {
    protected static final boolean DBG = true;

    protected Phone mPhone;
    private   UiccCardApplication mCurrentApp = null;
    protected AdnRecordCache mAdnCache;
    protected final Object mLock = new Object();
    protected int mRecordSize[];
    protected boolean mSuccess;
    private   boolean mIs3gCard = false;  // flag to determine if card is 3G or 2G
    protected List<AdnRecord> mRecords;


    protected static final boolean ALLOW_SIM_OP_IN_UI_THREAD = false;

    protected static final int EVENT_GET_SIZE_DONE = 1;
    protected static final int EVENT_LOAD_DONE = 2;
    protected static final int EVENT_UPDATE_DONE = 3;

    private static final class Request {
        AtomicBoolean mStatus = new AtomicBoolean(false);
        Object mResult = null;
    }

    protected Handler mBaseHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            AsyncResult ar;
            AsyncResult ar = (AsyncResult) msg.obj;
            Request request = (Request) ar.userObj;

            switch (msg.what) {
                case EVENT_GET_SIZE_DONE:
                    ar = (AsyncResult) msg.obj;
                    synchronized (mLock) {
                    int[] recordSize = null;
                    if (ar.exception == null) {
                            mRecordSize = (int[])ar.result;
                        recordSize = (int[]) ar.result;
                        // recordSize[0]  is the record length
                        // recordSize[1]  is the total length of the EF file
                        // recordSize[2]  is the number of records in the EF file
                            logd("GET_RECORD_SIZE Size " + mRecordSize[0] +
                                    " total " + mRecordSize[1] +
                                    " #record " + mRecordSize[2]);
                        logd("GET_RECORD_SIZE Size " + recordSize[0]
                                + " total " + recordSize[1]
                                + " #record " + recordSize[2]);
                    } else {
                        loge("EVENT_GET_SIZE_DONE: failed; ex=" + ar.exception);
                    }
                        notifyPending(ar);
                    }
                    notifyPending(request, recordSize);
                    break;
                case EVENT_UPDATE_DONE:
                    ar = (AsyncResult) msg.obj;
                    synchronized (mLock) {
                        mSuccess = (ar.exception == null);
                        if (!mSuccess) {
                    boolean success = (ar.exception == null);
                    if (!success) {
                        loge("EVENT_UPDATE_DONE - failed; ex=" + ar.exception);
                    }
                        notifyPending(ar);
                    }
                    notifyPending(request, success);
                    break;
                case EVENT_LOAD_DONE:
                    ar = (AsyncResult)msg.obj;
                    synchronized (mLock) {
                    List<AdnRecord> records = null;
                    if (ar.exception == null) {
                            mRecords = (List<AdnRecord>) ar.result;
                        records = (List<AdnRecord>) ar.result;
                    } else {
                        loge("EVENT_LOAD_DONE: Cannot load ADN records; ex="
                                + ar.exception);
                            mRecords = null;
                        }
                        notifyPending(ar);
                    }
                    notifyPending(request, records);
                    break;
            }
        }

        private void notifyPending(AsyncResult ar) {
            if (ar.userObj != null) {
                AtomicBoolean status = (AtomicBoolean) ar.userObj;
                status.set(true);
        private void notifyPending(Request request, Object result) {
            if (request != null) {
                synchronized (request) {
                    request.mResult = result;
                    request.mStatus.set(true);
                    request.notifyAll();
                }
            }
            mLock.notifyAll();
        }
    };

@@ -184,21 +174,20 @@ public class IccPhoneBookInterfaceManager {

        efid = updateEfForIccType(efid);

        synchronized(mLock) {
        checkThread();
            mSuccess = false;
            AtomicBoolean status = new AtomicBoolean(false);
            Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, status);
        Request updateRequest = new Request();
        synchronized (updateRequest) {
            Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, updateRequest);
            AdnRecord oldAdn = new AdnRecord(oldTag, oldPhoneNumber);
            AdnRecord newAdn = new AdnRecord(newTag, newPhoneNumber);
            if (mAdnCache != null) {
                mAdnCache.updateAdnBySearch(efid, oldAdn, newAdn, pin2, response);
                waitForResult(status);
                waitForResult(updateRequest);
            } else {
                loge("Failure while trying to update by search due to uninitialised adncache");
            }
        }
        return mSuccess;
        return (boolean) updateRequest.mResult;
    }

    /**
@@ -233,20 +222,21 @@ public class IccPhoneBookInterfaceManager {
                Integer.toHexString(efid).toUpperCase() + " Index=" + index + " ==> " + "(" +
                Rlog.pii(LOG_TAG, newTag) + "," + Rlog.pii(LOG_TAG, newPhoneNumber) + ")" +
                " pin2=" + Rlog.pii(LOG_TAG, pin2));
        synchronized(mLock) {


        checkThread();
            mSuccess = false;
            AtomicBoolean status = new AtomicBoolean(false);
            Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, status);
        Request updateRequest = new Request();
        synchronized (updateRequest) {
            Message response = mBaseHandler.obtainMessage(EVENT_UPDATE_DONE, updateRequest);
            AdnRecord newAdn = new AdnRecord(newTag, newPhoneNumber);
            if (mAdnCache != null) {
                mAdnCache.updateAdnByIndex(efid, newAdn, index, pin2, response);
                waitForResult(status);
                waitForResult(updateRequest);
            } else {
                loge("Failure while trying to update by index due to uninitialised adncache");
            }
        }
        return mSuccess;
        return (boolean) updateRequest.mResult;
    }

    /**
@@ -260,22 +250,19 @@ public class IccPhoneBookInterfaceManager {
     */
    public int[] getAdnRecordsSize(int efid) {
        if (DBG) logd("getAdnRecordsSize: efid=" + efid);
        synchronized(mLock) {
        checkThread();
            mRecordSize = new int[3];

        Request getSizeRequest = new Request();
        synchronized (getSizeRequest) {
            //Using mBaseHandler, no difference in EVENT_GET_SIZE_DONE handling
            AtomicBoolean status = new AtomicBoolean(false);
            Message response = mBaseHandler.obtainMessage(EVENT_GET_SIZE_DONE, status);

            Message response = mBaseHandler.obtainMessage(EVENT_GET_SIZE_DONE, getSizeRequest);
            IccFileHandler fh = mPhone.getIccFileHandler();
            if (fh != null) {
                fh.getEFLinearRecordSize(efid, response);
                waitForResult(status);
                waitForResult(getSizeRequest);
            }
        }

        return mRecordSize;
        return getSizeRequest.mResult == null ? new int[3] : (int[]) getSizeRequest.mResult;
    }


@@ -300,22 +287,21 @@ public class IccPhoneBookInterfaceManager {
        efid = updateEfForIccType(efid);
        if (DBG) logd("getAdnRecordsInEF: efid=0x" + Integer.toHexString(efid).toUpperCase());

        synchronized(mLock) {
        checkThread();
            AtomicBoolean status = new AtomicBoolean(false);
            Message response = mBaseHandler.obtainMessage(EVENT_LOAD_DONE, status);
        Request loadRequest = new Request();
        synchronized (loadRequest) {
            Message response = mBaseHandler.obtainMessage(EVENT_LOAD_DONE, loadRequest);
            if (mAdnCache != null) {
                mAdnCache.requestLoadAllAdnLike(efid, mAdnCache.extensionEfForEf(efid), response);
                waitForResult(status);
                waitForResult(loadRequest);
            } else {
                loge("Failure while trying to load from SIM due to uninitialised adncache");
            }
        }
        return mRecords;
        return (List<AdnRecord>) loadRequest.mResult;
    }

    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())) {
            loge("query() called on the main UI thread!");
@@ -323,17 +309,18 @@ public class IccPhoneBookInterfaceManager {
                    "You cannot call query on this provder from the main UI thread.");
        }
    }
    }

    protected void waitForResult(AtomicBoolean status) {
        while (!status.get()) {
    protected void waitForResult(Request request) {
        synchronized (request) {
            while (!request.mStatus.get()) {
                try {
                mLock.wait();
                    request.wait();
                } catch (InterruptedException e) {
                    logd("interrupted while trying to update by search");
                }
            }
        }
    }

    private int updateEfForIccType(int efid) {
        // Check if we are trying to read ADN records
+5 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.dataconnection.DcTracker.ReleaseNetworkType;
import com.android.internal.telephony.dataconnection.DcTracker.RequestNetworkType;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.nano.TelephonyProto.RilDataCall;
import com.android.internal.util.AsyncChannel;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Protocol;
@@ -1842,6 +1843,8 @@ public class DataConnection extends StateMachine {
                mPhone.mCi.registerForLceInfo(
                        getHandler(), DataConnection.EVENT_LINK_CAPACITY_CHANGED, null);
            }
            TelephonyMetrics.getInstance().writeRilDataCallEvent(mPhone.getPhoneId(),
                    mCid, mApnSetting.getApnTypeBitmask(), RilDataCall.State.CONNECTED);
        }

        @Override
@@ -1876,6 +1879,8 @@ public class DataConnection extends StateMachine {
                }
                mNetworkAgent = null;
            }
            TelephonyMetrics.getInstance().writeRilDataCallEvent(mPhone.getPhoneId(),
                    mCid, mApnSetting.getApnTypeBitmask(), RilDataCall.State.DISCONNECTED);
        }

        @Override
+1 −31
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.CANONI
import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_ALIAS_COLUMN;
import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN;
import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI;
import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI_PART;
import static android.provider.Telephony.RcsColumns.RcsParticipantEventColumns.NEW_ALIAS_COLUMN;
import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_ID_COLUMN;
import static android.provider.Telephony.RcsColumns.RcsThreadEventColumns.DESTINATION_PARTICIPANT_ID_COLUMN;
@@ -99,7 +98,6 @@ import android.telephony.ims.RcsMessageQueryResult;
import android.telephony.ims.RcsMessageSnippet;
import android.telephony.ims.RcsMessageStore;
import android.telephony.ims.RcsOutgoingMessageCreationParams;
import android.telephony.ims.RcsParticipant;
import android.telephony.ims.RcsParticipantQueryParams;
import android.telephony.ims.RcsParticipantQueryResult;
import android.telephony.ims.RcsQueryContinuationToken;
@@ -244,35 +242,7 @@ public class RcsMessageStoreController extends IRcs.Stub {

    @Override
    public int createRcs1To1Thread(int recipientId) throws RemoteException {
        // Look up if a similar thread exists. Fail the call if it does
        RcsParticipant participant = mParticipantQueryHelper.getParticipantFromId(recipientId);
        if (participant == null) {
            throw new RemoteException(
                    "RcsParticipant with id: " + recipientId + " does not exist.");
        }

        RcsThreadQueryParams queryParameters = new RcsThreadQueryParams.Builder()
                .setThreadType(RcsThreadQueryParams.THREAD_TYPE_1_TO_1).setParticipant(
                        participant).build();
        RcsThreadQueryResult queryResult = getRcsThreads(queryParameters);
        if (queryResult.getThreads().size() > 0) {
            throw new RemoteException(
                    "Rcs1To1Thread with recipient " + recipientId + " already exists.");
        }

        int rcs1To1ThreadId = mThreadQueryHelper.create1To1Thread();
        // add the recipient
        Uri recipientUri = RCS_1_TO_1_THREAD_URI.buildUpon().appendPath(
                Integer.toString(rcs1To1ThreadId)).appendPath(
                RCS_PARTICIPANT_URI_PART).appendPath(Integer.toString(recipientId)).build();
        Uri insertionResult = mContentResolver.insert(recipientUri, null);

        if (insertionResult.equals(recipientUri)) {
            // insertion successful, return the created thread
            return rcs1To1ThreadId;
        }

        throw new RemoteException("Creating Rcs1To1Thread failed");
        return mThreadQueryHelper.create1To1Thread(recipientId);
    }

    @Override
+2 −2
Original line number Diff line number Diff line
@@ -43,8 +43,8 @@ class RcsParticipantQueryHelper {
        RcsParticipant participant = null;
        try (Cursor cursor = mContentResolver.query(
                Uri.withAppendedPath(RCS_PARTICIPANT_URI, Integer.toString(participantId)),
                null, null, null)) {
            if (cursor == null && !cursor.moveToNext()) {
                new String[]{RCS_PARTICIPANT_ID_COLUMN}, null, null)) {
            if (cursor == null || !cursor.moveToNext()) {
                throw new RemoteException("Could not find participant with id: " + participantId);
            }

Loading