Mercurial > 510Connectbot
changeset 498:3feac274a27b
updates for android10+
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 06 Jun 2022 15:05:20 -0700 |
parents | 73fa7329dc87 |
children | 267e72057707 |
files | Makefile app/src/main/AndroidManifest.xml app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java |
diffstat | 3 files changed, 27 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Jun 06 13:01:45 2022 -0700 +++ b/Makefile Mon Jun 06 15:05:20 2022 -0700 @@ -3,7 +3,7 @@ na=$(shell find . -iname '*.c' -o -iname '*.h' -o -iname '*.cpp') style:=release -dest:=../ASM/Installers +dest:=../ASM.v6/installers ver:=$(shell grep versionName app/src/main/AndroidManifest.xml | cut -d'"' -f2) id:=$(shell hg id --id || echo 1) da:=$(shell date '+%Y-%m-%dT%H:%M:%S')
--- a/app/src/main/AndroidManifest.xml Mon Jun 06 13:01:45 2022 -0700 +++ b/app/src/main/AndroidManifest.xml Mon Jun 06 15:05:20 2022 -0700 @@ -26,25 +26,29 @@ <uses-permission android:name="android.permission.FOREGROUND" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.REORDER_TASKS"/> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" /> <permission android:name="org.openintents.ssh.permission.ACCESS_SSH_AGENT" android:protectionLevel="dangerous" - android:permissionGroup="android.permission-group.PERSONAL_INFO" android:label="@string/ssh_agent_permission_label" android:description="@string/ssh_agent_permission_desc" android:icon="@drawable/pubkey"> </permission> + <!-- android:permissionGroup="android.permission-group.PERSONAL_INFO" + --> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <supports-screens /> <application + android:requestLegacyExternalStorage="true" android:icon="@drawable/icon" android:label="@string/app_name" android:description="@string/app_desc"
--- a/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java Mon Jun 06 13:01:45 2022 -0700 +++ b/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java Mon Jun 06 15:05:20 2022 -0700 @@ -53,6 +53,7 @@ import android.os.IBinder; import android.os.Message; import android.preference.PreferenceManager; +import android.provider.Settings; import android.util.Log; import android.view.ContextMenu; import android.view.KeyEvent; @@ -177,9 +178,26 @@ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { String [] perms = {Manifest.permission.INTERNET, Manifest.permission.ACCESS_NETWORK_STATE, - Manifest.permission.WAKE_LOCK, - Manifest.permission.WRITE_EXTERNAL_STORAGE}; + Manifest.permission.WAKE_LOCK}; checkp(perms); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + if (!Environment.isExternalStorageManager()) { + try { + Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION); + intent.addCategory("android.intent.category.DEFAULT"); + intent.setData(Uri.parse(String.format("package:%s",getApplicationContext().getPackageName()))); + startActivity(intent); + } catch (Exception e) { + Intent intent = new Intent(); + intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION); + startActivity(intent); + } + } + } + else { + String [] perms2 = {Manifest.permission.WRITE_EXTERNAL_STORAGE}; + checkp(perms2); + } } // detect HTC Dream and apply special preferences