diff options
5 files changed, 50 insertions, 99 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/camera/CameraGestureHelper.kt b/packages/SystemUI/src/com/android/systemui/camera/CameraGestureHelper.kt index 4fe2dd810a08..e2ef2477c836 100644 --- a/packages/SystemUI/src/com/android/systemui/camera/CameraGestureHelper.kt +++ b/packages/SystemUI/src/com/android/systemui/camera/CameraGestureHelper.kt @@ -33,7 +33,6 @@ import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.ActivityIntentHelper import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.plugins.ActivityStarter -import com.android.systemui.shade.NotificationPanelViewController import com.android.systemui.shared.system.ActivityManagerKt.isInForeground import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.phone.CentralSurfaces @@ -117,7 +116,7 @@ class CameraGestureHelper @Inject constructor( ) } catch (e: RemoteException) { Log.w( - NotificationPanelViewController.TAG, + "CameraGestureHelper", "Unable to start camera activity", e ) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelView.java index 9818af3751a7..1cdacb93ba45 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelView.java @@ -17,32 +17,30 @@ package com.android.systemui.shade; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.util.AttributeSet; +import android.view.MotionEvent; +import android.widget.FrameLayout; import com.android.systemui.R; import com.android.systemui.statusbar.phone.TapAgainView; -public class NotificationPanelView extends PanelView { +/** The shade view. */ +public final class NotificationPanelView extends FrameLayout { + static final boolean DEBUG = false; - private static final boolean DEBUG = false; - - /** - * Fling expanding QS. - */ - public static final int FLING_EXPAND = 0; - - public static final String COUNTER_PANEL_OPEN = "panel_open"; - public static final String COUNTER_PANEL_OPEN_QS = "panel_open_qs"; + private final Paint mAlphaPaint = new Paint(); private int mCurrentPanelAlpha; - private final Paint mAlphaPaint = new Paint(); private boolean mDozing; private RtlChangeListener mRtlChangeListener; + private NotificationPanelViewController.TouchHandler mTouchHandler; + private OnConfigurationChangedListener mOnConfigurationChangedListener; public NotificationPanelView(Context context, AttributeSet attrs) { super(context, attrs); @@ -99,7 +97,36 @@ public class NotificationPanelView extends PanelView { return findViewById(R.id.shade_falsing_tap_again); } + /** Sets the touch handler for this view. */ + public void setOnTouchListener(NotificationPanelViewController.TouchHandler touchHandler) { + super.setOnTouchListener(touchHandler); + mTouchHandler = touchHandler; + } + + void setOnConfigurationChangedListener(OnConfigurationChangedListener listener) { + mOnConfigurationChangedListener = listener; + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent event) { + return mTouchHandler.onInterceptTouchEvent(event); + } + + @Override + public void dispatchConfigurationChanged(Configuration newConfig) { + super.dispatchConfigurationChanged(newConfig); + mOnConfigurationChangedListener.onConfigurationChanged(newConfig); + } + + /** Callback for right-to-left setting changes. */ interface RtlChangeListener { + /** Called when right-to-left setting changes. */ void onRtlPropertielsChanged(int layoutDirection); } + + /** Callback for config changes. */ + interface OnConfigurationChangedListener { + /** Called when configuration changes. */ + void onConfigurationChanged(Configuration newConfig); + } } diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 3b7c7ce359b3..efdeba57489f 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -33,7 +33,7 @@ import static com.android.systemui.classifier.Classifier.GENERIC; import static com.android.systemui.classifier.Classifier.QS_COLLAPSE; import static com.android.systemui.classifier.Classifier.QUICK_SETTINGS; import static com.android.systemui.classifier.Classifier.UNLOCK; -import static com.android.systemui.shade.PanelView.DEBUG; +import static com.android.systemui.shade.NotificationPanelView.DEBUG; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; @@ -248,7 +248,7 @@ import javax.inject.Provider; @CentralSurfacesComponent.CentralSurfacesScope public final class NotificationPanelViewController { - public static final String TAG = PanelView.class.getSimpleName(); + public static final String TAG = "PanelView"; public static final float FLING_MAX_LENGTH_SECONDS = 0.6f; public static final float FLING_SPEED_UP_FACTOR = 0.6f; public static final float FLING_CLOSING_MAX_LENGTH_SECONDS = 0.6f; @@ -274,7 +274,7 @@ public final class NotificationPanelViewController { /** * Fling expanding QS. */ - private static final int FLING_EXPAND = 0; + public static final int FLING_EXPAND = 0; /** * Fling collapsing QS, potentially stopping when QS becomes QQS. @@ -435,7 +435,8 @@ public final class NotificationPanelViewController { private boolean mQsTracking; /** - * If set, the ongoing touch gesture might both trigger the expansion in {@link PanelView} and + * If set, the ongoing touch gesture might both trigger the expansion in {@link + * NotificationPanelView} and * the expansion for quick settings. */ private boolean mConflictingQsExpansionGesture; @@ -5417,13 +5418,13 @@ public final class NotificationPanelViewController { return animator; } - /** Update the visibility of {@link PanelView} if necessary. */ + /** Update the visibility of {@link NotificationPanelView} if necessary. */ public void updateVisibility() { mView.setVisibility(shouldPanelBeVisible() ? VISIBLE : INVISIBLE); } /** - * Updates the panel expansion and {@link PanelView} visibility if necessary. + * Updates the panel expansion and {@link NotificationPanelView} visibility if necessary. * * TODO(b/200063118): Could public calls to this method be replaced with calls to * {@link #updateVisibility()}? That would allow us to make this method private. @@ -6186,7 +6187,7 @@ public final class NotificationPanelViewController { } public class OnConfigurationChangedListener implements - PanelView.OnConfigurationChangedListener { + NotificationPanelView.OnConfigurationChangedListener { @Override public void onConfigurationChanged(Configuration newConfig) { loadDimens(); diff --git a/packages/SystemUI/src/com/android/systemui/shade/PanelView.java b/packages/SystemUI/src/com/android/systemui/shade/PanelView.java deleted file mode 100644 index 4349d816b3c3..000000000000 --- a/packages/SystemUI/src/com/android/systemui/shade/PanelView.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.systemui.shade; - -import android.content.Context; -import android.content.res.Configuration; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.widget.FrameLayout; - -import com.android.systemui.statusbar.phone.CentralSurfaces; -import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; -import com.android.systemui.statusbar.phone.KeyguardBottomAreaView; - -public abstract class PanelView extends FrameLayout { - public static final boolean DEBUG = false; - public static final String TAG = PanelView.class.getSimpleName(); - private NotificationPanelViewController.TouchHandler mTouchHandler; - - protected CentralSurfaces mCentralSurfaces; - protected HeadsUpManagerPhone mHeadsUpManager; - - protected KeyguardBottomAreaView mKeyguardBottomArea; - private OnConfigurationChangedListener mOnConfigurationChangedListener; - - public PanelView(Context context) { - super(context); - } - - public PanelView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public PanelView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public void setOnTouchListener(NotificationPanelViewController.TouchHandler touchHandler) { - super.setOnTouchListener(touchHandler); - mTouchHandler = touchHandler; - } - - public void setOnConfigurationChangedListener(OnConfigurationChangedListener listener) { - mOnConfigurationChangedListener = listener; - } - - @Override - public boolean onInterceptTouchEvent(MotionEvent event) { - return mTouchHandler.onInterceptTouchEvent(event); - } - - @Override - public void dispatchConfigurationChanged(Configuration newConfig) { - super.dispatchConfigurationChanged(newConfig); - mOnConfigurationChangedListener.onConfigurationChanged(newConfig); - } - - interface OnConfigurationChangedListener { - void onConfigurationChanged(Configuration newConfig); - } -} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java index 747c4debb771..52a45d6785ca 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesCommandQueueCallbacks.java @@ -55,7 +55,6 @@ import com.android.systemui.dagger.qualifiers.DisplayId; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.qs.QSPanelController; -import com.android.systemui.shade.NotificationPanelView; import com.android.systemui.shade.NotificationPanelViewController; import com.android.systemui.shade.ShadeController; import com.android.systemui.statusbar.CommandQueue; @@ -326,12 +325,12 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba mNotificationPanelViewController.expand(true /* animate */); mNotificationStackScrollLayoutController.setWillExpand(true); mHeadsUpManager.unpinAll(true /* userUnpinned */); - mMetricsLogger.count(NotificationPanelView.COUNTER_PANEL_OPEN, 1); + mMetricsLogger.count("panel_open", 1); } else if (!mNotificationPanelViewController.isInSettings() && !mNotificationPanelViewController.isExpanding()) { mNotificationPanelViewController.flingSettings(0 /* velocity */, - NotificationPanelView.FLING_EXPAND); - mMetricsLogger.count(NotificationPanelView.COUNTER_PANEL_OPEN_QS, 1); + NotificationPanelViewController.FLING_EXPAND); + mMetricsLogger.count("panel_open_qs", 1); } } |