Skip to content

Commit

Permalink
fix(permissions activity): Start permissions request activity in sing…
Browse files Browse the repository at this point in the history
…le top new task mode
  • Loading branch information
Smooth-E committed Nov 10, 2023
1 parent df595e6 commit 0c32468
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ interface IUserService {

/** Returns Wireless ADB port number or -1 if Wireless ADB is disabled */
int getWirelessAdbPort() = 1;

}
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,19 @@ class GrantPermissionsActivity : CollapsingToolbarActivity(
private fun restartAppForRootAccessRefresh() {
val manager = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager
val time = System.currentTimeMillis() + 100
val intent = PendingIntent.getActivity(
val intent = requireActivity().intent
intent.flags =
Intent.FLAG_ACTIVITY_CLEAR_TOP or
Intent.FLAG_ACTIVITY_SINGLE_TOP or
Intent.FLAG_ACTIVITY_NEW_TASK

val pendingIntent = PendingIntent.getActivity(
requireActivity().baseContext,
0,
requireActivity().intent,
requireActivity().intent.flags
intent,
PendingIntent.FLAG_IMMUTABLE
)
manager.set(AlarmManager.RTC, time, intent)
manager.set(AlarmManager.RTC, time, pendingIntent)

Process.killProcess(Process.myPid())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceClickListener
Expand Down Expand Up @@ -68,9 +69,13 @@ class SettingsActivity : ApplicationPreferenceActivity(
preferencePrefixData.forceUpdate()
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GrantPermissionsActivity.startIfNeeded(this)
}

override fun onPreferencesCreated(preferenceFragment: PreferenceFragment) {
super.onPreferencesCreated(preferenceFragment)
GrantPermissionsActivity.startIfNeeded(this)

val kdeConnectInstalled = KdeConnect.isInstalled(this)
var preferenceKey: String
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/keys.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string translatable="false" name="key_asked_shizuku_permission">asked_shizuku_permission</string>
<string translatable="false" name="key_skip_permission_activity">skip_permissions_activity</string>
<string translatable="false" name="key_enable_kde_connect">enable_kde_connect</string>
<string translatable="false" name="key_prefix_connection_data">prefix_connection_data</string>
<string translatable="false" name="key_connection_data_prefix">connection_data_prefix</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/xml/preferences_kde_integration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<SwitchPreferenceCompat
android:key="@string/key_enable_kde_connect"
android:title="@string/preference_switch_name_kde_connect"
android:defaultValue="true"
app:layout="@layout/preference_big_switch"/>

<Preference
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/xml/preferences_prefixing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<SwitchPreferenceCompat
android:key="@string/key_prefix_connection_data"
android:title="@string/preference_switch_name_prefix_connection_data"
android:defaultValue="true"
app:layout="@layout/preference_big_switch" />

<Preference
Expand Down

0 comments on commit 0c32468

Please sign in to comment.