Skip executing testSmsBackupRestore test for non SMS capable device
If device is not SMS capable messaging application will not be present causing sms/mms backup-restore test failure.
skip this test for non sms capable device since it is not applicable.
1. run cts -m CtsProviderTestCases -t android.provider.cts.SmsBackupRestoreTest#testSmsBackupRestore
Bug: 191604010
Merged-In: Ib18b05208333d18de91afe7cf4776ef497c6df6b
Change-Id: Ib18b05208333d18de91afe7cf4776ef497c6df6b
Test: Build CTS
Test: run cts -m CtsProviderTestCases -t android.provider.cts.SmsBackupRestoreTest#testSmsBackupRestore
diff --git a/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java b/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
index 97cc62a..49471aa 100644
--- a/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
@@ -29,6 +29,7 @@
import android.net.Uri;
import android.provider.BaseColumns;
import android.provider.Telephony;
+import android.telephony.TelephonyManager;
import android.util.Log;
/**
@@ -136,7 +137,8 @@
* @throws Exception
*/
public void testSmsBackupRestore() throws Exception {
- if (!mHasFeature) {
+ TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+ if (!mHasFeature || !telephonyManager.isSmsCapable()) {
Log.i(TAG, "skipping testSmsBackupRestore");
return;
}