/td>
|
44
|
44
|
|
|
45
|
|
- private static final String MSG_TYPE_CAMERA_ERROR = "camero error";//相机错误,可能是线松动了。先exit,然后重新init
|
|
46
|
|
- private static final String MSG_TYPE_NOT_INIT = "not init"; //需要初始化
|
|
47
|
|
- private static final String MSG_TYPE_NAME_ERROR = "name error"; //继续调用waitforevent
|
|
48
|
|
- private static final String MSG_TYPE_TIME_OUT = "time out"; //继续调用waitforevent
|
|
49
|
|
- private static final String MSG_TYPE_CREATE_FILE_ERROR = "creat error";//照片文件创建失败
|
|
|
45
|
+ private PtpService ptp;
|
|
|
46
|
+ private Camera camera;
|
|
|
47
|
+ private int[] origin = new int[0];
|
|
50
|
48
|
|
|
51
|
|
- private static final int MAX_NO_PHOTO_COUNT = 500;
|
|
52
|
|
- private int count = 0;
|
|
|
49
|
+ @Override
|
|
|
50
|
+ public void onCreate() {
|
|
|
51
|
+ super.onCreate();
|
|
|
52
|
+ ptp = PtpService.Singleton.getInstance(this);
|
|
|
53
|
+ }
|
|
53
|
54
|
|
|
54
|
55
|
@Override
|
|
55
|
56
|
public IBinder onBind(Intent intent) {
|
|
|
|
@@ -59,40 +60,27 @@ public class CameraService extends Service {
|
|
59
|
60
|
@Override
|
|
60
|
61
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
61
|
62
|
LogHelper.d("czy","CameraService onStartCommand ");
|
|
62
|
|
- if(intent!=null&&intent.getIntExtra(EXTRA_CMD,0)>0){
|
|
|
63
|
+ if(camera == null){
|
|
|
64
|
+ startCamera(intent);
|
|
|
65
|
+ }else if(intent!=null&&intent.getIntExtra(EXTRA_CMD,0)>0){
|
|
63
|
66
|
int cmd = intent.getIntExtra(EXTRA_CMD,0);
|
|
64
|
67
|
if(cmd == CMD_EXIT_CAMERA_CONNECTION){
|
|
65
|
68
|
LogHelper.d("czy","CameraService 收到停止进程任务");
|
|
66
|
|
- stopCameraService();
|
|
|
69
|
+ stopCamera();
|
|
67
|
70
|
}else if(cmd == CMD_INIT_CAMERA_CONNECTION){
|
|
68
|
|
- if(!isInitExecuted){
|
|
69
|
|
- LogHelper.d("czy","CameraService 收到初始化相机任务");
|
|
70
|
|
- count = 0;
|
|
71
|
|
- cameraInitTask = new CameraInitTask();
|
|
72
|
|
- cameraInitTask.execute();
|
|
73
|
|
- }else{
|
|
74
|
|
- LogHelper.d("czy","CameraService 相机初始化成功");
|
|
|
71
|
+ if(camera != null){
|
|
75
|
72
|
Bundle bundle = new Bundle();
|
|
76
|
73
|
bundle.putInt(EXTRA_STATUS_PART,MSG_CAMERA_INIT_SUCCESS);
|
|
77
|
74
|
sendCameraIntent(bundle);
|
|
78
|
75
|
}
|
|
79
|
76
|
}else if(cmd == CMD_START_CAPTURE_PHOTO){
|
|
80
|
|
- if(isInitExecuted){
|
|
|
77
|
+ if(camera !=null){
|
|
81
|
78
|
LogHelper.d("czy","CameraService 收到开始拍摄任务");
|
|
82
|
|
- sessionWorkingDirPath = intent.getStringExtra(EXTRA_SESSION_DIR);
|
|
83
|
|
- if(!TextUtils.isEmpty(sessionWorkingDirPath)){
|
|
84
|
|
- startCapture();
|
|
85
|
|
- }
|
|
|
79
|
+ startCapture();
|
|
86
|
80
|
}
|
|
87
|
81
|
}else if(cmd == CMD_STOP_CAPTURE_PHOTO){
|
|
88
|
|
- stopCapture();
|
|
89
|
|
- }
|
|
90
|
|
- }else{
|
|
91
|
|
- if(!isInitExecuted){
|
|
92
|
|
- LogHelper.d("czy","CameraService自动重启,初始化相机");
|
|
93
|
|
- count = 0;
|
|
94
|
|
- cameraInitTask = new CameraInitTask();
|
|
95
|
|
- cameraInitTask.execute();
|
|
|
82
|
+ LogHelper.d("czy","CameraService 收到结束拍摄任务");
|
|
|
83
|
+ stopCapture();
|
|
96
|
84
|
}
|
|
97
|
85
|
}
|
|
98
|
86
|
return super.onStartCommand(intent, flags, startId);
|
|
|
|
@@ -100,89 +88,38 @@ public class CameraService extends Service {
|
|
100
|
88
|
|
|
101
|
89
|
@Override
|
|
102
|
90
|
public void onDestroy() {
|
|
|
91
|
+ stopCamera();
|
|
103
|
92
|
super.onDestroy();
|
|
104
|
93
|
}
|
|
105
|
94
|
|
|
106
|
|
- private void stopCameraService(){
|
|
107
|
|
- count = 0;
|
|
|
95
|
+ private void startCamera(Intent intent){
|
|
|
96
|
+ LogHelper.d("czy","CameraService 尝试与相机建立连接");
|
|
|
97
|
+ ptp.setCameraListener(this);
|
|
|
98
|
+ ptp.initialize(this, intent);
|
|
|
99
|
+ }
|
|
|
100
|
+ private void stopCamera(){
|
|
108
|
101
|
LogHelper.d("czy","CameraService stopCameraService ");
|
|
109
|
|
- if(cameraInitTask!=null){
|
|
110
|
|
- cameraInitTask.cancel();
|
|
111
|
|
- }
|
|
112
|
102
|
if(photoCaptureTimer !=null){
|
|
113
|
103
|
photoCaptureTimer.cancel();
|
|
114
|
104
|
photoCaptureTimer = null;
|
|
115
|
105
|
}
|
|
116
|
|
- new CameraExitTask().execute();
|
|
|
106
|
+ ptp.setCameraListener(null);
|
|
|
107
|
+ ptp.shutdown();
|
|
117
|
108
|
stopSelf();
|
|
118
|
109
|
Process.killProcess(Process.myPid());
|
|
119
|
110
|
System.exit(0);
|
|
120
|
111
|
}
|
|
121
|
112
|
|
|
122
|
|
- class CameraInitTask extends AsyncTask<Void,Integer,Integer>{
|
|
123
|
|
-
|
|
124
|
|
- private boolean isCancelled = false;
|
|
125
|
|
-
|
|
126
|
|
- public void cancel(){
|
|
127
|
|
- isCancelled = true;
|
|
128
|
|
- }
|
|
129
|
|
-
|
|
130
|
|
- @Override
|
|
131
|
|
- protected Integer doInBackground(Void... params) {
|
|
132
|
|
- LogHelper.d("czy","CameraService CameraInitTask ");
|
|
133
|
|
- try{
|
|
134
|
|
- return CameraJNIInterface.getInstance().java_mygpcamerainit();
|
|
135
|
|
- }catch (Throwable t){
|
|
136
|
|
- t.printStackTrace();
|
|
137
|
|
- return -1;
|
|
138
|
|
- }
|
|
139
|
|
- }
|
|
140
|
|
-
|
|
141
|
|
- @Override
|
|
142
|
|
- protected void onPostExecute(Integer result) {
|
|
143
|
|
-
|
|
144
|
|
- if(isCancelled){
|
|
145
|
|
- return;
|
|
146
|
|
- }
|
|
147
|
|
- if(result>=0){
|
|
148
|
|
- LogHelper.d("czy","CameraService 相机初始化成功");
|
|
149
|
|
- isInitExecuted = true;
|
|
150
|
|
- Bundle bundle = new Bundle();
|
|
151
|
|
- bundle.putInt(EXTRA_STATUS_PART,MSG_CAMERA_INIT_SUCCESS);
|
|
152
|
|
- sendCameraIntent(bundle);
|
|
153
|
|
- }else{
|
|
154
|
|
- LogHelper.d("czy","CameraService 相机初始化失败,杀掉进程,返回值是"+result);
|
|
155
|
|
- Bundle bundle = new Bundle();
|
|
156
|
|
- bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_CONN_ERROR);
|
|
157
|
|
- sendCameraIntent(bundle);
|
|
158
|
|
- stopCameraService();
|
|
159
|
|
- }
|
|
160
|
|
- }
|
|
161
|
|
- }
|
|
162
|
|
-
|
|
163
|
|
- class CameraExitTask extends AsyncTask<Void,Integer,Integer>{
|
|
164
|
|
-
|
|
165
|
|
-
|
|
166
|
|
- @Override
|
|
167
|
|
- protected Integer doInBackground(Void... params) {
|
|
168
|
|
- try{
|
|
169
|
|
- return CameraJNIInterface.getInstance().java_mygpcameraexit();
|
|
170
|
|
- }catch (Throwable t){
|
|
171
|
|
- t.printStackTrace();
|
|
172
|
|
- }
|
|
173
|
|
- return 0;
|
|
174
|
|
- }
|
|
175
|
113
|
|
|
176
|
|
- }
|
|
177
|
114
|
public void startCapture() {
|
|
178
|
115
|
stopCapture();
|
|
179
|
116
|
photoCaptureTimer = new Timer();
|
|
180
|
117
|
photoCaptureTimer.schedule(new TimerTask() {
|
|
181
|
118
|
@Override
|
|
182
|
119
|
public void run() {
|
|
183
|
|
- fetchPhotoTask();
|
|
|
120
|
+ camera.retrieveImageHandles(CameraService.this, 0xFFFFFFFF, PtpConstants.ObjectFormat.EXIF_JPEG);
|
|
184
|
121
|
}
|
|
185
|
|
- },1000, Preferences.getInstance().getCameraQueryInterval());
|
|
|
122
|
+ },0, Preferences.getInstance().getCameraQueryInterval());
|
|
186
|
123
|
}
|
|
187
|
124
|
|
|
188
|
125
|
public void stopCapture(){
|
|
|
|
@@ -190,66 +127,174 @@ public class CameraService extends Service {
|
|
190
|
127
|
photoCaptureTimer.cancel();
|
|
191
|
128
|
photoCaptureTimer = null;
|
|
192
|
129
|
}
|
|
|
130
|
+ origin = new int[0];
|
|
193
|
131
|
}
|
|
194
|
132
|
|
|
195
|
|
- private void fetchPhotoTask(){
|
|
196
|
|
- if(!isLastQueryReturned){
|
|
197
|
|
- LogHelper.d("czy","CameraService fetchPhotoTask last query not finished,return ");
|
|
198
|
|
- return;
|
|
199
|
|
- }
|
|
|
133
|
+ private void sendCameraIntent(Bundle bundle){
|
|
|
134
|
+ Intent intent = new Intent(ACTION_CAMERA_SERVICE_STATUS_CHANGE);
|
|
|
135
|
+ intent.putExtras(bundle);
|
|
|
136
|
+ sendBroadcast(intent);
|
|
|
137
|
+ }
|
|
200
|
138
|
|
|
201
|
|
- isLastQueryReturned = false;
|
|
202
|
|
- String eventMsg = CameraJNIInterface.getInstance().java_mygpcamerawaitforevent(sessionWorkingDirPath);
|
|
203
|
|
- LogHelper.d("czy","CameraService mygpcamerawaitforevent return result = "+eventMsg);
|
|
204
|
|
- if(eventMsg!=null && eventMsg.length()>0){
|
|
205
|
|
- count = 0;
|
|
206
|
|
- if(MSG_TYPE_NOT_INIT.equalsIgnoreCase(eventMsg)||MSG_TYPE_CAMERA_ERROR.equalsIgnoreCase(eventMsg)){
|
|
207
|
|
- LogHelper.d("czy","CameraService fetchPhotoTask 相机连接错误,重新连接试试");
|
|
208
|
|
- Bundle bundle = new Bundle();
|
|
209
|
|
- bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_CONN_ERROR);
|
|
210
|
|
- sendCameraIntent(bundle);
|
|
211
|
|
- stopCameraService();
|
|
212
|
|
- }else if(MSG_TYPE_TIME_OUT.equalsIgnoreCase(eventMsg)||MSG_TYPE_NAME_ERROR.equalsIgnoreCase(eventMsg)){
|
|
213
|
|
- count++;
|
|
214
|
|
- if(count>=MAX_NO_PHOTO_COUNT){
|
|
215
|
|
- LogHelper.d("czy","CameraService fetchPhotoTask 太久没发现新照片了,重新连接试试");
|
|
216
|
|
- Bundle bundle = new Bundle();
|
|
217
|
|
- bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_CONN_ERROR);
|
|
218
|
|
- sendCameraIntent(bundle);
|
|
219
|
|
- stopCameraService();
|
|
|
139
|
+
|
|
|
140
|
+ @Override
|
|
|
141
|
+ public void onCameraStarted(Camera camera) {
|
|
|
142
|
+ this.camera = camera;
|
|
|
143
|
+ LogHelper.d("czy","CameraService 相机初始化成功");
|
|
|
144
|
+ Bundle bundle = new Bundle();
|
|
|
145
|
+ bundle.putInt(EXTRA_STATUS_PART,MSG_CAMERA_INIT_SUCCESS);
|
|
|
146
|
+ sendCameraIntent(bundle);
|
|
|
147
|
+ }
|
|
|
148
|
+
|
|
|
149
|
+ @Override
|
|
|
150
|
+ public void onCameraStopped(Camera camera) {
|
|
|
151
|
+ this.camera = null;
|
|
|
152
|
+ Bundle bundle = new Bundle();
|
|
|
153
|
+ bundle.putInt(EXTRA_STATUS_PART,MSG_CAMERA_CONN_ERROR);
|
|
|
154
|
+ sendCameraIntent(bundle);
|
|
|
155
|
+ }
|
|
|
156
|
+
|
|
|
157
|
+ @Override
|
|
|
158
|
+ public void onNoCameraFound() {
|
|
|
159
|
+ this.camera = null;
|
|
|
160
|
+ Bundle bundle = new Bundle();
|
|
|
161
|
+ bundle.putInt(EXTRA_STATUS_PART,MSG_CAMERA_CONN_ERROR);
|
|
|
162
|
+ sendCameraIntent(bundle);
|
|
|
163
|
+ }
|
|
|
164
|
+
|
|
|
165
|
+ @Override
|
|
|
166
|
+ public void onError(String message) {
|
|
|
167
|
+ camera = null;
|
|
|
168
|
+ Bundle bundle = new Bundle();
|
|
|
169
|
+ bundle.putInt(EXTRA_STATUS_PART,MSG_CAMERA_CONN_ERROR);
|
|
|
170
|
+ sendCameraIntent(bundle);
|
|
|
171
|
+ }
|
|
|
172
|
+
|
|
|
173
|
+ @Override
|
|
|
174
|
+ public void onPropertyChanged(int property, int value) {
|
|
|
175
|
+
|
|
|
176
|
+ }
|
|
|
177
|
+
|
|
|
178
|
+ @Override
|
|
|
179
|
+ public void onPropertyStateChanged(int property, boolean enabled) {
|
|
|
180
|
+
|
|
|
181
|
+ }
|
|
|
182
|
+
|
|
|
183
|
+ @Override
|
|
|
184
|
+ public void onPropertyDescChanged(int property, int[] values) {
|
|
|
185
|
+
|
|
|
186
|
+ }
|
|
|
187
|
+
|
|
|
188
|
+ @Override
|
|
|
189
|
+ public void onLiveViewStarted() {
|
|
|
190
|
+
|
|
|
191
|
+ }
|
|
|
192
|
+
|
|
|
193
|
+ @Override
|
|
|
194
|
+ public void onLiveViewData(LiveViewData data) {
|
|
|
195
|
+
|
|
|
196
|
+ }
|
|
|
197
|
+
|
|
|
198
|
+ @Override
|
|
|
199
|
+ public void onLiveViewStopped() {
|
|
|
200
|
+
|
|
|
201
|
+ }
|
|
|
202
|
+
|
|
|
203
|
+ @Override
|
|
|
204
|
+ public void onCapturedPictureReceived(int objectHandle, String filename, Bitmap thumbnail, Bitmap bitmap) {
|
|
|
205
|
+
|
|
|
206
|
+ LogHelper.d("czy","CameraService fetchPhotoTask new photo found");
|
|
|
207
|
+
|
|
|
208
|
+ Bundle bundle = new Bundle();
|
|
|
209
|
+ bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_NEW_PHOTO_FOUND);
|
|
|
210
|
+ bundle.putString(EXTRA_DATA_PART,filename);
|
|
|
211
|
+ sendCameraIntent(bundle);
|
|
|
212
|
+ }
|
|
|
213
|
+
|
|
|
214
|
+ @Override
|
|
|
215
|
+ public void onBulbStarted() {
|
|
|
216
|
+
|
|
|
217
|
+ }
|
|
|
218
|
+
|
|
|
219
|
+ @Override
|
|
|
220
|
+ public void onBulbExposureTime(int seconds) {
|
|
|
221
|
+
|
|
|
222
|
+ }
|
|
|
223
|
+
|
|
|
224
|
+ @Override
|
|
|
225
|
+ public void onBulbStopped() {
|
|
|
226
|
+
|
|
|
227
|
+ }
|
|
|
228
|
+
|
|
|
229
|
+ @Override
|
|
|
230
|
+ public void onFocusStarted() {
|
|
|
231
|
+
|
|
|
232
|
+ }
|
|
|
233
|
+
|
|
|
234
|
+ @Override
|
|
|
235
|
+ public void onFocusEnded(boolean hasFocused) {
|
|
|
236
|
+
|
|
|
237
|
+ }
|
|
|
238
|
+
|
|
|
239
|
+ @Override
|
|
|
240
|
+ public void onFocusPointsChanged() {
|
|
|
241
|
+
|
|
|
242
|
+ }
|
|
|
243
|
+
|
|
|
244
|
+ @Override
|
|
|
245
|
+ public void onObjectAdded(int handle) {
|
|
|
246
|
+
|
|
|
247
|
+ }
|
|
|
248
|
+
|
|
|
249
|
+ @Override
|
|
|
250
|
+ public void onLogMessage(String msg) {
|
|
|
251
|
+
|
|
|
252
|
+ }
|
|
|
253
|
+
|
|
|
254
|
+ @Override
|
|
|
255
|
+ public void onStorageFound(int handle, String label) {
|
|
|
256
|
+
|
|
|
257
|
+ }
|
|
|
258
|
+
|
|
|
259
|
+ @Override
|
|
|
260
|
+ public void onAllStoragesFound() {
|
|
|
261
|
+
|
|
|
262
|
+ }
|
|
|
263
|
+
|
|
|
264
|
+ @Override
|
|
|
265
|
+ public void onImageHandlesRetrieved(int[] handles) {
|
|
|
266
|
+ if(origin.length ==0){
|
|
|
267
|
+ origin = handles;
|
|
|
268
|
+ }else{
|
|
|
269
|
+ if(origin.length == handles.length){
|
|
|
270
|
+ return;
|
|
|
271
|
+ }
|
|
|
272
|
+ ArrayList<Integer> diff = new ArrayList<>();
|
|
|
273
|
+ for (int i = 0; i < handles.length; i++) {
|
|
|
274
|
+ boolean isMatch = false;
|
|
|
275
|
+ for (int j = 0; j < origin.length; j++) {
|
|
|
276
|
+ if (origin[j] == handles[i]) {
|
|
|
277
|
+ isMatch = true;
|
|
|
278
|
+ break;
|
|
|
279
|
+ }
|
|
220
|
280
|
}
|
|
221
|
|
- }else if(MSG_TYPE_CREATE_FILE_ERROR.equalsIgnoreCase(eventMsg)){
|
|
222
|
|
- Bundle bundle = new Bundle();
|
|
223
|
|
- bundle.putInt(EXTRA_STATUS_PART, MSG_SDCARD_ERROR);
|
|
224
|
|
- sendCameraIntent(bundle);
|
|
225
|
|
- }else{
|
|
226
|
|
- String sub = eventMsg.substring(0,1);
|
|
227
|
|
- if(TextUtils.isDigitsOnly(sub)){
|
|
228
|
|
- LogHelper.d("czy","CameraService fetchPhotoTask new photo found");
|
|
229
|
|
- Bundle bundle = new Bundle();
|
|
230
|
|
- bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_NEW_PHOTO_FOUND);
|
|
231
|
|
- bundle.putString(EXTRA_DATA_PART,eventMsg);
|
|
232
|
|
- sendCameraIntent(bundle);
|
|
|
281
|
+ if (!isMatch) {
|
|
|
282
|
+ diff.add(handles[i]);
|
|
233
|
283
|
}
|
|
234
|
284
|
}
|
|
235
|
|
- }else{
|
|
236
|
|
- count++;
|
|
237
|
|
- if(count>=MAX_NO_PHOTO_COUNT){
|
|
238
|
|
- LogHelper.d("czy","CameraService fetchPhotoTask 太久没发现新照片了,重新连接试试");
|
|
239
|
|
- Bundle bundle = new Bundle();
|
|
240
|
|
- bundle.putInt(EXTRA_STATUS_PART, MSG_CAMERA_CONN_ERROR);
|
|
241
|
|
- sendCameraIntent(bundle);
|
|
242
|
|
- stopCameraService();
|
|
|
285
|
+ if(camera != null && diff.size() >0){
|
|
|
286
|
+ for(int k = 0; k< diff.size();k++){
|
|
|
287
|
+ camera.retrievePicture(diff.get(k));
|
|
|
288
|
+ }
|
|
243
|
289
|
}
|
|
|
290
|
+ origin = handles;
|
|
244
|
291
|
}
|
|
245
|
|
-
|
|
246
|
|
- isLastQueryReturned = true;
|
|
247
|
292
|
}
|
|
248
|
293
|
|
|
249
|
|
- private void sendCameraIntent(Bundle bundle){
|
|
250
|
|
- Intent intent = new Intent(ACTION_CAMERA_SERVICE_STATUS_CHANGE);
|
|
251
|
|
- intent.putExtras(bundle);
|
|
252
|
|
- sendBroadcast(intent);
|
|
|
294
|
+ @Override
|
|
|
295
|
+ public void onImageInfoRetrieved(int objectHandle, ObjectInfo objectInfo, Bitmap thumbnail) {
|
|
|
296
|
+
|
|
253
|
297
|
}
|
|
254
|
298
|
|
|
|
299
|
+
|
|
255
|
300
|
}
|
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
+<!-- Copyright (C) 2011 The Android Open Source Project
|
|
|
3
|
+
|
|
|
4
|
+ Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5
|
+ you may not use this file except in compliance with the License.
|
|
|
6
|
+ You may obtain a copy of the License at
|
|
|
7
|
+
|
|
|
8
|
+ http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9
|
+
|
|
|
10
|
+ Unless required by applicable law or agreed to in writing, software
|
|
|
11
|
+ distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12
|
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13
|
+ See the License for the specific language governing permissions and
|
|
|
14
|
+ limitations under the License.
|
|
|
15
|
+-->
|
|
|
16
|
+<resources>
|
|
|
17
|
+ <!-- vendor and product ID for EOS 600D -->
|
|
|
18
|
+ <!-- usb-device vendor-id="1193" product-id="12824" -->
|
|
|
19
|
+ <!-- usb-device protocol="0" / -->
|
|
|
20
|
+ <usb-device class="6" subclass="1" protocol="1" />
|
|
|
21
|
+</resources>
|
|
|
|
@@ -101,7 +101,7 @@ public class PtpUsbService implements PtpService {
|
|
101
|
101
|
}
|
|
102
|
102
|
camera.shutdownHard();
|
|
103
|
103
|
}
|
|
104
|
|
- UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
|
|
|
104
|
+ UsbDevice device = intent == null ? null :(UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
|
|
105
|
105
|
if (device != null) {
|
|
106
|
106
|
if (AppConfig.LOG) {
|
|
107
|
107
|
Log.i(TAG, "initialize: got device through intent");
|