System customization ================== Dynamic Permissions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **1.Shutdown/restart** Function:void setShundownOrReboot() Remarks: .. code-block:: java :linenos: :emphasize-lines: 1 private void setShundownOrReboot(String appName , Boolean isReboot){ try { Class c = Class.forName("android.app.ActivityManager"); Method method = c.getMethod("setShutdownOrRebootforApp",String.class,boolean.class); method.invoke(am,appName,isReboot); Log.d("iminSF","setShundownOrReboot : " + appName); } catch (Exception e) { e.printStackTrace(); } } parameter: appName –> the package name of the app isReboot –> ture indicates restart, false indicates shutdown **2.App installs in background** Function:void setSilenceInstall() Remarks: .. code-block:: java :linenos: :emphasize-lines: 1 private void setSilenceInstall(String apkName , String apkFilePath){ try { Class c = Class.forName("android.app.ActivityManager"); Method method = c.getMethod("setSilenceInstallforApp",String.class,String.class); method.invoke(am,apkName,apkFilePath); Log.d("iminSF","setSilenceInstall : " + apkName); } catch (Exception e) { e.printStackTrace(); } } parameter: apkName –> the package name of the app apkFilePath –> Path to install the APK package silently, for example, String apkFilePath = "/sdcard/test.apk";