Files
frameworks_base/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
Hawkwood Glazier 843cd5ea89 [DO NOT MERGE] Revert "[DO NOT MERGE]Revert "Migrate KeyguardClockSwitch to new..."
Revert "[DO NOT MERGE]Revert "Expose the clock version of google..."

Revert "[DO NOT MERGE]Revert "Changes to SystemUIGoogle to suppo..."

Revert submission 19508951-revert-19451291-cherrypick-clock_migration-tvip0m638i-BKWSUCNJAV

Reason for revert: Double Revert w/ fixes
Reverted Changes:
Iccd8d2e19:[DO NOT MERGE]Revert "Add clock version of google-...
I432d3d814:[DO NOT MERGE]Revert "Migrate KeyguardClockSwitch ...
Ifd0aa59df:[DO NOT MERGE]Revert "Expose the clock version of ...
I9a6ca6349:[DO NOT MERGE]Revert "Changes to SystemUIGoogle to...

To minimize merge issues, this topic consists of just cherry-picks from
master. Fixes for bugs are provided as downstream commits and will be
merged back to master as those bugs exist there as well. The commits
in this topic weren't tested in isolation beyond automated testing.

Additionally, I've updated the ktfmt exclude list to include new files
from this cherry-pick instead of reformatting those files.

Test: Screenshot test and manually validated each downstream fix mostly by
comparing reference images from known good builds to test builds.

Change-Id: Iff1d0ee8c6d09c77185be1ca5bbbe1aa5870e0c7
2022-08-31 22:26:07 +00:00

116 lines
3.6 KiB
Java

/*
* Copyright (C) 2012 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.keyguard;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridLayout;
import com.android.systemui.R;
import com.android.systemui.statusbar.CrossFadeHelper;
import java.io.PrintWriter;
import java.util.Set;
/**
* View consisting of:
* - keyguard clock
* - media player (split shade mode only)
*/
public class KeyguardStatusView extends GridLayout {
private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String TAG = "KeyguardStatusView";
private ViewGroup mStatusViewContainer;
private KeyguardClockSwitch mClockView;
private KeyguardSliceView mKeyguardSlice;
private View mMediaHostContainer;
private float mDarkAmount = 0;
public KeyguardStatusView(Context context) {
this(context, null, 0);
}
public KeyguardStatusView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public KeyguardStatusView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mStatusViewContainer = findViewById(R.id.status_view_container);
mClockView = findViewById(R.id.keyguard_clock_container);
if (KeyguardClockAccessibilityDelegate.isNeeded(mContext)) {
mClockView.setAccessibilityDelegate(new KeyguardClockAccessibilityDelegate(mContext));
}
mKeyguardSlice = findViewById(R.id.keyguard_slice_view);
mMediaHostContainer = findViewById(R.id.status_view_media_container);
updateDark();
}
void setDarkAmount(float darkAmount) {
if (mDarkAmount == darkAmount) {
return;
}
mDarkAmount = darkAmount;
CrossFadeHelper.fadeOut(mMediaHostContainer, darkAmount);
updateDark();
}
void updateDark() {
mKeyguardSlice.setDarkAmount(mDarkAmount);
}
/** Sets a translationY value on every child view except for the media view. */
public void setChildrenTranslationYExcludingMediaView(float translationY) {
setChildrenTranslationYExcluding(translationY, Set.of(mMediaHostContainer));
}
/** Sets a translationY value on every view except for the views in the provided set. */
private void setChildrenTranslationYExcluding(float translationY, Set<View> excludedViews) {
for (int i = 0; i < mStatusViewContainer.getChildCount(); i++) {
final View child = mStatusViewContainer.getChildAt(i);
if (!excludedViews.contains(child)) {
child.setTranslationY(translationY);
}
}
}
public void dump(PrintWriter pw, String[] args) {
pw.println("KeyguardStatusView:");
pw.println(" mDarkAmount: " + mDarkAmount);
if (mClockView != null) {
mClockView.dump(pw, args);
}
if (mKeyguardSlice != null) {
mKeyguardSlice.dump(pw, args);
}
}
}