Loading core/res/res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1538,6 +1538,7 @@ --> <string-array translatable="false" name="config_globalActionsList"> <item>power</item> <item>bugreport</item> <item>users</item> </string-array> Loading policy/src/com/android/internal/policy/impl/GlobalActions.java +38 −45 Original line number Diff line number Diff line Loading @@ -185,7 +185,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac // If we only have 1 item and it's a simple press action, just do this action. if (mAdapter.getCount() == 1 && mAdapter.getItem(0) instanceof SinglePressAction) { && mAdapter.getItem(0) instanceof SinglePressAction && !(mAdapter.getItem(0) instanceof LongPressAction)) { ((SinglePressAction) mAdapter.getItem(0)).onPress(); } else { WindowManager.LayoutParams attrs = mDialog.getWindow().getAttributes(); Loading Loading @@ -262,7 +263,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac continue; } if (GLOBAL_ACTION_KEY_POWER.equals(actionKey)) { mItems.add(getPowerAction()); mItems.add(new PowerAction()); } else if (GLOBAL_ACTION_KEY_AIRPLANE.equals(actionKey)) { mItems.add(mAirplaneModeOn); } else if (GLOBAL_ACTION_KEY_BUGREPORT.equals(actionKey) Loading Loading @@ -300,7 +301,11 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { return mAdapter.getItem(position).onLongPress(); final Action action = mAdapter.getItem(position); if (action instanceof LongPressAction) { return ((LongPressAction) action).onLongPress(); } return false; } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); Loading @@ -310,29 +315,33 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return dialog; } private Action getPowerAction() { return new SinglePressAction( com.android.internal.R.drawable.ic_lock_power_off, R.string.global_action_power_off) { public void onPress() { // shutdown by making sure radio and power are handled accordingly. mWindowManagerFuncs.shutdown(true); private final class PowerAction extends SinglePressAction implements LongPressAction { private PowerAction() { super(com.android.internal.R.drawable.ic_lock_power_off, R.string.global_action_power_off); } @Override public boolean onLongPress() { mWindowManagerFuncs.rebootSafeMode(true); return true; } @Override public boolean showDuringKeyguard() { return true; } @Override public boolean showBeforeProvisioning() { return true; } }; @Override public void onPress() { // shutdown by making sure radio and power are handled accordingly. mWindowManagerFuncs.shutdown(false /* confirm */); } } private Action getBugReportAction() { Loading Loading @@ -367,10 +376,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac dialog.show(); } public boolean onLongPress() { return false; } public boolean showDuringKeyguard() { return true; } Loading @@ -392,11 +397,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mContext.startActivity(intent); } @Override public boolean onLongPress() { return false; } @Override public boolean showDuringKeyguard() { return true; Loading Loading @@ -583,8 +583,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac void onPress(); public boolean onLongPress(); /** * @return whether this action should appear in the dialog when the keygaurd * is showing. Loading @@ -600,6 +598,13 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac boolean isEnabled(); } /** * An action that also supports long press. */ private interface LongPressAction extends Action { boolean onLongPress(); } /** * A single press action maintains no state, just responds to a press * and takes an action. Loading Loading @@ -637,10 +642,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac abstract public void onPress(); public boolean onLongPress() { return false; } public View create( Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { View v = inflater.inflate(R.layout.global_actions_item, parent, false); Loading Loading @@ -769,10 +770,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac changeStateFromPress(nowOn); } public boolean onLongPress() { return false; } public boolean isEnabled() { return !mState.inTransition(); } Loading Loading @@ -862,10 +859,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac public void onPress() { } public boolean onLongPress() { return false; } public boolean showDuringKeyguard() { return true; } Loading Loading
core/res/res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1538,6 +1538,7 @@ --> <string-array translatable="false" name="config_globalActionsList"> <item>power</item> <item>bugreport</item> <item>users</item> </string-array> Loading
policy/src/com/android/internal/policy/impl/GlobalActions.java +38 −45 Original line number Diff line number Diff line Loading @@ -185,7 +185,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac // If we only have 1 item and it's a simple press action, just do this action. if (mAdapter.getCount() == 1 && mAdapter.getItem(0) instanceof SinglePressAction) { && mAdapter.getItem(0) instanceof SinglePressAction && !(mAdapter.getItem(0) instanceof LongPressAction)) { ((SinglePressAction) mAdapter.getItem(0)).onPress(); } else { WindowManager.LayoutParams attrs = mDialog.getWindow().getAttributes(); Loading Loading @@ -262,7 +263,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac continue; } if (GLOBAL_ACTION_KEY_POWER.equals(actionKey)) { mItems.add(getPowerAction()); mItems.add(new PowerAction()); } else if (GLOBAL_ACTION_KEY_AIRPLANE.equals(actionKey)) { mItems.add(mAirplaneModeOn); } else if (GLOBAL_ACTION_KEY_BUGREPORT.equals(actionKey) Loading Loading @@ -300,7 +301,11 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { return mAdapter.getItem(position).onLongPress(); final Action action = mAdapter.getItem(position); if (action instanceof LongPressAction) { return ((LongPressAction) action).onLongPress(); } return false; } }); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); Loading @@ -310,29 +315,33 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return dialog; } private Action getPowerAction() { return new SinglePressAction( com.android.internal.R.drawable.ic_lock_power_off, R.string.global_action_power_off) { public void onPress() { // shutdown by making sure radio and power are handled accordingly. mWindowManagerFuncs.shutdown(true); private final class PowerAction extends SinglePressAction implements LongPressAction { private PowerAction() { super(com.android.internal.R.drawable.ic_lock_power_off, R.string.global_action_power_off); } @Override public boolean onLongPress() { mWindowManagerFuncs.rebootSafeMode(true); return true; } @Override public boolean showDuringKeyguard() { return true; } @Override public boolean showBeforeProvisioning() { return true; } }; @Override public void onPress() { // shutdown by making sure radio and power are handled accordingly. mWindowManagerFuncs.shutdown(false /* confirm */); } } private Action getBugReportAction() { Loading Loading @@ -367,10 +376,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac dialog.show(); } public boolean onLongPress() { return false; } public boolean showDuringKeyguard() { return true; } Loading @@ -392,11 +397,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mContext.startActivity(intent); } @Override public boolean onLongPress() { return false; } @Override public boolean showDuringKeyguard() { return true; Loading Loading @@ -583,8 +583,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac void onPress(); public boolean onLongPress(); /** * @return whether this action should appear in the dialog when the keygaurd * is showing. Loading @@ -600,6 +598,13 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac boolean isEnabled(); } /** * An action that also supports long press. */ private interface LongPressAction extends Action { boolean onLongPress(); } /** * A single press action maintains no state, just responds to a press * and takes an action. Loading Loading @@ -637,10 +642,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac abstract public void onPress(); public boolean onLongPress() { return false; } public View create( Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { View v = inflater.inflate(R.layout.global_actions_item, parent, false); Loading Loading @@ -769,10 +770,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac changeStateFromPress(nowOn); } public boolean onLongPress() { return false; } public boolean isEnabled() { return !mState.inTransition(); } Loading Loading @@ -862,10 +859,6 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac public void onPress() { } public boolean onLongPress() { return false; } public boolean showDuringKeyguard() { return true; } Loading