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

Commit 73450f20 authored by Etan Cohen's avatar Etan Cohen
Browse files

Wificond: transfer implementation to android.net.wifi

Move implementation of wificond to frameworks/base (android.net.wifi)
in prepration for making into a public API (which will be a wrapper
around the AIDL).

Bug: 140062898
Test: atest com.android.server.wifi
Test: atest android.net.wifi
Test: associates, soft AP client information received correctly
Change-Id: I3c5ede95d0421a1e00078e0316e9a2e751156f3e
parent 243a6fa6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -247,6 +247,7 @@ filegroup {
        ":framework-telephony-sources",
        ":framework-wifi-sources",
        ":framework-wifi-non-updatable-sources",
	":libwificond_ipc_aidl",
        ":PacProcessor-aidl-sources",
        ":ProxyHandler-aidl-sources",

@@ -371,6 +372,9 @@ java_library {
        "com.android.sysprop.apex",
        "PlatformProperties",
    ],
    aidl: {
        include_dirs: ["system/connectivity/wificond/aidl"],
    },
    sdk_version: "core_platform",
    installable: false,
}
+9 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@ import android.net.lowpan.ILowpanManager;
import android.net.lowpan.LowpanManager;
import android.net.nsd.INsdManager;
import android.net.nsd.NsdManager;
import android.net.wifi.WifiCondManager;
import android.net.wifi.WifiFrameworkInitializer;
import android.nfc.NfcManager;
import android.os.BatteryManager;
@@ -696,6 +697,14 @@ public final class SystemServiceRegistry {
                return new EthernetManager(ctx.getOuterContext(), service);
            }});

        registerService(Context.WIFI_COND_SERVICE, WifiCondManager.class,
                new CachedServiceFetcher<WifiCondManager>() {
                    @Override
                    public WifiCondManager createService(ContextImpl ctx) {
                        return new WifiCondManager(ctx.getOuterContext());
                    }
                });

        registerService(Context.WINDOW_SERVICE, WindowManager.class,
                new CachedServiceFetcher<WindowManager>() {
            @Override
+11 −0
Original line number Diff line number Diff line
@@ -3972,6 +3972,17 @@ public abstract class Context {
     */
    public static final String WIFI_SERVICE = "wifi";

    /**
     * Use with {@link #getSystemService(String)} to retrieve a
     * {@link android.net.wifi.WifiCondManager} for handling management of the Wi-Fi control
     * daemon.
     *
     * @see #getSystemService(String)
     * @see android.net.wifi.WifiCondManager
     * @hide
     */
    public static final String WIFI_COND_SERVICE = "wificond";

    /**
     * Use with {@link #getSystemService(String)} to retrieve a {@link
     * android.net.wifi.p2p.WifiP2pManager} for handling management of
+983 −0

File added.

Preview size limit exceeded, changes collapsed.

+95 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.wificond;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

import java.util.Objects;

/**
 * ChannelSettings for wificond
 *
 * @hide
 */
public class ChannelSettings implements Parcelable {
    private static final String TAG = "ChannelSettings";

    public int frequency;

    /** public constructor */
    public ChannelSettings() { }

    /** override comparator */
    @Override
    public boolean equals(Object rhs) {
        if (this == rhs) return true;
        if (!(rhs instanceof ChannelSettings)) {
            return false;
        }
        ChannelSettings channel = (ChannelSettings) rhs;
        if (channel == null) {
            return false;
        }
        return frequency == channel.frequency;
    }

    /** override hash code */
    @Override
    public int hashCode() {
        return Objects.hash(frequency);
    }

    /** implement Parcelable interface */
    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * implement Parcelable interface
     * |flags| is ignored.
     **/
    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(frequency);
    }

    /** implement Parcelable interface */
    public static final Parcelable.Creator<ChannelSettings> CREATOR =
            new Parcelable.Creator<ChannelSettings>() {
        /**
         * Caller is responsible for providing a valid parcel.
         */
        @Override
        public ChannelSettings createFromParcel(Parcel in) {
            ChannelSettings result = new ChannelSettings();
            result.frequency = in.readInt();
            if (in.dataAvail() != 0) {
                Log.e(TAG, "Found trailing data after parcel parsing.");
            }

            return result;
        }

        @Override
        public ChannelSettings[] newArray(int size) {
            return new ChannelSettings[size];
        }
    };
}
Loading