利用共享uid的方式来判断运维app是否正在运行

加入时间变化监控的一些定义
lowmem
Matthew 2 months ago
parent 621cf4f3ba
commit 897b53e44e

@ -165,7 +165,11 @@
<receiver
android:name=".MicroPhotoService$AlarmReceiver"
android:exported="true" />
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.TIME_CHANGED"/>
</intent-filter>
</receiver>
<receiver
android:name=".BootBroadcastReceiver"
android:enabled="true"

@ -134,6 +134,9 @@ public class MicroPhotoService extends Service {
private static final String ACTION_HEARTBEAT_MANUALLY = "com.xypower.mpapp.ACT_HB_M";
private static final String ACTION_UPDATE_CONFIGS = "com.xypower.mpapp.ACT_UPD_CFG";
public static final String ACTION_VIDEO_FINISHED = "com.xypower.mpapp.ACT_V_FINISHED";
public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_CHANGED";
private static final String EXTRA_PARAM_CHANNEL = "Channel";
private static final String EXTRA_PARAM_PRESET = "Preset";
private static final String EXTRA_PARAM_PHOTO_OR_VIDEO = "PhotoOrVideo";
@ -332,6 +335,7 @@ public class MicroPhotoService extends Service {
intentFilter.addAction(ACTION_HEARTBEAT_MANUALLY);
intentFilter.addAction(ACTION_GPS_TIMEOUT);
intentFilter.addAction(ACTION_RESTART);
intentFilter.addAction(ACTION_TIME_CHANGED);
getApplicationContext().registerReceiver(mAlarmReceiver, intentFilter, Context.RECEIVER_EXPORTED | Context.RECEIVER_VISIBLE_TO_INSTANT_APPS);
}
{
@ -518,11 +522,14 @@ public class MicroPhotoService extends Service {
}
try {
boolean mpmstAlive = MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPMASTER);
if (!mpmstAlive) {
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(MicroPhotoContext.PACKAGE_NAME_MPMASTER);
// launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (launchIntent != null) {
context.startActivity(launchIntent);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
@ -703,6 +710,8 @@ public class MicroPhotoService extends Service {
ex.printStackTrace();
}
restartSelfImpl(context, reason);
} else if (TextUtils.equals(ACTION_TIME_CHANGED, action)) {
}
}
}

Loading…
Cancel
Save