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

Commit 0e63859a authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6465574 from cd505490 to rvc-release

Change-Id: Idbc1463d44a0637eff761176a967ff2bfb3fbecd
parents 9ce876ec cd505490
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@
    <string name="not_exist_file" msgid="3489434189599716133">"Ningún ficheiro"</string>
    <string name="not_exist_file_desc" msgid="4059531573790529229">"O ficheiro non existe. \n"</string>
    <string name="enabling_progress_title" msgid="436157952334723406">"Agarda..."</string>
    <string name="enabling_progress_content" msgid="4601542238119927904">"Activando o Bluetooth..."</string>
    <string name="enabling_progress_content" msgid="4601542238119927904">"Activando Bluetooth"</string>
    <string name="bt_toast_1" msgid="972182708034353383">"Recibirase o ficheiro. Comproba o progreso no panel de notificacións."</string>
    <string name="bt_toast_2" msgid="8602553334099066582">"O ficheiro non se pode recibir."</string>
    <string name="bt_toast_3" msgid="6707884165086862518">"Detívose a recepción do ficheiro de \"<xliff:g id="SENDER">%1$s</xliff:g>\""</string>
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
    <string name="bt_enable_line1" msgid="7203551583048149">"ବ୍ଲୁଟୂଥ୍‍‌ ସେବା ବ୍ୟବହାର କରିବା ପାଇଁ, ଆପଣଙ୍କୁ ପ୍ରଥମେ ବ୍ଲୁଟୂଥ୍‍‌ ଅନ୍‌ କରିବାକୁ ପଡ଼ିବ।"</string>
    <string name="bt_enable_line2" msgid="4341936569415937994">"ବ୍ଲୁ-ଟୁଥ୍‌କୁ ଏବେ ଅନ୍‌ କରିବେ?"</string>
    <string name="bt_enable_cancel" msgid="1988832367505151727">"ବାତିଲ୍"</string>
    <string name="bt_enable_ok" msgid="3432462749994538265">"ଅନ୍ କରନ୍ତୁ"</string>
    <string name="bt_enable_ok" msgid="3432462749994538265">"ଚାଲୁ କରନ୍ତୁ"</string>
    <string name="incoming_file_confirm_title" msgid="8139874248612182627">"ଫାଇଲ୍‌ ଟ୍ରାନ୍ସଫର୍‌ କରନ୍ତୁ"</string>
    <string name="incoming_file_confirm_content" msgid="2752605552743148036">"ଆସୁଥିବା ଫାଇଲ୍‌କୁ ସ୍ୱୀକାର କରିବେ?"</string>
    <string name="incoming_file_confirm_cancel" msgid="2973321832477704805">"ଅସ୍ୱୀକାର"</string>
+4 −4
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="permlab_bluetoothShareManager" msgid="311492132450338925">"Aceder ao gestor de transferências."</string>
    <string name="permdesc_bluetoothShareManager" msgid="8930572979123190223">"Permite à aplicação aceder ao gestor BluetoothShare e utilizá-lo para transferir ficheiros."</string>
    <string name="permdesc_bluetoothShareManager" msgid="8930572979123190223">"Permite à app aceder ao gestor BluetoothShare e utilizá-lo para transferir ficheiros."</string>
    <string name="permlab_bluetoothWhitelist" msgid="7091552898592306386">"Colocar na lista de autorizações o acesso do dispositivo Bluetooth."</string>
    <string name="permdesc_bluetoothWhitelist" msgid="5494513855192170109">"Permite que a aplicação coloque temporariamente um dispositivo Bluetooth na lista de autorizações, permitindo que esse dispositivo envie ficheiros para este dispositivo sem a confirmação do utilizador."</string>
    <string name="permdesc_bluetoothWhitelist" msgid="5494513855192170109">"Permite que a app coloque temporariamente um dispositivo Bluetooth na lista de autorizações, permitindo que esse dispositivo envie ficheiros para este dispositivo sem a confirmação do utilizador."</string>
    <string name="bt_share_picker_label" msgid="6268100924487046932">"Bluetooth"</string>
    <string name="unknown_device" msgid="9221903979877041009">"Dispositivo desconhecido"</string>
    <string name="unknownNumber" msgid="4994750948072751566">"Desconhecido"</string>
@@ -72,7 +72,7 @@
    <string name="upload_fail_cancel" msgid="9118496285835687125">"Fechar"</string>
    <string name="bt_error_btn_ok" msgid="5965151173011534240">"OK"</string>
    <string name="unknown_file" msgid="6092727753965095366">"Ficheiro desconhecido"</string>
    <string name="unknown_file_desc" msgid="480434281415453287">"Não existe nenhuma aplicação para executar este tipo de ficheiro. \n"</string>
    <string name="unknown_file_desc" msgid="480434281415453287">"Não existe nenhuma app para executar este tipo de ficheiro. \n"</string>
    <string name="not_exist_file" msgid="3489434189599716133">"Nenhum ficheiro"</string>
    <string name="not_exist_file_desc" msgid="4059531573790529229">"O ficheiro não existe. \n"</string>
    <string name="enabling_progress_title" msgid="436157952334723406">"Aguarde..."</string>
