diff options
author | Edward Jee <edjee@google.com> | 2013-09-24 15:29:37 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-09-24 15:29:37 -0700 |
commit | 5fb79db91bd8b12c39a9e1183f670d8c9501258d (patch) | |
tree | 21447e6dee37bf9409eff3dfddc12161f06f1265 | |
parent | 7c84c7f4220d87dab5518cfb541df9583661de71 (diff) | |
parent | 1146695e4b94dd3ea987f942ed8fd86d39a859ce (diff) | |
download | packages_apps_Settings-5fb79db91bd8b12c39a9e1183f670d8c9501258d.zip packages_apps_Settings-5fb79db91bd8b12c39a9e1183f670d8c9501258d.tar.gz packages_apps_Settings-5fb79db91bd8b12c39a9e1183f670d8c9501258d.tar.bz2 |
am 1146695e: am 5ad8bf07: Merge "Once the user allows PBAP phonebook access, do not ask again." into klp-dev
* commit '1146695e4b94dd3ea987f942ed8fd86d39a859ce':
Once the user allows PBAP phonebook access, do not ask again.
-rw-r--r-- | res/layout/bluetooth_access.xml | 11 | ||||
-rw-r--r-- | res/layout/bluetooth_connection_access.xml | 40 | ||||
-rwxr-xr-x | src/com/android/settings/bluetooth/BluetoothPermissionActivity.java | 42 |
3 files changed, 14 insertions, 79 deletions
diff --git a/res/layout/bluetooth_access.xml b/res/layout/bluetooth_access.xml index f398cef..7f42177 100644 --- a/res/layout/bluetooth_access.xml +++ b/res/layout/bluetooth_access.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- /* -** Copyright 2009, The Android Open Source Project +** Copyright 2011, 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. @@ -35,15 +35,6 @@ android:layout_marginEnd="20dip" android:gravity="center_horizontal" android:textAppearance="?android:attr/textAppearanceMedium" /> - - <CheckBox android:id="@+id/bluetooth_remember_choice" - style="?android:attr/textAppearanceMedium" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="20dip" - android:layout_marginBottom="20dip" - android:text="@string/bluetooth_remember_choice" /> - </LinearLayout> </ScrollView> diff --git a/res/layout/bluetooth_connection_access.xml b/res/layout/bluetooth_connection_access.xml deleted file mode 100644 index 7f42177..0000000 --- a/res/layout/bluetooth_connection_access.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2011, 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. -*/ ---> - -<ScrollView - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_height="match_parent" - android:layout_width="match_parent"> - - <LinearLayout - android:layout_height="match_parent" - android:layout_width="match_parent" - android:orientation="vertical"> - - <TextView - android:id="@+id/message" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginStart="20dip" - android:layout_marginEnd="20dip" - android:gravity="center_horizontal" - android:textAppearance="?android:attr/textAppearanceMedium" /> - </LinearLayout> - -</ScrollView> diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java index 012aff0..e73857a 100755 --- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java +++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java @@ -55,8 +55,6 @@ public class BluetoothPermissionActivity extends AlertActivity implements private String mReturnPackage = null; private String mReturnClass = null; - private CheckBox mRememberChoice; - private boolean mRememberChoiceValue = false; private int mRequestType = 0; private BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override @@ -156,64 +154,50 @@ public class BluetoothPermissionActivity extends AlertActivity implements return mRemoteName; } + // TODO(edjee): createConnectionDialogView, createPhonebookDialogView and createMapDialogView + // are similar. Refactor them into one method. + // Also, the string resources bluetooth_remember_choice and bluetooth_pb_remember_choice should + // be removed. private View createConnectionDialogView() { String mRemoteName = createRemoteName(); - mView = getLayoutInflater().inflate(R.layout.bluetooth_connection_access, null); + mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null); messageView = (TextView)mView.findViewById(R.id.message); messageView.setText(getString(R.string.bluetooth_connection_dialog_text, mRemoteName)); return mView; } - private void createCheckbox(int viewId) - { - mRememberChoice = (CheckBox)mView.findViewById(viewId); - mRememberChoice.setChecked(false); - mRememberChoice.setOnCheckedChangeListener(new OnCheckedChangeListener() { - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (isChecked) { - mRememberChoiceValue = true; - } else { - mRememberChoiceValue = false; - } - } - }); - } private View createPhonebookDialogView() { String mRemoteName = createRemoteName(); mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null); messageView = (TextView)mView.findViewById(R.id.message); messageView.setText(getString(R.string.bluetooth_pb_acceptance_dialog_text, mRemoteName, mRemoteName)); - createCheckbox(R.id.bluetooth_remember_choice); return mView; } + private View createMapDialogView() { String mRemoteName = createRemoteName(); mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null); messageView = (TextView)mView.findViewById(R.id.message); messageView.setText(getString(R.string.bluetooth_map_acceptance_dialog_text, mRemoteName, mRemoteName)); - createCheckbox(R.id.bluetooth_remember_choice); return mView; } private void onPositive() { - if (DEBUG) Log.d(TAG, "onPositive mRememberChoiceValue: " + mRememberChoiceValue); - if (mRememberChoiceValue) - savePermissionChoice(mRequestType, CachedBluetoothDevice.ACCESS_ALLOWED); - + 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, mRememberChoiceValue); + BluetoothDevice.EXTRA_ALWAYS_ALLOWED, true); finish(); } private void onNegative() { - if (DEBUG) Log.d(TAG, "onNegative mRememberChoiceValue: " + mRememberChoiceValue); - - if (mRememberChoiceValue) - savePermissionChoice(mRequestType, CachedBluetoothDevice.ACCESS_REJECTED); - + if (DEBUG) Log.d(TAG, "onNegative"); + savePermissionChoice(mRequestType, CachedBluetoothDevice.ACCESS_UNKNOWN); sendIntentToReceiver(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY, false, null, false // dummy value, no effect since last param is null ); |