diff options
| -rw-r--r-- | services/core/java/com/android/server/policy/LegacyGlobalActions.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/policy/LegacyGlobalActions.java b/services/core/java/com/android/server/policy/LegacyGlobalActions.java index a71bc4cd37a1..14fabc593991 100644 --- a/services/core/java/com/android/server/policy/LegacyGlobalActions.java +++ b/services/core/java/com/android/server/policy/LegacyGlobalActions.java @@ -228,6 +228,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn R.string.global_actions_airplane_mode_on_status, R.string.global_actions_airplane_mode_off_status) { + @Override void onToggle(boolean on) { if (mHasTelephony && Boolean.parseBoolean( SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) { @@ -254,10 +255,12 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn } } + @Override public boolean showDuringKeyguard() { return true; } + @Override public boolean showBeforeProvisioning() { return false; } @@ -457,6 +460,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn return false; } + @Override public boolean showDuringKeyguard() { return true; } @@ -616,6 +620,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn com.android.internal.R.drawable.ic_menu_cc, icon, (user.name != null ? user.name : "Primary") + (isCurrentUser ? " \u2714" : "")) { + @Override public void onPress() { try { ActivityManager.getService().switchUser(user.id); @@ -624,10 +629,12 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn } } + @Override public boolean showDuringKeyguard() { return true; } + @Override public boolean showBeforeProvisioning() { return false; } @@ -659,6 +666,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn } /** {@inheritDoc} */ + @Override public void onDismiss(DialogInterface dialog) { if (mOnDismiss != null) { mOnDismiss.run(); @@ -674,6 +682,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn } /** {@inheritDoc} */ + @Override public void onClick(DialogInterface dialog, int which) { if (!(mAdapter.getItem(which) instanceof SilentModeTriStateAction)) { dialog.dismiss(); @@ -689,6 +698,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn */ private class MyAdapter extends BaseAdapter { + @Override public int getCount() { int count = 0; @@ -716,6 +726,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn return false; } + @Override public Action getItem(int position) { int filteredPos = 0; @@ -740,11 +751,12 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn + ", provisioned=" + mDeviceProvisioned); } - + @Override public long getItemId(int position) { return position; } + @Override public View getView(int position, View convertView, ViewGroup parent) { Action action = getItem(position); return action.create(mContext, convertView, parent, LayoutInflater.from(mContext)); @@ -817,6 +829,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn mIcon = icon; } + @Override public boolean isEnabled() { return true; } @@ -825,8 +838,10 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn return null; } + @Override abstract public void onPress(); + @Override public CharSequence getLabelForAccessibility(Context context) { if (mMessage != null) { return mMessage; @@ -835,6 +850,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn } } + @Override public View create( Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { View v = inflater.inflate(R.layout.global_actions_item, parent, false); @@ -929,6 +945,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn return context.getString(mMessageResId); } + @Override public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { willCreate(); @@ -963,6 +980,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn return v; } + @Override public final void onPress() { if (mState.inTransition()) { Log.w(TAG, "shouldn't be able to toggle when in transition"); @@ -974,6 +992,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn changeStateFromPress(nowOn); } + @Override public boolean isEnabled() { return !mState.inTransition(); } @@ -1004,6 +1023,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn R.string.global_action_silent_mode_off_status); } + @Override void onToggle(boolean on) { if (on) { mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT); @@ -1012,10 +1032,12 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn } } + @Override public boolean showDuringKeyguard() { return true; } + @Override public boolean showBeforeProvisioning() { return false; } @@ -1050,6 +1072,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn return null; } + @Override public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { View v = inflater.inflate(R.layout.global_actions_silent_mode, parent, false); @@ -1065,17 +1088,21 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn return v; } + @Override public void onPress() { } + @Override public boolean showDuringKeyguard() { return true; } + @Override public boolean showBeforeProvisioning() { return false; } + @Override public boolean isEnabled() { return true; } @@ -1083,6 +1110,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn void willCreate() { } + @Override public void onClick(View v) { if (!(v.getTag() instanceof Integer)) return; @@ -1093,6 +1121,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn } private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { + @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action) @@ -1146,6 +1175,7 @@ class LegacyGlobalActions implements DialogInterface.OnDismissListener, DialogIn private static final int DIALOG_DISMISS_DELAY = 300; // ms private Handler mHandler = new Handler() { + @Override public void handleMessage(Message msg) { switch (msg.what) { case MESSAGE_DISMISS: |