1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
package org.cyanogenmod.tests.telephony;
import android.telephony.SubscriptionManager;
import android.widget.Toast;
import org.cyanogenmod.tests.TestActivity;
import cyanogenmod.app.CMTelephonyManager;
/**
* Created by adnan on 8/6/15.
*/
public class CMTelephonyTest extends TestActivity {
@Override
protected String tag() {
return null;
}
@Override
protected Test[] tests() {
return mTests;
}
private Test[] mTests = new Test[] {
new Test("test retreive list of subscription information") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test retrieve info "
+ cmTelephonyManager.getSubInformation().toString(),
Toast.LENGTH_SHORT).show();
}
},
new Test("test is default subscription active") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test default sub active "
+ cmTelephonyManager.isSubActive(
SubscriptionManager.getDefaultSubscriptionId()),
Toast.LENGTH_SHORT).show();
}
},
new Test("test setSubState on default subscription") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setSubState(SubscriptionManager.getDefaultSubscriptionId(), true);
}
},
new Test("test is data enabled on default sub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test default sub data "
+ cmTelephonyManager.isDataConnectionSelectedOnSub(
SubscriptionManager.getDefaultSubscriptionId()),
Toast.LENGTH_SHORT).show();
}
},
new Test("test is data enabled") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
Toast.makeText(CMTelephonyTest.this, "Test data enabled "
+ cmTelephonyManager.isDataConnectionEnabled(),
Toast.LENGTH_SHORT).show();
}
},
new Test("test setDataConnectionState") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDataConnectionState(true);
}
},
new Test("test setDataConnectionSelectedOnSub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDataConnectionSelectedOnSub(
SubscriptionManager.getDefaultSubscriptionId());
}
},
new Test("test setDefaultPhoneSub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDefaultPhoneSub(
SubscriptionManager.getDefaultSubscriptionId());
}
},
new Test("test setDefaultSmsSub") {
public void run() {
CMTelephonyManager cmTelephonyManager =
CMTelephonyManager.getInstance(CMTelephonyTest.this);
cmTelephonyManager.setDefaultSmsSub(
SubscriptionManager.getDefaultSubscriptionId());
}
},
};
}
|