Merge "Fix bluetooth settings will broadcast to anywhere when some cases" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
47b254ad88
@@ -32,6 +32,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.app.AlertActivity;
|
||||
import com.android.internal.app.AlertController;
|
||||
import com.android.settings.R;
|
||||
@@ -51,8 +52,6 @@ public class BluetoothPermissionActivity extends AlertActivity implements
|
||||
private TextView messageView;
|
||||
private Button mOkButton;
|
||||
private BluetoothDevice mDevice;
|
||||
private String mReturnPackage = null;
|
||||
private String mReturnClass = null;
|
||||
|
||||
private int mRequestType = 0;
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@@ -89,8 +88,6 @@ public class BluetoothPermissionActivity extends AlertActivity implements
|
||||
}
|
||||
|
||||
mDevice = i.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
mReturnPackage = i.getStringExtra(BluetoothDevice.EXTRA_PACKAGE_NAME);
|
||||
mReturnClass = i.getStringExtra(BluetoothDevice.EXTRA_CLASS_NAME);
|
||||
mRequestType = i.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
|
||||
BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);
|
||||
|
||||
@@ -202,14 +199,14 @@ public class BluetoothPermissionActivity extends AlertActivity implements
|
||||
sendReplyIntentToReceiver(false, true);
|
||||
}
|
||||
|
||||
private void sendReplyIntentToReceiver(final boolean allowed, final boolean always) {
|
||||
@VisibleForTesting
|
||||
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, "sendReplyIntentToReceiver() Request type: " + mRequestType
|
||||
+ " mReturnPackage");
|
||||
}
|
||||
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
|
||||
|
Reference in New Issue
Block a user