Loading policy/com/android/internal/policy/impl/PhoneWindowManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final String TAG = "WindowManager"; static final boolean DEBUG = false; static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV; static final boolean DEBUG_LAYOUT = false; static final boolean SHOW_STARTING_ANIMATIONS = true; static final boolean SHOW_PROCESSES_ON_ALT_MENU = false; Loading Loading @@ -992,6 +993,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // If the status bar is hidden, we don't want to cause // windows behind it to scroll. mDockTop = mContentTop = mCurTop = mStatusBar.getFrameLw().bottom; if (DEBUG_LAYOUT) Log.v(TAG, "Status bar: mDockBottom=" + mDockBottom + " mContentBottom=" + mContentBottom + " mCurBottom=" + mCurBottom); } } } Loading Loading @@ -1152,11 +1156,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { df.right = df.bottom = cf.right = cf.bottom = vf.right = vf.bottom = 10000; } if (DEBUG_LAYOUT) Log.v(TAG, "Compute frame " + attrs.getTitle() + ": sim=#" + Integer.toHexString(sim) + " pf=" + pf.toShortString() + " df=" + df.toShortString() + " cf=" + cf.toShortString() + " vf=" + vf.toShortString()); if (false) { if ("com.google.android.youtube".equals(attrs.packageName) && attrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { if (true || localLOGV) Log.v(TAG, "Computing frame of " + win + ": pf=" + pf.toShortString() + " df=" + df.toShortString() ": sim=#" + Integer.toHexString(sim) + " pf=" + pf.toShortString() + " df=" + df.toShortString() + " cf=" + cf.toShortString() + " vf=" + vf.toShortString()); } } Loading @@ -1176,6 +1186,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (mCurBottom > top) { mCurBottom = top; } if (DEBUG_LAYOUT) Log.v(TAG, "Input method: mDockBottom=" + mDockBottom + " mContentBottom=" + mContentBottom + " mCurBottom=" + mCurBottom); } } Loading policy/com/android/internal/policy/impl/ShutdownThread.java +56 −21 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.policy.impl; import android.app.ProgressDialog; import android.app.AlertDialog; import android.bluetooth.BluetoothDevice; import android.bluetooth.IBluetoothDevice; import android.content.Context; import android.content.DialogInterface; import android.os.RemoteException; Loading @@ -37,6 +39,9 @@ final class ShutdownThread extends Thread { private static final int PHONE_STATE_POLL_SLEEP_MSEC = 500; private static final ITelephony sPhone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); private static final IBluetoothDevice sBluetooth = IBluetoothDevice.Stub.asInterface(ServiceManager.getService(Context.BLUETOOTH_SERVICE)); // state tracking private static Object sIsStartedGuard = new Object(); Loading Loading @@ -108,28 +113,58 @@ final class ShutdownThread extends Thread { /** * Makes sure we handle the shutdown gracefully. * Shuts off power regardless of radio state if the alloted time has passed. * Shuts off power regardless of radio and bluetooth state if the alloted time has passed. */ public void run() { //shutdown the phone radio if possible. if (sPhone != null) { boolean bluetoothOff; boolean radioOff; try { bluetoothOff = sBluetooth == null || sBluetooth.getBluetoothState() == BluetoothDevice.BLUETOOTH_STATE_OFF; if (!bluetoothOff) { sBluetooth.disable(false); // disable but don't persist new state } } catch (RemoteException ex) { Log.e(TAG, "RemoteException during bluetooth shutdown", ex); bluetoothOff = true; } try { //shutdown radio radioOff = sPhone == null || !sPhone.isRadioOn(); if (!radioOff) { sPhone.setRadio(false); } } catch (RemoteException ex) { Log.e(TAG, "RemoteException during radio shutdown", ex); radioOff = true; } // Wait a max of 32 seconds for clean shutdown for (int i = 0; i < MAX_NUM_PHONE_STATE_READS; i++) { // poll radio up to 64 times, with a 0.5 sec delay between each call, // totaling 32 sec. if (!sPhone.isRadioOn()) { Log.d(TAG, "Radio shutdown complete."); break; if (!bluetoothOff) { try { bluetoothOff = sBluetooth.getBluetoothState() == BluetoothDevice.BLUETOOTH_STATE_OFF; } catch (RemoteException ex) { Log.e(TAG, "RemoteException during bluetooth shutdown", ex); bluetoothOff = true; } SystemClock.sleep(PHONE_STATE_POLL_SLEEP_MSEC); } if (!radioOff) { try { radioOff = !sPhone.isRadioOn(); } catch (RemoteException ex) { Log.e(TAG, "RemoteException caught from failed radio shutdown.", ex); Log.e(TAG, "RemoteException during radio shutdown", ex); radioOff = true; } } if (radioOff && bluetoothOff) { Log.d(TAG, "Radio and Bluetooth shutdown complete."); break; } SystemClock.sleep(PHONE_STATE_POLL_SLEEP_MSEC); } //shutdown power Log.d(TAG, "Shutting down power."); Loading Loading
policy/com/android/internal/policy/impl/PhoneWindowManager.java +14 −1 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final String TAG = "WindowManager"; static final boolean DEBUG = false; static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV; static final boolean DEBUG_LAYOUT = false; static final boolean SHOW_STARTING_ANIMATIONS = true; static final boolean SHOW_PROCESSES_ON_ALT_MENU = false; Loading Loading @@ -992,6 +993,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // If the status bar is hidden, we don't want to cause // windows behind it to scroll. mDockTop = mContentTop = mCurTop = mStatusBar.getFrameLw().bottom; if (DEBUG_LAYOUT) Log.v(TAG, "Status bar: mDockBottom=" + mDockBottom + " mContentBottom=" + mContentBottom + " mCurBottom=" + mCurBottom); } } } Loading Loading @@ -1152,11 +1156,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { df.right = df.bottom = cf.right = cf.bottom = vf.right = vf.bottom = 10000; } if (DEBUG_LAYOUT) Log.v(TAG, "Compute frame " + attrs.getTitle() + ": sim=#" + Integer.toHexString(sim) + " pf=" + pf.toShortString() + " df=" + df.toShortString() + " cf=" + cf.toShortString() + " vf=" + vf.toShortString()); if (false) { if ("com.google.android.youtube".equals(attrs.packageName) && attrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { if (true || localLOGV) Log.v(TAG, "Computing frame of " + win + ": pf=" + pf.toShortString() + " df=" + df.toShortString() ": sim=#" + Integer.toHexString(sim) + " pf=" + pf.toShortString() + " df=" + df.toShortString() + " cf=" + cf.toShortString() + " vf=" + vf.toShortString()); } } Loading @@ -1176,6 +1186,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (mCurBottom > top) { mCurBottom = top; } if (DEBUG_LAYOUT) Log.v(TAG, "Input method: mDockBottom=" + mDockBottom + " mContentBottom=" + mContentBottom + " mCurBottom=" + mCurBottom); } } Loading
policy/com/android/internal/policy/impl/ShutdownThread.java +56 −21 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.policy.impl; import android.app.ProgressDialog; import android.app.AlertDialog; import android.bluetooth.BluetoothDevice; import android.bluetooth.IBluetoothDevice; import android.content.Context; import android.content.DialogInterface; import android.os.RemoteException; Loading @@ -37,6 +39,9 @@ final class ShutdownThread extends Thread { private static final int PHONE_STATE_POLL_SLEEP_MSEC = 500; private static final ITelephony sPhone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); private static final IBluetoothDevice sBluetooth = IBluetoothDevice.Stub.asInterface(ServiceManager.getService(Context.BLUETOOTH_SERVICE)); // state tracking private static Object sIsStartedGuard = new Object(); Loading Loading @@ -108,28 +113,58 @@ final class ShutdownThread extends Thread { /** * Makes sure we handle the shutdown gracefully. * Shuts off power regardless of radio state if the alloted time has passed. * Shuts off power regardless of radio and bluetooth state if the alloted time has passed. */ public void run() { //shutdown the phone radio if possible. if (sPhone != null) { boolean bluetoothOff; boolean radioOff; try { bluetoothOff = sBluetooth == null || sBluetooth.getBluetoothState() == BluetoothDevice.BLUETOOTH_STATE_OFF; if (!bluetoothOff) { sBluetooth.disable(false); // disable but don't persist new state } } catch (RemoteException ex) { Log.e(TAG, "RemoteException during bluetooth shutdown", ex); bluetoothOff = true; } try { //shutdown radio radioOff = sPhone == null || !sPhone.isRadioOn(); if (!radioOff) { sPhone.setRadio(false); } } catch (RemoteException ex) { Log.e(TAG, "RemoteException during radio shutdown", ex); radioOff = true; } // Wait a max of 32 seconds for clean shutdown for (int i = 0; i < MAX_NUM_PHONE_STATE_READS; i++) { // poll radio up to 64 times, with a 0.5 sec delay between each call, // totaling 32 sec. if (!sPhone.isRadioOn()) { Log.d(TAG, "Radio shutdown complete."); break; if (!bluetoothOff) { try { bluetoothOff = sBluetooth.getBluetoothState() == BluetoothDevice.BLUETOOTH_STATE_OFF; } catch (RemoteException ex) { Log.e(TAG, "RemoteException during bluetooth shutdown", ex); bluetoothOff = true; } SystemClock.sleep(PHONE_STATE_POLL_SLEEP_MSEC); } if (!radioOff) { try { radioOff = !sPhone.isRadioOn(); } catch (RemoteException ex) { Log.e(TAG, "RemoteException caught from failed radio shutdown.", ex); Log.e(TAG, "RemoteException during radio shutdown", ex); radioOff = true; } } if (radioOff && bluetoothOff) { Log.d(TAG, "Radio and Bluetooth shutdown complete."); break; } SystemClock.sleep(PHONE_STATE_POLL_SLEEP_MSEC); } //shutdown power Log.d(TAG, "Shutting down power."); Loading