Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d997486b authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

Enable sendText via bluetooth device.

Restore disabled sendText code for supported platforms.  This allows
devices supporting SUBSCRIPTION_TYPE_REMOTE_SIM to utilize telephony
APIs insted of Bluetooth APIs whenn sending messages.

Bug: 132620310
Test: send text message with default messaging app.
Change-Id: I194dcfcb8a5bb36bcc37ec78340da56d482d3cbd
parent c27ec61d
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@
package com.android.internal.telephony;

import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothMapClient;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.net.Uri;
@@ -40,10 +42,6 @@ public class BtSmsInterfaceManager {
     */
    public void sendText(Context context, String destAddr, String text, PendingIntent sentIntent,
            PendingIntent deliveryIntent, SubscriptionInfo info) {
        /*
        This is to remove the usage of hidden constant MAP_CLIENT and hidden API
        BluetoothMapClient.sendMessage(). This code is currently not functional anyway; it will be
        re-enabled in a later release.
        BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
        if (btAdapter == null) {
            // No bluetooth service on this platform?
@@ -56,10 +54,11 @@ public class BtSmsInterfaceManager {
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_INVALID_BLUETOOTH_ADDRESS);
            return;
        }
        btAdapter.getProfileProxy(context.getApplicationContext(),
        if (btAdapter.getProfileProxy(context.getApplicationContext(),
                new MapMessageSender(destAddr, text, device, sentIntent, deliveryIntent),
                BluetoothProfile.MAP_CLIENT);
        */
                BluetoothProfile.MAP_CLIENT)) {
            return;
        }
        throw new RuntimeException("Can't send message through BluetoothMapClient");
    }

@@ -100,7 +99,6 @@ public class BtSmsInterfaceManager {
        @Override
        public void onServiceConnected(int profile, BluetoothProfile proxy) {
            Log.d(LOG_TAG, "Service connected");
            /*
            if (profile != BluetoothProfile.MAP_CLIENT) {
                return;
            }
@@ -112,8 +110,6 @@ public class BtSmsInterfaceManager {
            }
            BluetoothAdapter.getDefaultAdapter()
                    .closeProfileProxy(BluetoothProfile.MAP_CLIENT, mapProfile);
            */
            throw new RuntimeException("Can't send message through BluetoothMapClient");
        }

        @Override