packages/apps/Settings
Revisão | 817f4b339bf8315a513c500d232a086c40b9299c (tree) |
---|---|
Hora | 2021-07-01 20:01:42 |
Autor | Hugh Chen <hughchen@goog...> |
Commiter | Android Build Coastguard Worker |
RESTRICT AUTOMERGE Fix phishing attacks over Bluetooth due to unclear warning message
This CL add more prompts presented for users to avoid phishing attacks.
Screenshot:
https://screenshot.googleplex.com/p5PZbphN46ddPFV.png
https://screenshot.googleplex.com/6Q2wKfPbNQmTtx8.png
https://screenshot.googleplex.com/987VpYgNUZL2K4T.png
https://screenshot.googleplex.com/9eVg6SAGScVXU8U.png
Bug: 167403112
Test: manually test
Change-Id: Iadec059b662fd91754ad573bbe688702cdd3c9af
(cherry picked from commit 10e459921953825d34e70cc4da846aac703d913c)
(cherry picked from commit 80d8b03d027f3dffb85958f849be3b5316791107)
@@ -12212,4 +12212,25 @@ | ||
12212 | 12212 | |
12213 | 12213 | <!-- Label for button to not allow grant the permission for remote devices. [CHAR_LIMIT=50] --> |
12214 | 12214 | <string name="request_manage_bluetooth_permission_dont_allow">Don\u2019t allow</string> |
12215 | + | |
12216 | + <!-- Bluetooth sim card permission alert for notification title [CHAR LIMIT=none] --> | |
12217 | + <string name="bluetooth_sim_card_access_notification_title">SIM card access request</string> | |
12218 | + <!-- Bluetooth sim card permission alert for notification content [CHAR LIMIT=none] --> | |
12219 | + <string name="bluetooth_sim_card_access_notification_content">A device wants to access your SIM card. Tap for details.</string> | |
12220 | + <!-- Bluetooth sim card permission alert for dialog title [CHAR LIMIT=none] --> | |
12221 | + <string name="bluetooth_sim_card_access_dialog_title">Allow access to SIM card?</string> | |
12222 | + <!-- Bluetooth sim card permission alert for dialog content [CHAR LIMIT=none] --> | |
12223 | + <string name="bluetooth_sim_card_access_dialog_content">A Bluetooth device, <xliff:g id="device_name" example="My device">%1$s</xliff:g>, wants to access data on your SIM card. This includes your contacts.\n\nWhile connected, <xliff:g id="device_name" example="My device">%2$s</xliff:g> will receive all calls made to <xliff:g id="phone_number" example="0912345678">%3$s</xliff:g>.</string> | |
12224 | + <!-- Bluetooth connect permission alert for notification title [CHAR LIMIT=none] --> | |
12225 | + <string name="bluetooth_connect_access_notification_title">Bluetooth device available</string> | |
12226 | + <!-- Bluetooth connect permission alert for notification content [CHAR LIMIT=none] --> | |
12227 | + <string name="bluetooth_connect_access_notification_content">A device wants to connect. Tap for details.</string> | |
12228 | + <!-- Bluetooth connect permission alert for dialog title [CHAR LIMIT=none] --> | |
12229 | + <string name="bluetooth_connect_access_dialog_title">Connect to Bluetooth device?</string> | |
12230 | + <!-- Bluetooth connect permission alert for dialog content [CHAR LIMIT=none] --> | |
12231 | + <string name="bluetooth_connect_access_dialog_content"><xliff:g id="device_name" example="My device">%1$s</xliff:g> wants to connect to this phone.\n\nYou haven\u2019t connected to <xliff:g id="device_name" example="My device">%2$s</xliff:g> before.</string> | |
12232 | + <!-- Strings for Dialog don't connect button --> | |
12233 | + <string name="bluetooth_connect_access_dialog_negative">Don\u2019t connect</string> | |
12234 | + <!-- Strings for Dialog connect button --> | |
12235 | + <string name="bluetooth_connect_access_dialog_positive">Connect</string> | |
12215 | 12236 | </resources> |
@@ -25,6 +25,7 @@ import android.content.DialogInterface; | ||
25 | 25 | import android.content.Intent; |
26 | 26 | import android.content.IntentFilter; |
27 | 27 | import android.os.Bundle; |
28 | +import android.telephony.TelephonyManager; | |
28 | 29 | import android.util.Log; |
29 | 30 | import android.view.View; |
30 | 31 | import android.widget.Button; |
@@ -94,13 +95,13 @@ public class BluetoothPermissionActivity extends AlertActivity implements | ||
94 | 95 | if(DEBUG) Log.i(TAG, "onCreate() Request type: " + mRequestType); |
95 | 96 | |
96 | 97 | if (mRequestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION) { |
97 | - showDialog(getString(R.string.bluetooth_connection_permission_request), mRequestType); | |
98 | + showDialog(getString(R.string.bluetooth_connect_access_dialog_title), mRequestType); | |
98 | 99 | } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) { |
99 | 100 | showDialog(getString(R.string.bluetooth_phonebook_access_dialog_title), mRequestType); |
100 | 101 | } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) { |
101 | 102 | showDialog(getString(R.string.bluetooth_message_access_dialog_title), mRequestType); |
102 | 103 | } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) { |
103 | - showDialog(getString(R.string.bluetooth_sap_request), mRequestType); | |
104 | + showDialog(getString(R.string.bluetooth_sim_card_access_dialog_title), mRequestType); | |
104 | 105 | } |
105 | 106 | else { |
106 | 107 | Log.e(TAG, "Error: bad request type: " + mRequestType); |
@@ -133,9 +134,14 @@ public class BluetoothPermissionActivity extends AlertActivity implements | ||
133 | 134 | p.mView = createSapDialogView(); |
134 | 135 | break; |
135 | 136 | } |
136 | - p.mPositiveButtonText = getString(R.string.allow); | |
137 | + p.mPositiveButtonText = getString( | |
138 | + requestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION | |
139 | + ? R.string.bluetooth_connect_access_dialog_positive : R.string.allow); | |
137 | 140 | p.mPositiveButtonListener = this; |
138 | - p.mNegativeButtonText = getString(R.string.request_manage_bluetooth_permission_dont_allow); | |
141 | + p.mNegativeButtonText = getString( | |
142 | + requestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION | |
143 | + ? R.string.bluetooth_connect_access_dialog_negative | |
144 | + : R.string.request_manage_bluetooth_permission_dont_allow); | |
139 | 145 | p.mNegativeButtonListener = this; |
140 | 146 | mOkButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE); |
141 | 147 | setupAlert(); |
@@ -156,8 +162,8 @@ public class BluetoothPermissionActivity extends AlertActivity implements | ||
156 | 162 | String mRemoteName = Utils.createRemoteName(this, mDevice); |
157 | 163 | mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null); |
158 | 164 | messageView = (TextView)mView.findViewById(R.id.message); |
159 | - messageView.setText(getString(R.string.bluetooth_connection_dialog_text, | |
160 | - mRemoteName)); | |
165 | + messageView.setText(getString(R.string.bluetooth_connect_access_dialog_content, | |
166 | + mRemoteName, mRemoteName)); | |
161 | 167 | return mView; |
162 | 168 | } |
163 | 169 |
@@ -181,10 +187,11 @@ public class BluetoothPermissionActivity extends AlertActivity implements | ||
181 | 187 | |
182 | 188 | private View createSapDialogView() { |
183 | 189 | String mRemoteName = Utils.createRemoteName(this, mDevice); |
190 | + TelephonyManager tm = getSystemService(TelephonyManager.class); | |
184 | 191 | mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null); |
185 | 192 | messageView = (TextView)mView.findViewById(R.id.message); |
186 | - messageView.setText(getString(R.string.bluetooth_sap_acceptance_dialog_text, | |
187 | - mRemoteName, mRemoteName)); | |
193 | + messageView.setText(getString(R.string.bluetooth_sim_card_access_dialog_content, | |
194 | + mRemoteName, mRemoteName, tm.getLine1Number())); | |
188 | 195 | return mView; |
189 | 196 | } |
190 | 197 |
@@ -144,13 +144,17 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { | ||
144 | 144 | R.string.bluetooth_message_access_notification_content); |
145 | 145 | break; |
146 | 146 | case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS: |
147 | - title = context.getString(R.string.bluetooth_sap_request); | |
148 | - message = context.getString(R.string.bluetooth_sap_acceptance_dialog_text, | |
147 | + title = context.getString( | |
148 | + R.string.bluetooth_sim_card_access_notification_title); | |
149 | + message = context.getString( | |
150 | + R.string.bluetooth_sim_card_access_notification_content, | |
149 | 151 | deviceAlias, deviceAlias); |
150 | 152 | break; |
151 | 153 | default: |
152 | - title = context.getString(R.string.bluetooth_connection_permission_request); | |
153 | - message = context.getString(R.string.bluetooth_connection_dialog_text, | |
154 | + title = context.getString( | |
155 | + R.string.bluetooth_connect_access_notification_title); | |
156 | + message = context.getString( | |
157 | + R.string.bluetooth_connect_access_notification_content, | |
154 | 158 | deviceAlias, deviceAlias); |
155 | 159 | break; |
156 | 160 | } |