aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPengquan Meng <mpq@google.com>2018-11-28 19:34:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-11-28 19:34:46 +0000
commitf12667efdb56014d2968ab16bf3a15b5fa03874e (patch)
treed97505e39593d0927cc074689a144051ead4da5f
parentb8607bbc0dfcee8509e09495e903ca6ef407d671 (diff)
parent4e5d53c66c52b6732451ac9a6f53adc973220bb9 (diff)
downloadtelephony-nougat-iot-release.tar.gz
Merge "Implement PhysicalChannelConfig"android-n-iot-release-ihome-igv1nougat-iot-release
-rw-r--r--src/java/com/android/internal/telephony/RadioIndication.java5
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerExecutorTest.java6
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java6
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/PhysicalChannelConfigTest.java79
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java5
5 files changed, 95 insertions, 6 deletions
diff --git a/src/java/com/android/internal/telephony/RadioIndication.java b/src/java/com/android/internal/telephony/RadioIndication.java
index 764c4eadf0..f2214d6845 100644
--- a/src/java/com/android/internal/telephony/RadioIndication.java
+++ b/src/java/com/android/internal/telephony/RadioIndication.java
@@ -294,7 +294,10 @@ public class RadioIndication extends IRadioIndication.Stub {
break;
}
- response.add(new PhysicalChannelConfig(status, config.cellBandwidthDownlink));
+ response.add(new PhysicalChannelConfig.Builder()
+ .setCellConnectionStatus(status)
+ .setCellBandwidthDownlinkKhz(config.cellBandwidthDownlink)
+ .build());
}
if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG, response);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerExecutorTest.java b/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerExecutorTest.java
index c5f19c8a41..40940bdbc6 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerExecutorTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerExecutorTest.java
@@ -114,8 +114,10 @@ public class PhoneStateListenerExecutorTest extends TelephonyTest {
assertNull(mPhysicalChannelConfigs);
- PhysicalChannelConfig config = new PhysicalChannelConfig(
- PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING, 20000 /* bandwidth */);
+ PhysicalChannelConfig config = new PhysicalChannelConfig.Builder()
+ .setCellConnectionStatus(PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING)
+ .setCellBandwidthDownlinkKhz(2000 /* bandwidth */)
+ .build();
List<PhysicalChannelConfig> configs = Collections.singletonList(config);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java b/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java
index 1d4b17361a..729260e4ef 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/PhoneStateListenerTest.java
@@ -128,8 +128,10 @@ public class PhoneStateListenerTest extends TelephonyTest {
assertNull(mPhysicalChannelConfigs);
- PhysicalChannelConfig config = new PhysicalChannelConfig(
- PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING, 20000 /* bandwidth */);
+ PhysicalChannelConfig config = new PhysicalChannelConfig.Builder()
+ .setCellConnectionStatus(PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING)
+ .setCellBandwidthDownlinkKhz(20000 /* bandwidth */)
+ .build();
List<PhysicalChannelConfig> configs = Collections.singletonList(config);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/PhysicalChannelConfigTest.java b/tests/telephonytests/src/com/android/internal/telephony/PhysicalChannelConfigTest.java
new file mode 100644
index 0000000000..535f7b28c5
--- /dev/null
+++ b/tests/telephonytests/src/com/android/internal/telephony/PhysicalChannelConfigTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.internal.telephony;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.os.Parcel;
+import android.telephony.PhysicalChannelConfig;
+import android.telephony.PhysicalChannelConfig.Builder;
+import android.telephony.ServiceState;
+
+import org.junit.Test;
+
+/** Unit test for {@link android.telephony.PhysicalChannelConfig}. */
+public class PhysicalChannelConfigTest {
+
+ private static final int RAT = ServiceState.RIL_RADIO_TECHNOLOGY_LTE;
+ private static final int CONNECTION_STATUS = PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING;
+ private static final int CELL_BANDWIDTH = 12345;
+ private static final int FREQUENCY_RANGE = 1;
+ private static final int CHANNEL_NUMBER = 1234;
+ private static final int[] CONTEXT_IDS = new int[] {123, 555, 1, 0};
+ private static final int PHYSICAL_CELL_ID = 502;
+
+ @Test
+ public void testBuilder() {
+ PhysicalChannelConfig config = new Builder()
+ .setRat(RAT)
+ .setCellConnectionStatus(CONNECTION_STATUS)
+ .setCellBandwidthDownlinkKhz(CELL_BANDWIDTH)
+ .setFrequencyRange(FREQUENCY_RANGE)
+ .setChannelNumber(CHANNEL_NUMBER)
+ .setContextIds(CONTEXT_IDS)
+ .setPhysicalCellId(PHYSICAL_CELL_ID)
+ .build();
+
+ assertThat(config.getRat()).isEqualTo(RAT);
+ assertThat(config.getConnectionStatus()).isEqualTo(CONNECTION_STATUS);
+ assertThat(config.getCellBandwidthDownlink()).isEqualTo(CELL_BANDWIDTH);
+ assertThat(config.getFrequencyRange()).isEqualTo(FREQUENCY_RANGE);
+ assertThat(config.getChannelNumber()).isEqualTo(CHANNEL_NUMBER);
+ assertThat(config.getContextIds()).isEqualTo(CONTEXT_IDS);
+ assertThat(config.getPhysicalCellId()).isEqualTo(PHYSICAL_CELL_ID);
+ }
+
+ @Test
+ public void testParcel() {
+ PhysicalChannelConfig config = new Builder()
+ .setRat(RAT)
+ .setCellConnectionStatus(CONNECTION_STATUS)
+ .setCellBandwidthDownlinkKhz(CELL_BANDWIDTH)
+ .setFrequencyRange(FREQUENCY_RANGE)
+ .setChannelNumber(CHANNEL_NUMBER)
+ .setContextIds(CONTEXT_IDS)
+ .setPhysicalCellId(PHYSICAL_CELL_ID)
+ .build();
+
+ Parcel parcel = Parcel.obtain();
+ config.writeToParcel(parcel, 0 /* flags */);
+ parcel.setDataPosition(0);
+
+ PhysicalChannelConfig fromParcel = PhysicalChannelConfig.CREATOR.createFromParcel(parcel);
+
+ assertThat(fromParcel).isEqualTo(config);
+ }
+}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
index 14eca24790..4f581bf7cf 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java
@@ -1729,7 +1729,10 @@ public class ServiceStateTrackerTest extends TelephonyTest {
ArrayList<PhysicalChannelConfig> pc = new ArrayList<>();
int ssType = PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING;
for (int bw : bandwidths) {
- pc.add(new PhysicalChannelConfig(ssType, bw));
+ pc.add(new PhysicalChannelConfig.Builder()
+ .setCellConnectionStatus(ssType)
+ .setCellBandwidthDownlinkKhz(bw)
+ .build());
// All cells after the first are secondary serving cells.
ssType = PhysicalChannelConfig.CONNECTION_SECONDARY_SERVING;