Skip to content

Commit 0b9b316

Browse files
authored
Merge pull request #16 from omnt/rel/0.3.1
Create Rel 0.3.1
2 parents e762747 + 8aa59ef commit 0b9b316

File tree

18 files changed

+171
-56
lines changed

18 files changed

+171
-56
lines changed

.github/ISSUE_TEMPLATE/bug.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Bug Report
3+
about: Use this template for creating bug report.
4+
title: "[BUG] - BUG_DESCRIPTION"
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Bug Report
10+
11+
### Context
12+
- **Device:**
13+
- **Carrier Privileges (Y/N):**
14+
- **Android Version:**
15+
- **App Version:**
16+
- **Git Hash:**
17+
18+
### Description
19+
<!-- A clear and concise description of what the bug is. -->
20+
21+
### How to Reproduce
22+
Steps to reproduce the behavior:
23+
1. Go to '...'
24+
2. Click on '...'
25+
3. Scroll down to '...'
26+
4. See error
27+
28+
### Expected Behavior
29+
<!-- A clear and concise description of what you expected to happen. -->
30+
31+
### Actual Behavior
32+
<!-- A clear and concise description of what actually happens. -->
33+
34+
### Screenshots
35+
<!-- If applicable, add screenshots to help explain your problem. -->
36+
37+
### Additional Context
38+
<!-- Add any other context about the problem here. -->
39+
40+
### Possible Fix
41+
<!-- Optional: suggest a fix for the bug. -->

.github/ISSUE_TEMPLATE/feature.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Feature Request
3+
about: Use this template for creating feature request.
4+
title: "[FEATURE] - FEATURE_DESCRIPTION"
5+
labels: feature
6+
assignees: ""
7+
---
8+
9+
## Feature Request
10+
11+
### Summary
12+
<!-- A brief summary of the feature request. -->
13+
14+
### Context
15+
<!-- Explain why this feature is needed and how it will benefit the project. -->
16+
17+
### Proposed Solution
18+
<!-- A clear and concise description of what you want to happen. -->
19+
20+
### Alternatives Considered
21+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
22+
23+
### Additional Context
24+
<!-- Add any other context, screenshots, or code snippets about the feature request here. -->
25+
26+
### Related Issues
27+
<!-- If there are any related issues, link to them here. -->

