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

Commit a121ec7c authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Remove SystemUIDialog inhertiance from BluetoothDialog

Rename BluetoothDialog to BluetoothDialogFactory.

Flag: NA
Bug: 219008720
Test: m SystemUI
Change-Id: I5874627809043f60d19e12d9da82ea6ddac8bc1f
parent 6ded2f2e
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -16,17 +16,25 @@

package com.android.systemui.keyboard;

import android.content.Context;
import android.view.WindowManager;

import com.android.systemui.statusbar.phone.SystemUIDialog;

public class BluetoothDialog extends SystemUIDialog {
import javax.inject.Inject;

    public BluetoothDialog(Context context) {
        super(context);
public class BluetoothDialogDelegate implements SystemUIDialog.Delegate{

        getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
        setShowForAllUsers(true);
    private final SystemUIDialog.Factory mSystemUIDialogFactory;
    @Inject
    public BluetoothDialogDelegate(SystemUIDialog.Factory systemUIDialogFactory) {
        mSystemUIDialogFactory = systemUIDialogFactory;
    }

    @Override
    public SystemUIDialog createDialog() {
        SystemUIDialog dialog = mSystemUIDialogFactory.create(this);
        dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
        dialog.setShowForAllUsers(true);
        return dialog;
    }
}
+10 −4
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
import com.android.systemui.CoreStartable;
import com.android.systemui.res.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.util.settings.SecureSettings;

import java.io.PrintWriter;
@@ -109,6 +110,7 @@ public class KeyboardUI implements CoreStartable, InputManager.OnTabletModeChang

    private final Provider<LocalBluetoothManager> mBluetoothManagerProvider;
    private final SecureSettings mSecureSettings;
    private final BluetoothDialogDelegate mBluetoothDialogDelegate;

    private boolean mEnabled;
    private String mKeyboardName;
@@ -121,16 +123,20 @@ public class KeyboardUI implements CoreStartable, InputManager.OnTabletModeChang
    private int mInTabletMode = InputManager.SWITCH_STATE_UNKNOWN;
    private int mScanAttempt = 0;
    private ScanCallback mScanCallback;
    private BluetoothDialog mDialog;
    private SystemUIDialog mDialog;

    private int mState;

    @Inject
    public KeyboardUI(Context context, Provider<LocalBluetoothManager> bluetoothManagerProvider,
            SecureSettings secureSettings) {
    public KeyboardUI(
            Context context,
            Provider<LocalBluetoothManager> bluetoothManagerProvider,
            SecureSettings secureSettings,
            BluetoothDialogDelegate bluetoothDialogDelegate) {
        mContext = context;
        this.mBluetoothManagerProvider = bluetoothManagerProvider;
        mSecureSettings = secureSettings;
        mBluetoothDialogDelegate = bluetoothDialogDelegate;
    }

    @Override
@@ -437,7 +443,7 @@ public class KeyboardUI implements CoreStartable, InputManager.OnTabletModeChang
                            new BluetoothDialogClickListener();
                    DialogInterface.OnDismissListener dismissListener =
                            new BluetoothDialogDismissListener();
                    mDialog = new BluetoothDialog(mContext);
                    mDialog = mBluetoothDialogDelegate.createDialog();
                    mDialog.setTitle(R.string.enable_bluetooth_title);
                    mDialog.setMessage(R.string.enable_bluetooth_message);
                    mDialog.setPositiveButton(