Loading proto/src/telephony.proto +37 −0 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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; Loading @@ -328,6 +362,9 @@ message TelephonyServiceState { // Current NR state optional NrState nr_state = 9; // Network registration info repeated NetworkRegistrationInfo networkRegistrationInfo = 10; } // Radio access families Loading src/java/com/android/internal/telephony/CellBroadcastHandler.java +30 −21 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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, Loading @@ -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); } } } Loading @@ -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) { Loading src/java/com/android/internal/telephony/VisualVoicemailSmsFilter.java +5 −1 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public class VisualVoicemailSmsFilter { return false; } String clientPrefix = settings.clientPrefix; FullMessage fullMessage = getFullMessage(pdus, format); if (fullMessage == null) { Loading @@ -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); } Loading @@ -161,7 +166,6 @@ public class VisualVoicemailSmsFilter { } String messageBody = fullMessage.fullMessageBody; String clientPrefix = settings.clientPrefix; WrappedMessageData messageData = VisualVoicemailSmsParser .parse(clientPrefix, messageBody); if (messageData != null) { Loading src/java/com/android/internal/telephony/dataconnection/DataConnection.java +1 −2 Original line number Diff line number Diff line Loading @@ -421,8 +421,7 @@ public class DataConnection extends StateMachine { return getCurrentState() == mDisconnectingState; } @VisibleForTesting public boolean isActive() { boolean isActive() { return getCurrentState() == mActiveState; } Loading src/java/com/android/internal/telephony/gsm/GsmCellBroadcastHandler.java +35 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading @@ -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 Loading Loading @@ -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. Loading Loading @@ -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 Loading
proto/src/telephony.proto +37 −0 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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; Loading @@ -328,6 +362,9 @@ message TelephonyServiceState { // Current NR state optional NrState nr_state = 9; // Network registration info repeated NetworkRegistrationInfo networkRegistrationInfo = 10; } // Radio access families Loading
src/java/com/android/internal/telephony/CellBroadcastHandler.java +30 −21 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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, Loading @@ -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); } } } Loading @@ -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) { Loading
src/java/com/android/internal/telephony/VisualVoicemailSmsFilter.java +5 −1 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public class VisualVoicemailSmsFilter { return false; } String clientPrefix = settings.clientPrefix; FullMessage fullMessage = getFullMessage(pdus, format); if (fullMessage == null) { Loading @@ -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); } Loading @@ -161,7 +166,6 @@ public class VisualVoicemailSmsFilter { } String messageBody = fullMessage.fullMessageBody; String clientPrefix = settings.clientPrefix; WrappedMessageData messageData = VisualVoicemailSmsParser .parse(clientPrefix, messageBody); if (messageData != null) { Loading
src/java/com/android/internal/telephony/dataconnection/DataConnection.java +1 −2 Original line number Diff line number Diff line Loading @@ -421,8 +421,7 @@ public class DataConnection extends StateMachine { return getCurrentState() == mDisconnectingState; } @VisibleForTesting public boolean isActive() { boolean isActive() { return getCurrentState() == mActiveState; } Loading
src/java/com/android/internal/telephony/gsm/GsmCellBroadcastHandler.java +35 −1 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading @@ -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 Loading Loading @@ -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. Loading Loading @@ -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