Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 58 additions & 12 deletions app/src/main/java/me/phh/treble/app/MiscSettings.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.phh.treble.app

import android.app.AlertDialog
import android.app.Application
import android.hardware.display.DisplayManager
import android.os.Bundle
import android.util.Log
Expand All @@ -21,6 +23,7 @@ object MiscSettings : Settings {
val forceNavbarOff = "key_misc_force_navbar_off"
val bluetooth = "key_misc_bluetooth"
val securize = "key_misc_securize"
val removeTelephony = "key_misc_removetelephony"
val remotectl = "key_misc_remotectl"
val disableAudioEffects = "key_misc_disable_audio_effects"
val cameraTimestampOverride = "key_misc_camera_timestamp"
Expand All @@ -35,19 +38,62 @@ class MiscSettingsFragment : SettingsFragment() {

val securizePref = findPreference<Preference>(MiscSettings.securize)
securizePref!!.setOnPreferenceClickListener {
var cmds = listOf(
"/sbin/su 0 /system/bin/phh-securize.sh",
"/sbin/su -c /system/bin/phh-securize.sh",
"/system/xbin/phh-su 0 /system/bin/phh-securize.sh",
"/system/xbin/phh-su -c /system/bin/phh-securize.sh",
"/system/xbin/su 0 /system/bin/phh-securize.sh",
"/system/xbin/su -c /system/bin/phh-securize.sh"
)
for(cmd in cmds) {
try {
Runtime.getRuntime().exec(cmd).waitFor()
} catch(t: Throwable) {}
val builder = AlertDialog.Builder( this.getActivity() )
builder.setTitle(getString(R.string.remove_root))
builder.setMessage(getString(R.string.continue_question))

builder.setPositiveButton(android.R.string.yes) { dialog, which ->

var cmds = listOf(
"/sbin/su 0 /system/bin/phh-securize.sh",
"/sbin/su -c /system/bin/phh-securize.sh",
"/system/xbin/phh-su 0 /system/bin/phh-securize.sh",
"/system/xbin/phh-su -c /system/bin/phh-securize.sh",
"/system/xbin/su 0 /system/bin/phh-securize.sh",
"/system/xbin/su -c /system/bin/phh-securize.sh"
)
for(cmd in cmds) {
try {
Runtime.getRuntime().exec(cmd).waitFor()
} catch(t: Throwable) {}
}
}

builder.setNegativeButton(android.R.string.no) { dialog, which ->
}

builder.show()
return@setOnPreferenceClickListener true
}

val removeTelephonyPref = findPreference<Preference>(MiscSettings.removeTelephony)
removeTelephonyPref!!.setOnPreferenceClickListener {

val builder = AlertDialog.Builder( this.getActivity() )
builder.setTitle(getString(R.string.remove_telephony_subsystem))
builder.setMessage(getString(R.string.continue_question))

builder.setPositiveButton(android.R.string.yes) { dialog, which ->

var cmds = listOf(
"/sbin/su 0 /system/bin/remove-telephony.sh",
"/sbin/su -c /system/bin/remove-telephony.sh",
"/system/xbin/phh-su 0 /system/bin/remove-telephony.sh",
"/system/xbin/phh-su -c /system/bin/remove-telephony.sh",
"/system/xbin/su 0 /system/bin/remove-telephony.sh",
"/system/xbin/su -c /system/bin/remove-telephony.sh"
)
for(cmd in cmds) {
try {
Runtime.getRuntime().exec(cmd).waitFor()
} catch(t: Throwable) {}
}
}

builder.setNegativeButton(android.R.string.no) { dialog, which ->
}

builder.show()
return@setOnPreferenceClickListener true
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
<string name="title_activity_settings">Settings</string>
<string name="title_activity_top_level">Phh Treble Settings</string>
<string name="desc_activity_top_level">Device specific settings</string>
<string name="remove_telephony_subsystem">Remove Telephony Subsystem</string>
<string name="remove_root">Remove Root</string>
<string name="continue_question">Continue?</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/xml/pref_misc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
android:title="Force navigation bar disabled" />
<Preference android:title="Securize"
android:key="key_misc_securize" />
<Preference android:title="@string/remove_telephony_subsystem"
android:key="key_misc_removetelephony" />
<CheckBoxPreference
android:defaultValue="false"
android:key="key_misc_remotectl"
Expand Down