Skip to content

Commit

Permalink
Merge pull request #7 from omnt/release_0.2
Browse files Browse the repository at this point in the history
Release 0.2
  • Loading branch information
hajoha authored May 2, 2024
2 parents f7f4ca6 + d341ac3 commit 02171fc
Show file tree
Hide file tree
Showing 12 changed files with 153 additions and 107 deletions.
19 changes: 11 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ android {

defaultConfig {
applicationId "de.fraunhofer.fokus.OpenMobileNetworkToolkit"
//targetSdkPreview "VanillaIceCream"
minSdk 31
targetSdk 34
versionCode 1
versionName "0.1"
versionCode 2
versionName "0.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
signingConfig signingConfigs.debug
Expand All @@ -40,7 +41,8 @@ android {

buildTypes {
release {
minifyEnabled false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
Expand All @@ -60,15 +62,16 @@ android {
lint {
abortOnError false
}
buildToolsVersion '34.0.0'
}

spdxSbom {
targets {
create("release") {
register("release") {
configurations = ['releaseRuntimeClasspath']
scm {
uri.set("https://github.com/omnt/OpenMobileNetworkToolkit")
revision.set("0.1")
revision.set("0.2")
}
document {
name.set("OpenMobileNetworkToolkit")
Expand All @@ -88,10 +91,10 @@ dependencies {
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.guava:guava:32.1.3-jre'
implementation 'com.google.guava:guava:33.1.0-jre'
implementation 'androidx.concurrent:concurrent-futures:1.1.0'
implementation 'androidx.activity:activity:1.8.2'
implementation 'androidx.fragment:fragment:1.6.2'
implementation 'androidx.activity:activity:1.9.0'
implementation 'androidx.fragment:fragment:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
Expand Down
13 changes: 12 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,15 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-dontskipnonpubliclibraryclasses
-dontobfuscate
-forceprocessing
-optimizationpasses 5

-keep class * extends android.app.Activity
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:description="@string/app_description"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.NoActionBar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
Expand All @@ -27,6 +28,8 @@
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;

import com.google.android.material.textfield.TextInputLayout;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
Expand Down Expand Up @@ -119,26 +122,34 @@ private void read_settings(View view) {
PersistableBundle cf = tm.getCarrierConfig();
Log.d(TAG, cf.toString());
Map<String, String> map = bundle_to_map(cf);
EditText filter = requireView().findViewById(R.id.carrier_settings_filter);
String filter_string = filter.getText().toString().toUpperCase();
for (Map.Entry<String, String> entry : map.entrySet()) {
TextView key_column = new TextView(context);
TextView value_column = new TextView(context);
TableRow tr = new TableRow(context);
key_column.setText(entry.getKey().toUpperCase());
key_column.setWidth(600);
key_column.setTextIsSelectable(true);
key_column.setPadding(0, 0, 0, 20);
value_column.setText(entry.getValue());
value_column.setPadding(50, 0, 0, 0);
value_column.setTextIsSelectable(true);
tr.addView(key_column);
tr.addView(value_column);
tl.addView(tr);
if (filter_string.isEmpty()) {
TableRow tr = getTableRow(entry);
tl.addView(tr);
} else if (entry.getKey().contains(filter_string)) {
TableRow tr = getTableRow(entry);
tl.addView(tr);
}
}
cv.addView(tl);
}

private void apply_settings(View view) {
CarrierConfigManager cs = (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
cs.notifyConfigChangedForSubId(tm.getSubscriptionId());
@NonNull
private TableRow getTableRow(Map.Entry<String, String> entry) {
TextView key_column = new TextView(context);
TextView value_column = new TextView(context);
TableRow tr = new TableRow(context);
key_column.setText(entry.getKey().toUpperCase());
key_column.setWidth(600);
key_column.setTextIsSelectable(true);
key_column.setPadding(0, 0, 0, 20);
value_column.setText(entry.getValue());
value_column.setPadding(50, 0, 0, 0);
value_column.setTextIsSelectable(true);
tr.addView(key_column);
tr.addView(value_column);
return tr;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public View onCreateView(
swipeRefreshLayout.setOnRefreshListener(() -> {
LinearLayout ll = requireView().findViewById(R.id.home_layout);
ll.removeAllViews();
dp.refreshAll();
ll.addView(get_cell_card_view(), 0);
ll.addView(get_signal_strength_card_view(), 1);
ll.addView(get_network_card_view(), 2);
Expand Down Expand Up @@ -146,6 +147,7 @@ public static String toHexString(byte[] bytes) {

public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
dp.refreshAll();
LinearLayout ll = requireView().findViewById(R.id.home_layout);
ll.addView(get_cell_card_view(), 0);
ll.addView(get_signal_strength_card_view(), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,16 @@ private void stopLocalInfluxDB() {
}
}

/**
* initialize a new remote influxDB connection
*/
private void setupRemoteInfluxDB() {
Log.d(TAG, "setupRemoteInfluxDB");
ic = InfluxdbConnections.getRicInstance(getApplicationContext());
Objects.requireNonNull(ic).open_write_api();
remoteInfluxHandler = new Handler(Objects.requireNonNull(Looper.myLooper()));
remoteInfluxHandler.post(RemoteInfluxUpdate);
gv.getLog_status().setColorFilter(Color.argb(255, 255, 0, 0));
}

/**
Expand Down Expand Up @@ -628,8 +632,7 @@ public void onChanged(Object o) {
e.printStackTrace();
}


if (sp.getBoolean("enable_influx", false)) {
if (sp.getBoolean("enable_influx", false) && ic != null) {
try {
ic.writePoints(Arrays.asList(point));
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public PersistableBundle applyCarrierSettings() {
// API 30
if (sdk_version >= Build.VERSION_CODES.R) {
configForSubId.putBoolean(CarrierConfigManager.KEY_ALLOW_VIDEO_CALLING_FALLBACK_BOOL, sp.getBoolean("switch_KEY_ALLOW_VIDEO_CALLING_FALLBACK_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL, sp.getBoolean("KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL, sp.getBoolean("switch_KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL, sp.getBoolean("switch_KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, sp.getBoolean("switch_KEY_WORLD_MODE_ENABLED_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL, sp.getBoolean("switch_KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, sp.getBoolean("switch_KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL, sp.getBoolean("KEY_EDITABLE_WFC_MODE_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL, sp.getBoolean("switch_KEY_EDITABLE_WFC_MODE_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL, sp.getBoolean("switch_KEY_EDITABLE_WFC_ROAMING_MODE_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL, sp.getBoolean("witch_KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL, sp.getBoolean("switch_KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_OVERRIDE_WFC_PROVISIONING_BOOL, sp.getBoolean("switch_KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL", false));
configForSubId.putStringArray(CarrierConfigManager.KEY_READ_ONLY_APN_FIELDS_STRING_ARRAY, new String[] {sp.getString("edit_text_KEY_READ_ONLY_APN_FIELDS_STRING_ARRAY", "")});
configForSubId.putStringArray(CarrierConfigManager.KEY_APN_SETTINGS_DEFAULT_APN_TYPES_STRING_ARRAY, new String[] {sp.getString("edit_text_KEY_APN_SETTINGS_DEFAULT_APN_TYPES_STRING_ARRAY", "")});
Expand All @@ -71,7 +71,7 @@ public PersistableBundle applyCarrierSettings() {
}
configForSubId.putIntArray(CarrierConfigManager.KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY, nr_av);
configForSubId.putBoolean(CarrierConfigManager.KEY_HIDE_TTY_HCO_VCO_WITH_RTT_BOOL, sp.getBoolean("switch_KEY_HIDE_TTY_HCO_VCO_WITH_RTT_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_HIDE_ENABLE_2G, sp.getBoolean("switch_KEY_HIDE_ENABLE_2G", false));
//configForSubId.putBoolean(CarrierConfigManager.KEY_HIDE_ENABLE_2G, sp.getBoolean("switch_KEY_HIDE_ENABLE_2G", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_RTT_UPGRADE_SUPPORTED_FOR_DOWNGRADED_VT_CALL_BOOL, sp.getBoolean("switch_KEY_RTT_UPGRADE_SUPPORTED_FOR_DOWNGRADED_VT_CALL_BOOL", true));
}

Expand All @@ -82,7 +82,7 @@ public PersistableBundle applyCarrierSettings() {
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL, sp.getBoolean("switch_KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL, sp.getBoolean("switch_KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL, sp.getBoolean("switch_KEY_EDITABLE_ENHANCED_4G_LTE_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_AVAILABLE_BOOL, sp.getBoolean("KEY_CARRIER_VOLTE_AVAILABLE_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_AVAILABLE_BOOL, sp.getBoolean("switch_KEY_CARRIER_VOLTE_AVAILABLE_BOOL", true));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL, sp.getBoolean("switch_KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_VOLTE_PROVISIONED_BOOL, sp.getBoolean("switch_KEY_CARRIER_VOLTE_PROVISIONED_BOOL", false));
configForSubId.putBoolean(CarrierConfigManager.KEY_CARRIER_VT_AVAILABLE_BOOL, sp.getBoolean("switch_KEY_CARRIER_VT_AVAILABLE_BOOL", false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle saved
View v = inflater.inflate(R.layout.fragment_special_codes, parent, false);
Button android_testing = v.findViewById(R.id.bt_android_testing);
android_testing.setOnClickListener(this::buttonHandler);
Button android_ims = v.findViewById(R.id.bt_android_ims);
android_ims.setOnClickListener(this::buttonHandler);
Button mediatek_ims = v.findViewById(R.id.bt_mediatek_ims);
mediatek_ims.setOnClickListener(this::buttonHandler);
Button sony_service = v.findViewById(R.id.bt_sony_service);
Expand All @@ -57,6 +59,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle saved
special_code = v.findViewById(R.id.tv_special_code);
if (!cp) {
android_testing.setEnabled(false);
android_ims.setEnabled(false);
mediatek_ims.setEnabled(false);
sony_service.setEnabled(false);
nokia_enable_sa.setEnabled(false);
Expand Down Expand Up @@ -95,6 +98,9 @@ private void buttonHandler(View view) {
case R.id.bt_android_testing:
tm.sendDialerSpecialCode("4636");
break;
case R.id.bt_android_ims:
tm.sendDialerSpecialCode("0702");
break;
case R.id.bt_mediatek_ims:
tm.sendDialerSpecialCode("3646633");
break;
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/res/layout/fragment_carrier_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="vertical">

<Button
android:id="@+id/button_read_carrier_settings"
Expand All @@ -35,6 +35,14 @@
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:text="@string/read_carrier_settings" />

<EditText
android:id="@+id/carrier_settings_filter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:autofillHints="filter string"
android:hint="filter string"></EditText>
</LinearLayout>

<ScrollView
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/res/layout/fragment_special_codes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@
android:text="*#*#4636#*#*" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">

<Button
android:id="@+id/bt_android_ims"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_android_ims" />

<TextView
android:id="@+id/tv_android_ims"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:text="*#*#0702#*#*" />
</TableRow>

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down
29 changes: 6 additions & 23 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
<string name="home">home</string>
<string name="about">About</string>
<string name="previous">Previous</string>
<string name="hello_first_fragment">Hello first fragment</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
<string name="service_name">OMNMT</string>
<string name="service_name">OMNT</string>
<string name="app_description">OMNT OpenMobileNetworkToolkit, the swiss army knife for network researcher</string>
<string name="slicing">Slicing</string>
<string name="Log">Debug Log</string>
<string name="device_admin_description">I need your permission</string>
Expand All @@ -49,16 +48,7 @@
<string name="iperf3_instances">Instances</string>
<string name="export_logs">Export Logs</string>
<string name="channel_name">OMNT_Notification</string>
<string name="channel_description">Notification channel for Open Mobile Network Toolkit</string>


<!-- Preference Titles -->
<string name="messages_header">Messages</string>
<string name="sync_header">Sync</string>

<!-- Messages Preferences -->
<string name="signature_title">Your signature</string>
<string name="reply_title">Default reply action</string>
<string name="channel_description">Notification channel for OpenMobileNetworkToolkit</string>

<!-- Application Preferences -->
<string name="carrier_permissions">carrier_permission</string>
Expand Down Expand Up @@ -98,15 +88,7 @@
<string name="fake_location_summary">Use a fake location for all measurements for testing / privacy reasons</string>

<!-- Work Profile Management -->
<string name="intro_message">
<![CDATA[
This sample demonstrates how to create a managed profile. You can also learn how to
enable or disable other apps and how to set restrictions to them. Intents can be
configured to be forwarded between primary account and managed profile. Finally, you can
wipe all the data associated with the profile.
Note that there can only be one managed profile on a device.
]]>
</string>

<string name="set_up_profile">Set up profile</string>
<string name="enable_forwarding">Enable forwarding of Share Intent</string>
<string name="send_intent_text">Send a sample share Intent</string>
Expand Down Expand Up @@ -162,7 +144,8 @@
<string name="carrier_settings_summary">Applied on SIM / network change</string>
<string name="show_neighbour_cells">Show neighbour cells\n</string>
<string name="home_screen_settings">Home screen settings</string>
<string name="app_settings">App settings</string>>
<string name="app_settings">App settings</string>
<string name="action_android_ims">Android IMS</string>>

<!-- -->

Expand Down
Loading

0 comments on commit 02171fc

Please sign in to comment.