mirror of
https://github.com/RfidResearchGroup/RFIDtools.git
synced 2026-05-12 11:19:59 -07:00
add some string
This commit is contained in:
@@ -328,5 +328,7 @@
|
||||
<string name="title_sub_terminal_type_setting">The complete terminal view is suitable for developers or masters, while the simple terminal view is suitable for novice users.</string>
|
||||
<string name="unselected">Unselected</string>
|
||||
<string name="tips_plz_wait">请稍等</string>
|
||||
<string name="select">select</string>
|
||||
<string name="title_pm3_home">Proxmark3 External Work Directory</string>
|
||||
|
||||
</resources>
|
||||
@@ -334,5 +334,7 @@
|
||||
<string name="title_sub_terminal_type_setting">完整的终端视图适合开发人员或大师,而简单终端视图适合新手用户。</string>
|
||||
<string name="unselected">未选择</string>
|
||||
<string name="tips_plz_wait">请稍等。</string>
|
||||
<string name="select">选择</string>
|
||||
<string name="title_pm3_home">Proxmark3 外部工作目录</string>
|
||||
|
||||
</resources>
|
||||
@@ -299,7 +299,6 @@
|
||||
<string name="custom_firmware">Custom firmware</string>
|
||||
<string name="title_select_bootrom">Select BootRom</string>
|
||||
<string name="select_fullimage">Select FullImage</string>
|
||||
<string name="tips_view_use_termux">Will use TERMUX implement UI</string>
|
||||
<string name="tips_fw_client_version_same">1. Your FW can\'t than for client version too low or high , you need go flash FW.</string>
|
||||
<string name="tips_check_auto_go_termux">2. Check \'Auto Go\', it will auto go to terminal view.</string>
|
||||
<string name="auto_go">Auto Go</string>
|
||||
@@ -328,5 +327,7 @@
|
||||
<string name="title_sub_terminal_type_setting">The complete terminal view is suitable for developers or masters, while the simple terminal view is suitable for novice users.</string>
|
||||
<string name="unselected">Unselected</string>
|
||||
<string name="tips_plz_wait">Please wait.</string>
|
||||
<string name="select">select</string>
|
||||
<string name="title_pm3_home">Proxmark3 External Work Directory</string>
|
||||
|
||||
</resources>
|
||||
@@ -15,7 +15,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
// applicationId "com.termux"
|
||||
minSdkVersion 24
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 95
|
||||
versionName "0.95"
|
||||
|
||||
@@ -67,6 +67,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.PermissionChecker;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
@@ -198,10 +200,10 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
||||
* For processes to access shared internal storage (/sdcard) we need this permission.
|
||||
*/
|
||||
public boolean ensureStoragePermissionGranted() {
|
||||
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
||||
if (PermissionChecker.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PermissionChecker.PERMISSION_GRANTED) {
|
||||
return true;
|
||||
} else {
|
||||
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUESTCODE_PERMISSION_STORAGE);
|
||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUESTCODE_PERMISSION_STORAGE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
||||
public static final String FILES_PATH = "/data/data/" + packageName + "/files";
|
||||
public static final String PREFIX_PATH = FILES_PATH + "/usr";
|
||||
public static final String HOME_PATH = FILES_PATH + "/home";
|
||||
public static String PM3_CWD = null;
|
||||
|
||||
private static final int NOTIFICATION_ID = 1337;
|
||||
|
||||
@@ -122,7 +123,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
||||
if (mWakeLock == null) {
|
||||
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
|
||||
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, EmulatorDebug.LOG_TAG);
|
||||
mWakeLock.acquire();
|
||||
mWakeLock.acquire(10 * 60 * 1000L /*10 minutes*/);
|
||||
|
||||
// http://tools.android.com/tech-docs/lint-in-studio-2-3#TOC-WifiManager-Leak
|
||||
WifiManager wm = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
|
||||
@@ -130,16 +131,18 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
||||
mWifiLock.acquire();
|
||||
|
||||
String packageName = getPackageName();
|
||||
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
|
||||
Intent whitelist = new Intent();
|
||||
whitelist.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||
whitelist.setData(Uri.parse("package:" + packageName));
|
||||
whitelist.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
|
||||
Intent whitelist = new Intent();
|
||||
whitelist.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||
whitelist.setData(Uri.parse("package:" + packageName));
|
||||
whitelist.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
try {
|
||||
startActivity(whitelist);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(EmulatorDebug.LOG_TAG, "Failed to call ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS", e);
|
||||
try {
|
||||
startActivity(whitelist);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Log.e(EmulatorDebug.LOG_TAG, "Failed to call ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,6 +302,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
||||
TerminalSession createTermSession(String executablePath, String[] arguments, String cwd, boolean failSafe) {
|
||||
new File(HOME_PATH).mkdirs();
|
||||
|
||||
if (PM3_CWD != null) cwd = PM3_CWD;
|
||||
if (cwd == null) cwd = HOME_PATH;
|
||||
|
||||
String[] env = BackgroundJob.buildEnvironment(failSafe, cwd);
|
||||
|
||||
@@ -354,43 +354,52 @@ public class FileUtils {
|
||||
|
||||
private static String getFilePathByUri_BELOWAPI11(Uri uri) {
|
||||
// 以 content:// 开头的,比如 content://media/extenral/images/media/17766
|
||||
if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
|
||||
String path = null;
|
||||
String[] projection = new String[]{MediaStore.Images.Media.DATA};
|
||||
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
||||
try {
|
||||
if (ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) {
|
||||
String path = null;
|
||||
String[] projection = new String[]{MediaStore.Images.Media.DATA};
|
||||
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
try {
|
||||
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
if (columnIndex > -1) {
|
||||
path = cursor.getString(columnIndex);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getFilePathByUri_API11to18(Uri contentUri) {
|
||||
String result = null;
|
||||
try {
|
||||
String[] projection = {MediaStore.Images.Media.DATA};
|
||||
|
||||
CursorLoader cursorLoader = new CursorLoader(context, contentUri, projection, null, null, null);
|
||||
Cursor cursor = cursorLoader.loadInBackground();
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
try {
|
||||
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
if (columnIndex > -1) {
|
||||
path = cursor.getString(columnIndex);
|
||||
}
|
||||
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
result = cursor.getString(column_index);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getFilePathByUri_API11to18(Uri contentUri) {
|
||||
String[] projection = {MediaStore.Images.Media.DATA};
|
||||
String result = null;
|
||||
CursorLoader cursorLoader = new CursorLoader(context, contentUri, projection, null, null, null);
|
||||
Cursor cursor = cursorLoader.loadInBackground();
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
try {
|
||||
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
result = cursor.getString(column_index);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user