--- a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -34,6 +34,7 @@ public class BluetoothPairingDialog extends Activity {
public static final String FRAGMENT_TAG = "bluetooth.pairing.fragment";
private BluetoothPairingController mBluetoothPairingController;
+ private BluetoothPairingDialogFragment mBluetoothFragment;
private boolean mReceiverRegistered = false;
/**
@@ -68,24 +69,23 @@ public class BluetoothPairingDialog extends Activity {
// build the dialog fragment
boolean fragmentFound = true;
// check if the fragment has been preloaded
- BluetoothPairingDialogFragment bluetoothFragment =
- (BluetoothPairingDialogFragment) getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
+ mBluetoothFragment =(BluetoothPairingDialogFragment) getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
// dismiss the fragment if it is already used
- if (bluetoothFragment != null && (bluetoothFragment.isPairingControllerSet()
- || bluetoothFragment.isPairingDialogActivitySet())) {
- bluetoothFragment.dismiss();
- bluetoothFragment = null;
+ if (mBluetoothFragment != null && (mBluetoothFragment.isPairingControllerSet()
+ || mBluetoothFragment.isPairingDialogActivitySet())) {
+ mBluetoothFragment.dismiss();
+ mBluetoothFragment = null;
}
// build a new fragment if it is null
- if (bluetoothFragment == null) {
+ if (mBluetoothFragment == null) {
fragmentFound = false;
- bluetoothFragment = new BluetoothPairingDialogFragment();
+ mBluetoothFragment = new BluetoothPairingDialogFragment();
}
- bluetoothFragment.setPairingController(mBluetoothPairingController);
- bluetoothFragment.setPairingDialogActivity(this);
+ mBluetoothFragment.setPairingController(mBluetoothPairingController);
+ mBluetoothFragment.setPairingDialogActivity(this);
// pass the fragment to the manager when it is created from scratch
if (!fragmentFound) {
- bluetoothFragment.show(getFragmentManager(), FRAGMENT_TAG);
+ mBluetoothFragment.show(getFragmentManager(), FRAGMENT_TAG);
}
/*
* Leave this registered through pause/resume since we still want to
@@ -96,6 +96,16 @@ public class BluetoothPairingDialog extends Activity {
mReceiverRegistered = true;
}
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (mBluetoothFragment != null) {
+ mBluetoothFragment.autoClick();
+ }
+ }
+
@Override
protected void onDestroy() {
super.onDestroy();
diff --git a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
old mode 100644
new mode 100755
index eaf1231556..299a9dcde9
--- a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
@@ -129,6 +129,12 @@ public class BluetoothPairingDialogFragment extends InstrumentedDialogFragment i
mPairingDialogActivity.dismiss();
}
+ //模拟点击配对按钮,直接同意
+ public void autoClick() {
+ mPairingController.onDialogPositiveClick(this);
+ mPairingDialogActivity.dismiss();
+ }
+
@Override
public int getMetricsCategory() {
return MetricsEvent.BLUETOOTH_DIALOG_FRAGMENT;
diff --git a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
old mode 100644
new mode 100755
index 4d02fd50c3..855c821a18
--- a/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
+++ b/vendor/mediatek/proprietary/packages/apps/MtkSettings/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
@@ -54,9 +54,11 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
// just open the dialog
context.startActivityAsUser(pairingIntent, UserHandle.CURRENT);
} else {
+ //屏蔽状态栏通知,直接跳转配对对话框 wjz@2022.3.28
+ context.startActivityAsUser(pairingIntent, UserHandle.CURRENT);
// Put up a notification that leads to the dialog
- intent.setClass(context, BluetoothPairingService.class);
- context.startServiceAsUser(intent, UserHandle.CURRENT);
+ //intent.setClass(context, BluetoothPairingService.class);
+ //context.startServiceAsUser(intent, UserHandle.CURRENT);
}
}
}