@@ -63,6 +63,10 @@ class UiModeManagerService extends IUiModeManager.Stub {
6363
6464 private static final String KEY_LAST_UPDATE_INTERVAL = "LAST_UPDATE_INTERVAL" ;
6565
66+ // Enable launching of applications when entering the dock.
67+ private static final boolean ENABLE_LAUNCH_CAR_DOCK_APP = true ;
68+ private static final boolean ENABLE_LAUNCH_DESK_DOCK_APP = false ;
69+
6670 private static final int MSG_UPDATE_TWILIGHT = 0 ;
6771 private static final int MSG_ENABLE_LOCATION_UPDATES = 1 ;
6872 private static final int MSG_GET_NEW_LOCATION_UPDATE = 2 ;
@@ -139,14 +143,16 @@ public void onReceive(Context context, Intent intent) {
139143 if (UiModeManager .ACTION_ENTER_CAR_MODE .equals (intent .getAction ())) {
140144 // Only launch car home when car mode is enabled and the caller
141145 // has asked us to switch to it.
142- if ((enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
146+ if (ENABLE_LAUNCH_CAR_DOCK_APP
147+ && (enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
143148 category = Intent .CATEGORY_CAR_DOCK ;
144149 }
145150 } else if (UiModeManager .ACTION_ENTER_DESK_MODE .equals (intent .getAction ())) {
146151 // Only launch car home when desk mode is enabled and the caller
147152 // has asked us to switch to it. Currently re-using the car
148153 // mode flag since we don't have a formal API for "desk mode".
149- if ((enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
154+ if (ENABLE_LAUNCH_DESK_DOCK_APP
155+ && (enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
150156 category = Intent .CATEGORY_DESK_DOCK ;
151157 }
152158 } else {
@@ -550,11 +556,13 @@ final void updateLocked(int enableFlags, int disableFlags) {
550556 } else {
551557 Intent homeIntent = null ;
552558 if (mCarModeEnabled ) {
553- if ((enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
559+ if (ENABLE_LAUNCH_CAR_DOCK_APP
560+ && (enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
554561 homeIntent = buildHomeIntent (Intent .CATEGORY_CAR_DOCK );
555562 }
556563 } else if (isDeskDockState (mDockState )) {
557- if ((enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
564+ if (ENABLE_LAUNCH_DESK_DOCK_APP
565+ && (enableFlags &UiModeManager .ENABLE_CAR_MODE_GO_CAR_HOME ) != 0 ) {
558566 homeIntent = buildHomeIntent (Intent .CATEGORY_DESK_DOCK );
559567 }
560568 } else {
0 commit comments