diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java index 00f58efe..539568df 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java @@ -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> postParams = new ArrayList<>(); postParams.add(new Pair("id", mCmdid)); postParams.add(new Pair("XyDev", "1")); + if (mBundleWithMpApp) { + postParams.add(new Pair("bundled", "1")); + } postParams.add(new Pair("bootTime", Long.toString(getBootTime()))); postParams.add(new Pair("i1Version", mService.getMpAppVersion())); postParams.add(new Pair("oid", mService.getSerialNo())); diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java index b2ee237d..5c494dbe 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java @@ -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: