Skip to content

Commit 05d2627

Browse files
committed
Move logError to new DebugTool APIs in android/base
1 parent 54d5385 commit 05d2627

54 files changed

Lines changed: 386 additions & 386 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

android/sdl_android/src/main/java/com/smartdevicelink/SdlConnection/SdlSession.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public IVideoStreamListener startVideoStream() {
264264
return packetizer;
265265
}
266266
default:
267-
DebugTool.logError("Protocol " + protocol + " is not supported.");
267+
DebugTool.logError(TAG, "Protocol " + protocol + " is not supported.");
268268
return null;
269269
}
270270
} catch (IOException e) {
@@ -291,7 +291,7 @@ public void startRPCStream(InputStream is, RPCRequest request, SessionType sType
291291
mRPCPacketizer = new StreamRPCPacketizer(null, this, is, request, sType, rpcSessionID, wiproVersion, 0, this);
292292
mRPCPacketizer.start();
293293
} catch (Exception e) {
294-
DebugTool.logError("Unable to start streaming:" + e.toString());
294+
DebugTool.logError(TAG, "Unable to start streaming:" + e.toString());
295295
}
296296
}
297297

@@ -304,7 +304,7 @@ public OutputStream startRPCStream(RPCRequest request, SessionType sType, byte r
304304
mRPCPacketizer.start();
305305
return os;
306306
} catch (Exception e) {
307-
DebugTool.logError("Unable to start streaming:" + e.toString());
307+
DebugTool.logError(TAG, "Unable to start streaming:" + e.toString());
308308
}
309309
return null;
310310
}