@@ -126,7 +126,7 @@
    <string name="bluetooth_map_settings_cancel" msgid="9205350798049865699">"Cancelar"</string>
    <string name="bluetooth_map_settings_intro" msgid="6482369468223987562">"Selecione as contas que pretende partilhar através de Bluetooth. Ao ligar, ainda tem de aceitar eventuais acessos às contas."</string>
    <string name="bluetooth_map_settings_count" msgid="4557473074937024833">"Ranhuras restantes:"</string>
    <string name="bluetooth_map_settings_app_icon" msgid="7105805610929114707">"Ícone de aplicação"</string>
    <string name="bluetooth_map_settings_app_icon" msgid="7105805610929114707">"Ícone de app"</string>
    <string name="bluetooth_map_settings_title" msgid="7420332483392851321">"Definições de partilha de mensagens por Bluetooth"</string>
    <string name="bluetooth_map_settings_no_account_slots_left" msgid="1796029082612965251">"Não é possível selecionar a conta. Não há ranhuras restantes"</string>
    <string name="bluetooth_connected" msgid="6718623220072656906">"Áudio Bluetooth ligado"</string>
+70 −47
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.bluetooth.BluetoothAudioConfig;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.IBluetoothA2dpSink;
import android.media.AudioManager;
import android.util.Log;

