Loading policy/com/android/internal/policy/impl/PhoneWindowManager.java +86 −65 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mSystemReady; boolean mLidOpen; int mUiMode = Configuration.UI_MODE_TYPE_NORMAL; int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED; int mLidOpenRotation; int mCarDockRotation; int mDeskDockRotation; Loading Loading @@ -340,8 +341,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } // We're in a dock that has a rotation affinity, an the app is willing to rotate. if ((mCarDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_CAR) || (mDeskDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_DESK)) { if ((mCarDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_CAR) || (mDeskDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_DESK)) { // Note we override the nosensor flag here. if (appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED Loading @@ -364,8 +365,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { // orientation, then we need to turn the sensor or. return true; } if ((mCarDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_CAR) || (mDeskDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_DESK)) { if ((mCarDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_CAR) || (mDeskDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_DESK)) { // enable accelerometer if we are docked in a dock that enables accelerometer // orientation management, return true; Loading Loading @@ -526,7 +527,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { filter.addAction(UiModeManager.ACTION_EXIT_CAR_MODE); filter.addAction(UiModeManager.ACTION_ENTER_DESK_MODE); filter.addAction(UiModeManager.ACTION_EXIT_DESK_MODE); context.registerReceiver(mDockReceiver, filter); filter.addAction(Intent.ACTION_DOCK_EVENT); Intent intent = context.registerReceiver(mDockReceiver, filter); if (intent != null) { // Retrieve current sticky dock event broadcast. mDockMode = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED); } mVibrator = new Vibrator(); mLongPressVibePattern = getLongIntArray(mContext.getResources(), com.android.internal.R.array.config_longPressVibePattern); Loading Loading @@ -829,6 +836,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { return null; } try { Context context = mContext; boolean setTheme = false; //Log.i(TAG, "addStartingWindow " + packageName + ": nonLocalizedLabel=" Loading Loading @@ -881,7 +889,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { com.android.internal.R.styleable.Window_windowAnimationStyle, 0); params.setTitle("Starting " + packageName); try { WindowManagerImpl wm = (WindowManagerImpl) context.getSystemService(Context.WINDOW_SERVICE); View view = win.getDecorView(); Loading Loading @@ -909,6 +916,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } catch (WindowManagerImpl.BadTokenException e) { // ignore Log.w(TAG, appToken + " already running, starting window not displayed"); } catch (RuntimeException e) { // don't crash if something else bad happens, for example a // failure loading resources because we are loading from an app // on external storage that has been unmounted. Log.w(TAG, appToken + " failed creating starting window", e); } return null; Loading Loading @@ -1973,12 +1985,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { BroadcastReceiver mDockReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { if (Intent.ACTION_DOCK_EVENT.equals(intent.getAction())) { mDockMode = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED); } else { try { IUiModeManager uiModeService = IUiModeManager.Stub.asInterface( ServiceManager.getService(Context.UI_MODE_SERVICE)); mUiMode = uiModeService.getCurrentModeType(); } catch (RemoteException e) { } } updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE); updateOrientationListenerLp(); } Loading Loading @@ -2106,9 +2123,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { //or case.unspecified if (mLidOpen) { return mLidOpenRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_CAR && mCarDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) { return mCarDockRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK && mDeskDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_DESK && mDeskDockRotation >= 0) { return mDeskDockRotation; } else { if (useSensorForOrientationLp(orientation)) { Loading Loading @@ -2220,9 +2237,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { int rotation = Surface.ROTATION_0; if (mLidOpen) { rotation = mLidOpenRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_CAR && mCarDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) { rotation = mCarDockRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK && mDeskDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_DESK && mDeskDockRotation >= 0) { rotation = mDeskDockRotation; } //if lid is closed orientation will be portrait Loading @@ -2242,6 +2259,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { */ Intent createHomeDockIntent() { Intent intent; // 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 // of whether we are actually in a car dock. if (mUiMode == Configuration.UI_MODE_TYPE_CAR) { intent = mCarDockIntent; } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK) { Loading policy/com/android/internal/policy/impl/RecentApplicationsDialog.java +14 −8 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.policy.impl; import android.app.ActivityManager; import android.app.Dialog; import android.app.StatusBarManager; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading @@ -29,6 +30,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; Loading Loading @@ -117,7 +119,11 @@ public class RecentApplicationsDialog extends Dialog implements OnClickListener Intent intent = (Intent)b.getTag(); if (intent != null) { intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); try { getContext().startActivity(intent); } catch (ActivityNotFoundException e) { Log.w("Recent", "Unable to launch recent task", e); } } break; } Loading Loading @@ -171,11 +177,11 @@ public class RecentApplicationsDialog extends Dialog implements OnClickListener final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); final List<ActivityManager.RecentTaskInfo> recentTasks = am.getRecentTasks(MAX_RECENT_TASKS, 0); am.getRecentTasks(MAX_RECENT_TASKS, ActivityManager.RECENT_IGNORE_UNAVAILABLE); ResolveInfo homeInfo = pm.resolveActivity( new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), 0); ActivityInfo homeInfo = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME) .resolveActivityInfo(pm, 0); IconUtilities iconUtilities = new IconUtilities(getContext()); Loading @@ -197,9 +203,9 @@ public class RecentApplicationsDialog extends Dialog implements OnClickListener // Skip the current home activity. if (homeInfo != null) { if (homeInfo.activityInfo.packageName.equals( if (homeInfo.packageName.equals( intent.getComponent().getPackageName()) && homeInfo.activityInfo.name.equals( && homeInfo.name.equals( intent.getComponent().getClassName())) { continue; } Loading Loading
policy/com/android/internal/policy/impl/PhoneWindowManager.java +86 −65 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mSystemReady; boolean mLidOpen; int mUiMode = Configuration.UI_MODE_TYPE_NORMAL; int mDockMode = Intent.EXTRA_DOCK_STATE_UNDOCKED; int mLidOpenRotation; int mCarDockRotation; int mDeskDockRotation; Loading Loading @@ -340,8 +341,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } // We're in a dock that has a rotation affinity, an the app is willing to rotate. if ((mCarDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_CAR) || (mDeskDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_DESK)) { if ((mCarDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_CAR) || (mDeskDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_DESK)) { // Note we override the nosensor flag here. if (appOrientation == ActivityInfo.SCREEN_ORIENTATION_USER || appOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED Loading @@ -364,8 +365,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { // orientation, then we need to turn the sensor or. return true; } if ((mCarDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_CAR) || (mDeskDockEnablesAccelerometer && mUiMode == Configuration.UI_MODE_TYPE_DESK)) { if ((mCarDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_CAR) || (mDeskDockEnablesAccelerometer && mDockMode == Intent.EXTRA_DOCK_STATE_DESK)) { // enable accelerometer if we are docked in a dock that enables accelerometer // orientation management, return true; Loading Loading @@ -526,7 +527,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { filter.addAction(UiModeManager.ACTION_EXIT_CAR_MODE); filter.addAction(UiModeManager.ACTION_ENTER_DESK_MODE); filter.addAction(UiModeManager.ACTION_EXIT_DESK_MODE); context.registerReceiver(mDockReceiver, filter); filter.addAction(Intent.ACTION_DOCK_EVENT); Intent intent = context.registerReceiver(mDockReceiver, filter); if (intent != null) { // Retrieve current sticky dock event broadcast. mDockMode = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED); } mVibrator = new Vibrator(); mLongPressVibePattern = getLongIntArray(mContext.getResources(), com.android.internal.R.array.config_longPressVibePattern); Loading Loading @@ -829,6 +836,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { return null; } try { Context context = mContext; boolean setTheme = false; //Log.i(TAG, "addStartingWindow " + packageName + ": nonLocalizedLabel=" Loading Loading @@ -881,7 +889,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { com.android.internal.R.styleable.Window_windowAnimationStyle, 0); params.setTitle("Starting " + packageName); try { WindowManagerImpl wm = (WindowManagerImpl) context.getSystemService(Context.WINDOW_SERVICE); View view = win.getDecorView(); Loading Loading @@ -909,6 +916,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } catch (WindowManagerImpl.BadTokenException e) { // ignore Log.w(TAG, appToken + " already running, starting window not displayed"); } catch (RuntimeException e) { // don't crash if something else bad happens, for example a // failure loading resources because we are loading from an app // on external storage that has been unmounted. Log.w(TAG, appToken + " failed creating starting window", e); } return null; Loading Loading @@ -1973,12 +1985,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { BroadcastReceiver mDockReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { if (Intent.ACTION_DOCK_EVENT.equals(intent.getAction())) { mDockMode = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_UNDOCKED); } else { try { IUiModeManager uiModeService = IUiModeManager.Stub.asInterface( ServiceManager.getService(Context.UI_MODE_SERVICE)); mUiMode = uiModeService.getCurrentModeType(); } catch (RemoteException e) { } } updateRotation(Surface.FLAGS_ORIENTATION_ANIMATION_DISABLE); updateOrientationListenerLp(); } Loading Loading @@ -2106,9 +2123,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { //or case.unspecified if (mLidOpen) { return mLidOpenRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_CAR && mCarDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) { return mCarDockRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK && mDeskDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_DESK && mDeskDockRotation >= 0) { return mDeskDockRotation; } else { if (useSensorForOrientationLp(orientation)) { Loading Loading @@ -2220,9 +2237,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { int rotation = Surface.ROTATION_0; if (mLidOpen) { rotation = mLidOpenRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_CAR && mCarDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) { rotation = mCarDockRotation; } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK && mDeskDockRotation >= 0) { } else if (mDockMode == Intent.EXTRA_DOCK_STATE_DESK && mDeskDockRotation >= 0) { rotation = mDeskDockRotation; } //if lid is closed orientation will be portrait Loading @@ -2242,6 +2259,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { */ Intent createHomeDockIntent() { Intent intent; // 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 // of whether we are actually in a car dock. if (mUiMode == Configuration.UI_MODE_TYPE_CAR) { intent = mCarDockIntent; } else if (mUiMode == Configuration.UI_MODE_TYPE_DESK) { Loading
policy/com/android/internal/policy/impl/RecentApplicationsDialog.java +14 −8 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.policy.impl; import android.app.ActivityManager; import android.app.Dialog; import android.app.StatusBarManager; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; Loading @@ -29,6 +30,7 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; Loading Loading @@ -117,7 +119,11 @@ public class RecentApplicationsDialog extends Dialog implements OnClickListener Intent intent = (Intent)b.getTag(); if (intent != null) { intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); try { getContext().startActivity(intent); } catch (ActivityNotFoundException e) { Log.w("Recent", "Unable to launch recent task", e); } } break; } Loading Loading @@ -171,11 +177,11 @@ public class RecentApplicationsDialog extends Dialog implements OnClickListener final ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); final List<ActivityManager.RecentTaskInfo> recentTasks = am.getRecentTasks(MAX_RECENT_TASKS, 0); am.getRecentTasks(MAX_RECENT_TASKS, ActivityManager.RECENT_IGNORE_UNAVAILABLE); ResolveInfo homeInfo = pm.resolveActivity( new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), 0); ActivityInfo homeInfo = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME) .resolveActivityInfo(pm, 0); IconUtilities iconUtilities = new IconUtilities(getContext()); Loading @@ -197,9 +203,9 @@ public class RecentApplicationsDialog extends Dialog implements OnClickListener // Skip the current home activity. if (homeInfo != null) { if (homeInfo.activityInfo.packageName.equals( if (homeInfo.packageName.equals( intent.getComponent().getPackageName()) && homeInfo.activityInfo.name.equals( && homeInfo.name.equals( intent.getComponent().getClassName())) { continue; } Loading