final String factoryResetPackage = context .getString(com.android.internal.R.string.config_factoryResetPackage); if (Intent.ACTION_FACTORY_RESET.equals(intent.getAction()) && !TextUtils.isEmpty(factoryResetPackage)) { intent.setPackage(factoryResetPackage).setComponent(null); context.sendBroadcastAsUse...
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR")); } else { Intent intent = new Intent("android.intent.action.FACTORY_RESET"); intent.setPackage("android"); sendBroadcast(intent); } 1. 2. 3. 4. 5. 6. 7. 注:添加...
android FactoryReset private void doMasterClear() { Intent intent = new Intent(Intent.ACTION_FACTORY_RESET); intent.setPackage("android"); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); intent.putExtra(Intent.EXTRA_REASON, "MasterClearConfirm"); intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE,...
<action android:name="android.intent.action.MASTER_CLEAR" /> <!-- MCS always uses REMOTE_INTENT: category=MASTER_CLEAR --> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="android.intent.category.MASTER_CLEAR" /> </intent-filter> </receiver> 找这个...
context.startActivity(intent); } /** * 恢复出厂默认命令,设备会发生重启 */ public void reset(){ Intent intent =new Intent(getIntentAction("android.content.Intent", "ACTION_FACTORY_RESET")); intent.setPackage("android"); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); ...
ACTION_SYNC同步执行一个数据 ACTION_PICK_ACTIVITY为已知的Intent选择一个Activity,返回别选中的类 ACTION_SEARCH执行一次搜索 ACTION_WEB_SEARCH执行一次web搜索 ACTION_FACTORY_TEST工场测试的主要进入点, 标准的广播Actions ACTION_TIME_TICK当前时间改变,每分钟都发送,不能通过组件声明来接收,只有通过Context.registerRece...
android.permission.REBOOTSettings发送广播privatevoiddoMasterClear(){Intentintent=newIntent(Intent.ACTION_MASTER_CLEAR);intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);intent.putExtra(Intent.EXTRA_REASON,"MasterClearConfirm");intent.putExtra(Intent.EXTRA_WIPE_EXTERNAL_STORAGE,mEraseSdCard);getActivity().send...
通过action启动ShutdownActivity请求关机重启,需要权限 android.permission.SHUTDOWNACTION_REQUEST_SHUTDOWN = “com.android.internal.intent.action.REQUEST_SHUTDOWN”; 下面以PowerManager#shutdown调用为例,来分析一下关机流程 1.1 PowerManager#shutdown mService实际上是PowerManagerService binder服务的bp端, 执行mSer...
Called when the user has asked to disable the administrator, as a result of receiving #ACTION_DEVICE_ADMIN_DISABLE_REQUESTED, giving you a chance to present a warning message to them. OnEnabled(Context, Intent) Called after the administrator is first enabled, as a result of receiving #ACTION...
Intentintent=newIntent("android.intent.action.FACTORY_RESET");intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);intent.setPackage("android");sendBroadcast(intent); 1. 2. 3. 4. 上述代码会发送一个FACTORY_RESET的广播,提示用户确认恢复出厂设置操作。需要注意的是,此广播需要具有receiver_foreground的标志,以确...