import com.android.bluetooth.Utils;
@@ -47,6 +48,8 @@ public class A2dpSinkService extends ProfileService {
    protected Map<BluetoothDevice, A2dpSinkStateMachine> mDeviceStateMap =
            new ConcurrentHashMap<>(1);

    private final Object mStreamHandlerLock = new Object();

    private A2dpSinkStreamHandler mA2dpSinkStreamHandler;
    private static A2dpSinkService sService;

@@ -56,22 +59,32 @@ public class A2dpSinkService extends ProfileService {

    @Override
    protected boolean start() {
        initNative();
        sService = this;
        synchronized (mStreamHandlerLock) {
            mA2dpSinkStreamHandler = new A2dpSinkStreamHandler(this, this);
        }
        initNative();
        setA2dpSinkService(this);
        return true;
    }

    @Override
    protected boolean stop() {
        setA2dpSinkService(null);
        cleanupNative();
        for (A2dpSinkStateMachine stateMachine : mDeviceStateMap.values()) {
            stateMachine.quitNow();
        }
        sService = null;
        mDeviceStateMap.clear();
        synchronized (mStreamHandlerLock) {
            if (mA2dpSinkStreamHandler != null) {
                mA2dpSinkStreamHandler.cleanup();
                mA2dpSinkStreamHandler = null;
            }
        }
        return true;
    }

    public static A2dpSinkService getA2dpSinkService() {
    public static synchronized A2dpSinkService getA2dpSinkService() {
        return sService;
    }

@@ -80,9 +93,8 @@ public class A2dpSinkService extends ProfileService {
     * @hide
     */
    @VisibleForTesting
    public static void setA2dpSinkService(A2dpSinkService service) {
    public static synchronized void setA2dpSinkService(A2dpSinkService service) {
        sService = service;
        sService.mA2dpSinkStreamHandler = new A2dpSinkStreamHandler(sService, sService);
    }


@@ -90,20 +102,36 @@ public class A2dpSinkService extends ProfileService {
        mAdapter = BluetoothAdapter.getDefaultAdapter();
    }

    protected A2dpSinkStateMachine newStateMachine(BluetoothDevice device) {
        return new A2dpSinkStateMachine(device, this);
    }

    protected synchronized A2dpSinkStateMachine getStateMachine(BluetoothDevice device) {
        return mDeviceStateMap.get(device);
    }

    /**
     * Request audio focus such that the designated device can stream audio
     */
    public void requestAudioFocus(BluetoothDevice device, boolean request) {
        synchronized (mStreamHandlerLock) {
            if (mA2dpSinkStreamHandler == null) return;
            mA2dpSinkStreamHandler.requestAudioFocus(request);
        }
    }

    /**
     * Get the current Bluetooth Audio focus state
     *
     * @return AudioManger.AUDIOFOCUS_* states on success, or AudioManager.ERROR on error
     */
    public int getFocusState() {
        synchronized (mStreamHandlerLock) {
            if (mA2dpSinkStreamHandler == null) return AudioManager.ERROR;
            return mA2dpSinkStreamHandler.getFocusState();
        }
    }

    boolean isA2dpPlaying(BluetoothDevice device) {
        enforceCallingOrSelfPermission(
                BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission");
        synchronized (mStreamHandlerLock) {
            if (mA2dpSinkStreamHandler == null) return false;
            return mA2dpSinkStreamHandler.isPlaying();
        }
    }

    @Override
    protected IProfileServiceBinder initBinder() {
@@ -225,7 +253,7 @@ public class A2dpSinkService extends ProfileService {
     *
     * @return true if connection is successful, false otherwise.
     */
    public synchronized boolean connect(BluetoothDevice device) {
    public boolean connect(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED,
                "Need BLUETOOTH_PRIVILEGED permission");
        if (device == null) {
@@ -242,13 +270,14 @@ public class A2dpSinkService extends ProfileService {
                    + "> is CONNECTION_POLICY_FORBIDDEN");
            return false;
        }

        A2dpSinkStateMachine stateMachine = getOrCreateStateMachine(device);
        if (stateMachine != null) {
            stateMachine.connect();
            return true;
        } else {
            // a state machine instance doesn't exist yet, and the max has been reached.
            Log.e(TAG, "Maxed out on the number of allowed MAP connections. "
            Log.e(TAG, "Maxed out on the number of allowed A2DP Sink connections. "
                    + "Connect request rejected on " + device);
            return false;
        }
@@ -259,7 +288,7 @@ public class A2dpSinkService extends ProfileService {
     *
     * @return true if disconnect is successful, false otherwise.
     */
    public synchronized boolean disconnect(BluetoothDevice device) {
    public boolean disconnect(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        if (DBG) {
            StringBuilder sb = new StringBuilder();
@@ -267,6 +296,7 @@ public class A2dpSinkService extends ProfileService {
            Log.d(TAG, "A2DP disconnect device: " + device
                    + ", InstanceMap start state: " + sb.toString());
        }

        A2dpSinkStateMachine stateMachine = mDeviceStateMap.get(device);
        // a state machine instance doesn't exist. maybe it is already gone?
        if (stateMachine == null) {
@@ -292,13 +322,16 @@ public class A2dpSinkService extends ProfileService {
    }

    protected A2dpSinkStateMachine getOrCreateStateMachine(BluetoothDevice device) {
        A2dpSinkStateMachine stateMachine = mDeviceStateMap.get(device);
        if (stateMachine == null) {
            stateMachine = newStateMachine(device);
            mDeviceStateMap.put(device, stateMachine);
            stateMachine.start();
        A2dpSinkStateMachine newStateMachine = new A2dpSinkStateMachine(device, this);
        A2dpSinkStateMachine existingStateMachine =
                mDeviceStateMap.putIfAbsent(device, newStateMachine);
        // Given null is not a valid value in our map, ConcurrentHashMap will return null if the
        // key was absent and our new value was added. We should then start and return it.
        if (existingStateMachine == null) {
            newStateMachine.start();
            return newStateMachine;
        }
        return stateMachine;
        return existingStateMachine;
    }

    List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
@@ -329,7 +362,7 @@ public class A2dpSinkService extends ProfileService {
     * {@link BluetoothProfile#STATE_CONNECTED} if this profile is connected, or
     * {@link BluetoothProfile#STATE_DISCONNECTING} if this profile is being disconnected
     */
    public synchronized int getConnectionState(BluetoothDevice device) {
    public int getConnectionState(BluetoothDevice device) {
        A2dpSinkStateMachine stateMachine = mDeviceStateMap.get(device);
        return (stateMachine == null) ? BluetoothProfile.STATE_DISCONNECTED
                : stateMachine.getState();
@@ -391,21 +424,6 @@ public class A2dpSinkService extends ProfileService {
        }
    }

    /**
     * Get the current Bluetooth Audio focus state
     *
     * @return focus
     */
    public static int getFocusState() {
        return sService.mA2dpSinkStreamHandler.getFocusState();
    }

    boolean isA2dpPlaying(BluetoothDevice device) {
        enforceCallingOrSelfPermission(
                BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission");
        return mA2dpSinkStreamHandler.isPlaying();
    }

    BluetoothAudioConfig getAudioConfig(BluetoothDevice device) {
        A2dpSinkStateMachine stateMachine = mDeviceStateMap.get(device);
        // a state machine instance doesn't exist. maybe it is already gone?
@@ -461,7 +479,11 @@ public class A2dpSinkService extends ProfileService {
    }

    private void onAudioStateChanged(byte[] address, int state) {
        if (state == StackEvent.AUDIO_STATE_STARTED) {
        synchronized (mStreamHandlerLock) {
            if (mA2dpSinkStreamHandler == null) {
                Log.e(TAG, "Received audio state change before we've been started");
                return;
            } else if (state == StackEvent.AUDIO_STATE_STARTED) {
                mA2dpSinkStreamHandler.obtainMessage(
                        A2dpSinkStreamHandler.SRC_STR_START).sendToTarget();
            } else if (state == StackEvent.AUDIO_STATE_STOPPED
@@ -470,6 +492,7 @@ public class A2dpSinkService extends ProfileService {
                        A2dpSinkStreamHandler.SRC_STR_STOP).sendToTarget();
            }
        }
    }

    private void onAudioConfigChanged(byte[] address, int sampleRate, int channelCount) {
        StackEvent event = StackEvent.audioConfigChanged(getDevice(address), sampleRate,
+8 −0
Original line number Diff line number Diff line
@@ -117,6 +117,14 @@ public class A2dpSinkStreamHandler extends Handler {
        mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    }

    /**
     * Safely clean up this stream handler object
     */
    public void cleanup() {
        abandonAudioFocus();
        removeCallbacksAndMessages(null);
    }

    void requestAudioFocus(boolean request) {
        obtainMessage(REQUEST_FOCUS, request).sendToTarget();
    }
Loading