Add necessary log for default logging level, move per service log to
locallog

Bug: 235783845
Test: atest com.android.server.wifi.aware
Change-Id: Id978d24024bddc223781e4a5fea82a120826b978
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 4b60c01..6ed5a8d 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -181,6 +181,7 @@
     private final WifiConfigManager mWifiConfigManager;
     private final WifiConnectivityHelper mWifiConnectivityHelper;
     private final LocalLog mConnectivityLocalLog;
+    private final LocalLog mWifiAwareLocalLog;
     private final ThroughputScorer mThroughputScorer;
     private final WifiNetworkSelector mWifiNetworkSelector;
     private final SavedNetworkNominator mSavedNetworkNominator;
@@ -362,6 +363,9 @@
         mConnectivityLocalLog = new LocalLog(
                 mContext.getSystemService(ActivityManager.class).isLowRamDevice() ? maxLinesLowRam
                         : maxLinesHighRam);
+        mWifiAwareLocalLog = new LocalLog(
+                mContext.getSystemService(ActivityManager.class).isLowRamDevice() ? maxLinesLowRam
+                        : maxLinesHighRam);
         mWifiDiagnostics = new WifiDiagnostics(
                 mContext, this, mWifiNative, mBuildProperties,
                 new LastMileLogger(this), mClock, mWifiDiagnosticsHandlerThread.getLooper());
@@ -1146,4 +1150,9 @@
     public BufferedReader createBufferedReader(String filename) throws FileNotFoundException {
         return new BufferedReader(new FileReader(filename));
     }
+
+    @NonNull
+    public LocalLog getWifiAwareLocalLog() {
+        return mWifiAwareLocalLog;
+    }
 }
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareClientState.java b/service/java/com/android/server/wifi/aware/WifiAwareClientState.java
index 9ba17de..d790390 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareClientState.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareClientState.java
@@ -28,6 +28,7 @@
 import android.net.wifi.util.HexEncoding;
 import android.os.Bundle;
 import android.os.RemoteException;
+import android.util.LocalLog;
 import android.util.Log;
 import android.util.SparseArray;
 
@@ -57,6 +58,7 @@
     private final Context mContext;
     private final IWifiAwareEventCallback mCallback;
     private final SparseArray<WifiAwareDiscoverySessionState> mSessions = new SparseArray<>();
+    private final LocalLog mLocalLog;
 
     private final int mClientId;
     private ConfigRequest mConfigRequest;
@@ -78,7 +80,7 @@
             String callingPackage, @Nullable String callingFeatureId,
             IWifiAwareEventCallback callback, ConfigRequest configRequest,
             boolean notifyIdentityChange, long creationTime,
