Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d0f0c7f authored by Etan Cohen's avatar Etan Cohen
Browse files

[NAN] Renamed listeners to callback per API guidelines [DO NOT MERGE]

The interfaces had multiple functions and are hence callback
and not a listener.

Note: purely a rename operation.

Bug: 27122760
Change-Id: Ib12711f56a64052455843859125d72268c465fc0
parent e4c50de7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -410,9 +410,9 @@ LOCAL_SRC_FILES += \
	telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl \
	telephony/java/com/android/internal/telephony/IWapPushManager.aidl \
	wifi/java/android/net/wifi/IWifiManager.aidl \
	wifi/java/android/net/wifi/nan/IWifiNanEventListener.aidl \
	wifi/java/android/net/wifi/nan/IWifiNanEventCallback.aidl \
	wifi/java/android/net/wifi/nan/IWifiNanManager.aidl \
	wifi/java/android/net/wifi/nan/IWifiNanSessionListener.aidl \
	wifi/java/android/net/wifi/nan/IWifiNanSessionCallback.aidl \
	wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \
	wifi/java/android/net/wifi/IWifiScanner.aidl \
	wifi/java/android/net/wifi/IRttManager.aidl \
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.net.wifi.nan.ConfigRequest;
 *
 * {@hide}
 */
oneway interface IWifiNanEventListener
oneway interface IWifiNanEventCallback
{
    void onConfigCompleted(in ConfigRequest completedConfig);
    void onConfigFailed(in ConfigRequest failedConfig, int reason);
+4 −4
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@ package android.net.wifi.nan;
import android.app.PendingIntent;

import android.net.wifi.nan.ConfigRequest;
import android.net.wifi.nan.IWifiNanEventListener;
import android.net.wifi.nan.IWifiNanSessionListener;
import android.net.wifi.nan.IWifiNanEventCallback;
import android.net.wifi.nan.IWifiNanSessionCallback;
import android.net.wifi.nan.PublishConfig;
import android.net.wifi.nan.SubscribeConfig;

@@ -32,12 +32,12 @@ import android.net.wifi.nan.SubscribeConfig;
interface IWifiNanManager
{
    // client API
    int connect(in IBinder binder, in IWifiNanEventListener listener, int events);
    int connect(in IBinder binder, in IWifiNanEventCallback callback, int events);
    void disconnect(int clientId, in IBinder binder);
    void requestConfig(int clientId, in ConfigRequest configRequest);

    // session API
    int createSession(int clientId, in IWifiNanSessionListener listener, int events);
    int createSession(int clientId, in IWifiNanSessionCallback callback, int events);
    void publish(int clientId, int sessionId, in PublishConfig publishConfig);
    void subscribe(int clientId, int sessionId, in SubscribeConfig subscribeConfig);
    void sendMessage(int clientId, int sessionId, int peerId, in byte[] message, int messageLength,
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ package android.net.wifi.nan;
 *
 * {@hide}
 */
oneway interface IWifiNanSessionListener
oneway interface IWifiNanSessionCallback
{
    void onPublishFail(int reason);
    void onPublishTerminated(int reason);
+33 −30
Original line number Diff line number Diff line
@@ -25,36 +25,37 @@ import android.util.Log;
 * Base class for NAN events callbacks. Should be extended by applications
 * wanting notifications. These are callbacks applying to the NAN connection as
 * a whole - not to specific publish or subscribe sessions - for that see
 * {@link WifiNanSessionListener}.
 * {@link WifiNanSessionCallback}.
 * <p>
 * During registration specify which specific events are desired using a set of
 * {@code NanEventListener.LISTEN_*} flags OR'd together. Only those events will
 * be delivered to the registered listener. Override those callbacks
 * {@code NanEventListener.on*} for the registered events.
 * {@code NanEventCallback.LISTEN_*} flags OR'd together. Only those events will
 * be delivered to the registered callback. Override those callbacks
 * {@code WifiNanEventCallback.on*} for the registered events.
 *
 * @hide PROPOSED_NAN_API
 */
public class WifiNanEventListener {
    private static final String TAG = "WifiNanEventListener";
public class WifiNanEventCallback {
    private static final String TAG = "WifiNanEventCallback";
    private static final boolean DBG = false;
    private static final boolean VDBG = false; // STOPSHIP if true

    /**
     * Configuration completion callback event registration flag. Corresponding
     * callback is {@link WifiNanEventListener#onConfigCompleted(ConfigRequest)}.
     * callback is {@link WifiNanEventCallback#onConfigCompleted(ConfigRequest)}
     * .
     */
    public static final int LISTEN_CONFIG_COMPLETED = 0x1 << 0;

    /**
     * Configuration failed callback event registration flag. Corresponding
     * callback is
     * {@link WifiNanEventListener#onConfigFailed(ConfigRequest, int)}.
     * {@link WifiNanEventCallback#onConfigFailed(ConfigRequest, int)}.
     */
    public static final int LISTEN_CONFIG_FAILED = 0x1 << 1;

    /**
     * NAN cluster is down callback event registration flag. Corresponding
     * callback is {@link WifiNanEventListener#onNanDown(int)}.
     * callback is {@link WifiNanEventCallback#onNanDown(int)}.
     */
    public static final int LISTEN_NAN_DOWN = 0x1 << 2;

@@ -63,27 +64,27 @@ public class WifiNanEventListener {
     * joining a cluster, starting a cluster, or discovery interface change. The
     * implication is that peers you've been communicating with may no longer
     * recognize you and you need to re-establish your identity. Corresponding
     * callback is {@link WifiNanEventListener#onIdentityChanged()}.
     * callback is {@link WifiNanEventCallback#onIdentityChanged()}.
     */
    public static final int LISTEN_IDENTITY_CHANGED = 0x1 << 3;

    private final Handler mHandler;

    /**
     * Constructs a {@link WifiNanEventListener} using the looper of the current
     * Constructs a {@link WifiNanEventCallback} using the looper of the current
     * thread. I.e. all callbacks will be delivered on the current thread.
     */
    public WifiNanEventListener() {
    public WifiNanEventCallback() {
        this(Looper.myLooper());
    }

    /**
     * Constructs a {@link WifiNanEventListener} using the specified looper. I.e.
     * all callbacks will delivered on the thread of the specified looper.
     * Constructs a {@link WifiNanEventCallback} using the specified looper.
     * I.e. all callbacks will delivered on the thread of the specified looper.
     *
     * @param looper The looper on which to execute the callbacks.
     */
    public WifiNanEventListener(Looper looper) {
    public WifiNanEventCallback(Looper looper) {
        if (VDBG) Log.v(TAG, "ctor: looper=" + looper);
        mHandler = new Handler(looper) {
            @Override
@@ -91,16 +92,16 @@ public class WifiNanEventListener {
                if (DBG) Log.d(TAG, "What=" + msg.what + ", msg=" + msg);
                switch (msg.what) {
                    case LISTEN_CONFIG_COMPLETED:
                        WifiNanEventListener.this.onConfigCompleted((ConfigRequest) msg.obj);
                        WifiNanEventCallback.this.onConfigCompleted((ConfigRequest) msg.obj);
                        break;
                    case LISTEN_CONFIG_FAILED:
                        WifiNanEventListener.this.onConfigFailed((ConfigRequest) msg.obj, msg.arg1);
                        WifiNanEventCallback.this.onConfigFailed((ConfigRequest) msg.obj, msg.arg1);
                        break;
                    case LISTEN_NAN_DOWN:
                        WifiNanEventListener.this.onNanDown(msg.arg1);
                        WifiNanEventCallback.this.onNanDown(msg.arg1);
                        break;
                    case LISTEN_IDENTITY_CHANGED:
                        WifiNanEventListener.this.onIdentityChanged();
                        WifiNanEventCallback.this.onIdentityChanged();
                        break;
                }
            }
@@ -109,8 +110,8 @@ public class WifiNanEventListener {

    /**
     * Called when NAN configuration is completed. Event will only be delivered
     * if registered using {@link WifiNanEventListener#LISTEN_CONFIG_COMPLETED}. A
     * dummy (empty implementation printing out a warning). Make sure to
     * if registered using {@link WifiNanEventCallback#LISTEN_CONFIG_COMPLETED}.
     * A dummy (empty implementation printing out a warning). Make sure to
     * override if registered.
     *
     * @param completedConfig The actual configuration request which was
@@ -124,11 +125,12 @@ public class WifiNanEventListener {

    /**
     * Called when NAN configuration failed. Event will only be delivered if
     * registered using {@link WifiNanEventListener#LISTEN_CONFIG_FAILED}. A dummy
     * (empty implementation printing out a warning). Make sure to override if
     * registered.
     * registered using {@link WifiNanEventCallback#LISTEN_CONFIG_FAILED}. A
     * dummy (empty implementation printing out a warning). Make sure to
     * override if registered.
     *
     * @param reason Failure reason code, see {@code NanSessionListener.FAIL_*}.
     * @param reason Failure reason code, see
     *            {@code WifiNanSessionCallback.FAIL_*}.
     */
    public void onConfigFailed(ConfigRequest failedConfig, int reason) {
        Log.w(TAG, "onConfigFailed: called in stub - override if interested or disable");
@@ -136,11 +138,12 @@ public class WifiNanEventListener {

    /**
     * Called when NAN cluster is down. Event will only be delivered if
     * registered using {@link WifiNanEventListener#LISTEN_NAN_DOWN}. A dummy (empty
     * implementation printing out a warning). Make sure to override if
     * registered using {@link WifiNanEventCallback#LISTEN_NAN_DOWN}. A dummy
     * (empty implementation printing out a warning). Make sure to override if
     * registered.
     *
     * @param reason Reason code for event, see {@code NanSessionListener.FAIL_*}.
     * @param reason Reason code for event, see
     *            {@code WifiNanSessionCallback.FAIL_*}.
     */
    public void onNanDown(int reason) {
        Log.w(TAG, "onNanDown: called in stub - override if interested or disable");
@@ -152,7 +155,7 @@ public class WifiNanEventListener {
     * implication is that peers you've been communicating with may no longer
     * recognize you and you need to re-establish your identity. Event will only
     * be delivered if registered using
     * {@link WifiNanEventListener#LISTEN_IDENTITY_CHANGED}. A dummy (empty
     * {@link WifiNanEventCallback#LISTEN_IDENTITY_CHANGED}. A dummy (empty
     * implementation printing out a warning). Make sure to override if
     * registered.
     */
@@ -163,7 +166,7 @@ public class WifiNanEventListener {
    /**
     * {@hide}
     */
    public IWifiNanEventListener callback = new IWifiNanEventListener.Stub() {
    public IWifiNanEventCallback callback = new IWifiNanEventCallback.Stub() {
        @Override
        public void onConfigCompleted(ConfigRequest completedConfig) {
            if (VDBG) Log.v(TAG, "onConfigCompleted: configRequest=" + completedConfig);
Loading