mock wifi (nl80211-framework#2): new constructor for mocking WifiNl80211Manager

To mock WifiNl80211Manager, it requires to have a new constructor to
inject the mocked IWificond binder for mocking WifiNl80211Manager
instance.

Bug: 251763354
Test: Manual test
Change-Id: I427696a26d611a9405fba1f478acef0ac6755b27
This commit is contained in:
Les Lee
2022-10-26 20:56:47 +08:00
parent 533e83f22e
commit 0a5d73b3be
2 changed files with 16 additions and 0 deletions

View File

@@ -9313,6 +9313,7 @@ package android.net.wifi.nl80211 {
}
public class WifiNl80211Manager {
ctor public WifiNl80211Manager(@NonNull android.content.Context, @NonNull android.os.IBinder);
method public void abortScan(@NonNull String);
method public void enableVerboseLogging(boolean);
method @NonNull public int[] getChannelsMhzForBand(int);

View File

@@ -393,6 +393,21 @@ public class WifiNl80211Manager {
mEventHandler = new Handler(context.getMainLooper());
}
/**
* Construct WifiNl80211Manager with giving context and binder which is an interface of
* IWificond.
*
* @param context Android context.
* @param binder a binder of IWificond.
*/
public WifiNl80211Manager(@NonNull Context context, @NonNull IBinder binder) {
this(context);
mWificond = IWificond.Stub.asInterface(binder);
if (mWificond == null) {
Log.e(TAG, "Failed to get reference to wificond");
}
}
/** @hide */
@VisibleForTesting
public WifiNl80211Manager(Context context, IWificond wificond) {