mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 03:05:18 +08:00
Added: Add MAX_PHANTOM_PROCESSES
and DEVICE_CONFIG_SYNC_DISABLED
value to device info output like shown in Termux About page
Related commit b6963035
This commit is contained in:
@@ -120,7 +120,7 @@ public class SettingsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
StringBuilder aboutString = new StringBuilder();
|
StringBuilder aboutString = new StringBuilder();
|
||||||
aboutString.append(TermuxUtils.getAppInfoMarkdownString(context, TermuxUtils.AppInfoMode.TERMUX_AND_PLUGIN_PACKAGES));
|
aboutString.append(TermuxUtils.getAppInfoMarkdownString(context, TermuxUtils.AppInfoMode.TERMUX_AND_PLUGIN_PACKAGES));
|
||||||
aboutString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(context));
|
aboutString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(context, true));
|
||||||
aboutString.append("\n\n").append(TermuxUtils.getImportantLinksMarkdownString(context));
|
aboutString.append("\n\n").append(TermuxUtils.getImportantLinksMarkdownString(context));
|
||||||
|
|
||||||
String userActionName = UserAction.ABOUT.getName();
|
String userActionName = UserAction.ABOUT.getName();
|
||||||
|
@@ -755,7 +755,7 @@ public class TermuxTerminalViewClient extends TermuxTerminalViewClientBase {
|
|||||||
reportString.append("\n\n").append(TermuxUtils.getAppInfoMarkdownString(mActivity, TermuxUtils.AppInfoMode.TERMUX_PACKAGE));
|
reportString.append("\n\n").append(TermuxUtils.getAppInfoMarkdownString(mActivity, TermuxUtils.AppInfoMode.TERMUX_PACKAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
reportString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(mActivity));
|
reportString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(mActivity, true));
|
||||||
|
|
||||||
if (TermuxBootstrap.isAppPackageManagerAPT()) {
|
if (TermuxBootstrap.isAppPackageManagerAPT()) {
|
||||||
String termuxAptInfo = TermuxUtils.geAPTInfoMarkdownString(mActivity);
|
String termuxAptInfo = TermuxUtils.geAPTInfoMarkdownString(mActivity);
|
||||||
|
@@ -9,6 +9,7 @@ import android.os.Build;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
|
import com.termux.shared.R;
|
||||||
import com.termux.shared.data.DataUtils;
|
import com.termux.shared.data.DataUtils;
|
||||||
import com.termux.shared.logger.Logger;
|
import com.termux.shared.logger.Logger;
|
||||||
import com.termux.shared.markdown.MarkdownUtils;
|
import com.termux.shared.markdown.MarkdownUtils;
|
||||||
@@ -50,7 +51,7 @@ public class AndroidUtils {
|
|||||||
AndroidUtils.appendPropertyToMarkdown(markdownString,"FILES_DIR", filesDir);
|
AndroidUtils.appendPropertyToMarkdown(markdownString,"FILES_DIR", filesDir);
|
||||||
|
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ) {
|
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
Long userId = PackageUtils.getUserIdForPackage(context);
|
Long userId = PackageUtils.getUserIdForPackage(context);
|
||||||
if (userId == null || userId != 0)
|
if (userId == null || userId != 0)
|
||||||
AndroidUtils.appendPropertyToMarkdown(markdownString, "USER_ID", userId);
|
AndroidUtils.appendPropertyToMarkdown(markdownString, "USER_ID", userId);
|
||||||
@@ -99,13 +100,18 @@ public class AndroidUtils {
|
|||||||
return markdownString.toString();
|
return markdownString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getDeviceInfoMarkdownString(@NonNull final Context context) {
|
||||||
|
return getDeviceInfoMarkdownString(context, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a markdown {@link String} for the device info.
|
* Get a markdown {@link String} for the device info.
|
||||||
*
|
*
|
||||||
* @param context The context for operations.
|
* @param context The context for operations.
|
||||||
|
* @param addPhantomProcessesInfo If phantom processes info should be added on Android >= 12.
|
||||||
* @return Returns the markdown {@link String}.
|
* @return Returns the markdown {@link String}.
|
||||||
*/
|
*/
|
||||||
public static String getDeviceInfoMarkdownString(@NonNull final Context context) {
|
public static String getDeviceInfoMarkdownString(@NonNull final Context context, boolean addPhantomProcessesInfo) {
|
||||||
// Some properties cannot be read with {@link System#getProperty(String)} but can be read
|
// Some properties cannot be read with {@link System#getProperty(String)} but can be read
|
||||||
// directly by running getprop command
|
// directly by running getprop command
|
||||||
Properties systemProperties = getSystemProperties();
|
Properties systemProperties = getSystemProperties();
|
||||||
@@ -133,8 +139,16 @@ public class AndroidUtils {
|
|||||||
appendPropertyToMarkdown(markdownString, "TAGS", Build.TAGS);
|
appendPropertyToMarkdown(markdownString, "TAGS", Build.TAGS);
|
||||||
|
|
||||||
// If on Android >= 12
|
// If on Android >= 12
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R)
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||||
appendPropertyToMarkdown(markdownString, "MONITOR_PHANTOM_PROCS", FeatureFlagUtils.getFeatureFlagValueString(context, FeatureFlagUtils.SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS).getName());
|
Integer maxPhantomProcesses = PhantomProcessUtils.getActivityManagerMaxPhantomProcesses(context);
|
||||||
|
if (maxPhantomProcesses != null)
|
||||||
|
appendPropertyToMarkdown(markdownString, "MAX_PHANTOM_PROCESSES", maxPhantomProcesses);
|
||||||
|
else
|
||||||
|
appendLiteralPropertyToMarkdown(markdownString, "MAX_PHANTOM_PROCESSES", "- (*" + context.getString(R.string.msg_requires_dump_and_package_usage_stats_permissions) + "*)");
|
||||||
|
|
||||||
|
appendPropertyToMarkdown(markdownString, "MONITOR_PHANTOM_PROCS", PhantomProcessUtils.getFeatureFlagMonitorPhantomProcsValueString(context).getName());
|
||||||
|
appendPropertyToMarkdown(markdownString, "DEVICE_CONFIG_SYNC_DISABLED", PhantomProcessUtils.getSettingsGlobalDeviceConfigSyncDisabled(context));
|
||||||
|
}
|
||||||
|
|
||||||
markdownString.append("\n\n### Hardware\n");
|
markdownString.append("\n\n### Hardware\n");
|
||||||
appendPropertyToMarkdown(markdownString, "MANUFACTURER", Build.MANUFACTURER);
|
appendPropertyToMarkdown(markdownString, "MANUFACTURER", Build.MANUFACTURER);
|
||||||
@@ -222,6 +236,14 @@ public class AndroidUtils {
|
|||||||
return MarkdownUtils.getSingleLineMarkdownStringEntry(label, value, "-");
|
return MarkdownUtils.getSingleLineMarkdownStringEntry(label, value, "-");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void appendLiteralPropertyToMarkdown(StringBuilder markdownString, String label, Object value) {
|
||||||
|
markdownString.append("\n").append(getLiteralPropertyMarkdown(label, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLiteralPropertyMarkdown(String label, Object value) {
|
||||||
|
return MarkdownUtils.getLiteralSingleLineMarkdownStringEntry(label, value, "-");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getCurrentTimeStamp() {
|
public static String getCurrentTimeStamp() {
|
||||||
|
@@ -106,6 +106,10 @@ public class MarkdownUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String getLiteralSingleLineMarkdownStringEntry(String label, Object object, String def) {
|
||||||
|
return "**" + label + "**: " + (object != null ? object.toString() : def) + " ";
|
||||||
|
}
|
||||||
|
|
||||||
public static String getSingleLineMarkdownStringEntry(String label, Object object, String def) {
|
public static String getSingleLineMarkdownStringEntry(String label, Object object, String def) {
|
||||||
if (object != null)
|
if (object != null)
|
||||||
return "**" + label + "**: " + getMarkdownCodeForString(object.toString(), false) + " ";
|
return "**" + label + "**: " + getMarkdownCodeForString(object.toString(), false) + " ";
|
||||||
|
@@ -324,7 +324,7 @@ public class TermuxCrashUtils implements CrashHandler.CrashHandlerClient {
|
|||||||
reportString.append("\n\n").append(TermuxUtils.getAppInfoMarkdownString(currentPackageContext, appInfoMode, currentPackageName));
|
reportString.append("\n\n").append(TermuxUtils.getAppInfoMarkdownString(currentPackageContext, appInfoMode, currentPackageName));
|
||||||
|
|
||||||
if (addDeviceInfo)
|
if (addDeviceInfo)
|
||||||
reportString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(currentPackageContext));
|
reportString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(currentPackageContext, true));
|
||||||
|
|
||||||
String userActionName = UserAction.CRASH_REPORT.getName();
|
String userActionName = UserAction.CRASH_REPORT.getName();
|
||||||
|
|
||||||
|
@@ -362,7 +362,7 @@ public class TermuxPluginUtils {
|
|||||||
callingPackageName != null ? callingPackageName : currentPackageName));
|
callingPackageName != null ? callingPackageName : currentPackageName));
|
||||||
|
|
||||||
if (addDeviceInfo)
|
if (addDeviceInfo)
|
||||||
reportString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(currentPackageContext));
|
reportString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(currentPackageContext, true));
|
||||||
|
|
||||||
String userActionName = UserAction.PLUGIN_EXECUTION_COMMAND.getName();
|
String userActionName = UserAction.PLUGIN_EXECUTION_COMMAND.getName();
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
<string name="error_attempted_to_check_for_permissions_not_requested">Attempted to check for permissions that have not been requested in app manifest: %1$s</string>
|
<string name="error_attempted_to_check_for_permissions_not_requested">Attempted to check for permissions that have not been requested in app manifest: %1$s</string>
|
||||||
<string name="error_attempted_to_ask_for_permissions_not_requested">Attempted to ask for permissions that have not been requested in app manifest: %1$s</string>
|
<string name="error_attempted_to_ask_for_permissions_not_requested">Attempted to ask for permissions that have not been requested in app manifest: %1$s</string>
|
||||||
<string name="error_has_not_requested_legacy_external_storage">The \"%1$s\" package is targeting targetSdkVersion %2$d and is running on android sdk %3$d but has not set requestLegacyExternalStorage to true in app manifest</string>
|
<string name="error_has_not_requested_legacy_external_storage">The \"%1$s\" package is targeting targetSdkVersion %2$d and is running on android sdk %3$d but has not set requestLegacyExternalStorage to true in app manifest</string>
|
||||||
|
<string name="msg_requires_dump_and_package_usage_stats_permissions">Requires `DUMP` and `PACKAGE_USAGE_STATS` permission</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user