diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/AndroidManifest_Resources.xml | 1 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiCarrierInfoManager.java | 22 | ||||
-rw-r--r-- | service/res/values/strings.xml | 6 |
3 files changed, 21 insertions, 8 deletions
diff --git a/service/AndroidManifest_Resources.xml b/service/AndroidManifest_Resources.xml index 6d637cb53..04ba1d38b 100644 --- a/service/AndroidManifest_Resources.xml +++ b/service/AndroidManifest_Resources.xml @@ -22,6 +22,7 @@ coreApp="true" android:versionCode="1" android:versionName="R-initial"> + <protected-broadcast android:name="com.android.server.wifi.action.CarrierNetwork.USER_CLICKED" /> <application android:label="@string/wifiResourcesAppLabel" android:defaultToDeviceProtectedStorage="true" diff --git a/service/java/com/android/server/wifi/WifiCarrierInfoManager.java b/service/java/com/android/server/wifi/WifiCarrierInfoManager.java index d483047d2..047f9139d 100644 --- a/service/java/com/android/server/wifi/WifiCarrierInfoManager.java +++ b/service/java/com/android/server/wifi/WifiCarrierInfoManager.java @@ -16,6 +16,8 @@ package com.android.server.wifi; +import static android.Manifest.permission.NETWORK_SETTINGS; + import android.annotation.IntDef; import android.annotation.NonNull; import android.app.AlertDialog; @@ -96,6 +98,10 @@ public class WifiCarrierInfoManager { @VisibleForTesting public static final String NOTIFICATION_USER_DISMISSED_INTENT_ACTION = "com.android.server.wifi.action.CarrierNetwork.USER_DISMISSED"; + /** Intent when user clicked on the notification. */ + @VisibleForTesting + public static final String NOTIFICATION_USER_CLICKED_INTENT_ACTION = + "com.android.server.wifi.action.CarrierNetwork.USER_CLICKED"; @VisibleForTesting public static final String EXTRA_CARRIER_NAME = "com.android.server.wifi.extra.CarrierNetwork.CARRIER_NAME"; @@ -223,14 +229,16 @@ public class WifiCarrierInfoManager { switch (intent.getAction()) { case NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION: - Log.i(TAG, "User clicked to allow carrier"); - sendImsiPrivacyConfirmationDialog(carrierName, carrierId); - // Collapse the notification bar - mContext.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); + handleUserAllowCarrierExemptionAction(carrierName, carrierId); break; case NOTIFICATION_USER_DISALLOWED_CARRIER_INTENT_ACTION: handleUserDisallowCarrierExemptionAction(carrierName, carrierId); break; + case NOTIFICATION_USER_CLICKED_INTENT_ACTION: + sendImsiPrivacyConfirmationDialog(carrierName, carrierId); + // Collapse the notification bar + mContext.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); + break; case NOTIFICATION_USER_DISMISSED_INTENT_ACTION: handleUserDismissAction(); return; // no need to cancel a dismissed notification, return. @@ -297,8 +305,9 @@ public class WifiCarrierInfoManager { mIntentFilter.addAction(NOTIFICATION_USER_DISMISSED_INTENT_ACTION); mIntentFilter.addAction(NOTIFICATION_USER_ALLOWED_CARRIER_INTENT_ACTION); mIntentFilter.addAction(NOTIFICATION_USER_DISALLOWED_CARRIER_INTENT_ACTION); + mIntentFilter.addAction(NOTIFICATION_USER_CLICKED_INTENT_ACTION); - mContext.registerReceiver(mBroadcastReceiver, mIntentFilter, null, handler); + mContext.registerReceiver(mBroadcastReceiver, mIntentFilter, NETWORK_SETTINGS, handler); configStore.registerStoreData(wifiInjector.makeImsiProtectionExemptionStoreData( new ImsiProtectionExemptionDataSource())); @@ -1448,6 +1457,9 @@ public class WifiCarrierInfoManager { .setStyle(new Notification.BigTextStyle() .bigText(mResources.getString( R.string.wifi_suggestion_imsi_privacy_content))) + .setContentIntent(getPrivateBroadcast(NOTIFICATION_USER_CLICKED_INTENT_ACTION, + Pair.create(EXTRA_CARRIER_NAME, carrierName), + Pair.create(EXTRA_CARRIER_ID, carrierId))) .setDeleteIntent(getPrivateBroadcast(NOTIFICATION_USER_DISMISSED_INTENT_ACTION, Pair.create(EXTRA_CARRIER_NAME, carrierName), Pair.create(EXTRA_CARRIER_ID, carrierId))) diff --git a/service/res/values/strings.xml b/service/res/values/strings.xml index 441ecca15..ae3f1977b 100644 --- a/service/res/values/strings.xml +++ b/service/res/values/strings.xml @@ -49,11 +49,11 @@ <string name="wifi_suggestion_action_disallow_app">No thanks</string> <!-- Notification title for a connection to a SIM-based carrier network without IMSI privacy protection. --> - <string name="wifi_suggestion_imsi_privacy_title"><xliff:g id="carrierName" example="xxxMobile">%s</xliff:g> wants to auto\u2011connect</string> + <string name="wifi_suggestion_imsi_privacy_title">Connect to <xliff:g id="carrierName" example="xxxMobile">%s</xliff:g> Wi\u2011Fi?</string> <!-- Notification content for a connection to a SIM-based carrier network without IMSI privacy protection.--> - <string name="wifi_suggestion_imsi_privacy_content">These networks receive a unique ID that can be used to track device location</string> + <string name="wifi_suggestion_imsi_privacy_content">These networks receive a SIM ID that can be used to track device location</string> <!-- Notification action for allowing carrier specified in the notification body.--> - <string name="wifi_suggestion_action_allow_imsi_privacy_exemption_carrier">Connect anyway</string> + <string name="wifi_suggestion_action_allow_imsi_privacy_exemption_carrier">Connect</string> <!-- Notification action for disallowing carrier specified in the notification body.--> <string name="wifi_suggestion_action_disallow_imsi_privacy_exemption_carrier">Don\u0027t connect</string> <!-- Confirmation dialog title for a connection to a SIM-based carrier network without IMSI privacy protection. --> |