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

Commit 89c650b7 authored by Qiang Chen's avatar Qiang Chen Committed by Gerrit Code Review
Browse files

Fix StrictMode violation during getDefaultApn()

move database read from main thread
to message handling thread

Change-Id: I018cd93d097d3b1752660b39ffb65dae61d41eb5
CRs-fixed: 837171
(cherry picked from commit 3badde01)
Ticket: CYNGNOS-751
parent aaa85c17
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ public class GpsLocationProvider implements LocationProviderInterface {
    private static final int REMOVE_LISTENER = 9;
    private static final int INJECT_NTP_TIME_FINISHED = 10;
    private static final int DOWNLOAD_XTRA_DATA_FINISHED = 11;
    private static final int GET_DEFAULT_APN = 13;

    // Request setid
    private static final int AGPS_RIL_REQUEST_SETID_IMSI = 1;
@@ -2184,6 +2185,10 @@ public class GpsLocationProvider implements LocationProviderInterface {
                case UPDATE_LOCATION:
                    handleUpdateLocation((Location)msg.obj);
                    break;
                case GET_DEFAULT_APN:
                    mDefaultApn = getDefaultApn();
                    if (DEBUG) Log.d(TAG,"Observer mDefaultApn=" + mDefaultApn);
                    break;
            }
            if (msg.arg2 == 1) {
                // wakelock was taken for this message, release it
@@ -2195,8 +2200,7 @@ public class GpsLocationProvider implements LocationProviderInterface {
    ContentObserver mDefaultApnObserver = new ContentObserver(mHandler) {
        @Override
        public void onChange(boolean selfChange) {
            mDefaultApn = getDefaultApn();
            if (DEBUG) Log.d(TAG, "Observer mDefaultApn=" + mDefaultApn);
            sendMessage(GET_DEFAULT_APN, 0, null);
        }
    };