Skip to content

Commit

Permalink
update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
chdft committed Oct 24, 2020
1 parent c6f82e9 commit d76b065
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import android.view.ViewGroup;
import android.widget.Button;

import com.jaredrummler.android.shell.Shell;

import net.chdft.connectivitychecksettings.R;

import java.util.Objects;
Expand Down Expand Up @@ -57,17 +59,17 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_no_root, container, false);
((Button)view.findViewById(R.id.buttonAquirePermissions)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
attemptAquirePermissionsShell();
restartApp();
}
});
((Button)view.findViewById(R.id.buttonRestart)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent mStartActivity = new Intent(getContext(), SwitcherActivity.class);
int mPendingIntentId = 123456;
PendingIntent mPendingIntent = PendingIntent.getActivity(getContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) requireContext().getSystemService(Context.ALARM_SERVICE);
if(mgr != null) {
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
}
System.exit(0);
restartApp();
}
});
return view;
Expand All @@ -90,4 +92,19 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
}

private void attemptAquirePermissionsShell(){
Shell.SU.run("pm grant net.chdft.connectivitychecksettings android.permission.WRITE_SECURE_SETTINGS");
}

private void restartApp(){
Intent mStartActivity = new Intent(getContext(), SwitcherActivity.class);
int mPendingIntentId = 123456;
PendingIntent mPendingIntent = PendingIntent.getActivity(getContext(), mPendingIntentId, mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) requireContext().getSystemService(Context.ALARM_SERVICE);
if(mgr != null) {
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
}
System.exit(0);
}
}
6 changes: 6 additions & 0 deletions app/src/main/res/layout/fragment_no_root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
android:text="@string/no_root_corrective_action"
android:textStyle="italic" />

<Button
android:id="@+id/buttonAquirePermissions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/attempt_to_aquire_permissions" />

