Add support for APK signing certificate SHA-256 digest and detecting APK release type and add them to App Info reports

The `TermuxConstants` class has been updated to `v0.21.0`. Check its Changelog sections for info on changes.
This commit is contained in:
agnostic-apollo
2021-05-13 15:40:09 +05:00
parent 4629276500
commit 1e30022ce7
4 changed files with 107 additions and 4 deletions

View File

@@ -10,6 +10,8 @@ public class DataUtils {
public static final int TRANSACTION_SIZE_LIMIT_IN_BYTES = 100 * 1024; // 100KB
private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static String getTruncatedCommandOutput(String text, int maxLength, boolean fromEnd, boolean onNewline, boolean addPrefix) {
if (text == null) return null;
@@ -43,7 +45,7 @@ public class DataUtils {
/**
* Get the {@code float} from a {@link String}.
*
* @param value The {@link String value.
* @param value The {@link String} value.
* @param def The default value if failed to read a valid value.
* @return Returns the {@code float} value after parsing the {@link String} value, otherwise
* returns default if failed to read a valid value, like in case of an exception.
@@ -62,7 +64,7 @@ public class DataUtils {
/**
* Get the {@code int} from a {@link String}.
*
* @param value The {@link String value.
* @param value The {@link String} value.
* @param def The default value if failed to read a valid value.
* @return Returns the {@code int} value after parsing the {@link String} value, otherwise
* returns default if failed to read a valid value, like in case of an exception.
@@ -78,6 +80,22 @@ public class DataUtils {
}
}
/**
* Get the {@code hex string} from a {@link byte[]}.
*
* @param bytes The {@link byte[]} value.
* @return Returns the {@code hex string} value.
*/
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars);
}
/**
* Get an {@code int} from {@link Bundle} that is stored as a {@link String}.
*