@@ -169,11 +169,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
169169 static final boolean SHOW_STARTING_ANIMATIONS = true ;
170170 static final boolean SHOW_PROCESSES_ON_ALT_MENU = false ;
171171
172- // Whether to allow dock apps with METADATA_DOCK_HOME to temporarily take over the Home key.
173- // No longer recommended for desk docks; still useful in car docks.
174- static final boolean ENABLE_CAR_DOCK_HOME_CAPTURE = true ;
175- static final boolean ENABLE_DESK_DOCK_HOME_CAPTURE = false ;
176-
177172 static final int LONG_PRESS_POWER_NOTHING = 0 ;
178173 static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1 ;
179174 static final int LONG_PRESS_POWER_SHUT_OFF = 2 ;
@@ -347,7 +342,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
347342 boolean mSystemReady ;
348343 boolean mSystemBooted ;
349344 boolean mHdmiPlugged ;
350- int mUiMode ;
351345 int mDockMode = Intent .EXTRA_DOCK_STATE_UNDOCKED ;
352346 int mLidOpenRotation ;
353347 int mCarDockRotation ;
@@ -892,8 +886,6 @@ public void init(Context context, IWindowManager windowManager,
892886 mSettingsObserver .observe ();
893887 mShortcutManager = new ShortcutManager (context , mHandler );
894888 mShortcutManager .observe ();
895- mUiMode = context .getResources ().getInteger (
896- com .android .internal .R .integer .config_defaultUiModeType );
897889 mHomeIntent = new Intent (Intent .ACTION_MAIN , null );
898890 mHomeIntent .addCategory (Intent .CATEGORY_HOME );
899891 mHomeIntent .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK
@@ -3563,13 +3555,6 @@ public void onReceive(Context context, Intent intent) {
35633555 if (Intent .ACTION_DOCK_EVENT .equals (intent .getAction ())) {
35643556 mDockMode = intent .getIntExtra (Intent .EXTRA_DOCK_STATE ,
35653557 Intent .EXTRA_DOCK_STATE_UNDOCKED );
3566- } else {
3567- try {
3568- IUiModeManager uiModeService = IUiModeManager .Stub .asInterface (
3569- ServiceManager .getService (Context .UI_MODE_SERVICE ));
3570- mUiMode = uiModeService .getCurrentModeType ();
3571- } catch (RemoteException e ) {
3572- }
35733558 }
35743559 updateRotation (true );
35753560 updateOrientationListenerLp ();
@@ -4122,63 +4107,8 @@ void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout) {
41224107 }
41234108 }
41244109
4125- /**
4126- * Return an Intent to launch the currently active dock app as home. Returns
4127- * null if the standard home should be launched, which is the case if any of the following is
4128- * true:
4129- * <ul>
4130- * <li>The device is not in either car mode or desk mode
4131- * <li>The device is in car mode but ENABLE_CAR_DOCK_HOME_CAPTURE is false
4132- * <li>The device is in desk mode but ENABLE_DESK_DOCK_HOME_CAPTURE is false
4133- * <li>The device is in car mode but there's no CAR_DOCK app with METADATA_DOCK_HOME
4134- * <li>The device is in desk mode but there's no DESK_DOCK app with METADATA_DOCK_HOME
4135- * </ul>
4136- * @return
4137- */
4138- Intent createHomeDockIntent () {
4139- Intent intent = null ;
4140-
4141- // What home does is based on the mode, not the dock state. That
4142- // is, when in car mode you should be taken to car home regardless
4143- // of whether we are actually in a car dock.
4144- if (mUiMode == Configuration .UI_MODE_TYPE_CAR ) {
4145- if (ENABLE_CAR_DOCK_HOME_CAPTURE ) {
4146- intent = mCarDockIntent ;
4147- }
4148- } else if (mUiMode == Configuration .UI_MODE_TYPE_DESK ) {
4149- if (ENABLE_DESK_DOCK_HOME_CAPTURE ) {
4150- intent = mDeskDockIntent ;
4151- }
4152- }
4153-
4154- if (intent == null ) {
4155- return null ;
4156- }
4157-
4158- ActivityInfo ai = intent .resolveActivityInfo (
4159- mContext .getPackageManager (), PackageManager .GET_META_DATA );
4160- if (ai == null ) {
4161- return null ;
4162- }
4163-
4164- if (ai .metaData != null && ai .metaData .getBoolean (Intent .METADATA_DOCK_HOME )) {
4165- intent = new Intent (intent );
4166- intent .setClassName (ai .packageName , ai .name );
4167- return intent ;
4168- }
4169-
4170- return null ;
4171- }
4172-
41734110 void startDockOrHome () {
4174- Intent dock = createHomeDockIntent ();
4175- if (dock != null ) {
4176- try {
4177- mContext .startActivity (dock );
4178- return ;
4179- } catch (ActivityNotFoundException e ) {
4180- }
4181- }
4111+ // We don't have dock home anymore. Home is home. If you lived here, you'd be home by now.
41824112 mContext .startActivityAsUser (mHomeIntent , UserHandle .CURRENT );
41834113 }
41844114
@@ -4205,18 +4135,6 @@ boolean goHome() {
42054135 } else {
42064136 ActivityManagerNative .getDefault ().stopAppSwitches ();
42074137 sendCloseSystemWindows ();
4208- Intent dock = createHomeDockIntent ();
4209- if (dock != null ) {
4210- int result = ActivityManagerNative .getDefault ()
4211- .startActivityAsUser (null , dock ,
4212- dock .resolveTypeIfNeeded (mContext .getContentResolver ()),
4213- null , null , 0 ,
4214- ActivityManager .START_FLAG_ONLY_IF_NEEDED ,
4215- null , null , null , UserHandle .USER_CURRENT );
4216- if (result == ActivityManager .START_RETURN_INTENT_TO_CALLER ) {
4217- return false ;
4218- }
4219- }
42204138 }
42214139 int result = ActivityManagerNative .getDefault ()
42224140 .startActivityAsUser (null , mHomeIntent ,
@@ -4403,8 +4321,7 @@ public void dump(String prefix, PrintWriter pw, String[] args) {
44034321 pw .print (prefix ); pw .print ("mLastFocusNeedsMenu=" );
44044322 pw .println (mLastFocusNeedsMenu );
44054323 }
4406- pw .print (prefix ); pw .print ("mUiMode=" ); pw .print (mUiMode );
4407- pw .print (" mDockMode=" ); pw .print (mDockMode );
4324+ pw .print (prefix ); pw .print ("mDockMode=" ); pw .print (mDockMode );
44084325 pw .print (" mCarDockRotation=" ); pw .print (mCarDockRotation );
44094326 pw .print (" mDeskDockRotation=" ); pw .println (mDeskDockRotation );
44104327 pw .print (prefix ); pw .print ("mUserRotationMode=" ); pw .print (mUserRotationMode );
0 commit comments