diff options
author | Casper Bonde <c.bonde@samsung.com> | 2015-05-04 22:04:29 -0700 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-05-05 16:59:17 +0000 |
commit | faadcd60e7ab8fa6eb9b5be7be907129bd3f8575 (patch) | |
tree | eeef6660c2e3335fec07ac6849a7a4e388025b1d /src/com/android/settings/bluetooth | |
parent | 3342d762e98996549aa5cae02ccdc3238eb3a33d (diff) | |
download | packages_apps_Settings-faadcd60e7ab8fa6eb9b5be7be907129bd3f8575.zip packages_apps_Settings-faadcd60e7ab8fa6eb9b5be7be907129bd3f8575.tar.gz packages_apps_Settings-faadcd60e7ab8fa6eb9b5be7be907129bd3f8575.tar.bz2 |
Settings UI for SIM access profile (1/2)
Change-Id: Iff14295ac0eb65561a2097f25c70e8b5f8be5003
Diffstat (limited to 'src/com/android/settings/bluetooth')
-rw-r--r--[-rwxr-xr-x] | src/com/android/settings/bluetooth/BluetoothPermissionActivity.java | 14 | ||||
-rw-r--r-- | src/com/android/settings/bluetooth/BluetoothPermissionRequest.java | 26 |
2 files changed, 38 insertions, 2 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java index 7a1e69d..2267555 100755..100644 --- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java +++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java @@ -101,6 +101,8 @@ public class BluetoothPermissionActivity extends AlertActivity implements showDialog(getString(R.string.bluetooth_phonebook_request), mRequestType); } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) { showDialog(getString(R.string.bluetooth_map_request), mRequestType); + } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) { + showDialog(getString(R.string.bluetooth_sap_request), mRequestType); } else { Log.e(TAG, "Error: bad request type: " + mRequestType); @@ -129,6 +131,9 @@ public class BluetoothPermissionActivity extends AlertActivity implements case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS: p.mView = createMapDialogView(); break; + case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS: + p.mView = createSapDialogView(); + break; } p.mPositiveButtonText = getString(R.string.yes); p.mPositiveButtonListener = this; @@ -183,6 +188,15 @@ public class BluetoothPermissionActivity extends AlertActivity implements return mView; } + private View createSapDialogView() { + String mRemoteName = createRemoteName(); + mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null); + messageView = (TextView)mView.findViewById(R.id.message); + messageView.setText(getString(R.string.bluetooth_sap_acceptance_dialog_text, + mRemoteName, mRemoteName)); + return mView; + } + private void onPositive() { if (DEBUG) Log.d(TAG, "onPositive"); sendReplyIntentToReceiver(true, true); diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java index b3a9571..372f9a5 100644 --- a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java +++ b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java @@ -44,7 +44,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { private static final String NOTIFICATION_TAG_PBAP = "Phonebook Access" ; private static final String NOTIFICATION_TAG_MAP = "Message Access"; - + private static final String NOTIFICATION_TAG_SAP = "SIM Access"; Context mContext; int mRequestType; @@ -139,6 +139,11 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { message = context.getString(R.string.bluetooth_map_acceptance_dialog_text, deviceName, deviceName); break; + case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS: + title = context.getString(R.string.bluetooth_sap_request); + message = context.getString(R.string.bluetooth_sap_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, @@ -184,6 +189,8 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { return NOTIFICATION_TAG_PBAP; } else if(mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) { return NOTIFICATION_TAG_MAP; + } else if(mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) { + return NOTIFICATION_TAG_SAP; } return null; } @@ -198,7 +205,8 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { // 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) { + && mRequestType != BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS + && mRequestType != BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) { if (DEBUG) Log.d(TAG, "checkUserChoice(): Unknown RequestType " + mRequestType); return processed; } @@ -242,6 +250,20 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { } else { Log.e(TAG, "Bad messagePermission: " + messagePermission); } + } else if(mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) { + int simPermission = cachedDevice.getSimPermissionChoice(); + + if (simPermission == CachedBluetoothDevice.ACCESS_UNKNOWN) { + // Leave 'processed' as false. + } else if (simPermission == CachedBluetoothDevice.ACCESS_ALLOWED) { + sendReplyIntentToReceiver(true); + processed = true; + } else if (simPermission == CachedBluetoothDevice.ACCESS_REJECTED) { + sendReplyIntentToReceiver(false); + processed = true; + } else { + Log.e(TAG, "Bad simPermission: " + simPermission); + } } if (DEBUG) Log.d(TAG,"checkUserChoice(): returning " + processed); return processed; |