diff options
author | Pankaj Kanwar <pkanwar@google.com> | 2018-04-02 21:03:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-04-02 21:03:13 +0000 |
commit | 85fa6ab417f39148fceee1b7262063249600c0a2 (patch) | |
tree | 4eb5766aaca1b5c71d8951ca7c8644ccce78683f /service | |
parent | da5014a57aa359bdbaee9f73ce2afec78376f5cc (diff) | |
parent | 0ae2f996c3c6550226a476caf2e1d5c0f110c1eb (diff) |
Merge "Adds ContentObserver for certificate downloaded notification" into pi-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/CarrierNetworkConfig.java | 17 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiInjector.java | 3 |
2 files changed, 18 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/CarrierNetworkConfig.java b/service/java/com/android/server/wifi/CarrierNetworkConfig.java index db107bf6c..91e22afe1 100644 --- a/service/java/com/android/server/wifi/CarrierNetworkConfig.java +++ b/service/java/com/android/server/wifi/CarrierNetworkConfig.java @@ -16,12 +16,17 @@ package com.android.server.wifi; +import android.annotation.NonNull; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.database.ContentObserver; +import android.net.Uri; import android.net.wifi.EAPConstants; import android.net.wifi.WifiEnterpriseConfig; +import android.os.Handler; +import android.os.Looper; import android.os.PersistableBundle; import android.telephony.CarrierConfigManager; import android.telephony.ImsiEncryptionInfo; @@ -45,11 +50,13 @@ public class CarrierNetworkConfig { private static final int ENCODED_SSID_INDEX = 0; private static final int EAP_TYPE_INDEX = 1; private static final int CONFIG_ELEMENT_SIZE = 2; + private static final Uri CONTENT_URI = Uri.parse("content://carrier_information/carrier"); private final Map<String, NetworkInfo> mCarrierNetworkMap; private boolean mIsCarrierImsiEncryptionInfoAvailable = false; - public CarrierNetworkConfig(Context context) { + public CarrierNetworkConfig(@NonNull Context context, @NonNull Looper looper, + @NonNull FrameworkFacade framework) { mCarrierNetworkMap = new HashMap<>(); updateNetworkConfig(context); @@ -62,6 +69,14 @@ public class CarrierNetworkConfig { updateNetworkConfig(context); } }, filter); + + framework.registerContentObserver(context, CONTENT_URI, false, + new ContentObserver(new Handler(looper)) { + @Override + public void onChange(boolean selfChange) { + updateNetworkConfig(context); + } + }); } /** diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java index 6e14822ef..04bb3f48c 100644 --- a/service/java/com/android/server/wifi/WifiInjector.java +++ b/service/java/com/android/server/wifi/WifiInjector.java @@ -167,13 +167,14 @@ public class WifiInjector { mBatteryStats = IBatteryStats.Stub.asInterface(mFrameworkFacade.getService( BatteryStats.SERVICE_NAME)); mWifiStateTracker = new WifiStateTracker(mBatteryStats); - mCarrierNetworkConfig = new CarrierNetworkConfig(mContext); // Now create and start handler threads mWifiServiceHandlerThread = new HandlerThread("WifiService"); mWifiServiceHandlerThread.start(); mWifiStateMachineHandlerThread = new HandlerThread("WifiStateMachine"); mWifiStateMachineHandlerThread.start(); Looper wifiStateMachineLooper = mWifiStateMachineHandlerThread.getLooper(); + mCarrierNetworkConfig = new CarrierNetworkConfig(mContext, + mWifiServiceHandlerThread.getLooper(), mFrameworkFacade); WifiAwareMetrics awareMetrics = new WifiAwareMetrics(mClock); mWifiMetrics = new WifiMetrics(mClock, wifiStateMachineLooper, awareMetrics); // Modules interacting with Native. |