修复bugs

serial
Matthew 2 years ago
parent a36148d5ae
commit a0c5909bc0

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

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

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

@ -53,7 +53,7 @@ import java.util.List;
import java.util.Map;
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.
static {
@ -865,6 +865,7 @@ public class MicroPhotoService extends Service {
startActivity(LaunchIntent);
} else {
Log.w(TAG, "Recv REBOOT command");
SysApi.reboot(getApplicationContext());
}
}

Loading…
Cancel
Save