Restrict telephony.cts.CellInfoTest to Devices with FEATURE_TELEPHONY
Bug: 23979591
Change-Id: I9ea227b40c793bd1ce352d3eaf2f0147b42642f9
diff --git a/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java b/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java
index 9a93a60..b7caabb 100644
--- a/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/CellInfoTest.java
@@ -16,6 +16,7 @@
package android.telephony.cts;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.telephony.CellInfo;
import android.telephony.CellInfoGsm;
@@ -41,6 +42,7 @@
// Maximum and minimum possible RSSI values(in dbm).
private static final int MAX_RRSI = -10;
private static final int MIN_RSSI = -150;
+ private PackageManager mPm;
@Override
protected void setUp() throws Exception {
@@ -48,9 +50,16 @@
mTelephonyManager =
(TelephonyManager)getContext().getSystemService(Context.TELEPHONY_SERVICE);
mCm = (ConnectivityManager)getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
+ mPm = getContext().getPackageManager();
}
public void testCellInfo() throws Throwable {
+
+ if(! (mPm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY))) {
+ Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
+ return;
+ }
+
if (mCm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) == null) {
Log.d(TAG, "Skipping test that requires ConnectivityManager.TYPE_MOBILE");
return;