PasspointObjectFactory.java revision 3d42402e0d282dc75f9c65f29d0f9e0eea753100
1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.wifi.hotspot2;
18
19import android.net.wifi.hotspot2.PasspointConfiguration;
20
21import com.android.server.wifi.Clock;
22import com.android.server.wifi.WifiKeyStore;
23import com.android.server.wifi.WifiNative;
24
25/**
26 * Factory class for creating Passpoint related objects. Useful for mocking object creations
27 * in the unit tests.
28 */
29public class PasspointObjectFactory{
30    /**
31     * Create a PasspointEventHandler instance.
32     *
33     * @param wifiNative Instance of {@link WifiNative}
34     * @param callbacks Instance of {@link PasspointEventHandler.Callbacks}
35     * @return {@link PasspointEventHandler}
36     */
37    public PasspointEventHandler makePasspointEventHandler(WifiNative wifiNative,
38            PasspointEventHandler.Callbacks callbacks) {
39        return new PasspointEventHandler(wifiNative, callbacks);
40    }
41
42    /**
43     * Create a PasspointProvider instance.
44     *
45     * @param keyStore Instance of {@link WifiKeyStore}
46     * @param config Configuration for the provider
47     * @param providerId Unique identifier for the provider
48     * @return {@link PasspointProvider}
49     */
50    public PasspointProvider makePasspointProvider(PasspointConfiguration config,
51            WifiKeyStore keyStore, long providerId) {
52        return new PasspointProvider(config, keyStore, providerId);
53    }
54
55    /**
56     * Create a AnqpCache instance.
57     *
58     * @param clock Instance of {@link Clock}
59     * @return {@link AnqpCache}
60     */
61    public AnqpCache makeAnqpCache(Clock clock) {
62        return new AnqpCache(clock);
63    }
64}
65