|
|
|
@ -171,7 +171,7 @@ public class MpMasterService extends Service {
|
|
|
|
|
@Override
|
|
|
|
|
public IBinder onBind(Intent intent) {
|
|
|
|
|
// TODO: Return the communication channel to the service.
|
|
|
|
|
throw new UnsupportedOperationException("Not yet implemented");
|
|
|
|
|
// throw new UnsupportedOperationException("Not yet implemented");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1300,11 +1300,11 @@ public class MpMasterService extends Service {
|
|
|
|
|
//重启MpApp应用
|
|
|
|
|
public static void restartMpApp(Context context, String reason) {
|
|
|
|
|
|
|
|
|
|
SysApi.forceStopApp(context, MicroPhotoContext.PACKAGE_NAME_MPAPP);
|
|
|
|
|
forceStopMpApp(context);
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(100);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
//// 然后启动目标应用
|
|
|
|
|
try {
|
|
|
|
@ -1322,13 +1322,24 @@ public class MpMasterService extends Service {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void forceStopMpApp(Context context) {
|
|
|
|
|
if (Build.TIME < 1744905600000L) {
|
|
|
|
|
SysApi.forceStopApp(context, MicroPhotoContext.PACKAGE_NAME_MPAPP);
|
|
|
|
|
} else {
|
|
|
|
|
int pid = MicroPhotoContext.getProcessIdOfService(context, MicroPhotoContext.PACKAGE_NAME_MPAPP, MicroPhotoContext.SERVICE_NAME_MPSERVICE);
|
|
|
|
|
if (pid != 0) {
|
|
|
|
|
android.os.Process.killProcess(pid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据包名重启应用
|
|
|
|
|
public static void restartAppByPackage(Context context, String packagename, String reason) {
|
|
|
|
|
SysApi.forceStopApp(context, packagename);
|
|
|
|
|
forceStopMpApp(context);
|
|
|
|
|
try {
|
|
|
|
|
Thread.sleep(100);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
//// 然后启动目标应用
|
|
|
|
|
try {
|
|
|
|
|