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

Commit ae2a7d06 authored by David Su's avatar David Su Committed by Android (Google) Code Review
Browse files

Merge "WifiManager: Remove sync version of getWifiActivityEnergyInfo"

parents ed7b0210 e4b59bcf
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import android.net.wifi.WifiNetworkSuggestion;
import android.os.Messenger;
import android.os.ResultReceiver;
import android.os.WorkSource;
import android.os.connectivity.WifiActivityEnergyInfo;

/**
 * Interface that allows controlling and querying Wi-Fi connectivity.
@@ -55,8 +54,6 @@ interface IWifiManager
{
    long getSupportedFeatures();

    WifiActivityEnergyInfo reportActivityInfo();

    oneway void getWifiActivityEnergyInfoAsync(in IOnWifiActivityEnergyInfoListener listener);

    ParceledListSlice getConfiguredNetworks(String packageName, String featureId);
+0 −19
Original line number Diff line number Diff line
@@ -2378,25 +2378,6 @@ public class WifiManager {
        return isFeatureSupported(WIFI_FEATURE_AP_RAND_MAC);
    }

    /**
     * Return the record of {@link WifiActivityEnergyInfo} object that
     * has the activity and energy info. This can be used to ascertain what
     * the controller has been up to, since the last sample.
     *
     * @return a record with {@link WifiActivityEnergyInfo} or null if
     * report is unavailable or unsupported
     * @hide
     */
    public WifiActivityEnergyInfo getControllerActivityEnergyInfo() {
        try {
            synchronized(this) {
                return mService.reportActivityInfo();
            }
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Interface for Wi-Fi activity energy info listener. Should be implemented by applications and
     * set when calling {@link WifiManager#getWifiActivityEnergyInfoAsync}.
+4 −1
Original line number Diff line number Diff line
@@ -76,11 +76,14 @@ public class BaseWifiService extends IWifiManager.Stub {
        throw new UnsupportedOperationException();
    }

    @Override
    /** @deprecated use {@link #getWifiActivityEnergyInfoAsync} instead */
    @Deprecated
    public WifiActivityEnergyInfo reportActivityInfo() {
        throw new UnsupportedOperationException();
    }

    /** @deprecated use {@link #getWifiActivityEnergyInfoAsync} instead */
    @Deprecated
    public void requestActivityInfo(ResultReceiver result) {
        throw new UnsupportedOperationException();
    }
+0 −12
Original line number Diff line number Diff line
@@ -1707,18 +1707,6 @@ public class WifiManagerTest {
        assertFalse(mWifiManager.isEnhancedPowerReportingSupported());
    }

    /**
     * Test behavior of {@link WifiManager#getControllerActivityEnergyInfo()}
     */
    @Test
    public void testGetControllerActivityEnergyInfo() throws Exception {
        WifiActivityEnergyInfo activityEnergyInfo =
                new WifiActivityEnergyInfo(5, 3, 3, 5, 5, 5);
        when(mWifiService.reportActivityInfo()).thenReturn(activityEnergyInfo);

        assertEquals(activityEnergyInfo, mWifiManager.getControllerActivityEnergyInfo());
    }

    /**
     * Tests that passing a null Executor to {@link WifiManager#getWifiActivityEnergyInfoAsync}
     * throws an exception.