From 650e7cc429c89e2471fc44abe8b0cc8a0e50158f Mon Sep 17 00:00:00 2001 From: weijiaxu Date: Tue, 31 Oct 2017 12:38:54 -0700 Subject: Add more log entries in loggingBinding. Test: Run in dialer lab PiperOrigin-RevId: 174075702 Change-Id: Ib663dc34d2c0c9e737c6d5f13b16d2b42b714127 --- java/com/android/dialer/app/DialtactsActivity.java | 12 ++++++++++++ java/com/android/dialer/logging/LoggingBindings.java | 5 +++++ java/com/android/dialer/logging/LoggingBindingsStub.java | 3 +++ java/com/android/incallui/InCallActivity.java | 11 +++++++++++ 4 files changed, 31 insertions(+) (limited to 'java') diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java index 1dd852487..5af9b95ac 100644 --- a/java/com/android/dialer/app/DialtactsActivity.java +++ b/java/com/android/dialer/app/DialtactsActivity.java @@ -111,6 +111,8 @@ import com.android.dialer.interactions.PhoneNumberInteraction; import com.android.dialer.interactions.PhoneNumberInteraction.InteractionErrorCode; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.logging.LoggingBindings; +import com.android.dialer.logging.LoggingBindingsFactory; import com.android.dialer.logging.ScreenEvent; import com.android.dialer.logging.UiAction; import com.android.dialer.main.Main; @@ -589,6 +591,16 @@ public class DialtactsActivity extends TransactionSafeActivity LogUtil.i("DialtactsActivity.onResume", "clearing all new voicemails"); CallLogNotificationsService.markAllNewVoicemailsAsOld(this); } + // add 1 sec delay to get memory snapshot so that dialer wont react slowly on resume. + ThreadUtil.postDelayedOnUiThread( + () -> { + if (getApplicationContext() instanceof LoggingBindingsFactory) { + ((LoggingBindingsFactory) getApplicationContext()) + .newLoggingBindings() + .logRecordMemory(LoggingBindings.ACTIVITY_ON_RESUME_MEMORY_EVENT_NAME); + } + }, + 1000); } mFirstLaunch = false; diff --git a/java/com/android/dialer/logging/LoggingBindings.java b/java/com/android/dialer/logging/LoggingBindings.java index e4de420a3..b70c600b5 100644 --- a/java/com/android/dialer/logging/LoggingBindings.java +++ b/java/com/android/dialer/logging/LoggingBindings.java @@ -26,6 +26,8 @@ public interface LoggingBindings { "CallList.onCallAdded_To_InCallActivity.onCreate_Incoming"; String ON_CALL_ADDED_TO_ON_INCALL_UI_SHOWN_OUTGOING = "CallList.onCallAdded_To_InCallActivity.onCreate_Outgoing"; + String ACTIVITY_ON_RESUME_MEMORY_EVENT_NAME = "GoogleDialtactsActivity.onResume"; + String INCALL_ACTIVITY_ON_RESUME_MEMORY_EVENT_NAME = "IncallActivity.OnResume"; /** * Logs an DialerImpression event that's not associated with a specific call. * @@ -99,4 +101,7 @@ public interface LoggingBindings { /** Log end a latency timer */ void logStopLatencyTimer(String timerEventName); + + /** Log get a memory snapshot */ + void logRecordMemory(String memoryEventName); } diff --git a/java/com/android/dialer/logging/LoggingBindingsStub.java b/java/com/android/dialer/logging/LoggingBindingsStub.java index ab6872cf4..74ac294fc 100644 --- a/java/com/android/dialer/logging/LoggingBindingsStub.java +++ b/java/com/android/dialer/logging/LoggingBindingsStub.java @@ -67,4 +67,7 @@ public class LoggingBindingsStub implements LoggingBindings { @Override public void logStopLatencyTimer(String timerEventName) {} + + @Override + public void logRecordMemory(String memoryEventName) {} } diff --git a/java/com/android/incallui/InCallActivity.java b/java/com/android/incallui/InCallActivity.java index c509e4890..34ffdf5b7 100644 --- a/java/com/android/incallui/InCallActivity.java +++ b/java/com/android/incallui/InCallActivity.java @@ -36,6 +36,7 @@ import android.view.MotionEvent; import android.view.View; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; +import com.android.dialer.common.concurrent.ThreadUtil; import com.android.dialer.compat.ActivityCompat; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.logging.DialerImpression; @@ -196,6 +197,16 @@ public class InCallActivity extends TransactionSafeFragmentActivity pseudoScreenState.addListener(this); onPseudoScreenStateChanged(pseudoScreenState.isOn()); Trace.endSection(); + // add 1 sec delay to get memory snapshot so that dialer wont react slowly on resume. + ThreadUtil.postDelayedOnUiThread( + () -> { + if (getApplicationContext() instanceof LoggingBindingsFactory) { + ((LoggingBindingsFactory) getApplicationContext()) + .newLoggingBindings() + .logRecordMemory(LoggingBindings.INCALL_ACTIVITY_ON_RESUME_MEMORY_EVENT_NAME); + } + }, + 1000); } /** onPause is guaranteed to be called when the InCallActivity goes in the background. */ -- cgit v1.2.3