android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ public class VirtualDisplayEncoder {
8383
*/
8484
public void init(Context context, IVideoStreamListener outputListener, VideoStreamingParameters streamingParams) throws Exception {
8585
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
86-
DebugTool.logError("API level of 19 required for VirtualDisplayEncoder");
86+
DebugTool.logError(TAG, "API level of 19 required for VirtualDisplayEncoder");
8787
throw new Exception("API level of 19 required");
8888
}
8989

9090
if (context == null || outputListener == null || streamingParams == null || streamingParams.getResolution() == null || streamingParams.getFormat() == null) {
91-
DebugTool.logError("init parameters cannot be null for VirtualDisplayEncoder");
91+
DebugTool.logError(TAG, "init parameters cannot be null for VirtualDisplayEncoder");
9292
throw new Exception("init parameters cannot be null");
9393
}
9494

@@ -122,7 +122,7 @@ public void setStreamingParams(VideoStreamingParameters streamingParams) {
122122
*/
123123
public void start() throws Exception {
124124
if (!initPassed) {
125-
DebugTool.logError("VirtualDisplayEncoder was not properly initialized with the init() method.");
125+
DebugTool.logError(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
126126
return;
127127
}
128128
if (streamingParams == null || streamingParams.getResolution() == null || streamingParams.getFormat() == null) {
@@ -142,15 +142,15 @@ public void start() throws Exception {
142142
startEncoder();
143143

144144
} catch (Exception ex) {
145-
DebugTool.logError("Unable to create Virtual Display.");
145+
DebugTool.logError(TAG, "Unable to create Virtual Display.");
146146
throw new RuntimeException(ex);
147147
}
148148
}
149149
}
150150

151151
public void shutDown() {
152152
if (!initPassed) {
153-
DebugTool.logError("VirtualDisplayEncoder was not properly initialized with the init() method.");
153+
DebugTool.logError(TAG, "VirtualDisplayEncoder was not properly initialized with the init() method.");
154154
return;
155155
}
156156
try {
@@ -175,7 +175,7 @@ public void shutDown() {
175175
inputSurface = null;
176176
}
177177
} catch (Exception ex) {
178-
DebugTool.logError("shutDown() failed");
178+
DebugTool.logError(TAG, "shutDown() failed");
179179
}
180180
}
181181

@@ -266,7 +266,7 @@ public void onOutputFormatChanged(MediaCodec codec, MediaFormat format) {
266266
encoderThread = new Thread(new EncoderCompat());
267267

268268
} else {
269-
DebugTool.logError("Unable to start encoder. Android OS version " + Build.VERSION.SDK_INT + "is not supported");
269+
DebugTool.logError(TAG, "Unable to start encoder. Android OS version " + Build.VERSION.SDK_INT + "is not supported");
270270
}
271271

272272
return surface;

android/sdl_android/src/main/java/com/smartdevicelink/managers/SdlManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void checkState() {
161161
onReady();
162162
} else if (permissionManager.getState() == BaseSubManager.ERROR && fileManager.getState() == BaseSubManager.ERROR && screenManager.getState() == BaseSubManager.ERROR && (!lockScreenConfig.isEnabled() || lockScreenManager.getState() == BaseSubManager.ERROR)) {
163163
String info = "ERROR starting sdl manager, all sub managers are in error state";
164-
DebugTool.logError(info);
164+
DebugTool.logError(TAG, info);
165165
transitionToState(BaseSubManager.ERROR);
166166
notifyDevListener(info);
167167
} else if (permissionManager.getState() == BaseSubManager.SETTING_UP || fileManager.getState() == BaseSubManager.SETTING_UP || screenManager.getState() == BaseSubManager.SETTING_UP || (lockScreenConfig.isEnabled() && lockScreenManager != null && lockScreenManager.getState() == BaseSubManager.SETTING_UP)) {
@@ -178,7 +178,7 @@ void checkState() {
178178
} else {
179179
// We should never be here, but somehow one of the sub-sub managers is null
180180
String info = "ERROR one of the sdl sub managers is null";
181-
DebugTool.logError(info);
181+
DebugTool.logError(TAG, info);
182182
transitionToState(BaseSubManager.ERROR);
183183
notifyDevListener(info);
184184
}
@@ -293,7 +293,7 @@ AudioStreamManager getAudioStreamManager() {
293293
*/
294294
public LockScreenManager getLockScreenManager() {
295295
if (lockScreenManager.getState() != BaseSubManager.READY && lockScreenManager.getState() != BaseSubManager.LIMITED) {
296-
DebugTool.logError("LockScreenManager should not be accessed because it is not in READY/LIMITED state");
296+
DebugTool.logError(TAG, "LockScreenManager should not be accessed because it is not in READY/LIMITED state");
297297
}
298298
checkSdlManagerState();
299299
return lockScreenManager;

android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/AudioStreamManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void onServiceError(SdlSession session, SessionType type, String reason)
145145
serviceCompletionHandler.removeCallbacks(serviceCompletionTimeoutCallback);
146146

147147
streamingStateMachine.transitionToState(StreamingStateMachine.ERROR);
148-
DebugTool.logError("OnServiceError: " + reason);
148+
DebugTool.logError(TAG, "OnServiceError: " + reason);
149149
streamingStateMachine.transitionToState(StreamingStateMachine.NONE);
150150

151151
if (serviceCompletionListener != null) {
@@ -229,7 +229,7 @@ public void onCapabilityRetrieved(Object capability) {
229229

230230
@Override
231231
public void onError(String info) {
232-
DebugTool.logError("Error retrieving audio streaming capability: " + info);
232+
DebugTool.logError(TAG, "Error retrieving audio streaming capability: " + info);
233233
streamingStateMachine.transitionToState(StreamingStateMachine.ERROR);
234234
transitionToState(ERROR);
235235
}
@@ -414,7 +414,7 @@ public void onDecoderFinish(boolean success) {
414414

415415
@Override
416416
public void onDecoderError(Exception e) {
417-
DebugTool.logError("decoder error", e);
417+
DebugTool.logError(TAG, "decoder error", e);
418418
}
419419
};
420420

android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/BaseAudioDecoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ protected void onOutputFormatChanged(@NonNull MediaFormat mediaFormat) {
252252
}
253253

254254
protected void onMediaCodecError(@NonNull MediaCodec.CodecException e) {
255-
DebugTool.logError("MediaCodec.onError: " + e.getLocalizedMessage());
255+
DebugTool.logError(TAG, "MediaCodec.onError: " + e.getLocalizedMessage());
256256
if (listener != null) {
257257
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
258258
listener.onDecoderError(e);

android/sdl_android/src/main/java/com/smartdevicelink/managers/audio/SampleBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public double get(int index) {
209209
return avg;
210210
}
211211
default: {
212-
DebugTool.logError("SampleBuffer.get(int): The sample type is not known: " + sampleType);
212+
DebugTool.logError(TAG, "SampleBuffer.get(int): The sample type is not known: " + sampleType);
213213
return 0.0;
214214
}
215215
}
@@ -273,7 +273,7 @@ public void put(int index, double sample) {
273273
break;
274274
}
275275
default: {
276-
DebugTool.logError("SampleBuffer.set(int): The sample type is not known: " + sampleType);
276+
DebugTool.logError(TAG, "SampleBuffer.set(int): The sample type is not known: " + sampleType);
277277
}
278278
}
279279
}

android/sdl_android/src/main/java/com/smartdevicelink/managers/file/FileManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private byte[] contentsOfResource(int resource) {
142142
is = context.get().getResources().openRawResource(resource);
143143
return contentsOfInputStream(is);
144144
} catch (Resources.NotFoundException e) {
145-
DebugTool.logError("Can't read from resource", e);
145+
DebugTool.logError(TAG, "Can't read from resource", e);
146146
return null;
147147
} finally {
148148
if (is != null) {
@@ -166,7 +166,7 @@ private byte[] contentsOfUri(Uri uri){
166166
is = context.get().getContentResolver().openInputStream(uri);
167167
return contentsOfInputStream(is);
168168
} catch (IOException e){
169-
DebugTool.logError("Can't read from Uri", e);
169+
DebugTool.logError(TAG, "Can't read from Uri", e);
170170
return null;
171171
} finally {
172172
if (is != null) {

android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenDeviceIconManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private void saveFileToCache(Bitmap icon, String iconUrl) {
135135
fos.close();
136136
writeDeviceIconParametersToSharedPreferences(iconHash);
137137
} catch (Exception e) {
138-
DebugTool.logError("Failed to save icon to cache");
138+
DebugTool.logError(TAG, "Failed to save icon to cache");
139139
e.printStackTrace();
140140
}
141141
}
@@ -153,15 +153,15 @@ private Bitmap getFileFromCache(String iconUrl) {
153153
if (iconLastUpdatedTime != null) {
154154
Bitmap cachedIcon = BitmapFactory.decodeFile(this.context.getCacheDir() + "/" + STORED_ICON_DIRECTORY_PATH + "/" + iconHash);
155155
if(cachedIcon == null) {
156-
DebugTool.logError("Failed to get Bitmap from decoding file cache");
156+
DebugTool.logError(TAG, "Failed to get Bitmap from decoding file cache");
157157
clearIconDirectory();
158158
sharedPref.edit().clear().commit();
159159
return null;
160160
} else {
161161
return cachedIcon;
162162
}
163163
} else {
164-
DebugTool.logError("Failed to get shared preferences");
164+
DebugTool.logError(TAG, "Failed to get shared preferences");
165165
return null;
166166
}
167167
}
@@ -195,7 +195,7 @@ private String getMD5HashFromIconUrl(String iconUrl) {
195195
}
196196
iconHash = hashtext;
197197
} catch (NoSuchAlgorithmException e) {
198-
DebugTool.logError("Unable to hash icon url");
198+
DebugTool.logError(TAG, "Unable to hash icon url");
199199
e.printStackTrace();
200200
}
201201
return iconHash;

android/sdl_android/src/main/java/com/smartdevicelink/managers/lockscreen/LockScreenManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public void onImageRetrieved(Bitmap icon) {
392392

393393
@Override
394394
public void onError(String info) {
395-
DebugTool.logError(info);
395+
DebugTool.logError(TAG, info);
396396
}
397397
});
398398
}

android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void onServiceStarted(SdlSession session, SessionType type, boolean isEnc
109109
}
110110

111111
if (VideoStreamManager.this.streamListener == null) {
112-
DebugTool.logError("Error starting video stream");
112+
DebugTool.logError(TAG, "Error starting video stream");
113113
stateMachine.transitionToState(StreamingStateMachine.ERROR);
114114
return;
115115
}
@@ -136,7 +136,7 @@ public void onServiceEnded(SdlSession session, SessionType type) {
136136

137137
@Override
138138
public void onServiceError(SdlSession session, SessionType type, String reason) {
139-
DebugTool.logError("Unable to start video service: " + reason);
139+
DebugTool.logError(TAG, "Unable to start video service: " + reason);
140140
stateMachine.transitionToState(StreamingStateMachine.ERROR);
141141
transitionToState(BaseSubManager.ERROR);
142142
}
@@ -235,7 +235,7 @@ public void onCapabilityRetrieved(Object capability) {
235235

236236
@Override
237237
public void onError(String info) {
238-
DebugTool.logError("Error retrieving video streaming capability: " + info);
238+
DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
239239
stateMachine.transitionToState(StreamingStateMachine.ERROR);
240240
transitionToState(ERROR);
241241
}
@@ -268,7 +268,7 @@ public void startRemoteDisplayStream(Context context, Class<? extends SdlRemoteD
268268
this.remoteDisplayClass = remoteDisplayClass;
269269
int majorProtocolVersion = internalInterface.getProtocolVersion().getMajor();
270270
if(majorProtocolVersion >= 5 && !internalInterface.isCapabilitySupported(SystemCapabilityType.VIDEO_STREAMING)){
271-
DebugTool.logError("Video streaming not supported on this module");
271+
DebugTool.logError(TAG, "Video streaming not supported on this module");
272272
stateMachine.transitionToState(StreamingStateMachine.ERROR);
273273
return;
274274
}
@@ -285,7 +285,7 @@ public void onCapabilityRetrieved(Object capability) {
285285
@Override
286286
public void onError(String info) {
287287
stateMachine.transitionToState(StreamingStateMachine.ERROR);
288-
DebugTool.logError("Error retrieving video streaming capability: " + info);
288+
DebugTool.logError(TAG, "Error retrieving video streaming capability: " + info);
289289
}
290290
});
291291
}else{
@@ -312,7 +312,7 @@ public void onError(String info) {
312312
protected void startStreaming(VideoStreamingParameters parameters, boolean encrypted){
313313
this.parameters = parameters;
314314
if (!isHMIStateVideoStreamCapable(currentOnHMIStatus)) {
315-
DebugTool.logError("Cannot start video service in the current HMI status");
315+
DebugTool.logError(TAG, "Cannot start video service in the current HMI status");
316316
return;
317317
}
318318
//Start the video service
@@ -495,7 +495,7 @@ public void run() {
495495

496496
showPresentation.start();
497497
} catch (Exception ex) {
498-
DebugTool.logError("Unable to create Virtual Display.");
498+
DebugTool.logError(TAG, "Unable to create Virtual Display.");
499499
if(DebugTool.isDebugEnabled()){
500500
ex.printStackTrace();
501501
}

0 commit comments

Comments
 (0)