Remove static library loading from WebRTC Android SDK.

Bug: webrtc:7474
Change-Id: Ie75a5c12638be82d7bd91073744946ac21c48155
Reviewed-on: https://webrtc-review.googlesource.com/22962
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20865}
This commit is contained in:
Sami Kalliomäki
2017-11-24 11:13:39 +01:00
committed by Commit Bot
parent ff610bd2b2
commit 3e189a6dc3
9 changed files with 8 additions and 84 deletions

View File

@ -30,8 +30,6 @@ import java.util.logging.Logger;
public class Logging {
private static final Logger fallbackLogger = createFallbackLogger();
private static volatile boolean loggingEnabled;
private static enum NativeLibStatus { UNINITIALIZED, LOADED, FAILED }
private static volatile NativeLibStatus nativeLibStatus = NativeLibStatus.UNINITIALIZED;
private static Logger createFallbackLogger() {
final Logger fallbackLogger = Logger.getLogger("org.webrtc.Logging");
@ -39,19 +37,6 @@ public class Logging {
return fallbackLogger;
}
private static boolean loadNativeLibrary() {
if (nativeLibStatus == NativeLibStatus.UNINITIALIZED) {
try {
System.loadLibrary("jingle_peerconnection_so");
nativeLibStatus = NativeLibStatus.LOADED;
} catch (UnsatisfiedLinkError t) {
nativeLibStatus = NativeLibStatus.FAILED;
fallbackLogger.log(Level.WARNING, "Failed to load jingle_peerconnection_so: ", t);
}
}
return nativeLibStatus == NativeLibStatus.LOADED;
}
// TODO(solenberg): Remove once dependent projects updated.
@Deprecated
public enum TraceLevel {
@ -81,19 +66,10 @@ public class Logging {
public enum Severity { LS_SENSITIVE, LS_VERBOSE, LS_INFO, LS_WARNING, LS_ERROR, LS_NONE }
public static void enableLogThreads() {
if (!loadNativeLibrary()) {
fallbackLogger.log(Level.WARNING, "Cannot enable log thread because native lib not loaded.");
return;
}
nativeEnableLogThreads();
}
public static void enableLogTimeStamps() {
if (!loadNativeLibrary()) {
fallbackLogger.log(
Level.WARNING, "Cannot enable log timestamps because native lib not loaded.");
return;
}
nativeEnableLogTimeStamps();
}
@ -107,10 +83,6 @@ public class Logging {
// TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression.
@SuppressWarnings("NoSynchronizedMethodCheck")
public static synchronized void enableLogToDebugOutput(Severity severity) {
if (!loadNativeLibrary()) {
fallbackLogger.log(Level.WARNING, "Cannot enable logging because native lib not loaded.");
return;
}
nativeEnableLogToDebugOutput(severity.ordinal());
loggingEnabled = true;
}