diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-04-23 09:11:28 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-04-23 09:11:28 +0000 |
commit | 47b254ad8859ae061f58cd853f7929218ae29ef0 (patch) | |
tree | 9a770e490aa50f5b387de26e04c3dfabc905e0d0 /src/com/android/settings/bluetooth/BluetoothPermissionActivity.java | |
parent | 3e6e4a1ad5a7680a93cb18a75c671baad36354a6 (diff) | |
parent | 8adedc62496cf8cf6ecfc6ccf23b0b248081d7d4 (diff) | |
download | packages_apps_Settings-47b254ad8859ae061f58cd853f7929218ae29ef0.tar.gz packages_apps_Settings-47b254ad8859ae061f58cd853f7929218ae29ef0.tar.bz2 packages_apps_Settings-47b254ad8859ae061f58cd853f7929218ae29ef0.zip |
Merge "Fix bluetooth settings will broadcast to anywhere when some cases" into sc-dev
Diffstat (limited to 'src/com/android/settings/bluetooth/BluetoothPermissionActivity.java')
-rw-r--r-- | src/com/android/settings/bluetooth/BluetoothPermissionActivity.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java index 10acdb545b..8794b08129 100644 --- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java +++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java @@ -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 |