Loading wifi/java/android/net/wifi/p2p/WifiP2pManager.java +8 −175 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.net.wifi.p2p.nsd.WifiP2pServiceResponse; import android.net.wifi.p2p.nsd.WifiP2pUpnpServiceInfo; import android.net.wifi.p2p.nsd.WifiP2pUpnpServiceResponse; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.Handler; import android.os.Looper; Loading Loading @@ -273,41 +272,6 @@ public class WifiP2pManager { public static final String WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTION = "android.net.wifi.p2p.PERSISTENT_GROUPS_CHANGED"; /** * The lookup key for a {@link #String} object. * Retrieve with {@link android.os.Bundle#getString(String)}. * @hide */ public static final String APP_PKG_BUNDLE_KEY = "appPkgName"; /** * The lookup key for a {@link #Boolean} object. * Retrieve with {@link android.os.Bundle#getBoolean(String)}. * @hide */ public static final String RESET_DIALOG_LISTENER_BUNDLE_KEY = "dialogResetFlag"; /** * The lookup key for a {@link #String} object. * Retrieve with {@link android.os.Bundle#getString(String)}. * @hide */ public static final String WPS_PIN_BUNDLE_KEY = "wpsPin"; /** * The lookup key for a {@link android.net.wifi.p2p.WifiP2pDevice} object * Retrieve with {@link android.os.Bundle#getParcelable(String)}. * @hide */ public static final String P2P_DEV_BUNDLE_KEY = "wifiP2pDevice"; /** * The lookup key for a {@link android.net.wifi.p2p.WifiP2pConfig} object * Retrieve with {@link android.os.Bundle#getParcelable(String)}. * @hide */ public static final String P2P_CONFIG_BUNDLE_KEY = "wifiP2pConfig"; IWifiP2pManager mService; private static final int BASE = Protocol.BASE_WIFI_P2P_MANAGER; Loading Loading @@ -432,35 +396,23 @@ public class WifiP2pManager { public static final int SET_DEVICE_NAME_SUCCEEDED = BASE + 53; /** @hide */ public static final int SET_DIALOG_LISTENER = BASE + 54; /** @hide */ public static final int DIALOG_LISTENER_DETACHED = BASE + 55; /** @hide */ public static final int DIALOG_LISTENER_ATTACHED = BASE + 56; /** @hide */ public static final int CONNECTION_REQUESTED = BASE + 57; /** @hide */ public static final int SHOW_PIN_REQUESTED = BASE + 58; /** @hide */ public static final int DELETE_PERSISTENT_GROUP = BASE + 59; public static final int DELETE_PERSISTENT_GROUP = BASE + 54; /** @hide */ public static final int DELETE_PERSISTENT_GROUP_FAILED = BASE + 60; public static final int DELETE_PERSISTENT_GROUP_FAILED = BASE + 55; /** @hide */ public static final int DELETE_PERSISTENT_GROUP_SUCCEEDED = BASE + 61; public static final int DELETE_PERSISTENT_GROUP_SUCCEEDED = BASE + 56; /** @hide */ public static final int REQUEST_PERSISTENT_GROUP_INFO = BASE + 62; public static final int REQUEST_PERSISTENT_GROUP_INFO = BASE + 57; /** @hide */ public static final int RESPONSE_PERSISTENT_GROUP_INFO = BASE + 63; public static final int RESPONSE_PERSISTENT_GROUP_INFO = BASE + 58; /** @hide */ public static final int SET_WFD_INFO = BASE + 64; public static final int SET_WFD_INFO = BASE + 59; /** @hide */ public static final int SET_WFD_INFO_FAILED = BASE + 65; public static final int SET_WFD_INFO_FAILED = BASE + 60; /** @hide */ public static final int SET_WFD_INFO_SUCCEEDED = BASE + 66; public static final int SET_WFD_INFO_SUCCEEDED = BASE + 61; /** * Create a new WifiP2pManager instance. Applications use Loading Loading @@ -501,14 +453,6 @@ public class WifiP2pManager { */ public static final int NO_SERVICE_REQUESTS = 3; /** * Passed with {@link DialogListener#onDetached}. * Indicates that the registered listener was detached from the system because * the application went into background. * @hide */ public static final int NOT_IN_FOREGROUND = 4; /** Interface for callback invocation when framework channel is lost */ public interface ChannelListener { /** Loading Loading @@ -640,49 +584,6 @@ public class WifiP2pManager { } /** * Interface for callback invocation when dialog events are received. * see {@link #setDialogListener}. * @hide */ public interface DialogListener { /** * Called by the system when a request to show WPS pin is received. * * @param pin WPS pin. */ public void onShowPinRequested(String pin); /** * Called by the system when a request to establish the connection is received. * * Application can then call {@link #connect} with the given config if the request * is acceptable. * * @param device the source device. * @param config p2p configuration. */ public void onConnectionRequested(WifiP2pDevice device, WifiP2pConfig config); /** * Called by the system when this listener was attached to the system. */ public void onAttached(); /** * Called by the system when this listener was detached from the system or * failed to attach. * * Application can request again using {@link #setDialogListener} when it is * in the foreground. * * @param reason The reason for failure could be one of {@link #ERROR}, * {@link #BUSY}, {@link #P2P_UNSUPPORTED} or {@link #NOT_IN_FOREGROUND} */ public void onDetached(int reason); } /** Interface for callback invocation when stored group info list is available {@hide}*/ public interface PersistentGroupInfoListener { /** Loading Loading @@ -713,7 +614,6 @@ public class WifiP2pManager { private HashMap<Integer, Object> mListenerMap = new HashMap<Integer, Object>(); private Object mListenerMapLock = new Object(); private int mListenerKey = 0; private DialogListener mDialogListener; private AsyncChannel mAsyncChannel; private P2pHandler mHandler; Loading Loading @@ -797,34 +697,6 @@ public class WifiP2pManager { WifiP2pServiceResponse resp = (WifiP2pServiceResponse) message.obj; handleServiceResponse(resp); break; case WifiP2pManager.CONNECTION_REQUESTED: if (mDialogListener != null) { Bundle bundle = message.getData(); mDialogListener.onConnectionRequested( (WifiP2pDevice)bundle.getParcelable( P2P_DEV_BUNDLE_KEY), (WifiP2pConfig)bundle.getParcelable( P2P_CONFIG_BUNDLE_KEY)); } break; case WifiP2pManager.SHOW_PIN_REQUESTED: if (mDialogListener != null) { Bundle bundle = message.getData(); mDialogListener.onShowPinRequested( bundle.getString(WPS_PIN_BUNDLE_KEY)); } break; case WifiP2pManager.DIALOG_LISTENER_ATTACHED: if (mDialogListener != null) { mDialogListener.onAttached(); } break; case WifiP2pManager.DIALOG_LISTENER_DETACHED: if (mDialogListener != null) { mDialogListener.onDetached(message.arg1); mDialogListener = null; } break; case WifiP2pManager.RESPONSE_PERSISTENT_GROUP_INFO: WifiP2pGroupList groups = (WifiP2pGroupList) message.obj; if (listener != null) { Loading Loading @@ -897,10 +769,6 @@ public class WifiP2pManager { return mListenerMap.remove(key); } } private void setDialogListener(DialogListener listener) { mDialogListener = listener; } } private static void checkChannel(Channel c) { Loading Loading @@ -1314,41 +1182,6 @@ public class WifiP2pManager { c.mAsyncChannel.sendMessage(SET_WFD_INFO, 0, c.putListener(listener), wfdInfo); } /** * Set dialog listener to over-ride system dialogs on p2p events. This function * allows an application to receive notifications on connection requests from * peers so that it can customize the user experience for connection with * peers. * * <p> The function call immediately returns after sending a request * to the framework. The application is notified of a success or failure to attach * to the system through listener callbacks {@link DialogListener#onAttached} or * {@link DialogListener#onDetached}. * * <p> Note that only foreground application will be successful in overriding the * system dialogs. * @hide * * @param c is the channel created at {@link #initialize} * @param listener for callback on a dialog event. */ public void setDialogListener(Channel c, DialogListener listener) { checkChannel(c); c.setDialogListener(listener); /** * mAsyncChannel should always stay private and inaccessible from the app * to prevent an app from sending a message with a fake app name to gain * control over the dialogs */ Message msg = Message.obtain(); Bundle bundle = new Bundle(); bundle.putString(APP_PKG_BUNDLE_KEY, c.mContext.getPackageName()); bundle.putBoolean(RESET_DIALOG_LISTENER_BUNDLE_KEY, listener == null); msg.what = SET_DIALOG_LISTENER; msg.setData(bundle); c.mAsyncChannel.sendMessage(msg); } /** * Delete a stored persistent group from the system settings. Loading wifi/java/android/net/wifi/p2p/WifiP2pService.java +26 −227 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
wifi/java/android/net/wifi/p2p/WifiP2pManager.java +8 −175 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import android.net.wifi.p2p.nsd.WifiP2pServiceResponse; import android.net.wifi.p2p.nsd.WifiP2pUpnpServiceInfo; import android.net.wifi.p2p.nsd.WifiP2pUpnpServiceResponse; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.Handler; import android.os.Looper; Loading Loading @@ -273,41 +272,6 @@ public class WifiP2pManager { public static final String WIFI_P2P_PERSISTENT_GROUPS_CHANGED_ACTION = "android.net.wifi.p2p.PERSISTENT_GROUPS_CHANGED"; /** * The lookup key for a {@link #String} object. * Retrieve with {@link android.os.Bundle#getString(String)}. * @hide */ public static final String APP_PKG_BUNDLE_KEY = "appPkgName"; /** * The lookup key for a {@link #Boolean} object. * Retrieve with {@link android.os.Bundle#getBoolean(String)}. * @hide */ public static final String RESET_DIALOG_LISTENER_BUNDLE_KEY = "dialogResetFlag"; /** * The lookup key for a {@link #String} object. * Retrieve with {@link android.os.Bundle#getString(String)}. * @hide */ public static final String WPS_PIN_BUNDLE_KEY = "wpsPin"; /** * The lookup key for a {@link android.net.wifi.p2p.WifiP2pDevice} object * Retrieve with {@link android.os.Bundle#getParcelable(String)}. * @hide */ public static final String P2P_DEV_BUNDLE_KEY = "wifiP2pDevice"; /** * The lookup key for a {@link android.net.wifi.p2p.WifiP2pConfig} object * Retrieve with {@link android.os.Bundle#getParcelable(String)}. * @hide */ public static final String P2P_CONFIG_BUNDLE_KEY = "wifiP2pConfig"; IWifiP2pManager mService; private static final int BASE = Protocol.BASE_WIFI_P2P_MANAGER; Loading Loading @@ -432,35 +396,23 @@ public class WifiP2pManager { public static final int SET_DEVICE_NAME_SUCCEEDED = BASE + 53; /** @hide */ public static final int SET_DIALOG_LISTENER = BASE + 54; /** @hide */ public static final int DIALOG_LISTENER_DETACHED = BASE + 55; /** @hide */ public static final int DIALOG_LISTENER_ATTACHED = BASE + 56; /** @hide */ public static final int CONNECTION_REQUESTED = BASE + 57; /** @hide */ public static final int SHOW_PIN_REQUESTED = BASE + 58; /** @hide */ public static final int DELETE_PERSISTENT_GROUP = BASE + 59; public static final int DELETE_PERSISTENT_GROUP = BASE + 54; /** @hide */ public static final int DELETE_PERSISTENT_GROUP_FAILED = BASE + 60; public static final int DELETE_PERSISTENT_GROUP_FAILED = BASE + 55; /** @hide */ public static final int DELETE_PERSISTENT_GROUP_SUCCEEDED = BASE + 61; public static final int DELETE_PERSISTENT_GROUP_SUCCEEDED = BASE + 56; /** @hide */ public static final int REQUEST_PERSISTENT_GROUP_INFO = BASE + 62; public static final int REQUEST_PERSISTENT_GROUP_INFO = BASE + 57; /** @hide */ public static final int RESPONSE_PERSISTENT_GROUP_INFO = BASE + 63; public static final int RESPONSE_PERSISTENT_GROUP_INFO = BASE + 58; /** @hide */ public static final int SET_WFD_INFO = BASE + 64; public static final int SET_WFD_INFO = BASE + 59; /** @hide */ public static final int SET_WFD_INFO_FAILED = BASE + 65; public static final int SET_WFD_INFO_FAILED = BASE + 60; /** @hide */ public static final int SET_WFD_INFO_SUCCEEDED = BASE + 66; public static final int SET_WFD_INFO_SUCCEEDED = BASE + 61; /** * Create a new WifiP2pManager instance. Applications use Loading Loading @@ -501,14 +453,6 @@ public class WifiP2pManager { */ public static final int NO_SERVICE_REQUESTS = 3; /** * Passed with {@link DialogListener#onDetached}. * Indicates that the registered listener was detached from the system because * the application went into background. * @hide */ public static final int NOT_IN_FOREGROUND = 4; /** Interface for callback invocation when framework channel is lost */ public interface ChannelListener { /** Loading Loading @@ -640,49 +584,6 @@ public class WifiP2pManager { } /** * Interface for callback invocation when dialog events are received. * see {@link #setDialogListener}. * @hide */ public interface DialogListener { /** * Called by the system when a request to show WPS pin is received. * * @param pin WPS pin. */ public void onShowPinRequested(String pin); /** * Called by the system when a request to establish the connection is received. * * Application can then call {@link #connect} with the given config if the request * is acceptable. * * @param device the source device. * @param config p2p configuration. */ public void onConnectionRequested(WifiP2pDevice device, WifiP2pConfig config); /** * Called by the system when this listener was attached to the system. */ public void onAttached(); /** * Called by the system when this listener was detached from the system or * failed to attach. * * Application can request again using {@link #setDialogListener} when it is * in the foreground. * * @param reason The reason for failure could be one of {@link #ERROR}, * {@link #BUSY}, {@link #P2P_UNSUPPORTED} or {@link #NOT_IN_FOREGROUND} */ public void onDetached(int reason); } /** Interface for callback invocation when stored group info list is available {@hide}*/ public interface PersistentGroupInfoListener { /** Loading Loading @@ -713,7 +614,6 @@ public class WifiP2pManager { private HashMap<Integer, Object> mListenerMap = new HashMap<Integer, Object>(); private Object mListenerMapLock = new Object(); private int mListenerKey = 0; private DialogListener mDialogListener; private AsyncChannel mAsyncChannel; private P2pHandler mHandler; Loading Loading @@ -797,34 +697,6 @@ public class WifiP2pManager { WifiP2pServiceResponse resp = (WifiP2pServiceResponse) message.obj; handleServiceResponse(resp); break; case WifiP2pManager.CONNECTION_REQUESTED: if (mDialogListener != null) { Bundle bundle = message.getData(); mDialogListener.onConnectionRequested( (WifiP2pDevice)bundle.getParcelable( P2P_DEV_BUNDLE_KEY), (WifiP2pConfig)bundle.getParcelable( P2P_CONFIG_BUNDLE_KEY)); } break; case WifiP2pManager.SHOW_PIN_REQUESTED: if (mDialogListener != null) { Bundle bundle = message.getData(); mDialogListener.onShowPinRequested( bundle.getString(WPS_PIN_BUNDLE_KEY)); } break; case WifiP2pManager.DIALOG_LISTENER_ATTACHED: if (mDialogListener != null) { mDialogListener.onAttached(); } break; case WifiP2pManager.DIALOG_LISTENER_DETACHED: if (mDialogListener != null) { mDialogListener.onDetached(message.arg1); mDialogListener = null; } break; case WifiP2pManager.RESPONSE_PERSISTENT_GROUP_INFO: WifiP2pGroupList groups = (WifiP2pGroupList) message.obj; if (listener != null) { Loading Loading @@ -897,10 +769,6 @@ public class WifiP2pManager { return mListenerMap.remove(key); } } private void setDialogListener(DialogListener listener) { mDialogListener = listener; } } private static void checkChannel(Channel c) { Loading Loading @@ -1314,41 +1182,6 @@ public class WifiP2pManager { c.mAsyncChannel.sendMessage(SET_WFD_INFO, 0, c.putListener(listener), wfdInfo); } /** * Set dialog listener to over-ride system dialogs on p2p events. This function * allows an application to receive notifications on connection requests from * peers so that it can customize the user experience for connection with * peers. * * <p> The function call immediately returns after sending a request * to the framework. The application is notified of a success or failure to attach * to the system through listener callbacks {@link DialogListener#onAttached} or * {@link DialogListener#onDetached}. * * <p> Note that only foreground application will be successful in overriding the * system dialogs. * @hide * * @param c is the channel created at {@link #initialize} * @param listener for callback on a dialog event. */ public void setDialogListener(Channel c, DialogListener listener) { checkChannel(c); c.setDialogListener(listener); /** * mAsyncChannel should always stay private and inaccessible from the app * to prevent an app from sending a message with a fake app name to gain * control over the dialogs */ Message msg = Message.obtain(); Bundle bundle = new Bundle(); bundle.putString(APP_PKG_BUNDLE_KEY, c.mContext.getPackageName()); bundle.putBoolean(RESET_DIALOG_LISTENER_BUNDLE_KEY, listener == null); msg.what = SET_DIALOG_LISTENER; msg.setData(bundle); c.mAsyncChannel.sendMessage(msg); } /** * Delete a stored persistent group from the system settings. Loading
wifi/java/android/net/wifi/p2p/WifiP2pService.java +26 −227 File changed.Preview size limit exceeded, changes collapsed. Show changes