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

Commit fec11db4 authored by Xin Li's avatar Xin Li
Browse files

DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp-without-vendor (6129114) into stage-aosp-master

Bug: 146167222
Change-Id: Idad0286b1d7bfa1c43c18d25609ee7a6e5ad7241
parents 0c3a90dc 4e05716e
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -242,6 +242,17 @@ message TelephonyServiceState {
    optional string numeric = 3;
  }

  message NetworkRegistrationInfo {
    // Network domain
    optional Domain domain = 1;

    // Network transport
    optional Transport transport = 2;

    // Radio access technology
    optional RadioAccessTechnology rat = 3;
  }

  // Roaming type
  enum RoamingType {

@@ -302,6 +313,29 @@ message TelephonyServiceState {
    NR_STATE_CONNECTED = 3;
  }

  // Domain type
  enum Domain {
    // Unknown
    DOMAIN_UNKNOWN = 0;

    // Circuit switching domain
    DOMAIN_CS = 1;

    // Packet switching domain
    DOMAIN_PS = 2;
  }

  enum Transport {
    // Unknown
    TRANSPORT_UNKNOWN = 0;

    // Transport type for Wireless Wide Area Networks (i.e. Cellular)
    TRANSPORT_WWAN = 1;

    // Transport type for Wireless Local Area Networks (i.e. Wifi)
    TRANSPORT_WLAN = 2;
  }

  // Current registered operator
  optional TelephonyOperator voice_operator = 1;

@@ -328,6 +362,9 @@ message TelephonyServiceState {

  // Current NR state
  optional NrState nr_state = 9;

  // Network registration info
  repeated NetworkRegistrationInfo networkRegistrationInfo = 10;
}

// Radio access families
+30 −21
Original line number Diff line number Diff line
@@ -314,13 +314,13 @@ public class CellBroadcastHandler extends WakeLockStateMachine {
    }

    private static final class LocationRequester {
        private static final String TAG = LocationRequester.class.getSimpleName();
        private static final String TAG = CellBroadcastHandler.class.getSimpleName();

        /**
         * Use as the default maximum wait time if the cell broadcast doesn't specify the value.
         * Most of the location request should be responded within 20 seconds.
         * Most of the location request should be responded within 30 seconds.
         */
        private static final int DEFAULT_MAXIMUM_WAIT_TIME_SEC = 20;
        private static final int DEFAULT_MAXIMUM_WAIT_TIME_SEC = 30;

        /**
         * Trigger this event when the {@link LocationManager} is not responded within the given
@@ -372,6 +372,11 @@ public class CellBroadcastHandler extends WakeLockStateMachine {
                callback.onLocationUpdate(location);
            }
            mCallbacks.clear();

            for (LocationListener listener : mLocationListenerList) {
                mLocationManager.removeUpdates(listener);
            }
            mLocationListenerList.clear();
        }

        private void requestLocationUpdateInternal(@NonNull LocationUpdateCallback callback,
@@ -398,8 +403,27 @@ public class CellBroadcastHandler extends WakeLockStateMachine {

            for (String provider : LOCATION_PROVIDERS) {
                if (mLocationManager.isProviderEnabled(provider)) {
                    mLocationManager.requestSingleUpdate(provider, mLocationListener, mLooper);
                    break;
                    LocationListener listener = new LocationListener() {
                        @Override
                        public void onLocationChanged(Location location) {
                            mLocationListenerList.remove(this);
                            mLocationHandler.removeMessages(EVENT_LOCATION_REQUEST_TIMEOUT);
                            onLocationUpdate(new LatLng(location.getLatitude(),
                                    location.getLongitude()));
                        }

                        @Override
                        public void onStatusChanged(String provider, int status, Bundle extras) {}

                        @Override
                        public void onProviderEnabled(String provider) {}

                        @Override
                        public void onProviderDisabled(String provider) {}
                    };
                    mLocationListenerList.add(listener);
                    Log.d(TAG, "Request location single update from " + provider);
                    mLocationManager.requestSingleUpdate(provider, listener, mLooper);
                }
            }
        }
@@ -418,22 +442,7 @@ public class CellBroadcastHandler extends WakeLockStateMachine {
                    == PackageManager.PERMISSION_GRANTED;
        }

        private final LocationListener mLocationListener = new LocationListener() {
            @Override
            public void onLocationChanged(Location location) {
                mLocationHandler.removeMessages(EVENT_LOCATION_REQUEST_TIMEOUT);
                onLocationUpdate(new LatLng(location.getLatitude(), location.getLongitude()));
            }

            @Override
            public void onStatusChanged(String provider, int status, Bundle extras) {}

            @Override
            public void onProviderEnabled(String provider) {}

            @Override
            public void onProviderDisabled(String provider) {}
        };
        private final List<LocationListener> mLocationListenerList = new ArrayList<>();

        private final class LocationHandler extends Handler {
            LocationHandler(Looper looper) {
+5 −1
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ public class VisualVoicemailSmsFilter {
            return false;
        }

        String clientPrefix = settings.clientPrefix;
        FullMessage fullMessage = getFullMessage(pdus, format);

        if (fullMessage == null) {
@@ -152,6 +153,10 @@ public class VisualVoicemailSmsFilter {
            String asciiMessage = parseAsciiPduMessage(pdus);
            WrappedMessageData messageData = VisualVoicemailSmsParser
                    .parseAlternativeFormat(asciiMessage);
            if (messageData == null) {
                Log.i(TAG, "Attempt to parse ascii PDU");
                messageData = VisualVoicemailSmsParser.parse(clientPrefix, asciiMessage);
            }
            if (messageData != null) {
                sendVvmSmsBroadcast(context, settings, phoneAccountHandle, messageData, null);
            }
@@ -161,7 +166,6 @@ public class VisualVoicemailSmsFilter {
        }

        String messageBody = fullMessage.fullMessageBody;
        String clientPrefix = settings.clientPrefix;
        WrappedMessageData messageData = VisualVoicemailSmsParser
                .parse(clientPrefix, messageBody);
        if (messageData != null) {
+1 −2
Original line number Diff line number Diff line
@@ -421,8 +421,7 @@ public class DataConnection extends StateMachine {
        return getCurrentState() == mDisconnectingState;
    }

    @VisibleForTesting
    public boolean isActive() {
    boolean isActive() {
        return getCurrentState() == mActiveState;
    }

+35 −1
Original line number Diff line number Diff line
@@ -19,13 +19,18 @@ package com.android.internal.telephony.gsm;
import static com.android.internal.telephony.gsm.SmsCbConstants.MESSAGE_ID_CMAS_GEO_FENCING_TRIGGER;

import android.compat.annotation.UnsupportedAppUsage;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncResult;
import android.os.Message;
import android.os.SystemClock;
import android.provider.Telephony.CellBroadcasts;
import android.telephony.CbGeoUtils.Geometry;
import android.telephony.CellLocation;
@@ -40,6 +45,7 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.gsm.GsmSmsCbMessage.GeoFencingTriggerMessage;
import com.android.internal.telephony.gsm.GsmSmsCbMessage.GeoFencingTriggerMessage.CellBroadcastIdentity;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -59,9 +65,29 @@ public class GsmCellBroadcastHandler extends CellBroadcastHandler {
    private final HashMap<SmsCbConcatInfo, byte[][]> mSmsCbPageMap =
            new HashMap<SmsCbConcatInfo, byte[][]>(4);

    private long mLastAirplaneModeTime = 0;

    protected GsmCellBroadcastHandler(Context context, Phone phone) {
        super("GsmCellBroadcastHandler", context, phone);
        phone.mCi.setOnNewGsmBroadcastSms(getHandler(), EVENT_NEW_SMS_MESSAGE, null);

        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
        mContext.registerReceiver(
                new BroadcastReceiver() {
                    @Override
                    public void onReceive(Context context, Intent intent) {
                        switch (intent.getAction()) {
                            case Intent.ACTION_AIRPLANE_MODE_CHANGED:
                                boolean airplaneModeOn = intent.getBooleanExtra("state", false);
                                if (airplaneModeOn) {
                                    mLastAirplaneModeTime = System.currentTimeMillis();
                                }
                                break;
                        }

                    }
                }, intentFilter);
    }

    @Override
@@ -94,8 +120,13 @@ public class GsmCellBroadcastHandler extends CellBroadcastHandler {
        final List<SmsCbMessage> cbMessages = new ArrayList<>();
        final List<Uri> cbMessageUris = new ArrayList<>();

        // Only consider the cell broadcast received within 24 hours.
        long lastReceivedTime = System.currentTimeMillis() - DateUtils.DAY_IN_MILLIS;
        Resources res = mContext.getResources();
        if (res.getBoolean(com.android.internal.R.bool.reset_geo_fencing_check_after_boot_or_apm)) {
            lastReceivedTime = Long.max(lastReceivedTime, mLastAirplaneModeTime);
            lastReceivedTime = Long.max(lastReceivedTime,
                    System.currentTimeMillis() - SystemClock.elapsedRealtime());
        }

        // Find the cell broadcast message identify by the message identifier and serial number
        // and is not broadcasted.
@@ -123,6 +154,9 @@ public class GsmCellBroadcastHandler extends CellBroadcastHandler {
            }
        }

        log("Found " + cbMessages.size() + " messages since "
                + DateFormat.getDateTimeInstance().format(lastReceivedTime));

        List<Geometry> commonBroadcastArea = new ArrayList<>();
        if (geoFencingTriggerMessage.shouldShareBroadcastArea()) {
            for (SmsCbMessage msg : cbMessages) {
Loading