Loading core/res/res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1571,6 +1571,7 @@ --> <string-array translatable="false" name="config_globalActionsList"> <item>power</item> <item>lockdown</item> <item>bugreport</item> <item>users</item> </string-array> Loading core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,9 @@ <!-- label for item that launches settings in phone options dialog [CHAR LIMIT=15]--> <string name="global_action_settings">Settings</string> <!-- label for item that locks the phone and enforces that it can't be unlocked without entering a credential. [CHAR LIMIT=15] --> <string name="global_action_lockdown">Lock now</string> <!-- Text to use when the number in a notification info is too large (greater than status_bar_notification_info_maxnum, defined in values/config.xml) and must be truncated. May need to be localized Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1425,6 +1425,7 @@ <java-symbol type="string" name="global_action_silent_mode_off_status" /> <java-symbol type="string" name="global_action_silent_mode_on_status" /> <java-symbol type="string" name="global_action_toggle_silent_mode" /> <java-symbol type="string" name="global_action_lockdown" /> <java-symbol type="string" name="invalidPuk" /> <java-symbol type="string" name="lockscreen_carrier_default" /> <java-symbol type="style" name="Animation.LockScreen" /> Loading policy/src/com/android/internal/policy/impl/GlobalActions.java +37 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.app.AlertController.AlertParams; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyProperties; import com.android.internal.R; import com.android.internal.widget.LockPatternUtils; import android.app.ActivityManagerNative; import android.app.AlertDialog; Loading Loading @@ -64,6 +65,8 @@ import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.WindowManagerInternal; import android.view.WindowManagerPolicy.WindowManagerFuncs; import android.widget.AdapterView; import android.widget.BaseAdapter; Loading Loading @@ -94,6 +97,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private static final String GLOBAL_ACTION_KEY_SILENT = "silent"; private static final String GLOBAL_ACTION_KEY_USERS = "users"; private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings"; private static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown"; private final Context mContext; private final WindowManagerFuncs mWindowManagerFuncs; Loading Loading @@ -279,6 +283,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac addUsersToMenu(mItems); } else if (GLOBAL_ACTION_KEY_SETTINGS.equals(actionKey)) { mItems.add(getSettingsAction()); } else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey) && hasTrustAgents()) { mItems.add(getLockdownAction()); } else { Log.e(TAG, "Invalid global action key " + actionKey); } Loading Loading @@ -317,6 +323,11 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return dialog; } private boolean hasTrustAgents() { // TODO: Add implementation. return true; } private final class PowerAction extends SinglePressAction implements LongPressAction { private PowerAction() { super(com.android.internal.R.drawable.ic_lock_power_off, Loading Loading @@ -419,6 +430,32 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }; } private Action getLockdownAction() { return new SinglePressAction(com.android.internal.R.drawable.ic_lock_lock, R.string.global_action_lockdown) { @Override public void onPress() { new LockPatternUtils(mContext).requireCredentialEntry(UserHandle.USER_ALL); try { WindowManagerGlobal.getWindowManagerService().lockNow(null); } catch (RemoteException e) { Log.e(TAG, "Error while trying to lock device.", e); } } @Override public boolean showDuringKeyguard() { return true; } @Override public boolean showBeforeProvisioning() { return false; } }; } private UserInfo getCurrentUser() { try { return ActivityManagerNative.getDefault().getCurrentUser(); Loading Loading
core/res/res/values/config.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1571,6 +1571,7 @@ --> <string-array translatable="false" name="config_globalActionsList"> <item>power</item> <item>lockdown</item> <item>bugreport</item> <item>users</item> </string-array> Loading
core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -443,6 +443,9 @@ <!-- label for item that launches settings in phone options dialog [CHAR LIMIT=15]--> <string name="global_action_settings">Settings</string> <!-- label for item that locks the phone and enforces that it can't be unlocked without entering a credential. [CHAR LIMIT=15] --> <string name="global_action_lockdown">Lock now</string> <!-- Text to use when the number in a notification info is too large (greater than status_bar_notification_info_maxnum, defined in values/config.xml) and must be truncated. May need to be localized Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1425,6 +1425,7 @@ <java-symbol type="string" name="global_action_silent_mode_off_status" /> <java-symbol type="string" name="global_action_silent_mode_on_status" /> <java-symbol type="string" name="global_action_toggle_silent_mode" /> <java-symbol type="string" name="global_action_lockdown" /> <java-symbol type="string" name="invalidPuk" /> <java-symbol type="string" name="lockscreen_carrier_default" /> <java-symbol type="style" name="Animation.LockScreen" /> Loading
policy/src/com/android/internal/policy/impl/GlobalActions.java +37 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import com.android.internal.app.AlertController.AlertParams; import com.android.internal.telephony.TelephonyIntents; import com.android.internal.telephony.TelephonyProperties; import com.android.internal.R; import com.android.internal.widget.LockPatternUtils; import android.app.ActivityManagerNative; import android.app.AlertDialog; Loading Loading @@ -64,6 +65,8 @@ import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.view.WindowManagerInternal; import android.view.WindowManagerPolicy.WindowManagerFuncs; import android.widget.AdapterView; import android.widget.BaseAdapter; Loading Loading @@ -94,6 +97,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private static final String GLOBAL_ACTION_KEY_SILENT = "silent"; private static final String GLOBAL_ACTION_KEY_USERS = "users"; private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings"; private static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown"; private final Context mContext; private final WindowManagerFuncs mWindowManagerFuncs; Loading Loading @@ -279,6 +283,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac addUsersToMenu(mItems); } else if (GLOBAL_ACTION_KEY_SETTINGS.equals(actionKey)) { mItems.add(getSettingsAction()); } else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey) && hasTrustAgents()) { mItems.add(getLockdownAction()); } else { Log.e(TAG, "Invalid global action key " + actionKey); } Loading Loading @@ -317,6 +323,11 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac return dialog; } private boolean hasTrustAgents() { // TODO: Add implementation. return true; } private final class PowerAction extends SinglePressAction implements LongPressAction { private PowerAction() { super(com.android.internal.R.drawable.ic_lock_power_off, Loading Loading @@ -419,6 +430,32 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }; } private Action getLockdownAction() { return new SinglePressAction(com.android.internal.R.drawable.ic_lock_lock, R.string.global_action_lockdown) { @Override public void onPress() { new LockPatternUtils(mContext).requireCredentialEntry(UserHandle.USER_ALL); try { WindowManagerGlobal.getWindowManagerService().lockNow(null); } catch (RemoteException e) { Log.e(TAG, "Error while trying to lock device.", e); } } @Override public boolean showDuringKeyguard() { return true; } @Override public boolean showBeforeProvisioning() { return false; } }; } private UserInfo getCurrentUser() { try { return ActivityManagerNative.getDefault().getCurrentUser(); Loading