1

I want to disable factory reset/data wipe on my phone via ADB. I tried running

pm disable 'com.android.settings/com.android.settings.SubSettings'

but it threw

Exception occurred while executing 'disable':
java.lang.SecurityException: Shell cannot change component state for ComponentInfo{com.android.settings/com.android.settings.SubSettings} to 2
        at com.android.server.pm.PackageManagerService.setEnabledSettings(PackageManagerService.java:3808)
        at com.android.server.pm.PackageManagerService.-$$Nest$msetEnabledSettings(Unknown Source:0)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.setComponentEnabledSetting(PackageManagerService.java:5652)
        at com.android.server.pm.PackageManagerShellCommand.runSetEnabledSetting(PackageManagerShellCommand.java:2363)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:272)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6045)
        at android.os.Binder.shellCommand(Binder.java:1049)
        at android.os.Binder.onTransact(Binder.java:877)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4313)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6029)
        at android.os.Binder.execTransactInternal(Binder.java:1285)
        at android.os.Binder.execTransact(Binder.java:1244)

How can I achieve this? I want to disable the factory reset on my Android phone. If theres no way to achieve it through adb, how else can it be done? I have heard of people doing it, so I know there is a way, I just need help doing it.

I also tried pm disable com.android.settings but it threw


Exception occurred while executing 'disable':
java.lang.SecurityException: Shell cannot change component state for null to 2
        at com.android.server.pm.PackageManagerService.setEnabledSettings(PackageManagerService.java:3808)
        at com.android.server.pm.PackageManagerService.-$$Nest$msetEnabledSettings(Unknown Source:0)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.setApplicationEnabledSetting(PackageManagerService.java:5528)
        at com.android.server.pm.PackageManagerShellCommand.runSetEnabledSetting(PackageManagerShellCommand.java:2356)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:272)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6045)
        at android.os.Binder.shellCommand(Binder.java:1049)
        at android.os.Binder.onTransact(Binder.java:877)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4313)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6029)
        at android.os.Binder.execTransactInternal(Binder.java:1285)
        at android.os.Binder.execTransact(Binder.java:1244)```

1 Answer 1

1

If you disable or uninstall Settings app, your device will work fine until you restart or power off the device -- then it will get stuck in a bootloop.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .