修复重启原因相关的错误

TempBranch
Matthew 8 months ago
parent 827890deed
commit b7c329548e

@ -992,7 +992,7 @@ bool CPhoneDevice::InstallAPP(const std::string& path, unsigned int delayedTime)
return true;
}
bool CPhoneDevice::Reboot(int resetType)
bool CPhoneDevice::Reboot(int resetType, const std::string& reason)
{
if (resetType == REBOOT_TYPE_DEVICE)
{
@ -1007,7 +1007,7 @@ bool CPhoneDevice::Reboot(int resetType)
else
{
long timeout = 1000;
RestartApp(resetType, timeout);
RestartApp(resetType, timeout, reason);
}
return true;

File diff suppressed because it is too large Load Diff

@ -390,7 +390,7 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View v) {
Context context = v.getContext().getApplicationContext();
MicroPhotoService.restartApp(context, context.getPackageName());
MicroPhotoService.restartApp(context, context.getPackageName(), "Manual Restart From MainActivity");
}
});

@ -168,7 +168,7 @@ public class MicroPhotoService extends Service {
mHander.postDelayed(new Runnable() {
@Override
public void run() {
restartApp(context, MicroPhotoContext.PACKAGE_NAME_MPAPP);
restartApp(context, MicroPhotoContext.PACKAGE_NAME_MPAPP, "TrimMemory");
}
}, 1000);
} catch (Exception ex) {
@ -434,7 +434,7 @@ public class MicroPhotoService extends Service {
int restart = intent.getIntExtra("restart", 0);
Log.i(TAG, "UPD CFG Fired ACTION=" + action + " restart=" + restart);
if (restart != 0) {
MicroPhotoService.restartApp(context, context.getPackageName());
MicroPhotoService.restartApp(context, context.getPackageName(), "Config Updated");
} else if (mService.mNativeHandle != 0) {
mService.reloadConfigs(mService.mNativeHandle);
}
@ -553,7 +553,7 @@ public class MicroPhotoService extends Service {
} catch (Exception ex) {
ex.printStackTrace();
}
MicroPhotoService.restartApp(context.getApplicationContext(), MicroPhotoContext.PACKAGE_NAME_MPAPP);
MicroPhotoService.restartApp(context.getApplicationContext(), MicroPhotoContext.PACKAGE_NAME_MPAPP, "Restart Cmd");
}
}
}
@ -1262,14 +1262,14 @@ public class MicroPhotoService extends Service {
return true;
}
public void reboot(final int rebootType, final long timeout) {
public void reboot(final int rebootType, final long timeout, final String reason) {
Runnable runnable = new Runnable() {
@Override
public void run() {
if (rebootType == 0) {
Context context = MicroPhotoService.this.getApplicationContext();
restartApp(context, context.getPackageName());
restartApp(context, context.getPackageName(), reason);
} else {
Log.w(TAG, "Recv REBOOT command");
@ -1280,11 +1280,14 @@ public class MicroPhotoService extends Service {
mHander.postDelayed(runnable, timeout > 0 ? timeout : 1000);
}
public static void restartApp(Context context, String packageName) {
public static void restartApp(Context context, String packageName, String reason) {
Intent intent = new Intent(context, MainActivity.class);
int noDelay = 1;
intent.putExtra("noDelay", noDelay);
if (!TextUtils.isEmpty(reason)) {
intent.putExtra("reason", reason);
}
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
context.startActivity(intent);

@ -777,7 +777,7 @@ public class SimUtil {
}
if (rebootMpApp != 0) {
MicroPhotoContext.restartMpApp(context);
MicroPhotoContext.restartMpApp(context, "Config Updated From SMS");
} else {
Intent intent = new Intent();
intent.setAction(MicroPhotoContext.ACTION_UPDATE_CONFIGS_MP);

Loading…
Cancel
Save