<activity android:name=".wifi.WifiSetupActivity"
android:taskAffinity="com.android.wizard"
- android:theme="@style/SetupWizardWifiTheme"
+ android:theme="@style/SetupWizardDisableAppStartingTheme"
android:label="@string/wifi_setup_wizard_title"
android:icon="@drawable/empty_icon"
android:clearTaskOnLaunch="true">
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:maxLevel="0" android:drawable="@drawable/ic_wifi_lock_signal_1_teal" />
+ <item android:maxLevel="1" android:drawable="@drawable/ic_wifi_lock_signal_2_teal" />
+ <item android:maxLevel="2" android:drawable="@drawable/ic_wifi_lock_signal_3_teal" />
+ <item android:maxLevel="3" android:drawable="@drawable/ic_wifi_lock_signal_4_teal" />
+</level-list>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:maxLevel="0" android:drawable="@drawable/ic_wifi_signal_1_teal" />
+ <item android:maxLevel="1" android:drawable="@drawable/ic_wifi_signal_2_teal" />
+ <item android:maxLevel="2" android:drawable="@drawable/ic_wifi_signal_3_teal" />
+ <item android:maxLevel="3" android:drawable="@drawable/ic_wifi_signal_4_teal" />
+</level-list>
+
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
+ <item settings:state_encrypted="true" android:drawable="@drawable/wifi_signal_lock_teal" />
+ <item settings:state_encrypted="false" android:drawable="@drawable/wifi_signal_open_teal" />
+</selector>
android:textColor="@*android:color/secondary_text_material_light"
android:visibility="gone" />
+ <TextView
+ android:id="@+id/phonebook_sharing_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/bluetooth_dialog_padding"
+ android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
+ android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
+ android:gravity="center_vertical"
+ android:text="@string/bluetooth_pairing_will_share_phonebook"
+ android:textSize="12sp" />
+
</LinearLayout>
</ScrollView>
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMedium" />
+ <TextView
+ android:id="@+id/phonebook_sharing_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/bluetooth_dialog_padding"
+ android:layout_marginEnd="@dimen/bluetooth_dialog_padding"
+ android:layout_marginBottom="@dimen/bluetooth_dialog_padding"
+ android:gravity="center_vertical"
+ android:text="@string/bluetooth_pairing_will_share_phonebook"
+ android:textSize="12sp" />
+
</LinearLayout>
</ScrollView>
android:layout_marginLeft="@dimen/wifi_assistant_padding_start_end"
android:layout_marginRight="@dimen/wifi_assistant_padding_start_end"
android:gravity="start"
- android:text="@string/wifi_assistant_title_message"
android:textAppearance="?android:attr/textAppearanceMedium" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<!-- Button text for declining an incoming pairing request. [CHAR LIMIT=20] -->
<string name="bluetooth_pairing_decline">Cancel</string>
+ <!-- Message in pairing dialogs. [CHAR LIMIT=NONE] -->
+ <string name="bluetooth_pairing_will_share_phonebook">Pairing grants access to your contacts and call history when connected.</string>
+
<!-- Title for BT error dialogs. -->
<string name="bluetooth_error_title"></string>
<!-- Message for the error dialog when BT pairing fails generically. -->
<!-- Wifi Assistant title. [CHAR LIMIT=40] -->
<string name="wifi_assistant_title">Wi\u2011Fi Assistant</string>
<!-- Wifi Assistant title message. First piece of text on the Wifi Assistant setup wizard. [CHAR LIMIT=200] -->
- <string name="wifi_assistant_title_message">Google Wi\u2011Fi Assistant automatically connects you to the best available Wi\u2011Fi</string>
- <!-- Wifi Assistant explanation message. Explains what wifi assistant does to the android phone. [CHAR LIMIT=200] -->
- <string name="wifi_assistant_explanation_message">Google Wi\u2011Fi Assistant detects the networks available to you and connects your device to the one with the best speed and reliability.</string>
- <!-- Wifi Assistant vpn message. Explains to the user that Google may use/provide a secure VPN connecte to Google's servers. [CHAR LIMIT=100] -->
- <string name="wifi_assistant_vpn_message">To help protect your data, Google Wi\u2011Fi Assistant may provide a secure VPN connection through Google servers.</string>
- <!-- Wifi Assistant No, thanks string. Text to say no to wifi assistant. [CHAR LIMIT=20] -->
- <string name="wifi_assistant_activity_no_thanks">No, thanks</string>
- <!-- Wifi Assistant Yes string. Text to say yes to wifi assistant. [CHAR LIMIT=20] -->
- <string name="wifi_assistant_activity_yes">YES, I\'M IN</string>
- <!-- Wifi Assistant Dialog title. [CHAR LIMIT=30] -->
- <string name="wifi_assistant_dialog_title">Connection Request</string>
- <!-- Wifi Assistant Dialog message. Explains what monitor may occur with wifi-assistant [CHAR LIMIT=100] -->
- <string name="wifi_assistant_dialog_message">Wi\u2011Fi Assistant" wants to set up a VPN connection that allows it to monitor network traffic. Only accept if you trust the source.</string>
- <!-- Wifi Assistant Dialog message. Notice of the icon that will appear when wifi assistant is on. [CHAR LIMIT=100] -->
- <string name="wifi_assistant_dialog_notice">appears at the top of your screen when VPN is active.</string>
- <!-- Wifi Assistant dialog accept. [CHAR LIMIT=20] -->
- <string name="wifi_assistant_accept">ACCEPT</string>
- <!-- Wifi Assistant dialog deny. [CHAR LIMIT=20] -->
- <string name="wifi_assistant_deny">DENY</string>
- <!-- Wifi Assistant Network Monitoring titile. [CHAR LIMIT=40] -->
- <string name="wifi_assistant_network_title">Network monitoring</string>
- <!-- Wifi Assistant permission accepted message. [CHAR LIMIT=140] -->
- <string name="wifi_assistant_permission_accepted">You gave “Google Wi\u2011Fi Assistant” permission to set up a VPN connection. That means this app can monitor network traffic.</string>
+ <string name="wifi_assistant_title_message"><xliff:g id="wifi_assistant">%1$s</xliff:g> automatically connects you to the best available Wi\u2011Fi</string>
<!-- Wifi Assistant open app button text. [CHAR LIMIT=40] -->
<string name="wifi_assistant_open_app">OPEN APP</string>
<string name="wifi_automatically_manage_title">Automatically manage Wi\u2011Fi</string>
<!-- Checkbox summary for option to Automatically manage Wi\u2011Fi [CHAR LIMIT=100] -->
<string name="wifi_automatically_manage_summary">Let <xliff:g id="wifi_assistant">%1$s</xliff:g> manage your Wi\u2011Fi connection</string>
- <!-- Checkbox title for option for Wi\u2011Fi Assistant [CHAR LIMIT=40] -->
- <string name="wifi_assistant_setting_title">Wi\u2011Fi assistant</string>
- <!-- Checkbox summary for option for Wi\u2011Fi Assistant [CHAR LIMIT=40] -->
- <string name="wifi_assistant_setting_summary">Google Wi\u2011Fi Assistant</string>
<!-- Preference title for option to install certificates -->
<string name="wifi_install_credentials">Install certificates</string>
<string name="wifi_scan_notify_text_location_on">To improve location accuracy and for other purposes, Google and other apps may scan for nearby networks, even when Wi-Fi is off. If you don\'t want this to happen, go to Advanced > Scanning always available.</string>
<attr name="wifi_signal_color" format="reference" />
<attr name="wifi_signal" format="reference" />
+ <style name="SetupWizardDisableAppStartingTheme">
+ <!-- Theme to disable the app starting window. The actual theme of the activity needs to
+ be then set in code via setTheme or onApplyThemeResource. -->
+ <item name="android:windowBackground">@null</item>
+ </style>
+
<style name="SetupWizardWifiTheme" parent="android:Theme.Material.NoActionBar">
<item name="android:alertDialogTheme">@style/Theme.WifiDialog</item>
<item name="android:colorAccent">@color/setup_wizard_color_accent_dark</item>
<item name="ic_wps">@drawable/ic_wps_dark</item>
<item name="setup_divider_color">@color/setup_divider_color_dark</item>
<item name="wifi_signal_color">@color/setup_wizard_wifi_color_dark</item>
- <item name="wifi_signal">@drawable/wifi_signal_colored</item>
+ <item name="wifi_signal">@drawable/wifi_signal_teal</item>
<item name="preferenceBackgroundColor">@color/setup_wizard_preference_background_color_dark</item>
</style>
<item name="ic_wps">@drawable/ic_wps_light</item>
<item name="setup_divider_color">@color/setup_divider_color_light</item>
<item name="wifi_signal_color">@color/setup_wizard_wifi_color_light</item>
- <item name="wifi_signal">@drawable/wifi_signal_colored</item>
+ <item name="wifi_signal">@drawable/wifi_signal_teal</item>
<item name="preferenceBackgroundColor">@color/setup_wizard_preference_background_color_light</item>
</style>
<item name="ic_menu_add">@drawable/ic_menu_add_dark</item>
<item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_holo_dark</item>
<item name="ic_wps">@drawable/ic_wps_dark</item>
- <item name="wifi_signal">@drawable/wifi_signal_light</item>
+ <item name="wifi_signal">@drawable/wifi_signal_teal</item>
<!-- Redefine the ActionBar style for contentInsetStart -->
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
<SwitchPreference
android:key="wifi_assistant"
android:title="@string/wifi_automatically_manage_title"
- android:summary="@string/wifi_assistant_setting_summary"
android:persistent="false" />
<ListPreference
private static final int BLUETOOTH_PIN_MAX_LENGTH = 16;
private static final int BLUETOOTH_PASSKEY_MAX_LENGTH = 6;
+
+ private LocalBluetoothManager mBluetoothManager;
+ private CachedBluetoothDeviceManager mCachedDeviceManager;
private BluetoothDevice mDevice;
private int mType;
private String mPairingKey;
return;
}
- LocalBluetoothManager manager = LocalBluetoothManager.getInstance(this);
- if (manager == null) {
+ mBluetoothManager = LocalBluetoothManager.getInstance(this);
+ if (mBluetoothManager == null) {
Log.e(TAG, "Error: BluetoothAdapter not supported by system");
finish();
return;
}
- CachedBluetoothDeviceManager deviceManager = manager.getCachedDeviceManager();
+ mCachedDeviceManager = mBluetoothManager.getCachedDeviceManager();
mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
mType = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
- createUserEntryDialog(deviceManager);
+ createUserEntryDialog();
break;
case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION:
return;
}
mPairingKey = String.format(Locale.US, "%06d", passkey);
- createConfirmationDialog(deviceManager);
+ createConfirmationDialog();
break;
case BluetoothDevice.PAIRING_VARIANT_CONSENT:
case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT:
- createConsentDialog(deviceManager);
+ createConsentDialog();
break;
case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY:
} else {
mPairingKey = String.format("%04d", pairingKey);
}
- createDisplayPasskeyOrPinDialog(deviceManager);
+ createDisplayPasskeyOrPinDialog();
break;
default:
registerReceiver(mReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
}
- private void createUserEntryDialog(CachedBluetoothDeviceManager deviceManager) {
+ private void createUserEntryDialog() {
final AlertController.AlertParams p = mAlertParams;
p.mTitle = getString(R.string.bluetooth_pairing_request);
- p.mView = createPinEntryView(deviceManager.getName(mDevice));
+ p.mView = createPinEntryView();
p.mPositiveButtonText = getString(android.R.string.ok);
p.mPositiveButtonListener = this;
p.mNegativeButtonText = getString(android.R.string.cancel);
mOkButton.setEnabled(false);
}
- private View createPinEntryView(String deviceName) {
+ private View createPinEntryView() {
View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null);
TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
}
messageViewCaption.setText(messageId1);
- messageViewContent.setText(deviceName);
+ messageViewContent.setText(mCachedDeviceManager.getName(mDevice));
messageView2.setText(messageId2);
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
mPairingView.setFilters(new InputFilter[] {
return view;
}
- private View createView(CachedBluetoothDeviceManager deviceManager) {
+ private View createView() {
View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null);
// Escape device name to avoid HTML injection.
- String name = Html.escapeHtml(deviceManager.getName(mDevice));
+ String name = Html.escapeHtml(mCachedDeviceManager.getName(mDevice));
TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption);
TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead);
TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption);
return view;
}
- private void createConfirmationDialog(CachedBluetoothDeviceManager deviceManager) {
+ private void createConfirmationDialog() {
final AlertController.AlertParams p = mAlertParams;
p.mTitle = getString(R.string.bluetooth_pairing_request);
- p.mView = createView(deviceManager);
+ p.mView = createView();
p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
p.mPositiveButtonListener = this;
p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
setupAlert();
}
- private void createConsentDialog(CachedBluetoothDeviceManager deviceManager) {
+ private void createConsentDialog() {
final AlertController.AlertParams p = mAlertParams;
p.mTitle = getString(R.string.bluetooth_pairing_request);
- p.mView = createView(deviceManager);
+ p.mView = createView();
p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
p.mPositiveButtonListener = this;
p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
setupAlert();
}
- private void createDisplayPasskeyOrPinDialog(
- CachedBluetoothDeviceManager deviceManager) {
+ private void createDisplayPasskeyOrPinDialog() {
final AlertController.AlertParams p = mAlertParams;
p.mTitle = getString(R.string.bluetooth_pairing_request);
- p.mView = createView(deviceManager);
+ p.mView = createView();
p.mNegativeButtonText = getString(android.R.string.cancel);
p.mNegativeButtonListener = this;
setupAlert();
}
}
+ private void allowPhonebookAccess() {
+ CachedBluetoothDevice cachedDevice = mCachedDeviceManager.findDevice(mDevice);
+ if (cachedDevice == null) {
+ cachedDevice = mCachedDeviceManager.addDevice(
+ mBluetoothManager.getBluetoothAdapter(),
+ mBluetoothManager.getProfileManager(),
+ mDevice);
+ }
+ cachedDevice.setPhonebookPermissionChoice(CachedBluetoothDevice.ACCESS_ALLOWED);
+ }
+
private void onPair(String value) {
+ allowPhonebookAccess();
+
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
byte[] pinBytes = BluetoothDevice.convertPinToBytes(value);
import android.preference.Preference;
import android.util.Log;
import android.view.View;
-import android.widget.CheckBox;
-import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.Button;
-import android.widget.CompoundButton.OnCheckedChangeListener;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
String action = intent.getAction();
if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL)) {
int requestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
- BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);
+ BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);
if (requestType != mRequestType) return;
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (mDevice.equals(device)) dismissDialog();
private void onPositive() {
if (DEBUG) Log.d(TAG, "onPositive");
- savePermissionChoice(mRequestType, CachedBluetoothDevice.ACCESS_ALLOWED);
- // TODO(edjee): Now that we always save the user's choice,
- // we can get rid of BluetoothDevice#EXTRA_ALWAYS_ALLOWED.
- sendIntentToReceiver(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY, true,
- BluetoothDevice.EXTRA_ALWAYS_ALLOWED, true);
+ sendReplyIntentToReceiver(true, true);
finish();
}
private void onNegative() {
if (DEBUG) Log.d(TAG, "onNegative");
- savePermissionChoice(mRequestType, CachedBluetoothDevice.ACCESS_REJECTED);
- sendIntentToReceiver(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY, false,
- null, false // dummy value, no effect since last param is null
- );
- finish();
+
+ boolean always = true;
+ if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
+ LocalBluetoothManager bluetoothManager = LocalBluetoothManager.getInstance(this);
+ CachedBluetoothDeviceManager cachedDeviceManager =
+ bluetoothManager.getCachedDeviceManager();
+ CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
+ if (cachedDevice == null) {
+ cachedDevice = cachedDeviceManager.addDevice(bluetoothManager.getBluetoothAdapter(),
+ bluetoothManager.getProfileManager(),
+ mDevice);
+ }
+ always = cachedDevice.checkAndIncreaseMessageRejectionCount();
+ }
+
+ sendReplyIntentToReceiver(false, always);
}
- private void sendIntentToReceiver(final String intentName, final boolean allowed,
- final String extraName, final boolean extraValue) {
- Intent intent = new Intent(intentName);
+ private void sendReplyIntentToReceiver(final boolean allowed, final boolean always) {
+ Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY);
if (mReturnPackage != null && mReturnClass != null) {
intent.setClassName(mReturnPackage, mReturnClass);
}
- if(DEBUG) Log.i(TAG, "sendIntentToReceiver() Request type: " + mRequestType +
+ if (DEBUG) Log.i(TAG, "sendReplyIntentToReceiver() Request type: " + mRequestType +
" mReturnPackage" + mReturnPackage + " mReturnClass" + mReturnClass);
intent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT,
- allowed ? BluetoothDevice.CONNECTION_ACCESS_YES :
- BluetoothDevice.CONNECTION_ACCESS_NO);
-
- if (extraName != null) {
- intent.putExtra(extraName, extraValue);
- }
+ allowed ? BluetoothDevice.CONNECTION_ACCESS_YES
+ : BluetoothDevice.CONNECTION_ACCESS_NO);
+ intent.putExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, always);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
public boolean onPreferenceChange(Preference preference, Object newValue) {
return true;
}
-
- private void savePermissionChoice(int permissionType, int permissionChoice) {
- LocalBluetoothManager bluetoothManager = LocalBluetoothManager.getInstance(this);
- CachedBluetoothDeviceManager cachedDeviceManager =
- bluetoothManager.getCachedDeviceManager();
- CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
- if (DEBUG) Log.d(TAG, "savePermissionChoice permissionType: " + permissionType);
- if (cachedDevice == null ) {
- cachedDevice = cachedDeviceManager.addDevice(bluetoothManager.getBluetoothAdapter(),
- bluetoothManager.getProfileManager(),
- mDevice);
- }
- if(permissionType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS){
- cachedDevice.setPhonebookPermissionChoice(permissionChoice);
- }else if (permissionType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS){
- cachedDevice.setMessagePermissionChoice(permissionChoice);
- }
- }
-
}
if (DEBUG) Log.d(TAG, "onReceive request type: " + mRequestType + " return "
+ mReturnPackage + "," + mReturnClass);
- // Check if user had made decisions on accepting or rejecting the phonebook access
- // request. If there is, reply the request and return, no need to start permission
- // activity dialog or notification.
+ // Even if the user has already made the choice, Bluetooth still may not know that if
+ // the user preference data have not been migrated from Settings app's shared
+ // preferences to Bluetooth app's. In that case, Bluetooth app broadcasts an
+ // ACTION_CONNECTION_ACCESS_REQUEST intent to ask to Settings app.
+ //
+ // If that happens, 'checkUserChoice()' here will do migration because it finds or
+ // creates a 'CachedBluetoothDevice' object for the device.
+ //
+ // After migration is done, 'checkUserChoice()' replies to the request by sending an
+ // ACTION_CONNECTION_ACCESS_REPLY intent. And we don't need to start permission activity
+ // dialog or notification.
if (checkUserChoice()) {
return;
}
Intent connectionAccessIntent = new Intent(action);
connectionAccessIntent.setClass(context, BluetoothPermissionActivity.class);
- // We use the FLAG_ACTIVITY_MULTIPLE_TASK since we can have multiple concurrent access requests
- connectionAccessIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
- connectionAccessIntent.setType(Integer.toString(mRequestType)); /* This is needed to create two pending
- intents to the same activity.
- The value is not used in the activity. */
+ // We use the FLAG_ACTIVITY_MULTIPLE_TASK since we can have multiple concurrent access
+ // requests.
+ connectionAccessIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
+ // This is needed to create two pending intents to the same activity. The value is not
+ // used in the activity.
+ connectionAccessIntent.setType(Integer.toString(mRequestType));
connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
mRequestType);
connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
PowerManager powerManager =
(PowerManager) context.getSystemService(Context.POWER_SERVICE);
- if (powerManager.isScreenOn() &&
- LocalBluetoothPreferences.shouldShowDialogInForeground(context, deviceAddress) ) {
+ if (powerManager.isScreenOn()
+ && LocalBluetoothPreferences.shouldShowDialogInForeground(
+ context, deviceAddress)) {
context.startActivity(connectionAccessIntent);
} else {
// Put up a notification that leads to the dialog
switch (mRequestType) {
case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS:
title = context.getString(R.string.bluetooth_phonebook_request);
- message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text, deviceName, deviceName);
+ message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text,
+ deviceName, deviceName);
break;
case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS:
title = context.getString(R.string.bluetooth_map_request);
- message = context.getString(R.string.bluetooth_map_acceptance_dialog_text, deviceName, deviceName);
+ message = context.getString(R.string.bluetooth_map_acceptance_dialog_text,
+ deviceName, deviceName);
break;
default:
title = context.getString(R.string.bluetooth_connection_permission_request);
- message = context.getString(R.string.bluetooth_connection_dialog_text, deviceName, deviceName);
+ message = context.getString(R.string.bluetooth_connection_dialog_text,
+ deviceName, deviceName);
break;
}
Notification notification = new Notification.Builder(context)
com.android.internal.R.color.system_notification_accent_color))
.build();
- notification.flags |= Notification.FLAG_NO_CLEAR; /* cannot be set with the builder */
+ notification.flags |= Notification.FLAG_NO_CLEAR; // Cannot be set with the builder.
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.notify(getNotificationTag(mRequestType),NOTIFICATION_ID, notification);
+ notificationManager.notify(getNotificationTag(mRequestType), NOTIFICATION_ID,
+ notification);
}
} else if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL)) {
// Remove the notification
// ignore if it is something else than phonebook/message settings it wants us to remember
if (mRequestType != BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS
&& mRequestType != BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
- if (DEBUG) Log.d(TAG, "Unknown RequestType: " + mRequestType);
+ if (DEBUG) Log.d(TAG, "checkUserChoice(): Unknown RequestType " + mRequestType);
return processed;
}
CachedBluetoothDeviceManager cachedDeviceManager =
bluetoothManager.getCachedDeviceManager();
CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
-
if (cachedDevice == null) {
cachedDevice = cachedDeviceManager.addDevice(bluetoothManager.getBluetoothAdapter(),
bluetoothManager.getProfileManager(), mDevice);
}
- if(mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) {
+ String intentName = BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY;
+ if (mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) {
int phonebookPermission = cachedDevice.getPhonebookPermissionChoice();
if (phonebookPermission == CachedBluetoothDevice.ACCESS_UNKNOWN) {
- return processed;
- }
-
- String intentName = BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY;
- if (phonebookPermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
- sendIntentToReceiver(intentName, true, BluetoothDevice.EXTRA_ALWAYS_ALLOWED, true);
+ // Leave 'processed' as false.
+ } else if (phonebookPermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
+ sendReplyIntentToReceiver(true);
processed = true;
} else if (phonebookPermission == CachedBluetoothDevice.ACCESS_REJECTED) {
- sendIntentToReceiver(intentName, false,
- null, false ); // dummy value, no effect since previous param is null
+ sendReplyIntentToReceiver(false);
processed = true;
} else {
Log.e(TAG, "Bad phonebookPermission: " + phonebookPermission);
}
-
- } else if(mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
-
+ } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
int messagePermission = cachedDevice.getMessagePermissionChoice();
if (messagePermission == CachedBluetoothDevice.ACCESS_UNKNOWN) {
- return processed;
- }
-
- String intentName = BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY;
- if (messagePermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
- sendIntentToReceiver(intentName, true, BluetoothDevice.EXTRA_ALWAYS_ALLOWED, true);
+ // Leave 'processed' as false.
+ } else if (messagePermission == CachedBluetoothDevice.ACCESS_ALLOWED) {
+ sendReplyIntentToReceiver(true);
processed = true;
} else if (messagePermission == CachedBluetoothDevice.ACCESS_REJECTED) {
- sendIntentToReceiver(intentName, false,
- null, false); // dummy value, no effect since previous param is null
+ sendReplyIntentToReceiver(false);
processed = true;
} else {
Log.e(TAG, "Bad messagePermission: " + messagePermission);
}
}
- if(DEBUG) Log.d(TAG,"checkUserChoice(): returning " + processed);
+ if (DEBUG) Log.d(TAG,"checkUserChoice(): returning " + processed);
return processed;
}
- private void sendIntentToReceiver(final String intentName, final boolean allowed,
- final String extraName, final boolean extraValue) {
- Intent intent = new Intent(intentName);
+ private void sendReplyIntentToReceiver(final boolean allowed) {
+ Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY);
if (mReturnPackage != null && mReturnClass != null) {
intent.setClassName(mReturnPackage, mReturnClass);
}
intent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT,
- allowed ? BluetoothDevice.CONNECTION_ACCESS_YES :
- BluetoothDevice.CONNECTION_ACCESS_NO);
-
- if (extraName != null) {
- intent.putExtra(extraName, extraValue);
- }
+ allowed ? BluetoothDevice.CONNECTION_ACCESS_YES
+ : BluetoothDevice.CONNECTION_ACCESS_NO);
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH_ADMIN);
private int mMessagePermissionChoice;
- private int mPhonebookRejectedTimes;
-
- private int mMessageRejectedTimes;
+ private int mMessageRejectionCount;
private final Collection<Callback> mCallbacks = new ArrayList<Callback>();
// User has rejected the connection and let Settings app remember the decision
public final static int ACCESS_REJECTED = 2;
- // how many times did User reject the connection to make the rejected persist.
- final static int PERSIST_REJECTED_TIMES_LIMIT = 2;
+ // How many times user should reject the connection to make the choice persist.
+ private final static int MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST = 2;
- private final static String PHONEBOOK_PREFS_NAME = "bluetooth_phonebook_permission";
- private final static String MESSAGE_PREFS_NAME = "bluetooth_message_permission";
- private final static String PHONEBOOK_REJECT_TIMES = "bluetooth_phonebook_reject";
- private final static String MESSAGE_REJECT_TIMES = "bluetooth_message_reject";
+ private final static String MESSAGE_REJECTION_COUNT_PREFS_NAME = "bluetooth_message_reject";
/**
* When we connect to multiple profiles, we only want to display a single
fetchName();
fetchBtClass();
updateProfiles();
- fetchPhonebookPermissionChoice();
- fetchMessagePermissionChoice();
- fetchPhonebookRejectTimes();
- fetchMessageRejectTimes();
+ migratePhonebookPermissionChoice();
+ migrateMessagePermissionChoice();
+ fetchMessageRejectionCount();
mVisible = false;
dispatchAttributesChanged();
mConnectAfterPairing = false; // cancel auto-connect
setPhonebookPermissionChoice(ACCESS_UNKNOWN);
setMessagePermissionChoice(ACCESS_UNKNOWN);
- mPhonebookRejectedTimes = 0;
- savePhonebookRejectTimes();
- mMessageRejectedTimes = 0;
- saveMessageRejectTimes();
+ mMessageRejectionCount = 0;
+ saveMessageRejectionCount();
}
refresh();
}
int getPhonebookPermissionChoice() {
- return mPhonebookPermissionChoice;
+ int permission = mDevice.getPhonebookAccessPermission();
+ if (permission == BluetoothDevice.ACCESS_ALLOWED) {
+ return ACCESS_ALLOWED;
+ } else if (permission == BluetoothDevice.ACCESS_REJECTED) {
+ return ACCESS_REJECTED;
+ }
+ return ACCESS_UNKNOWN;
}
void setPhonebookPermissionChoice(int permissionChoice) {
- // if user reject it, only save it when reject exceed limit.
- if (permissionChoice == ACCESS_REJECTED) {
- mPhonebookRejectedTimes++;
- savePhonebookRejectTimes();
- if (mPhonebookRejectedTimes < PERSIST_REJECTED_TIMES_LIMIT) {
- return;
- }
- }
-
- mPhonebookPermissionChoice = permissionChoice;
-
- SharedPreferences.Editor editor =
- mContext.getSharedPreferences(PHONEBOOK_PREFS_NAME, Context.MODE_PRIVATE).edit();
- if (permissionChoice == ACCESS_UNKNOWN) {
- editor.remove(mDevice.getAddress());
- } else {
- editor.putInt(mDevice.getAddress(), permissionChoice);
+ int permission = BluetoothDevice.ACCESS_UNKNOWN;
+ if (permissionChoice == ACCESS_ALLOWED) {
+ permission = BluetoothDevice.ACCESS_ALLOWED;
+ } else if (permissionChoice == ACCESS_REJECTED) {
+ permission = BluetoothDevice.ACCESS_REJECTED;
}
- editor.commit();
- }
-
- private void fetchPhonebookPermissionChoice() {
- SharedPreferences preference = mContext.getSharedPreferences(PHONEBOOK_PREFS_NAME,
- Context.MODE_PRIVATE);
- mPhonebookPermissionChoice = preference.getInt(mDevice.getAddress(),
- ACCESS_UNKNOWN);
+ mDevice.setPhonebookAccessPermission(permission);
}
- private void fetchPhonebookRejectTimes() {
- SharedPreferences preference = mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
- Context.MODE_PRIVATE);
- mPhonebookRejectedTimes = preference.getInt(mDevice.getAddress(), 0);
- }
+ // Migrates data from old data store (in Settings app's shared preferences) to new (in Bluetooth
+ // app's shared preferences).
+ private void migratePhonebookPermissionChoice() {
+ SharedPreferences preferences = mContext.getSharedPreferences(
+ "bluetooth_phonebook_permission", Context.MODE_PRIVATE);
+ if (!preferences.contains(mDevice.getAddress())) {
+ return;
+ }
- private void savePhonebookRejectTimes() {
- SharedPreferences.Editor editor =
- mContext.getSharedPreferences(PHONEBOOK_REJECT_TIMES,
- Context.MODE_PRIVATE).edit();
- if (mPhonebookRejectedTimes == 0) {
- editor.remove(mDevice.getAddress());
- } else {
- editor.putInt(mDevice.getAddress(), mPhonebookRejectedTimes);
+ if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_UNKNOWN) {
+ int oldPermission = preferences.getInt(mDevice.getAddress(), ACCESS_UNKNOWN);
+ if (oldPermission == ACCESS_ALLOWED) {
+ mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+ } else if (oldPermission == ACCESS_REJECTED) {
+ mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+ }
}
+
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.remove(mDevice.getAddress());
editor.commit();
}
int getMessagePermissionChoice() {
- return mMessagePermissionChoice;
+ int permission = mDevice.getMessageAccessPermission();
+ if (permission == BluetoothDevice.ACCESS_ALLOWED) {
+ return ACCESS_ALLOWED;
+ } else if (permission == BluetoothDevice.ACCESS_REJECTED) {
+ return ACCESS_REJECTED;
+ }
+ return ACCESS_UNKNOWN;
}
void setMessagePermissionChoice(int permissionChoice) {
- // if user reject it, only save it when reject exceed limit.
- if (permissionChoice == ACCESS_REJECTED) {
- mMessageRejectedTimes++;
- saveMessageRejectTimes();
- if (mMessageRejectedTimes < PERSIST_REJECTED_TIMES_LIMIT) {
- return;
- }
+ int permission = BluetoothDevice.ACCESS_UNKNOWN;
+ if (permissionChoice == ACCESS_ALLOWED) {
+ permission = BluetoothDevice.ACCESS_ALLOWED;
+ } else if (permissionChoice == ACCESS_REJECTED) {
+ permission = BluetoothDevice.ACCESS_REJECTED;
}
+ mDevice.setMessageAccessPermission(permission);
+ }
- mMessagePermissionChoice = permissionChoice;
+ // Migrates data from old data store (in Settings app's shared preferences) to new (in Bluetooth
+ // app's shared preferences).
+ private void migrateMessagePermissionChoice() {
+ SharedPreferences preferences = mContext.getSharedPreferences(
+ "bluetooth_message_permission", Context.MODE_PRIVATE);
+ if (!preferences.contains(mDevice.getAddress())) {
+ return;
+ }
- SharedPreferences.Editor editor =
- mContext.getSharedPreferences(MESSAGE_PREFS_NAME, Context.MODE_PRIVATE).edit();
- if (permissionChoice == ACCESS_UNKNOWN) {
- editor.remove(mDevice.getAddress());
- } else {
- editor.putInt(mDevice.getAddress(), permissionChoice);
+ if (mDevice.getMessageAccessPermission() == BluetoothDevice.ACCESS_UNKNOWN) {
+ int oldPermission = preferences.getInt(mDevice.getAddress(), ACCESS_UNKNOWN);
+ if (oldPermission == ACCESS_ALLOWED) {
+ mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_ALLOWED);
+ } else if (oldPermission == ACCESS_REJECTED) {
+ mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_REJECTED);
+ }
}
+
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.remove(mDevice.getAddress());
editor.commit();
}
- private void fetchMessagePermissionChoice() {
- SharedPreferences preference = mContext.getSharedPreferences(MESSAGE_PREFS_NAME,
- Context.MODE_PRIVATE);
- mMessagePermissionChoice = preference.getInt(mDevice.getAddress(),
- ACCESS_UNKNOWN);
+ /**
+ * @return Whether this rejection should persist.
+ */
+ boolean checkAndIncreaseMessageRejectionCount() {
+ if (mMessageRejectionCount < MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST) {
+ mMessageRejectionCount++;
+ saveMessageRejectionCount();
+ }
+ return mMessageRejectionCount >= MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST;
}
- private void fetchMessageRejectTimes() {
- SharedPreferences preference = mContext.getSharedPreferences(MESSAGE_REJECT_TIMES,
- Context.MODE_PRIVATE);
- mMessageRejectedTimes = preference.getInt(mDevice.getAddress(), 0);
+ private void fetchMessageRejectionCount() {
+ SharedPreferences preference = mContext.getSharedPreferences(
+ MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE);
+ mMessageRejectionCount = preference.getInt(mDevice.getAddress(), 0);
}
- private void saveMessageRejectTimes() {
- SharedPreferences.Editor editor =
- mContext.getSharedPreferences(MESSAGE_REJECT_TIMES, Context.MODE_PRIVATE).edit();
- if (mMessageRejectedTimes == 0) {
+ private void saveMessageRejectionCount() {
+ SharedPreferences.Editor editor = mContext.getSharedPreferences(
+ MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE).edit();
+ if (mMessageRejectionCount == 0) {
editor.remove(mDevice.getAddress());
} else {
- editor.putInt(mDevice.getAddress(), mMessageRejectedTimes);
+ editor.putInt(mDevice.getAddress(), mMessageRejectionCount);
}
editor.commit();
}
-
}
if (pbapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
final PbapServerProfile psp = mManager.getProfileManager().getPbapProfile();
CheckBoxPreference pbapPref = createProfilePreference(psp);
- pbapPref.setChecked(pbapPermission == CachedBluetoothDevice.ACCESS_ALLOWED);
mProfileContainer.addPreference(pbapPref);
}
pref.setIcon(getResources().getDrawable(iconResource));
}
- /**
- * Gray out profile while connecting and disconnecting
- */
- pref.setEnabled(!mCachedDevice.isBusy());
-
refreshProfilePreference(pref, profile);
return pref;
LocalBluetoothProfile profile) {
BluetoothDevice device = mCachedDevice.getDevice();
- /*
- * Gray out checkbox while connecting and disconnecting
- */
+ // Gray out checkbox while connecting and disconnecting.
profilePref.setEnabled(!mCachedDevice.isBusy());
- profilePref.setChecked(profile.isPreferred(device));
+
+ if (profile instanceof PbapServerProfile) {
+ // Handle PBAP specially.
+ profilePref.setChecked(mCachedDevice.getPhonebookPermissionChoice()
+ == CachedBluetoothDevice.ACCESS_ALLOWED);
+ } else {
+ profilePref.setChecked(profile.isPreferred(device));
+ }
}
private LocalBluetoothProfile getProfileOf(Preference pref) {
}
if (rec.cmd == HistoryItem.CMD_CURRENT_TIME
|| rec.cmd == HistoryItem.CMD_RESET) {
+ // If there is a ridiculously large jump in time, then we won't be
+ // able to create a good chart with that data, so just ignore the
+ // times we got before and pretend like our data extends back from
+ // the time we have now.
+ // Also, if we are getting a time change and we are less than 5 minutes
+ // since the start of the history real time, then also use this new
+ // time to compute the base time, since whatever time we had before is
+ // pretty much just noise.
+ if (rec.currentTime > (lastWallTime+(180*24*60*60*1000L))
+ || rec.time < (mHistStart+(5*60*1000L))) {
+ mStartWallTime = 0;
+ }
lastWallTime = rec.currentTime;
lastRealtime = rec.time;
if (mStartWallTime == 0) {
- mStartWallTime = lastWallTime;
+ mStartWallTime = lastWallTime - (lastRealtime-mHistStart);
}
}
if (rec.isDeltaData()) {
final long walltimeStart = mStartWallTime;
final long walltimeChange = mEndWallTime > walltimeStart
? (mEndWallTime-walltimeStart) : 1;
- long curWalltime = 0;
+ long curWalltime = mStartWallTime;
long lastRealtime = 0;
final int batLow = mBatLow;
boolean lastWifiRunning = false, lastWifiSupplRunning = false, lastCpuRunning = false;
int lastWifiSupplState = BatteryStats.WIFI_SUPPL_STATE_INVALID;
final int N = mNumHist;
- if (mStats.startIteratingHistoryLocked()) {
+ if (mEndDataWallTime > mStartWallTime && mStats.startIteratingHistoryLocked()) {
final HistoryItem rec = new HistoryItem();
while (mStats.getNextHistoryLocked(rec) && i < N) {
- if (rec.cmd == HistoryItem.CMD_CURRENT_TIME || rec.cmd == HistoryItem.CMD_RESET) {
- curWalltime = rec.currentTime;
- lastRealtime = rec.time;
- } else if (curWalltime != 0) {
+ if (rec.isDeltaData()) {
curWalltime += rec.time-lastRealtime;
lastRealtime = rec.time;
- }
- if (curWalltime != 0 && rec.isDeltaData()) {
x = mLevelLeft + (int)(((curWalltime-walltimeStart)*levelWidth)/walltimeChange);
if (x < 0) {
x = 0;
}
}
- } else if (rec.cmd != HistoryItem.CMD_OVERFLOW
- && rec.cmd != HistoryItem.CMD_CURRENT_TIME) {
- if (curLevelPath != null) {
- finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
- lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
- lastCpuRunning, lastLinePath);
- lastX = lastY = -1;
- curLevelPath = null;
- lastLinePath = null;
- lastCharging = lastScreenOn = lastGpsOn = lastCpuRunning = false;
+ } else {
+ long lastWalltime = curWalltime;
+ if (rec.cmd == HistoryItem.CMD_CURRENT_TIME
+ || rec.cmd == HistoryItem.CMD_RESET) {
+ if (rec.currentTime >= mStartWallTime) {
+ curWalltime = rec.currentTime;
+ } else {
+ curWalltime = mStartWallTime + (rec.time-mHistStart);
+ }
+ lastRealtime = rec.time;
+ }
+
+ if (rec.cmd != HistoryItem.CMD_OVERFLOW
+ && (rec.cmd != HistoryItem.CMD_CURRENT_TIME
+ || Math.abs(lastWalltime-curWalltime) > (60*60*1000))) {
+ if (curLevelPath != null) {
+ finishPaths(x+1, h, levelh, startX, lastY, curLevelPath, lastX,
+ lastCharging, lastScreenOn, lastGpsOn, lastWifiRunning,
+ lastCpuRunning, lastLinePath);
+ lastX = lastY = -1;
+ curLevelPath = null;
+ lastLinePath = null;
+ lastCharging = lastScreenOn = lastGpsOn = lastCpuRunning = false;
+ }
}
}
i++;
}
+ mStats.finishIteratingHistoryLocked();
}
if (lastY < 0 || lastX < 0) {
.inflate(R.layout.wifi_assistant_card, getListView(), false);
Button setup = (Button) mWifiAssistantCard.findViewById(R.id.setup);
Button noThanks = (Button) mWifiAssistantCard.findViewById(R.id.no_thanks_button);
+ TextView assistantText =
+ (TextView) mWifiAssistantCard.findViewById(R.id.wifi_assistant_text);
+ assistantText.setText(getResources().getString(
+ R.string.wifi_assistant_title_message, mWifiAssistantApp.mScorerName));
if (setup != null && noThanks != null) {
setup.setOnClickListener(new OnClickListener() {