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

Commit 9631314e authored by Matthew Xie's avatar Matthew Xie Committed by Android (Google) Code Review
Browse files

Fix merge error, put in tmp workaround for input manager.

Fix merge error, missing enableNoAutoConnect api.
Remove bluetoothF from inputManageF.systemReady call as tmp workaround.
Recover shutdownRadios(MAX_RADIO_WAIT_TIME) call in ShutdownThread

Change-Id: Ice2b5c54267755bdbf56c742feabbb8709b92570
parent 5a1195fd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ interface IBluetooth
    boolean isEnabled();
    int getState();
    boolean enable();
    boolean enableNoAutoConnect();
    boolean disable(boolean persist);

    String getAddress();
+2 −2
Original line number Diff line number Diff line
@@ -731,7 +731,6 @@ class ServerThread extends Thread {
        final StatusBarManagerService statusBarF = statusBar;
        final DreamManagerService dreamyF = dreamy;
        final InputManagerService inputManagerF = inputManager;
        final BluetoothService bluetoothF = bluetooth;

        // We now tell the activity manager it is okay to run third party
        // code.  It will call back into us once it has gotten to the state
@@ -844,7 +843,8 @@ class ServerThread extends Thread {
                    reportWtf("making DreamManagerService ready", e);
                }
                try {
                    if (inputManagerF != null) inputManagerF.systemReady(bluetoothF);
                    // TODO(BT) Pass parameter to input manager
                    if (inputManagerF != null) inputManagerF.systemReady();
                } catch (Throwable e) {
                    reportWtf("making InputManagerService ready", e);
                }
+5 −7
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ import android.os.Process;
import android.os.RemoteException;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.server.BluetoothService;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
@@ -110,7 +109,6 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
    private final Callbacks mCallbacks;
    private final InputManagerHandler mHandler;
    private boolean mSystemReady;
    private BluetoothService mBluetoothService;
    private NotificationManager mNotificationManager;

    // Persistent data store.  Must be locked each time during use.
@@ -238,11 +236,11 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.
        updateShowTouchesFromSettings();
    }

    public void systemReady(BluetoothService bluetoothService) {
    // TODO(BT) Pass in paramter for bluetooth system
    public void systemReady() {
        if (DEBUG) {
            Slog.d(TAG, "System ready.");
        }
        mBluetoothService = bluetoothService;
        mNotificationManager = (NotificationManager)mContext.getSystemService(
                Context.NOTIFICATION_SERVICE);
        mSystemReady = true;
@@ -1398,9 +1396,9 @@ public class InputManagerService extends IInputManager.Stub implements Watchdog.

    // Native callback.
    private String getDeviceAlias(String uniqueId) {
        if (mBluetoothService != null &&
                BluetoothAdapter.checkBluetoothAddress(uniqueId)) {
            return mBluetoothService.getRemoteAlias(uniqueId);
        if (BluetoothAdapter.checkBluetoothAddress(uniqueId)) {
            // TODO(BT) mBluetoothService.getRemoteAlias(uniqueId)
            return null;
        }
        return null;
    }
+8 −7
Original line number Diff line number Diff line
@@ -325,6 +325,9 @@ public final class ShutdownThread extends Thread {
            }
        }

        // Shutdown radios.
        shutdownRadios(MAX_RADIO_WAIT_TIME);

        // Shutdown MountService to ensure media is in a safe state
        IMountShutdownObserver observer = new IMountShutdownObserver.Stub() {
            public void onShutDownComplete(int statusCode) throws RemoteException {
@@ -381,9 +384,9 @@ public final class ShutdownThread extends Thread {
                        INfcAdapter.Stub.asInterface(ServiceManager.checkService("nfc"));
                final ITelephony phone =
                        ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
                final IBluetooth bluetooth =
                        IBluetooth.Stub.asInterface(ServiceManager.checkService(
                                BluetoothAdapter.BLUETOOTH_SERVICE));
                final IBluetoothManager bluetooth =
                        IBluetoothManager.Stub.asInterface(ServiceManager.checkService(
                                BluetoothAdapter.BLUETOOTH_MANAGER_SERVICE));

                try {
                    nfcOff = nfc == null ||
@@ -398,8 +401,7 @@ public final class ShutdownThread extends Thread {
                }

                try {
                    bluetoothOff = bluetooth == null ||
                                   bluetooth.getBluetoothState() == BluetoothAdapter.STATE_OFF;
                    bluetoothOff = bluetooth == null || !bluetooth.isEnabled();
                    if (!bluetoothOff) {
                        Log.w(TAG, "Disabling Bluetooth...");
                        bluetooth.disable(false);  // disable but don't persist new state
@@ -425,8 +427,7 @@ public final class ShutdownThread extends Thread {
                while (SystemClock.elapsedRealtime() < endTime) {
                    if (!bluetoothOff) {
                        try {
                            bluetoothOff =
                                    bluetooth.getBluetoothState() == BluetoothAdapter.STATE_OFF;
                            bluetoothOff = !bluetooth.isEnabled();
                        } catch (RemoteException ex) {
                            Log.e(TAG, "RemoteException during bluetooth shutdown", ex);
                            bluetoothOff = true;