修复bugs

serial
Matthew 2 years ago
parent a36148d5ae
commit a0c5909bc0

@ -42,7 +42,10 @@ public class AppMaster {
@Override @Override
protected void finalize() { protected void finalize() {
if (mWakelock != null) {
mWakelock.release(); mWakelock.release();
mWakelock = null;
}
mService = null; mService = null;
} }

@ -1,8 +1,10 @@
package com.xypower.mpapp; package com.xypower.mpapp;
import android.app.PendingIntent;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log;
public class BootBroadcastReceiver extends BroadcastReceiver { public class BootBroadcastReceiver extends BroadcastReceiver {
private static final String ACTION = "android.intent.action.BOOT_COMPLETED"; private static final String ACTION = "android.intent.action.BOOT_COMPLETED";
@ -15,12 +17,24 @@ public class BootBroadcastReceiver extends BroadcastReceiver {
if (ACTION.equals(intent.getAction())) { if (ACTION.equals(intent.getAction())) {
// Log.e("接收广播", "onReceive: 启动了。。。"); // Log.e("接收广播", "onReceive: 启动了。。。");
Log.i("BootBroadcastReceiver", "Start MainActivity");
/*
Intent mainIntent = new Intent(context, MainActivity.class); Intent mainIntent = new Intent(context, MainActivity.class);
mainIntent.putExtra("reboot", 1); mainIntent.putExtra("reboot", 1);
/** intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
* Intent.FLAG_ACTIVITY_NEW_TASK PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
* Intent.FLAG_ACTIVITY_CLEAR_TOP try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
*/ */
Intent mainIntent = new Intent(context, MainActivity.class);
mainIntent.putExtra("reboot", 1);
//Intent.FLAG_ACTIVITY_NEW_TASK
// Intent.FLAG_ACTIVITY_CLEAR_TOP
mainIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mainIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mainIntent); context.startActivity(mainIntent);

@ -211,8 +211,6 @@ public class MainActivity extends AppCompatActivity {
int width = defaultDisplay.getWidth(); int width = defaultDisplay.getWidth();
int height = defaultDisplay.getHeight(); int height = defaultDisplay.getHeight();
Log.d(TAG, "Screen Size: " + width + " x " + height);
Intent intent = getIntent(); Intent intent = getIntent();
final int noDelay = intent.getIntExtra("noDelay", 0); final int noDelay = intent.getIntExtra("noDelay", 0);
int rebootFlag = intent.getIntExtra("reboot", 0); int rebootFlag = intent.getIntExtra("reboot", 0);
@ -220,6 +218,8 @@ public class MainActivity extends AppCompatActivity {
// SysApi.enableAirPlane(MainActivity.this, true); // SysApi.enableAirPlane(MainActivity.this, true);
} }
Log.d(TAG, "MainActivity: reboot=" + rebootFlag + " noDelay=" + noDelay);
String cmdid = ""; String cmdid = "";
String server = ""; String server = "";
Integer port = new Integer(6891); Integer port = new Integer(6891);

@ -53,7 +53,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class MicroPhotoService extends Service { public class MicroPhotoService extends Service {
public static final String TAG = "MPService"; public static final String TAG = "MPLOG";
// Used to load the 'microphoto' library on application startup. // Used to load the 'microphoto' library on application startup.
static { static {
@ -865,6 +865,7 @@ public class MicroPhotoService extends Service {
startActivity(LaunchIntent); startActivity(LaunchIntent);
} else { } else {
Log.w(TAG, "Recv REBOOT command");
SysApi.reboot(getApplicationContext()); SysApi.reboot(getApplicationContext());
} }
} }

Loading…
Cancel
Save