2020-12-09 11:42:01 +00:00
|
|
|
package org.schabi.newpipe.error;
|
2016-02-25 22:19:43 +00:00
|
|
|
|
2021-12-01 08:10:59 +00:00
|
|
|
import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;
|
|
|
|
|
2016-02-25 21:02:42 +00:00
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2016-02-25 22:19:43 +00:00
|
|
|
import android.net.Uri;
|
2016-02-25 21:02:42 +00:00
|
|
|
import android.os.Build;
|
2017-02-27 11:55:15 +00:00
|
|
|
import android.os.Bundle;
|
2016-02-25 22:19:43 +00:00
|
|
|
import android.util.Log;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
2016-02-25 21:02:42 +00:00
|
|
|
import android.view.MenuItem;
|
|
|
|
|
2020-03-31 17:20:15 +00:00
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.appcompat.app.ActionBar;
|
2021-04-01 19:46:29 +00:00
|
|
|
import androidx.appcompat.app.AlertDialog;
|
2020-03-31 17:20:15 +00:00
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
|
2020-04-20 09:02:45 +00:00
|
|
|
import com.grack.nanojson.JsonWriter;
|
2020-03-31 17:20:15 +00:00
|
|
|
|
2016-09-13 21:39:32 +00:00
|
|
|
import org.schabi.newpipe.BuildConfig;
|
|
|
|
import org.schabi.newpipe.MainActivity;
|
|
|
|
import org.schabi.newpipe.R;
|
2020-10-31 10:14:11 +00:00
|
|
|
import org.schabi.newpipe.databinding.ActivityErrorBinding;
|
2020-06-28 14:07:17 +00:00
|
|
|
import org.schabi.newpipe.util.Localization;
|
2017-02-27 11:55:15 +00:00
|
|
|
import org.schabi.newpipe.util.ThemeHelper;
|
2021-12-01 08:10:59 +00:00
|
|
|
import org.schabi.newpipe.util.external_communication.ShareUtils;
|
2016-02-25 21:02:42 +00:00
|
|
|
|
2020-12-11 13:55:47 +00:00
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
2020-04-20 09:02:45 +00:00
|
|
|
import java.util.Arrays;
|
2022-07-29 03:35:50 +00:00
|
|
|
import java.util.stream.Collectors;
|
2016-02-25 21:02:42 +00:00
|
|
|
|
2017-09-03 06:04:18 +00:00
|
|
|
/*
|
2016-02-25 22:19:43 +00:00
|
|
|
* Created by Christian Schabesberger on 24.10.15.
|
2016-09-11 22:33:11 +00:00
|
|
|
*
|
2016-02-25 22:19:43 +00:00
|
|
|
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
|
|
|
* ErrorActivity.java is part of NewPipe.
|
2016-09-11 22:33:11 +00:00
|
|
|
*
|
2016-02-25 22:19:43 +00:00
|
|
|
* NewPipe is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-09-11 22:33:11 +00:00
|
|
|
* <
|
2016-02-25 22:19:43 +00:00
|
|
|
* NewPipe is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2016-09-11 22:33:11 +00:00
|
|
|
* <
|
2016-02-25 22:19:43 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-12-07 17:11:36 +00:00
|
|
|
/**
|
|
|
|
* This activity is used to show error details and allow reporting them in various ways. Use {@link
|
|
|
|
* ErrorUtil#openActivity(Context, ErrorInfo)} to correctly open this activity.
|
|
|
|
*/
|
2021-12-01 08:43:24 +00:00
|
|
|
public class ErrorActivity extends AppCompatActivity {
|
2016-09-13 20:36:47 +00:00
|
|
|
// LOG TAGS
|
2016-02-25 21:02:42 +00:00
|
|
|
public static final String TAG = ErrorActivity.class.toString();
|
2016-09-13 20:36:47 +00:00
|
|
|
// BUNDLE TAGS
|
|
|
|
public static final String ERROR_INFO = "error_info";
|
2017-06-28 05:27:32 +00:00
|
|
|
|
2016-02-27 14:57:37 +00:00
|
|
|
public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org";
|
2021-02-21 21:22:27 +00:00
|
|
|
public static final String ERROR_EMAIL_SUBJECT = "Exception in ";
|
2020-06-28 14:07:17 +00:00
|
|
|
|
2022-07-10 12:19:58 +00:00
|
|
|
public static final String ERROR_GITHUB_ISSUE_URL =
|
|
|
|
"https://github.com/TeamNewPipe/NewPipe/issues";
|
2020-06-28 14:07:17 +00:00
|
|
|
|
2022-07-10 12:19:58 +00:00
|
|
|
public static final DateTimeFormatter CURRENT_TIMESTAMP_FORMATTER =
|
|
|
|
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
2020-12-11 13:55:47 +00:00
|
|
|
|
|
|
|
|
2016-02-25 21:02:42 +00:00
|
|
|
private ErrorInfo errorInfo;
|
2016-02-27 14:02:28 +00:00
|
|
|
private String currentTimeStamp;
|
2020-10-31 10:14:11 +00:00
|
|
|
|
|
|
|
private ActivityErrorBinding activityErrorBinding;
|
2016-02-25 21:02:42 +00:00
|
|
|
|
|
|
|
|
2020-12-11 13:55:47 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2021-01-09 15:33:59 +00:00
|
|
|
// Activity lifecycle
|
2020-12-11 13:55:47 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2016-09-13 21:24:49 +00:00
|
|
|
|
2016-02-25 21:02:42 +00:00
|
|
|
@Override
|
2020-03-31 17:20:15 +00:00
|
|
|
protected void onCreate(final Bundle savedInstanceState) {
|
2020-01-28 19:48:42 +00:00
|
|
|
assureCorrectAppLanguage(this);
|
2016-02-25 21:02:42 +00:00
|
|
|
super.onCreate(savedInstanceState);
|
2021-03-29 19:44:03 +00:00
|
|
|
|
|
|
|
ThemeHelper.setDayNightMode(this);
|
2017-04-26 19:32:20 +00:00
|
|
|
ThemeHelper.setTheme(this);
|
2020-10-31 10:14:11 +00:00
|
|
|
|
|
|
|
activityErrorBinding = ActivityErrorBinding.inflate(getLayoutInflater());
|
|
|
|
setContentView(activityErrorBinding.getRoot());
|
2016-09-13 20:36:47 +00:00
|
|
|
|
2020-08-16 08:24:58 +00:00
|
|
|
final Intent intent = getIntent();
|
2016-09-13 20:36:47 +00:00
|
|
|
|
2020-10-31 10:14:11 +00:00
|
|
|
setSupportActionBar(activityErrorBinding.toolbarLayout.toolbar);
|
2017-04-26 19:32:20 +00:00
|
|
|
|
2020-08-16 08:24:58 +00:00
|
|
|
final ActionBar actionBar = getSupportActionBar();
|
2017-04-26 19:32:20 +00:00
|
|
|
if (actionBar != null) {
|
2016-05-25 21:51:22 +00:00
|
|
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
|
|
actionBar.setTitle(R.string.error_report_title);
|
|
|
|
actionBar.setDisplayShowTitleEnabled(true);
|
|
|
|
}
|
2016-02-25 21:02:42 +00:00
|
|
|
|
2016-09-13 20:36:47 +00:00
|
|
|
errorInfo = intent.getParcelableExtra(ERROR_INFO);
|
2016-02-25 21:02:42 +00:00
|
|
|
|
2017-06-28 05:27:32 +00:00
|
|
|
// important add guru meditation
|
2020-06-28 14:07:17 +00:00
|
|
|
addGuruMeditation();
|
2020-12-11 13:55:47 +00:00
|
|
|
currentTimeStamp = CURRENT_TIMESTAMP_FORMATTER.format(LocalDateTime.now());
|
2016-02-25 22:19:43 +00:00
|
|
|
|
2020-10-31 10:14:11 +00:00
|
|
|
activityErrorBinding.errorReportEmailButton.setOnClickListener(v ->
|
2020-08-27 20:56:41 +00:00
|
|
|
openPrivacyPolicyDialog(this, "EMAIL"));
|
2018-05-24 15:10:28 +00:00
|
|
|
|
2020-12-11 13:55:47 +00:00
|
|
|
activityErrorBinding.errorReportCopyButton.setOnClickListener(v ->
|
|
|
|
ShareUtils.copyToClipboard(this, buildMarkdown()));
|
2016-02-25 22:19:43 +00:00
|
|
|
|
2020-10-31 10:14:11 +00:00
|
|
|
activityErrorBinding.errorReportGitHubButton.setOnClickListener(v ->
|
2020-08-27 20:56:41 +00:00
|
|
|
openPrivacyPolicyDialog(this, "GITHUB"));
|
2016-02-27 14:02:28 +00:00
|
|
|
|
2016-09-13 20:36:47 +00:00
|
|
|
// normal bugreport
|
|
|
|
buildInfo(errorInfo);
|
2020-12-11 13:55:47 +00:00
|
|
|
activityErrorBinding.errorMessageView.setText(errorInfo.getMessageStringId());
|
|
|
|
activityErrorBinding.errorView.setText(formErrorText(errorInfo.getStackTraces()));
|
2017-02-12 15:45:01 +00:00
|
|
|
|
2020-06-28 14:07:17 +00:00
|
|
|
// print stack trace once again for debugging:
|
2020-12-11 13:55:47 +00:00
|
|
|
for (final String e : errorInfo.getStackTraces()) {
|
2017-02-12 15:45:01 +00:00
|
|
|
Log.e(TAG, e);
|
|
|
|
}
|
2016-02-25 22:19:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-03-31 17:20:15 +00:00
|
|
|
public boolean onCreateOptionsMenu(final Menu menu) {
|
2020-08-16 08:24:58 +00:00
|
|
|
final MenuInflater inflater = getMenuInflater();
|
2016-02-25 22:19:43 +00:00
|
|
|
inflater.inflate(R.menu.error_menu, menu);
|
|
|
|
return true;
|
2016-02-25 21:02:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-03-31 17:20:15 +00:00
|
|
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
2021-04-19 05:22:52 +00:00
|
|
|
switch (item.getItemId()) {
|
2021-05-15 21:49:52 +00:00
|
|
|
case android.R.id.home:
|
2021-04-19 05:22:52 +00:00
|
|
|
onBackPressed();
|
|
|
|
return true;
|
|
|
|
case R.id.menu_item_share_error:
|
2021-04-25 12:14:56 +00:00
|
|
|
ShareUtils.shareText(getApplicationContext(),
|
|
|
|
getString(R.string.error_report_title), buildJson());
|
2021-04-19 05:22:52 +00:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
2016-02-25 21:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-28 14:07:17 +00:00
|
|
|
private void openPrivacyPolicyDialog(final Context context, final String action) {
|
|
|
|
new AlertDialog.Builder(context)
|
|
|
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
|
|
|
.setTitle(R.string.privacy_policy_title)
|
|
|
|
.setMessage(R.string.start_accept_privacy_policy)
|
|
|
|
.setCancelable(false)
|
2020-08-27 20:56:41 +00:00
|
|
|
.setNeutralButton(R.string.read_privacy_policy, (dialog, which) ->
|
|
|
|
ShareUtils.openUrlInBrowser(context,
|
|
|
|
context.getString(R.string.privacy_policy_url)))
|
2020-06-28 14:07:17 +00:00
|
|
|
.setPositiveButton(R.string.accept, (dialog, which) -> {
|
|
|
|
if (action.equals("EMAIL")) { // send on email
|
|
|
|
final Intent i = new Intent(Intent.ACTION_SENDTO)
|
|
|
|
.setData(Uri.parse("mailto:")) // only email apps should handle this
|
|
|
|
.putExtra(Intent.EXTRA_EMAIL, new String[]{ERROR_EMAIL_ADDRESS})
|
2021-02-21 21:22:27 +00:00
|
|
|
.putExtra(Intent.EXTRA_SUBJECT, ERROR_EMAIL_SUBJECT
|
|
|
|
+ getString(R.string.app_name) + " "
|
|
|
|
+ BuildConfig.VERSION_NAME)
|
2020-06-28 14:07:17 +00:00
|
|
|
.putExtra(Intent.EXTRA_TEXT, buildJson());
|
2021-03-13 11:37:54 +00:00
|
|
|
ShareUtils.openIntentInApp(context, i, true);
|
2020-06-28 14:07:17 +00:00
|
|
|
} else if (action.equals("GITHUB")) { // open the NewPipe issue page on GitHub
|
2020-12-15 19:11:55 +00:00
|
|
|
ShareUtils.openUrlInBrowser(this, ERROR_GITHUB_ISSUE_URL, false);
|
2020-06-28 14:07:17 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.setNegativeButton(R.string.decline, (dialog, which) -> {
|
|
|
|
// do nothing
|
|
|
|
})
|
|
|
|
.show();
|
|
|
|
}
|
|
|
|
|
2020-03-31 17:20:15 +00:00
|
|
|
private String formErrorText(final String[] el) {
|
2022-07-29 03:35:50 +00:00
|
|
|
final String separator = "-------------------------------------";
|
|
|
|
return Arrays.stream(el)
|
|
|
|
.collect(Collectors.joining(separator + "\n", separator + "\n", separator));
|
2016-02-25 21:02:42 +00:00
|
|
|
}
|
|
|
|
|
2020-04-02 11:51:10 +00:00
|
|
|
/**
|
|
|
|
* Get the checked activity.
|
|
|
|
*
|
|
|
|
* @param returnActivity the activity to return to
|
|
|
|
* @return the casted return activity or null
|
|
|
|
*/
|
|
|
|
@Nullable
|
|
|
|
static Class<? extends Activity> getReturnActivity(final Class<?> returnActivity) {
|
|
|
|
Class<? extends Activity> checkedReturnActivity = null;
|
|
|
|
if (returnActivity != null) {
|
|
|
|
if (Activity.class.isAssignableFrom(returnActivity)) {
|
|
|
|
checkedReturnActivity = returnActivity.asSubclass(Activity.class);
|
|
|
|
} else {
|
|
|
|
checkedReturnActivity = MainActivity.class;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return checkedReturnActivity;
|
|
|
|
}
|
|
|
|
|
2020-03-31 17:20:15 +00:00
|
|
|
private void buildInfo(final ErrorInfo info) {
|
2016-02-25 21:02:42 +00:00
|
|
|
String text = "";
|
|
|
|
|
2020-10-31 10:14:11 +00:00
|
|
|
activityErrorBinding.errorInfoLabelsView.setText(getString(R.string.info_labels)
|
|
|
|
.replace("\\n", "\n"));
|
2016-02-25 21:02:42 +00:00
|
|
|
|
2020-10-04 01:50:28 +00:00
|
|
|
text += getUserActionString(info.getUserAction()) + "\n"
|
|
|
|
+ info.getRequest() + "\n"
|
2020-06-28 14:07:17 +00:00
|
|
|
+ getContentLanguageString() + "\n"
|
|
|
|
+ getContentCountryString() + "\n"
|
|
|
|
+ getAppLanguage() + "\n"
|
2020-10-04 01:50:28 +00:00
|
|
|
+ info.getServiceName() + "\n"
|
2020-03-31 17:20:15 +00:00
|
|
|
+ currentTimeStamp + "\n"
|
|
|
|
+ getPackageName() + "\n"
|
|
|
|
+ BuildConfig.VERSION_NAME + "\n"
|
|
|
|
+ getOsString();
|
2016-02-25 21:02:42 +00:00
|
|
|
|
2020-10-31 10:14:11 +00:00
|
|
|
activityErrorBinding.errorInfosView.setText(text);
|
2016-02-25 21:02:42 +00:00
|
|
|
}
|
|
|
|
|
2016-02-25 22:19:43 +00:00
|
|
|
private String buildJson() {
|
|
|
|
try {
|
2020-04-20 09:02:45 +00:00
|
|
|
return JsonWriter.string()
|
|
|
|
.object()
|
2020-10-04 01:50:28 +00:00
|
|
|
.value("user_action", getUserActionString(errorInfo.getUserAction()))
|
|
|
|
.value("request", errorInfo.getRequest())
|
2020-06-28 14:07:17 +00:00
|
|
|
.value("content_language", getContentLanguageString())
|
|
|
|
.value("content_country", getContentCountryString())
|
|
|
|
.value("app_language", getAppLanguage())
|
2020-10-04 01:50:28 +00:00
|
|
|
.value("service", errorInfo.getServiceName())
|
2020-04-20 09:02:45 +00:00
|
|
|
.value("package", getPackageName())
|
|
|
|
.value("version", BuildConfig.VERSION_NAME)
|
|
|
|
.value("os", getOsString())
|
|
|
|
.value("time", currentTimeStamp)
|
2020-12-11 13:55:47 +00:00
|
|
|
.array("exceptions", Arrays.asList(errorInfo.getStackTraces()))
|
2020-10-31 10:14:11 +00:00
|
|
|
.value("user_comment", activityErrorBinding.errorCommentBox.getText()
|
|
|
|
.toString())
|
2020-04-20 09:02:45 +00:00
|
|
|
.end()
|
|
|
|
.done();
|
2020-08-16 08:24:58 +00:00
|
|
|
} catch (final Throwable e) {
|
2016-02-25 22:19:43 +00:00
|
|
|
Log.e(TAG, "Error while erroring: Could not build json");
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2020-06-28 14:07:17 +00:00
|
|
|
private String buildMarkdown() {
|
|
|
|
try {
|
|
|
|
final StringBuilder htmlErrorReport = new StringBuilder();
|
|
|
|
|
2020-10-31 10:14:11 +00:00
|
|
|
final String userComment = activityErrorBinding.errorCommentBox.getText().toString();
|
2020-06-28 14:07:17 +00:00
|
|
|
if (!userComment.isEmpty()) {
|
|
|
|
htmlErrorReport.append(userComment).append("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// basic error info
|
|
|
|
htmlErrorReport
|
|
|
|
.append("## Exception")
|
|
|
|
.append("\n* __User Action:__ ")
|
2020-10-04 01:50:28 +00:00
|
|
|
.append(getUserActionString(errorInfo.getUserAction()))
|
|
|
|
.append("\n* __Request:__ ").append(errorInfo.getRequest())
|
2020-06-28 14:07:17 +00:00
|
|
|
.append("\n* __Content Country:__ ").append(getContentCountryString())
|
|
|
|
.append("\n* __Content Language:__ ").append(getContentLanguageString())
|
|
|
|
.append("\n* __App Language:__ ").append(getAppLanguage())
|
2020-10-04 01:50:28 +00:00
|
|
|
.append("\n* __Service:__ ").append(errorInfo.getServiceName())
|
2020-06-28 14:07:17 +00:00
|
|
|
.append("\n* __Version:__ ").append(BuildConfig.VERSION_NAME)
|
|
|
|
.append("\n* __OS:__ ").append(getOsString()).append("\n");
|
|
|
|
|
|
|
|
|
|
|
|
// Collapse all logs to a single paragraph when there are more than one
|
|
|
|
// to keep the GitHub issue clean.
|
2020-12-11 13:55:47 +00:00
|
|
|
if (errorInfo.getStackTraces().length > 1) {
|
2020-06-28 14:07:17 +00:00
|
|
|
htmlErrorReport
|
|
|
|
.append("<details><summary><b>Exceptions (")
|
2020-12-11 13:55:47 +00:00
|
|
|
.append(errorInfo.getStackTraces().length)
|
2020-06-28 14:07:17 +00:00
|
|
|
.append(")</b></summary><p>\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// add the logs
|
2020-12-11 13:55:47 +00:00
|
|
|
for (int i = 0; i < errorInfo.getStackTraces().length; i++) {
|
2020-06-28 14:07:17 +00:00
|
|
|
htmlErrorReport.append("<details><summary><b>Crash log ");
|
2020-12-11 13:55:47 +00:00
|
|
|
if (errorInfo.getStackTraces().length > 1) {
|
2020-06-28 14:07:17 +00:00
|
|
|
htmlErrorReport.append(i + 1);
|
|
|
|
}
|
|
|
|
htmlErrorReport.append("</b>")
|
|
|
|
.append("</summary><p>\n")
|
2020-12-11 13:55:47 +00:00
|
|
|
.append("\n```\n").append(errorInfo.getStackTraces()[i]).append("\n```\n")
|
2020-06-28 14:07:17 +00:00
|
|
|
.append("</details>\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// make sure to close everything
|
2020-12-11 13:55:47 +00:00
|
|
|
if (errorInfo.getStackTraces().length > 1) {
|
2020-06-28 14:07:17 +00:00
|
|
|
htmlErrorReport.append("</p></details>\n");
|
|
|
|
}
|
|
|
|
htmlErrorReport.append("<hr>\n");
|
|
|
|
return htmlErrorReport.toString();
|
2020-08-16 08:24:58 +00:00
|
|
|
} catch (final Throwable e) {
|
2020-06-28 14:07:17 +00:00
|
|
|
Log.e(TAG, "Error while erroring: Could not build markdown");
|
|
|
|
e.printStackTrace();
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-31 17:20:15 +00:00
|
|
|
private String getUserActionString(final UserAction userAction) {
|
2017-09-03 06:04:18 +00:00
|
|
|
if (userAction == null) {
|
2017-06-28 05:27:32 +00:00
|
|
|
return "Your description is in another castle.";
|
|
|
|
} else {
|
|
|
|
return userAction.getMessage();
|
2016-02-25 22:19:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-28 14:07:17 +00:00
|
|
|
private String getContentCountryString() {
|
|
|
|
return Localization.getPreferredContentCountry(this).getCountryCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getContentLanguageString() {
|
|
|
|
return Localization.getPreferredLocalization(this).getLocalizationCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getAppLanguage() {
|
|
|
|
return Localization.getAppLocale(getApplicationContext()).toString();
|
2016-02-25 22:19:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private String getOsString() {
|
2020-08-27 20:59:29 +00:00
|
|
|
final String osBase = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
|
|
|
? Build.VERSION.BASE_OS : "Android";
|
2016-02-27 14:02:28 +00:00
|
|
|
return System.getProperty("os.name")
|
2016-02-25 22:19:43 +00:00
|
|
|
+ " " + (osBase.isEmpty() ? "Android" : osBase)
|
|
|
|
+ " " + Build.VERSION.RELEASE
|
2020-03-31 17:20:15 +00:00
|
|
|
+ " - " + Build.VERSION.SDK_INT;
|
2016-02-25 22:19:43 +00:00
|
|
|
}
|
|
|
|
|
2020-06-28 14:07:17 +00:00
|
|
|
private void addGuruMeditation() {
|
2016-02-25 21:02:42 +00:00
|
|
|
//just an easter egg
|
2020-10-31 10:14:11 +00:00
|
|
|
String text = activityErrorBinding.errorSorryView.getText().toString();
|
2016-02-25 21:02:42 +00:00
|
|
|
text += "\n" + getString(R.string.guru_meditation);
|
2020-10-31 10:14:11 +00:00
|
|
|
activityErrorBinding.errorSorryView.setText(text);
|
2016-02-25 21:02:42 +00:00
|
|
|
}
|
|
|
|
}
|