Skip to content

Commit

Permalink
Merge pull request #16 from omnt/rel/0.3.1
Browse files Browse the repository at this point in the history
Create Rel 0.3.1
  • Loading branch information
PeterHasse authored Jul 5, 2024
2 parents e762747 + 8aa59ef commit 0b9b316
Show file tree
Hide file tree
Showing 18 changed files with 171 additions and 56 deletions.
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Bug Report
about: Use this template for creating bug report.
title: "[BUG] - BUG_DESCRIPTION"
labels: bug
assignees: ""
---

## Bug Report

### Context
- **Device:**
- **Carrier Privileges (Y/N):**
- **Android Version:**
- **App Version:**
- **Git Hash:**

### Description
<!-- A clear and concise description of what the bug is. -->

### How to Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error

### Expected Behavior
<!-- A clear and concise description of what you expected to happen. -->

### Actual Behavior
<!-- A clear and concise description of what actually happens. -->

### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

### Additional Context
<!-- Add any other context about the problem here. -->

### Possible Fix
<!-- Optional: suggest a fix for the bug. -->
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature Request
about: Use this template for creating feature request.
title: "[FEATURE] - FEATURE_DESCRIPTION"
labels: feature
assignees: ""
---

## Feature Request

### Summary
<!-- A brief summary of the feature request. -->

### Context
<!-- Explain why this feature is needed and how it will benefit the project. -->

### Proposed Solution
<!-- A clear and concise description of what you want to happen. -->

### Alternatives Considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->

### Additional Context
<!-- Add any other context, screenshots, or code snippets about the feature request here. -->

### Related Issues
<!-- If there are any related issues, link to them here. -->
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# OpenMobileNetworkToolkit Changelog
## Release [0.3.1]

