From 8eff6d57d11a47f25c0db4b57604325d6fb1648f Mon Sep 17 00:00:00 2001 From: ScreenTinker Date: Wed, 29 Jul 2026 18:27:45 -0500 Subject: [PATCH] Let permissions be turned back off from the setup screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every row on the setup screen hid its button once the permission was granted (visibility = GONE), which made each one a one-way door. None of these can be revoked by the app — they all live in system Settings — so hiding the only route to that screen removed the way back entirely. Asked on #234: "if I make the app as Home launcher but later on want to remove it then how can I do it?" The button now stays and relabels to "Manage", with the same destination. Two rows needed more than a relabel, because their existing destination was a dead end once granted: - Battery: ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS only ASKS to add an exemption and cannot remove one. An already-exempt user now goes to the system list (verified: Settings$HighPowerApplicationsActivity). - Notifications: requestPermissions() does nothing once the answer has been given. Now opens app notification settings, which toggles either way. Also fixes the launcher row disagreeing with itself. The status read resolveActivity(MATCH_DEFAULT_ONLY), which can name us for merely being a HOME candidate, while the button asked RoleManager. So the row could say ON while the OEM launcher was still home — and the button would then offer to BECOME home rather than open the picker. That is the other half of the same report: "in the apk I have granted the permission ... BUT in the settings of the tablet it still shows the tablet native launcher as home." Status and action now ask the same authority. Verified on an Android 12 tablet, both directions: not-home reads OFF/Set; after becoming home it reads ON/Manage and Manage opens the Home-app picker (DefaultAppActivity) — a way out, which is what was asked for. NOTE: this screen's strings are hardcoded English in the layout and in code ("ON", "OFF", "Enable", "Continue Anyway"), so "Manage" matches what is already there rather than introducing one translated word among twenty untranslated ones. Localising the screen is worth doing and is deliberately not mixed into this change. --- .../com/remotedisplay/player/SetupActivity.kt | 97 +++++++++++++++---- 1 file changed, 79 insertions(+), 18 deletions(-) diff --git a/android/app/src/main/java/com/remotedisplay/player/SetupActivity.kt b/android/app/src/main/java/com/remotedisplay/player/SetupActivity.kt index 04b23ed..9b77cb6 100644 --- a/android/app/src/main/java/com/remotedisplay/player/SetupActivity.kt +++ b/android/app/src/main/java/com/remotedisplay/player/SetupActivity.kt @@ -98,9 +98,22 @@ class SetupActivity : AppCompatActivity() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { findViewById(R.id.notificationRow).visibility = View.VISIBLE findViewById