Loading policy/src/com/android/internal/policy/impl/GlobalActions.java +34 −27 Original line number Diff line number Diff line Loading @@ -286,6 +286,39 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mItems.add(mSilentModeAction); } // one more thing: optionally add a list of users to switch to if (SystemProperties.getBoolean("fw.power_user_switcher", false)) { addUsersToMenu(mItems); } mAdapter = new MyAdapter(); AlertParams params = new AlertParams(mContext); params.mAdapter = mAdapter; params.mOnClickListener = this; params.mForceInverseBackground = true; GlobalActionsDialog dialog = new GlobalActionsDialog(mContext, params); dialog.setCanceledOnTouchOutside(false); // Handled by the custom class. dialog.getListView().setItemsCanFocus(true); dialog.getListView().setLongClickable(true); dialog.getListView().setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { return mAdapter.getItem(position).onLongPress(); } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); dialog.setOnDismissListener(this); return dialog; } private void addUsersToMenu(ArrayList<Action> items) { List<UserInfo> users = ((UserManager) mContext.getSystemService(Context.USER_SERVICE)) .getUsers(); if (users.size() > 1) { Loading Loading @@ -320,35 +353,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return false; } }; mItems.add(switchToUser); items.add(switchToUser); } } mAdapter = new MyAdapter(); AlertParams params = new AlertParams(mContext); params.mAdapter = mAdapter; params.mOnClickListener = this; params.mForceInverseBackground = true; GlobalActionsDialog dialog = new GlobalActionsDialog(mContext, params); dialog.setCanceledOnTouchOutside(false); // Handled by the custom class. dialog.getListView().setItemsCanFocus(true); dialog.getListView().setLongClickable(true); dialog.getListView().setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { return mAdapter.getItem(position).onLongPress(); } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); dialog.setOnDismissListener(this); return dialog; } private void prepareDialog() { Loading services/java/com/android/server/am/ActivityManagerService.java +1 −0 Original line number Diff line number Diff line Loading @@ -14057,6 +14057,7 @@ public final class ActivityManagerService extends ActivityManagerNative return false; } mWindowManager.lockNow(); mWindowManager.startFreezingScreen(R.anim.screen_user_exit, R.anim.screen_user_enter); Loading
policy/src/com/android/internal/policy/impl/GlobalActions.java +34 −27 Original line number Diff line number Diff line Loading @@ -286,6 +286,39 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mItems.add(mSilentModeAction); } // one more thing: optionally add a list of users to switch to if (SystemProperties.getBoolean("fw.power_user_switcher", false)) { addUsersToMenu(mItems); } mAdapter = new MyAdapter(); AlertParams params = new AlertParams(mContext); params.mAdapter = mAdapter; params.mOnClickListener = this; params.mForceInverseBackground = true; GlobalActionsDialog dialog = new GlobalActionsDialog(mContext, params); dialog.setCanceledOnTouchOutside(false); // Handled by the custom class. dialog.getListView().setItemsCanFocus(true); dialog.getListView().setLongClickable(true); dialog.getListView().setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { return mAdapter.getItem(position).onLongPress(); } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); dialog.setOnDismissListener(this); return dialog; } private void addUsersToMenu(ArrayList<Action> items) { List<UserInfo> users = ((UserManager) mContext.getSystemService(Context.USER_SERVICE)) .getUsers(); if (users.size() > 1) { Loading Loading @@ -320,35 +353,9 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return false; } }; mItems.add(switchToUser); items.add(switchToUser); } } mAdapter = new MyAdapter(); AlertParams params = new AlertParams(mContext); params.mAdapter = mAdapter; params.mOnClickListener = this; params.mForceInverseBackground = true; GlobalActionsDialog dialog = new GlobalActionsDialog(mContext, params); dialog.setCanceledOnTouchOutside(false); // Handled by the custom class. dialog.getListView().setItemsCanFocus(true); dialog.getListView().setLongClickable(true); dialog.getListView().setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { return mAdapter.getItem(position).onLongPress(); } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG); dialog.setOnDismissListener(this); return dialog; } private void prepareDialog() { Loading
services/java/com/android/server/am/ActivityManagerService.java +1 −0 Original line number Diff line number Diff line Loading @@ -14057,6 +14057,7 @@ public final class ActivityManagerService extends ActivityManagerNative return false; } mWindowManager.lockNow(); mWindowManager.startFreezingScreen(R.anim.screen_user_exit, R.anim.screen_user_enter);