Skip to content

Commit

Permalink
added Debloater app disable
Browse files Browse the repository at this point in the history
  • Loading branch information
legendsayantan committed Jul 4, 2024
1 parent 7acfd91 commit 49366b0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
Binary file modified app/release/app-release.apk
Binary file not shown.
43 changes: 43 additions & 0 deletions app/src/main/java/com/legendsayantan/adbtools/DebloatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.marginEnd
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.button.MaterialButton
Expand Down Expand Up @@ -94,6 +95,46 @@ class DebloatActivity : AppCompatActivity() {
//open link
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(listOfLinks[linkPosition])))
}
val disableBtn = MaterialButton(this)
ShizukuRunner.command("pm list packages -d",object : ShizukuRunner.CommandResultListener{
override fun onCommandResult(output: String, done: Boolean) {
if (done){
val isDisabled = output.contains(id)
disableBtn.text = if(isDisabled) getString(R.string.confirm_to_enable) else getString(R.string.confirm_to_disable)
disableBtn.setOnClickListener {
//disable app
ShizukuRunner.command("cmd package ${if(isDisabled)"enable" else "disable"} -k --user 0 $id",
object : ShizukuRunner.CommandResultListener {
override fun onCommandResult(output: String, done: Boolean) {
if (done) {
runOnUiThread {
if (output.contains("Success", true)) {
list.adapter =
DebloatAdapter(this@DebloatActivity, apps)
Toast.makeText(
applicationContext,
"Disabled ${app.name}",
Toast.LENGTH_LONG
).show()
} else {
Toast.makeText(
applicationContext,
"Failed,\n$output",
Toast.LENGTH_LONG
).show()
}
dialog?.dismiss()
}
}
}
})
}
}
}
})
disableBtn.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply {
setMargins(0,0,25,0)
}
val uninstallBtn = MaterialButton(this)
uninstallBtn.text = getString(R.string.confirm_to_uninstall)
uninstallBtn.setOnClickListener {
Expand Down Expand Up @@ -128,6 +169,8 @@ class DebloatActivity : AppCompatActivity() {
})
}
val btnContainer = LinearLayout(this)
btnContainer.orientation = LinearLayout.HORIZONTAL
btnContainer.addView(disableBtn)
btnContainer.addView(uninstallBtn)
btnContainer.setPadding(20, 20, 20, 20)
btnContainer.gravity = Gravity.END
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<string name="selected_item_was_patched_as_permanent">Selected item was patched as permanent.</string>
<string name="do_not_un_mute_apps_that_are_being_controlled_by_soundmaster">Do not un-mute apps that are being controlled by SoundMaster, while SoundMaster is running.</string>
<string name="select_audio_output">Select Audio Output :</string>
<string name="confirm_to_uninstall">Confirm to uninstall</string>
<string name="confirm_to_uninstall">Uninstall</string>
<string name="links">Links :</string>
<string name="soundmaster_initial_noti">You can now change volume to configure %1$s as well. Make sure to disable it before you power off the device.</string>
<string name="url_uad_lists">https://cdn.jsdelivr.net/gh/Universal-Debloater-Alliance/universal-android-debloater-next-generation@main/resources/assets/uad_lists.json</string>
Expand All @@ -62,4 +62,6 @@
<string name="desc_universalpip">Switch apps to picture-in-picture mode even if they don\'t allow it. May not support some launchers.</string>
<string name="unmute_all_apps">Unmute All Apps</string>
<string name="disable_all_mixedaudio">Disable All MixedAudio</string>
<string name="confirm_to_disable">Disable</string>
<string name="confirm_to_enable">Enable</string>
</resources>

0 comments on commit 49366b0

Please sign in to comment.