diff --git a/app/build.gradle b/app/build.gradle index 15a3cf53..04f9a231 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 @@ -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 } @@ -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") @@ -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' diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb434..e3d3247e 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,15 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-dontskipnonpubliclibraryclasses +-dontobfuscate +-forceprocessing +-optimizationpasses 5 + +-keep class * extends android.app.Activity +-assumenosideeffects class android.util.Log { + public static *** d(...); + public static *** v(...); +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 27f6a272..ce5b6c8c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,6 +40,7 @@ map = bundle_to_map(cf); + EditText filter = requireView().findViewById(R.id.carrier_settings_filter); + String filter_string = filter.getText().toString().toUpperCase(); for (Map.Entry 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 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; } } diff --git a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/HomeFragment.java b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/HomeFragment.java index 1a2bfed1..c9e22dca 100644 --- a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/HomeFragment.java +++ b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/HomeFragment.java @@ -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); @@ -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); diff --git a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/LoggingService.java b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/LoggingService.java index fadf9f47..74e9b64e 100644 --- a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/LoggingService.java +++ b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/LoggingService.java @@ -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)); } /** @@ -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) { diff --git a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/OpenMobileNetworkToolkit.java b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/OpenMobileNetworkToolkit.java index 64039da5..a21291a9 100644 --- a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/OpenMobileNetworkToolkit.java +++ b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/OpenMobileNetworkToolkit.java @@ -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", "")}); @@ -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)); } @@ -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)); diff --git a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/SpecialCodesFragment.java b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/SpecialCodesFragment.java index 923a7989..0ca80a83 100644 --- a/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/SpecialCodesFragment.java +++ b/app/src/main/java/de/fraunhofer/fokus/OpenMobileNetworkToolkit/SpecialCodesFragment.java @@ -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); @@ -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); @@ -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; diff --git a/app/src/main/res/layout/fragment_carrier_settings.xml b/app/src/main/res/layout/fragment_carrier_settings.xml index d33f0f49..0889e4cd 100644 --- a/app/src/main/res/layout/fragment_carrier_settings.xml +++ b/app/src/main/res/layout/fragment_carrier_settings.xml @@ -25,7 +25,7 @@ + android:orientation="vertical">