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

Commit 81edd9a2 authored by Stanley Tng's avatar Stanley Tng
Browse files

resolve merge conflicts of b0e99e14 to stage-aosp-master

Bug: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ife619e714d451b6cb77bfaf50e3f45c969d37cb4
Merged-In: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
Merged-In: I169cda4a1658b0a67cc7c7367b38d57a021e6953
parents a8af2d36 b0e99e14
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.Log;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceScreen;
import android.util.Pair;
@@ -36,6 +37,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
 */
public class BluetoothDetailsHeaderController extends BluetoothDetailsController {
    private static final String KEY_DEVICE_HEADER = "bluetooth_device_header";
    private static final String TAG = "BluetoothDetailsHeaderController";

    private EntityHeaderController mHeaderController;
    private LocalBluetoothManager mLocalManager;
@@ -63,12 +65,16 @@ public class BluetoothDetailsHeaderController extends BluetoothDetailsController
                .getBtClassDrawableWithDescription(mContext, mCachedDevice,
                mContext.getResources().getFraction(R.fraction.bt_battery_scale_fraction, 1, 1));
        String summaryText = mCachedDevice.getConnectionSummary();
        // If both the hearing aids are connected, two battery status should be shown.

        if (mCachedDevice.isHearingAidDevice()) {
            // For Hearing Aid device, display the other battery status.
            final String pairDeviceSummary = mDeviceManager
                .getHearingAidPairDeviceSummary(mCachedDevice);
        if (pairDeviceSummary != null) {
            Log.d(TAG, "setHeaderProperties: HearingAid: summaryText=" + summaryText
                  + ", pairDeviceSummary=" + pairDeviceSummary);
            mHeaderController.setSecondSummary(pairDeviceSummary);
        }

        mHeaderController.setLabel(mCachedDevice.getName());
        mHeaderController.setIcon(pair.first);
        mHeaderController.setIconContentDescription(pair.second);
+10 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settings.bluetooth;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@@ -96,7 +97,7 @@ public class BluetoothDetailsHeaderControllerTest extends BluetoothDetailsContro
        verify(mHeaderController).setIcon(any(Drawable.class));
        verify(mHeaderController).setIconContentDescription(any(String.class));
        verify(mHeaderController).setSummary(any(String.class));
        verify(mHeaderController).setSecondSummary(any(String.class));
        verify(mHeaderController, never()).setSecondSummary(any(String.class));
        verify(mHeaderController).done(mActivity, true);
    }

@@ -119,4 +120,12 @@ public class BluetoothDetailsHeaderControllerTest extends BluetoothDetailsContro
        inOrder.verify(mHeaderController)
            .setSummary(mContext.getString(R.string.bluetooth_connecting));
    }

    @Test
    public void testSecondSummary_isHearingAidDevice_showSecondSummary() {
        when(mCachedDevice.isHearingAidDevice()).thenReturn(true);
        showScreen(mController);

        verify(mHeaderController).setSecondSummary(any(String.class));
    }
}