Settings UI for SIM access profile (1/2)
Change-Id: Iff14295ac0eb65561a2097f25c70e8b5f8be5003
This commit is contained in:
committed by
Andre Eisenbach
parent
3342d762e9
commit
faadcd60e7
@@ -367,6 +367,12 @@
|
||||
<!-- Bluetooth message permission Alert Activity text [CHAR LIMIT=none] -->
|
||||
<string name="bluetooth_map_acceptance_dialog_text">%1$s wants to access your messages. Give access to %2$s?</string>
|
||||
|
||||
<!-- Activity label of BluetoothMessagePermissionActivity for SIM access profile. Also used as Strings in the permission dialog [CHAR LIMIT=none] -->
|
||||
<string name="bluetooth_sap_request">"SIM access request"</string>
|
||||
|
||||
<!-- Bluetooth SIM access permission Alert Activity text [CHAR LIMIT=none] -->
|
||||
<string name="bluetooth_sap_acceptance_dialog_text"><xliff:g id="device_name">%1$s</xliff:g> wants to access your SIM card. Granting access to the SIM card will disable data connectivity on your device for the duration of the connection. Give access to <xliff:g id="device_name">%2$s?</xliff:g></string>
|
||||
|
||||
<!-- Date & time settings screen title -->
|
||||
<string name="date_and_time">Date & time</string>
|
||||
<!-- The title of the activity to pick a time zone. -->
|
||||
|
14
src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
Executable file → Normal file
14
src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
Executable file → Normal file
@@ -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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user