Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +25 −6 Original line number Original line Diff line number Diff line Loading @@ -157,6 +157,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final boolean SHOW_STARTING_ANIMATIONS = true; static final boolean SHOW_STARTING_ANIMATIONS = true; static final boolean SHOW_PROCESSES_ON_ALT_MENU = false; static final boolean SHOW_PROCESSES_ON_ALT_MENU = false; // Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key. // No longer recommended for desk docks; still useful in car docks. static final boolean ENABLE_CAR_DOCK_HOME_CAPTURE = true; static final boolean ENABLE_DESK_DOCK_HOME_CAPTURE = false; static final int LONG_PRESS_POWER_NOTHING = 0; static final int LONG_PRESS_POWER_NOTHING = 0; static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1; static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1; static final int LONG_PRESS_POWER_SHUT_OFF = 2; static final int LONG_PRESS_POWER_SHUT_OFF = 2; Loading Loading @@ -3514,21 +3519,35 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } /** /** * Return an Intent to launch the currently active dock as home. Returns * Return an Intent to launch the currently active dock app as home. Returns * null if the standard home should be launched. * null if the standard home should be launched, which is the case if any of the following is * true: * <ul> * <li>The device is not in either car mode or desk mode * <li>The device is in car mode but ENABLE_CAR_DOCK_HOME_CAPTURE is false * <li>The device is in desk mode but ENABLE_DESK_DOCK_HOME_CAPTURE is false * <li>The device is in car mode but there's no CAR_DOCK app with METADATA_DOCK_HOME * <li>The device is in desk mode but there's no DESK_DOCK app with METADATA_DOCK_HOME * </ul> * @return * @return */ */ Intent createHomeDockIntent() { Intent createHomeDockIntent() { Intent intent; Intent intent = null; // What home does is based on the mode, not the dock state. That // What home does is based on the mode, not the dock state. That // is, when in car mode you should be taken to car home regardless // is, when in car mode you should be taken to car home regardless // of whether we are actually in a car dock. // of whether we are actually in a car dock. if (mUiMode == Configuration.UI_MODE_TYPE_CAR) { if (mUiMode == Configuration.UI_MODE_TYPE_CAR) { if (ENABLE_CAR_DOCK_HOME_CAPTURE) { intent = mCarDockIntent; intent = mCarDockIntent; } } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK) { } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK) { if (ENABLE_DESK_DOCK_HOME_CAPTURE) { intent = mDeskDockIntent; intent = mDeskDockIntent; } else { } } if (intent == null) { return null; return null; } } Loading services/java/com/android/server/UiModeManagerService.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,10 @@ class UiModeManagerService extends IUiModeManager.Stub { private static final String KEY_LAST_UPDATE_INTERVAL = "LAST_UPDATE_INTERVAL"; private static final String KEY_LAST_UPDATE_INTERVAL = "LAST_UPDATE_INTERVAL"; // Enable launching of applications when entering the dock. private static final boolean ENABLE_LAUNCH_CAR_DOCK_APP = true; private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = false; private static final int MSG_UPDATE_TWILIGHT = 0; private static final int MSG_UPDATE_TWILIGHT = 0; private static final int MSG_ENABLE_LOCATION_UPDATES = 1; private static final int MSG_ENABLE_LOCATION_UPDATES = 1; private static final int MSG_GET_NEW_LOCATION_UPDATE = 2; private static final int MSG_GET_NEW_LOCATION_UPDATE = 2; Loading Loading @@ -139,14 +143,16 @@ class UiModeManagerService extends IUiModeManager.Stub { if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) { if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) { // Only launch car home when car mode is enabled and the caller // Only launch car home when car mode is enabled and the caller // has asked us to switch to it. // has asked us to switch to it. if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_CAR_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { category = Intent.CATEGORY_CAR_DOCK; category = Intent.CATEGORY_CAR_DOCK; } } } else if (UiModeManager.ACTION_ENTER_DESK_MODE.equals(intent.getAction())) { } else if (UiModeManager.ACTION_ENTER_DESK_MODE.equals(intent.getAction())) { // Only launch car home when desk mode is enabled and the caller // Only launch car home when desk mode is enabled and the caller // has asked us to switch to it. Currently re-using the car // has asked us to switch to it. Currently re-using the car // mode flag since we don't have a formal API for "desk mode". // mode flag since we don't have a formal API for "desk mode". if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_DESK_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { category = Intent.CATEGORY_DESK_DOCK; category = Intent.CATEGORY_DESK_DOCK; } } } else { } else { Loading Loading @@ -550,11 +556,13 @@ class UiModeManagerService extends IUiModeManager.Stub { } else { } else { Intent homeIntent = null; Intent homeIntent = null; if (mCarModeEnabled) { if (mCarModeEnabled) { if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_CAR_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { homeIntent = buildHomeIntent(Intent.CATEGORY_CAR_DOCK); homeIntent = buildHomeIntent(Intent.CATEGORY_CAR_DOCK); } } } else if (isDeskDockState(mDockState)) { } else if (isDeskDockState(mDockState)) { if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_DESK_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { homeIntent = buildHomeIntent(Intent.CATEGORY_DESK_DOCK); homeIntent = buildHomeIntent(Intent.CATEGORY_DESK_DOCK); } } } else { } else { Loading Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +25 −6 Original line number Original line Diff line number Diff line Loading @@ -157,6 +157,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final boolean SHOW_STARTING_ANIMATIONS = true; static final boolean SHOW_STARTING_ANIMATIONS = true; static final boolean SHOW_PROCESSES_ON_ALT_MENU = false; static final boolean SHOW_PROCESSES_ON_ALT_MENU = false; // Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key. // No longer recommended for desk docks; still useful in car docks. static final boolean ENABLE_CAR_DOCK_HOME_CAPTURE = true; static final boolean ENABLE_DESK_DOCK_HOME_CAPTURE = false; static final int LONG_PRESS_POWER_NOTHING = 0; static final int LONG_PRESS_POWER_NOTHING = 0; static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1; static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1; static final int LONG_PRESS_POWER_SHUT_OFF = 2; static final int LONG_PRESS_POWER_SHUT_OFF = 2; Loading Loading @@ -3514,21 +3519,35 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } /** /** * Return an Intent to launch the currently active dock as home. Returns * Return an Intent to launch the currently active dock app as home. Returns * null if the standard home should be launched. * null if the standard home should be launched, which is the case if any of the following is * true: * <ul> * <li>The device is not in either car mode or desk mode * <li>The device is in car mode but ENABLE_CAR_DOCK_HOME_CAPTURE is false * <li>The device is in desk mode but ENABLE_DESK_DOCK_HOME_CAPTURE is false * <li>The device is in car mode but there's no CAR_DOCK app with METADATA_DOCK_HOME * <li>The device is in desk mode but there's no DESK_DOCK app with METADATA_DOCK_HOME * </ul> * @return * @return */ */ Intent createHomeDockIntent() { Intent createHomeDockIntent() { Intent intent; Intent intent = null; // What home does is based on the mode, not the dock state. That // What home does is based on the mode, not the dock state. That // is, when in car mode you should be taken to car home regardless // is, when in car mode you should be taken to car home regardless // of whether we are actually in a car dock. // of whether we are actually in a car dock. if (mUiMode == Configuration.UI_MODE_TYPE_CAR) { if (mUiMode == Configuration.UI_MODE_TYPE_CAR) { if (ENABLE_CAR_DOCK_HOME_CAPTURE) { intent = mCarDockIntent; intent = mCarDockIntent; } } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK) { } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK) { if (ENABLE_DESK_DOCK_HOME_CAPTURE) { intent = mDeskDockIntent; intent = mDeskDockIntent; } else { } } if (intent == null) { return null; return null; } } Loading
services/java/com/android/server/UiModeManagerService.java +12 −4 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,10 @@ class UiModeManagerService extends IUiModeManager.Stub { private static final String KEY_LAST_UPDATE_INTERVAL = "LAST_UPDATE_INTERVAL"; private static final String KEY_LAST_UPDATE_INTERVAL = "LAST_UPDATE_INTERVAL"; // Enable launching of applications when entering the dock. private static final boolean ENABLE_LAUNCH_CAR_DOCK_APP = true; private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = false; private static final int MSG_UPDATE_TWILIGHT = 0; private static final int MSG_UPDATE_TWILIGHT = 0; private static final int MSG_ENABLE_LOCATION_UPDATES = 1; private static final int MSG_ENABLE_LOCATION_UPDATES = 1; private static final int MSG_GET_NEW_LOCATION_UPDATE = 2; private static final int MSG_GET_NEW_LOCATION_UPDATE = 2; Loading Loading @@ -139,14 +143,16 @@ class UiModeManagerService extends IUiModeManager.Stub { if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) { if (UiModeManager.ACTION_ENTER_CAR_MODE.equals(intent.getAction())) { // Only launch car home when car mode is enabled and the caller // Only launch car home when car mode is enabled and the caller // has asked us to switch to it. // has asked us to switch to it. if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_CAR_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { category = Intent.CATEGORY_CAR_DOCK; category = Intent.CATEGORY_CAR_DOCK; } } } else if (UiModeManager.ACTION_ENTER_DESK_MODE.equals(intent.getAction())) { } else if (UiModeManager.ACTION_ENTER_DESK_MODE.equals(intent.getAction())) { // Only launch car home when desk mode is enabled and the caller // Only launch car home when desk mode is enabled and the caller // has asked us to switch to it. Currently re-using the car // has asked us to switch to it. Currently re-using the car // mode flag since we don't have a formal API for "desk mode". // mode flag since we don't have a formal API for "desk mode". if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_DESK_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { category = Intent.CATEGORY_DESK_DOCK; category = Intent.CATEGORY_DESK_DOCK; } } } else { } else { Loading Loading @@ -550,11 +556,13 @@ class UiModeManagerService extends IUiModeManager.Stub { } else { } else { Intent homeIntent = null; Intent homeIntent = null; if (mCarModeEnabled) { if (mCarModeEnabled) { if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_CAR_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { homeIntent = buildHomeIntent(Intent.CATEGORY_CAR_DOCK); homeIntent = buildHomeIntent(Intent.CATEGORY_CAR_DOCK); } } } else if (isDeskDockState(mDockState)) { } else if (isDeskDockState(mDockState)) { if ((enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { if (ENABLE_LAUNCH_DESK_DOCK_APP && (enableFlags&UiModeManager.ENABLE_CAR_MODE_GO_CAR_HOME) != 0) { homeIntent = buildHomeIntent(Intent.CATEGORY_DESK_DOCK); homeIntent = buildHomeIntent(Intent.CATEGORY_DESK_DOCK); } } } else { } else { Loading