|
19 | 19 | import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; |
20 | 20 | import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_GLOBAL_ACTIONS; |
21 | 21 | import static android.view.WindowManager.TAKE_SCREENSHOT_FULLSCREEN; |
| 22 | +import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON; |
22 | 23 |
|
23 | 24 | import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST; |
24 | 25 | import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED; |
@@ -547,7 +548,7 @@ protected boolean shouldShowAction(Action action) { |
547 | 548 | if (!mDeviceProvisioned && !action.showBeforeProvisioning()) { |
548 | 549 | return false; |
549 | 550 | } |
550 | | - return true; |
| 551 | + return action.shouldShow(); |
551 | 552 | } |
552 | 553 |
|
553 | 554 | /** |
@@ -962,6 +963,8 @@ public void onPress() { |
962 | 963 |
|
963 | 964 | @VisibleForTesting |
964 | 965 | class ScreenshotAction extends SinglePressAction implements LongPressAction { |
| 966 | + final String KEY_SYSTEM_NAV_2BUTTONS = "system_nav_2buttons"; |
| 967 | + |
965 | 968 | public ScreenshotAction() { |
966 | 969 | super(R.drawable.ic_screenshot, R.string.global_action_screenshot); |
967 | 970 | } |
@@ -993,6 +996,19 @@ public boolean showBeforeProvisioning() { |
993 | 996 | return false; |
994 | 997 | } |
995 | 998 |
|
| 999 | + @Override |
| 1000 | + public boolean shouldShow() { |
| 1001 | + // Include screenshot in power menu for legacy nav because it is not accessible |
| 1002 | + // through Recents in that mode |
| 1003 | + return is2ButtonNavigationEnabled(); |
| 1004 | + } |
| 1005 | + |
| 1006 | + boolean is2ButtonNavigationEnabled() { |
| 1007 | + return NAV_BAR_MODE_2BUTTON == mContext.getResources().getInteger( |
| 1008 | + com.android.internal.R.integer.config_navBarInteractionMode); |
| 1009 | + } |
| 1010 | + |
| 1011 | + |
996 | 1012 | @Override |
997 | 1013 | public boolean onLongPress() { |
998 | 1014 | if (FeatureFlagUtils.isEnabled(mContext, FeatureFlagUtils.SCREENRECORD_LONG_PRESS)) { |
@@ -1616,6 +1632,10 @@ default boolean shouldBeSeparated() { |
1616 | 1632 | * @return |
1617 | 1633 | */ |
1618 | 1634 | CharSequence getMessage(); |
| 1635 | + |
| 1636 | + default boolean shouldShow() { |
| 1637 | + return true; |
| 1638 | + } |
1619 | 1639 | } |
1620 | 1640 |
|
1621 | 1641 | /** |
|
0 commit comments