Skip to content

Commit

Permalink
Show explanatory dialog for Shizuku permission
Browse files Browse the repository at this point in the history
  • Loading branch information
farmerbb committed Jan 17, 2023
1 parent 81f45ed commit 8776a7c
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Shizuku.pingBinder()) {
proceedWithOnCreateShizuku();

boolean isGranted;
if(Shizuku.isPreV11() || Shizuku.getVersion() < 11) {
isGranted = checkSelfPermission(ShizukuProvider.PERMISSION) == PackageManager.PERMISSION_GRANTED;
Expand Down Expand Up @@ -131,6 +133,22 @@ private void proceedWithOnCreate() {
button2.setVisibility(View.GONE);
}

private void proceedWithOnCreateShizuku() {
setContentView(R.layout.activity_turn_off);
setTitle(R.string.permission_needed);

TextView textView = findViewById(R.id.turnOffTextView);
textView.setText(R.string.shizuku_dialog);

Button button1 = findViewById(R.id.turnOffButtonPrimary);
Button button2 = findViewById(R.id.turnOffButtonSecondary);

button1.setText(R.string.action_close);
button1.setOnClickListener(v -> finish());

button2.setVisibility(View.GONE);
}

private void proceedWithProfileLoad() {
if(getIntent().hasExtra("action")) {
if(U.hasElevatedPermissions(this, true)) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="background_operations_active">Performing background operations&#8230;</string>
<string name="debug_mode">Debug mode</string>
<string name="safe_mode_dialog">Leaving safe mode on is strongly recommended.\n\nDisabling this option allows SecondScreen to stay active across reboots. Only disable this option if you know how to restore your device\'s resolution and density settings via adb if something goes wrong.</string>
<string name="shizuku_dialog">SecondScreen uses Shizuku to change device settings, such as resolution and density.\n\nPlease close this dialog once Shizuku permission has been granted.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="background_operations_active">Performing background operations&#8230;</string>
<string name="debug_mode">Debug mode</string>
<string name="safe_mode_dialog">Leaving safe mode on is strongly recommended.\n\nDisabling this option allows SecondScreen to stay active across reboots. Only disable this option if you know how to restore your device\'s resolution and density settings via adb if something goes wrong.</string>
<string name="shizuku_dialog">SecondScreen uses Shizuku to change device settings, such as resolution and density.\n\nPlease close this dialog once Shizuku permission has been granted.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="background_operations_active">Performing background operations&#8230;</string>
<string name="debug_mode">Debug mode</string>
<string name="safe_mode_dialog">Leaving safe mode on is strongly recommended.\n\nDisabling this option allows SecondScreen to stay active across reboots. Only disable this option if you know how to restore your device\'s resolution and density settings via adb if something goes wrong.</string>
<string name="shizuku_dialog">SecondScreen uses Shizuku to change device settings, such as resolution and density.\n\nPlease close this dialog once Shizuku permission has been granted.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="background_operations_active">Performing background operations&#8230;</string>
<string name="debug_mode">Debug mode</string>
<string name="safe_mode_dialog">Leaving safe mode on is strongly recommended.\n\nDisabling this option allows SecondScreen to stay active across reboots. Only disable this option if you know how to restore your device\'s resolution and density settings via adb if something goes wrong.</string>
<string name="shizuku_dialog">SecondScreen uses Shizuku to change device settings, such as resolution and density.\n\nPlease close this dialog once Shizuku permission has been granted.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-sk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="background_operations_active">Performing background operations&#8230;</string>
<string name="debug_mode">Debug mode</string>
<string name="safe_mode_dialog">Leaving safe mode on is strongly recommended.\n\nDisabling this option allows SecondScreen to stay active across reboots. Only disable this option if you know how to restore your device\'s resolution and density settings via adb if something goes wrong.</string>
<string name="shizuku_dialog">SecondScreen uses Shizuku to change device settings, such as resolution and density.\n\nPlease close this dialog once Shizuku permission has been granted.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="background_operations_active">执行后台操作&#8230;</string>
<string name="debug_mode">调试模式</string>
<string name="safe_mode_dialog">强烈建议开启安全模式.\n\n禁用此选项可使SecondScreen在重新启动后保持活动状态. \n仅当您知道在出现问题时如何通过adb恢复设备的分辨率和密度设置时,才禁用此选项.</string>
<string name="shizuku_dialog">SecondScreen uses Shizuku to change device settings, such as resolution and density.\n\nPlease close this dialog once Shizuku permission has been granted.</string>

</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="background_operations_active">Performing background operations&#8230;</string>
<string name="debug_mode">Debug mode</string>
<string name="safe_mode_dialog">Leaving safe mode on is strongly recommended.\n\nDisabling this option allows SecondScreen to stay active across reboots. Only disable this option if you know how to restore your device\'s resolution and density settings via adb if something goes wrong.</string>
<string name="shizuku_dialog">SecondScreen uses Shizuku to change device settings, such as resolution and density.\n\nPlease close this dialog once Shizuku permission has been granted.</string>

</resources>

0 comments on commit 8776a7c

Please sign in to comment.