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

Commit 02214760 authored by Roshan Pius's avatar Roshan Pius
Browse files

WifiManager: Deprecate API implementation

Changes:
a) Pass the calling package name in the AIDL call to allow target-SDK
checks & error logging on the service side (similar to other binder calls).
b) Pass the return value from service for AIDL calls: disconnect,
reconnect, reassociate.
c) Return false for a previously deprecated saveWifiConfiguration API.

Bug: 115504728
Test: Compiles
Change-Id: I9bc9c8fc5857a430242e5afbecca7fc2c39f1ca1
parent 4df6418f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ interface IWifiManager
     */
    oneway void requestActivityInfo(in ResultReceiver result);

    ParceledListSlice getConfiguredNetworks();
    ParceledListSlice getConfiguredNetworks(String packageName);

    ParceledListSlice getPrivilegedConfiguredNetworks();

@@ -90,11 +90,11 @@ interface IWifiManager

    List<ScanResult> getScanResults(String callingPackage);

    void disconnect(String packageName);
    boolean disconnect(String packageName);

    void reconnect(String packageName);
    boolean reconnect(String packageName);

    void reassociate(String packageName);
    boolean reassociate(String packageName);

    WifiInfo getConnectionInfo(String callingPackage);

+6 −9
Original line number Diff line number Diff line
@@ -1067,7 +1067,7 @@ public class WifiManager {
    public List<WifiConfiguration> getConfiguredNetworks() {
        try {
            ParceledListSlice<WifiConfiguration> parceledList =
                mService.getConfiguredNetworks();
                    mService.getConfiguredNetworks(mContext.getOpPackageName());
            if (parceledList == null) {
                return Collections.emptyList();
            }
@@ -1761,8 +1761,7 @@ public class WifiManager {
    @Deprecated
    public boolean disconnect() {
        try {
            mService.disconnect(mContext.getOpPackageName());
            return true;
            return mService.disconnect(mContext.getOpPackageName());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -1786,8 +1785,7 @@ public class WifiManager {
    @Deprecated
    public boolean reconnect() {
        try {
            mService.reconnect(mContext.getOpPackageName());
            return true;
            return mService.reconnect(mContext.getOpPackageName());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -1811,8 +1809,7 @@ public class WifiManager {
    @Deprecated
    public boolean reassociate() {
        try {
            mService.reassociate(mContext.getOpPackageName());
            return true;
            return mService.reassociate(mContext.getOpPackageName());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2132,14 +2129,14 @@ public class WifiManager {
     * existing networks. You should assume the network IDs can be different
     * after calling this method.
     *
     * @return {@code false} Will always return true.
     * @return {@code false}.
     * @deprecated There is no need to call this method -
     * {@link #addNetwork(WifiConfiguration)}, {@link #updateNetwork(WifiConfiguration)}
     * and {@link #removeNetwork(int)} already persist the configurations automatically.
     */
    @Deprecated
    public boolean saveConfiguration() {
        return true;
        return false;
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public abstract class AbstractWifiService extends IWifiManager.Stub {
    }

    @Override
    public ParceledListSlice getConfiguredNetworks() {
    public ParceledListSlice getConfiguredNetworks(String packageName) {
        throw new UnsupportedOperationException();
    }

@@ -188,17 +188,17 @@ public abstract class AbstractWifiService extends IWifiManager.Stub {
    }

    @Override
    public void disconnect(String packageName) {
    public boolean disconnect(String packageName) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void reconnect(String packageName) {
    public boolean reconnect(String packageName) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void reassociate(String packageName) {
    public boolean reassociate(String packageName) {
        throw new UnsupportedOperationException();
    }