CHANGELOG.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
# OpenMobileNetworkToolkit Changelog
2+
## Release [0.3.1]
3+
4+
### Added
5+
- Add Issue Template [PR 21](https://github.com/omnt/OpenMobileNetworkToolkit/pull/21)
6+
7+
### Changed
8+
- Use [TelephonyCallback](https://developer.android.com/reference/android/telephony/TelephonyCallback) instead of [PhoneStateListener](https://developer.android.com/reference/android/telephony/PhoneStateListener)
9+
- Bump gradle to 8.5.0
10+
- Bump lib depencies
11+
- disable Radio Settings if Carrier Permissions are not available
12+
- minor documentation update
13+
14+
### Fixed
15+
- Fix Bug if DP is not available, resulting in a crash
16+
- Fix Bug if two Sim Cards are available, see [Issue 22](https://github.com/omnt/OpenMobileNetworkToolkit/issues/22)
17+
218
## Release [0.3]
319

420
### Added
@@ -11,7 +27,7 @@
1127
- iPerf3 GUI [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)
1228
- Fix Ping Bug, where button is enabled but now Ping is running after app restart [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)
1329
- Update Ping Fragment, now uses the Metric class to display [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)
14-
-
30+
1531
### Breaking Changes
1632
- see [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)
1733

app/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,19 @@ dependencies {
122122
implementation "androidx.room:room-runtime:$room_version"
123123
annotationProcessor "androidx.room:room-compiler:$room_version"
124124
implementation 'androidx.appcompat:appcompat:1.7.0'
125-
implementation 'com.google.guava:guava:33.1.0-jre'
125+
implementation 'com.google.guava:guava:33.2.1-jre'
126126
implementation 'androidx.concurrent:concurrent-futures:1.2.0'
127127
implementation 'androidx.activity:activity:1.9.0'
128-
implementation 'androidx.fragment:fragment:1.8.0'
128+
implementation 'androidx.fragment:fragment:1.8.1'
129129
implementation 'androidx.appcompat:appcompat:1.7.0'
130130
implementation 'com.google.android.material:material:1.12.0'
131131
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
132132
implementation 'androidx.navigation:navigation-fragment:2.7.7'
133133
implementation 'androidx.navigation:navigation-ui:2.7.7'
134134
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
135135
testImplementation 'junit:junit:4.13.2'
136-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
137-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
136+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
137+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
138138
implementation 'androidx.preference:preference-ktx:1.2.1'
139139
implementation 'androidx.recyclerview:recyclerview:1.3.2'
140140
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'

app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/DataProvider/DataProvider.java

+21-11
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
import de.fraunhofer.fokus.OpenMobileNetworkToolkit.GlobalVars;
7676

77-
public class DataProvider extends PhoneStateListener implements LocationListener, TelephonyCallback.CellInfoListener, TelephonyCallback.PhysicalChannelConfigListener {
77+
public class DataProvider extends TelephonyCallback implements LocationListener, TelephonyCallback.CellInfoListener, TelephonyCallback.PhysicalChannelConfigListener, TelephonyCallback.SignalStrengthsListener {
7878
private static final String TAG = "DataProvider";
7979
private final Context ct;
8080
private final SharedPreferences sp;
@@ -191,7 +191,6 @@ public Point getNetworkInformationPoint() {
191191

192192

193193
// ## Device Information
194-
@SuppressLint({"MissingPermission", "HardwareIds", "ObsoleteSdkInt"})
195194
public void refreshDeviceInformation() {
196195
updateTimestamp();
197196
di.setTimeStamp(ts);
@@ -210,13 +209,19 @@ public void refreshDeviceInformation() {
210209
if (permission_phone_state) {
211210
di.setDeviceSoftwareVersion(String.valueOf(tm.getDeviceSoftwareVersion()));
212211
}
212+
Log.d(TAG, "refreshDeviceInformation: Carrier Privileges is " + cp);
213213
if (cp) { // todo try root privileges or more fine granular permission
214-
di.setIMEI(tm.getImei());
215-
di.setMEID(tm.getMeid());
214+
try {
215+
di.setIMEI(tm.getImei());
216+
di.setMEID(tm.getMeid());
217+
di.setSimSerial(tm.getSimSerialNumber());
218+
di.setSubscriberId(tm.getSubscriberId());
219+
di.setNetworkAccessIdentifier(tm.getNai());
220+
} catch (SecurityException e) {
221+
Log.d(TAG, "Can't get IMEI, MEID, SimSerial or SubscriberId");
222+
}
216223
di.setIMSI(getIMSI());
217-
di.setSimSerial(tm.getSimSerialNumber());
218-
di.setSubscriberId(tm.getSubscriberId());
219-
di.setNetworkAccessIdentifier(tm.getNai());
224+
220225
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
221226
di.setSubscriberId(String.valueOf(tm.getSubscriptionId()));
222227
}
@@ -280,7 +285,6 @@ public List<Point> getNetworkInterfaceInformationPoints() {
280285
return points;
281286
}
282287

283-
284288
// ### Cell Information ###
285289

286290
/**
@@ -526,8 +530,6 @@ public Point getNetworkCapabilitiesPoint() {
526530
point.addField("MobileRxBytes", TrafficStats.getMobileRxBytes());
527531
return point;
528532
}
529-
530-
531533
// ### Signal Strength Information ###
532534
@SuppressLint("ObsoleteSdkInt")
533535
@Override
@@ -837,7 +839,15 @@ public List<SubscriptionInfo> getSubscriptions() {
837839
} else {
838840
subscriptions = sm.getActiveSubscriptionInfoList();
839841
}
840-
return subscriptions;
842+
843+
ArrayList<SubscriptionInfo> activeSubscriptions = new ArrayList<>();
844+
for (SubscriptionInfo info : Objects.requireNonNull(subscriptions)) {
845+
Log.d(TAG, "Subscription Info: " + info.toString());
846+
if(tm.getSimState(info.getSimSlotIndex()) == TelephonyManager.SIM_STATE_READY){
847+
activeSubscriptions.add(info);
848+
}
849+
}
850+
return activeSubscriptions;
841851
}
842852

843853
/**

app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/LoggingService.java

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ public void run() {
103103
private final Runnable notification_updater = new Runnable() {
104104
@Override
105105
public void run() {
106+
if(dp == null) {
107+
Log.e(TAG, "run: Dataprovider is null!");
108+
return;
109+
}
106110
List<CellInformation> cil = dp.getRegisteredCells();
107111
StringBuilder s = new StringBuilder();
108112
for (CellInformation ci : cil) {

app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/MainActivity.java

-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ public void onClick(DialogInterface dialog, int which) {
235235
}
236236
requestCellInfoUpdateHandler = new Handler(Objects.requireNonNull(Looper.myLooper()));
237237
requestCellInfoUpdateHandler.post(requestCellInfoUpdate);
238-
tm.listen(dp, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
239238
}
240239

241240

app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/Ping/PingFragment.java

+21-17
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,7 @@ private void startPingService(){
6464
Intent pingStart = new Intent(ct, PingService.class);
6565
ct.startService(pingStart);
6666
rttMetric.resetMetric();
67-
PingParser pingParser = PingParser.getInstance(null);
68-
pingParser.addPropertyChangeListener(new PropertyChangeListener() {
69-
@Override
70-
public void propertyChange(PropertyChangeEvent evt) {
71-
PingInformation pi = (PingInformation) evt.getNewValue();
72-
switch (pi.getLineType()){
73-
case RTT:
74-
rttMetric.update( ((RTTLine)pi).getRtt());
75-
break;
76-
case PACKET_LOSS:
77-
packetLossMetric.update(((PacketLossLine)pi).getPacketLoss());
78-
//packetLossMetric.setVisibility(View.VISIBLE);
79-
break;
80-
}
81-
}
82-
});
67+
packetLossMetric.resetMetric();
8368
}
8469
private void stopPingService(){
8570
input.setEnabled(true);
@@ -123,7 +108,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
123108
aSwitch = verticalLL.findViewById(R.id.ping_switch);
124109
input = verticalLL.findViewById(R.id.ping_input);
125110
input.setText(sp.getString("ping_input", "-w 5 8.8.8.8"));
126-
111+
input.setEnabled(!PingService.isRunning());
127112
ct = requireContext();
128113

129114
saveTextInputToSharedPreferences(input, "ping_input");
@@ -150,6 +135,25 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
150135
metricsLL.addView(packetLossMetric.createMainLL("Packet Loss [%]"));
151136

152137
horizontalLL1.addView(metricsLL);
138+
139+
140+
PingParser pingParser = PingParser.getInstance(null);
141+
pingParser.addPropertyChangeListener(new PropertyChangeListener() {
142+
@Override
143+
public void propertyChange(PropertyChangeEvent evt) {
144+
PingInformation pi = (PingInformation) evt.getNewValue();
145+
switch (pi.getLineType()){
146+
case RTT:
147+
rttMetric.update( ((RTTLine)pi).getRtt());
148+
break;
149+
case PACKET_LOSS:
150+
packetLossMetric.update(((PacketLossLine)pi).getPacketLoss());
151+
//packetLossMetric.setVisibility(View.VISIBLE);
152+
break;
153+
}
154+
}
155+
});
156+
153157
//packetLossMetric.setVisibility(View.INVISIBLE);
154158
return v;
155159
}

app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/Ping/PingService.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public class PingService extends Service {
5757
private static final String TAG = "PingService";
5858
private FileOutputStream ping_stream;
5959
private Handler pingLogging;
60-
private String pingInput;
6160
private WorkManager wm;
6261
private Context context;
6362
private ArrayList<OneTimeWorkRequest> pingWRs;
@@ -67,10 +66,7 @@ public class PingService extends Service {
6766
DataProvider dp;
6867
InfluxdbConnection influx;
6968
private static boolean isRunning = false;
70-
private static PingParser pingParser;
71-
private Process pingProcess;
7269
private String pingCommand;
73-
private Runtime runtime = Runtime.getRuntime();
7470
private PropertyChangeListener propertyChangeListener;
7571
HashMap<String, String> parsedCommand = new HashMap<>();
7672

@@ -95,9 +91,10 @@ public int onStartCommand(Intent intent, int flags, int startId) {
9591
defaultSP = PreferenceManager.getDefaultSharedPreferences(context);
9692
if(defaultSP.getBoolean("enable_influx", false)) influx = InfluxdbConnections.getRicInstance(context);
9793
wm = WorkManager.getInstance(context);
94+
wm.cancelAllWorkByTag("Ping");
9895
if(intent == null) return START_NOT_STICKY;
99-
pingInput = intent.getStringExtra("input");
10096
pingWRs = new ArrayList<>();
97+
10198
setupPing();
10299
isRunning = true;
103100
return START_STICKY;
@@ -233,6 +230,7 @@ public void onChanged(Object o) {
233230
}
234231

235232
wm.getWorkInfoByIdLiveData(pingWR.getId()).removeObserver(this);
233+
pingWRs.remove(pingWR);
236234
pingLogging.postDelayed(pingUpdate, 200);
237235
}
238236
};

app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/Ping/PingWorker.java

-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ public void propertyChange(PropertyChangeEvent evt) {
162162
case RTT:
163163
rtt = ((RTTLine)pi).getRtt();
164164
break;
165-
166165
}
167166
updateNotification.run();
168167
}

app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/SettingPreferences/MobileNetworkSettingsFragment.java

+17-2
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,31 @@ private boolean setNetworkSelection(){
7070
}
7171

7272
private void handleSetNetwork(){
73-
boolean result = setNetworkSelection();
74-
Toast.makeText(ct, String.valueOf(result), Toast.LENGTH_SHORT).show();
73+
if(gv.isCarrier_permissions()){
74+
if(setNetworkSelection()){
75+
Toast.makeText(ct, "Network Selection Successful", Toast.LENGTH_SHORT).show();
76+
return;
77+
} else {
78+
Toast.makeText(ct, "Network Selection Failed", Toast.LENGTH_SHORT).show();
79+
return;
80+
}
81+
}
82+
Toast.makeText(ct, "App doesn't have Carrier Permissions", Toast.LENGTH_SHORT).show();
7583
}
7684

85+
7786
@Override
7887
public void onCreate(@Nullable Bundle savedInstanceState) {
7988
super.onCreate(savedInstanceState);
8089
DropDownPreference selectNetworkType = findPreference(SELECTNETWORKTYPE);
8190
EditTextPreference inputPLMN = findPreference(ADDPLMN);
8291
SwitchPreference reboot = findPreference(PERSISTREBOOT);
92+
93+
if(!gv.isCarrier_permissions()){
94+
selectNetworkType.setEnabled(false);
95+
inputPLMN.setEnabled(false);
96+
reboot.setEnabled(false);
97+
}
8398
ct = requireContext();
8499
plmnId = ct.getString(R.string.select_plmn);
85100
accessNetworkType = ct.getString(R.string.access_networktype);

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
mavenCentral()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:8.4.2'
10+
classpath 'com.android.tools.build:gradle:8.5.0'
1111
def nav_version = "2.5.3"
1212
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
1313
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'

docs/images/iperf3_edit.gif

2.08 MB
Loading

docs/images/iperf3_stop.gif

1.71 MB
Loading

docs/iperf3.md

+9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ You can type into the GUI the server IP and port, the duration of the test, and
1313
You can also choose the protocol you want to use, TCP or UDP.
1414
![iPerf3](images/iperf3.png)
1515

16+
#### Stop iPerf3 Run
17+
To stop an iPerf3 run, click on the `Instance` button, swipe left on the instance you want to stop, and click on the `Stop` button.
18+
![iPerf3_stop](images/iperf3_stop.gif)
19+
20+
#### Edit iPerf3 Run
21+
To stop an iPerf3 run, click on the `Instance` button, swipe right on the instance you want to stop, and click on the `Edit` button.
22+
![iPerf3_edit](images/iperf3_edit.gif)
23+
24+
1625
### Results
1726
The results of the iPerf3 test are displayed in the GUI.
1827
![iPerf3_results](images/iPerf3_run_view.gif)

docs/ping.md

-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
[ICMP](https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol) allows a high level analysis of the current network conditions. The input field allows entering the target IP address as well as options of the ICMP command. If logging is enabled, the results of the ICMP test are pushed to the InfluxDB and can be viewed in the dashboards. The most relevant KPIs gathered here are:
33
* packet loss
44
* RTT round trip time
5-
* jitter
65

76
[Home](OpenMobileNetworkToolkit.md)

0 commit comments

Comments
 (0)