<Button
android:id="@+id/buttonRestart"
android:layout_width="match_parent"
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,19 @@
<string name="section_ntp">NTP (Netzwerk Zeit)</string>
<string name="section_agps">Unterstütztes GNSS</string>
<string name="no_root_description">Es ist nicht gelungen eine Root-Shell zu öffnen. Android stellt keine normale API zum ändern des System GLOBAL Einstellungsspeichers bereit, es ist daher eine Root-Shell zum setzen der Einstellungen erforderlich.</string>
<string name="no_root_corrective_action">Stellen Sie sicher, dass dieser App der Root-Zugriff gestattet ist. Da diese App freie Software ist, können Sie den Source Code kontrollieren, bevor Sie dies tun.</string>
<string name="no_root_corrective_action">Die folgenden Lösungsmöglichkeiten sind bekannt: (1) Genehmigen Sie die Verwendung der WRITE_SECURE_SETTINGS Berechtigung manuell, indem Sie den Befehl \"pm grant net.chdft.connectivitychecksettings android.permission.WRITE_SECURE_SETTINGS\" in einer Shell (z.B. über ADB oder eine lokale privilegierte Terminal App) ausführen. (2) Genehmigen Sie die Verwendung einer root-Shell. Root-Zugriff wird in der Regel über eine vorinstallierte App verwaltet, die genaue Vorgehensweise variiert aber von ROM zu ROM. Da diese App freie Software ist, können Sie den Source Code kontrollieren, bevor Sie dies tun. (3) Installieren Sie diese App als priviligierte App in /system/app anstelle von /data/app</string>
<string name="restart_app">App neustarten</string>
<string name="about_menueitem">Über</string>
<string name="libraries_header">Bibliotheken</string>
<string name="title_activity_licenses">Über</string>
<string name="known_ntp_server_description">Die unten stehnde Liste enthält dem Entwickler dieser App bekannte Server, welcher als NTP-Server geeignet sind. Das Vorkommen in dieser Liste bedeutet nicht, dass der Server stets erreichbar ist oder eine gute Wahl ist (z.B. Anfragen nicht speichert). Die List ist Teil des App-Paktes und kann daher nur mit der App zusammen aktualisiert werden.</string>
<string name="ntp_server_url_hint">NTP-Servername (FQDN oder IP; leer lassen für System-Standard)</string>
<string name="ntp_server_use_description">Der NTP-Server wird verwendet um eine zuverlässige Uhrzeit ohne Nutzereingaben zu erhalten. Die Synchronisation wird periodisch im Hintergrund durchgeführt um kleine Abweichungen der Hardware-Uhr auszugleichen. Manche Geräte verwenden für diesen Zweck allerdings bevorzug GNSS.</string>
<string-array name="known_ntp_servers_description">
<item>Verwendet den System-Standard Server (setzt eine leere Zeichenfolge als Server).</item>
<item>Server, welcher von AOSP als Standard verwendet wird, wenn der OEM und Benutzer keinen anderen setzen.</item>
<item>This server is operated by the NTP Pool Project (https://www.ntppool.org), which provides free access to well-synchronized NTP servers. Servers hosted by this organization are commonly used as default servers in embedded hardware.
Der Server wird vom NTP Pool Project (https://www.ntppool.org) bereitgestellt, welches kostenfreien Zugang zu gut synchronisierten Zeitservern bereitstellt. IOT-Geräte (z.B. Router) verwenden oft einen Server als Werkseinstellung, welcher von dieser Organisation betrieben wird.</item>
</string-array>
<string name="attempt_to_aquire_permissions">Versuche Berechtigungen dauerhaft zu gewähren (erfordert root)</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-v28/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<bool name="is_settingmap_known">true</bool>
<string-array name="connecivity_check_server_settings_http" tools:ignore="InconsistentArrays">
<item>captive_portal_http_url</item>
<item>captive_portal_fallback_url</item>
<item>captive_portal_other_fallback_urls</item>
</string-array>
<string-array name="connecivity_check_server_settings_https" tools:ignore="InconsistentArrays">
<item>captive_portal_https_url</item>
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/res/values-v29/config.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<bool name="is_settingmap_known">true</bool>
<string-array name="connecivity_check_server_settings_http" tools:ignore="InconsistentArrays">
<item>captive_portal_http_url</item>
<!-- used by https://github.com/ResurrectionRemix/android_frameworks_base/blob/3962f678c3559ee62bcfd81d353af5d86a32622e/packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java#L1223 -->
<item>captive_portal_fallback_url</item>
<item>captive_portal_other_fallback_urls</item>
</string-array>
<string-array name="connecivity_check_server_settings_https" tools:ignore="InconsistentArrays">
<item>captive_portal_https_url</item>
</string-array>
<string-array name="ntp_server_settings" tools:ignore="InconsistentArrays">
<item>ntp_server</item>
</string-array>
</resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/config.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<bool name="is_settingmap_known">false</bool>
<!-- this array should contain all keys contained in the version/ROM specific config -->
<string-array name="connecivity_check_server_settings_http" tools:ignore="InconsistentArrays">
<item>config_networkCaptivePortalServerUrl</item>
<item>networkCaptivePortalServerUrl</item>
<item>captive_portal_http_url</item>
<item>captive_portal_server</item>
<item>captive_portal_fallback_url</item>
<item>captive_portal_other_fallback_urls</item>
</string-array>
<string-array name="connecivity_check_server_settings_https" tools:ignore="InconsistentArrays">
<item>captive_portal_https_url</item>
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<string name="section_ntp">NTP (Network Time)</string>
<string name="section_agps">Assisted GNSS</string>
<string name="no_root_header">No Root Access</string>
<string name="no_root_description">This app was no able to acquire a root shell. Since Android does not provide a proper API to modify the system settings GLOBAL store, a root shell is required for this app to function.</string>
<string name="no_root_corrective_action">If your device is rooted, please grant this app root access. Since this app is Free Software, you may audit the source code before doing so.</string>
<string name="no_root_description">This app was no able to acquire a root shell. The API to modify the system settings GLOBAL store is only available to privileged apps (installed by the ROM author) by default. This app uses said API if the OS permits it and tries a root-shell as workaround.</string>
<string name="no_root_corrective_action">The following solutions are known: (1) You may grant this app the WRITE_SECURE_SETTINGS permission manually by running \"pm grant net.chdft.connectivitychecksettings android.permission.WRITE_SECURE_SETTINGS\" in a shell (for example over adb or a local privileged terminal emulator). (2) Grant this app root access. This is usually done throguh a management app provided by your ROM, but the process may vary from ROM to ROM. Since this app is Free Software, you may audit the source code before doing so. (3) Install this app as privileged app in /system/app instead of /data/app</string>
<string name="known_servers_header">Known Servers</string>
<string name="known_server_description">The following list contains servers which are known to the developer of this app to function as connectivity check server (meaning they reliably return status 204). Inclusion in this list does not constitute a recommendation and no additional checks (for example not logging requests) are performed. Since the list is hard-coded in the application package, it can only be updated, when the app is updated.</string>
<string name="save_settings">Save</string>
Expand Down Expand Up @@ -33,8 +33,8 @@
<string-array name="known_ncc_servers_title">
<item>System Default</item>
<item>Google</item>
<item>ChDF T (This app developer) Server</item>
<item>ChDF T (This app developer) Server (Intentionally Failing)</item>
<item>ChDF T\'s Server</item>
<item>ChDF T\'s Server (Intentionally Failing)</item>
</string-array>
<string-array name="known_ncc_servers_description">
<item>Uses the system-default server (sets empty string as preference value).</item>
Expand All @@ -50,20 +50,24 @@
<string-array name="known_ntp_servers_url" translatable="false">
<item />
<item>time.android.com</item>
<item>0.pool.ntp.org</item>
</string-array>
<string-array name="known_ntp_servers_title">
<item>System Default</item>
<item>Google</item>
<item>NTP Pool Project</item>
</string-array>
<string-array name="known_ntp_servers_description">
<item>Uses the system-default server (sets empty string as preference value).</item>
<item>Default server used by AOSP, if no other server was configured by the OEM or user.</item>
<item>This server is operated by the NTP Pool Project (https://www.ntppool.org), which provides free access to well-synchronized NTP servers. Servers hosted by this organization are commonly used as default servers in embedded hardware.</item>
</string-array>

<!-- Licenses/About -->
<string name="title_activity_licenses">About</string>
<string name="about_menueitem">About</string>
<string name="libraries_header">Libraries</string>
<string name="attempt_to_aquire_permissions">Attempt to Aquire Permissions permanently (requires root)</string>


</resources>

0 comments on commit d76b065

Please sign in to comment.