From 8ed82ec198cde2cbfd026881d8c5bbab9d10018c Mon Sep 17 00:00:00 2001 From: mukesh agrawal Date: Thu, 23 Feb 2017 17:13:29 -0800 Subject: [PATCH] StateMachine: add getLogRecMaxSize() Add the getLogRecMaxSize() method, so that WifiStateMachine tests can verify the log record buffer size, without having to fill the buffer. Bug: 35399013 Test: compile Change-Id: Ib1bd8d670b7b39e9f740a4dd92ea67463b179ce2 --- .../com/android/internal/util/StateMachine.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/java/com/android/internal/util/StateMachine.java b/core/java/com/android/internal/util/StateMachine.java index be10608df2a3f..d67cef3f0ddaf 100644 --- a/core/java/com/android/internal/util/StateMachine.java +++ b/core/java/com/android/internal/util/StateMachine.java @@ -23,6 +23,8 @@ import android.os.Message; import android.text.TextUtils; import android.util.Log; +import com.android.internal.annotations.VisibleForTesting; + import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.StringWriter; @@ -1495,7 +1497,7 @@ public class StateMachine { } /** - * @return number of log records + * @return the number of log records currently readable */ public final int getLogRecSize() { // mSmHandler can be null if the state machine has quit. @@ -1504,6 +1506,17 @@ public class StateMachine { return smh.mLogRecords.size(); } + /** + * @return the number of log records we can store + */ + @VisibleForTesting + public final int getLogRecMaxSize() { + // mSmHandler can be null if the state machine has quit. + SmHandler smh = mSmHandler; + if (smh == null) return 0; + return smh.mLogRecords.mMaxSize; + } + /** * @return the total number of records processed */