Browse Source

change version code, log levels, stopping message

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/44/head
R4SAS 3 years ago
parent
commit
ae3016e4b7
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 6
      app/build.gradle
  2. 10
      app/src/main/java/org/purplei2p/i2pd/DaemonWrapper.java
  3. 2
      app/src/main/java/org/purplei2p/i2pd/ForegroundService.java
  4. 23
      app/src/main/java/org/purplei2p/i2pd/I2PDActivity.java
  5. 2
      app/src/main/java/org/purplei2p/i2pd/NetworkStateChangeReceiver.java
  6. 4
      app/src/main/java/org/purplei2p/i2pd/SettingsActivity.java
  7. 2
      app/src/main/res/values-ru/strings.xml
  8. 2
      app/src/main/res/values/strings.xml

6
app/build.gradle

@ -14,9 +14,9 @@ android { @@ -14,9 +14,9 @@ android {
applicationId "org.purplei2p.i2pd"
targetSdkVersion 29
minSdkVersion 16
versionCode 24101
versionCode 2410001
versionName "2.41.0.1"
setProperty("archivesBaseName", archivesBaseName + "-" + versionName)
archivesBaseName += "-$versionName"
ndkVersion "21.4.7075529"
ndk {
@ -83,7 +83,7 @@ android.applicationVariants.all { variant -> @@ -83,7 +83,7 @@ android.applicationVariants.all { variant ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
if (baseAbiVersionCode != null) {
output.versionCodeOverride = baseAbiVersionCode + variant.versionCode
output.versionCodeOverride = baseAbiVersionCode * 10 + variant.versionCode
}
}
}

10
app/src/main/java/org/purplei2p/i2pd/DaemonWrapper.java

@ -128,7 +128,7 @@ public class DaemonWrapper { @@ -128,7 +128,7 @@ public class DaemonWrapper {
private String daemonStartResult = "N/A";
private void fireStateUpdate1(State oldValue, State newValue) {
Log.i(TAG, "daemon state change: " + state);
Log.d(TAG, "daemon state change: " + state);
for (StateUpdateListener listener : stateUpdateListeners) {
try {
listener.daemonStateUpdate(oldValue, newValue);
@ -186,7 +186,7 @@ public class DaemonWrapper { @@ -186,7 +186,7 @@ public class DaemonWrapper {
synchronized (DaemonWrapper.this) {
I2PD_JNI.setDataDir(i2pdpath); // (Environment.getExternalStorageDirectory().getAbsolutePath() + "/i2pd");
Log.d(TAG, "setting webconsole language to " + appLocale);
Log.i(TAG, "setting webconsole language to " + appLocale);
I2PD_JNI.setLanguage(appLocale);
daemonStartResult = I2PD_JNI.startDaemon();
@ -351,7 +351,7 @@ public class DaemonWrapper { @@ -351,7 +351,7 @@ public class DaemonWrapper {
}
boolean deleteResult = fileOrDirectory.delete();
if (!deleteResult)
Log.e(TAG, "fileOrDirectory.delete() returned " + deleteResult + ", absolute path='" + fileOrDirectory.getAbsolutePath() + "'");
Log.d(TAG, "fileOrDirectory.delete() returned " + deleteResult + ", absolute path='" + fileOrDirectory.getAbsolutePath() + "'");
}
private void registerNetworkCallback(){
@ -373,14 +373,14 @@ public class DaemonWrapper { @@ -373,14 +373,14 @@ public class DaemonWrapper {
public void onAvailable(Network network) {
super.onAvailable(network);
I2PD_JNI.onNetworkStateChanged(true);
Log.i(TAG, "NetworkCallback.onAvailable");
Log.d(TAG, "NetworkCallback.onAvailable");
}
@Override
public void onLost(Network network) {
super.onLost(network);
I2PD_JNI.onNetworkStateChanged(false);
Log.i(TAG, " NetworkCallback.onLost");
Log.d(TAG, " NetworkCallback.onLost");
}
}
}

2
app/src/main/java/org/purplei2p/i2pd/ForegroundService.java

@ -84,7 +84,7 @@ public class ForegroundService extends Service { @@ -84,7 +84,7 @@ public class ForegroundService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i("ForegroundService", "Received start id " + startId + ": " + intent);
Log.d("ForegroundService", "Received start id " + startId + ": " + intent);
return START_STICKY;
}

23
app/src/main/java/org/purplei2p/i2pd/I2PDActivity.java

@ -107,7 +107,7 @@ public class I2PDActivity extends Activity { @@ -107,7 +107,7 @@ public class I2PDActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@ -173,11 +173,10 @@ public class I2PDActivity extends Activity { @@ -173,11 +173,10 @@ public class I2PDActivity extends Activity {
{
if (requestCode == MY_PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
Log.e(TAG, "WR_EXT_STORAGE perm granted");
Log.w(TAG, "WR_EXT_STORAGE perm granted");
else {
Log.e(TAG, "WR_EXT_STORAGE perm declined, stopping i2pd");
i2pdStop();
//TODO must work w/o this perm, ask orignal
}
}
}
@ -318,14 +317,14 @@ public class I2PDActivity extends Activity { @@ -318,14 +317,14 @@ public class I2PDActivity extends Activity {
}
private void onReloadTunnelsConfig() {
Log.d(TAG, "reloading tunnels");
Log.i(TAG, "reloading tunnels");
daemon.reloadTunnelsConfigs();
Toast.makeText(this, R.string.tunnels_reloading, Toast.LENGTH_SHORT).show();
}
private void i2pdStop() {
cancelGracefulStop0();
Log.d(TAG, "stopping");
Log.i(TAG, "stopping");
textView.setText(getText(R.string.stopping));
new Thread(() -> {
try {
@ -351,7 +350,7 @@ public class I2PDActivity extends Activity { @@ -351,7 +350,7 @@ public class I2PDActivity extends Activity {
Toast.makeText(this, R.string.graceful_stop_is_in_progress, Toast.LENGTH_SHORT).show();
new Thread(() -> {
try {
Log.d(TAG, "graceful stopping");
Log.i(TAG, "graceful stopping");
if (daemon.isStartedOkay()) {
daemon.stopAcceptingTunnels();
long gracefulStopAtMillis;
@ -373,7 +372,7 @@ public class I2PDActivity extends Activity { @@ -373,7 +372,7 @@ public class I2PDActivity extends Activity {
cancelGracefulStop0();
new Thread(() -> {
try {
Log.d(TAG, "canceling graceful stop");
Log.i(TAG, "canceling graceful stop");
if (daemon.isStartedOkay()) {
daemon.startAcceptingTunnels();
runOnUiThread(() -> Toast.makeText(this, R.string.shutdown_canceled, Toast.LENGTH_SHORT).show());
@ -390,7 +389,7 @@ public class I2PDActivity extends Activity { @@ -390,7 +389,7 @@ public class I2PDActivity extends Activity {
gracefulQuitTimerOld.cancel();
if (daemon.getTransitTunnelsCount() <= 0) { // no tunnels left
Log.d(TAG, "no transit tunnels left, stopping");
Log.i(TAG, "no transit tunnels left, stopping");
i2pdStop();
return;
}
@ -436,7 +435,7 @@ public class I2PDActivity extends Activity { @@ -436,7 +435,7 @@ public class I2PDActivity extends Activity {
@SuppressLint("BatteryLife")
private void openBatteryOptimizationDialogIfNeeded() {
boolean questionEnabled = getPreferences().getBoolean(getBatteryOptimizationPreferenceKey(), true);
Log.i(TAG, "BATT_OPTIM_questionEnabled==" + questionEnabled);
Log.d(TAG, "BATT_OPTIM_questionEnabled==" + questionEnabled);
if (!isKnownIgnoringBatteryOptimizations()
&& android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M
&& questionEnabled) {
@ -466,14 +465,14 @@ public class I2PDActivity extends Activity { @@ -466,14 +465,14 @@ public class I2PDActivity extends Activity {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
if (pm == null) {
Log.i(TAG, "BATT_OPTIM: POWER_SERVICE==null");
Log.d(TAG, "BATT_OPTIM: POWER_SERVICE==null");
return false;
}
boolean ignoring = pm.isIgnoringBatteryOptimizations(getPackageName());
Log.i(TAG, "BATT_OPTIM: ignoring==" + ignoring);
Log.d(TAG, "BATT_OPTIM: ignoring==" + ignoring);
return ignoring;
} else {
Log.i(TAG, "BATT_OPTIM: old SDK version==" + Build.VERSION.SDK_INT);
Log.d(TAG, "BATT_OPTIM: old SDK version==" + Build.VERSION.SDK_INT);
return false;
}
}

2
app/src/main/java/org/purplei2p/i2pd/NetworkStateChangeReceiver.java

@ -21,7 +21,7 @@ public class NetworkStateChangeReceiver extends BroadcastReceiver { @@ -21,7 +21,7 @@ public class NetworkStateChangeReceiver extends BroadcastReceiver {
I2PD_JNI.onNetworkStateChanged(isConnected);
} catch (Throwable tr) {
Log.d(TAG, "", tr);
Log.e(TAG, "", tr);
}
}
}

4
app/src/main/java/org/purplei2p/i2pd/SettingsActivity.java

@ -78,7 +78,7 @@ public class SettingsActivity extends Activity { @@ -78,7 +78,7 @@ public class SettingsActivity extends Activity {
}
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Objects.requireNonNull(getActionBar()).setDisplayHomeAsUpEnabled(true);
@ -99,7 +99,7 @@ public class SettingsActivity extends Activity { @@ -99,7 +99,7 @@ public class SettingsActivity extends Activity {
if (!onBoot.createNewFile())
Log.d(TAG, "Cant create new wile on: "+onBoot.getAbsolutePath());
} catch (Exception e) {
Log.d(TAG, "error: " + e.toString());
Log.e(TAG, "error: " + e.toString());
}
}
} else {

2
app/src/main/res/values-ru/strings.xml

@ -56,5 +56,5 @@ @@ -56,5 +56,5 @@
<string name="services">Внутренние сервисы</string>
<string name="services_http_proxy">HTTP Прокси</string>
<string name="services_socks_proxy">SOCKS5 Прокси</string>
<string name="stopping">Остановка приложения</string>
<string name="stopping">Остановка приложения...</string>
</resources>

2
app/src/main/res/values/strings.xml

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
<string name="startedOkay">Application started</string>
<string name="startFailed">Start failed</string>
<string name="stopped">Application stopped</string>
<string name="stopping">Application stopping</string>
<string name="stopping">Application stopping...</string>
<string name="remaining">remaining</string>
<string name="ok" translatable="false">OK</string>

Loading…
Cancel
Save