diff options
| author | 2017-10-18 13:06:40 -0700 | |
|---|---|---|
| committer | 2018-01-08 23:47:34 +0000 | |
| commit | 884f99d617624eb92d11b8c1ae209076d0520958 (patch) | |
| tree | 8a5c585a2ca0e697c9ee60882c3416add0fb8cd7 | |
| parent | 9c1279d2ae27071db4f351904bcad0fca4afae48 (diff) | |
Don't wait for NFC when shutting down.
NFC doesn't store any state before powering off, and hence it is okay to
not wait for it while shutting down.
Bug: 65761561
Test: Boot and shutdown
Change-Id: Ic8243bdb9c6d12daf6cff5784046286bfa8f4d53
(cherry picked from commit 20bc30f4cedff1043c4c665cfe68f7d7fd16a801)
Merged-In: Ic8243bdb9c6d12daf6cff5784046286bfa8f4d53
| -rw-r--r-- | services/core/java/com/android/server/power/ShutdownThread.java | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index 853e1b269c92..72b2211f1a82 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -34,8 +34,6 @@ import android.content.IntentFilter; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.media.AudioAttributes; -import android.nfc.INfcAdapter; -import android.nfc.NfcAdapter; import android.os.FileUtils; import android.os.Handler; import android.os.PowerManager; @@ -124,7 +122,6 @@ public final class ShutdownThread extends Thread { 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_NFC = "shutdown_nfc"; private static String METRIC_SM = "shutdown_storage_manager"; private final Object mActionDoneSync = new Object(); @@ -630,29 +627,14 @@ public final class ShutdownThread extends Thread { Thread t = new Thread() { public void run() { TimingsTraceLog shutdownTimingsTraceLog = newTimingsLog(); - boolean nfcOff; boolean bluetoothReadyForShutdown; boolean radioOff; - final INfcAdapter nfc = - INfcAdapter.Stub.asInterface(ServiceManager.checkService("nfc")); final ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); final IBluetoothManager bluetooth = IBluetoothManager.Stub.asInterface(ServiceManager.checkService( BluetoothAdapter.BLUETOOTH_MANAGER_SERVICE)); - try { - nfcOff = nfc == null || - nfc.getState() == NfcAdapter.STATE_OFF; - if (!nfcOff) { - Log.w(TAG, "Turning off NFC..."); - metricStarted(METRIC_NFC); - nfc.disable(false); // Don't persist new state - } - } catch (RemoteException ex) { - Log.e(TAG, "RemoteException during NFC shutdown", ex); - nfcOff = true; - } try { bluetoothReadyForShutdown = bluetooth == null || @@ -679,7 +661,7 @@ public final class ShutdownThread extends Thread { radioOff = true; } - Log.i(TAG, "Waiting for NFC, Bluetooth and Radio..."); + Log.i(TAG, "Waiting for Bluetooth and Radio..."); long delay = endTime - SystemClock.elapsedRealtime(); while (delay > 0) { @@ -723,23 +705,9 @@ public final class ShutdownThread extends Thread { .logDuration("ShutdownRadio", TRON_METRICS.get(METRIC_RADIO)); } } - if (!nfcOff) { - try { - nfcOff = nfc.getState() == NfcAdapter.STATE_OFF; - } catch (RemoteException ex) { - Log.e(TAG, "RemoteException during NFC shutdown", ex); - nfcOff = true; - } - if (nfcOff) { - Log.i(TAG, "NFC turned off."); - metricEnded(METRIC_NFC); - shutdownTimingsTraceLog - .logDuration("ShutdownNfc", TRON_METRICS.get(METRIC_NFC)); - } - } - if (radioOff && bluetoothReadyForShutdown && nfcOff) { - Log.i(TAG, "NFC, Radio and Bluetooth shutdown complete."); + if (radioOff && bluetoothReadyForShutdown) { + Log.i(TAG, "Radio and Bluetooth shutdown complete."); done[0] = true; break; } @@ -756,7 +724,7 @@ public final class ShutdownThread extends Thread { } catch (InterruptedException ex) { } if (!done[0]) { - Log.w(TAG, "Timed out waiting for NFC, Radio and Bluetooth shutdown."); + Log.w(TAG, "Timed out waiting for Radio and Bluetooth shutdown."); } } |