@@ -43,11 +43,6 @@ public class CameraService extends Service {
|
||
| 43 | 43 |
private static final String MSG_TYPE_TIME_OUT = "time out"; //继续调用waitforevent |
| 44 | 44 |
|
| 45 | 45 |
@Override |
| 46 |
- public void onCreate() {
|
|
| 47 |
- super.onCreate(); |
|
| 48 |
- } |
|
| 49 |
- |
|
| 50 |
- @Override |
|
| 51 | 46 |
public IBinder onBind(Intent intent) {
|
| 52 | 47 |
return null; |
| 53 | 48 |
} |
@@ -58,7 +53,6 @@ public class CameraService extends Service {
|
||
| 58 | 53 |
int cmd = intent.getIntExtra(EXTRA_CMD,0); |
| 59 | 54 |
if(cmd == CMD_EXIT_CAMERA_CONNECTION){
|
| 60 | 55 |
stopCameraService(); |
| 61 |
- return START_NOT_STICKY; |
|
| 62 | 56 |
}else if(cmd == CMD_INIT_CAMERA_CONNECTION){
|
| 63 | 57 |
if(!isInitExecuted){
|
| 64 | 58 |
cameraInitTask = new CameraInitTask(); |
@@ -73,7 +67,6 @@ public class CameraService extends Service {
|
||
| 73 | 67 |
} |
| 74 | 68 |
} |
| 75 | 69 |
} |
| 76 |
- |
|
| 77 | 70 |
return super.onStartCommand(intent, flags, startId); |
| 78 | 71 |
} |
| 79 | 72 |
|
@@ -90,6 +83,7 @@ public class CameraService extends Service {
|
||
| 90 | 83 |
photoCaptureTimer.cancel(); |
| 91 | 84 |
photoCaptureTimer = null; |
| 92 | 85 |
} |
| 86 |
+ new CameraExitTask().execute(); |
|
| 93 | 87 |
stopSelf(); |
| 94 | 88 |
Process.killProcess(Process.myPid()); |
| 95 | 89 |
System.exit(0); |
@@ -127,6 +121,16 @@ public class CameraService extends Service {
|
||
| 127 | 121 |
} |
| 128 | 122 |
} |
| 129 | 123 |
} |
| 124 |
+ |
|
| 125 |
+ class CameraExitTask extends AsyncTask<Void,Integer,Integer>{
|
|
| 126 |
+ |
|
| 127 |
+ |
|
| 128 |
+ @Override |
|
| 129 |
+ protected Integer doInBackground(Void... params) {
|
|
| 130 |
+ return CameraJNIInterface.getInstance().java_mygpcameraexit(); |
|
| 131 |
+ } |
|
| 132 |
+ |
|
| 133 |
+ } |
|
| 130 | 134 |
public void startCapture() {
|
| 131 | 135 |
if(photoCaptureTimer !=null){
|
| 132 | 136 |
photoCaptureTimer.cancel(); |
@@ -80,7 +80,6 @@ public class SessionInteractor implements Callback{
|
||
| 80 | 80 |
Intent intent = new Intent(App.getAppContext(), CameraService.class); |
| 81 | 81 |
intent.putExtra(EXTRA_CMD,CMD_START_CAPTURE_PHOTO); |
| 82 | 82 |
App.getAppContext().startService(intent); |
| 83 |
- |
|
| 84 | 83 |
} |
| 85 | 84 |
|
| 86 | 85 |
|
@@ -9,7 +9,6 @@ import java.util.Timer; |
||
| 9 | 9 |
import java.util.TimerTask; |
| 10 | 10 |
|
| 11 | 11 |
import ai.pai.lensman.App; |
| 12 |
-import ai.pai.lensman.BuildConfig; |
|
| 13 | 12 |
import ai.pai.lensman.R; |
| 14 | 13 |
import ai.pai.lensman.bean.PhotoBean; |
| 15 | 14 |
import ai.pai.lensman.bean.SessionBean; |