feat: throw a pop-up asking user to enable WRITE_SECURE_SETTINGS permission#13
feat: throw a pop-up asking user to enable WRITE_SECURE_SETTINGS permission#13pixincreate merged 5 commits intomainfrom
WRITE_SECURE_SETTINGS permission#13Conversation
…rmission inspired from 6f3b26e
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new feature that prompts the user with a pop-up to enable the WRITE_SECURE_SETTINGS permission when needed. Key changes include:
- Adding auto-grant logic and a user dialog for the WRITE_SECURE_SETTINGS permission in the SettingsFragment.
- Refactoring secure permission checks to use a helper method, hasSecureSettingsPermission().
- Introducing a new shared preference constant, PENDING_SECURE_SETTINGS_GRANT, in ShizukuSettings.java to manage the permission grant status.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt | Added logic for checking and auto-granting WRITE_SECURE_SETTINGS with appropriate dialogs and refactored boot component toggling |
| manager/src/main/java/moe/shizuku/manager/ShizukuSettings.java | Added a new preference key for pending secure settings grant tracking |
Files not reviewed (1)
- manager/src/main/res/values/strings.xml: Language not supported
There was a problem hiding this comment.
Pull Request Overview
This PR adds a feature to automatically prompt the user to grant the sensitive WRITE_SECURE_SETTINGS permission through a pop-up when required, streamlining the user experience and handling permission conflicts.
- Introduces a dialog for automatic permission granting with Shizuku.
- Updates boot component toggling logic to handle mutual exclusivity between boot options.
- Adds an ADB instructions dialog for manual permission granting fallback.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt | Implements permission check, auto-grant logic via Shizuku, and related dialogs. |
| manager/src/main/java/moe/shizuku/manager/ShizukuSettings.java | Adds a constant for pending secure settings grant. |
Files not reviewed (1)
- manager/src/main/res/values/strings.xml: Language not supported
Comments suppressed due to low confidence (1)
manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt:122
- [nitpick] The auto-granting permission logic is duplicated in both onPreferenceChangeListener and onResume. Consider extracting this logic into a shared helper method to reduce duplication and enhance maintainability.
val pendingGrant = ShizukuSettings.getPreferences().getBoolean(PENDING_SECURE_SETTINGS_GRANT, false)
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a pop-up prompt to request the WRITE_SECURE_SETTINGS permission and automates parts of the permission grant process via Shizuku.
- Added methods to check, request, and auto-grant the WRITE_SECURE_SETTINGS permission in SettingsFragment.kt.
- Updated the Settings UI to disable conflicting options when the permission is granted or denied.
- Added a new constant in ShizukuSettings.java to track pending secure settings grants.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt | Updated with permission checks, a pop-up dialog, and auto-grant logic for WRITE_SECURE_SETTINGS. |
| manager/src/main/java/moe/shizuku/manager/ShizukuSettings.java | Added constant for pending secure settings grant. |
Files not reviewed (1)
- manager/src/main/res/values/strings.xml: Language not supported
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new pop-up UI flow to prompt users to enable the WRITE_SECURE_SETTINGS permission and refactors how the boot component is managed.
- Consolidates boot component logic by switching to a dedicated bootComponentName field.
- Implements methods to auto-grant the WRITE_SECURE_SETTINGS permission and to display informative dialogs.
- Adds a new shared preference constant for tracking the pending secure settings grant.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt | Refactors boot component handling and implements the secure settings permission prompt. |
| manager/src/main/java/moe/shizuku/manager/ShizukuSettings.java | Introduces a new constant (PENDING_SECURE_SETTINGS_GRANT) to support the new feature. |
Files not reviewed (1)
- manager/src/main/res/values/strings.xml: Language not supported
Comments suppressed due to low confidence (1)
manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt:505
- Parsing the user ID from UserHandle's toString output is brittle and may break if the output format changes. Consider using a more robust API for retrieving the user ID if available.
val userId = try { userHandle.toString().substringAfter("{").substringBefore("}").toInt() } catch (e: Exception) {
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new pop-up to prompt users to enable the WRITE_SECURE_SETTINGS permission, improving the permission-grant flow for the wireless boot feature.
- Replaces the local component name with a globally initialized bootComponentName to better manage boot component toggling.
- Implements permission checking and auto-granting via Shizuku, along with a detailed Material dialog explaining the risks and instructions for manual granting.
- Adds utility methods to verify and grant secure settings permissions and updates the settings flag accordingly in ShizukuSettings.java.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt | Implements the permission dialog, auto-grant logic, and component toggling adjustments. |
| manager/src/main/java/moe/shizuku/manager/ShizukuSettings.java | Adds a new constant flag to manage pending permission grants. |
Files not reviewed (1)
- manager/src/main/res/values/strings.xml: Language not supported
Comments suppressed due to low confidence (1)
manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt:503
- [nitpick] Extracting the user ID from the UserHandle's string representation is brittle; consider using an official API if available to obtain the user ID directly.
val userId = try { userHandle.toString().substringAfter("{").substringBefore("}").toInt() } catch (e: Exception) { ... }
WRITE_SECURE_SETTINGS permission
Inspired from 6f3b26e
Initial thought that I had was to throw a pop-up in home screen after user starts the Shizuku service. Now that I think about it, this approach is more cleaner as the pop-up is restricted to the feature that is added:
ref: https://developer.android.com/reference/android/Manifest.permission#WRITE_SECURE_SETTINGS