summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/system-current.txt1
-rw-r--r--api/test-current.txt1
-rw-r--r--core/java/android/content/Context.java8
-rw-r--r--core/java/android/content/pm/PermissionInfo.java15
-rw-r--r--core/res/AndroidManifest.xml6
-rw-r--r--core/res/res/values/attrs_manifest.xml3
-rw-r--r--core/res/res/values/config.xml8
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--data/etc/privapp-permissions-platform.xml18
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java35
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java9
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java1
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeHotspotController.java4
-rw-r--r--services/Android.bp2
-rw-r--r--services/core/java/android/content/pm/PackageManagerInternal.java2
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java4
-rw-r--r--services/core/java/com/android/server/pm/permission/BasePermission.java3
-rw-r--r--services/core/java/com/android/server/pm/permission/PermissionManagerService.java7
-rw-r--r--services/java/com/android/server/SystemServer.java43
-rw-r--r--services/wifi/Android.bp16
-rw-r--r--services/wifi/java/android/net/wifi/IWifiStackConnector.aidl23
-rw-r--r--services/wifi/java/android/net/wifi/WifiStackClient.java100
-rw-r--r--wifi/java/android/net/wifi/WifiFrameworkInitializer.java5
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java507
28 files changed, 155 insertions, 678 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 9c975c154ed9..5313bef5575a 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1843,7 +1843,6 @@ package android.content.pm {
field public static final int PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER = 65536; // 0x10000
field public static final int PROTECTION_FLAG_TELEPHONY = 4194304; // 0x400000
field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
- field public static final int PROTECTION_FLAG_WIFI = 8388608; // 0x800000
field @Nullable public final String backgroundPermission;
field @StringRes public int requestRes;
}
diff --git a/api/test-current.txt b/api/test-current.txt
index dacc5d67b730..e590f2bcc87a 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -812,7 +812,6 @@ package android.content.pm {
field public static final int PROTECTION_FLAG_TELEPHONY = 4194304; // 0x400000
field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
field public static final int PROTECTION_FLAG_WELLBEING = 131072; // 0x20000
- field public static final int PROTECTION_FLAG_WIFI = 8388608; // 0x800000
field @Nullable public final String backgroundPermission;
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 0fdb51359cf9..226af9ed0baa 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -3864,14 +3864,6 @@ public abstract class Context {
public static final String NETWORK_STACK_SERVICE = "network_stack";
/**
- * Use with {@link android.os.ServiceManager.getService()} to retrieve a
- * {@link android.net.WifiStackClient} IBinder for communicating with the network stack
- * @hide
- * @see android.net.WifiStackClient
- */
- public static final String WIFI_STACK_SERVICE = "wifi_stack";
-
- /**
* Use with {@link #getSystemService(String)} to retrieve a
* {@link android.net.IpSecManager} for encrypting Sockets or Networks with
* IPSec.
diff --git a/core/java/android/content/pm/PermissionInfo.java b/core/java/android/content/pm/PermissionInfo.java
index aa6f58e82bcf..c77c53f387e2 100644
--- a/core/java/android/content/pm/PermissionInfo.java
+++ b/core/java/android/content/pm/PermissionInfo.java
@@ -248,17 +248,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
@TestApi
public static final int PROTECTION_FLAG_TELEPHONY = 0x400000;
- /**
- * Additional flag for {@link #protectionLevel}, corresponding
- * to the <code>wifi</code> value of
- * {@link android.R.attr#protectionLevel}.
- *
- * @hide
- */
- @SystemApi
- @TestApi
- public static final int PROTECTION_FLAG_WIFI = 0x800000;
-
/** @hide */
@IntDef(flag = true, prefix = { "PROTECTION_FLAG_" }, value = {
PROTECTION_FLAG_PRIVILEGED,
@@ -281,7 +270,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
PROTECTION_FLAG_INCIDENT_REPORT_APPROVER,
PROTECTION_FLAG_APP_PREDICTOR,
PROTECTION_FLAG_TELEPHONY,
- PROTECTION_FLAG_WIFI,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ProtectionFlags {}
@@ -528,9 +516,6 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {
if ((level & PermissionInfo.PROTECTION_FLAG_TELEPHONY) != 0) {
protLevel += "|telephony";
}
- if ((level & PermissionInfo.PROTECTION_FLAG_WIFI) != 0) {
- protLevel += "|wifi";
- }
return protLevel;
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 5e93b32a66a3..577f6c68b89c 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2269,7 +2269,7 @@
types of interactions
@hide -->
<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
- android:protectionLevel="signature|installer|telephony|wifi" />
+ android:protectionLevel="signature|installer|telephony" />
<!-- @SystemApi Allows an application to start its own activities, but on a different profile
associated with the user. For example, an application running on the main profile of a user
@@ -2951,7 +2951,7 @@
@hide
-->
<permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"
- android:protectionLevel="signature|telephony|wifi" />
+ android:protectionLevel="signature|telephony" />
<!-- @SystemApi Allows an application to use
{@link android.view.WindowManager.LayoutsParams#SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS}
@@ -3542,7 +3542,7 @@
<!-- Allows an application to manage the companion devices.
@hide -->
<permission android:name="android.permission.MANAGE_COMPANION_DEVICES"
- android:protectionLevel="signature|wifi" />
+ android:protectionLevel="signature" />
<!-- @SystemApi Allows an application to use SurfaceFlinger's low level features.
<p>Not for use by third-party applications.
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index ffcfe4310f06..166cde0d7005 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -298,9 +298,6 @@
<!-- Additional flag from base permission type: this permission can be automatically
granted to the system telephony apps -->
<flag name="telephony" value="0x400000" />
- <!-- Additional flag from base permission type: this permission can be automatically
- granted to the system wifi app-->
- <flag name="wifi" value="0x800000" />
</attr>
<!-- Flags indicating more context for a permission group. -->
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 74bb2cf6658d..b91a31553cb2 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3517,6 +3517,7 @@
-->
<string name="config_defaultWellbeingPackage" translatable="false"></string>
+
<!-- The package name for the system telephony apps.
This package must be trusted, as it will be granted with permissions with special telephony
protection level. Note, framework by default support multiple telephony apps, each package
@@ -3525,13 +3526,6 @@
-->
<string name="config_telephonyPackages" translatable="false">"com.android.phone,com.android.stk,com.android.providers.telephony,com.android.ons,com.android.cellbroadcastservice"</string>
- <!-- The package name for the default system wifi app.
- This package must be trusted, as it has the permissions to control wifi
- connectivity on the device.
- Example: "com.android.wifi"
- -->
- <string name="config_wifiPackage" translatable="false">"com.android.wifi"</string>
-
<!-- The component name for the default system attention service.
This service must be trusted, as it can be activated without explicit consent of the user.
See android.attention.AttentionManagerService.
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 1d5133901064..79201f6dfad5 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3360,7 +3360,6 @@
<java-symbol type="array" name="config_defaultTextClassifierPackages" />
<java-symbol type="string" name="config_defaultWellbeingPackage" />
<java-symbol type="string" name="config_telephonyPackages" />
- <java-symbol type="string" name="config_wifiPackage" />
<java-symbol type="string" name="config_defaultContentCaptureService" />
<java-symbol type="string" name="config_defaultAugmentedAutofillService" />
<java-symbol type="string" name="config_defaultAppPredictionService" />
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index fe539e4ca22b..f2a6452d6e44 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -367,22 +367,4 @@ applications that come with the platform
<permission name="android.permission.REBOOT"/>
<permission name="android.permission.MANAGE_DYNAMIC_SYSTEM"/>
</privapp-permissions>
-
- <privapp-permissions package="com.android.wifi">
- <permission name="android.permission.CHANGE_CONFIGURATION"/>
- <permission name="android.permission.CONNECTIVITY_INTERNAL"/>
- <permission name="android.permission.DUMP"/>
- <permission name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
- <permission name="android.permission.INTERNAL_SYSTEM_WINDOW"/>
- <permission name="android.permission.LOCAL_MAC_ADDRESS"/>
- <permission name="android.permission.MANAGE_USERS"/>
- <permission name="android.permission.PACKAGE_USAGE_STATS"/>
- <permission name="android.permission.READ_DEVICE_CONFIG"/>
- <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
- <permission name="android.permission.REQUEST_NETWORK_SCORES"/>
- <permission name="android.permission.WRITE_SECURE_SETTINGS"/>
- <permission name="android.permission.UPDATE_DEVICE_STATS"/>
- <permission name="android.permission.UPDATE_APP_OPS_STATS"/>
- <permission name="android.permission.LOCATION_HARDWARE"/>
- </privapp-permissions>
</permissions>
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
index 23754c5c73f9..23b16e811606 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/WifiTracker.java
@@ -224,9 +224,7 @@ public class WifiTracker implements LifecycleObserver, OnStart, OnStop, OnDestro
mConnectivityManager = connectivityManager;
// check if verbose logging developer option has been turned on or off
- sVerboseLogging = Settings.Global.getInt(
- mContext.getContentResolver(),
- Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED, 0) > 0;
+ sVerboseLogging = mWifiManager != null && (mWifiManager.getVerboseLoggingLevel() > 0);
mFilter = filter;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
index 16a39750a9bd..001e09406e3a 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/HotspotTile.java
@@ -73,7 +73,6 @@ public class HotspotTile extends QSTileImpl<BooleanState> {
if (listening) {
refreshState();
}
- mHotspotController.handleSetListening(listening);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java
index 8b06a9fa05a1..830b50e35490 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotController.java
@@ -20,8 +20,6 @@ import com.android.systemui.Dumpable;
import com.android.systemui.statusbar.policy.HotspotController.Callback;
public interface HotspotController extends CallbackController<Callback>, Dumpable {
- void handleSetListening(boolean listening);
-
boolean isHotspotEnabled();
boolean isHotspotTransient();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
index 6331a2d6db1c..cd6ec05d90ec 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java
@@ -54,7 +54,6 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof
private int mHotspotState;
private volatile int mNumConnectedDevices;
private boolean mWaitingForTerminalState;
- private boolean mListening;
/**
* Controller used to retrieve information related to a hotspot.
@@ -109,19 +108,14 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof
if (DEBUG) Log.d(TAG, "addCallback " + callback);
mCallbacks.add(callback);
if (mWifiManager != null) {
- if (mListening) {
- if (mCallbacks.size() == 1) {
- mWifiManager.registerSoftApCallback(new HandlerExecutor(mMainHandler),
- this);
- } else {
- // mWifiManager#registerSoftApCallback triggers a call to
- // onConnectedClientsChanged on the Main Handler. In order to always update
- // the callback on added, we make this call when adding callbacks after the
- // first.
- mMainHandler.post(() ->
- callback.onHotspotChanged(isHotspotEnabled(),
- mNumConnectedDevices));
- }
+ if (mCallbacks.size() == 1) {
+ mWifiManager.registerSoftApCallback(new HandlerExecutor(mMainHandler), this);
+ } else {
+ // mWifiManager#registerSoftApCallback triggers a call to onNumClientsChanged
+ // on the Main Handler. In order to always update the callback on added, we
+ // make this call when adding callbacks after the first.
+ mMainHandler.post(() ->
+ callback.onHotspotChanged(isHotspotEnabled(), mNumConnectedDevices));
}
}
}
@@ -133,24 +127,13 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof
if (DEBUG) Log.d(TAG, "removeCallback " + callback);
synchronized (mCallbacks) {
mCallbacks.remove(callback);
- if (mCallbacks.isEmpty() && mWifiManager != null && mListening) {
+ if (mCallbacks.isEmpty() && mWifiManager != null) {
mWifiManager.unregisterSoftApCallback(this);
}
}
}
@Override
- public void handleSetListening(boolean listening) {
- // Wait for the first |handleSetListening(true))| to register softap callbacks (for lazy
- // registration of the softap callbacks).
- if (mListening || !listening) return;
- mListening = true;
- if (mCallbacks.size() >= 1) {
- mWifiManager.registerSoftApCallback(new HandlerExecutor(mMainHandler), this);
- }
- }
-
- @Override
public boolean isHotspotEnabled() {
return mHotspotState == WifiManager.WIFI_AP_STATE_ENABLED;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 05a4b290fb7b..24492bf3ca5b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -325,7 +325,6 @@ public class NetworkControllerImpl extends BroadcastReceiver
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
filter.addAction(ConnectivityManager.INET_CONDITION_ACTION);
filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
- filter.addAction(Intent.ACTION_BOOT_COMPLETED);
filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
mBroadcastDispatcher.registerReceiver(this, filter, mReceiverHandler);
mListening = true;
@@ -543,9 +542,6 @@ public class NetworkControllerImpl extends BroadcastReceiver
recalculateEmergency();
}
break;
- case Intent.ACTION_BOOT_COMPLETED:
- mWifiSignalController.handleBootCompleted();
- break;
case CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED:
mConfig = Config.readConfig(mContext);
mReceiverHandler.post(this::handleConfigurationChanged);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
index 5a4332105e57..e7d1c95db0e3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/WifiSignalController.java
@@ -38,7 +38,6 @@ import java.util.Objects;
public class WifiSignalController extends
SignalController<WifiSignalController.WifiState, SignalController.IconGroup> {
private final boolean mHasMobileData;
- private final WifiManager mWifiManager;
private final WifiStatusTracker mWifiTracker;
public WifiSignalController(Context context, boolean hasMobileData,
@@ -50,11 +49,13 @@ public class WifiSignalController extends
context.getSystemService(NetworkScoreManager.class);
ConnectivityManager connectivityManager =
context.getSystemService(ConnectivityManager.class);
- mWifiManager = wifiManager;
mWifiTracker = new WifiStatusTracker(mContext, wifiManager, networkScoreManager,
connectivityManager, this::handleStatusUpdated);
mWifiTracker.setListening(true);
mHasMobileData = hasMobileData;
+ if (wifiManager != null) {
+ wifiManager.registerTrafficStateCallback(new WifiTrafficStateCallback());
+ }
// WiFi only has one state.
mCurrentState.iconGroup = mLastState.iconGroup = new IconGroup(
"Wi-Fi Icons",
@@ -127,10 +128,6 @@ public class WifiSignalController extends
notifyListenersIfNecessary();
}
- public void handleBootCompleted() {
- mWifiManager.registerTrafficStateCallback(new WifiTrafficStateCallback());
- }
-
/**
* Handler to receive the data activity on wifi.
*/
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
index 811e6a06e607..631c580a490d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/HotspotControllerImplTest.java
@@ -77,7 +77,6 @@ public class HotspotControllerImplTest extends SysuiTestCase {
any(WifiManager.SoftApCallback.class));
mController = new HotspotControllerImpl(mContext, new Handler(mLooper.getLooper()));
- mController.handleSetListening(true);
}
@Test
diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeHotspotController.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeHotspotController.java
index c9681ac558f9..016160aea433 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeHotspotController.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeHotspotController.java
@@ -26,10 +26,6 @@ public class FakeHotspotController extends BaseLeakChecker<Callback> implements
}
@Override
- public void handleSetListening(boolean listening) {
- }
-
- @Override
public boolean isHotspotEnabled() {
return false;
}
diff --git a/services/Android.bp b/services/Android.bp
index 35dc44e0ac65..041631b74380 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -28,7 +28,6 @@ filegroup {
":services.usage-sources",
":services.usb-sources",
":services.voiceinteraction-sources",
- ":services.wifi-sources",
],
visibility: ["//visibility:private"],
}
@@ -68,7 +67,6 @@ java_library {
"services.usage",
"services.usb",
"services.voiceinteraction",
- "services.wifi",
"android.hidl.base-V1.0-java",
],
diff --git a/services/core/java/android/content/pm/PackageManagerInternal.java b/services/core/java/android/content/pm/PackageManagerInternal.java
index e67d736796b9..413a79dc6acd 100644
--- a/services/core/java/android/content/pm/PackageManagerInternal.java
+++ b/services/core/java/android/content/pm/PackageManagerInternal.java
@@ -61,7 +61,6 @@ public abstract class PackageManagerInternal {
public static final int PACKAGE_INCIDENT_REPORT_APPROVER = 10;
public static final int PACKAGE_APP_PREDICTOR = 11;
public static final int PACKAGE_TELEPHONY = 12;
- public static final int PACKAGE_WIFI = 13;
@IntDef(value = {
PACKAGE_SYSTEM,
PACKAGE_SETUP_WIZARD,
@@ -76,7 +75,6 @@ public abstract class PackageManagerInternal {
PACKAGE_INCIDENT_REPORT_APPROVER,
PACKAGE_APP_PREDICTOR,
PACKAGE_TELEPHONY,
- PACKAGE_WIFI,
})
@Retention(RetentionPolicy.SOURCE)
public @interface KnownPackage {}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index eebc8d7db81f..0e075b117b81 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -1492,7 +1492,6 @@ public class PackageManagerService extends IPackageManager.Stub
final @Nullable String mAppPredictionServicePackage;
final @Nullable String mIncidentReportApproverPackage;
final @Nullable String[] mTelephonyPackages;
- final @Nullable String mWifiPackage;
final @NonNull String mServicesSystemSharedLibraryPackageName;
final @NonNull String mSharedSystemSharedLibraryPackageName;
@@ -2974,7 +2973,6 @@ public class PackageManagerService extends IPackageManager.Stub
mAppPredictionServicePackage = getAppPredictionServicePackageName();
mIncidentReportApproverPackage = getIncidentReportApproverPackageName();
mTelephonyPackages = getTelephonyPackageNames();
- mWifiPackage = mContext.getString(R.string.config_wifiPackage);
// Now that we know all of the shared libraries, update all clients to have
// the correct library paths.
@@ -22938,8 +22936,6 @@ public class PackageManagerService extends IPackageManager.Stub
return filterOnlySystemPackages(mAppPredictionServicePackage);
case PackageManagerInternal.PACKAGE_TELEPHONY:
return filterOnlySystemPackages(mTelephonyPackages);
- case PackageManagerInternal.PACKAGE_WIFI:
- return filterOnlySystemPackages(mWifiPackage);
default:
return ArrayUtils.emptyArray(String.class);
}
diff --git a/services/core/java/com/android/server/pm/permission/BasePermission.java b/services/core/java/com/android/server/pm/permission/BasePermission.java
index 037912a66b3a..c39dcfefb2e8 100644
--- a/services/core/java/com/android/server/pm/permission/BasePermission.java
+++ b/services/core/java/com/android/server/pm/permission/BasePermission.java
@@ -279,9 +279,6 @@ public final class BasePermission {
public boolean isTelephony() {
return (protectionLevel & PermissionInfo.PROTECTION_FLAG_TELEPHONY) != 0;
}
- public boolean isWifi() {
- return (protectionLevel & PermissionInfo.PROTECTION_FLAG_WIFI) != 0;
- }
public void transfer(@NonNull String origPackageName, @NonNull String newPackageName) {
if (!origPackageName.equals(sourcePackageName)) {
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index e9aad4fa94d8..2ffba45be4a3 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -3292,13 +3292,6 @@ public class PermissionManagerService extends IPermissionManager.Stub {
// Special permissions for the system telephony apps.
allowed = true;
}
- if (!allowed && bp.isWifi()
- && ArrayUtils.contains(mPackageManagerInt.getKnownPackageNames(
- PackageManagerInternal.PACKAGE_WIFI, UserHandle.USER_SYSTEM),
- pkg.packageName)) {
- // Special permissions for the system wifi.
- allowed = true;
- }
}
return allowed;
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index cb4e377c0110..f46857a26482 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -43,7 +43,6 @@ import android.database.sqlite.SQLiteGlobal;
import android.hardware.display.DisplayManagerInternal;
import android.net.ConnectivityModuleConnector;
import android.net.NetworkStackClient;
-import android.net.wifi.WifiStackClient;
import android.os.BaseBundle;
import android.os.Binder;
import android.os.Build;
@@ -1360,6 +1359,40 @@ public final class SystemServer {
t.traceEnd();
if (context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WIFI)) {
+ // Wifi Service must be started first for wifi-related services.
+ t.traceBegin("StartWifi");
+ mSystemServiceManager.startService(WIFI_SERVICE_CLASS);
+ t.traceEnd();
+ t.traceBegin("StartWifiScanning");
+ mSystemServiceManager.startService(
+ "com.android.server.wifi.scanner.WifiScanningService");
+ t.traceEnd();
+ }
+
+ if (context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WIFI_RTT)) {
+ t.traceBegin("StartRttService");
+ mSystemServiceManager.startService(
+ "com.android.server.wifi.rtt.RttService");
+ t.traceEnd();
+ }
+
+ if (context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WIFI_AWARE)) {
+ t.traceBegin("StartWifiAware");
+ mSystemServiceManager.startService(WIFI_AWARE_SERVICE_CLASS);
+ t.traceEnd();
+ }
+
+ if (context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WIFI_DIRECT)) {
+ t.traceBegin("StartWifiP2P");
+ mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS);
+ t.traceEnd();
+ }
+
+ if (context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_LOWPAN)) {
t.traceBegin("StartLowpan");
mSystemServiceManager.startService(LOWPAN_SERVICE_CLASS);
@@ -2171,14 +2204,6 @@ public final class SystemServer {
}
t.traceEnd();
- t.traceBegin("StartWifiStack");
- try {
- WifiStackClient.getInstance().start();
- } catch (Throwable e) {
- reportWtf("starting Wifi Stack", e);
- }
- t.traceEnd();
-
t.traceBegin("MakeCountryDetectionServiceReady");
try {
if (countryDetectorF != null) {
diff --git a/services/wifi/Android.bp b/services/wifi/Android.bp
deleted file mode 100644
index 8a7f73fcf501..000000000000
--- a/services/wifi/Android.bp
+++ /dev/null
@@ -1,16 +0,0 @@
-filegroup {
- name: "services.wifi-sources",
- srcs: [
- "java/**/*.java",
- "java/**/*.aidl",
- ],
- path: "java",
- visibility: ["//frameworks/base/services"],
-}
-
-// Interfaces between the core system and the wifi mainline module.
-java_library_static {
- name: "services.wifi",
- srcs: [":services.wifi-sources"],
- libs: ["services.net"],
-}
diff --git a/services/wifi/java/android/net/wifi/IWifiStackConnector.aidl b/services/wifi/java/android/net/wifi/IWifiStackConnector.aidl
deleted file mode 100644
index 3af4666b8d9c..000000000000
--- a/services/wifi/java/android/net/wifi/IWifiStackConnector.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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 perNmissions and
- * limitations under the License.
- */
-package android.net.wifi;
-
-import android.net.wifi.WifiApiServiceInfo;
-
-/** @hide */
-interface IWifiStackConnector {
- List<WifiApiServiceInfo> getWifiApiServiceInfos();
-}
diff --git a/services/wifi/java/android/net/wifi/WifiStackClient.java b/services/wifi/java/android/net/wifi/WifiStackClient.java
deleted file mode 100644
index dcdfbc54687c..000000000000
--- a/services/wifi/java/android/net/wifi/WifiStackClient.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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;
-
-import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH;
-import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
-
-import android.annotation.NonNull;
-import android.content.Context;
-import android.net.ConnectivityModuleConnector;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.util.Log;
-
-import java.util.List;
-
-/**
- * Service used to communicate with the wifi stack, which could be running in a separate
- * module.
- * @hide
- */
-public class WifiStackClient {
- public static final String PERMISSION_MAINLINE_WIFI_STACK =
- "android.permission.MAINLINE_WIFI_STACK";
-
- private static final String TAG = WifiStackClient.class.getSimpleName();
- private static WifiStackClient sInstance;
-
- private WifiStackClient() { }
-
- /**
- * Get the WifiStackClient singleton instance.
- */
- public static synchronized WifiStackClient getInstance() {
- if (sInstance == null) {
- sInstance = new WifiStackClient();
- }
- return sInstance;
- }
-
- private class WifiStackConnection implements
- ConnectivityModuleConnector.ModuleServiceCallback {
- @Override
- public void onModuleServiceConnected(IBinder service) {
- Log.i(TAG, "Wifi stack connected");
- registerWifiStackService(service);
-
- IWifiStackConnector connector = IWifiStackConnector.Stub.asInterface(service);
-
- List<WifiApiServiceInfo> wifiApiServiceInfos;
- try {
- wifiApiServiceInfos = connector.getWifiApiServiceInfos();
- } catch (RemoteException e) {
- throw new RuntimeException("Failed to getWifiApiServiceInfos()", e);
- }
-
- for (WifiApiServiceInfo wifiApiServiceInfo : wifiApiServiceInfos) {
- String serviceName = wifiApiServiceInfo.name;
- IBinder binder = wifiApiServiceInfo.binder;
- Log.i(TAG, "Registering " + serviceName);
- ServiceManager.addService(serviceName, binder);
- }
- }
- }
-
- private void registerWifiStackService(@NonNull IBinder service) {
- ServiceManager.addService(Context.WIFI_STACK_SERVICE, service,
- false /* allowIsolated */,
- DUMP_FLAG_PRIORITY_HIGH | DUMP_FLAG_PRIORITY_NORMAL);
- Log.i(TAG, "Wifi stack service registered");
- }
-
- /**
- * Start the wifi stack. Should be called only once on device startup.
- *
- * <p>This method will start the wifi stack either in the wifi stack
- * process, or inside the system server on devices that do not support the wifi stack
- * module.
- */
- public void start() {
- Log.i(TAG, "Starting wifi stack");
- ConnectivityModuleConnector.getInstance().startModuleService(
- IWifiStackConnector.class.getName(), PERMISSION_MAINLINE_WIFI_STACK,
- new WifiStackConnection());
- }
-}
diff --git a/wifi/java/android/net/wifi/WifiFrameworkInitializer.java b/wifi/java/android/net/wifi/WifiFrameworkInitializer.java
index 775043ae3291..002820b1bcc8 100644
--- a/wifi/java/android/net/wifi/WifiFrameworkInitializer.java
+++ b/wifi/java/android/net/wifi/WifiFrameworkInitializer.java
@@ -72,7 +72,10 @@ public class WifiFrameworkInitializer {
SystemServiceRegistry.registerContextAwareService(
Context.WIFI_SERVICE,
WifiManager.class,
- context -> new WifiManager(context, getInstanceLooper())
+ (context, serviceBinder) -> {
+ IWifiManager service = IWifiManager.Stub.asInterface(serviceBinder);
+ return new WifiManager(context, service, getInstanceLooper());
+ }
);
SystemServiceRegistry.registerStaticService(
Context.WIFI_P2P_SERVICE,
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 2a0211b77450..9f866f75c003 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -50,7 +50,6 @@ import android.os.HandlerExecutor;
import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.WorkSource;
import android.text.TextUtils;
import android.util.Log;
@@ -58,7 +57,6 @@ import android.util.Pair;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.util.ArrayUtils;
import com.android.server.net.NetworkPinner;
import dalvik.system.CloseGuard;
@@ -69,6 +67,7 @@ import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -1211,46 +1210,24 @@ public class WifiManager {
/**
* Create a new WifiManager instance.
* Applications will almost always want to use
- * {@link android.content.Context#getSystemService Context.getSystemService()} to retrieve
+ * {@link android.content.Context#getSystemService Context.getSystemService} to retrieve
* the standard {@link android.content.Context#WIFI_SERVICE Context.WIFI_SERVICE}.
*
* @param context the application context
+ * @param service the Binder interface
* @param looper the Looper used to deliver callbacks
- *
- * @hide
+ * @hide - hide this because it takes in a parameter of type IWifiManager, which
+ * is a system private class.
*/
- public WifiManager(@NonNull Context context, @NonNull Looper looper) {
+ public WifiManager(@NonNull Context context, @NonNull IWifiManager service,
+ @NonNull Looper looper) {
mContext = context;
+ mService = service;
mLooper = looper;
mTargetSdkVersion = context.getApplicationInfo().targetSdkVersion;
- }
-
- /**
- * This is used only for unit testing.
- * @hide
- */
- @VisibleForTesting
- public WifiManager(Context context, IWifiManager service, Looper looper) {
- this(context, looper);
- mService = service;
updateVerboseLoggingEnabledFromService();
}
- private IWifiManager getIWifiManager() {
- if (mService == null) {
- synchronized (this) {
- mService = IWifiManager.Stub.asInterface(
- ServiceManager.getService(Context.WIFI_SERVICE));
- if (mService != null) {
- updateVerboseLoggingEnabledFromService();
- } else {
- Log.e(TAG, "Wifi Service not running yet, ignoring WifiManager API call");
- }
- }
- }
- return mService;
- }
-
/**
* Return a list of all the networks configured for the current foreground
* user.
@@ -1290,10 +1267,8 @@ public class WifiManager {
@RequiresPermission(allOf = {ACCESS_FINE_LOCATION, ACCESS_WIFI_STATE})
public List<WifiConfiguration> getConfiguredNetworks() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return Collections.emptyList();
ParceledListSlice<WifiConfiguration> parceledList =
- iWifiManager.getConfiguredNetworks(mContext.getOpPackageName(),
+ mService.getConfiguredNetworks(mContext.getOpPackageName(),
mContext.getFeatureId());
if (parceledList == null) {
return Collections.emptyList();
@@ -1309,10 +1284,8 @@ public class WifiManager {
@RequiresPermission(allOf = {ACCESS_FINE_LOCATION, ACCESS_WIFI_STATE, READ_WIFI_CREDENTIAL})
public List<WifiConfiguration> getPrivilegedConfiguredNetworks() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return Collections.emptyList();
ParceledListSlice<WifiConfiguration> parceledList =
- iWifiManager.getPrivilegedConfiguredNetworks(mContext.getOpPackageName(),
+ mService.getPrivilegedConfiguredNetworks(mContext.getOpPackageName(),
mContext.getFeatureId());
if (parceledList == null) {
return Collections.emptyList();
@@ -1344,16 +1317,14 @@ public class WifiManager {
@NonNull List<ScanResult> scanResults) {
List<Pair<WifiConfiguration, Map<Integer, List<ScanResult>>>> configs = new ArrayList<>();
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return Collections.emptyList();
Map<String, Map<Integer, List<ScanResult>>> results =
- iWifiManager.getAllMatchingFqdnsForScanResults(
+ mService.getAllMatchingFqdnsForScanResults(
scanResults);
if (results.isEmpty()) {
return configs;
}
List<WifiConfiguration> wifiConfigurations =
- iWifiManager.getWifiConfigsForPasspointProfiles(
+ mService.getWifiConfigsForPasspointProfiles(
new ArrayList<>(results.keySet()));
for (WifiConfiguration configuration : wifiConfigurations) {
Map<Integer, List<ScanResult>> scanResultsPerNetworkType = results.get(
@@ -1388,12 +1359,10 @@ public class WifiManager {
public Map<OsuProvider, List<ScanResult>> getMatchingOsuProviders(
@Nullable List<ScanResult> scanResults) {
if (scanResults == null) {
- return Collections.emptyMap();
+ return new HashMap<>();
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return Collections.emptyMap();
- return iWifiManager.getMatchingOsuProviders(scanResults);
+ return mService.getMatchingOsuProviders(scanResults);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1420,9 +1389,7 @@ public class WifiManager {
public Map<OsuProvider, PasspointConfiguration> getMatchingPasspointConfigsForOsuProviders(
@NonNull Set<OsuProvider> osuProviders) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return Collections.emptyMap();
- return iWifiManager.getMatchingPasspointConfigsForOsuProviders(
+ return mService.getMatchingPasspointConfigsForOsuProviders(
new ArrayList<>(osuProviders));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -1507,9 +1474,7 @@ public class WifiManager {
*/
private int addOrUpdateNetwork(WifiConfiguration config) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return -1;
- return iWifiManager.addOrUpdateNetwork(config, mContext.getOpPackageName());
+ return mService.addOrUpdateNetwork(config, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1756,11 +1721,7 @@ public class WifiManager {
Binder binder = new Binder();
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.registerNetworkRequestMatchCallback(
+ mService.registerNetworkRequestMatchCallback(
binder, new NetworkRequestMatchCallbackProxy(executor, callback),
callback.hashCode());
} catch (RemoteException e) {
@@ -1787,11 +1748,7 @@ public class WifiManager {
Log.v(TAG, "unregisterNetworkRequestMatchCallback: callback=" + callback);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.unregisterNetworkRequestMatchCallback(callback.hashCode());
+ mService.unregisterNetworkRequestMatchCallback(callback.hashCode());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1824,9 +1781,7 @@ public class WifiManager {
public @NetworkSuggestionsStatusCode int addNetworkSuggestions(
@NonNull List<WifiNetworkSuggestion> networkSuggestions) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return STATUS_NETWORK_SUGGESTIONS_ERROR_INTERNAL;
- return iWifiManager.addNetworkSuggestions(
+ return mService.addNetworkSuggestions(
networkSuggestions, mContext.getOpPackageName(), mContext.getFeatureId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -1850,9 +1805,7 @@ public class WifiManager {
public @NetworkSuggestionsStatusCode int removeNetworkSuggestions(
@NonNull List<WifiNetworkSuggestion> networkSuggestions) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return STATUS_NETWORK_SUGGESTIONS_ERROR_INTERNAL;
- return iWifiManager.removeNetworkSuggestions(
+ return mService.removeNetworkSuggestions(
networkSuggestions, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -1868,9 +1821,7 @@ public class WifiManager {
@RequiresPermission(ACCESS_WIFI_STATE)
public @NonNull List<WifiNetworkSuggestion> getNetworkSuggestions() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return Collections.emptyList();
- return iWifiManager.getNetworkSuggestions(mContext.getOpPackageName());
+ return mService.getNetworkSuggestions(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
@@ -1900,13 +1851,7 @@ public class WifiManager {
*/
public void addOrUpdatePasspointConfiguration(PasspointConfiguration config) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (config == null) return;
- throw new RemoteException("Wifi service is not running");
- }
- if (!iWifiManager.addOrUpdatePasspointConfiguration(
- config, mContext.getOpPackageName())) {
+ if (!mService.addOrUpdatePasspointConfiguration(config, mContext.getOpPackageName())) {
throw new IllegalArgumentException();
}
} catch (RemoteException e) {
@@ -1930,13 +1875,7 @@ public class WifiManager {
})
public void removePasspointConfiguration(String fqdn) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (TextUtils.isEmpty(fqdn)) return;
- throw new RemoteException("Wifi service is not running");
- }
- if (!iWifiManager.removePasspointConfiguration(
- fqdn, mContext.getOpPackageName())) {
+ if (!mService.removePasspointConfiguration(fqdn, mContext.getOpPackageName())) {
throw new IllegalArgumentException();
}
} catch (RemoteException e) {
@@ -1959,9 +1898,7 @@ public class WifiManager {
})
public List<PasspointConfiguration> getPasspointConfigurations() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) Collections.emptyList();
- return iWifiManager.getPasspointConfigurations(mContext.getOpPackageName());
+ return mService.getPasspointConfigurations(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -1981,12 +1918,7 @@ public class WifiManager {
*/
public void queryPasspointIcon(long bssid, String fileName) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (bssid == 0L || TextUtils.isEmpty(fileName)) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.queryPasspointIcon(bssid, fileName);
+ mService.queryPasspointIcon(bssid, fileName);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2000,9 +1932,7 @@ public class WifiManager {
*/
public int matchProviderWithCurrentNetwork(String fqdn) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return -1;
- return iWifiManager.matchProviderWithCurrentNetwork(fqdn);
+ return mService.matchProviderWithCurrentNetwork(fqdn);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2018,11 +1948,7 @@ public class WifiManager {
*/
public void deauthenticateNetwork(long holdoff, boolean ess) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.deauthenticateNetwork(holdoff, ess);
+ mService.deauthenticateNetwork(holdoff, ess);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2052,9 +1978,7 @@ public class WifiManager {
@Deprecated
public boolean removeNetwork(int netId) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.removeNetwork(netId, mContext.getOpPackageName());
+ return mService.removeNetwork(netId, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2109,10 +2033,7 @@ public class WifiManager {
boolean success;
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- success = iWifiManager.enableNetwork(
- netId, attemptConnect, mContext.getOpPackageName());
+ success = mService.enableNetwork(netId, attemptConnect, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2148,9 +2069,7 @@ public class WifiManager {
@Deprecated
public boolean disableNetwork(int netId) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.disableNetwork(netId, mContext.getOpPackageName());
+ return mService.disableNetwork(netId, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2173,9 +2092,7 @@ public class WifiManager {
@Deprecated
public boolean disconnect() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.disconnect(mContext.getOpPackageName());
+ return mService.disconnect(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2199,9 +2116,7 @@ public class WifiManager {
@Deprecated
public boolean reconnect() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.reconnect(mContext.getOpPackageName());
+ return mService.reconnect(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2225,9 +2140,7 @@ public class WifiManager {
@Deprecated
public boolean reassociate() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.reassociate(mContext.getOpPackageName());
+ return mService.reassociate(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2323,9 +2236,7 @@ public class WifiManager {
private long getSupportedFeatures() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return 0L;
- return iWifiManager.getSupportedFeatures();
+ return mService.getSupportedFeatures();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2482,10 +2393,8 @@ public class WifiManager {
*/
public WifiActivityEnergyInfo getControllerActivityEnergyInfo() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return null;
synchronized(this) {
- return iWifiManager.reportActivityInfo();
+ return mService.reportActivityInfo();
}
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -2524,11 +2433,9 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS)
public boolean startScan(WorkSource workSource) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
String packageName = mContext.getOpPackageName();
String featureId = mContext.getFeatureId();
- return iWifiManager.startScan(packageName, featureId);
+ return mService.startScan(packageName, featureId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2557,9 +2464,7 @@ public class WifiManager {
*/
public WifiInfo getConnectionInfo() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return null;
- return iWifiManager.getConnectionInfo(mContext.getOpPackageName(),
+ return mService.getConnectionInfo(mContext.getOpPackageName(),
mContext.getFeatureId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -2574,9 +2479,7 @@ public class WifiManager {
*/
public List<ScanResult> getScanResults() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return Collections.emptyList();
- return iWifiManager.getScanResults(mContext.getOpPackageName(),
+ return mService.getScanResults(mContext.getOpPackageName(),
mContext.getFeatureId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -2596,9 +2499,7 @@ public class WifiManager {
@Deprecated
public boolean isScanAlwaysAvailable() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.isScanAlwaysAvailable();
+ return mService.isScanAlwaysAvailable();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2631,9 +2532,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL)
public String getCountryCode() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return null;
- return iWifiManager.getCountryCode();
+ return mService.getCountryCode();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2648,9 +2547,7 @@ public class WifiManager {
@SystemApi
public boolean isDualBandSupported() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.isDualBandSupported();
+ return mService.isDualBandSupported();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2673,9 +2570,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public boolean isDualModeSupported() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.needs5GHzToAnyApBandConversion();
+ return mService.needs5GHzToAnyApBandConversion();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2688,9 +2583,7 @@ public class WifiManager {
*/
public DhcpInfo getDhcpInfo() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return null;
- return iWifiManager.getDhcpInfo();
+ return mService.getDhcpInfo();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2717,9 +2610,7 @@ public class WifiManager {
@Deprecated
public boolean setWifiEnabled(boolean enabled) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.setWifiEnabled(mContext.getOpPackageName(), enabled);
+ return mService.setWifiEnabled(mContext.getOpPackageName(), enabled);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2734,9 +2625,7 @@ public class WifiManager {
*/
public int getWifiState() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return WIFI_STATE_UNKNOWN;
- return iWifiManager.getWifiEnabledState();
+ return mService.getWifiEnabledState();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2764,11 +2653,7 @@ public class WifiManager {
TxPacketCountListenerProxy listenerProxy =
new TxPacketCountListenerProxy(mLooper, listener);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.getTxPacketCount(mContext.getOpPackageName(), binder, listenerProxy,
+ mService.getTxPacketCount(mContext.getOpPackageName(), binder, listenerProxy,
listener.hashCode());
} catch (RemoteException e) {
listenerProxy.onFailure(ERROR);
@@ -2811,11 +2696,7 @@ public class WifiManager {
*/
public int calculateSignalLevel(int rssi) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- return iWifiManager.calculateSignalLevel(rssi);
+ return mService.calculateSignalLevel(rssi);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2861,12 +2742,7 @@ public class WifiManager {
})
public void updateInterfaceIpState(@Nullable String ifaceName, @IfaceIpMode int mode) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (TextUtils.isEmpty(ifaceName) || mode == IFACE_IP_MODE_UNSPECIFIED) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.updateInterfaceIpState(ifaceName, mode);
+ mService.updateInterfaceIpState(ifaceName, mode);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2890,9 +2766,7 @@ public class WifiManager {
})
public boolean startSoftAp(@Nullable WifiConfiguration wifiConfig) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.startSoftAp(wifiConfig);
+ return mService.startSoftAp(wifiConfig);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -2912,9 +2786,7 @@ public class WifiManager {
})
public boolean stopSoftAp() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.stopSoftAp();
+ return mService.stopSoftAp();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3032,13 +2904,9 @@ public class WifiManager {
LocalOnlyHotspotCallbackProxy proxy =
new LocalOnlyHotspotCallbackProxy(this, executor, callback);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
String packageName = mContext.getOpPackageName();
String featureId = mContext.getFeatureId();
- int returnCode = iWifiManager.startLocalOnlyHotspot(proxy, packageName, featureId,
+ int returnCode = mService.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
@@ -3090,11 +2958,7 @@ public class WifiManager {
}
mLOHSCallbackProxy = null;
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.stopLocalOnlyHotspot();
+ mService.stopLocalOnlyHotspot();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3126,11 +2990,7 @@ public class WifiManager {
mLOHSObserverProxy =
new LocalOnlyHotspotObserverProxy(this, executor, observer);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.startWatchLocalOnlyHotspot(mLOHSObserverProxy);
+ mService.startWatchLocalOnlyHotspot(mLOHSObserverProxy);
mLOHSObserverProxy.registered();
} catch (RemoteException e) {
mLOHSObserverProxy = null;
@@ -3153,11 +3013,7 @@ public class WifiManager {
}
mLOHSObserverProxy = null;
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.stopWatchLocalOnlyHotspot();
+ mService.stopWatchLocalOnlyHotspot();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3177,9 +3033,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE)
public int getWifiApState() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return WIFI_AP_STATE_FAILED;
- return iWifiManager.getWifiApEnabledState();
+ return mService.getWifiApEnabledState();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3208,9 +3062,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE)
public WifiConfiguration getWifiApConfiguration() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return null;
- return iWifiManager.getWifiApConfiguration();
+ return mService.getWifiApConfiguration();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3227,10 +3079,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE)
public boolean setWifiApConfiguration(WifiConfiguration wifiConfig) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.setWifiApConfiguration(
- wifiConfig, mContext.getOpPackageName());
+ return mService.setWifiApConfiguration(wifiConfig, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3258,12 +3107,7 @@ public class WifiManager {
*/
public void setTdlsEnabled(InetAddress remoteIPAddress, boolean enable) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (remoteIPAddress == null || !enable) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.enableTdls(remoteIPAddress.getHostAddress(), enable);
+ mService.enableTdls(remoteIPAddress.getHostAddress(), enable);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3277,12 +3121,7 @@ public class WifiManager {
*/
public void setTdlsEnabledWithMacAddress(String remoteMacAddress, boolean enable) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (TextUtils.isEmpty(remoteMacAddress) || !enable) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.enableTdlsWithMacAddress(remoteMacAddress, enable);
+ mService.enableTdlsWithMacAddress(remoteMacAddress, enable);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3573,11 +3412,7 @@ public class WifiManager {
Binder binder = new Binder();
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.registerSoftApCallback(
+ mService.registerSoftApCallback(
binder, new SoftApCallbackProxy(executor, callback), callback.hashCode());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -3599,11 +3434,7 @@ public class WifiManager {
Log.v(TAG, "unregisterSoftApCallback: callback=" + callback);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.unregisterSoftApCallback(callback.hashCode());
+ mService.unregisterSoftApCallback(callback.hashCode());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -3931,11 +3762,7 @@ public class WifiManager {
binder = new Binder();
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.connect(config, networkId, binder, listenerProxy,
+ mService.connect(config, networkId, binder, listenerProxy,
listener == null ? 0 : listener.hashCode());
} catch (RemoteException e) {
if (listenerProxy != null) listenerProxy.onFailure(ERROR);
@@ -4028,11 +3855,7 @@ public class WifiManager {
binder = new Binder();
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.save(config, binder, listenerProxy,
+ mService.save(config, binder, listenerProxy,
listener == null ? 0 : listener.hashCode());
} catch (RemoteException e) {
if (listenerProxy != null) listenerProxy.onFailure(ERROR);
@@ -4069,11 +3892,7 @@ public class WifiManager {
binder = new Binder();
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.forget(netId, binder, listenerProxy,
+ mService.forget(netId, binder, listenerProxy,
listener == null ? 0 : listener.hashCode());
} catch (RemoteException e) {
if (listenerProxy != null) listenerProxy.onFailure(ERROR);
@@ -4126,11 +3945,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public void allowAutojoin(int netId, boolean choice) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.allowAutojoin(netId, choice);
+ mService.allowAutojoin(netId, choice);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4153,11 +3968,7 @@ public class WifiManager {
throw new IllegalArgumentException("SSID cannot be null or empty!");
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.disableEphemeralNetwork(ssid, mContext.getOpPackageName());
+ mService.disableEphemeralNetwork(ssid, mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4245,14 +4056,10 @@ public class WifiManager {
synchronized (mBinder) {
if (mRefCounted ? (++mRefCount == 1) : (!mHeld)) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.acquireWifiLock(mBinder, mLockType, mTag, mWorkSource);
+ mService.acquireWifiLock(mBinder, mLockType, mTag, mWorkSource);
synchronized (WifiManager.this) {
if (mActiveLockCount >= MAX_ACTIVE_LOCKS) {
- iWifiManager.releaseWifiLock(mBinder);
+ mService.releaseWifiLock(mBinder);
throw new UnsupportedOperationException(
"Exceeded maximum number of wifi locks");
}
@@ -4282,11 +4089,7 @@ public class WifiManager {
synchronized (mBinder) {
if (mRefCounted ? (--mRefCount == 0) : (mHeld)) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.releaseWifiLock(mBinder);
+ mService.releaseWifiLock(mBinder);
synchronized (WifiManager.this) {
mActiveLockCount--;
}
@@ -4349,11 +4152,7 @@ public class WifiManager {
}
if (changed && mHeld) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.updateWifiLockWorkSource(mBinder, mWorkSource);
+ mService.updateWifiLockWorkSource(mBinder, mWorkSource);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4381,11 +4180,7 @@ public class WifiManager {
synchronized (mBinder) {
if (mHeld) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.releaseWifiLock(mBinder);
+ mService.releaseWifiLock(mBinder);
synchronized (WifiManager.this) {
mActiveLockCount--;
}
@@ -4498,14 +4293,10 @@ public class WifiManager {
synchronized (mBinder) {
if (mRefCounted ? (++mRefCount == 1) : (!mHeld)) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.acquireMulticastLock(mBinder, mTag);
+ mService.acquireMulticastLock(mBinder, mTag);
synchronized (WifiManager.this) {
if (mActiveLockCount >= MAX_ACTIVE_LOCKS) {
- iWifiManager.releaseMulticastLock(mTag);
+ mService.releaseMulticastLock(mTag);
throw new UnsupportedOperationException(
"Exceeded maximum number of wifi locks");
}
@@ -4547,11 +4338,7 @@ public class WifiManager {
synchronized (mBinder) {
if (mRefCounted ? (--mRefCount == 0) : (mHeld)) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.releaseMulticastLock(mTag);
+ mService.releaseMulticastLock(mTag);
synchronized (WifiManager.this) {
mActiveLockCount--;
}
@@ -4628,9 +4415,7 @@ public class WifiManager {
*/
public boolean isMulticastEnabled() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- return iWifiManager.isMulticastEnabled();
+ return mService.isMulticastEnabled();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4643,9 +4428,7 @@ public class WifiManager {
@UnsupportedAppUsage
public boolean initializeMulticastFiltering() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return false;
- iWifiManager.initializeMulticastFiltering();
+ mService.initializeMulticastFiltering();
return true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -4664,12 +4447,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public void enableVerboseLogging (int verbose) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (verbose == 0) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.enableVerboseLogging(verbose);
+ mService.enableVerboseLogging(verbose);
} catch (Exception e) {
//ignore any failure here
Log.e(TAG, "enableVerboseLogging " + e.toString());
@@ -4688,9 +4466,7 @@ public class WifiManager {
@SystemApi
public int getVerboseLoggingLevel() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return -1;
- return iWifiManager.getVerboseLoggingLevel();
+ return mService.getVerboseLoggingLevel();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4706,11 +4482,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL)
public void factoryReset() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.factoryReset(mContext.getOpPackageName());
+ mService.factoryReset(mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4725,9 +4497,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE)
public Network getCurrentNetwork() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return null;
- return iWifiManager.getCurrentNetwork();
+ return mService.getCurrentNetwork();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4759,12 +4529,7 @@ public class WifiManager {
*/
public void enableWifiConnectivityManager(boolean enabled) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (enabled) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.enableWifiConnectivityManager(enabled);
+ mService.enableWifiConnectivityManager(enabled);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4781,9 +4546,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public byte[] retrieveBackupData() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return new byte[0];
- return iWifiManager.retrieveBackupData();
+ return mService.retrieveBackupData();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4798,12 +4561,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public void restoreBackupData(@NonNull byte[] data) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (ArrayUtils.isEmpty(data)) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.restoreBackupData(data);
+ mService.restoreBackupData(data);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4824,12 +4582,7 @@ public class WifiManager {
public void restoreSupplicantBackupData(
@NonNull byte[] supplicantData, @NonNull byte[] ipConfigData) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (ArrayUtils.isEmpty(supplicantData) && ArrayUtils.isEmpty(ipConfigData)) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.restoreSupplicantBackupData(supplicantData, ipConfigData);
+ mService.restoreSupplicantBackupData(supplicantData, ipConfigData);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -4858,11 +4611,7 @@ public class WifiManager {
throw new IllegalArgumentException("callback must not be null");
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.startSubscriptionProvisioning(provider,
+ mService.startSubscriptionProvisioning(provider,
new ProvisioningCallbackProxy(executor, callback));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -4996,11 +4745,7 @@ public class WifiManager {
Binder binder = new Binder();
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.registerTrafficStateCallback(
+ mService.registerTrafficStateCallback(
binder, new TrafficStateCallbackProxy(executor, callback), callback.hashCode());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -5021,11 +4766,7 @@ public class WifiManager {
Log.v(TAG, "unregisterTrafficStateCallback: callback=" + callback);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.unregisterTrafficStateCallback(callback.hashCode());
+ mService.unregisterTrafficStateCallback(callback.hashCode());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5083,9 +4824,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public String[] getFactoryMacAddresses() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) return new String[0];
- return iWifiManager.getFactoryMacAddresses();
+ return mService.getFactoryMacAddresses();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5154,12 +4893,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.WIFI_SET_DEVICE_MOBILITY_STATE)
public void setDeviceMobilityState(@DeviceMobilityState int state) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- if (state == DEVICE_MOBILITY_STATE_UNKNOWN) return;
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.setDeviceMobilityState(state);
+ mService.setDeviceMobilityState(state);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5214,13 +4948,8 @@ public class WifiManager {
@NonNull EasyConnectStatusCallback callback) {
Binder binder = new Binder();
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.startDppAsConfiguratorInitiator(
- binder, enrolleeUri, selectedNetworkId, enrolleeNetworkRole,
- new EasyConnectCallbackProxy(executor, callback));
+ mService.startDppAsConfiguratorInitiator(binder, enrolleeUri, selectedNetworkId,
+ enrolleeNetworkRole, new EasyConnectCallbackProxy(executor, callback));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5245,11 +4974,7 @@ public class WifiManager {
@NonNull EasyConnectStatusCallback callback) {
Binder binder = new Binder();
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.startDppAsEnrolleeInitiator(binder, configuratorUri,
+ mService.startDppAsEnrolleeInitiator(binder, configuratorUri,
new EasyConnectCallbackProxy(executor, callback));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@@ -5270,12 +4995,8 @@ public class WifiManager {
android.Manifest.permission.NETWORK_SETUP_WIZARD})
public void stopEasyConnectSession() {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
/* Request lower layers to stop/abort and clear resources */
- iWifiManager.stopDppSession();
+ mService.stopDppSession();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5374,11 +5095,7 @@ public class WifiManager {
Log.v(TAG, "addOnWifiUsabilityStatsListener: listener=" + listener);
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.addOnWifiUsabilityStatsListener(new Binder(),
+ mService.addOnWifiUsabilityStatsListener(new Binder(),
new IOnWifiUsabilityStatsListener.Stub() {
@Override
public void onWifiUsabilityStats(int seqNum, boolean isSameBssidAndFreq,
@@ -5415,11 +5132,7 @@ public class WifiManager {
Log.v(TAG, "removeOnWifiUsabilityStatsListener: listener=" + listener);
}
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.removeOnWifiUsabilityStatsListener(listener.hashCode());
+ mService.removeOnWifiUsabilityStatsListener(listener.hashCode());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5442,11 +5155,7 @@ public class WifiManager {
@RequiresPermission(android.Manifest.permission.WIFI_UPDATE_USABILITY_STATS_SCORE)
public void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec) {
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.updateWifiUsabilityScore(seqNum, score, predictionHorizonSec);
+ mService.updateWifiUsabilityScore(seqNum, score, predictionHorizonSec);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5545,11 +5254,7 @@ public class WifiManager {
ScanResultsCallback.ScanResultsCallbackProxy proxy = callback.getProxy();
proxy.initProxy(executor, callback);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.registerScanResultsCallback(proxy);
+ mService.registerScanResultsCallback(proxy);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -5567,11 +5272,7 @@ public class WifiManager {
Log.v(TAG, "unregisterScanResultsCallback: Callback=" + callback);
ScanResultsCallback.ScanResultsCallbackProxy proxy = callback.getProxy();
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.unregisterScanResultsCallback(proxy);
+ mService.unregisterScanResultsCallback(proxy);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
} finally {
@@ -5647,11 +5348,7 @@ public class WifiManager {
Log.v(TAG, "addSuggestionConnectionStatusListener listener=" + listener
+ ", executor=" + executor);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.registerSuggestionConnectionStatusListener(new Binder(),
+ mService.registerSuggestionConnectionStatusListener(new Binder(),
new SuggestionConnectionStatusListenerProxy(executor, listener),
listener.hashCode(), mContext.getOpPackageName(), mContext.getFeatureId());
} catch (RemoteException e) {
@@ -5672,11 +5369,7 @@ public class WifiManager {
if (listener == null) throw new IllegalArgumentException("Listener cannot be null");
Log.v(TAG, "removeSuggestionConnectionStatusListener: listener=" + listener);
try {
- IWifiManager iWifiManager = getIWifiManager();
- if (iWifiManager == null) {
- throw new RemoteException("Wifi service is not running");
- }
- iWifiManager.unregisterSuggestionConnectionStatusListener(listener.hashCode(),
+ mService.unregisterSuggestionConnectionStatusListener(listener.hashCode(),
mContext.getOpPackageName());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();