OSDN Git Service

Fix merge error, put in tmp workaround for input manager.
authorMatthew Xie <mattx@google.com>
Fri, 29 Jun 2012 23:57:31 +0000 (16:57 -0700)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Tue, 17 Jul 2012 04:29:12 +0000 (21:29 -0700)
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

core/java/android/bluetooth/IBluetooth.aidl
services/java/com/android/server/SystemServer.java
services/java/com/android/server/input/InputManagerService.java
services/java/com/android/server/power/ShutdownThread.java

index eff780d..bfad4be 100644 (file)
@@ -32,6 +32,7 @@ interface IBluetooth
     boolean isEnabled();
     int getState();
     boolean enable();
+    boolean enableNoAutoConnect();
     boolean disable(boolean persist);
 
     String getAddress();
index f4a5f5b..2185456 100644 (file)
@@ -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);
                 }
index e7afb1a..21100e2 100644 (file)
@@ -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;
     }
index 5715151..a3770d7 100644 (file)
@@ -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;