-            WifiPermissionsUtil wifiPermissionsUtil, Bundle extra) {
+            WifiPermissionsUtil wifiPermissionsUtil, Bundle extra, LocalLog localLog) {
         mContext = context;
         mClientId = clientId;
         mUid = uid;
@@ -93,6 +95,7 @@
         mCreationTime = creationTime;
         mWifiPermissionsUtil = wifiPermissionsUtil;
         mExtra = extra;
+        mLocalLog = localLog;
     }
 
     /**
@@ -107,11 +110,13 @@
      * the client. Destroys all discovery sessions belonging to this client.
      */
     public void destroy() {
+        mLocalLog.log("onAwareSessionTerminated, ClientId:" + mClientId);
         for (int i = 0; i < mSessions.size(); ++i) {
             mSessions.valueAt(i).terminate();
         }
         mSessions.clear();
         mConfigRequest = null;
+
         try {
             mCallback.onAttachTerminate();
         } catch (RemoteException e1) {
@@ -238,13 +243,11 @@
      *            client.
      */
     public void onInterfaceAddressChange(byte[] mac) {
-        if (mDbg) {
-            Log.v(TAG,
-                    "onInterfaceAddressChange: mClientId=" + mClientId + ", mNotifyIdentityChange="
-                            + mNotifyIdentityChange + ", mac=" + String.valueOf(
-                            HexEncoding.encode(mac)) + ", mLastDiscoveryInterfaceMac="
-                            + String.valueOf(HexEncoding.encode(mLastDiscoveryInterfaceMac)));
-        }
+        mLocalLog.log("onInterfaceAddressChange: mClientId=" + mClientId
+                + ", mNotifyIdentityChange=" + mNotifyIdentityChange
+                + ", mac=" + String.valueOf(HexEncoding.encode(mac))
+                + ", mLastDiscoveryInterfaceMac="
+                + String.valueOf(HexEncoding.encode(mLastDiscoveryInterfaceMac)));
         if (mNotifyIdentityChange && !Arrays.equals(mac, mLastDiscoveryInterfaceMac)) {
             try {
                 boolean hasPermission = mWifiPermissionsUtil.checkCallersLocationPermission(
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
index 3677420..9c9e61f 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareDataPathStateManager.java
@@ -48,6 +48,7 @@
 import android.os.Looper;
 import android.text.TextUtils;
 import android.util.ArrayMap;
+import android.util.LocalLog;
 import android.util.Log;
 import android.util.Pair;
 import android.util.SparseArray;
@@ -121,13 +122,16 @@
     private Handler mHandler;
     private WifiAwareNetworkFactory mNetworkFactory;
     public NetdWrapper mNetdWrapper;
+    private final LocalLog mLocalLog;
 
     // internal debug flag to override API check
     /* package */ boolean mAllowNdpResponderFromAnyOverride = false;
 
-    public WifiAwareDataPathStateManager(WifiAwareStateManager mgr, Clock clock) {
+    public WifiAwareDataPathStateManager(WifiAwareStateManager mgr, Clock clock,
+            LocalLog localLog) {
         mMgr = mgr;
         mClock = clock;
+        mLocalLog = localLog;
     }
 
     private static NetworkCapabilities makeNetworkCapabilitiesFilter() {
@@ -228,7 +232,7 @@
      * capabilities of the firmware.
      */
     public void createAllInterfaces() {
-        if (mVerboseLoggingEnabled) Log.v(TAG, "createAllInterfaces");
+        Log.d(TAG, "createAllInterfaces");
 
         if (mMgr.getCapabilities() == null) {
             Log.e(TAG, "createAllInterfaces: capabilities aren't initialized yet!");
@@ -254,7 +258,7 @@
      * Delete all Aware data-path interfaces which are currently up.
      */
     public void deleteAllInterfaces() {
-        if (mVerboseLoggingEnabled) Log.v(TAG, "deleteAllInterfaces");
+        Log.d(TAG, "deleteAllInterfaces");
         onAwareDownCleanupDataPaths();
 
         if (mMgr.getCapabilities() == null) {
@@ -287,9 +291,7 @@
      * Called when firmware indicates the an interface was deleted.
      */
     public void onInterfaceDeleted(String interfaceName) {
-        if (mVerboseLoggingEnabled) {
-            Log.v(TAG, "onInterfaceDeleted: interfaceName=" + interfaceName);
-        }
+        Log.d(TAG, "onInterfaceDeleted: interfaceName=" + interfaceName);
 
         if (!mInterfaces.contains(interfaceName)) {
             Log.w(TAG, "onInterfaceDeleted: interface not on list -- " + interfaceName);
@@ -387,11 +389,8 @@
      */
     public boolean onDataPathRequest(int pubSubId, byte[] mac, int ndpId,
             byte[] message) {
-        if (mVerboseLoggingEnabled) {
-            Log.v(TAG,
-                    "onDataPathRequest: pubSubId=" + pubSubId + ", mac=" + String.valueOf(
-                            HexEncoding.encode(mac)) + ", ndpId=" + ndpId);
-        }
+        mLocalLog.log("onDataPathRequest: pubSubId=" + pubSubId + ", mac=" + String.valueOf(
+                HexEncoding.encode(mac)) + ", ndpId=" + ndpId);
 
         // it is also possible that this is an initiator-side data-path request indication (which
         // happens when the Responder responds). In such a case it will be matched by the NDP ID.
@@ -510,9 +509,7 @@
      * @param success Whether or not the 'RespondToDataPathRequest' operation was a success.
      */
     public void onRespondToDataPathRequest(int ndpId, boolean success, int reasonOnFailure) {
-        if (mVerboseLoggingEnabled) {
-            Log.v(TAG, "onRespondToDataPathRequest: ndpId=" + ndpId + ", success=" + success);
-        }
+        mLocalLog.log("onRespondToDataPathRequest: ndpId=" + ndpId + ", success=" + success);
         Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> nnriE =
                 getNetworkRequestByNdpId(ndpId);
 
@@ -579,12 +576,11 @@
      */
     public boolean onDataPathConfirm(int ndpId, byte[] mac, boolean accept,
             int reason, byte[] message, List<WifiAwareChannelInfo> channelInfo) {
-        if (mVerboseLoggingEnabled) {
-            Log.v(TAG, "onDataPathConfirm: ndpId=" + ndpId + ", mac=" + String.valueOf(
-                    HexEncoding.encode(mac)) + ", accept=" + accept + ", reason=" + reason
-                    + ", message.length=" + ((message == null) ? 0 : message.length)
-                    + ", channelInfo=" + channelInfo);
-        }
+        mLocalLog.log("onDataPathConfirm: ndpId=" + ndpId
+                + ", mac=" + String.valueOf(HexEncoding.encode(mac))
+                + ", accept=" + accept + ", reason=" + reason
+                + ", message.length=" + ((message == null) ? 0 : message.length)
+                + ", channelInfo=" + channelInfo);
 
         Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> nnriE =
                 getNetworkRequestByNdpId(ndpId);
@@ -734,9 +730,7 @@
                     ndpInfo.peerPort, ndpInfo.peerTransportProtocol,
                     ndpInfo.channelInfos);
             ncBuilder.setTransportInfo(ni);
-            if (VDBG) {
-                Log.v(TAG, "onDataPathConfirm: AwareNetworkInfo=" + ni);
-            }
+            mLocalLog.log("onDataPathConfirm: AwareNetworkInfo=" + ni);
             final NetworkAgentConfig naConfig = new NetworkAgentConfig.Builder()
                     .setLegacyType(ConnectivityManager.TYPE_NONE)
                     .setLegacyTypeName(NETWORK_TAG)
@@ -775,7 +769,7 @@
      * @param ndpId The ID of the terminated data-path.
      */
     public void onDataPathEnd(int ndpId) {
-        if (mVerboseLoggingEnabled) Log.v(TAG, "onDataPathEnd: ndpId=" + ndpId);
+        mLocalLog.log("onDataPathEnd: ndpId=" + ndpId);
 
         Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> nnriE =
                 getNetworkRequestByNdpId(ndpId);
@@ -837,7 +831,7 @@
      * Called whenever Aware comes down. Clean up all pending and up network requests and agents.
      */
     public void onAwareDownCleanupDataPaths() {
-        if (mVerboseLoggingEnabled) Log.v(TAG, "onAwareDownCleanupDataPaths");
+        Log.d(TAG, "onAwareDownCleanupDataPaths");
 
         Iterator<Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation>> it =
                 mNetworkRequestsCache.entrySet().iterator();
@@ -901,9 +895,7 @@
 
         @Override
         public boolean acceptRequest(NetworkRequest request) {
-            if (VDBG) {
-                Log.v(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request);
-            }
+            mLocalLog.log("WifiAwareNetworkFactory.acceptRequest: request=" + request);
 
             NetworkSpecifier networkSpecifierBase = request.getNetworkSpecifier();
             if (!(networkSpecifierBase instanceof WifiAwareNetworkSpecifier)) {
@@ -963,11 +955,9 @@
             Map.Entry<WifiAwareNetworkSpecifier, AwareNetworkRequestInformation> primaryRequest =
                     getNetworkRequestByCanonicalDescriptor(nnri.getCanonicalDescriptor());
             if (primaryRequest != null) {
-                if (VDBG) {
-                    Log.v(TAG, "WifiAwareNetworkFactory.acceptRequest: request=" + request
-                            + ", already has a primary request=" + primaryRequest.getKey()
-                            + " with state=" + primaryRequest.getValue().state);
-                }
+                mLocalLog.log("WifiAwareNetworkFactory.acceptRequest: request=" + request
+                        + ", already has a primary request=" + primaryRequest.getKey()
+                        + " with state=" + primaryRequest.getValue().state);
 
                 if (primaryRequest.getValue().state
                         == AwareNetworkRequestInformation.STATE_TERMINATING) {
@@ -986,10 +976,7 @@
 
         @Override
         protected void needNetworkFor(NetworkRequest networkRequest) {
-            if (mVerboseLoggingEnabled) {
-                Log.v(TAG, "WifiAwareNetworkFactory.needNetworkFor: networkRequest="
-                        + networkRequest);
-            }
+            mLocalLog.log("WifiAwareNetworkFactory.needNetworkFor: networkRequest=");
 
             NetworkSpecifier networkSpecifierObj = networkRequest.getNetworkSpecifier();
             WifiAwareNetworkSpecifier networkSpecifier = null;
@@ -1046,10 +1033,8 @@
 
         @Override
         protected void releaseNetworkFor(NetworkRequest networkRequest) {
-            if (mVerboseLoggingEnabled) {
-                Log.v(TAG, "WifiAwareNetworkFactory.releaseNetworkFor: networkRequest="
-                        + networkRequest);
-            }
+            mLocalLog.log("WifiAwareNetworkFactory.releaseNetworkFor: networkRequest="
+                    + networkRequest);
 
             NetworkSpecifier networkSpecifierObj = networkRequest.getNetworkSpecifier();
             WifiAwareNetworkSpecifier networkSpecifier = null;
@@ -1152,15 +1137,13 @@
     }
 
     private void tearDownInterfaceIfPossible(AwareNetworkRequestInformation nnri) {
-        if (VDBG) Log.v(TAG, "tearDownInterfaceIfPossible: nnri=" + nnri);
+        mLocalLog.log("tearDownInterfaceIfPossible: nnri=" + nnri);
 
         if (!TextUtils.isEmpty(nnri.interfaceName)) {
             boolean interfaceUsedByAnotherNdp = isInterfaceUpAndUsedByAnotherNdp(nnri);
             if (interfaceUsedByAnotherNdp) {
-                if (mVerboseLoggingEnabled) {
-                    Log.v(TAG, "tearDownInterfaceIfPossible: interfaceName=" + nnri.interfaceName
-                            + ", still in use - not turning down");
-                }
+                mLocalLog.log("tearDownInterfaceIfPossible: interfaceName=" + nnri.interfaceName
+                        + ", still in use - not turning down");
             } else {
                 try {
                     mNetdWrapper.setInterfaceDown(nnri.interfaceName);
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
index 876f5c5..557ef01 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareDiscoverySessionState.java
@@ -28,6 +28,7 @@
 import android.net.wifi.util.HexEncoding;
 import android.os.RemoteException;
 import android.os.SystemClock;
+import android.util.LocalLog;
 import android.util.Log;
 import android.util.SparseArray;
 
@@ -57,6 +58,7 @@
     private long mUpdateTime;
     private boolean mInstantModeEnabled;
     private int mInstantModeBand;
+    private final LocalLog mLocalLog;
 
     static class PeerInfo {
         PeerInfo(int instanceId, byte[] mac) {
@@ -80,7 +82,7 @@
     public WifiAwareDiscoverySessionState(WifiAwareNativeApi wifiAwareNativeApi, int sessionId,
             byte pubSubId, IWifiAwareDiscoverySessionCallback callback, boolean isPublishSession,
             boolean isRangingEnabled, long creationTime, boolean instantModeEnabled,
-            int instantModeBand) {
+            int instantModeBand, LocalLog localLog) {
         mWifiAwareNativeApi = wifiAwareNativeApi;
         mSessionId = sessionId;
         mPubSubId = pubSubId;
@@ -91,6 +93,7 @@
         mUpdateTime = creationTime;
         mInstantModeEnabled = instantModeEnabled;
         mInstantModeBand = instantModeBand;
+        mLocalLog = localLog;
     }
 
     /**
@@ -384,9 +387,7 @@
         PeerInfo newPeerInfo = new PeerInfo(requestorInstanceId, peerMac);
         mPeerInfoByRequestorInstanceId.put(newPeerId, newPeerInfo);
 
-        if (mDbg) {
-            Log.v(TAG, "New peer info: peerId=" + newPeerId + ", peerInfo=" + newPeerInfo);
-        }
+        mLocalLog.log("New peer info: peerId=" + newPeerId + ", peerInfo=" + newPeerInfo);
 
         return newPeerId;
     }
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java b/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
index 6d1ff0f..1ea5969 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareNativeApi.java
@@ -434,15 +434,13 @@
             boolean notifyIdentityChange, boolean initialConfiguration, boolean isInteractive,
             boolean isIdle, boolean rangingEnabled, boolean isInstantCommunicationEnabled,
             int instantModeChannel) {
-        if (mVerboseLoggingEnabled) {
-            Log.v(TAG, "enableAndConfigure: transactionId=" + transactionId + ", configRequest="
-                    + configRequest + ", notifyIdentityChange=" + notifyIdentityChange
-                    + ", initialConfiguration=" + initialConfiguration
-                    + ", isInteractive=" + isInteractive + ", isIdle=" + isIdle
-                    + ", isRangingEnabled=" + rangingEnabled
-                    + ", isInstantCommunicationEnabled=" + isInstantCommunicationEnabled
-                    + ", instantModeChannel=" + instantModeChannel);
-        }
+        Log.d(TAG, "enableAndConfigure: transactionId=" + transactionId + ", configRequest="
+                + configRequest + ", notifyIdentityChange=" + notifyIdentityChange
+                + ", initialConfiguration=" + initialConfiguration
+                + ", isInteractive=" + isInteractive + ", isIdle=" + isIdle
+                + ", isRangingEnabled=" + rangingEnabled
+                + ", isInstantCommunicationEnabled=" + isInstantCommunicationEnabled
+                + ", instantModeChannel=" + instantModeChannel);
         recordTransactionId(transactionId);
 
         IWifiNanIface iface = mHal.getWifiNanIface();
@@ -1108,10 +1106,8 @@
      * @param interfaceName The name of the interface, e.g. "aware0".
      */
     public boolean createAwareNetworkInterface(short transactionId, String interfaceName) {
-        if (mVerboseLoggingEnabled) {
-            Log.v(TAG, "createAwareNetworkInterface: transactionId=" + transactionId + ", "
+        Log.d(TAG, "createAwareNetworkInterface: transactionId=" + transactionId + ", "
                     + "interfaceName=" + interfaceName);
-        }
         recordTransactionId(transactionId);
 
         IWifiNanIface iface = mHal.getWifiNanIface();
@@ -1142,10 +1138,8 @@
      * @param interfaceName The name of the interface, e.g. "aware0".
      */
     public boolean deleteAwareNetworkInterface(short transactionId, String interfaceName) {
-        if (mVerboseLoggingEnabled) {
-            Log.v(TAG, "deleteAwareNetworkInterface: transactionId=" + transactionId + ", "
-                    + "interfaceName=" + interfaceName);
-        }
+        Log.d(TAG, "deleteAwareNetworkInterface: transactionId=" + transactionId + ", "
+                + "interfaceName=" + interfaceName);
         recordTransactionId(transactionId);
 
         IWifiNanIface iface = mHal.getWifiNanIface();
diff --git a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
index 51f28c9..9c84486 100644
--- a/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
+++ b/service/java/com/android/server/wifi/aware/WifiAwareStateManager.java
@@ -58,6 +58,7 @@
 import android.os.UserHandle;
 import android.os.WorkSource;
 import android.text.TextUtils;
+import android.util.LocalLog;
 import android.util.Log;
 import android.util.Pair;
 import android.util.SparseArray;
@@ -253,6 +254,7 @@
     private WifiManager mWifiManager;
     private Handler mHandler;
     private final WifiInjector mWifiInjector;
+    private final LocalLog mLocalLog;
 
     private final SparseArray<WifiAwareClientState> mClients = new SparseArray<>();
     private ConfigRequest mCurrentAwareConfiguration = null;
@@ -273,6 +275,7 @@
 
     public WifiAwareStateManager(WifiInjector wifiInjector) {
         mWifiInjector = wifiInjector;
+        mLocalLog = wifiInjector.getWifiAwareLocalLog();
         onReset();
     }
 
@@ -488,7 +491,7 @@
         mSm.start();
         mHandler = new Handler(looper);
 
-        mDataPathMgr = new WifiAwareDataPathStateManager(this, clock);
+        mDataPathMgr = new WifiAwareDataPathStateManager(this, clock, mLocalLog);
         mDataPathMgr.start(mContext, mSm.getHandler().getLooper(), awareMetrics,
                 wifiPermissionsUtil, permissionsWrapper, netdWrapper);
 
@@ -2402,13 +2405,12 @@
         }
 
         private void processSendMessageTimeout() {
-            if (mVerboseLoggingEnabled) {
-                Log.v(TAG, "processSendMessageTimeout: mHostQueuedSendMessages.size()="
-                        + mHostQueuedSendMessages.size() + ", mFwQueuedSendMessages.size()="
-                        + mFwQueuedSendMessages.size() + ", mSendQueueBlocked="
-                        + mSendQueueBlocked);
+            mLocalLog.log("processSendMessageTimeout: mHostQueuedSendMessages.size()="
+                    + mHostQueuedSendMessages.size() + ", mFwQueuedSendMessages.size()="
+                    + mFwQueuedSendMessages.size() + ", mSendQueueBlocked="
+                    + mSendQueueBlocked);
 
-            }
+
             /*
              * Note: using 'first' to always time-out (remove) at least 1 notification (partially)
              * due to test code needs: there's no way to mock elapsedRealtime(). TODO: replace with
@@ -2517,12 +2519,10 @@
             String callingPackage, @Nullable String callingFeatureId,
             IWifiAwareEventCallback callback, ConfigRequest configRequest,
             boolean notifyIdentityChange, Bundle extra) {
-        if (VDBG) {
-            Log.v(TAG, "connectLocal(): transactionId=" + transactionId + ", clientId=" + clientId
-                    + ", uid=" + uid + ", pid=" + pid + ", callingPackage=" + callingPackage
-                    + ", callback=" + callback + ", configRequest=" + configRequest
-                    + ", notifyIdentityChange=" + notifyIdentityChange);
-        }
+        mLocalLog.log("connectLocal(): transactionId=" + transactionId + ", clientId=" + clientId
+                + ", uid=" + uid + ", pid=" + pid + ", callingPackage=" + callingPackage
+                + ", callback=" + callback + ", configRequest=" + configRequest
+                + ", notifyIdentityChange=" + notifyIdentityChange);
 
         if (!mUsageEnabled) {
             Log.w(TAG, "connect(): called with mUsageEnabled=false");
@@ -2562,13 +2562,14 @@
         if (mCurrentAwareConfiguration != null && mCurrentAwareConfiguration.equals(merged)
                 && (mCurrentIdentityNotification || !notifyIdentityChange)) {
             try {
+                mLocalLog.log("Connect success for clientId:" + clientId);
                 callback.onConnectSuccess(clientId);
             } catch (RemoteException e) {
                 Log.w(TAG, "connectLocal onConnectSuccess(): RemoteException (FYI): " + e);
             }
             WifiAwareClientState client = new WifiAwareClientState(mContext, clientId, uid, pid,
                     callingPackage, callingFeatureId, callback, configRequest, notifyIdentityChange,
-                    SystemClock.elapsedRealtime(), mWifiPermissionsUtil, extra);
+                    SystemClock.elapsedRealtime(), mWifiPermissionsUtil, extra, mLocalLog);
             client.enableVerboseLogging(mVerboseLoggingEnabled);
             client.onInterfaceAddressChange(mCurrentDiscoveryInterfaceMac);
             mClients.append(clientId, client);
@@ -2610,10 +2611,8 @@
     }
 
     private boolean disconnectLocal(short transactionId, int clientId) {
-        if (VDBG) {
-            Log.v(TAG,
-                    "disconnectLocal(): transactionId=" + transactionId + ", clientId=" + clientId);
-        }
+        mLocalLog.log("disconnectLocal(): transactionId=" + transactionId
+                + ", clientId=" + clientId);
 
         WifiAwareClientState client = mClients.get(clientId);
         if (client == null) {
@@ -2694,10 +2693,7 @@
     }
 
     private void terminateSessionLocal(int clientId, int sessionId) {
-        if (VDBG) {
-            Log.v(TAG,
-                    "terminateSessionLocal(): clientId=" + clientId + ", sessionId=" + sessionId);
-        }
+        mLocalLog.log("terminateSessionLocal(): clientId=" + clientId + ", sessionId=" + sessionId);
 
         WifiAwareClientState client = mClients.get(clientId);
         if (client == null) {
@@ -2720,10 +2716,8 @@
 
     private boolean publishLocal(short transactionId, int clientId, PublishConfig publishConfig,
             IWifiAwareDiscoverySessionCallback callback) {
-        if (VDBG) {
-            Log.v(TAG, "publishLocal(): transactionId=" + transactionId + ", clientId=" + clientId
-                    + ", publishConfig=" + publishConfig + ", callback=" + callback);
-        }
+        mLocalLog.log("publishLocal(): transactionId=" + transactionId + ", clientId=" + clientId
+                + ", publishConfig=" + publishConfig + ", callback=" + callback);
 
         WifiAwareClientState client = mClients.get(clientId);
         if (client == null) {
@@ -2780,10 +2774,8 @@
 
     private boolean subscribeLocal(short transactionId, int clientId,
             SubscribeConfig subscribeConfig, IWifiAwareDiscoverySessionCallback callback) {
-        if (VDBG) {
-            Log.v(TAG, "subscribeLocal(): transactionId=" + transactionId + ", clientId=" + clientId
+        mLocalLog.log("subscribeLocal(): transactionId=" + transactionId + ", clientId=" + clientId
                     + ", subscribeConfig=" + subscribeConfig + ", callback=" + callback);
-        }
 
         WifiAwareClientState client = mClients.get(clientId);
         if (client == null) {
@@ -2842,12 +2834,9 @@
 
     private boolean sendFollowonMessageLocal(short transactionId, int clientId, int sessionId,
             int peerId, byte[] message, int messageId) {
-        if (VDBG) {
-            Log.v(TAG,
-                    "sendFollowonMessageLocal(): transactionId=" + transactionId + ", clientId="
-                            + clientId + ", sessionId=" + sessionId + ", peerId=" + peerId
-                            + ", messageId=" + messageId);
-        }
+        mLocalLog.log("sendFollowonMessageLocal(): transactionId=" + transactionId + ", clientId="
+                + clientId + ", sessionId=" + sessionId + ", peerId=" + peerId
+                + ", messageId=" + messageId);
 
         WifiAwareClientState client = mClients.get(clientId);
         if (client == null) {
@@ -2866,7 +2855,7 @@
     }
 
     private void enableUsageLocal() {
-        if (mVerboseLoggingEnabled) Log.v(TAG, "enableUsageLocal: mUsageEnabled=" + mUsageEnabled);
+        Log.d(TAG, "enableUsageLocal: mUsageEnabled=" + mUsageEnabled);
 
         if (mUsageEnabled) {
             return;
@@ -2878,10 +2867,8 @@
     }
 
     private void disableUsageLocal(short transactionId, boolean markAsAvailable) {
-        if (VDBG) {
-            Log.v(TAG, "disableUsageLocal: transactionId=" + transactionId + ", mUsageEnabled="
+        Log.d(TAG, "disableUsageLocal: transactionId=" + transactionId + ", mUsageEnabled="
                     + mUsageEnabled);
-        }
 
         if (!mUsageEnabled) {
             return;
@@ -2905,16 +2892,15 @@
             boolean isOutOfBand, byte[] appInfo) {
         WifiAwareDataPathSecurityConfig securityConfig = networkSpecifier
                 .getWifiAwareDataPathSecurityConfig();
-        if (VDBG) {
-            Log.v(TAG, "initiateDataPathSetupLocal(): transactionId=" + transactionId
-                    + ", networkSpecifier=" + networkSpecifier + ", peerId=" + peerId
-                    + ", channelRequestType=" + channelRequestType + ", channel=" + channel
-                    + ", peer="
-                    + String.valueOf(HexEncoding.encode(peer)) + ", interfaceName=" + interfaceName
-                    + ", securityConfig=" + ((securityConfig == null) ? "" : securityConfig)
-                    + ", isOutOfBand="
-                    + isOutOfBand + ", appInfo=" + (appInfo == null ? "<null>" : "<non-null>"));
-        }
+        mLocalLog.log("initiateDataPathSetupLocal(): transactionId=" + transactionId
+                + ", networkSpecifier=" + networkSpecifier + ", peerId=" + peerId
+                + ", channelRequestType=" + channelRequestType + ", channel=" + channel
+                + ", peer="
+                + String.valueOf(HexEncoding.encode(peer)) + ", interfaceName=" + interfaceName
+                + ", securityConfig=" + ((securityConfig == null) ? "" : securityConfig)
+                + ", isOutOfBand="
+                + isOutOfBand + ", appInfo=" + (appInfo == null ? "<null>" : "<non-null>"));
+
 
         boolean success = mWifiAwareNativeApi.initiateDataPath(transactionId, peerId,
                 channelRequestType, channel, peer, interfaceName, isOutOfBand,
@@ -2929,14 +2915,11 @@
     private boolean respondToDataPathRequestLocal(short transactionId, boolean accept,
             int ndpId, String interfaceName, byte[] appInfo, boolean isOutOfBand,
             WifiAwareDataPathSecurityConfig securityConfig) {
-        if (VDBG) {
-            Log.v(TAG,
-                    "respondToDataPathRequestLocal(): transactionId=" + transactionId + ", accept="
-                            + accept + ", ndpId=" + ndpId + ", interfaceName=" + interfaceName
-                            + ", securityConfig=" + securityConfig
-                            + ", isOutOfBand=" + isOutOfBand
-                            + ", appInfo=" + (appInfo == null ? "<null>" : "<non-null>"));
-        }
+        mLocalLog.log("respondToDataPathRequestLocal(): transactionId=" + transactionId
+                + ", accept=" + accept + ", ndpId=" + ndpId + ", interfaceName=" + interfaceName
+                + ", securityConfig=" + securityConfig
+                + ", isOutOfBand=" + isOutOfBand
+                + ", appInfo=" + (appInfo == null ? "<null>" : "<non-null>"));
         boolean success = mWifiAwareNativeApi.respondToDataPathRequest(transactionId, accept, ndpId,
                 interfaceName, appInfo, isOutOfBand, mCapabilities, securityConfig);
         if (!success) {
@@ -2948,10 +2931,8 @@
     }
 
     private boolean endDataPathLocal(short transactionId, int ndpId) {
-        if (VDBG) {
-            Log.v(TAG,
-                    "endDataPathLocal: transactionId=" + transactionId + ", ndpId=" + ndpId);
-        }
+
+        mLocalLog.log("endDataPathLocal: transactionId=" + transactionId + ", ndpId=" + ndpId);
         sendAwareResourcesChangedBroadcast();
         return mWifiAwareNativeApi.endDataPath(transactionId, ndpId);
     }
@@ -2961,9 +2942,7 @@
      */
 
     private void onConfigCompletedLocal(Message completedCommand) {
-        if (VDBG) {
-            Log.v(TAG, "onConfigCompleted: completedCommand=" + completedCommand);
-        }
+        Log.d(TAG, "onConfigCompleted: completedCommand=" + completedCommand);
 
         if (completedCommand.arg1 == COMMAND_TYPE_CONNECT) {
             if (mCurrentAwareConfiguration == null) { // enabled (as opposed to re-configured)
@@ -2987,11 +2966,12 @@
             WifiAwareClientState client = new WifiAwareClientState(mContext, clientId, uid, pid,
                     callingPackage, callingFeatureId, callback, configRequest, notifyIdentityChange,
                     SystemClock.elapsedRealtime(), mWifiPermissionsUtil,
-                    data.getBundle(MESSAGE_BUNDLE_KEY_ATTRIBUTION_SOURCE));
+                    data.getBundle(MESSAGE_BUNDLE_KEY_ATTRIBUTION_SOURCE), mLocalLog);
             client.enableVerboseLogging(mVerboseLoggingEnabled);
             mClients.put(clientId, client);
             mAwareMetrics.recordAttachSession(uid, notifyIdentityChange, mClients);
             try {
+                mLocalLog.log("Connect success for clientId:" + clientId);
                 callback.onConnectSuccess(clientId);
             } catch (RemoteException e) {
                 Log.w(TAG,
@@ -3061,9 +3041,7 @@
     }
 
     private void onDisableResponseLocal(Message command, int reason) {
-        if (VDBG) {
-            Log.v(TAG, "onDisableResponseLocal: command=" + command + ", reason=" + reason);
-        }
+        Log.d(TAG, "onDisableResponseLocal: command=" + command + ", reason=" + reason);
 
         /*
          * do nothing:
@@ -3126,6 +3104,8 @@
 
             int sessionId = mSm.mNextSessionId++;
             try {
+                mLocalLog.log((isPublish ? "publish" : "subscribe") + " session started, sessionId="
+                        + sessionId);
                 callback.onSessionStarted(sessionId);
             } catch (RemoteException e) {
                 Log.e(TAG, "onSessionConfigSuccessLocal: onSessionStarted() RemoteException=" + e);
@@ -3134,7 +3114,7 @@
 
             WifiAwareDiscoverySessionState session = new WifiAwareDiscoverySessionState(
                     mWifiAwareNativeApi, sessionId, pubSubId, callback, isPublish, isRangingEnabled,
-                    SystemClock.elapsedRealtime(), enableInstantMode, instantModeBand);
+                    SystemClock.elapsedRealtime(), enableInstantMode, instantModeBand, mLocalLog);
             session.enableVerboseLogging(mVerboseLoggingEnabled);
             client.addSession(session);
 
@@ -3257,9 +3237,7 @@
     }
 
     private void onMessageSendSuccessLocal(Message completedCommand) {
-        if (VDBG) {
-            Log.v(TAG, "onMessageSendSuccess: completedCommand=" + completedCommand);
-        }
+        mLocalLog.log("onMessageSendSuccess: completedCommand=" + completedCommand);
 
         int clientId = completedCommand.arg2;
         int sessionId = completedCommand.getData().getInt(MESSAGE_BUNDLE_KEY_SESSION_ID);
@@ -3366,10 +3344,8 @@
     }
 
     private boolean onInitiateDataPathResponseSuccessLocal(Message command, int ndpId) {
-        if (VDBG) {
-            Log.v(TAG, "onInitiateDataPathResponseSuccessLocal: command=" + command + ", ndpId="
-                    + ndpId);
-        }
+        mLocalLog.log("onInitiateDataPathResponseSuccessLocal: command=" + command + ", ndpId="
+                + ndpId);
 
         return mDataPathMgr
                 .onDataPathInitiateSuccess((WifiAwareNetworkSpecifier) command.obj, ndpId);
@@ -3408,9 +3384,7 @@
      */
 
     private void onInterfaceAddressChangeLocal(byte[] mac) {
-        if (VDBG) {
-            Log.v(TAG, "onInterfaceAddressChange: mac=" + String.valueOf(HexEncoding.encode(mac)));
-        }
+        Log.d(TAG, "onInterfaceAddressChange: mac=" + String.valueOf(HexEncoding.encode(mac)));
 
         mCurrentDiscoveryInterfaceMac = mac;
 
@@ -3439,14 +3413,12 @@
     private void onMatchLocal(int pubSubId, int requestorInstanceId, byte[] peerMac,
             byte[] serviceSpecificInfo, byte[] matchFilter, int rangingIndication, int rangeMm,
             int cipherSuite, byte[] scid) {
-        if (VDBG) {
-            Log.v(TAG,
-                    "onMatch: pubSubId=" + pubSubId + ", requestorInstanceId=" + requestorInstanceId
-                            + ", peerDiscoveryMac=" + String.valueOf(HexEncoding.encode(peerMac))
-                            + ", serviceSpecificInfo=" + Arrays.toString(serviceSpecificInfo)
-                            + ", matchFilter=" + Arrays.toString(matchFilter)
-                            + ", rangingIndication=" + rangingIndication + ", rangeMm=" + rangeMm);
-        }
+        mLocalLog.log("onMatch: pubSubId=" + pubSubId
+                + ", requestorInstanceId=" + requestorInstanceId
+                + ", peerDiscoveryMac=" + String.valueOf(HexEncoding.encode(peerMac))
+                + ", serviceSpecificInfo=" + Arrays.toString(serviceSpecificInfo)
+                + ", matchFilter=" + Arrays.toString(matchFilter)
+                + ", rangingIndication=" + rangingIndication + ", rangeMm=" + rangeMm);
 
         Pair<WifiAwareClientState, WifiAwareDiscoverySessionState> data =
                 getClientSessionForPubSubId(pubSubId);
@@ -3479,10 +3451,8 @@
     }
 
     private void onSessionTerminatedLocal(int pubSubId, boolean isPublish, int reason) {
-        if (VDBG) {
-            Log.v(TAG, "onSessionTerminatedLocal: pubSubId=" + pubSubId + ", isPublish=" + isPublish
-                    + ", reason=" + reason);
-        }
+        mLocalLog.log("onSessionTerminatedLocal: pubSubId=" + pubSubId + ", isPublish=" + isPublish
+                + ", reason=" + reason);
 
         Pair<WifiAwareClientState, WifiAwareDiscoverySessionState> data =
                 getClientSessionForPubSubId(pubSubId);
@@ -3510,12 +3480,9 @@
 
     private void onMessageReceivedLocal(int pubSubId, int requestorInstanceId, byte[] peerMac,
             byte[] message) {
-        if (VDBG) {
-            Log.v(TAG,
-                    "onMessageReceivedLocal: pubSubId=" + pubSubId + ", requestorInstanceId="
-                            + requestorInstanceId + ", peerDiscoveryMac="
-                            + String.valueOf(HexEncoding.encode(peerMac)));
-        }
+        mLocalLog.log("onMessageReceivedLocal: pubSubId=" + pubSubId + ", requestorInstanceId="
+                + requestorInstanceId + ", peerDiscoveryMac="
+                + String.valueOf(HexEncoding.encode(peerMac)));
 
         Pair<WifiAwareClientState, WifiAwareDiscoverySessionState> data =
                 getClientSessionForPubSubId(pubSubId);
@@ -3528,9 +3495,8 @@
     }
 
     private void onAwareDownLocal() {
-        if (VDBG) {
-            Log.v(TAG, "onAwareDown: mCurrentAwareConfiguration=" + mCurrentAwareConfiguration);
-        }
+        Log.d(TAG, "onAwareDown: mCurrentAwareConfiguration=" + mCurrentAwareConfiguration);
+
         if (mCurrentAwareConfiguration == null) {
             return;
         }
@@ -3764,6 +3730,9 @@
         pw.println("mAwareMetrics:");
         mAwareMetrics.dump(fd, pw, args);
         mInterfaceConflictMgr.dump(fd, pw, args);
+        pw.println("AwareStateManager - Log Begin ----");
+        mLocalLog.dump(fd, pw, args);
+        pw.println("AwareStateManager - Log End ----");
     }
 
     private void handleLocationModeDisabled() {
diff --git a/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java b/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
index 5dd56f0..87ab735 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java
@@ -83,6 +83,7 @@
 import android.os.Process;
 import android.os.UserHandle;
 import android.os.test.TestLooper;
+import android.util.LocalLog;
 
 import androidx.test.filters.SmallTest;
 
@@ -158,6 +159,7 @@
     public ErrorCollector collector = new ErrorCollector();
     private MockResources mResources;
     private Bundle mExtras = new Bundle();
+    private LocalLog mLocalLog = new LocalLog(512);
 
     /**
      * Initialize mocks.
@@ -191,6 +193,7 @@
         when(mWifiPermissionsUtil.isTargetSdkLessThan(anyString(), anyInt(), anyInt()))
             .thenReturn(true);
         when(mWifiPermissionsUtil.isLocationModeEnabled()).thenReturn(true);
+        when(mWifiInjector.getWifiAwareLocalLog()).thenReturn(mLocalLog);
 
         mDut = new WifiAwareStateManager(mWifiInjector);
         mDut.setNative(mMockNativeManager, mMockNative);
diff --git a/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java b/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java
index fe3e29a..38bacad 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java
@@ -29,6 +29,7 @@
 import android.content.Context;
 import android.hardware.wifi.V1_0.NanStatusType;
 import android.net.wifi.aware.WifiAwareNetworkSpecifier;
+import android.util.LocalLog;
 import android.util.Log;
 import android.util.SparseArray;
 import android.util.SparseIntArray;
@@ -65,6 +66,7 @@
     @Rule public ErrorCollector collector = new ErrorCollector();
 
     private WifiAwareMetrics mDut;
+    private LocalLog mLocalLog = new LocalLog(512);
 
     // Histogram definition: start[i] = b + p * m^i with s sub-buckets, i=0,...,n-1
 
@@ -243,25 +245,25 @@
         // uid1: session 1
         clients.put(10,
                 new WifiAwareClientState(mMockContext, 10, uid1, 0, null, null, null, null, false,
-                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null));
+                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null, mLocalLog));
         mDut.recordAttachSession(uid1, false, clients);
 
         // uid1: session 2
         clients.put(11,
                 new WifiAwareClientState(mMockContext, 11, uid1, 0, null, null, null, null, false,
-                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null));
+                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null, mLocalLog));
         mDut.recordAttachSession(uid1, false, clients);
 
         // uid2: session 1
         clients.put(12,
                 new WifiAwareClientState(mMockContext, 12, uid2, 0, null, null, null, null, false,
-                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null));
+                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null, mLocalLog));
         mDut.recordAttachSession(uid2, false, clients);
 
         // uid2: session 2
         clients.put(13,
                 new WifiAwareClientState(mMockContext, 13, uid2, 0, null, null, null, null, true,
-                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null));
+                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null, mLocalLog));
         mDut.recordAttachSession(uid2, true, clients);
 
         // uid2: delete session 1
@@ -277,7 +279,7 @@
         // uid2: session 3
         clients.put(14,
                 new WifiAwareClientState(mMockContext, 14, uid2, 0, null, null, null, null, false,
-                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null));
+                        mClock.getElapsedSinceBootMillis(), mWifiPermissionsUtil, null, mLocalLog));
         mDut.recordAttachSession(uid2, false, clients);
 
         // a few failures
@@ -320,60 +322,60 @@
 
         setTime(5);
         WifiAwareClientState client1 = new WifiAwareClientState(mMockContext, 10, uid1, 0, null,
-                null, null, null, false, 0, mWifiPermissionsUtil, null);
+                null, null, null, false, 0, mWifiPermissionsUtil, null, mLocalLog);
         WifiAwareClientState client2 = new WifiAwareClientState(mMockContext, 11, uid2, 0, null,
-                null, null, null, false, 0, mWifiPermissionsUtil, null);
+                null, null, null, false, 0, mWifiPermissionsUtil, null, mLocalLog);
         WifiAwareClientState client3 = new WifiAwareClientState(mMockContext, 12, uid3, 0, null,
-                null, null, null, false, 0, mWifiPermissionsUtil, null);
+                null, null, null, false, 0, mWifiPermissionsUtil, null, mLocalLog);
         clients.put(10, client1);
         clients.put(11, client2);
         clients.put(12, client3);
 
         // uid1: publish session 1
         client1.addSession(new WifiAwareDiscoverySessionState(null, 100, (byte) 0, null, true,
-                false, mClock.getElapsedSinceBootMillis(), false, 0));
+                false, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySession(uid1, clients);
         mDut.recordDiscoveryStatus(uid1, NanStatusType.SUCCESS, true);
 
         // uid1: publish session 2
         client1.addSession(new WifiAwareDiscoverySessionState(null, 101, (byte) 0, null, true,
-                false, mClock.getElapsedSinceBootMillis(), false, 0));
+                false, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySession(uid1, clients);
         mDut.recordDiscoveryStatus(uid1, NanStatusType.SUCCESS, true);
 
         // uid3: publish session 3 with ranging
         client3.addSession(new WifiAwareDiscoverySessionState(null, 111, (byte) 0, null, true,
-                true, mClock.getElapsedSinceBootMillis(), false, 0));
+                true, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySessionWithRanging(uid3, false, -1, -1, clients);
         mDut.recordDiscoveryStatus(uid3, NanStatusType.SUCCESS, true);
 
         // uid2: subscribe session 1
         client2.addSession(new WifiAwareDiscoverySessionState(null, 102, (byte) 0, null, false,
-                false, mClock.getElapsedSinceBootMillis(), false, 0));
+                false, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySession(uid2, clients);
         mDut.recordDiscoveryStatus(uid2, NanStatusType.SUCCESS, false);
 
         // uid2: publish session 2
         client2.addSession(new WifiAwareDiscoverySessionState(null, 103, (byte) 0, null, true,
-                false, mClock.getElapsedSinceBootMillis(), false, 0));
+                false, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySession(uid2, clients);
         mDut.recordDiscoveryStatus(uid2, NanStatusType.SUCCESS, false);
 
         // uid3: subscribe session 3 with ranging: min
         client3.addSession(new WifiAwareDiscoverySessionState(null, 112, (byte) 0, null, false,
-                true, mClock.getElapsedSinceBootMillis(), false, 0));
+                true, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySessionWithRanging(uid3, true, 10, -1, clients);
         mDut.recordDiscoveryStatus(uid3, NanStatusType.SUCCESS, false);
 
         // uid3: subscribe session 3 with ranging: max
         client3.addSession(new WifiAwareDiscoverySessionState(null, 113, (byte) 0, null, false,
-                true, mClock.getElapsedSinceBootMillis(), false, 0));
+                true, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySessionWithRanging(uid3, true, -1, 50, clients);
         mDut.recordDiscoveryStatus(uid3, NanStatusType.SUCCESS, false);
 
         // uid3: subscribe session 3 with ranging: minmax
         client3.addSession(new WifiAwareDiscoverySessionState(null, 114, (byte) 0, null, false,
-                true, mClock.getElapsedSinceBootMillis(), false, 0));
+                true, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
         mDut.recordDiscoverySessionWithRanging(uid3, true, 0, 110, clients);
         mDut.recordDiscoveryStatus(uid3, NanStatusType.SUCCESS, false);
 
@@ -392,7 +394,7 @@
         // uid2: subscribe session 3
         mDut.recordDiscoverySession(uid2, clients);
         client2.addSession(new WifiAwareDiscoverySessionState(null, 104, (byte) 0, null, false,
-                false, mClock.getElapsedSinceBootMillis(), false, 0));
+                false, mClock.getElapsedSinceBootMillis(), false, 0, mLocalLog));
 
         // a few failures
         mDut.recordDiscoveryStatus(uid1, NanStatusType.INTERNAL_FAILURE, true);
diff --git a/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java b/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
index 1cb08bf..35272aa 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareStateManagerTest.java
@@ -86,6 +86,7 @@
 import android.os.UserHandle;
 import android.os.WorkSource;
 import android.os.test.TestLooper;
+import android.util.LocalLog;
 import android.util.Log;
 import android.util.SparseArray;
 
@@ -166,6 +167,7 @@
     private Bundle mExtras = new Bundle();
     private WifiManager.ActiveCountryCodeChangedCallback mActiveCountryCodeChangedCallback;
     private HandlerThread mWifiHandlerThread;
+    private LocalLog mLocalLog = new LocalLog(512);
 
     /**
      * Pre-test configuration. Initialize and install mocks.
@@ -216,6 +218,7 @@
         WifiThreadRunner wifiThreadRunner = new WifiThreadRunner(wifiHandler);
         when(mWifiInjector.getWifiNative()).thenReturn(mWifiNative);
         when(mWifiInjector.getWifiThreadRunner()).thenReturn(wifiThreadRunner);
+        when(mWifiInjector.getWifiAwareLocalLog()).thenReturn(mLocalLog);
         mDut = new WifiAwareStateManager(mWifiInjector);
         mDut.setNative(mMockNativeManager, mMockNative);
         mDut.start(mMockContext, mMockLooper.getLooper(), mAwareMetricsMock,