Loading packages/SystemUI/res/layout/global_actions_grid_lite.xml +9 −5 Original line number Diff line number Diff line Loading @@ -13,13 +13,12 @@ See the License for the specific language governing permissions and limitations under the License. --> <LinearLayout <androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" android:layout_gravity="center"> <com.android.systemui.globalactions.GlobalActionsLayoutLite Loading @@ -29,8 +28,11 @@ android:orientation="vertical" android:clipChildren="false" android:clipToPadding="false" android:background="@drawable/global_actions_lite_background" android:padding="@dimen/global_actions_lite_padding"> app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_weight="1"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="wrap_content" android:layout_height="wrap_content" Loading @@ -38,6 +40,8 @@ android:gravity="center" android:translationZ="@dimen/global_actions_translate" android:orientation="horizontal" android:background="@drawable/global_actions_lite_background" android:padding="@dimen/global_actions_lite_padding" android:layoutDirection="ltr"> <androidx.constraintlayout.helper.widget.Flow android:id="@+id/list_flow" Loading @@ -53,4 +57,4 @@ app:flow_horizontalStyle="packed"/> </androidx.constraintlayout.widget.ConstraintLayout> </com.android.systemui.globalactions.GlobalActionsLayoutLite> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> packages/SystemUI/res/layout/global_actions_toast.xml 0 → 100644 +44 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center|bottom" android:gravity="center" android:layout_marginBottom="@dimen/global_actions_info_margin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintWidth_max="382dp" android:layout_weight="0" android:background="@drawable/global_actions_lite_background" android:theme="@style/Theme.SystemUI.QuickSettings" android:paddingTop="14dp" android:paddingBottom="14dp" android:paddingStart="20dp" android:paddingEnd="20dp" android:orientation="horizontal"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textSize="14sp" android:textColor="?android:attr/textColorSecondary" android:text="@string/global_action_smart_lock_disabled" /> </LinearLayout> No newline at end of file packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1133,6 +1133,7 @@ <dimen name="global_actions_button_padding">38dp</dimen> <dimen name="global_actions_corner_radius">28dp</dimen> <dimen name="global_actions_lite_padding">24dp</dimen> <dimen name="global_actions_info_margin">32dp</dimen> <!-- The maximum offset in either direction that elements are moved horizontally to prevent burn-in on AOD. --> Loading packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,8 @@ <!-- Power menu item for taking a screenshot [CHAR LIMIT=20]--> <string name="global_action_screenshot">Screenshot</string> <!-- Message shown in power menu when smart lock has been disabled [CHAR_LIMIT=NONE] --> <string name="global_action_smart_lock_disabled">Smart Lock disabled</string> <!-- text to show in place of RemoteInput images when they cannot be shown. [CHAR LIMIT=50] --> Loading packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java +61 −3 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import android.view.Window; import android.view.WindowInsets; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ImageView.ScaleType; Loading @@ -108,6 +109,7 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.internal.util.EmergencyAffordanceManager; import com.android.internal.util.ScreenshotHelper; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.MultiListLayout; import com.android.systemui.MultiListLayout.MultiListAdapter; import com.android.systemui.animation.Interpolators; Loading Loading @@ -171,6 +173,11 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene static final String GLOBAL_ACTION_KEY_EMERGENCY = "emergency"; static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot"; // See NotificationManagerService#scheduleDurationReachedLocked private static final long TOAST_FADE_TIME = 333; // See NotificationManagerService.LONG_DELAY private static final int TOAST_VISIBLE_TIME = 3500; private final Context mContext; private final GlobalActionsManager mWindowManagerFuncs; private final AudioManager mAudioManager; Loading Loading @@ -231,6 +238,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene protected Handler mMainHandler; private int mSmallestScreenWidthDp; private final Optional<StatusBar> mStatusBarOptional; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; @VisibleForTesting public enum GlobalActionsEvent implements UiEventLogger.UiEventEnum { Loading Loading @@ -337,7 +345,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene SysUiState sysUiState, @Main Handler handler, PackageManager packageManager, Optional<StatusBar> statusBarOptional) { Optional<StatusBar> statusBarOptional, KeyguardUpdateMonitor keyguardUpdateMonitor) { mContext = context; mWindowManagerFuncs = windowManagerFuncs; mAudioManager = audioManager; Loading Loading @@ -367,6 +376,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mMainHandler = handler; mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp; mStatusBarOptional = statusBarOptional; mKeyguardUpdateMonitor = keyguardUpdateMonitor; // receive broadcasts IntentFilter filter = new IntentFilter(); Loading Loading @@ -420,6 +430,10 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene return mStatusBarOptional; } protected KeyguardUpdateMonitor getKeyguardUpdateMonitor() { return mKeyguardUpdateMonitor; } /** * Show the global actions dialog (creating if necessary) * Loading Loading @@ -651,7 +665,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mAdapter, mOverflowAdapter, mSysuiColorExtractor, mStatusBarService, mNotificationShadeWindowController, mSysUiState, this::onRotate, mKeyguardShowing, mPowerAdapter, mUiEventLogger, mStatusBarOptional); mStatusBarOptional, mKeyguardUpdateMonitor, mLockPatternUtils); dialog.setOnDismissListener(this); dialog.setOnShowListener(this); Loading Loading @@ -2119,6 +2133,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene private UiEventLogger mUiEventLogger; private GestureDetector mGestureDetector; private Optional<StatusBar> mStatusBarOptional; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private LockPatternUtils mLockPatternUtils; protected ViewGroup mContainer; Loading Loading @@ -2172,7 +2188,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene NotificationShadeWindowController notificationShadeWindowController, SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing, MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger, Optional<StatusBar> statusBarOptional) { Optional<StatusBar> statusBarOptional, KeyguardUpdateMonitor keyguardUpdateMonitor, LockPatternUtils lockPatternUtils) { super(context, themeRes); mContext = context; mAdapter = adapter; Loading @@ -2186,6 +2203,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mKeyguardShowing = keyguardShowing; mUiEventLogger = uiEventLogger; mStatusBarOptional = statusBarOptional; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLockPatternUtils = lockPatternUtils; mGestureDetector = new GestureDetector(mContext, mGestureListener); Loading Loading @@ -2304,6 +2323,14 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mBackgroundDrawable = new ScrimDrawable(); mScrimAlpha = 1.0f; } // If user entered from the lock screen and smart lock was enabled, disable it int user = KeyguardUpdateMonitor.getCurrentUser(); boolean userHasTrust = mKeyguardUpdateMonitor.getUserHasTrust(user); if (mKeyguardShowing && userHasTrust) { mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser()); showSmartLockDisabledMessage(); } } protected void fixNavBarClipping() { Loading @@ -2315,6 +2342,37 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene contentParent.setClipToPadding(false); } private void showSmartLockDisabledMessage() { // Since power menu is the top window, make a Toast-like view that will show up View message = LayoutInflater.from(mContext) .inflate(com.android.systemui.R.layout.global_actions_toast, mContainer, false); // Set up animation AccessibilityManager mAccessibilityManager = (AccessibilityManager) getContext().getSystemService( Context.ACCESSIBILITY_SERVICE); final int visibleTime = mAccessibilityManager.getRecommendedTimeoutMillis( TOAST_VISIBLE_TIME, AccessibilityManager.FLAG_CONTENT_TEXT); message.setVisibility(View.VISIBLE); message.setAlpha(0f); mContainer.addView(message); // Fade in message.animate() .alpha(1f) .setDuration(TOAST_FADE_TIME) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { // Then fade out message.animate() .alpha(0f) .setDuration(TOAST_FADE_TIME) .setStartDelay(visibleTime); } }); } @Override protected void onStart() { super.onStart(); Loading Loading
packages/SystemUI/res/layout/global_actions_grid_lite.xml +9 −5 Original line number Diff line number Diff line Loading @@ -13,13 +13,12 @@ See the License for the specific language governing permissions and limitations under the License. --> <LinearLayout <androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" android:layout_gravity="center"> <com.android.systemui.globalactions.GlobalActionsLayoutLite Loading @@ -29,8 +28,11 @@ android:orientation="vertical" android:clipChildren="false" android:clipToPadding="false" android:background="@drawable/global_actions_lite_background" android:padding="@dimen/global_actions_lite_padding"> app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_weight="1"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="wrap_content" android:layout_height="wrap_content" Loading @@ -38,6 +40,8 @@ android:gravity="center" android:translationZ="@dimen/global_actions_translate" android:orientation="horizontal" android:background="@drawable/global_actions_lite_background" android:padding="@dimen/global_actions_lite_padding" android:layoutDirection="ltr"> <androidx.constraintlayout.helper.widget.Flow android:id="@+id/list_flow" Loading @@ -53,4 +57,4 @@ app:flow_horizontalStyle="packed"/> </androidx.constraintlayout.widget.ConstraintLayout> </com.android.systemui.globalactions.GlobalActionsLayoutLite> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
packages/SystemUI/res/layout/global_actions_toast.xml 0 → 100644 +44 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center|bottom" android:gravity="center" android:layout_marginBottom="@dimen/global_actions_info_margin" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintWidth_max="382dp" android:layout_weight="0" android:background="@drawable/global_actions_lite_background" android:theme="@style/Theme.SystemUI.QuickSettings" android:paddingTop="14dp" android:paddingBottom="14dp" android:paddingStart="20dp" android:paddingEnd="20dp" android:orientation="horizontal"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textSize="14sp" android:textColor="?android:attr/textColorSecondary" android:text="@string/global_action_smart_lock_disabled" /> </LinearLayout> No newline at end of file
packages/SystemUI/res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1133,6 +1133,7 @@ <dimen name="global_actions_button_padding">38dp</dimen> <dimen name="global_actions_corner_radius">28dp</dimen> <dimen name="global_actions_lite_padding">24dp</dimen> <dimen name="global_actions_info_margin">32dp</dimen> <!-- The maximum offset in either direction that elements are moved horizontally to prevent burn-in on AOD. --> Loading
packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,8 @@ <!-- Power menu item for taking a screenshot [CHAR LIMIT=20]--> <string name="global_action_screenshot">Screenshot</string> <!-- Message shown in power menu when smart lock has been disabled [CHAR_LIMIT=NONE] --> <string name="global_action_smart_lock_disabled">Smart Lock disabled</string> <!-- text to show in place of RemoteInput images when they cannot be shown. [CHAR LIMIT=50] --> Loading
packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java +61 −3 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import android.view.Window; import android.view.WindowInsets; import android.view.WindowManager; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ImageView.ScaleType; Loading @@ -108,6 +109,7 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.internal.util.EmergencyAffordanceManager; import com.android.internal.util.ScreenshotHelper; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.MultiListLayout; import com.android.systemui.MultiListLayout.MultiListAdapter; import com.android.systemui.animation.Interpolators; Loading Loading @@ -171,6 +173,11 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene static final String GLOBAL_ACTION_KEY_EMERGENCY = "emergency"; static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot"; // See NotificationManagerService#scheduleDurationReachedLocked private static final long TOAST_FADE_TIME = 333; // See NotificationManagerService.LONG_DELAY private static final int TOAST_VISIBLE_TIME = 3500; private final Context mContext; private final GlobalActionsManager mWindowManagerFuncs; private final AudioManager mAudioManager; Loading Loading @@ -231,6 +238,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene protected Handler mMainHandler; private int mSmallestScreenWidthDp; private final Optional<StatusBar> mStatusBarOptional; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; @VisibleForTesting public enum GlobalActionsEvent implements UiEventLogger.UiEventEnum { Loading Loading @@ -337,7 +345,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene SysUiState sysUiState, @Main Handler handler, PackageManager packageManager, Optional<StatusBar> statusBarOptional) { Optional<StatusBar> statusBarOptional, KeyguardUpdateMonitor keyguardUpdateMonitor) { mContext = context; mWindowManagerFuncs = windowManagerFuncs; mAudioManager = audioManager; Loading Loading @@ -367,6 +376,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mMainHandler = handler; mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp; mStatusBarOptional = statusBarOptional; mKeyguardUpdateMonitor = keyguardUpdateMonitor; // receive broadcasts IntentFilter filter = new IntentFilter(); Loading Loading @@ -420,6 +430,10 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene return mStatusBarOptional; } protected KeyguardUpdateMonitor getKeyguardUpdateMonitor() { return mKeyguardUpdateMonitor; } /** * Show the global actions dialog (creating if necessary) * Loading Loading @@ -651,7 +665,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mAdapter, mOverflowAdapter, mSysuiColorExtractor, mStatusBarService, mNotificationShadeWindowController, mSysUiState, this::onRotate, mKeyguardShowing, mPowerAdapter, mUiEventLogger, mStatusBarOptional); mStatusBarOptional, mKeyguardUpdateMonitor, mLockPatternUtils); dialog.setOnDismissListener(this); dialog.setOnShowListener(this); Loading Loading @@ -2119,6 +2133,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene private UiEventLogger mUiEventLogger; private GestureDetector mGestureDetector; private Optional<StatusBar> mStatusBarOptional; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private LockPatternUtils mLockPatternUtils; protected ViewGroup mContainer; Loading Loading @@ -2172,7 +2188,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene NotificationShadeWindowController notificationShadeWindowController, SysUiState sysuiState, Runnable onRotateCallback, boolean keyguardShowing, MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger, Optional<StatusBar> statusBarOptional) { Optional<StatusBar> statusBarOptional, KeyguardUpdateMonitor keyguardUpdateMonitor, LockPatternUtils lockPatternUtils) { super(context, themeRes); mContext = context; mAdapter = adapter; Loading @@ -2186,6 +2203,8 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mKeyguardShowing = keyguardShowing; mUiEventLogger = uiEventLogger; mStatusBarOptional = statusBarOptional; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLockPatternUtils = lockPatternUtils; mGestureDetector = new GestureDetector(mContext, mGestureListener); Loading Loading @@ -2304,6 +2323,14 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene mBackgroundDrawable = new ScrimDrawable(); mScrimAlpha = 1.0f; } // If user entered from the lock screen and smart lock was enabled, disable it int user = KeyguardUpdateMonitor.getCurrentUser(); boolean userHasTrust = mKeyguardUpdateMonitor.getUserHasTrust(user); if (mKeyguardShowing && userHasTrust) { mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser()); showSmartLockDisabledMessage(); } } protected void fixNavBarClipping() { Loading @@ -2315,6 +2342,37 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene contentParent.setClipToPadding(false); } private void showSmartLockDisabledMessage() { // Since power menu is the top window, make a Toast-like view that will show up View message = LayoutInflater.from(mContext) .inflate(com.android.systemui.R.layout.global_actions_toast, mContainer, false); // Set up animation AccessibilityManager mAccessibilityManager = (AccessibilityManager) getContext().getSystemService( Context.ACCESSIBILITY_SERVICE); final int visibleTime = mAccessibilityManager.getRecommendedTimeoutMillis( TOAST_VISIBLE_TIME, AccessibilityManager.FLAG_CONTENT_TEXT); message.setVisibility(View.VISIBLE); message.setAlpha(0f); mContainer.addView(message); // Fade in message.animate() .alpha(1f) .setDuration(TOAST_FADE_TIME) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { // Then fade out message.animate() .alpha(0f) .setDuration(TOAST_FADE_TIME) .setStartDelay(visibleTime); } }); } @Override protected void onStart() { super.onStart(); Loading