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

Commit dcb850c5 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Pipe through featureId from calling context to wifi location checking

code

Bug: 136595429
Test: atest FrameworksWifiTests FrameworksWifiApiTests
Change-Id: I7e1090e6e618dcd9e67b64c0f4c29934c8e1a69e
parent 4542a9eb
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -64,9 +64,9 @@ interface IWifiManager
     */
    oneway void requestActivityInfo(in ResultReceiver result);

    ParceledListSlice getConfiguredNetworks(String packageName);
    ParceledListSlice getConfiguredNetworks(String packageName, String featureId);

    ParceledListSlice getPrivilegedConfiguredNetworks(String packageName);
    ParceledListSlice getPrivilegedConfiguredNetworks(String packageName, String featureId);

    Map getAllMatchingFqdnsForScanResults(in List<ScanResult> scanResult);

@@ -98,9 +98,9 @@ interface IWifiManager

    void allowAutojoin(int netId, boolean choice);

    boolean startScan(String packageName);
    boolean startScan(String packageName, String featureId);

    List<ScanResult> getScanResults(String callingPackage);
    List<ScanResult> getScanResults(String callingPackage, String callingFeatureId);

    boolean disconnect(String packageName);

@@ -108,7 +108,7 @@ interface IWifiManager

    boolean reassociate(String packageName);

    WifiInfo getConnectionInfo(String callingPackage);
    WifiInfo getConnectionInfo(String callingPackage, String callingFeatureId);

    boolean setWifiEnabled(String packageName, boolean enable);

@@ -145,7 +145,7 @@ interface IWifiManager
    boolean stopSoftAp();

    int startLocalOnlyHotspot(in ILocalOnlyHotspotCallback callback, String packageName,
                              in SoftApConfiguration customConfig);
                              String featureId, in SoftApConfiguration customConfig);

    void stopLocalOnlyHotspot();

@@ -206,7 +206,8 @@ interface IWifiManager

    void unregisterNetworkRequestMatchCallback(int callbackIdentifier);

    int addNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName);
    int addNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName,
        in String featureId);

    int removeNetworkSuggestions(in List<WifiNetworkSuggestion> networkSuggestions, in String packageName);

