I tried to perform a factory reset in Android using the RecoverySystem class, but I get permission errors, which I can not overwrite because they are system permissions. I w
This works on a many different devices I have tried. (more than 20)
Context foreignContext = createPackageContext("com.android.settings", Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE);
Class> yourClass = foreignContext.getClassLoader().loadClass("com.android.settings.MasterClear");
Intent intent = new Intent(foreignContext, yourClass);
startActivity(intent);