Loading api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -27070,7 +27070,8 @@ package android.net.wifi.p2p { method public abstract void onSuccess(); } public static class WifiP2pManager.Channel { public static class WifiP2pManager.Channel implements java.lang.AutoCloseable { method public void close(); } public static abstract interface WifiP2pManager.ChannelListener { api/system-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -29866,7 +29866,8 @@ package android.net.wifi.p2p { method public abstract void onSuccess(); } public static class WifiP2pManager.Channel { public static class WifiP2pManager.Channel implements java.lang.AutoCloseable { method public void close(); } public static abstract interface WifiP2pManager.ChannelListener { api/test-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -27181,7 +27181,8 @@ package android.net.wifi.p2p { method public abstract void onSuccess(); } public static class WifiP2pManager.Channel { public static class WifiP2pManager.Channel implements java.lang.AutoCloseable { method public void close(); } public static abstract interface WifiP2pManager.ChannelListener { wifi/java/android/net/wifi/p2p/WifiP2pManager.java +47 −21 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ import android.util.Log; import com.android.internal.util.AsyncChannel; import com.android.internal.util.Protocol; import dalvik.system.CloseGuard; import java.util.HashMap; import java.util.List; import java.util.Map; Loading Loading @@ -668,15 +670,21 @@ public class WifiP2pManager { * Most p2p operations require a Channel as an argument. An instance of Channel is obtained * by doing a call on {@link #initialize} */ public static class Channel { Channel(Context context, Looper looper, ChannelListener l, Binder binder) { public static class Channel implements AutoCloseable { /** @hide */ public Channel(Context context, Looper looper, ChannelListener l, Binder binder, WifiP2pManager p2pManager) { mAsyncChannel = new AsyncChannel(); mHandler = new P2pHandler(looper); mChannelListener = l; mContext = context; mBinder = binder; mP2pManager = p2pManager; mCloseGuard.open("close"); } private final static int INVALID_LISTENER_KEY = 0; private final WifiP2pManager mP2pManager; private ChannelListener mChannelListener; private ServiceResponseListener mServRspListener; private DnsSdServiceResponseListener mDnsSdServRspListener; Loading @@ -686,6 +694,41 @@ public class WifiP2pManager { private final Object mListenerMapLock = new Object(); private int mListenerKey = 0; private final CloseGuard mCloseGuard = CloseGuard.get(); /** * Close the current P2P connection and indicate to the P2P service that connections * created by the app can be removed. */ public void close() { if (mP2pManager == null) { Log.w(TAG, "Channel.close(): Null mP2pManager!?"); } else { try { mP2pManager.mService.close(mBinder); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } mAsyncChannel.disconnect(); mCloseGuard.close(); } /** @hide */ @Override protected void finalize() throws Throwable { try { if (mCloseGuard != null) { mCloseGuard.warnIfOpen(); } close(); } finally { super.finalize(); } } /* package */ final Binder mBinder; private AsyncChannel mAsyncChannel; Loading Loading @@ -913,11 +956,12 @@ public class WifiP2pManager { Messenger messenger, Binder binder) { if (messenger == null) return null; Channel c = new Channel(srcContext, srcLooper, listener, binder); Channel c = new Channel(srcContext, srcLooper, listener, binder, this); if (c.mAsyncChannel.connectSync(srcContext, c.mHandler, messenger) == AsyncChannel.STATUS_SUCCESSFUL) { return c; } else { c.close(); return null; } } Loading Loading @@ -1421,24 +1465,6 @@ public class WifiP2pManager { } } /** * Close the current P2P connection and clean-up any configuration requested by the * current app. Takes same action as taken when the app dies. * * @param c is the channel created at {@link #initialize} * * @hide */ public void close(Channel c) { try { if (c != null) { mService.close(c.mBinder); } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Get a handover request message for use in WFA NFC Handover transfer. * @hide Loading wifi/tests/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude) LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-test \ core-test-rules \ guava \ mockito-target-minus-junit4 \ frameworks-base-testutils \ Loading Loading
api/current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -27070,7 +27070,8 @@ package android.net.wifi.p2p { method public abstract void onSuccess(); } public static class WifiP2pManager.Channel { public static class WifiP2pManager.Channel implements java.lang.AutoCloseable { method public void close(); } public static abstract interface WifiP2pManager.ChannelListener {
api/system-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -29866,7 +29866,8 @@ package android.net.wifi.p2p { method public abstract void onSuccess(); } public static class WifiP2pManager.Channel { public static class WifiP2pManager.Channel implements java.lang.AutoCloseable { method public void close(); } public static abstract interface WifiP2pManager.ChannelListener {
api/test-current.txt +2 −1 Original line number Diff line number Diff line Loading @@ -27181,7 +27181,8 @@ package android.net.wifi.p2p { method public abstract void onSuccess(); } public static class WifiP2pManager.Channel { public static class WifiP2pManager.Channel implements java.lang.AutoCloseable { method public void close(); } public static abstract interface WifiP2pManager.ChannelListener {
wifi/java/android/net/wifi/p2p/WifiP2pManager.java +47 −21 Original line number Diff line number Diff line Loading @@ -41,6 +41,8 @@ import android.util.Log; import com.android.internal.util.AsyncChannel; import com.android.internal.util.Protocol; import dalvik.system.CloseGuard; import java.util.HashMap; import java.util.List; import java.util.Map; Loading Loading @@ -668,15 +670,21 @@ public class WifiP2pManager { * Most p2p operations require a Channel as an argument. An instance of Channel is obtained * by doing a call on {@link #initialize} */ public static class Channel { Channel(Context context, Looper looper, ChannelListener l, Binder binder) { public static class Channel implements AutoCloseable { /** @hide */ public Channel(Context context, Looper looper, ChannelListener l, Binder binder, WifiP2pManager p2pManager) { mAsyncChannel = new AsyncChannel(); mHandler = new P2pHandler(looper); mChannelListener = l; mContext = context; mBinder = binder; mP2pManager = p2pManager; mCloseGuard.open("close"); } private final static int INVALID_LISTENER_KEY = 0; private final WifiP2pManager mP2pManager; private ChannelListener mChannelListener; private ServiceResponseListener mServRspListener; private DnsSdServiceResponseListener mDnsSdServRspListener; Loading @@ -686,6 +694,41 @@ public class WifiP2pManager { private final Object mListenerMapLock = new Object(); private int mListenerKey = 0; private final CloseGuard mCloseGuard = CloseGuard.get(); /** * Close the current P2P connection and indicate to the P2P service that connections * created by the app can be removed. */ public void close() { if (mP2pManager == null) { Log.w(TAG, "Channel.close(): Null mP2pManager!?"); } else { try { mP2pManager.mService.close(mBinder); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } mAsyncChannel.disconnect(); mCloseGuard.close(); } /** @hide */ @Override protected void finalize() throws Throwable { try { if (mCloseGuard != null) { mCloseGuard.warnIfOpen(); } close(); } finally { super.finalize(); } } /* package */ final Binder mBinder; private AsyncChannel mAsyncChannel; Loading Loading @@ -913,11 +956,12 @@ public class WifiP2pManager { Messenger messenger, Binder binder) { if (messenger == null) return null; Channel c = new Channel(srcContext, srcLooper, listener, binder); Channel c = new Channel(srcContext, srcLooper, listener, binder, this); if (c.mAsyncChannel.connectSync(srcContext, c.mHandler, messenger) == AsyncChannel.STATUS_SUCCESSFUL) { return c; } else { c.close(); return null; } } Loading Loading @@ -1421,24 +1465,6 @@ public class WifiP2pManager { } } /** * Close the current P2P connection and clean-up any configuration requested by the * current app. Takes same action as taken when the app dies. * * @param c is the channel created at {@link #initialize} * * @hide */ public void close(Channel c) { try { if (c != null) { mService.close(c.mBinder); } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Get a handover request message for use in WFA NFC Handover transfer. * @hide Loading
wifi/tests/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := $(jacoco_exclude) LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-test \ core-test-rules \ guava \ mockito-target-minus-junit4 \ frameworks-base-testutils \ Loading