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

Commit 718a0487 authored by Roshan Pius's avatar Roshan Pius Committed by Android (Google) Code Review
Browse files

Merge changes from topics "clientmodeimpl_api_cleanup",...

Merge changes from topics "clientmodeimpl_api_cleanup", "remove_wifi_set_country_code_api", "wifimanager_async_remove"

* changes:
  TestLooper: Some changes to test looper behavior
  WifiManager: Remove setCountryCode API
  WifiManager: Remove async channel usage
parents e75b4a7d f145e173
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4722,7 +4722,7 @@ package android.net.wifi {
    method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void addOnWifiUsabilityStatsListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.OnWifiUsabilityStatsListener);
    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(@NonNull android.net.wifi.WifiConfiguration, @Nullable android.net.wifi.WifiManager.ActionListener);
    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void connect(int, @Nullable android.net.wifi.WifiManager.ActionListener);
    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
    method @Deprecated @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void disable(int, @Nullable android.net.wifi.WifiManager.ActionListener);
    method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD, "android.permission.NETWORK_STACK"}) public void forget(int, @Nullable android.net.wifi.WifiManager.ActionListener);
    method @NonNull @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.util.Pair<android.net.wifi.WifiConfiguration,java.util.Map<java.lang.Integer,java.util.List<android.net.wifi.ScanResult>>>> getAllMatchingWifiConfigs(@NonNull java.util.List<android.net.wifi.ScanResult>);
    method @NonNull @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.Map<android.net.wifi.hotspot2.OsuProvider,java.util.List<android.net.wifi.ScanResult>> getMatchingOsuProviders(@Nullable java.util.List<android.net.wifi.ScanResult>);
+27 −11
Original line number Diff line number Diff line
@@ -210,34 +210,37 @@ public class TestLooper {
        /**
         * Run method for the auto dispatch thread.
         * The thread loops a maximum of MAX_LOOPS times with a 10ms sleep between loops.
         * The thread continues looping and attempting to dispatch all messages until at
         * least one message has been dispatched.
         * The thread continues looping and attempting to dispatch all messages until
         * {@link #stopAutoDispatch()} has been invoked.
         */
        @Override
        public void run() {
            int dispatchCount = 0;
            for (int i = 0; i < MAX_LOOPS; i++) {
                try {
                    dispatchCount = dispatchAll();
                    dispatchCount += dispatchAll();
                } catch (RuntimeException e) {
                    mAutoDispatchException = e;
                }
                Log.d(TAG, "dispatched " + dispatchCount + " messages");
                if (dispatchCount > 0) {
                    return;
                }
                Log.d(TAG, "dispatched " + dispatchCount + " messages");
                try {
                    Thread.sleep(LOOP_SLEEP_TIME_MS);
                } catch (InterruptedException e) {
                    if (dispatchCount == 0) {
                        Log.e(TAG, "stopAutoDispatch called before any messages were dispatched.");
                        mAutoDispatchException = new IllegalStateException(
                                "stopAutoDispatch called before any messages were dispatched.");
                    }
                    return;
                }
            }
            if (dispatchCount == 0) {
                Log.e(TAG, "AutoDispatchThread did not dispatch any messages.");
                mAutoDispatchException = new IllegalStateException(
                        "TestLooper did not dispatch any messages before exiting.");
            }
        }

        /**
         * Method allowing the TestLooper to pass any exceptions thrown by the thread to be passed
@@ -287,4 +290,17 @@ public class TestLooper {
                    "stopAutoDispatch called without startAutoDispatch.");
        }
    }

    /**
     * If an AutoDispatchThread is currently running, stop and clean up.
     * This method ignores exceptions raised for indicating that no messages were dispatched.
     */
    public void stopAutoDispatchAndIgnoreExceptions() {
        try {
            stopAutoDispatch();
        } catch (IllegalStateException e) {
            Log.e(TAG, "stopAutoDispatch", e);
        }

    }
}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 * Copyright (C) 2019 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.
@@ -16,60 +16,12 @@

package android.net.wifi;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Bundle of RSSI and packet count information, for WiFi watchdog
 *
 * @see WifiWatchdogStateMachine
 *
 * Interface for generic wifi callbacks.
 * @hide
 */
public class RssiPacketCountInfo implements Parcelable {

    public int rssi;

    public int txgood;

    public int txbad;

    public int rxgood;

    public RssiPacketCountInfo() {
        rssi = txgood = txbad = rxgood = 0;
    }

    private RssiPacketCountInfo(Parcel in) {
        rssi = in.readInt();
        txgood = in.readInt();
        txbad = in.readInt();
        rxgood = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(rssi);
        out.writeInt(txgood);
        out.writeInt(txbad);
        out.writeInt(rxgood);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final @android.annotation.NonNull Parcelable.Creator<RssiPacketCountInfo> CREATOR =
            new Parcelable.Creator<RssiPacketCountInfo>() {
        @Override
        public RssiPacketCountInfo createFromParcel(Parcel in) {
            return new RssiPacketCountInfo(in);
        }

        @Override
        public RssiPacketCountInfo[] newArray(int size) {
            return new RssiPacketCountInfo[size];
        }
    };
oneway interface IActionListener
{
    void onSuccess();
    void onFailure(int reason);
}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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;

/**
 * Interface for tx packet counter callback.
 * @hide
 */
oneway interface ITxPacketCountListener
{
    void onSuccess(int count);
    void onFailure(int reason);
}
+10 −4
Original line number Diff line number Diff line
@@ -24,10 +24,12 @@ import android.net.wifi.hotspot2.IProvisioningCallback;

import android.net.DhcpInfo;
import android.net.Network;
import android.net.wifi.IActionListener;
import android.net.wifi.IDppCallback;
import android.net.wifi.INetworkRequestMatchCallback;
import android.net.wifi.ISoftApCallback;
import android.net.wifi.ITrafficStateCallback;
import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.IOnWifiUsabilityStatsListener;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiActivityEnergyInfo;
@@ -106,8 +108,6 @@ interface IWifiManager

    int getWifiEnabledState();

    void setCountryCode(String country);

    String getCountryCode();

    boolean isDualBandSupported();
@@ -156,8 +156,6 @@ interface IWifiManager

    void notifyUserOfApBandConversion(String packageName);

    Messenger getWifiServiceMessenger(String packageName);

    void enableTdls(String remoteIPAddress, boolean enable);

    void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable);
@@ -220,4 +218,12 @@ interface IWifiManager
    void stopDppSession();

    void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec);

    oneway void connect(in WifiConfiguration config, int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);

    oneway void save(in WifiConfiguration config, in IBinder binder, in IActionListener listener, int callbackIdentifier);

    oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier);

    oneway void getTxPacketCount(String packageName, in IBinder binder, in ITxPacketCountListener listener, int callbackIdentifier);
}
Loading