reduce forced restarts (Christian Schneppe)

This commit is contained in:
12aw 2022-04-29 00:36:32 +02:00
parent 3068871366
commit 8354a681ed
2 changed files with 11 additions and 17 deletions
src/main/java/eu/siacs/conversations/ui

View file

@ -206,13 +206,17 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
SharedPreferences.Editor editor = FirstStart.edit();
editor.putLong(PREF_FIRST_START, FirstStartTime);
editor.commit();
// restart
Intent restartintent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
restartintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
restartintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(restartintent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
System.exit(0);
// restart if storage not accessable
if (FileBackend.getDiskSize() > 0) {
return;
} else {
Intent restartintent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
restartintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
restartintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(restartintent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
System.exit(0);
}
}
if (useInternalUpdater()) {

View file

@ -221,17 +221,7 @@ public class ImportBackupActivity extends XmppActivity implements ServiceConnect
@Override
public void onBackupRestored() {
runOnUiThread(this::restart);
}
private void restart() {
Log.d(Config.LOGTAG, "Restarting " + getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName()));
Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
System.exit(0);
}
@Override