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

Commit 49de715b authored by Sohani Rao's avatar Sohani Rao Committed by Android (Google) Code Review
Browse files

Merge changes from topics "ProvisioningCallback", "PASSPOINT_APIs"

* changes:
  Introduce Status and Failure code for Provisioning
  Provide APIs for HS2.0 provisioning
parents 3c1d0cae 06751720
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -559,6 +559,7 @@ LOCAL_SRC_FILES += \
	wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \
	wifi/java/android/net/wifi/rtt/IRttCallback.aidl \
	wifi/java/android/net/wifi/rtt/IWifiRttManager.aidl \
	wifi/java/android/net/wifi/hotspot2/IProvisioningCallback.aidl \
	wifi/java/android/net/wifi/IWifiScanner.aidl \
	wifi/java/android/net/wifi/IRttManager.aidl \
	packages/services/PacProcessor/com/android/net/IProxyService.aidl \
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.pm.ParceledListSlice;

import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.hotspot2.IProvisioningCallback;

import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
@@ -184,5 +185,7 @@ interface IWifiManager
    void restoreBackupData(in byte[] data);

    void restoreSupplicantBackupData(in byte[] supplicantData, in byte[] ipConfigData);

    void startSubscriptionProvisioning(in OsuProvider provider, in IProvisioningCallback callback);
}
+43 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.net.wifi.hotspot2.IProvisioningCallback;
import android.net.wifi.hotspot2.ProvisioningCallback;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
@@ -3610,4 +3612,45 @@ public class WifiManager {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Start subscription provisioning flow
     * @param provider {@link OsuProvider} to provision with
     * @param callback {@link ProvisioningCallback} for updates regarding provisioning flow
     * @hide
     */
    public void startSubscriptionProvisioning(OsuProvider provider, ProvisioningCallback callback,
            @Nullable Handler handler) {
        Looper looper = (handler == null) ? Looper.getMainLooper() : handler.getLooper();
        try {
            mService.startSubscriptionProvisioning(provider,
                    new ProvisioningCallbackProxy(looper, callback));
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    private static class ProvisioningCallbackProxy extends IProvisioningCallback.Stub {
        private final Handler mHandler;
        private final ProvisioningCallback mCallback;

        ProvisioningCallbackProxy(Looper looper, ProvisioningCallback callback) {
            mHandler = new Handler(looper);
            mCallback = callback;
        }

        @Override
        public void onProvisioningStatus(int status) {
            mHandler.post(() -> {
                mCallback.onProvisioningStatus(status);
            });
        }

        @Override
        public void onProvisioningFailure(int status) {
            mHandler.post(() -> {
                mCallback.onProvisioningFailure(status);
            });
        }
    }
}
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.wifi.hotspot2;

/**
 * Interface for Provisioning callback.
 *
 * @hide
 */
oneway interface IProvisioningCallback
{
    /**
     * Service to manager callback providing failure notification
     */
    void onProvisioningFailure(int status);

    /**
     * Service to manager callback providing Provisioning status
     */
    void onProvisioningStatus(int status);
}
+59 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net.wifi.hotspot2;

import android.os.Handler;

/**
 * Base class for provisioning callbacks. Should be extended by applications and set when calling
 * {@link WifiManager#startSubscriptionProvisiong(OsuProvider, ProvisioningCallback, Handler)}.
 *
 * @hide
 */
public abstract class ProvisioningCallback {

   /**
     * The reason code for Provisioning Failure due to connection failure to OSU AP.
     * @hide
     */
    public static final int OSU_FAILURE_AP_CONNECTION      = 1;

    /**
     * The status code for Provisioning flow to indicate connecting to OSU AP
     * @hide
     */
    public static final int OSU_STATUS_AP_CONNECTING       = 1;

    /**
     * The status code for Provisioning flow to indicate connected to OSU AP
     * @hide
     */
    public static final int OSU_STATUS_AP_CONNECTED        = 2;

    /**
     * Provisioning status for OSU failure
     * @param status indicates error condition
     */
    public abstract void onProvisioningFailure(int status);

    /**
     * Provisioning status when OSU is in progress
     * @param status indicates status of OSU flow
     */
    public abstract void onProvisioningStatus(int status);
}