正直なところ、SDK を変更せずにこれを行う方法を思いつくことができませんでした。あなたが OEM なら簡単です (私は 4.3 を使用しています)。
packages/apps/Settings/AndroidManifest.xml で、ペアリング ダイアログのインテント フィルターをコメント化します。
<activity android:name=".bluetooth.BluetoothPairingDialog"
android:label="@string/bluetooth_pairing_request"
android:excludeFromRecents="true"
android:theme="@*android:style/Theme.Holo.Dialog.Alert">
<!-- <intent-filter>
<action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter> -->
</activity>
Frameworks/base/core/java/android/bluetooth/BluetoothDevice.java で、この定数から @hide javadoc アノテーションを削除します
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
public static final String ACTION_PAIRING_REQUEST =
"android.bluetooth.device.action.PAIRING_REQUEST";
そしてこの方法
public boolean setPairingConfirmation(boolean confirm)
次に、BluetoothDevice.PAIRING_REQUEST アクション用に独自のアクティビティまたはブロードキャスト レシーバーを登録します。このブロードキャスト レシーバーを使用すると、ユーザーの入力なしでペアリングを続行できます (ピンが必要ない場合のみ)。
@Override
public void onReceive(Context context, Intent intent) {
if( intent.getAction().equals(BluetoothDevice.ACTION_PAIRING_REQUEST) ) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
device.setPairingConfirmation( true );
}
}
SDK を再構築し、新しいバージョンに対してコードをコンパイルして定数とメソッドにアクセスし、/system パーティションの Settings.apk を置き換えてダイアログを無効にする必要があります。システムアプリとして実行する必要があるかもしれませんが、おそらくそうではないと思います。