@@ -238,7 +239,7 @@ interface IWifiManager

    void unregisterScanResultsListener(int listenerIdentifier);

    void registerSuggestionConnectionStatusListener(in IBinder binder, in ISuggestionConnectionStatusListener listener, int listenerIdentifier, String packageName);
    void registerSuggestionConnectionStatusListener(in IBinder binder, in ISuggestionConnectionStatusListener listener, int listenerIdentifier, String packageName, String featureId);

    void unregisterSuggestionConnectionStatusListener(int listenerIdentifier, String packageName);
}
+1 −1
Original line number Diff line number Diff line
@@ -26,5 +26,5 @@ interface IWifiScanner
{
    Messenger getMessenger();

    Bundle getAvailableChannels(int band, String packageName);
    Bundle getAvailableChannels(int band, String packageName, String featureId);
}
+15 −8
Original line number Diff line number Diff line
@@ -1254,7 +1254,8 @@ public class WifiManager {
            IWifiManager iWifiManager = getIWifiManager();
            if (iWifiManager == null) return Collections.emptyList();
            ParceledListSlice<WifiConfiguration> parceledList =
                    iWifiManager.getConfiguredNetworks(mContext.getOpPackageName());
                    iWifiManager.getConfiguredNetworks(mContext.getOpPackageName(),
                            mContext.getFeatureId());
            if (parceledList == null) {
                return Collections.emptyList();
            }
@@ -1272,7 +1273,8 @@ public class WifiManager {
            IWifiManager iWifiManager = getIWifiManager();
            if (iWifiManager == null) return Collections.emptyList();
            ParceledListSlice<WifiConfiguration> parceledList =
                    iWifiManager.getPrivilegedConfiguredNetworks(mContext.getOpPackageName());
                    iWifiManager.getPrivilegedConfiguredNetworks(mContext.getOpPackageName(),
                            mContext.getFeatureId());
            if (parceledList == null) {
                return Collections.emptyList();
            }
@@ -1764,7 +1766,7 @@ public class WifiManager {
            IWifiManager iWifiManager = getIWifiManager();
            if (iWifiManager == null) return STATUS_NETWORK_SUGGESTIONS_ERROR_INTERNAL;
            return iWifiManager.addNetworkSuggestions(
                    networkSuggestions, mContext.getOpPackageName());
                    networkSuggestions, mContext.getOpPackageName(), mContext.getFeatureId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2449,7 +2451,8 @@ public class WifiManager {
            IWifiManager iWifiManager = getIWifiManager();
            if (iWifiManager == null) return false;
            String packageName = mContext.getOpPackageName();
            return iWifiManager.startScan(packageName);
            String featureId = mContext.getFeatureId();
            return iWifiManager.startScan(packageName, featureId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2480,7 +2483,8 @@ public class WifiManager {
        try {
            IWifiManager iWifiManager = getIWifiManager();
            if (iWifiManager == null) return null;
            return iWifiManager.getConnectionInfo(mContext.getOpPackageName());
            return iWifiManager.getConnectionInfo(mContext.getOpPackageName(),
                    mContext.getFeatureId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2496,7 +2500,8 @@ public class WifiManager {
        try {
            IWifiManager iWifiManager = getIWifiManager();
            if (iWifiManager == null) return Collections.emptyList();
            return iWifiManager.getScanResults(mContext.getOpPackageName());
            return iWifiManager.getScanResults(mContext.getOpPackageName(),
                    mContext.getFeatureId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2914,7 +2919,9 @@ public class WifiManager {
                    throw new RemoteException("Wifi service is not running");
                }
                String packageName = mContext.getOpPackageName();
                int returnCode = iWifiManager.startLocalOnlyHotspot(proxy, packageName, config);
                String featureId = mContext.getFeatureId();
                int returnCode = iWifiManager.startLocalOnlyHotspot(proxy, packageName, featureId,
                        config);
                if (returnCode != LocalOnlyHotspotCallback.REQUEST_REGISTERED) {
                    // Send message to the proxy to make sure we call back on the correct thread
                    proxy.onHotspotFailed(returnCode);
@@ -5439,7 +5446,7 @@ public class WifiManager {
            }
            iWifiManager.registerSuggestionConnectionStatusListener(new Binder(),
                    new SuggestionConnectionStatusListenerProxy(executor, listener),
                    listener.hashCode(), mContext.getOpPackageName());
                    listener.hashCode(), mContext.getOpPackageName(), mContext.getFeatureId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+10 −1
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ public class WifiScanner {
    @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
    public List<Integer> getAvailableChannels(@WifiBand int band) {
        try {
            Bundle bundle = mService.getAvailableChannels(band, mContext.getOpPackageName());
            Bundle bundle = mService.getAvailableChannels(band, mContext.getOpPackageName(),
                    mContext.getFeatureId());
            List<Integer> channels = bundle.getIntegerArrayList(GET_AVAILABLE_CHANNELS_EXTRA);
            return channels == null ? new ArrayList<>() : channels;
        } catch (RemoteException e) {
@@ -220,6 +221,8 @@ public class WifiScanner {
    public static final String SCAN_PARAMS_WORK_SOURCE_KEY = "WorkSource";
    /** {@hide} */
    public static final String REQUEST_PACKAGE_NAME_KEY = "PackageName";
    /** {@hide} */
    public static final String REQUEST_FEATURE_ID_KEY = "FeatureId";

    /**
     * scan configuration parameters to be sent to {@link #startBackgroundScan}
@@ -864,6 +867,7 @@ public class WifiScanner {
        scanParams.putParcelable(SCAN_PARAMS_SCAN_SETTINGS_KEY, settings);
        scanParams.putParcelable(SCAN_PARAMS_WORK_SOURCE_KEY, workSource);
        scanParams.putString(REQUEST_PACKAGE_NAME_KEY, mContext.getOpPackageName());
        scanParams.putString(REQUEST_FEATURE_ID_KEY, mContext.getFeatureId());
        mAsyncChannel.sendMessage(CMD_START_BACKGROUND_SCAN, 0, key, scanParams);
    }

@@ -880,6 +884,7 @@ public class WifiScanner {
        validateChannel();
        Bundle scanParams = new Bundle();
        scanParams.putString(REQUEST_PACKAGE_NAME_KEY, mContext.getOpPackageName());
        scanParams.putString(REQUEST_FEATURE_ID_KEY, mContext.getFeatureId());
        mAsyncChannel.sendMessage(CMD_STOP_BACKGROUND_SCAN, 0, key, scanParams);
    }

@@ -892,6 +897,7 @@ public class WifiScanner {
        validateChannel();
        Bundle scanParams = new Bundle();
        scanParams.putString(REQUEST_PACKAGE_NAME_KEY, mContext.getOpPackageName());
        scanParams.putString(REQUEST_FEATURE_ID_KEY, mContext.getFeatureId());
        Message reply =
                mAsyncChannel.sendMessageSynchronously(CMD_GET_SCAN_RESULTS, 0, 0, scanParams);
        return reply.what == CMD_OP_SUCCEEDED;
@@ -929,6 +935,7 @@ public class WifiScanner {
        scanParams.putParcelable(SCAN_PARAMS_SCAN_SETTINGS_KEY, settings);
        scanParams.putParcelable(SCAN_PARAMS_WORK_SOURCE_KEY, workSource);
        scanParams.putString(REQUEST_PACKAGE_NAME_KEY, mContext.getOpPackageName());
        scanParams.putString(REQUEST_FEATURE_ID_KEY, mContext.getFeatureId());
        mAsyncChannel.sendMessage(CMD_START_SINGLE_SCAN, 0, key, scanParams);
    }

@@ -945,6 +952,7 @@ public class WifiScanner {
        validateChannel();
        Bundle scanParams = new Bundle();
        scanParams.putString(REQUEST_PACKAGE_NAME_KEY, mContext.getOpPackageName());
        scanParams.putString(REQUEST_FEATURE_ID_KEY, mContext.getFeatureId());
        mAsyncChannel.sendMessage(CMD_STOP_SINGLE_SCAN, 0, key, scanParams);
    }

@@ -956,6 +964,7 @@ public class WifiScanner {
        validateChannel();
        Bundle scanParams = new Bundle();
        scanParams.putString(REQUEST_PACKAGE_NAME_KEY, mContext.getOpPackageName());
        scanParams.putString(REQUEST_FEATURE_ID_KEY, mContext.getFeatureId());
        Message reply = mAsyncChannel.sendMessageSynchronously(CMD_GET_SINGLE_SCAN_RESULTS, 0, 0,
                scanParams);
        if (reply.what == WifiScanner.CMD_OP_SUCCEEDED) {
+7 −6
Original line number Diff line number Diff line
@@ -38,14 +38,15 @@ interface IWifiAwareManager
    Characteristics getCharacteristics();

    // client API
    void connect(in IBinder binder, in String callingPackage, in IWifiAwareEventCallback callback,
            in ConfigRequest configRequest, boolean notifyOnIdentityChanged);
    void connect(in IBinder binder, in String callingPackage, in String callingFeatureId,
            in IWifiAwareEventCallback callback, in ConfigRequest configRequest,
            boolean notifyOnIdentityChanged);
    void disconnect(int clientId, in IBinder binder);

    void publish(in String callingPackage, int clientId, in PublishConfig publishConfig,
            in IWifiAwareDiscoverySessionCallback callback);
    void subscribe(in String callingPackage, int clientId, in SubscribeConfig subscribeConfig,
            in IWifiAwareDiscoverySessionCallback callback);
    void publish(in String callingPackage, in String callingFeatureId, int clientId,
            in PublishConfig publishConfig, in IWifiAwareDiscoverySessionCallback callback);
    void subscribe(in String callingPackage, in String callingFeatureId, int clientId,
            in SubscribeConfig subscribeConfig, in IWifiAwareDiscoverySessionCallback callback);

    // session API
    void updatePublish(int clientId, int discoverySessionId, in PublishConfig publishConfig);
Loading