### Added
- Add Issue Template [PR 21](https://github.com/omnt/OpenMobileNetworkToolkit/pull/21)

### Changed
- Use [TelephonyCallback](https://developer.android.com/reference/android/telephony/TelephonyCallback) instead of [PhoneStateListener](https://developer.android.com/reference/android/telephony/PhoneStateListener)
- Bump gradle to 8.5.0
- Bump lib depencies
- disable Radio Settings if Carrier Permissions are not available
- minor documentation update

### Fixed
- Fix Bug if DP is not available, resulting in a crash
- Fix Bug if two Sim Cards are available, see [Issue 22](https://github.com/omnt/OpenMobileNetworkToolkit/issues/22)

## Release [0.3]

### Added
Expand All @@ -11,7 +27,7 @@
- iPerf3 GUI [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)
- Fix Ping Bug, where button is enabled but now Ping is running after app restart [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)
- Update Ping Fragment, now uses the Metric class to display [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)
-

### Breaking Changes
- see [PR 14](https://github.com/omnt/OpenMobileNetworkToolkit/pull/14)

Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,19 @@ dependencies {
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.guava:guava:33.1.0-jre'
implementation 'com.google.guava:guava:33.2.1-jre'
implementation 'androidx.concurrent:concurrent-futures:1.2.0'
implementation 'androidx.activity:activity:1.9.0'
implementation 'androidx.fragment:fragment:1.8.0'
implementation 'androidx.fragment:fragment:1.8.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.7.7'
implementation 'androidx.navigation:navigation-ui:2.7.7'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

import de.fraunhofer.fokus.OpenMobileNetworkToolkit.GlobalVars;

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


// ## Device Information
@SuppressLint({"MissingPermission", "HardwareIds", "ObsoleteSdkInt"})
public void refreshDeviceInformation() {
updateTimestamp();
di.setTimeStamp(ts);
Expand All @@ -210,13 +209,19 @@ public void refreshDeviceInformation() {
if (permission_phone_state) {
di.setDeviceSoftwareVersion(String.valueOf(tm.getDeviceSoftwareVersion()));
}
Log.d(TAG, "refreshDeviceInformation: Carrier Privileges is " + cp);
if (cp) { // todo try root privileges or more fine granular permission
di.setIMEI(tm.getImei());
di.setMEID(tm.getMeid());
try {
di.setIMEI(tm.getImei());
di.setMEID(tm.getMeid());
di.setSimSerial(tm.getSimSerialNumber());
di.setSubscriberId(tm.getSubscriberId());
di.setNetworkAccessIdentifier(tm.getNai());
} catch (SecurityException e) {
Log.d(TAG, "Can't get IMEI, MEID, SimSerial or SubscriberId");
}
di.setIMSI(getIMSI());
di.setSimSerial(tm.getSimSerialNumber());
di.setSubscriberId(tm.getSubscriberId());
di.setNetworkAccessIdentifier(tm.getNai());

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
di.setSubscriberId(String.valueOf(tm.getSubscriptionId()));
}
Expand Down Expand Up @@ -280,7 +285,6 @@ public List<Point> getNetworkInterfaceInformationPoints() {
return points;
}


// ### Cell Information ###

/**
Expand Down Expand Up @@ -526,8 +530,6 @@ public Point getNetworkCapabilitiesPoint() {
point.addField("MobileRxBytes", TrafficStats.getMobileRxBytes());
return point;
}


// ### Signal Strength Information ###
@SuppressLint("ObsoleteSdkInt")
@Override
Expand Down Expand Up @@ -837,7 +839,15 @@ public List<SubscriptionInfo> getSubscriptions() {
} else {
subscriptions = sm.getActiveSubscriptionInfoList();
}
return subscriptions;

ArrayList<SubscriptionInfo> activeSubscriptions = new ArrayList<>();
for (SubscriptionInfo info : Objects.requireNonNull(subscriptions)) {
Log.d(TAG, "Subscription Info: " + info.toString());
if(tm.getSimState(info.getSimSlotIndex()) == TelephonyManager.SIM_STATE_READY){
activeSubscriptions.add(info);
}
}
return activeSubscriptions;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public void run() {
private final Runnable notification_updater = new Runnable() {
@Override
public void run() {
if(dp == null) {
Log.e(TAG, "run: Dataprovider is null!");
return;
}
List<CellInformation> cil = dp.getRegisteredCells();
StringBuilder s = new StringBuilder();
for (CellInformation ci : cil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ public void onClick(DialogInterface dialog, int which) {
}
requestCellInfoUpdateHandler = new Handler(Objects.requireNonNull(Looper.myLooper()));
requestCellInfoUpdateHandler.post(requestCellInfoUpdate);
tm.listen(dp, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,7 @@ private void startPingService(){
Intent pingStart = new Intent(ct, PingService.class);
ct.startService(pingStart);
rttMetric.resetMetric();
PingParser pingParser = PingParser.getInstance(null);
pingParser.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
PingInformation pi = (PingInformation) evt.getNewValue();
switch (pi.getLineType()){
case RTT:
rttMetric.update( ((RTTLine)pi).getRtt());
break;
case PACKET_LOSS:
packetLossMetric.update(((PacketLossLine)pi).getPacketLoss());
//packetLossMetric.setVisibility(View.VISIBLE);
break;
}
}
});
packetLossMetric.resetMetric();
}
private void stopPingService(){
input.setEnabled(true);
Expand Down Expand Up @@ -123,7 +108,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
aSwitch = verticalLL.findViewById(R.id.ping_switch);
input = verticalLL.findViewById(R.id.ping_input);
input.setText(sp.getString("ping_input", "-w 5 8.8.8.8"));

input.setEnabled(!PingService.isRunning());
ct = requireContext();

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

horizontalLL1.addView(metricsLL);


PingParser pingParser = PingParser.getInstance(null);
pingParser.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
PingInformation pi = (PingInformation) evt.getNewValue();
switch (pi.getLineType()){
case RTT:
rttMetric.update( ((RTTLine)pi).getRtt());
break;
case PACKET_LOSS:
packetLossMetric.update(((PacketLossLine)pi).getPacketLoss());
//packetLossMetric.setVisibility(View.VISIBLE);
break;
}
}
});

//packetLossMetric.setVisibility(View.INVISIBLE);
return v;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public class PingService extends Service {
private static final String TAG = "PingService";
private FileOutputStream ping_stream;
private Handler pingLogging;
private String pingInput;
private WorkManager wm;
private Context context;
private ArrayList<OneTimeWorkRequest> pingWRs;
Expand All @@ -67,10 +66,7 @@ public class PingService extends Service {
DataProvider dp;
InfluxdbConnection influx;
private static boolean isRunning = false;
private static PingParser pingParser;
private Process pingProcess;
private String pingCommand;
private Runtime runtime = Runtime.getRuntime();
private PropertyChangeListener propertyChangeListener;
HashMap<String, String> parsedCommand = new HashMap<>();

Expand All @@ -95,9 +91,10 @@ public int onStartCommand(Intent intent, int flags, int startId) {
defaultSP = PreferenceManager.getDefaultSharedPreferences(context);
if(defaultSP.getBoolean("enable_influx", false)) influx = InfluxdbConnections.getRicInstance(context);
wm = WorkManager.getInstance(context);
wm.cancelAllWorkByTag("Ping");
if(intent == null) return START_NOT_STICKY;
pingInput = intent.getStringExtra("input");
pingWRs = new ArrayList<>();

setupPing();
isRunning = true;
return START_STICKY;
Expand Down Expand Up @@ -233,6 +230,7 @@ public void onChanged(Object o) {
}

wm.getWorkInfoByIdLiveData(pingWR.getId()).removeObserver(this);
pingWRs.remove(pingWR);
pingLogging.postDelayed(pingUpdate, 200);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ public void propertyChange(PropertyChangeEvent evt) {
case RTT:
rtt = ((RTTLine)pi).getRtt();
break;

}
updateNotification.run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,31 @@ private boolean setNetworkSelection(){
}

private void handleSetNetwork(){
boolean result = setNetworkSelection();
Toast.makeText(ct, String.valueOf(result), Toast.LENGTH_SHORT).show();
if(gv.isCarrier_permissions()){
if(setNetworkSelection()){
Toast.makeText(ct, "Network Selection Successful", Toast.LENGTH_SHORT).show();
return;
} else {
Toast.makeText(ct, "Network Selection Failed", Toast.LENGTH_SHORT).show();
return;
}
}
Toast.makeText(ct, "App doesn't have Carrier Permissions", Toast.LENGTH_SHORT).show();
}


@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
DropDownPreference selectNetworkType = findPreference(SELECTNETWORKTYPE);
EditTextPreference inputPLMN = findPreference(ADDPLMN);
SwitchPreference reboot = findPreference(PERSISTREBOOT);

if(!gv.isCarrier_permissions()){
selectNetworkType.setEnabled(false);
inputPLMN.setEnabled(false);
reboot.setEnabled(false);
}
ct = requireContext();
plmnId = ct.getString(R.string.select_plmn);
accessNetworkType = ct.getString(R.string.access_networktype);
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.4.2'
classpath 'com.android.tools.build:gradle:8.5.0'
def nav_version = "2.5.3"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
Expand Down
Binary file added docs/images/iperf3_edit.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/iperf3_stop.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/iperf3.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ You can type into the GUI the server IP and port, the duration of the test, and
You can also choose the protocol you want to use, TCP or UDP.
![iPerf3](images/iperf3.png)

#### Stop iPerf3 Run
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.
![iPerf3_stop](images/iperf3_stop.gif)

#### Edit iPerf3 Run
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.
![iPerf3_edit](images/iperf3_edit.gif)


### Results
The results of the iPerf3 test are displayed in the GUI.
![iPerf3_results](images/iPerf3_run_view.gif)
Expand Down
1 change: 0 additions & 1 deletion docs/ping.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
[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:
* packet loss
* RTT round trip time
* jitter

[Home](OpenMobileNetworkToolkit.md)
Loading

0 comments on commit 0b9b316

Please sign in to comment.