Replace android.util.log for FLog

Summary:
We must use FLog instead of android.util.log, this diff moves the current callsites of android.util.log to FLog

changeLog:[internal]

Reviewed By: JoshuaGross

Differential Revision: D19884741

fbshipit-source-id: 300f7d691961aa51f0b525c37da7ae3d64fe5131
This commit is contained in:
David Vacca 2020-02-13 14:42:00 -08:00 коммит произвёл Facebook Github Bot
Родитель bcc62a6d17
Коммит 2b5283e39f
6 изменённых файлов: 28 добавлений и 29 удалений

Просмотреть файл

@ -12,7 +12,6 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import android.content.res.AssetManager;
import android.os.AsyncTask;
import android.util.Log;
import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
@ -123,7 +122,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
final NativeModuleRegistry nativeModuleRegistry,
final JSBundleLoader jsBundleLoader,
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createCatalystInstanceImpl");
mHybridData = initHybrid();
@ -140,7 +139,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
mTraceListener = new JSProfilerTraceListener(this);
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge before initializeBridge");
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "initializeCxxBridge");
initializeBridge(
new BridgeCallback(this),
@ -149,7 +148,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
mNativeModulesQueueThread,
mNativeModuleRegistry.getJavaModules(this),
mNativeModuleRegistry.getCxxModules());
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
FLog.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
mJavaScriptContextHolder = new JavaScriptContextHolder(getJavaScriptContext());
@ -253,7 +252,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
@Override
public void runJSBundle() {
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.runJSBundle()");
FLog.d(ReactConstants.TAG, "CatalystInstanceImpl.runJSBundle()");
Assertions.assertCondition(!mJSBundleHasLoaded, "JS bundle was already loaded!");
// incrementPendingJSCalls();
mJSBundleLoader.loadScript(CatalystInstanceImpl.this);
@ -333,7 +332,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
@Override
@ThreadConfined(UI)
public void destroy() {
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() start");
FLog.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() start");
UiThreadUtil.assertOnUiThread();
if (ReactFeatureFlags.useCatalystTeardownV2) {
@ -345,7 +344,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
@ThreadConfined(UI)
public void destroyV1() {
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroyV1() start");
FLog.d(ReactConstants.TAG, "CatalystInstanceImpl.destroyV1() start");
UiThreadUtil.assertOnUiThread();
if (mDestroyed) {
@ -405,7 +404,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
mHybridData.resetNative();
getReactQueueConfiguration().destroy();
Log.d(
FLog.d(
ReactConstants.TAG,
"CatalystInstanceImpl.destroy() end");
ReactMarker.logMarker(
@ -430,7 +429,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
*/
@ThreadConfined(UI)
public void destroyV2() {
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroyV2() start");
FLog.d(ReactConstants.TAG, "CatalystInstanceImpl.destroyV2() start");
UiThreadUtil.assertOnUiThread();
if (mDestroyed) {
@ -447,7 +446,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
new Runnable() {
@Override
public void run() {
Log.d("CatalystInstanceImpl", ".destroy on native modules thread");
FLog.d("CatalystInstanceImpl", ".destroy on native modules thread");
mNativeModuleRegistry.notifyJSInstanceDestroy();
// Notifies all JSI modules that they are being destroyed, including the FabricUIManager
@ -464,7 +463,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
}
mNativeModulesThreadDestructionComplete = true;
Log.d("CatalystInstanceImpl", ".destroy on native modules thread finished");
FLog.d("CatalystInstanceImpl", ".destroy on native modules thread finished");
}
});
@ -474,14 +473,14 @@ public class CatalystInstanceImpl implements CatalystInstance {
new Runnable() {
@Override
public void run() {
Log.d("CatalystInstanceImpl", ".destroy on JS thread");
FLog.d("CatalystInstanceImpl", ".destroy on JS thread");
// We need to destroy the TurboModuleManager on the JS Thread
if (mTurboModuleManagerJSIModule != null) {
mTurboModuleManagerJSIModule.onCatalystInstanceDestroy();
}
mJSThreadDestructionComplete = true;
Log.d("CatalystInstanceImpl", ".destroy on JS thread finished");
FLog.d("CatalystInstanceImpl", ".destroy on JS thread finished");
}
});
@ -490,7 +489,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
while (!mNativeModulesThreadDestructionComplete || !mJSThreadDestructionComplete) {
// Never wait here, blocking the UI thread, for more than 100ms
if ((System.currentTimeMillis() - waitStartTime) > 100) {
Log.w(
FLog.w(
ReactConstants.TAG,
"CatalystInstanceImpl.destroy() timed out waiting for Native Modules and JS thread teardown");
break;
@ -511,7 +510,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
mHybridData.resetNative();
getReactQueueConfiguration().destroy();
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() end");
FLog.d(ReactConstants.TAG, "CatalystInstanceImpl.destroy() end");
ReactMarker.logMarker(ReactMarkerConstants.DESTROY_CATALYST_INSTANCE_END);
// This is a noop if the listener was not yet registered.
@ -527,7 +526,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
@VisibleForTesting
@Override
public void initialize() {
Log.d(ReactConstants.TAG, "CatalystInstanceImpl.initialize()");
FLog.d(ReactConstants.TAG, "CatalystInstanceImpl.initialize()");
Assertions.assertCondition(
!mInitialized, "This catalyst instance has already been initialized");
// We assume that the instance manager blocks on running the JS bundle. If

Просмотреть файл

@ -7,7 +7,6 @@
package com.facebook.react.devsupport;
import android.util.Log;
import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
@ -58,7 +57,7 @@ public class BundleDownloader {
info.mUrl = obj.getString("url");
info.mFilesChangedCount = obj.getInt("filesChangedCount");
} catch (JSONException e) {
Log.e(TAG, "Invalid bundle info: ", e);
FLog.e(TAG, "Invalid bundle info: ", e);
return null;
}
@ -72,7 +71,7 @@ public class BundleDownloader {
obj.put("url", mUrl);
obj.put("filesChangedCount", mFilesChangedCount);
} catch (JSONException e) {
Log.e(TAG, "Can't serialize bundle info: ", e);
FLog.e(TAG, "Can't serialize bundle info: ", e);
return null;
}

Просмотреть файл

@ -7,11 +7,11 @@
package com.facebook.react.views.drawer;
import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import androidx.drawerlayout.widget.DrawerLayout;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.uimanager.events.NativeGestureUtil;
@ -41,7 +41,7 @@ import com.facebook.react.uimanager.events.NativeGestureUtil;
// Log and ignore the error. This seems to be a bug in the android SDK and
// this is the commonly accepted workaround.
// https://tinyurl.com/mw6qkod (Stack Overflow)
Log.w(ReactConstants.TAG, "Error intercepting touch event.", e);
FLog.w(ReactConstants.TAG, "Error intercepting touch event.", e);
}
return false;

Просмотреть файл

@ -16,6 +16,7 @@ rn_android_library(
],
deps = [
YOGA_TARGET,
react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"),
react_native_dep("third-party/java/infer-annotations:infer-annotations"),
react_native_dep("third-party/java/jsr-305:jsr-305"),
react_native_target("java/com/facebook/react/bridge:bridge"),

Просмотреть файл

@ -13,7 +13,6 @@ import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.MotionEvent;
@ -23,6 +22,7 @@ import android.widget.OverScroller;
import androidx.annotation.Nullable;
import androidx.core.text.TextUtilsCompat;
import androidx.core.view.ViewCompat;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.config.ReactFeatureFlags;
@ -95,7 +95,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
sScrollerField = HorizontalScrollView.class.getDeclaredField("mScroller");
sScrollerField.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.w(
FLog.w(
ReactConstants.TAG,
"Failed to get mScroller field for HorizontalScrollView! "
+ "This app will exhibit the bounce-back scrolling bug :(");
@ -108,7 +108,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
if (scrollerValue instanceof OverScroller) {
scroller = (OverScroller) scrollerValue;
} else {
Log.w(
FLog.w(
ReactConstants.TAG,
"Failed to cast mScroller field in HorizontalScrollView (probably due to OEM changes to AOSP)! "
+ "This app will exhibit the bounce-back scrolling bug :(");
@ -326,7 +326,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
// Log and ignore the error. This seems to be a bug in the android SDK and
// this is the commonly accepted workaround.
// https://tinyurl.com/mw6qkod (Stack Overflow)
Log.w(ReactConstants.TAG, "Error intercepting touch event.", e);
FLog.w(ReactConstants.TAG, "Error intercepting touch event.", e);
}
return false;

Просмотреть файл

@ -12,7 +12,6 @@ import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@ -21,6 +20,7 @@ import android.widget.OverScroller;
import android.widget.ScrollView;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.WritableMap;
@ -107,7 +107,7 @@ public class ReactScrollView extends ScrollView
sScrollerField = ScrollView.class.getDeclaredField("mScroller");
sScrollerField.setAccessible(true);
} catch (NoSuchFieldException e) {
Log.w(
FLog.w(
ReactConstants.TAG,
"Failed to get mScroller field for ScrollView! "
+ "This app will exhibit the bounce-back scrolling bug :(");
@ -120,7 +120,7 @@ public class ReactScrollView extends ScrollView
if (scrollerValue instanceof OverScroller) {
scroller = (OverScroller) scrollerValue;
} else {
Log.w(
FLog.w(
ReactConstants.TAG,
"Failed to cast mScroller field in ScrollView (probably due to OEM changes to AOSP)! "
+ "This app will exhibit the bounce-back scrolling bug :(");
@ -284,7 +284,7 @@ public class ReactScrollView extends ScrollView
// Log and ignore the error. This seems to be a bug in the android SDK and
// this is the commonly accepted workaround.
// https://tinyurl.com/mw6qkod (Stack Overflow)
Log.w(ReactConstants.TAG, "Error intercepting touch event.", e);
FLog.w(ReactConstants.TAG, "Error intercepting touch event.", e);
}
return false;