diff options
| author | 2018-01-05 16:12:54 -0800 | |
|---|---|---|
| committer | 2018-01-10 18:15:51 +0000 | |
| commit | da9a3d413bb6bc4dcfa0c8ce48d7ce58e40634d1 (patch) | |
| tree | e3b8ef917c8d93479eb8943eec2b2e5a03f3cf8c | |
| parent | 8098078edf5c74b1a1513c45012aa036ce6d36ec (diff) | |
Don't wait for Bluetooth when shutting down
Bluetooth doesn't need to be shut down cleanly; shutting it down just
slows down the shutdown process.
Change-Id: I91fc9b26930a392f0c4462c76626a966051aea7b
Merged-In: Ic2ed89dd618806adc6646066ab0956dea4a94d8e
Bug: 70855323
Test: Boot, shut down, boot, shut down.
| -rw-r--r-- | services/core/java/com/android/server/power/ShutdownThread.java | 49 |
1 files changed, 5 insertions, 44 deletions
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index 72b2211f1a82..3aca330ed3f2 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -24,8 +24,6 @@ import android.app.KeyguardManager; import android.app.ProgressDialog; import android.app.WallpaperColors; import android.app.WallpaperManager; -import android.bluetooth.BluetoothAdapter; -import android.bluetooth.IBluetoothManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; @@ -120,7 +118,6 @@ public final class ShutdownThread extends Thread { private static String METRIC_AM = "shutdown_activity_manager"; private static String METRIC_PM = "shutdown_package_manager"; private static String METRIC_RADIOS = "shutdown_radios"; - private static String METRIC_BT = "shutdown_bt"; private static String METRIC_RADIO = "shutdown_radio"; private static String METRIC_SM = "shutdown_storage_manager"; @@ -415,7 +412,7 @@ public final class ShutdownThread extends Thread { /** * Makes sure we handle the shutdown gracefully. - * Shuts off power regardless of radio and bluetooth state if the alloted time has passed. + * Shuts off power regardless of radio state if the allotted time has passed. */ public void run() { TimingsTraceLog shutdownTimingLog = newTimingsLog(); @@ -627,27 +624,10 @@ public final class ShutdownThread extends Thread { Thread t = new Thread() { public void run() { TimingsTraceLog shutdownTimingsTraceLog = newTimingsLog(); - boolean bluetoothReadyForShutdown; boolean radioOff; final ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); - final IBluetoothManager bluetooth = - IBluetoothManager.Stub.asInterface(ServiceManager.checkService( - BluetoothAdapter.BLUETOOTH_MANAGER_SERVICE)); - - try { - bluetoothReadyForShutdown = bluetooth == null || - bluetooth.getState() == BluetoothAdapter.STATE_OFF; - if (!bluetoothReadyForShutdown) { - Log.w(TAG, "Disabling Bluetooth..."); - metricStarted(METRIC_BT); - bluetooth.disable(mContext.getPackageName(), false); // disable but don't persist new state - } - } catch (RemoteException ex) { - Log.e(TAG, "RemoteException during bluetooth shutdown", ex); - bluetoothReadyForShutdown = true; - } try { radioOff = phone == null || !phone.needMobileRadioShutdown(); @@ -661,7 +641,7 @@ public final class ShutdownThread extends Thread { radioOff = true; } - Log.i(TAG, "Waiting for Bluetooth and Radio..."); + Log.i(TAG, "Waiting for Radio..."); long delay = endTime - SystemClock.elapsedRealtime(); while (delay > 0) { @@ -672,25 +652,6 @@ public final class ShutdownThread extends Thread { sInstance.setRebootProgress(status, null); } - if (!bluetoothReadyForShutdown) { - try { - // BLE only mode can happen when BT is turned off - // We will continue shutting down in such case - bluetoothReadyForShutdown = - bluetooth.getState() == BluetoothAdapter.STATE_OFF || - bluetooth.getState() == BluetoothAdapter.STATE_BLE_TURNING_OFF || - bluetooth.getState() == BluetoothAdapter.STATE_BLE_ON; - } catch (RemoteException ex) { - Log.e(TAG, "RemoteException during bluetooth shutdown", ex); - bluetoothReadyForShutdown = true; - } - if (bluetoothReadyForShutdown) { - Log.i(TAG, "Bluetooth turned off."); - metricEnded(METRIC_BT); - shutdownTimingsTraceLog - .logDuration("ShutdownBt", TRON_METRICS.get(METRIC_BT)); - } - } if (!radioOff) { try { radioOff = !phone.needMobileRadioShutdown(); @@ -706,8 +667,8 @@ public final class ShutdownThread extends Thread { } } - if (radioOff && bluetoothReadyForShutdown) { - Log.i(TAG, "Radio and Bluetooth shutdown complete."); + if (radioOff) { + Log.i(TAG, "Radio shutdown complete."); done[0] = true; break; } @@ -724,7 +685,7 @@ public final class ShutdownThread extends Thread { } catch (InterruptedException ex) { } if (!done[0]) { - Log.w(TAG, "Timed out waiting for Radio and Bluetooth shutdown."); + Log.w(TAG, "Timed out waiting for Radio shutdown."); } } |