Loading packages/SystemUI/res/layout/keyguard_bottom_area.xml +6 −3 Original line number Diff line number Diff line Loading @@ -43,14 +43,17 @@ android:accessibilityLiveRegion="polite"/> <com.android.systemui.statusbar.phone.KeyguardIndicationTextView android:id="@+id/keyguard_indication_enterprise_disclosure" android:layout_width="match_parent" android:id="@+id/keyguard_indication_text_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:minHeight="48dp" android:layout_gravity="center_horizontal" android:layout_centerHorizontal="true" android:paddingStart="@dimen/keyguard_indication_text_padding" android:paddingEnd="@dimen/keyguard_indication_text_padding" android:textAppearance="@style/TextAppearance.Keyguard.BottomArea" android:alpha=".54" android:alpha=".8" android:visibility="gone"/> </LinearLayout> Loading packages/SystemUI/res/values/dimens.xml +4 −1 Original line number Diff line number Diff line Loading @@ -199,6 +199,9 @@ <!-- The amount the content shifts upwards when transforming into the shelf --> <dimen name="shelf_transform_content_shift">32dp</dimen> <!-- The y translation for keyguard indication text animation for rotating text in/out --> <dimen name="keyguard_indication_y_translation">24dp</dimen> <!-- The padding on the bottom of the notifications on the keyguard --> <dimen name="keyguard_indication_bottom_padding">12sp</dimen> Loading Loading @@ -1157,7 +1160,7 @@ <dimen name="logout_button_layout_height">32dp</dimen> <dimen name="logout_button_padding_horizontal">16dp</dimen> <dimen name="logout_button_margin_bottom">12dp</dimen> <dimen name="logout_button_corner_radius">2dp</dimen> <dimen name="logout_button_corner_radius">4dp</dimen> <!-- Blur radius on status bar window and power menu --> <dimen name="min_window_blur_radius">1px</dimen> Loading packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +26 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,10 @@ public class KeyguardStatusView extends GridLayout { private final IActivityManager mIActivityManager; private TextView mLogoutView; private boolean mCanShowLogout = true; // by default, try to show the logout button here private KeyguardClockSwitch mClockView; private TextView mOwnerInfo; private boolean mCanShowOwnerInfo = true; // by default, try to show the owner information here private KeyguardSliceView mKeyguardSlice; private View mNotificationIcons; private Runnable mPendingMarqueeStart; Loading Loading @@ -114,6 +116,25 @@ public class KeyguardStatusView extends GridLayout { if (mOwnerInfo != null) mOwnerInfo.setSelected(enabled); } void setCanShowOwnerInfo(boolean canShowOwnerInfo) { mCanShowOwnerInfo = canShowOwnerInfo; mOwnerInfo = findViewById(R.id.owner_info); if (mOwnerInfo != null) { if (mCanShowOwnerInfo) { mOwnerInfo.setVisibility(VISIBLE); updateOwnerInfo(); } else { mOwnerInfo.setVisibility(GONE); mOwnerInfo = null; } } } void setCanShowLogout(boolean canShowLogout) { mCanShowLogout = canShowLogout; updateLogoutView(); } @Override protected void onFinishInflate() { super.onFinishInflate(); Loading @@ -128,7 +149,10 @@ public class KeyguardStatusView extends GridLayout { if (KeyguardClockAccessibilityDelegate.isNeeded(mContext)) { mClockView.setAccessibilityDelegate(new KeyguardClockAccessibilityDelegate(mContext)); } if (mCanShowOwnerInfo) { mOwnerInfo = findViewById(R.id.owner_info); } mKeyguardSlice = findViewById(R.id.keyguard_status_area); mTextColor = mClockView.getCurrentTextColor(); Loading Loading @@ -189,7 +213,7 @@ public class KeyguardStatusView extends GridLayout { if (mLogoutView == null) { return; } mLogoutView.setVisibility(shouldShowLogout() ? VISIBLE : GONE); mLogoutView.setVisibility(mCanShowLogout && shouldShowLogout() ? VISIBLE : GONE); // Logout button will stay in language of user 0 if we don't set that manually. mLogoutView.setText(mContext.getResources().getString( com.android.internal.R.string.global_action_logout)); Loading packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +5 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV } /** * Get the height of the logout button. * Get the height of the owner information view. */ public int getOwnerInfoHeight() { return mView.getOwnerInfoHeight(); Loading Loading @@ -335,9 +335,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV // of the top of the view mKeyguardSliceViewController.updateTopMargin( mKeyguardClockSwitchController.getClockTextTopPadding()); mView.setCanShowOwnerInfo(false); mView.setCanShowLogout(false); } else { // reset margin mKeyguardSliceViewController.updateTopMargin(0); mView.setCanShowOwnerInfo(true); mView.setCanShowLogout(false); } updateAodIcons(); } Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java 0 → 100644 +155 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.keyguard; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.view.View; /** * Data class containing display information (message, icon, styling) for indication to show at * the bottom of the keyguard. * * See {@link com.android.systemui.statusbar.phone.KeyguardBottomAreaView}. */ public class KeyguardIndication { @NonNull private final CharSequence mMessage; @NonNull private final ColorStateList mTextColor; @Nullable private final Drawable mIcon; @Nullable private final View.OnClickListener mOnClickListener; @Nullable private final Drawable mBackground; private KeyguardIndication( CharSequence message, ColorStateList textColor, Drawable icon, View.OnClickListener onClickListener, Drawable background) { mMessage = message; mTextColor = textColor; mIcon = icon; mOnClickListener = onClickListener; mBackground = background; } /** * Message to display */ public @NonNull CharSequence getMessage() { return mMessage; } /** * TextColor to display the message. */ public @NonNull ColorStateList getTextColor() { return mTextColor; } /** * Icon to display. */ public @Nullable Drawable getIcon() { return mIcon; } /** * Click listener for messsage. */ public @Nullable View.OnClickListener getClickListener() { return mOnClickListener; } /** * Background for textView. */ public @Nullable Drawable getBackground() { return mBackground; } /** * KeyguardIndication Builder */ public static class Builder { private CharSequence mMessage; private Drawable mIcon; private View.OnClickListener mOnClickListener; private ColorStateList mTextColor; private Drawable mBackground; public Builder() { } /** * Required field. Message to display. */ public Builder setMessage(@NonNull CharSequence message) { this.mMessage = message; return this; } /** * Required field. Text color to use to display the message. */ public Builder setTextColor(@NonNull ColorStateList textColor) { this.mTextColor = textColor; return this; } /** * Optional. Icon to show next to the text. Icon location changes based on language * display direction. For LTR, icon shows to the left of the message. For RTL, icon shows * to the right of the message. */ public Builder setIcon(Drawable icon) { this.mIcon = icon; return this; } /** * Optional. Set a click listener on the message. */ public Builder setClickListener(View.OnClickListener onClickListener) { this.mOnClickListener = onClickListener; return this; } /** * Optional. Set a custom background on the TextView. */ public Builder setBackground(Drawable background) { this.mBackground = background; return this; } /** * Build the KeyguardIndication. */ public KeyguardIndication build() { if (mMessage == null) throw new IllegalStateException("message must be set"); if (mTextColor == null) throw new IllegalStateException("text color must be set"); return new KeyguardIndication( mMessage, mTextColor, mIcon, mOnClickListener, mBackground); } } } Loading
packages/SystemUI/res/layout/keyguard_bottom_area.xml +6 −3 Original line number Diff line number Diff line Loading @@ -43,14 +43,17 @@ android:accessibilityLiveRegion="polite"/> <com.android.systemui.statusbar.phone.KeyguardIndicationTextView android:id="@+id/keyguard_indication_enterprise_disclosure" android:layout_width="match_parent" android:id="@+id/keyguard_indication_text_bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:minHeight="48dp" android:layout_gravity="center_horizontal" android:layout_centerHorizontal="true" android:paddingStart="@dimen/keyguard_indication_text_padding" android:paddingEnd="@dimen/keyguard_indication_text_padding" android:textAppearance="@style/TextAppearance.Keyguard.BottomArea" android:alpha=".54" android:alpha=".8" android:visibility="gone"/> </LinearLayout> Loading
packages/SystemUI/res/values/dimens.xml +4 −1 Original line number Diff line number Diff line Loading @@ -199,6 +199,9 @@ <!-- The amount the content shifts upwards when transforming into the shelf --> <dimen name="shelf_transform_content_shift">32dp</dimen> <!-- The y translation for keyguard indication text animation for rotating text in/out --> <dimen name="keyguard_indication_y_translation">24dp</dimen> <!-- The padding on the bottom of the notifications on the keyguard --> <dimen name="keyguard_indication_bottom_padding">12sp</dimen> Loading Loading @@ -1157,7 +1160,7 @@ <dimen name="logout_button_layout_height">32dp</dimen> <dimen name="logout_button_padding_horizontal">16dp</dimen> <dimen name="logout_button_margin_bottom">12dp</dimen> <dimen name="logout_button_corner_radius">2dp</dimen> <dimen name="logout_button_corner_radius">4dp</dimen> <!-- Blur radius on status bar window and power menu --> <dimen name="min_window_blur_radius">1px</dimen> Loading
packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java +26 −2 Original line number Diff line number Diff line Loading @@ -56,8 +56,10 @@ public class KeyguardStatusView extends GridLayout { private final IActivityManager mIActivityManager; private TextView mLogoutView; private boolean mCanShowLogout = true; // by default, try to show the logout button here private KeyguardClockSwitch mClockView; private TextView mOwnerInfo; private boolean mCanShowOwnerInfo = true; // by default, try to show the owner information here private KeyguardSliceView mKeyguardSlice; private View mNotificationIcons; private Runnable mPendingMarqueeStart; Loading Loading @@ -114,6 +116,25 @@ public class KeyguardStatusView extends GridLayout { if (mOwnerInfo != null) mOwnerInfo.setSelected(enabled); } void setCanShowOwnerInfo(boolean canShowOwnerInfo) { mCanShowOwnerInfo = canShowOwnerInfo; mOwnerInfo = findViewById(R.id.owner_info); if (mOwnerInfo != null) { if (mCanShowOwnerInfo) { mOwnerInfo.setVisibility(VISIBLE); updateOwnerInfo(); } else { mOwnerInfo.setVisibility(GONE); mOwnerInfo = null; } } } void setCanShowLogout(boolean canShowLogout) { mCanShowLogout = canShowLogout; updateLogoutView(); } @Override protected void onFinishInflate() { super.onFinishInflate(); Loading @@ -128,7 +149,10 @@ public class KeyguardStatusView extends GridLayout { if (KeyguardClockAccessibilityDelegate.isNeeded(mContext)) { mClockView.setAccessibilityDelegate(new KeyguardClockAccessibilityDelegate(mContext)); } if (mCanShowOwnerInfo) { mOwnerInfo = findViewById(R.id.owner_info); } mKeyguardSlice = findViewById(R.id.keyguard_status_area); mTextColor = mClockView.getCurrentTextColor(); Loading Loading @@ -189,7 +213,7 @@ public class KeyguardStatusView extends GridLayout { if (mLogoutView == null) { return; } mLogoutView.setVisibility(shouldShowLogout() ? VISIBLE : GONE); mLogoutView.setVisibility(mCanShowLogout && shouldShowLogout() ? VISIBLE : GONE); // Logout button will stay in language of user 0 if we don't set that manually. mLogoutView.setText(mContext.getResources().getString( com.android.internal.R.string.global_action_logout)); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +5 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV } /** * Get the height of the logout button. * Get the height of the owner information view. */ public int getOwnerInfoHeight() { return mView.getOwnerInfoHeight(); Loading Loading @@ -335,9 +335,13 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV // of the top of the view mKeyguardSliceViewController.updateTopMargin( mKeyguardClockSwitchController.getClockTextTopPadding()); mView.setCanShowOwnerInfo(false); mView.setCanShowLogout(false); } else { // reset margin mKeyguardSliceViewController.updateTopMargin(0); mView.setCanShowOwnerInfo(true); mView.setCanShowLogout(false); } updateAodIcons(); } Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java 0 → 100644 +155 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.keyguard; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.view.View; /** * Data class containing display information (message, icon, styling) for indication to show at * the bottom of the keyguard. * * See {@link com.android.systemui.statusbar.phone.KeyguardBottomAreaView}. */ public class KeyguardIndication { @NonNull private final CharSequence mMessage; @NonNull private final ColorStateList mTextColor; @Nullable private final Drawable mIcon; @Nullable private final View.OnClickListener mOnClickListener; @Nullable private final Drawable mBackground; private KeyguardIndication( CharSequence message, ColorStateList textColor, Drawable icon, View.OnClickListener onClickListener, Drawable background) { mMessage = message; mTextColor = textColor; mIcon = icon; mOnClickListener = onClickListener; mBackground = background; } /** * Message to display */ public @NonNull CharSequence getMessage() { return mMessage; } /** * TextColor to display the message. */ public @NonNull ColorStateList getTextColor() { return mTextColor; } /** * Icon to display. */ public @Nullable Drawable getIcon() { return mIcon; } /** * Click listener for messsage. */ public @Nullable View.OnClickListener getClickListener() { return mOnClickListener; } /** * Background for textView. */ public @Nullable Drawable getBackground() { return mBackground; } /** * KeyguardIndication Builder */ public static class Builder { private CharSequence mMessage; private Drawable mIcon; private View.OnClickListener mOnClickListener; private ColorStateList mTextColor; private Drawable mBackground; public Builder() { } /** * Required field. Message to display. */ public Builder setMessage(@NonNull CharSequence message) { this.mMessage = message; return this; } /** * Required field. Text color to use to display the message. */ public Builder setTextColor(@NonNull ColorStateList textColor) { this.mTextColor = textColor; return this; } /** * Optional. Icon to show next to the text. Icon location changes based on language * display direction. For LTR, icon shows to the left of the message. For RTL, icon shows * to the right of the message. */ public Builder setIcon(Drawable icon) { this.mIcon = icon; return this; } /** * Optional. Set a click listener on the message. */ public Builder setClickListener(View.OnClickListener onClickListener) { this.mOnClickListener = onClickListener; return this; } /** * Optional. Set a custom background on the TextView. */ public Builder setBackground(Drawable background) { this.mBackground = background; return this; } /** * Build the KeyguardIndication. */ public KeyguardIndication build() { if (mMessage == null) throw new IllegalStateException("message must be set"); if (mTextColor == null) throw new IllegalStateException("text color must be set"); return new KeyguardIndication( mMessage, mTextColor, mIcon, mOnClickListener, mBackground); } } }