Merge "Show lock message in Global Actions" into rvc-dev am: 315edf11f8
Change-Id: If79ec8a9f8bf11f2283e34d9606b1e21b6a5bb60
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/global_actions_container"
|
android:id="@+id/global_actions_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@@ -43,39 +44,50 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.android.systemui.globalactions.GlobalActionsFlatLayout>
|
</com.android.systemui.globalactions.GlobalActionsFlatLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/global_actions_lock_message_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:visibility="gone">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/global_actions_lock_message"
|
||||||
|
style="@style/TextAppearance.Control.Title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="@dimen/global_actions_side_margin"
|
||||||
|
android:drawablePadding="12dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/global_action_lock_message"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.35"/>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<com.android.systemui.globalactions.MinHeightScrollView
|
<com.android.systemui.globalactions.MinHeightScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:scrollbars="none"
|
android:scrollbars="none">
|
||||||
>
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/global_actions_grid_root"
|
android:id="@+id/global_actions_grid_root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false">
|
||||||
>
|
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
android:id="@+id/global_actions_panel"
|
android:id="@+id/global_actions_wallet"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"/>
|
||||||
android:orientation="vertical"
|
|
||||||
>
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/global_actions_panel_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/global_actions_controls"
|
android:id="@+id/global_actions_controls"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"/>
|
||||||
/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</com.android.systemui.globalactions.MinHeightScrollView>
|
</com.android.systemui.globalactions.MinHeightScrollView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -1028,6 +1028,9 @@
|
|||||||
<!-- Amount to shift the layout when exiting/entering for controls activities -->
|
<!-- Amount to shift the layout when exiting/entering for controls activities -->
|
||||||
<dimen name="global_actions_controls_y_translation">20dp</dimen>
|
<dimen name="global_actions_controls_y_translation">20dp</dimen>
|
||||||
|
|
||||||
|
<!-- Shift quick access wallet down in Global Actions when Controls are unavailable -->
|
||||||
|
<dimen name="global_actions_wallet_top_margin">40dp</dimen>
|
||||||
|
|
||||||
<!-- The maximum offset in either direction that elements are moved horizontally to prevent
|
<!-- The maximum offset in either direction that elements are moved horizontally to prevent
|
||||||
burn-in on AOD. -->
|
burn-in on AOD. -->
|
||||||
<dimen name="burn_in_prevention_offset_x">8dp</dimen>
|
<dimen name="burn_in_prevention_offset_x">8dp</dimen>
|
||||||
|
|||||||
@@ -212,6 +212,13 @@
|
|||||||
<!-- Power menu item for taking a screenshot [CHAR LIMIT=20]-->
|
<!-- Power menu item for taking a screenshot [CHAR LIMIT=20]-->
|
||||||
<string name="global_action_screenshot">Screenshot</string>
|
<string name="global_action_screenshot">Screenshot</string>
|
||||||
|
|
||||||
|
<!-- Text shown when viewing global actions while phone is locked and additional controls are hidden [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="global_action_lock_message" product="default">Unlock your phone for more options</string>
|
||||||
|
<!-- Text shown when viewing global actions while phone is locked and additional controls are hidden [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="global_action_lock_message" product="tablet">Unlock your tablet for more options</string>
|
||||||
|
<!-- Text shown when viewing global actions while phone is locked and additional controls are hidden [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="global_action_lock_message" product="device">Unlock your device for more options</string>
|
||||||
|
|
||||||
<!-- text to show in place of RemoteInput images when they cannot be shown.
|
<!-- text to show in place of RemoteInput images when they cannot be shown.
|
||||||
[CHAR LIMIT=50] -->
|
[CHAR LIMIT=50] -->
|
||||||
<string name="remote_input_image_insertion_text">sent an image</string>
|
<string name="remote_input_image_insertion_text">sent an image</string>
|
||||||
|
|||||||
@@ -129,11 +129,8 @@ import com.android.systemui.model.SysUiState;
|
|||||||
import com.android.systemui.plugins.ActivityStarter;
|
import com.android.systemui.plugins.ActivityStarter;
|
||||||
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
|
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
|
||||||
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
|
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
|
||||||
import com.android.systemui.shared.system.QuickStepContract;
|
|
||||||
import com.android.systemui.statusbar.BlurUtils;
|
|
||||||
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
||||||
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
|
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
|
||||||
import com.android.systemui.statusbar.phone.ScrimController;
|
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
import com.android.systemui.util.EmergencyDialerConstants;
|
import com.android.systemui.util.EmergencyDialerConstants;
|
||||||
@@ -167,19 +164,19 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
/* Valid settings for global actions keys.
|
/* Valid settings for global actions keys.
|
||||||
* see config.xml config_globalActionList */
|
* see config.xml config_globalActionList */
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected static final String GLOBAL_ACTION_KEY_POWER = "power";
|
static final String GLOBAL_ACTION_KEY_POWER = "power";
|
||||||
protected static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane";
|
private static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane";
|
||||||
protected static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport";
|
private static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport";
|
||||||
protected static final String GLOBAL_ACTION_KEY_SILENT = "silent";
|
private static final String GLOBAL_ACTION_KEY_SILENT = "silent";
|
||||||
protected static final String GLOBAL_ACTION_KEY_USERS = "users";
|
private static final String GLOBAL_ACTION_KEY_USERS = "users";
|
||||||
protected static final String GLOBAL_ACTION_KEY_SETTINGS = "settings";
|
private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings";
|
||||||
protected static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown";
|
private static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown";
|
||||||
protected static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist";
|
private static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist";
|
||||||
protected static final String GLOBAL_ACTION_KEY_ASSIST = "assist";
|
private static final String GLOBAL_ACTION_KEY_ASSIST = "assist";
|
||||||
protected static final String GLOBAL_ACTION_KEY_RESTART = "restart";
|
static final String GLOBAL_ACTION_KEY_RESTART = "restart";
|
||||||
protected static final String GLOBAL_ACTION_KEY_LOGOUT = "logout";
|
private static final String GLOBAL_ACTION_KEY_LOGOUT = "logout";
|
||||||
protected static final String GLOBAL_ACTION_KEY_EMERGENCY = "emergency";
|
static final String GLOBAL_ACTION_KEY_EMERGENCY = "emergency";
|
||||||
protected static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot";
|
static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot";
|
||||||
|
|
||||||
private static final String PREFS_CONTROLS_SEEDING_COMPLETED = "ControlsSeedingCompleted";
|
private static final String PREFS_CONTROLS_SEEDING_COMPLETED = "ControlsSeedingCompleted";
|
||||||
private static final String PREFS_CONTROLS_FILE = "controls_prefs";
|
private static final String PREFS_CONTROLS_FILE = "controls_prefs";
|
||||||
@@ -202,7 +199,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
private final MetricsLogger mMetricsLogger;
|
private final MetricsLogger mMetricsLogger;
|
||||||
private final UiEventLogger mUiEventLogger;
|
private final UiEventLogger mUiEventLogger;
|
||||||
private final NotificationShadeDepthController mDepthController;
|
private final NotificationShadeDepthController mDepthController;
|
||||||
private final BlurUtils mBlurUtils;
|
|
||||||
private final SysUiState mSysUiState;
|
private final SysUiState mSysUiState;
|
||||||
|
|
||||||
// Used for RingerModeTracker
|
// Used for RingerModeTracker
|
||||||
@@ -211,7 +207,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected final ArrayList<Action> mItems = new ArrayList<>();
|
protected final ArrayList<Action> mItems = new ArrayList<>();
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected final ArrayList<Action> mOverflowItems = new ArrayList<>();
|
final ArrayList<Action> mOverflowItems = new ArrayList<>();
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected ActionsDialog mDialog;
|
protected ActionsDialog mDialog;
|
||||||
@@ -236,18 +232,18 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
private final SysuiColorExtractor mSysuiColorExtractor;
|
private final SysuiColorExtractor mSysuiColorExtractor;
|
||||||
private final IStatusBarService mStatusBarService;
|
private final IStatusBarService mStatusBarService;
|
||||||
private final NotificationShadeWindowController mNotificationShadeWindowController;
|
private final NotificationShadeWindowController mNotificationShadeWindowController;
|
||||||
private GlobalActionsPanelPlugin mPanelPlugin;
|
private GlobalActionsPanelPlugin mWalletPlugin;
|
||||||
private ControlsUiController mControlsUiController;
|
private ControlsUiController mControlsUiController;
|
||||||
private final IWindowManager mIWindowManager;
|
private final IWindowManager mIWindowManager;
|
||||||
private final Executor mBackgroundExecutor;
|
private final Executor mBackgroundExecutor;
|
||||||
private final ControlsListingController mControlsListingController;
|
|
||||||
private List<ControlsServiceInfo> mControlsServiceInfos = new ArrayList<>();
|
private List<ControlsServiceInfo> mControlsServiceInfos = new ArrayList<>();
|
||||||
private ControlsController mControlsController;
|
private ControlsController mControlsController;
|
||||||
private SharedPreferences mControlsPreferences;
|
private SharedPreferences mControlsPreferences;
|
||||||
private final RingerModeTracker mRingerModeTracker;
|
private final RingerModeTracker mRingerModeTracker;
|
||||||
private int mDialogPressDelay = DIALOG_PRESS_DELAY; // ms
|
private int mDialogPressDelay = DIALOG_PRESS_DELAY; // ms
|
||||||
private Handler mMainHandler;
|
private Handler mMainHandler;
|
||||||
private boolean mShowLockScreenCardsAndControls = false;
|
@VisibleForTesting
|
||||||
|
boolean mShowLockScreenCardsAndControls = false;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public enum GlobalActionsEvent implements UiEventLogger.UiEventEnum {
|
public enum GlobalActionsEvent implements UiEventLogger.UiEventEnum {
|
||||||
@@ -299,7 +295,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
TrustManager trustManager, IActivityManager iActivityManager,
|
TrustManager trustManager, IActivityManager iActivityManager,
|
||||||
@Nullable TelecomManager telecomManager, MetricsLogger metricsLogger,
|
@Nullable TelecomManager telecomManager, MetricsLogger metricsLogger,
|
||||||
NotificationShadeDepthController depthController, SysuiColorExtractor colorExtractor,
|
NotificationShadeDepthController depthController, SysuiColorExtractor colorExtractor,
|
||||||
IStatusBarService statusBarService, BlurUtils blurUtils,
|
IStatusBarService statusBarService,
|
||||||
NotificationShadeWindowController notificationShadeWindowController,
|
NotificationShadeWindowController notificationShadeWindowController,
|
||||||
ControlsUiController controlsUiController, IWindowManager iWindowManager,
|
ControlsUiController controlsUiController, IWindowManager iWindowManager,
|
||||||
@Background Executor backgroundExecutor,
|
@Background Executor backgroundExecutor,
|
||||||
@@ -330,8 +326,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
mControlsUiController = controlsUiController;
|
mControlsUiController = controlsUiController;
|
||||||
mIWindowManager = iWindowManager;
|
mIWindowManager = iWindowManager;
|
||||||
mBackgroundExecutor = backgroundExecutor;
|
mBackgroundExecutor = backgroundExecutor;
|
||||||
mControlsListingController = controlsListingController;
|
|
||||||
mBlurUtils = blurUtils;
|
|
||||||
mRingerModeTracker = ringerModeTracker;
|
mRingerModeTracker = ringerModeTracker;
|
||||||
mControlsController = controlsController;
|
mControlsController = controlsController;
|
||||||
mSysUiState = sysUiState;
|
mSysUiState = sysUiState;
|
||||||
@@ -372,20 +366,21 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
@Override
|
@Override
|
||||||
public void onUnlockedChanged() {
|
public void onUnlockedChanged() {
|
||||||
if (mDialog != null) {
|
if (mDialog != null) {
|
||||||
if (mDialog.mPanelController != null) {
|
boolean unlocked = mKeyguardStateController.isUnlocked();
|
||||||
mDialog.mPanelController.onDeviceLockStateChanged(
|
if (mDialog.mWalletViewController != null) {
|
||||||
!mKeyguardStateController.isUnlocked());
|
mDialog.mWalletViewController.onDeviceLockStateChanged(!unlocked);
|
||||||
}
|
}
|
||||||
if (!mDialog.isShowingControls() && shouldShowControls()) {
|
if (!mDialog.isShowingControls() && shouldShowControls()) {
|
||||||
mDialog.showControls(mControlsUiController);
|
mDialog.showControls(mControlsUiController);
|
||||||
}
|
}
|
||||||
|
if (unlocked) {
|
||||||
|
mDialog.hideLockMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mControlsListingController.addCallback(list -> {
|
controlsListingController.addCallback(list -> mControlsServiceInfos = list);
|
||||||
mControlsServiceInfos = list;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Need to be user-specific with the context to make sure we read the correct prefs
|
// Need to be user-specific with the context to make sure we read the correct prefs
|
||||||
Context userContext = context.createContextAsUser(
|
Context userContext = context.createContextAsUser(
|
||||||
@@ -450,10 +445,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
* @param keyguardShowing True if keyguard is showing
|
* @param keyguardShowing True if keyguard is showing
|
||||||
*/
|
*/
|
||||||
public void showOrHideDialog(boolean keyguardShowing, boolean isDeviceProvisioned,
|
public void showOrHideDialog(boolean keyguardShowing, boolean isDeviceProvisioned,
|
||||||
GlobalActionsPanelPlugin panelPlugin) {
|
GlobalActionsPanelPlugin walletPlugin) {
|
||||||
mKeyguardShowing = keyguardShowing;
|
mKeyguardShowing = keyguardShowing;
|
||||||
mDeviceProvisioned = isDeviceProvisioned;
|
mDeviceProvisioned = isDeviceProvisioned;
|
||||||
mPanelPlugin = panelPlugin;
|
mWalletPlugin = walletPlugin;
|
||||||
if (mDialog != null && mDialog.isShowing()) {
|
if (mDialog != null && mDialog.isShowing()) {
|
||||||
// In order to force global actions to hide on the same affordance press, we must
|
// In order to force global actions to hide on the same affordance press, we must
|
||||||
// register a call to onGlobalActionsShown() first to prevent the default actions
|
// register a call to onGlobalActionsShown() first to prevent the default actions
|
||||||
@@ -520,11 +515,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected int getMaxShownPowerItems() {
|
protected int getMaxShownPowerItems() {
|
||||||
if (shouldUseControlsLayout()) {
|
return mResources.getInteger(com.android.systemui.R.integer.power_menu_max_columns);
|
||||||
return mResources.getInteger(com.android.systemui.R.integer.power_menu_max_columns);
|
|
||||||
} else {
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -593,9 +584,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
} else if (GLOBAL_ACTION_KEY_SETTINGS.equals(actionKey)) {
|
} else if (GLOBAL_ACTION_KEY_SETTINGS.equals(actionKey)) {
|
||||||
addActionItem(getSettingsAction());
|
addActionItem(getSettingsAction());
|
||||||
} else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey)) {
|
} else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey)) {
|
||||||
|
int userId = getCurrentUser().id;
|
||||||
if (Settings.Secure.getIntForUser(mContentResolver,
|
if (Settings.Secure.getIntForUser(mContentResolver,
|
||||||
Settings.Secure.LOCKDOWN_IN_POWER_MENU, 0, getCurrentUser().id) != 0
|
Settings.Secure.LOCKDOWN_IN_POWER_MENU, 0, userId) != 0
|
||||||
&& shouldDisplayLockdown()) {
|
&& shouldDisplayLockdown(userId)) {
|
||||||
addActionItem(getLockdownAction());
|
addActionItem(getLockdownAction());
|
||||||
}
|
}
|
||||||
} else if (GLOBAL_ACTION_KEY_VOICEASSIST.equals(actionKey)) {
|
} else if (GLOBAL_ACTION_KEY_VOICEASSIST.equals(actionKey)) {
|
||||||
@@ -639,12 +631,19 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
mAdapter = new MyAdapter();
|
mAdapter = new MyAdapter();
|
||||||
mOverflowAdapter = new MyOverflowAdapter();
|
mOverflowAdapter = new MyOverflowAdapter();
|
||||||
|
|
||||||
mDepthController.setShowingHomeControls(shouldUseControlsLayout());
|
mDepthController.setShowingHomeControls(true);
|
||||||
|
GlobalActionsPanelPlugin.PanelViewController walletViewController =
|
||||||
|
getWalletViewController();
|
||||||
ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, mOverflowAdapter,
|
ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, mOverflowAdapter,
|
||||||
getWalletPanelViewController(), mDepthController, mSysuiColorExtractor,
|
walletViewController, mDepthController, mSysuiColorExtractor,
|
||||||
mStatusBarService, mNotificationShadeWindowController,
|
mStatusBarService, mNotificationShadeWindowController,
|
||||||
shouldShowControls() ? mControlsUiController : null, mBlurUtils, mSysUiState,
|
controlsAvailable(), shouldShowControls() ? mControlsUiController : null,
|
||||||
shouldUseControlsLayout(), this::onRotate, mKeyguardShowing);
|
mSysUiState, this::onRotate, mKeyguardShowing);
|
||||||
|
boolean walletViewAvailable = walletViewController != null
|
||||||
|
&& walletViewController.getPanelContent() != null;
|
||||||
|
if (shouldShowLockMessage(walletViewAvailable)) {
|
||||||
|
dialog.showLockMessage();
|
||||||
|
}
|
||||||
dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
|
dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
|
||||||
dialog.setOnDismissListener(this);
|
dialog.setOnDismissListener(this);
|
||||||
dialog.setOnShowListener(this);
|
dialog.setOnShowListener(this);
|
||||||
@@ -652,13 +651,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldDisplayLockdown() {
|
private boolean shouldDisplayLockdown(int userId) {
|
||||||
// Lockdown is meaningless without a place to go.
|
// Lockdown is meaningless without a place to go.
|
||||||
if (!mKeyguardStateController.isMethodSecure()) {
|
if (!mKeyguardStateController.isMethodSecure()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int userId = getCurrentUser().id;
|
|
||||||
// Only show the lockdown button if the device isn't locked down (for whatever reason).
|
// Only show the lockdown button if the device isn't locked down (for whatever reason).
|
||||||
int state = mLockPatternUtils.getStrongAuthForUser(userId);
|
int state = mLockPatternUtils.getStrongAuthForUser(userId);
|
||||||
return (state == STRONG_AUTH_NOT_REQUIRED
|
return (state == STRONG_AUTH_NOT_REQUIRED
|
||||||
@@ -678,11 +676,11 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private GlobalActionsPanelPlugin.PanelViewController getWalletPanelViewController() {
|
private GlobalActionsPanelPlugin.PanelViewController getWalletViewController() {
|
||||||
if (mPanelPlugin == null) {
|
if (mWalletPlugin == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return mPanelPlugin.onPanelShown(this, !mKeyguardStateController.isUnlocked());
|
return mWalletPlugin.onPanelShown(this, !mKeyguardStateController.isUnlocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -743,7 +741,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBeSeparated() {
|
public boolean shouldBeSeparated() {
|
||||||
return !shouldUseControlsLayout();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -751,18 +749,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
Context context, View convertView, ViewGroup parent, LayoutInflater inflater) {
|
Context context, View convertView, ViewGroup parent, LayoutInflater inflater) {
|
||||||
View v = super.create(context, convertView, parent, inflater);
|
View v = super.create(context, convertView, parent, inflater);
|
||||||
int textColor;
|
int textColor;
|
||||||
if (shouldUseControlsLayout()) {
|
v.setBackgroundTintList(ColorStateList.valueOf(v.getResources().getColor(
|
||||||
v.setBackgroundTintList(ColorStateList.valueOf(v.getResources().getColor(
|
com.android.systemui.R.color.global_actions_emergency_background)));
|
||||||
com.android.systemui.R.color.global_actions_emergency_background)));
|
textColor = v.getResources().getColor(
|
||||||
textColor = v.getResources().getColor(
|
com.android.systemui.R.color.global_actions_emergency_text);
|
||||||
com.android.systemui.R.color.global_actions_emergency_text);
|
|
||||||
} else if (shouldBeSeparated()) {
|
|
||||||
textColor = v.getResources().getColor(
|
|
||||||
com.android.systemui.R.color.global_actions_alert_text);
|
|
||||||
} else {
|
|
||||||
textColor = v.getResources().getColor(
|
|
||||||
com.android.systemui.R.color.global_actions_text);
|
|
||||||
}
|
|
||||||
TextView messageView = v.findViewById(R.id.message);
|
TextView messageView = v.findViewById(R.id.message);
|
||||||
messageView.setTextColor(textColor);
|
messageView.setTextColor(textColor);
|
||||||
messageView.setSelected(true); // necessary for marquee to work
|
messageView.setSelected(true); // necessary for marquee to work
|
||||||
@@ -1192,13 +1182,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
mUiEventLogger.log(GlobalActionsEvent.GA_POWER_MENU_OPEN);
|
mUiEventLogger.log(GlobalActionsEvent.GA_POWER_MENU_OPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getActionLayoutId() {
|
|
||||||
if (shouldUseControlsLayout()) {
|
|
||||||
return com.android.systemui.R.layout.global_actions_grid_item_v2;
|
|
||||||
}
|
|
||||||
return com.android.systemui.R.layout.global_actions_grid_item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The adapter used for power menu items shown in the global actions dialog.
|
* The adapter used for power menu items shown in the global actions dialog.
|
||||||
*/
|
*/
|
||||||
@@ -1492,7 +1475,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
|
|
||||||
public View create(
|
public View create(
|
||||||
Context context, View convertView, ViewGroup parent, LayoutInflater inflater) {
|
Context context, View convertView, ViewGroup parent, LayoutInflater inflater) {
|
||||||
View v = inflater.inflate(getActionLayoutId(), parent, false /* attach */);
|
View v = inflater.inflate(com.android.systemui.R.layout.global_actions_grid_item_v2,
|
||||||
|
parent, false /* attach */);
|
||||||
|
|
||||||
ImageView icon = v.findViewById(R.id.icon);
|
ImageView icon = v.findViewById(R.id.icon);
|
||||||
TextView messageView = v.findViewById(R.id.message);
|
TextView messageView = v.findViewById(R.id.message);
|
||||||
@@ -1598,7 +1582,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
LayoutInflater inflater) {
|
LayoutInflater inflater) {
|
||||||
willCreate();
|
willCreate();
|
||||||
|
|
||||||
View v = inflater.inflate(getActionLayoutId(), parent, false /* attach */);
|
View v = inflater.inflate(com.android.systemui.R.layout.global_actions_grid_item_v2,
|
||||||
|
parent, false /* attach */);
|
||||||
|
|
||||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||||
TextView messageView = (TextView) v.findViewById(R.id.message);
|
TextView messageView = (TextView) v.findViewById(R.id.message);
|
||||||
@@ -1905,7 +1890,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
return mLifecycle;
|
return mLifecycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class ActionsDialog extends Dialog implements DialogInterface,
|
@VisibleForTesting
|
||||||
|
static final class ActionsDialog extends Dialog implements DialogInterface,
|
||||||
ColorExtractor.OnColorsChangedListener {
|
ColorExtractor.OnColorsChangedListener {
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@@ -1916,7 +1902,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
private MultiListLayout mGlobalActionsLayout;
|
private MultiListLayout mGlobalActionsLayout;
|
||||||
private Drawable mBackgroundDrawable;
|
private Drawable mBackgroundDrawable;
|
||||||
private final SysuiColorExtractor mColorExtractor;
|
private final SysuiColorExtractor mColorExtractor;
|
||||||
private final GlobalActionsPanelPlugin.PanelViewController mPanelController;
|
private final GlobalActionsPanelPlugin.PanelViewController mWalletViewController;
|
||||||
private boolean mKeyguardShowing;
|
private boolean mKeyguardShowing;
|
||||||
private boolean mShowing;
|
private boolean mShowing;
|
||||||
private float mScrimAlpha;
|
private float mScrimAlpha;
|
||||||
@@ -1924,24 +1910,24 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
private boolean mHadTopUi;
|
private boolean mHadTopUi;
|
||||||
private final NotificationShadeWindowController mNotificationShadeWindowController;
|
private final NotificationShadeWindowController mNotificationShadeWindowController;
|
||||||
private final NotificationShadeDepthController mDepthController;
|
private final NotificationShadeDepthController mDepthController;
|
||||||
private final BlurUtils mBlurUtils;
|
|
||||||
private final SysUiState mSysUiState;
|
private final SysUiState mSysUiState;
|
||||||
private final boolean mUseControlsLayout;
|
|
||||||
private ListPopupWindow mOverflowPopup;
|
private ListPopupWindow mOverflowPopup;
|
||||||
private final Runnable mOnRotateCallback;
|
private final Runnable mOnRotateCallback;
|
||||||
|
private final boolean mControlsAvailable;
|
||||||
|
|
||||||
private ControlsUiController mControlsUiController;
|
private ControlsUiController mControlsUiController;
|
||||||
private ViewGroup mControlsView;
|
private ViewGroup mControlsView;
|
||||||
private ViewGroup mContainer;
|
private ViewGroup mContainer;
|
||||||
|
@VisibleForTesting ViewGroup mLockMessageContainer;
|
||||||
|
private TextView mLockMessage;
|
||||||
|
|
||||||
ActionsDialog(Context context, MyAdapter adapter, MyOverflowAdapter overflowAdapter,
|
ActionsDialog(Context context, MyAdapter adapter, MyOverflowAdapter overflowAdapter,
|
||||||
GlobalActionsPanelPlugin.PanelViewController plugin,
|
GlobalActionsPanelPlugin.PanelViewController walletViewController,
|
||||||
NotificationShadeDepthController depthController,
|
NotificationShadeDepthController depthController,
|
||||||
SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
|
SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
|
||||||
NotificationShadeWindowController notificationShadeWindowController,
|
NotificationShadeWindowController notificationShadeWindowController,
|
||||||
ControlsUiController controlsUiController, BlurUtils blurUtils,
|
boolean controlsAvailable, @Nullable ControlsUiController controlsUiController,
|
||||||
SysUiState sysuiState, boolean useControlsLayout, Runnable onRotateCallback,
|
SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing) {
|
||||||
boolean keyguardShowing) {
|
|
||||||
super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
|
super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mAdapter = adapter;
|
mAdapter = adapter;
|
||||||
@@ -1950,10 +1936,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
mColorExtractor = sysuiColorExtractor;
|
mColorExtractor = sysuiColorExtractor;
|
||||||
mStatusBarService = statusBarService;
|
mStatusBarService = statusBarService;
|
||||||
mNotificationShadeWindowController = notificationShadeWindowController;
|
mNotificationShadeWindowController = notificationShadeWindowController;
|
||||||
|
mControlsAvailable = controlsAvailable;
|
||||||
mControlsUiController = controlsUiController;
|
mControlsUiController = controlsUiController;
|
||||||
mBlurUtils = blurUtils;
|
|
||||||
mSysUiState = sysuiState;
|
mSysUiState = sysuiState;
|
||||||
mUseControlsLayout = useControlsLayout;
|
|
||||||
mOnRotateCallback = onRotateCallback;
|
mOnRotateCallback = onRotateCallback;
|
||||||
mKeyguardShowing = keyguardShowing;
|
mKeyguardShowing = keyguardShowing;
|
||||||
|
|
||||||
@@ -1978,7 +1963,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
window.getAttributes().setFitInsetsTypes(0 /* types */);
|
window.getAttributes().setFitInsetsTypes(0 /* types */);
|
||||||
setTitle(R.string.global_actions);
|
setTitle(R.string.global_actions);
|
||||||
|
|
||||||
mPanelController = plugin;
|
mWalletViewController = walletViewController;
|
||||||
initializeLayout();
|
initializeLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1991,11 +1976,11 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
mControlsUiController.show(mControlsView, this::dismissForControlsActivity);
|
mControlsUiController.show(mControlsView, this::dismissForControlsActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldUsePanel() {
|
private void initializeWalletView() {
|
||||||
return mPanelController != null && mPanelController.getPanelContent() != null;
|
if (mWalletViewController == null || mWalletViewController.getPanelContent() == null) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
private void initializePanel() {
|
|
||||||
int rotation = RotationUtils.getRotation(mContext);
|
int rotation = RotationUtils.getRotation(mContext);
|
||||||
boolean rotationLocked = RotationPolicy.isRotationLocked(mContext);
|
boolean rotationLocked = RotationPolicy.isRotationLocked(mContext);
|
||||||
if (rotation != RotationUtils.ROTATION_NONE) {
|
if (rotation != RotationUtils.ROTATION_NONE) {
|
||||||
@@ -2032,12 +2017,16 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
setRotationSuggestionsEnabled(false);
|
setRotationSuggestionsEnabled(false);
|
||||||
|
|
||||||
FrameLayout panelContainer =
|
FrameLayout panelContainer =
|
||||||
findViewById(com.android.systemui.R.id.global_actions_panel_container);
|
findViewById(com.android.systemui.R.id.global_actions_wallet);
|
||||||
FrameLayout.LayoutParams panelParams =
|
FrameLayout.LayoutParams panelParams =
|
||||||
new FrameLayout.LayoutParams(
|
new FrameLayout.LayoutParams(
|
||||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
FrameLayout.LayoutParams.MATCH_PARENT);
|
FrameLayout.LayoutParams.MATCH_PARENT);
|
||||||
View walletView = mPanelController.getPanelContent();
|
if (!mControlsAvailable) {
|
||||||
|
panelParams.topMargin = mContext.getResources().getDimensionPixelSize(
|
||||||
|
com.android.systemui.R.dimen.global_actions_wallet_top_margin);
|
||||||
|
}
|
||||||
|
View walletView = mWalletViewController.getPanelContent();
|
||||||
panelContainer.addView(walletView, panelParams);
|
panelContainer.addView(walletView, panelParams);
|
||||||
// Smooth transitions when wallet is resized, which can happen when a card is added
|
// Smooth transitions when wallet is resized, which can happen when a card is added
|
||||||
ViewGroup root = findViewById(com.android.systemui.R.id.global_actions_grid_root);
|
ViewGroup root = findViewById(com.android.systemui.R.id.global_actions_grid_root);
|
||||||
@@ -2077,7 +2066,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeLayout() {
|
private void initializeLayout() {
|
||||||
setContentView(getGlobalActionsLayoutId(mContext));
|
setContentView(com.android.systemui.R.layout.global_actions_grid_v2);
|
||||||
fixNavBarClipping();
|
fixNavBarClipping();
|
||||||
mControlsView = findViewById(com.android.systemui.R.id.global_actions_controls);
|
mControlsView = findViewById(com.android.systemui.R.id.global_actions_controls);
|
||||||
mGlobalActionsLayout = findViewById(com.android.systemui.R.id.global_actions_view);
|
mGlobalActionsLayout = findViewById(com.android.systemui.R.id.global_actions_view);
|
||||||
@@ -2093,10 +2082,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
mGlobalActionsLayout.setRotationListener(this::onRotate);
|
mGlobalActionsLayout.setRotationListener(this::onRotate);
|
||||||
mGlobalActionsLayout.setAdapter(mAdapter);
|
mGlobalActionsLayout.setAdapter(mAdapter);
|
||||||
mContainer = findViewById(com.android.systemui.R.id.global_actions_container);
|
mContainer = findViewById(com.android.systemui.R.id.global_actions_container);
|
||||||
// Some legacy dialog layouts don't have the outer container
|
mLockMessageContainer = requireViewById(
|
||||||
if (mContainer == null) {
|
com.android.systemui.R.id.global_actions_lock_message_container);
|
||||||
mContainer = mGlobalActionsLayout;
|
mLockMessage = requireViewById(com.android.systemui.R.id.global_actions_lock_message);
|
||||||
}
|
|
||||||
|
|
||||||
View overflowButton = findViewById(
|
View overflowButton = findViewById(
|
||||||
com.android.systemui.R.id.global_actions_overflow_button);
|
com.android.systemui.R.id.global_actions_overflow_button);
|
||||||
@@ -2117,17 +2105,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldUsePanel()) {
|
initializeWalletView();
|
||||||
initializePanel();
|
|
||||||
}
|
|
||||||
if (mBackgroundDrawable == null) {
|
if (mBackgroundDrawable == null) {
|
||||||
mBackgroundDrawable = new ScrimDrawable();
|
mBackgroundDrawable = new ScrimDrawable();
|
||||||
if (mUseControlsLayout) {
|
mScrimAlpha = 1.0f;
|
||||||
mScrimAlpha = 1.0f;
|
|
||||||
} else {
|
|
||||||
mScrimAlpha = mBlurUtils.supportsBlursOnWindows()
|
|
||||||
? ScrimController.BLUR_SCRIM_ALPHA : ScrimController.BUSY_SCRIM_ALPHA;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
getWindow().setBackgroundDrawable(mBackgroundDrawable);
|
getWindow().setBackgroundDrawable(mBackgroundDrawable);
|
||||||
}
|
}
|
||||||
@@ -2141,29 +2122,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
contentParent.setClipToPadding(false);
|
contentParent.setClipToPadding(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getGlobalActionsLayoutId(Context context) {
|
|
||||||
if (mUseControlsLayout) {
|
|
||||||
return com.android.systemui.R.layout.global_actions_grid_v2;
|
|
||||||
}
|
|
||||||
|
|
||||||
int rotation = RotationUtils.getRotation(context);
|
|
||||||
boolean useGridLayout = isForceGridEnabled(context)
|
|
||||||
|| (shouldUsePanel() && rotation == RotationUtils.ROTATION_NONE);
|
|
||||||
if (rotation == RotationUtils.ROTATION_SEASCAPE) {
|
|
||||||
if (useGridLayout) {
|
|
||||||
return com.android.systemui.R.layout.global_actions_grid_seascape;
|
|
||||||
} else {
|
|
||||||
return com.android.systemui.R.layout.global_actions_column_seascape;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (useGridLayout) {
|
|
||||||
return com.android.systemui.R.layout.global_actions_grid;
|
|
||||||
} else {
|
|
||||||
return com.android.systemui.R.layout.global_actions_column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.setCanceledOnTouchOutside(true);
|
super.setCanceledOnTouchOutside(true);
|
||||||
@@ -2187,9 +2145,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
if (!(mBackgroundDrawable instanceof ScrimDrawable)) {
|
if (!(mBackgroundDrawable instanceof ScrimDrawable)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((ScrimDrawable) mBackgroundDrawable).setColor(
|
((ScrimDrawable) mBackgroundDrawable).setColor(Color.BLACK, animate);
|
||||||
!mUseControlsLayout && colors.supportsDarkText()
|
|
||||||
? Color.WHITE : Color.BLACK, animate);
|
|
||||||
View decorView = getWindow().getDecorView();
|
View decorView = getWindow().getDecorView();
|
||||||
if (colors.supportsDarkText()) {
|
if (colors.supportsDarkText()) {
|
||||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
|
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR |
|
||||||
@@ -2216,12 +2172,10 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
|
|
||||||
ViewGroup root = (ViewGroup) mGlobalActionsLayout.getRootView();
|
ViewGroup root = (ViewGroup) mGlobalActionsLayout.getRootView();
|
||||||
root.setOnApplyWindowInsetsListener((v, windowInsets) -> {
|
root.setOnApplyWindowInsetsListener((v, windowInsets) -> {
|
||||||
if (mUseControlsLayout) {
|
root.setPadding(windowInsets.getStableInsetLeft(),
|
||||||
root.setPadding(windowInsets.getStableInsetLeft(),
|
windowInsets.getStableInsetTop(),
|
||||||
windowInsets.getStableInsetTop(),
|
windowInsets.getStableInsetRight(),
|
||||||
windowInsets.getStableInsetRight(),
|
windowInsets.getStableInsetBottom());
|
||||||
windowInsets.getStableInsetBottom());
|
|
||||||
}
|
|
||||||
return WindowInsets.CONSUMED;
|
return WindowInsets.CONSUMED;
|
||||||
});
|
});
|
||||||
if (mControlsUiController != null) {
|
if (mControlsUiController != null) {
|
||||||
@@ -2308,7 +2262,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
private void completeDismiss() {
|
private void completeDismiss() {
|
||||||
mShowing = false;
|
mShowing = false;
|
||||||
resetOrientation();
|
resetOrientation();
|
||||||
dismissPanel();
|
dismissWallet();
|
||||||
dismissOverflow(true);
|
dismissOverflow(true);
|
||||||
if (mControlsUiController != null) mControlsUiController.hide();
|
if (mControlsUiController != null) mControlsUiController.hide();
|
||||||
mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi);
|
mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi);
|
||||||
@@ -2318,9 +2272,9 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
super.dismiss();
|
super.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dismissPanel() {
|
private void dismissWallet() {
|
||||||
if (mPanelController != null) {
|
if (mWalletViewController != null) {
|
||||||
mPanelController.onDismissed();
|
mWalletViewController.onDismissed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2375,7 +2329,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
|
|
||||||
public void refreshDialog() {
|
public void refreshDialog() {
|
||||||
// ensure dropdown menus are dismissed before re-initializing the dialog
|
// ensure dropdown menus are dismissed before re-initializing the dialog
|
||||||
dismissPanel();
|
dismissWallet();
|
||||||
dismissOverflow(true);
|
dismissOverflow(true);
|
||||||
if (mControlsUiController != null) {
|
if (mControlsUiController != null) {
|
||||||
mControlsUiController.hide();
|
mControlsUiController.hide();
|
||||||
@@ -2396,6 +2350,25 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hideLockMessage() {
|
||||||
|
if (mLockMessageContainer.getVisibility() == View.VISIBLE) {
|
||||||
|
mLockMessageContainer.animate().alpha(0).setDuration(150).setListener(
|
||||||
|
new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
mLockMessageContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showLockMessage() {
|
||||||
|
Drawable lockIcon = mContext.getDrawable(com.android.internal.R.drawable.ic_lock);
|
||||||
|
lockIcon.setTint(mContext.getColor(com.android.systemui.R.color.control_primary_text));
|
||||||
|
mLockMessage.setCompoundDrawablesWithIntrinsicBounds(null, lockIcon, null, null);
|
||||||
|
mLockMessageContainer.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
private static class ResetOrientationData {
|
private static class ResetOrientationData {
|
||||||
public boolean locked;
|
public boolean locked;
|
||||||
public int rotation;
|
public int rotation;
|
||||||
@@ -2418,17 +2391,21 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
|||||||
return isPanelDebugModeEnabled(context);
|
return isPanelDebugModeEnabled(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
private boolean shouldShowControls() {
|
||||||
protected boolean shouldShowControls() {
|
|
||||||
return (mKeyguardStateController.isUnlocked() || mShowLockScreenCardsAndControls)
|
return (mKeyguardStateController.isUnlocked() || mShowLockScreenCardsAndControls)
|
||||||
&& mControlsUiController.getAvailable()
|
&& controlsAvailable();
|
||||||
&& !mControlsServiceInfos.isEmpty()
|
|
||||||
&& mDeviceProvisioned;
|
|
||||||
}
|
}
|
||||||
// TODO: Remove legacy layout XML and classes.
|
|
||||||
protected boolean shouldUseControlsLayout() {
|
private boolean controlsAvailable() {
|
||||||
// always use new controls layout
|
return mDeviceProvisioned
|
||||||
return true;
|
&& mControlsUiController.getAvailable()
|
||||||
|
&& !mControlsServiceInfos.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldShowLockMessage(boolean walletViewAvailable) {
|
||||||
|
return !mKeyguardStateController.isUnlocked()
|
||||||
|
&& !mShowLockScreenCardsAndControls
|
||||||
|
&& (controlsAvailable() || walletViewAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onPowerMenuLockScreenSettingsChanged() {
|
private void onPowerMenuLockScreenSettingsChanged() {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks
|
|||||||
private final Lazy<GlobalActionsDialog> mGlobalActionsDialogLazy;
|
private final Lazy<GlobalActionsDialog> mGlobalActionsDialogLazy;
|
||||||
private final KeyguardStateController mKeyguardStateController;
|
private final KeyguardStateController mKeyguardStateController;
|
||||||
private final DeviceProvisionedController mDeviceProvisionedController;
|
private final DeviceProvisionedController mDeviceProvisionedController;
|
||||||
private final ExtensionController.Extension<GlobalActionsPanelPlugin> mPanelExtension;
|
private final ExtensionController.Extension<GlobalActionsPanelPlugin> mWalletPluginProvider;
|
||||||
private final BlurUtils mBlurUtils;
|
private final BlurUtils mBlurUtils;
|
||||||
private final CommandQueue mCommandQueue;
|
private final CommandQueue mCommandQueue;
|
||||||
private GlobalActionsDialog mGlobalActionsDialog;
|
private GlobalActionsDialog mGlobalActionsDialog;
|
||||||
@@ -69,7 +69,7 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks
|
|||||||
mCommandQueue = commandQueue;
|
mCommandQueue = commandQueue;
|
||||||
mBlurUtils = blurUtils;
|
mBlurUtils = blurUtils;
|
||||||
mCommandQueue.addCallback(this);
|
mCommandQueue.addCallback(this);
|
||||||
mPanelExtension = Dependency.get(ExtensionController.class)
|
mWalletPluginProvider = Dependency.get(ExtensionController.class)
|
||||||
.newExtension(GlobalActionsPanelPlugin.class)
|
.newExtension(GlobalActionsPanelPlugin.class)
|
||||||
.withPlugin(GlobalActionsPanelPlugin.class)
|
.withPlugin(GlobalActionsPanelPlugin.class)
|
||||||
.build();
|
.build();
|
||||||
@@ -90,7 +90,7 @@ public class GlobalActionsImpl implements GlobalActions, CommandQueue.Callbacks
|
|||||||
mGlobalActionsDialog = mGlobalActionsDialogLazy.get();
|
mGlobalActionsDialog = mGlobalActionsDialogLazy.get();
|
||||||
mGlobalActionsDialog.showOrHideDialog(mKeyguardStateController.isShowing(),
|
mGlobalActionsDialog.showOrHideDialog(mKeyguardStateController.isShowing(),
|
||||||
mDeviceProvisionedController.isDeviceProvisioned(),
|
mDeviceProvisionedController.isDeviceProvisioned(),
|
||||||
mPanelExtension.get());
|
mWalletPluginProvider.get());
|
||||||
Dependency.get(KeyguardUpdateMonitor.class).requestFaceAuth();
|
Dependency.get(KeyguardUpdateMonitor.class).requestFaceAuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,13 @@
|
|||||||
|
|
||||||
package com.android.systemui.globalactions;
|
package com.android.systemui.globalactions;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
@@ -30,6 +34,7 @@ import android.app.admin.DevicePolicyManager;
|
|||||||
import android.app.trust.TrustManager;
|
import android.app.trust.TrustManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -40,9 +45,12 @@ import android.testing.AndroidTestingRunner;
|
|||||||
import android.testing.TestableLooper;
|
import android.testing.TestableLooper;
|
||||||
import android.util.FeatureFlagUtils;
|
import android.util.FeatureFlagUtils;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
|
import com.android.internal.colorextraction.ColorExtractor;
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.internal.statusbar.IStatusBarService;
|
import com.android.internal.statusbar.IStatusBarService;
|
||||||
@@ -56,7 +64,7 @@ import com.android.systemui.controls.ui.ControlsUiController;
|
|||||||
import com.android.systemui.model.SysUiState;
|
import com.android.systemui.model.SysUiState;
|
||||||
import com.android.systemui.plugins.ActivityStarter;
|
import com.android.systemui.plugins.ActivityStarter;
|
||||||
import com.android.systemui.plugins.GlobalActions;
|
import com.android.systemui.plugins.GlobalActions;
|
||||||
import com.android.systemui.statusbar.BlurUtils;
|
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
|
||||||
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
import com.android.systemui.statusbar.NotificationShadeDepthController;
|
||||||
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
|
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
@@ -98,7 +106,6 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
|
|||||||
@Mock private NotificationShadeDepthController mDepthController;
|
@Mock private NotificationShadeDepthController mDepthController;
|
||||||
@Mock private SysuiColorExtractor mColorExtractor;
|
@Mock private SysuiColorExtractor mColorExtractor;
|
||||||
@Mock private IStatusBarService mStatusBarService;
|
@Mock private IStatusBarService mStatusBarService;
|
||||||
@Mock private BlurUtils mBlurUtils;
|
|
||||||
@Mock private NotificationShadeWindowController mNotificationShadeWindowController;
|
@Mock private NotificationShadeWindowController mNotificationShadeWindowController;
|
||||||
@Mock private ControlsUiController mControlsUiController;
|
@Mock private ControlsUiController mControlsUiController;
|
||||||
@Mock private IWindowManager mWindowManager;
|
@Mock private IWindowManager mWindowManager;
|
||||||
@@ -109,6 +116,8 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
|
|||||||
@Mock private RingerModeTracker mRingerModeTracker;
|
@Mock private RingerModeTracker mRingerModeTracker;
|
||||||
@Mock private RingerModeLiveData mRingerModeLiveData;
|
@Mock private RingerModeLiveData mRingerModeLiveData;
|
||||||
@Mock private SysUiState mSysUiState;
|
@Mock private SysUiState mSysUiState;
|
||||||
|
@Mock GlobalActionsPanelPlugin mWalletPlugin;
|
||||||
|
@Mock GlobalActionsPanelPlugin.PanelViewController mWalletController;
|
||||||
@Mock private Handler mHandler;
|
@Mock private Handler mHandler;
|
||||||
|
|
||||||
private TestableLooper mTestableLooper;
|
private TestableLooper mTestableLooper;
|
||||||
@@ -143,7 +152,6 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
|
|||||||
mDepthController,
|
mDepthController,
|
||||||
mColorExtractor,
|
mColorExtractor,
|
||||||
mStatusBarService,
|
mStatusBarService,
|
||||||
mBlurUtils,
|
|
||||||
mNotificationShadeWindowController,
|
mNotificationShadeWindowController,
|
||||||
mControlsUiController,
|
mControlsUiController,
|
||||||
mWindowManager,
|
mWindowManager,
|
||||||
@@ -156,6 +164,11 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
|
|||||||
mHandler
|
mHandler
|
||||||
);
|
);
|
||||||
mGlobalActionsDialog.setZeroDialogPressDelayForTesting();
|
mGlobalActionsDialog.setZeroDialogPressDelayForTesting();
|
||||||
|
|
||||||
|
ColorExtractor.GradientColors backdropColors = new ColorExtractor.GradientColors();
|
||||||
|
backdropColors.setMainColor(Color.BLACK);
|
||||||
|
when(mColorExtractor.getNeutralColors()).thenReturn(backdropColors);
|
||||||
|
when(mSysUiState.setFlag(anyInt(), anyBoolean())).thenReturn(mSysUiState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -277,4 +290,65 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
|
|||||||
assertEquals(3, mGlobalActionsDialog.mItems.size());
|
assertEquals(3, mGlobalActionsDialog.mItems.size());
|
||||||
assertEquals(0, mGlobalActionsDialog.mOverflowItems.size());
|
assertEquals(0, mGlobalActionsDialog.mOverflowItems.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testShouldShowLockScreenMessage() {
|
||||||
|
mGlobalActionsDialog = spy(mGlobalActionsDialog);
|
||||||
|
mGlobalActionsDialog.mDialog = null;
|
||||||
|
when(mKeyguardStateController.isUnlocked()).thenReturn(false);
|
||||||
|
mGlobalActionsDialog.mShowLockScreenCardsAndControls = false;
|
||||||
|
setupDefaultActions();
|
||||||
|
when(mWalletPlugin.onPanelShown(any(), anyBoolean())).thenReturn(mWalletController);
|
||||||
|
when(mWalletController.getPanelContent()).thenReturn(new FrameLayout(mContext));
|
||||||
|
|
||||||
|
mGlobalActionsDialog.showOrHideDialog(false, true, mWalletPlugin);
|
||||||
|
|
||||||
|
GlobalActionsDialog.ActionsDialog dialog = mGlobalActionsDialog.mDialog;
|
||||||
|
assertThat(dialog).isNotNull();
|
||||||
|
assertThat(dialog.mLockMessageContainer.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testShouldNotShowLockScreenMessage_whenWalletOrControlsShownOnLockScreen() {
|
||||||
|
mGlobalActionsDialog = spy(mGlobalActionsDialog);
|
||||||
|
mGlobalActionsDialog.mDialog = null;
|
||||||
|
when(mKeyguardStateController.isUnlocked()).thenReturn(false);
|
||||||
|
mGlobalActionsDialog.mShowLockScreenCardsAndControls = true;
|
||||||
|
setupDefaultActions();
|
||||||
|
when(mWalletPlugin.onPanelShown(any(), anyBoolean())).thenReturn(mWalletController);
|
||||||
|
when(mWalletController.getPanelContent()).thenReturn(new FrameLayout(mContext));
|
||||||
|
|
||||||
|
mGlobalActionsDialog.showOrHideDialog(false, true, mWalletPlugin);
|
||||||
|
|
||||||
|
GlobalActionsDialog.ActionsDialog dialog = mGlobalActionsDialog.mDialog;
|
||||||
|
assertThat(dialog).isNotNull();
|
||||||
|
assertThat(dialog.mLockMessageContainer.getVisibility()).isEqualTo(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testShouldNotShowLockScreenMessage_whenControlsAndWalletBothDisabled() {
|
||||||
|
mGlobalActionsDialog = spy(mGlobalActionsDialog);
|
||||||
|
mGlobalActionsDialog.mDialog = null;
|
||||||
|
when(mKeyguardStateController.isUnlocked()).thenReturn(false);
|
||||||
|
mGlobalActionsDialog.mShowLockScreenCardsAndControls = true;
|
||||||
|
setupDefaultActions();
|
||||||
|
when(mWalletPlugin.onPanelShown(any(), anyBoolean())).thenReturn(mWalletController);
|
||||||
|
when(mWalletController.getPanelContent()).thenReturn(null);
|
||||||
|
when(mControlsUiController.getAvailable()).thenReturn(false);
|
||||||
|
|
||||||
|
mGlobalActionsDialog.showOrHideDialog(false, true, mWalletPlugin);
|
||||||
|
|
||||||
|
GlobalActionsDialog.ActionsDialog dialog = mGlobalActionsDialog.mDialog;
|
||||||
|
assertThat(dialog).isNotNull();
|
||||||
|
assertThat(dialog.mLockMessageContainer.getVisibility()).isEqualTo(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupDefaultActions() {
|
||||||
|
String[] actions = {
|
||||||
|
GlobalActionsDialog.GLOBAL_ACTION_KEY_POWER,
|
||||||
|
GlobalActionsDialog.GLOBAL_ACTION_KEY_RESTART,
|
||||||
|
GlobalActionsDialog.GLOBAL_ACTION_KEY_SCREENSHOT,
|
||||||
|
};
|
||||||
|
doReturn(actions).when(mGlobalActionsDialog).getDefaultActions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user