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

Commit 9636f583 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "gtbs: Add Generic Telephone Bearer Service implementation"

parents 365053f1 1e941c84
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -449,6 +449,15 @@
                <action android:name="android.bluetooth.IBluetoothCsipSetCoordinator" />
            </intent-filter>
        </service>
        <service
            android:process="@string/process"
            android:name = ".tbs.TbsService"
            android:enabled="@bool/profile_supported_le_call_control"
            android:exported = "true">
            <intent-filter>
                <action android:name="android.bluetooth.IBluetoothLeCallControl" />
            </intent-filter>
        </service>
        <!-- Authenticator for PBAP account. -->
        <service android:process="@string/process"
             android:name=".pbapclient.AuthenticationService"
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
    <bool name="profile_supported_vc">true</bool>
    <bool name="profile_supported_mcp_server">true</bool>
    <bool name="profile_supported_csip_set_coordinator">true</bool>
    <bool name="profile_supported_le_call_control">true</bool>

    <!-- If true, we will require location to be enabled on the device to
         fire Bluetooth LE scan result callbacks in addition to having one
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.bluetooth.pbap.BluetoothPbapService;
import com.android.bluetooth.pbapclient.PbapClientService;
import com.android.bluetooth.sap.SapService;
import com.android.bluetooth.vc.VolumeControlService;
import com.android.bluetooth.tbs.TbsService;

import java.util.ArrayList;
import java.util.Arrays;
@@ -121,6 +122,8 @@ public class Config {
                    (1 << BluetoothProfile.VOLUME_CONTROL)),
            new ProfileConfig(McpService.class, R.bool.profile_supported_mcp_server,
                    (1 << BluetoothProfile.MCP_SERVER)),
            new ProfileConfig(TbsService.class, R.bool.profile_supported_le_call_control,
                    (1 << BluetoothProfile.LE_CALL_CONTROL)),
            new ProfileConfig(HearingAidService.class,
                    com.android.internal.R.bool.config_hearing_aid_profile_supported,
                    (1 << BluetoothProfile.HEARING_AID)),
+5 −0
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@ class Metadata {
            case BluetoothProfile.CSIP_SET_COORDINATOR:
                profileConnectionPolicies.csip_set_coordinator_connection_policy = connectionPolicy;
                break;
            case BluetoothProfile.LE_CALL_CONTROL:
                profileConnectionPolicies.le_call_control_connection_policy = connectionPolicy;
                break;
            default:
                throw new IllegalArgumentException("invalid profile " + profile);
        }
@@ -156,6 +159,8 @@ class Metadata {
                return profileConnectionPolicies.volume_control_connection_policy;
            case BluetoothProfile.CSIP_SET_COORDINATOR:
                return profileConnectionPolicies.csip_set_coordinator_connection_policy;
            case BluetoothProfile.LE_CALL_CONTROL:
                return profileConnectionPolicies.le_call_control_connection_policy;
        }
        return BluetoothProfile.CONNECTION_POLICY_UNKNOWN;
    }
+20 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import java.util.List;
/**
 * MetadataDatabase is a Room database stores Bluetooth persistence data
 */
@Database(entities = {Metadata.class}, version = 108)
@Database(entities = {Metadata.class}, version = 109)
public abstract class MetadataDatabase extends RoomDatabase {
    /**
     * The metadata database file name
@@ -61,6 +61,7 @@ public abstract class MetadataDatabase extends RoomDatabase {
                .addMigrations(MIGRATION_105_106)
                .addMigrations(MIGRATION_106_107)
                .addMigrations(MIGRATION_107_108)
                .addMigrations(MIGRATION_108_109)
                .allowMainThreadQueries()
                .build();
    }
@@ -388,4 +389,22 @@ public abstract class MetadataDatabase extends RoomDatabase {
            }
        }
    };

    @VisibleForTesting
    static final Migration MIGRATION_108_109 = new Migration(108, 109) {
        @Override
        public void migrate(SupportSQLiteDatabase database) {
            try {
                database.execSQL(
                        "ALTER TABLE metadata ADD COLUMN `le_call_control_connection_policy` "
                        + "INTEGER DEFAULT 100");
            } catch (SQLException ex) {
                // Check if user has new schema, but is just missing the version update
                Cursor cursor = database.query("SELECT * FROM metadata");
                if (cursor == null || cursor.getColumnIndex("le_call_control_connection_policy") == -1) {
                    throw ex;
                }
            }
        }
    };
}
Loading