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

Commit 2ab50ea8 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12404440 from 9cdd1108 to 24Q4-release

Change-Id: Iaf43ac3fd61ffff035ebf51289ef758f4ca42b47
parents a5a9fdaf 9cdd1108
Loading
Loading
Loading
Loading
+145 −752

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -12141,8 +12141,8 @@
    <string name="title_have_satellite_plan">Satellite messaging is included with your account</string>
    <!-- Title for category "Your mobile plan when satellite is not included in plan" [CHAR_LIMIT=NONE] -->
    <string name="title_no_satellite_plan">Satellite messaging isn\u2019t included with your account</string>
    <!-- text view add satellite messaging" [CHAR_LIMIT=NONE] -->
    <string name="summary_add_satellite_setting">Add satellite messaging</string>
    <!-- text view "Learn more" [CHAR_LIMIT=NONE] -->
    <string name="summary_add_satellite_setting">Learn More</string>
    <!-- Category name "How it works" [CHAR_LIMIT=NONE] -->
    <string name="category_name_how_it_works">How it works</string>
    <!-- Title for satellite connection guide [CHAR_LIMIT=NONE] -->
+10 −10
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
    private final Handler mHandler = new Handler(Looper.getMainLooper());
    private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
    @Nullable
    private AlertDialog mLoadingDialog = null;
    private AlertDialog mProgressDialog = null;
    @VisibleForTesting
    boolean mShouldTriggerAudioSharingShareThenPairFlow = false;
    private CopyOnWriteArrayList<BluetoothDevice> mDevicesWithMetadataChangedListener =
@@ -89,7 +89,7 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
    // In share then pair flow, we have to wait on this page till the device is connected.
    // The BluetoothDevicePreference summary will be blank for seconds between "Pairing..." and
    // "Connecting..." To help users better understand the process, we listen to metadata change
    // as well and show a loading dialog with "Connecting to ...." once BluetoothDevice.getState()
    // as well and show a progress dialog with "Connecting to ...." once BluetoothDevice.getState()
    // gets to BOND_BONDED.
    final BluetoothAdapter.OnMetadataChangedListener mMetadataListener =
            new BluetoothAdapter.OnMetadataChangedListener() {
@@ -97,7 +97,7 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
                public void onMetadataChanged(@NonNull BluetoothDevice device, int key,
                        @Nullable byte[] value) {
                    Log.d(getLogTag(), "onMetadataChanged device = " + device + ", key  = " + key);
                    if (mShouldTriggerAudioSharingShareThenPairFlow && mLoadingDialog == null
                    if (mShouldTriggerAudioSharingShareThenPairFlow && mProgressDialog == null
                            && device.getBondState() == BluetoothDevice.BOND_BONDED
                            && mSelectedList.contains(device)) {
                        triggerAudioSharingShareThenPairFlow(device);
@@ -355,7 +355,7 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
                return;
            }
            mJustBonded = device;
            // Show connecting device loading state
            // Show connecting device progress
            String aliasName = device.getAlias();
            String deviceName = TextUtils.isEmpty(aliasName) ? device.getAddress()
                    : aliasName;
@@ -387,9 +387,9 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
    // TODO: use DialogFragment
    private void showConnectingDialog(@NonNull String message) {
        postOnMainThread(() -> {
            if (mLoadingDialog != null) {
            if (mProgressDialog != null) {
                Log.d(getLogTag(), "showConnectingDialog, is already showing");
                TextView textView = mLoadingDialog.findViewById(R.id.message);
                TextView textView = mProgressDialog.findViewById(R.id.message);
                if (textView != null && !message.equals(textView.getText().toString())) {
                    Log.d(getLogTag(), "showConnectingDialog, update message");
                    // TODO: use string res once finalized
@@ -401,7 +401,7 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
            LayoutInflater inflater = LayoutInflater.from(builder.getContext());
            View customView = inflater.inflate(
                    R.layout.dialog_audio_sharing_loading_state, /* root= */
                    R.layout.dialog_audio_sharing_progress, /* root= */
                    null);
            TextView textView = customView.findViewById(R.id.message);
            if (textView != null) {
@@ -410,15 +410,15 @@ public abstract class BluetoothDevicePairingDetailBase extends DeviceListPrefere
            }
            AlertDialog dialog = builder.setView(customView).setCancelable(false).create();
            dialog.setCanceledOnTouchOutside(false);
            mLoadingDialog = dialog;
            mProgressDialog = dialog;
            dialog.show();
        });
    }

    private void dismissConnectingDialog() {
        postOnMainThread(() -> {
            if (mLoadingDialog != null) {
                mLoadingDialog.dismiss();
            if (mProgressDialog != null) {
                mProgressDialog.dismiss();
            }
        });
    }
+29 −6
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.provider.SettingsSlicesContract;
import android.util.Log;

import androidx.core.graphics.drawable.IconCompat;
import androidx.slice.Slice;
@@ -36,10 +37,16 @@ import androidx.slice.builders.SliceAction;
import com.android.settings.R;
import com.android.settings.SubSettings;
import com.android.settings.connecteddevice.BluetoothDashboardFragment;
import com.android.settings.network.SatelliteRepository;
import com.android.settings.slices.CustomSliceRegistry;
import com.android.settings.slices.SliceBroadcastReceiver;
import com.android.settings.slices.SliceBuilderUtils;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/**
 * Utility class to build a Bluetooth Slice, and handle all associated actions.
 */
@@ -80,18 +87,34 @@ public class BluetoothSliceBuilder {
        final PendingIntent primaryAction = getPrimaryAction(context);
        final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryAction, icon,
                ListBuilder.ICON_IMAGE, title);

        RowBuilder rowBuilder = new RowBuilder();
        rowBuilder.setTitle(title);
        rowBuilder.setPrimaryAction(primarySliceAction);
        if (!isSatelliteOn(context)) {
            final SliceAction toggleSliceAction = SliceAction.createToggle(toggleAction,
                    null /* actionTitle */, isBluetoothEnabled);

            rowBuilder.addEndItem(toggleSliceAction);
        }
        return new ListBuilder(context, CustomSliceRegistry.BLUETOOTH_URI, ListBuilder.INFINITY)
                .setAccentColor(color)
                .addRow(new RowBuilder()
                        .setTitle(title)
                        .addEndItem(toggleSliceAction)
                        .setPrimaryAction(primarySliceAction))
                .addRow(rowBuilder)
                .build();
    }

    private static boolean isSatelliteOn(Context context) {
        boolean result = false;
        SatelliteRepository satelliteRepository = new SatelliteRepository(context);
        try {
            result = satelliteRepository.requestIsSessionStarted(
                    Executors.newSingleThreadExecutor()).get(3000, TimeUnit.MILLISECONDS);
        } catch (InterruptedException | ExecutionException | TimeoutException e) {
            Log.e(TAG, "Error to get satellite status : " + e);
        }

        return result;
    }

    public static Intent getIntent(Context context) {
        final String screenTitle = context.getText(R.string.bluetooth_settings_title).toString();
        final Uri contentUri = new Uri.Builder().appendPath(
Loading