这个获取权限后,应该是进行工厂重设的,可以参考一下Settings的代码(你确定你不是在做什么邪恶的功能吗?)private void showFactoryReset() {
// Hide the encryption-bot to make room for the "factory reset" button
findViewById(R.id.encroid).setVisibility(View.GONE); // Show the reset button, failure text, and a divider
final Button button = (Button) findViewById(R.id.factory_reset);
button.setVisibility(View.VISIBLE);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
}
}); // Alert the user of the failure.
((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_failed_title);
((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_failed_summary); final View view = findViewById(R.id.bottom_divider);
// TODO(viki): Why would the bottom divider be missing in certain layouts? Investigate.
if (view != null) {
view.setVisibility(View.VISIBLE);
}
}
// Hide the encryption-bot to make room for the "factory reset" button
findViewById(R.id.encroid).setVisibility(View.GONE); // Show the reset button, failure text, and a divider
final Button button = (Button) findViewById(R.id.factory_reset);
button.setVisibility(View.VISIBLE);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
}
}); // Alert the user of the failure.
((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_failed_title);
((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_failed_summary); final View view = findViewById(R.id.bottom_divider);
// TODO(viki): Why would the bottom divider be missing in certain layouts? Investigate.
if (view != null) {
view.setVisibility(View.VISIBLE);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货