|
|
@ -19,6 +19,7 @@ import android.os.Environment;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.IBinder;
|
|
|
|
import android.os.IBinder;
|
|
|
|
import android.os.PowerManager;
|
|
|
|
import android.os.PowerManager;
|
|
|
|
|
|
|
|
import android.os.SystemClock;
|
|
|
|
import android.telephony.SubscriptionInfo;
|
|
|
|
import android.telephony.SubscriptionInfo;
|
|
|
|
import android.telephony.SubscriptionManager;
|
|
|
|
import android.telephony.SubscriptionManager;
|
|
|
|
import android.telephony.TelephonyManager;
|
|
|
|
import android.telephony.TelephonyManager;
|
|
|
@ -397,15 +398,18 @@ public class MpMasterService extends Service {
|
|
|
|
long ts = System.currentTimeMillis();
|
|
|
|
long ts = System.currentTimeMillis();
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
boolean isMpAppRunning = detectMpAppRunning();
|
|
|
|
int detectionCnt = 4;
|
|
|
|
if (!isMpAppRunning) {
|
|
|
|
if (SystemClock.elapsedRealtime() < 180000) {
|
|
|
|
try {
|
|
|
|
// In 3 minutes after device reboot
|
|
|
|
Thread.sleep(1000);
|
|
|
|
detectionCnt = 16;
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check twice
|
|
|
|
boolean isMpAppRunning = false;
|
|
|
|
|
|
|
|
for (int idx = 0; idx < detectionCnt; idx++) {
|
|
|
|
isMpAppRunning = detectMpAppRunning();
|
|
|
|
isMpAppRunning = detectMpAppRunning();
|
|
|
|
|
|
|
|
if (isMpAppRunning) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sleep(1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isMpAppRunning) {
|
|
|
|
if (!isMpAppRunning) {
|
|
|
@ -1308,11 +1312,8 @@ public class MpMasterService extends Service {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
sleep(5000);
|
|
|
|
Thread.sleep(5000);
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
File tmpDestPath = new File(MicroPhotoContext.buildMasterAppDir(context));
|
|
|
|
File tmpDestPath = new File(MicroPhotoContext.buildMasterAppDir(context));
|
|
|
|
tmpDestPath = new File(tmpDestPath, "mpdata");
|
|
|
|
tmpDestPath = new File(tmpDestPath, "mpdata");
|
|
|
|
if (tmpDestPath.exists()) {
|
|
|
|
if (tmpDestPath.exists()) {
|
|
|
@ -1430,6 +1431,13 @@ public class MpMasterService extends Service {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void sleep(long ms) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Thread.sleep(ms);
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public native static int getInt(int cmd);
|
|
|
|
public native static int getInt(int cmd);
|
|
|
|
public native static int setInt(int cmd, int val);
|
|
|
|
public native static int setInt(int cmd, int val);
|
|
|
|
public native static int[] getStats(long ts);
|
|
|
|
public native static int[] getStats(long ts);
|
|
|
|