Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Rel 0.3.1 #16

Merged
merged 21 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# OpenMobileNetworkToolkit Changelog
## Release [0.3.1]

### Changed
- Fix Bug if DP is not available
- Use [TelephonyCallback](https://developer.android.com/reference/android/telephony/TelephonyCallback) instead of [PhoneStateListener](https://developer.android.com/reference/android/telephony/PhoneStateListener)

## Release [0.3]

### Added
Expand All @@ -11,7 +17,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
hajoha marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -211,12 +210,17 @@ public void refreshDeviceInformation() {
di.setDeviceSoftwareVersion(String.valueOf(tm.getDeviceSoftwareVersion()));
}
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, "Carrier Privileges not available");
}
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 +284,6 @@ public List<Point> getNetworkInterfaceInformationPoints() {
return points;
}


// ### Cell Information ###

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


// ### Signal Strength Information ###
@SuppressLint("ObsoleteSdkInt")
@Override
Expand Down
hajoha marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void run() {
private final Runnable notification_updater = new Runnable() {
@Override
public void run() {
if(dp == 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
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