summaryrefslogtreecommitdiffstats
path: root/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-12-05 16:36:20 -0800
committerIrfan Sheriff <isheriff@google.com>2012-12-05 21:19:52 -0800
commitef96a43a3c9277a2b63cce5ead0618281ac263b1 (patch)
tree87730942a3ead1db7118ac8f7c87c9a0dbb13103 /wifi/java/android/net/wifi/p2p/WifiP2pManager.java
parent0a19ad089ad93740debc52c122726507e4517ccb (diff)
downloadframeworks_base-ef96a43a3c9277a2b63cce5ead0618281ac263b1.zip
frameworks_base-ef96a43a3c9277a2b63cce5ead0618281ac263b1.tar.gz
frameworks_base-ef96a43a3c9277a2b63cce5ead0618281ac263b1.tar.bz2
Remove exposing dialog handling to apps
This was a hidden API that has little value in being exposed due to persistence now being supported on the platform. The only use case for this is NFC, and we are going to add support for that in official way Change-Id: I20d97c8fd81e50fc610b4983b613e26ebaa72578
Diffstat (limited to 'wifi/java/android/net/wifi/p2p/WifiP2pManager.java')
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pManager.java183
1 files changed, 8 insertions, 175 deletions
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
index 6edc232..d79421f 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java
@@ -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;
@@ -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;
@@ -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;
-
+ public static final int DELETE_PERSISTENT_GROUP = BASE + 54;
/** @hide */
- public static final int DELETE_PERSISTENT_GROUP = BASE + 59;
+ public static final int DELETE_PERSISTENT_GROUP_FAILED = BASE + 55;
/** @hide */
- public static final int DELETE_PERSISTENT_GROUP_FAILED = BASE + 60;
- /** @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
@@ -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 {
/**
@@ -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 {
/**
@@ -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;
@@ -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) {
@@ -897,10 +769,6 @@ public class WifiP2pManager {
return mListenerMap.remove(key);
}
}
-
- private void setDialogListener(DialogListener listener) {
- mDialogListener = listener;
- }
}
private static void checkChannel(Channel c) {
@@ -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.