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

Commit a8cdbc85 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 24501 into eclair

* changes:
  Make Phone.updateServiceLocation acquire a one-shot wake lock.
parents 6ba23c59 7a043b35
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -1189,17 +1189,9 @@ public interface Phone {
    List<DataConnection> getCurrentDataConnectionList ();

    /**
     * Udpate LAC and CID in service state for currnet GSM netowrk registration
     *
     * If get different LAC and/or CID, notifyServiceState will be sent
     *
     * @param
     * <strong>On failure</strong>,
     * (((AsyncResult)response.obj).result) == null and
     * (((AsyncResult)response.obj).exception) being an instance of
     * com.android.internal.telephony.gsm.CommandException
     * Update the ServiceState CellLocation for current network registration.
     */
    void updateServiceLocation(Message response);
    void updateServiceLocation();

    /**
     * Enable location update notifications.
+2 −2
Original line number Diff line number Diff line
@@ -566,8 +566,8 @@ public class PhoneProxy extends Handler implements Phone {
        return mActivePhone.getCurrentDataConnectionList();
    }

    public void updateServiceLocation(Message response) {
        mActivePhone.updateServiceLocation(response);
    public void updateServiceLocation() {
        mActivePhone.updateServiceLocation();
    }

    public void enableLocationUpdates() {
+32 −1
Original line number Diff line number Diff line
@@ -226,13 +226,44 @@ public abstract class ServiceStateTracker extends Handler {
        setPowerStateToDesired();
    }

    /**
     * These two flags manage the behavior of the cell lock -- the
     * lock should be held if either flag is true.  The intention is
     * to allow temporary aquisition of the lock to get a single
     * update.  Such a lock grab and release can thus be made to not
     * interfere with more permanent lock holds -- in other words, the
     * lock will only be released if both flags are false, and so
     * releases by temporary users will only affect the lock state if
     * there is no continuous user.
     */
    private boolean mWantContinuousLocationUpdates;
    private boolean mWantSingleLocationUpdate;

    public void enableSingleLocationUpdate() {
        if (mWantSingleLocationUpdate || mWantContinuousLocationUpdates) return;
        mWantSingleLocationUpdate = true;
        cm.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
    }

    public void enableLocationUpdates() {
        if (mWantSingleLocationUpdate || mWantContinuousLocationUpdates) return;
        mWantContinuousLocationUpdates = true;
        cm.setLocationUpdates(true, obtainMessage(EVENT_LOCATION_UPDATES_ENABLED));
    }

    protected void disableSingleLocationUpdate() {
        mWantSingleLocationUpdate = false;
        if (!mWantSingleLocationUpdate && !mWantContinuousLocationUpdates) {
            cm.setLocationUpdates(false, null);
        }
    }

    public void disableLocationUpdates() {
        mWantContinuousLocationUpdates = false;
        if (!mWantSingleLocationUpdate && !mWantContinuousLocationUpdates) {
            cm.setLocationUpdates(false, null);
        }
    }

    public abstract void handleMessage(Message msg);

+6 −6
Original line number Diff line number Diff line
@@ -500,8 +500,8 @@ public class CDMAPhone extends PhoneBase {
        Log.e(LOG_TAG, "method setCallWaiting is NOT supported in CDMA!");
    }

    public void updateServiceLocation(Message response) {
        mSST.getLacAndCid(response);
    public void updateServiceLocation() {
        mSST.enableSingleLocationUpdate();
    }

    public void setDataRoamingEnabled(boolean enable) {
@@ -661,6 +661,10 @@ public class CDMAPhone extends PhoneBase {
        mSST.enableLocationUpdates();
    }

    public void disableLocationUpdates() {
        mSST.disableLocationUpdates();
    }

    /**
     * @deprecated
     */
@@ -741,10 +745,6 @@ public class CDMAPhone extends PhoneBase {
        }
    }

    public void disableLocationUpdates() {
        mSST.disableLocationUpdates();
    }

    public boolean getIccRecordsLoaded() {
        return mRuimRecords.getRecordsLoaded();
    }
+7 −21
Original line number Diff line number Diff line
@@ -279,12 +279,6 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
        cdmaForSubscriptionInfoReadyRegistrants.remove(h);
    }

    public void
    getLacAndCid(Message onComplete) {
        cm.getRegistrationState(obtainMessage(
                EVENT_GET_LOC_DONE_CDMA, onComplete));
    }

    @Override
    public void handleMessage (Message msg) {
        AsyncResult ar;
@@ -377,22 +371,14 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
                    }
                }

                // Only update if cell location really changed.
                if (cellLoc.getBaseStationId() != baseStationData[0]
                        || cellLoc.getBaseStationLatitude() != baseStationData[1]
                        || cellLoc.getBaseStationLongitude() != baseStationData[2]) {
                cellLoc.setCellLocationData(baseStationData[0],
                                                baseStationData[1],
                                                baseStationData[2]);
                        baseStationData[1], baseStationData[2]);
                phone.notifyLocationChanged();
            }
            }

            if (ar.userObj != null) {
                AsyncResult.forMessage(((Message) ar.userObj)).exception
                = ar.exception;
                ((Message) ar.userObj).sendToTarget();
            }
            // Release any temporary cell lock, which could have been
            // aquired to allow a single-shot location update.
            disableSingleLocationUpdate();
            break;

        case EVENT_POLL_STATE_REGISTRATION_CDMA:
@@ -487,7 +473,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker {
            ar = (AsyncResult) msg.obj;

            if (ar.exception == null) {
                getLacAndCid(null);
                cm.getRegistrationState(obtainMessage(EVENT_GET_LOC_DONE_CDMA, null));
            }
            break;

Loading