Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +45 −18 Original line number Diff line number Diff line Loading @@ -279,6 +279,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerFuncs mWindowManagerFuncs; LocalPowerManager mPowerManager; IStatusBarService mStatusBarService; final Object mServiceAquireLock = new Object(); Vibrator mVibrator; // Vibrator for giving feedback of orientation changes SearchManager mSearchManager; Loading Loading @@ -597,6 +598,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { } MyOrientationListener mOrientationListener; IStatusBarService getStatusBarService() { synchronized (mServiceAquireLock) { if (mStatusBarService == null) { mStatusBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService("statusbar")); } return mStatusBarService; } } /* * We always let the sensor be switched on by default except when * the user has explicitly disabled sensor based rotation or when the Loading Loading @@ -790,9 +801,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS); } else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) { try { mStatusBarService.toggleRecentApps(); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.toggleRecentApps(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException when showing recent apps", e); // re-acquire status bar service next time it is needed. mStatusBarService = null; } } } Loading Loading @@ -1752,9 +1768,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHomeLongPressed = false; if (!homeWasLongPressed) { try { mStatusBarService.cancelPreloadRecentApps(); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.cancelPreloadRecentApps(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException when showing recent apps", e); // re-acquire status bar service next time it is needed. mStatusBarService = null; } mHomePressed = false; Loading Loading @@ -1805,9 +1826,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (down) { if (!mHomePressed && mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) { try { mStatusBarService.preloadRecentApps(); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.preloadRecentApps(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException when preloading recent apps", e); // re-acquire status bar service next time it is needed. mStatusBarService = null; } } if (repeatCount == 0) { Loading Loading @@ -2902,10 +2928,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { changes |= FINISH_LAYOUT_REDO_LAYOUT; mHandler.post(new Runnable() { public void run() { if (mStatusBarService != null) { try { mStatusBarService.collapse(); } catch (RemoteException ex) {} IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.collapse(); } } catch (RemoteException ex) { // re-acquire status bar service next time it is needed. mStatusBarService = null; } }}); } else if (DEBUG_LAYOUT) { Loading Loading @@ -4343,20 +4373,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { mFocusedApp = mFocusedWindow.getAppToken(); mHandler.post(new Runnable() { public void run() { if (mStatusBarService == null) { mStatusBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService("statusbar")); } if (mStatusBarService != null) { try { mStatusBarService.setSystemUiVisibility(visibility, 0xffffffff); mStatusBarService.topAppWindowChanged(needsMenu); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.setSystemUiVisibility(visibility, 0xffffffff); statusbar.topAppWindowChanged(needsMenu); } } catch (RemoteException e) { // not much to be done // re-acquire status bar service next time it is needed. mStatusBarService = null; } } } }); return diff; } Loading services/java/com/android/server/am/ActivityStack.java +45 −15 Original line number Diff line number Diff line Loading @@ -1129,6 +1129,11 @@ final class ActivityStack { resumeTopActivityLocked(prev); } else { checkReadyForSleepLocked(); if (topRunningActivityLocked(null) == null) { // If there are no more activities available to run, then // do resume anyway to start something. resumeTopActivityLocked(null); } } if (prev != null) { Loading Loading @@ -3409,6 +3414,7 @@ final class ActivityStack { IApplicationThread sendThumbnail = null; boolean booting = false; boolean enableScreen = false; boolean activityRemoved = false; synchronized (mService) { ActivityRecord r = ActivityRecord.forToken(token); Loading Loading @@ -3515,7 +3521,7 @@ final class ActivityStack { for (i=0; i<NF; i++) { ActivityRecord r = (ActivityRecord)finishes.get(i); synchronized (mService) { destroyActivityLocked(r, true, false, "finish-idle"); activityRemoved = destroyActivityLocked(r, true, false, "finish-idle"); } } Loading @@ -3537,6 +3543,10 @@ final class ActivityStack { mService.enableScreenAfterBoot(); } if (activityRemoved) { resumeTopActivityLocked(null); } return res; } Loading Loading @@ -3776,7 +3786,11 @@ final class ActivityStack { || prevState == ActivityState.INITIALIZING) { // If this activity is already stopped, we can just finish // it right now. return destroyActivityLocked(r, true, true, "finish-imm") ? null : r; boolean activityRemoved = destroyActivityLocked(r, true, true, "finish-imm"); if (activityRemoved) { resumeTopActivityLocked(null); } return activityRemoved ? null : r; } else { // Need to go through the full pause cycle to get this // activity into the stopped state and then finish it. Loading Loading @@ -3840,6 +3854,10 @@ final class ActivityStack { } // Get rid of any pending idle timeouts. removeTimeoutsForActivityLocked(r); } private void removeTimeoutsForActivityLocked(ActivityRecord r) { mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r); mHandler.removeMessages(STOP_TIMEOUT_MSG, r); mHandler.removeMessages(IDLE_TIMEOUT_MSG, r); Loading Loading @@ -3893,6 +3911,7 @@ final class ActivityStack { final void destroyActivitiesLocked(ProcessRecord owner, boolean oomAdj, String reason) { boolean lastIsOpaque = false; boolean activityRemoved = false; for (int i=mHistory.size()-1; i>=0; i--) { ActivityRecord r = mHistory.get(i); if (r.finishing) { Loading @@ -3916,9 +3935,14 @@ final class ActivityStack { if (DEBUG_SWITCH) Slog.v(TAG, "Destroying " + r + " in state " + r.state + " resumed=" + mResumedActivity + " pausing=" + mPausingActivity); destroyActivityLocked(r, true, oomAdj, reason); if (destroyActivityLocked(r, true, oomAdj, reason)) { activityRemoved = true; } } } if (activityRemoved) { resumeTopActivityLocked(null); } } /** Loading Loading @@ -4023,6 +4047,8 @@ final class ActivityStack { final void activityDestroyed(IBinder token) { synchronized (mService) { final long origId = Binder.clearCallingIdentity(); try { ActivityRecord r = ActivityRecord.forToken(token); if (r != null) { mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r); Loading @@ -4031,15 +4057,18 @@ final class ActivityStack { int index = indexOfActivityLocked(r); if (index >= 0) { if (r.state == ActivityState.DESTROYING) { final long origId = Binder.clearCallingIdentity(); cleanUpActivityLocked(r, true, true); removeActivityFromHistoryLocked(r); Binder.restoreCallingIdentity(origId); } } resumeTopActivityLocked(null); } finally { Binder.restoreCallingIdentity(origId); } } } private static void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app) { private void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app) { int i = list.size(); if (localLOGV) Slog.v( TAG, "Removing app " + app + " from list " + list Loading @@ -4052,6 +4081,7 @@ final class ActivityStack { if (r.app == app) { if (localLOGV) Slog.v(TAG, "Removing this entry!"); list.remove(i); removeTimeoutsForActivityLocked(r); } } } Loading Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +45 −18 Original line number Diff line number Diff line Loading @@ -279,6 +279,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowManagerFuncs mWindowManagerFuncs; LocalPowerManager mPowerManager; IStatusBarService mStatusBarService; final Object mServiceAquireLock = new Object(); Vibrator mVibrator; // Vibrator for giving feedback of orientation changes SearchManager mSearchManager; Loading Loading @@ -597,6 +598,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { } MyOrientationListener mOrientationListener; IStatusBarService getStatusBarService() { synchronized (mServiceAquireLock) { if (mStatusBarService == null) { mStatusBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService("statusbar")); } return mStatusBarService; } } /* * We always let the sensor be switched on by default except when * the user has explicitly disabled sensor based rotation or when the Loading Loading @@ -790,9 +801,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { showOrHideRecentAppsDialog(RECENT_APPS_BEHAVIOR_SHOW_OR_DISMISS); } else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) { try { mStatusBarService.toggleRecentApps(); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.toggleRecentApps(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException when showing recent apps", e); // re-acquire status bar service next time it is needed. mStatusBarService = null; } } } Loading Loading @@ -1752,9 +1768,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHomeLongPressed = false; if (!homeWasLongPressed) { try { mStatusBarService.cancelPreloadRecentApps(); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.cancelPreloadRecentApps(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException when showing recent apps", e); // re-acquire status bar service next time it is needed. mStatusBarService = null; } mHomePressed = false; Loading Loading @@ -1805,9 +1826,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (down) { if (!mHomePressed && mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) { try { mStatusBarService.preloadRecentApps(); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.preloadRecentApps(); } } catch (RemoteException e) { Slog.e(TAG, "RemoteException when preloading recent apps", e); // re-acquire status bar service next time it is needed. mStatusBarService = null; } } if (repeatCount == 0) { Loading Loading @@ -2902,10 +2928,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { changes |= FINISH_LAYOUT_REDO_LAYOUT; mHandler.post(new Runnable() { public void run() { if (mStatusBarService != null) { try { mStatusBarService.collapse(); } catch (RemoteException ex) {} IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.collapse(); } } catch (RemoteException ex) { // re-acquire status bar service next time it is needed. mStatusBarService = null; } }}); } else if (DEBUG_LAYOUT) { Loading Loading @@ -4343,20 +4373,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { mFocusedApp = mFocusedWindow.getAppToken(); mHandler.post(new Runnable() { public void run() { if (mStatusBarService == null) { mStatusBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService("statusbar")); } if (mStatusBarService != null) { try { mStatusBarService.setSystemUiVisibility(visibility, 0xffffffff); mStatusBarService.topAppWindowChanged(needsMenu); IStatusBarService statusbar = getStatusBarService(); if (statusbar != null) { statusbar.setSystemUiVisibility(visibility, 0xffffffff); statusbar.topAppWindowChanged(needsMenu); } } catch (RemoteException e) { // not much to be done // re-acquire status bar service next time it is needed. mStatusBarService = null; } } } }); return diff; } Loading
services/java/com/android/server/am/ActivityStack.java +45 −15 Original line number Diff line number Diff line Loading @@ -1129,6 +1129,11 @@ final class ActivityStack { resumeTopActivityLocked(prev); } else { checkReadyForSleepLocked(); if (topRunningActivityLocked(null) == null) { // If there are no more activities available to run, then // do resume anyway to start something. resumeTopActivityLocked(null); } } if (prev != null) { Loading Loading @@ -3409,6 +3414,7 @@ final class ActivityStack { IApplicationThread sendThumbnail = null; boolean booting = false; boolean enableScreen = false; boolean activityRemoved = false; synchronized (mService) { ActivityRecord r = ActivityRecord.forToken(token); Loading Loading @@ -3515,7 +3521,7 @@ final class ActivityStack { for (i=0; i<NF; i++) { ActivityRecord r = (ActivityRecord)finishes.get(i); synchronized (mService) { destroyActivityLocked(r, true, false, "finish-idle"); activityRemoved = destroyActivityLocked(r, true, false, "finish-idle"); } } Loading @@ -3537,6 +3543,10 @@ final class ActivityStack { mService.enableScreenAfterBoot(); } if (activityRemoved) { resumeTopActivityLocked(null); } return res; } Loading Loading @@ -3776,7 +3786,11 @@ final class ActivityStack { || prevState == ActivityState.INITIALIZING) { // If this activity is already stopped, we can just finish // it right now. return destroyActivityLocked(r, true, true, "finish-imm") ? null : r; boolean activityRemoved = destroyActivityLocked(r, true, true, "finish-imm"); if (activityRemoved) { resumeTopActivityLocked(null); } return activityRemoved ? null : r; } else { // Need to go through the full pause cycle to get this // activity into the stopped state and then finish it. Loading Loading @@ -3840,6 +3854,10 @@ final class ActivityStack { } // Get rid of any pending idle timeouts. removeTimeoutsForActivityLocked(r); } private void removeTimeoutsForActivityLocked(ActivityRecord r) { mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r); mHandler.removeMessages(STOP_TIMEOUT_MSG, r); mHandler.removeMessages(IDLE_TIMEOUT_MSG, r); Loading Loading @@ -3893,6 +3911,7 @@ final class ActivityStack { final void destroyActivitiesLocked(ProcessRecord owner, boolean oomAdj, String reason) { boolean lastIsOpaque = false; boolean activityRemoved = false; for (int i=mHistory.size()-1; i>=0; i--) { ActivityRecord r = mHistory.get(i); if (r.finishing) { Loading @@ -3916,9 +3935,14 @@ final class ActivityStack { if (DEBUG_SWITCH) Slog.v(TAG, "Destroying " + r + " in state " + r.state + " resumed=" + mResumedActivity + " pausing=" + mPausingActivity); destroyActivityLocked(r, true, oomAdj, reason); if (destroyActivityLocked(r, true, oomAdj, reason)) { activityRemoved = true; } } } if (activityRemoved) { resumeTopActivityLocked(null); } } /** Loading Loading @@ -4023,6 +4047,8 @@ final class ActivityStack { final void activityDestroyed(IBinder token) { synchronized (mService) { final long origId = Binder.clearCallingIdentity(); try { ActivityRecord r = ActivityRecord.forToken(token); if (r != null) { mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r); Loading @@ -4031,15 +4057,18 @@ final class ActivityStack { int index = indexOfActivityLocked(r); if (index >= 0) { if (r.state == ActivityState.DESTROYING) { final long origId = Binder.clearCallingIdentity(); cleanUpActivityLocked(r, true, true); removeActivityFromHistoryLocked(r); Binder.restoreCallingIdentity(origId); } } resumeTopActivityLocked(null); } finally { Binder.restoreCallingIdentity(origId); } } } private static void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app) { private void removeHistoryRecordsForAppLocked(ArrayList list, ProcessRecord app) { int i = list.size(); if (localLOGV) Slog.v( TAG, "Removing app " + app + " from list " + list Loading @@ -4052,6 +4081,7 @@ final class ActivityStack { if (r.app == app) { if (localLOGV) Slog.v(TAG, "Removing this entry!"); list.remove(i); removeTimeoutsForActivityLocked(r); } } } Loading