移除重复的运维请求,并针对不同的运维触发添加不同的标记

serial
Matthew 1 year ago
parent 85e9a8e6cf
commit d8136da9a1

@ -50,6 +50,7 @@ public class AppMaster {
private MpMasterService mService;
private String mMasterUrl;
private String mCmdid;
private boolean mBundleWithMpApp;
private PowerManager.WakeLock mWakelock;
public static final String CMD_REBOOT_APP = "cmd_reboot_app";
@ -70,13 +71,18 @@ public class AppMaster {
public static final String CMD_IMPORT_PUB_KEY = "imp_pub_key";
public AppMaster(MpMasterService service, String masterUrl, String cmdid) {
public AppMaster(MpMasterService service, String masterUrl, String cmdid, boolean bundleWithMpApp) {
mService = service;
mMasterUrl = masterUrl;
mCmdid = cmdid;
mBundleWithMpApp = bundleWithMpApp;
mWakelock = null;
if (!mBundleWithMpApp) {
int aa = 0;
}
try {
PowerManager powerManager = (PowerManager) service.getSystemService(Context.POWER_SERVICE);
mWakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "com.xypower.mpmaster:MpMaster");
@ -204,6 +210,9 @@ public class AppMaster {
List<Pair<String, String>> postParams = new ArrayList<>();
postParams.add(new Pair<String, String>("id", mCmdid));
postParams.add(new Pair<String, String>("XyDev", "1"));
if (mBundleWithMpApp) {
postParams.add(new Pair<String, String>("bundled", "1"));
}
postParams.add(new Pair<String, String>("bootTime", Long.toString(getBootTime())));
postParams.add(new Pair<String, String>("i1Version", mService.getMpAppVersion()));
postParams.add(new Pair<String, String>("oid", mService.getSerialNo()));

@ -225,7 +225,7 @@ public class MpMasterService extends Service {
// AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
startMaster();
// startMaster(false);
startMpApp();
registerHeartbeatTimer();
@ -416,7 +416,7 @@ public class MpMasterService extends Service {
}
}
private void startMaster() {
private void startMaster(boolean bundleWithMpApp) {
String masterUrl = MicroPhotoContext.DEFAULT_MASTER_URL;
MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(getApplicationContext());
@ -429,7 +429,7 @@ public class MpMasterService extends Service {
logger.warning("Start Mntn report:" + masterUrl);
AppMaster appMaster = new AppMaster(this, masterUrl, appConfig.cmdid);
AppMaster appMaster = new AppMaster(this, masterUrl, appConfig.cmdid, bundleWithMpApp);
appMaster.start();
}
@ -448,7 +448,7 @@ public class MpMasterService extends Service {
mService.registerHeartbeatTimer();
mService.startMaster();
mService.startMaster(false);
mService.startMpApp();
} else if (TextUtils.equals(MicroPhotoContext.ACTION_HEARTBEAT_MP, action)) {
@ -457,7 +457,7 @@ public class MpMasterService extends Service {
mService.registerHeartbeatTimer(mService.mPreviousHeartbeatTime + mService.mHeartbeatDuration * 1000);
mService.startMaster();
mService.startMaster(true);
mService.startMpApp();
}
} else if (TextUtils.equals(ACTION_UPDATE_CONFIGS, action)) {
@ -533,7 +533,7 @@ public class MpMasterService extends Service {
registerHeartbeatTimer();
startMaster();
startMaster(false);
break;
case ACTION_STOP:

Loading…
Cancel
Save