diff --git a/packages/SystemUI/res/drawable/header_dot.xml b/packages/SystemUI/res/drawable/header_dot.xml new file mode 100644 index 0000000000000..568a9c29175a2 --- /dev/null +++ b/packages/SystemUI/res/drawable/header_dot.xml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml index 187316885f9f8..bb37b83af3366 100644 --- a/packages/SystemUI/res/layout/qs_panel.xml +++ b/packages/SystemUI/res/layout/qs_panel.xml @@ -19,7 +19,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/qs_background_primary" - android:paddingTop="8dp" android:paddingBottom="8dp" android:elevation="2dp"> diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml index 8124eb78c0237..e949adc8a7487 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml @@ -33,16 +33,6 @@ android:focusable="true" > - - + android:layout_marginTop="30dp" + android:layout_marginEnd="16dp"> - - - - - + + + + - 8 + 6 diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index a0052cec986e5..388da17301e8a 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -117,7 +117,7 @@ 4000 - 7 + 5 true diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 25ff6b12c2b17..67f915795f103 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -107,7 +107,7 @@ 32dp - 60dp + 90dp 116dp diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml index 8dcf8a7bc60fe..e31927eb9cec0 100644 --- a/packages/SystemUI/res/xml/tuner_prefs.xml +++ b/packages/SystemUI/res/xml/tuner_prefs.xml @@ -18,25 +18,10 @@ xmlns:sysui="http://schemas.android.com/apk/res-auto" android:title="@string/system_ui_tuner"> - - - - - - - - - - - - + diff --git a/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java b/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java index cb6708e4aec5c..699273aad6124 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java +++ b/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java @@ -98,7 +98,7 @@ public class PseudoGridView extends ViewGroup { } } - setMeasuredDimension(width, getDefaultSize(totalHeight, heightMeasureSpec)); + setMeasuredDimension(width, resolveSizeAndState(totalHeight, heightMeasureSpec, 0)); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java index 5d3fbe2aa9347..ae8542ad9d882 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java @@ -19,14 +19,12 @@ package com.android.systemui.qs; import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.AnimatorListenerAdapter; -import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Handler; import android.os.Message; -import android.provider.Settings; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; @@ -36,7 +34,6 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; - import com.android.internal.logging.MetricsLogger; import com.android.systemui.FontSizeUtils; import com.android.systemui.R; @@ -56,7 +53,6 @@ import java.util.Collection; public class QSPanel extends FrameLayout implements Tunable { public static final String QS_SHOW_BRIGHTNESS = "qs_show_brightness"; - public static final String QS_THE_NEW_QS = "qs_paged_panel"; protected final Context mContext; protected final ArrayList mRecords = new ArrayList(); @@ -102,20 +98,25 @@ public class QSPanel extends FrameLayout implements Tunable { updateDetailText(); mDetail.setVisibility(GONE); mDetail.setClickable(true); - mBrightnessView = LayoutInflater.from(context).inflate( - R.layout.quick_settings_brightness_dialog, this, false); - mFooter = new QSFooter(this, context); addView(mDetail); mQsContainer = new LinearLayout(mContext); mQsContainer.setOrientation(LinearLayout.VERTICAL); mQsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); - addView(mQsContainer); + mBrightnessView = LayoutInflater.from(context).inflate( + R.layout.quick_settings_brightness_dialog, this, false); mQsContainer.addView(mBrightnessView); + + mTileLayout = (QSTileLayout) LayoutInflater.from(mContext).inflate( + R.layout.qs_paged_tile_layout, mQsContainer, false); + mQsContainer.addView((View) mTileLayout); + + mFooter = new QSFooter(this, context); mQsContainer.addView(mFooter.getView()); + mClipper = new QSDetailClipper(mDetail); updateResources(); @@ -136,7 +137,7 @@ public class QSPanel extends FrameLayout implements Tunable { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - TunerService.get(mContext).addTunable(this, QS_SHOW_BRIGHTNESS, QS_THE_NEW_QS); + TunerService.get(mContext).addTunable(this, QS_SHOW_BRIGHTNESS); } @Override @@ -150,36 +151,15 @@ public class QSPanel extends FrameLayout implements Tunable { if (QS_SHOW_BRIGHTNESS.equals(key)) { mBrightnessView.setVisibility(newValue == null || Integer.parseInt(newValue) != 0 ? VISIBLE : GONE); - } else if (QS_THE_NEW_QS.equals(key)) { - boolean theNewQs = newValue != null && Integer.parseInt(newValue) != 0; - if (mTileLayout != null) { - for (int i = 0; i < mRecords.size(); i++) { - mTileLayout.removeTile(mRecords.get(i)); - } - mQsContainer.removeView((View) mTileLayout); - } - int layout = theNewQs - ? R.layout.qs_paged_tile_layout : R.layout.qs_tile_layout; - mTileLayout = - (QSTileLayout) LayoutInflater.from(mContext).inflate(layout, mQsContainer, false); - mQsContainer.addView((View) mTileLayout, 1 /* Between brightness and footer */); - for (int i = 0; i < mRecords.size(); i++) { - mTileLayout.addTile(mRecords.get(i)); - } - if (theNewQs) { - mCustomizePanel = (QSCustomizer) LayoutInflater.from(mContext) - .inflate(R.layout.qs_customize_panel, null); - mCustomizePanel.setHost(mHost); - } else { - if (mCustomizePanel != null && mCustomizePanel.isCustomizing()) { - mCustomizePanel.hide(mCustomizePanel.getWidth() / 2, - mCustomizePanel.getHeight() / 2); - } - mCustomizePanel = null; - } } } + protected void createCustomizePanel() { + mCustomizePanel = (QSCustomizer) LayoutInflater.from(mContext) + .inflate(R.layout.qs_customize_panel, null); + mCustomizePanel.setHost(mHost); + } + private void updateDetailText() { mDetailDoneButton.setText(R.string.quick_settings_done); mDetailSettingsButton.setText(R.string.quick_settings_more_settings); @@ -200,6 +180,7 @@ public class QSPanel extends FrameLayout implements Tunable { public void setHost(QSTileHost host) { mHost = host; mFooter.setHost(host); + createCustomizePanel(); } public QSTileHost getHost() { @@ -608,9 +589,4 @@ public class QSPanel extends FrameLayout implements Tunable { int getOffsetTop(TileRecord tile); void updateResources(); } - - public static boolean isTheNewQS(Context context) { - return Settings.Secure.getIntForUser(context.getContentResolver(), QS_THE_NEW_QS, - ActivityManager.getCurrentUser(), 0) != 0; - } } diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java index fe8ce9bd799da..bda46756e1aa5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java @@ -128,9 +128,10 @@ public class QuickQSPanel extends QSPanel { } private LayoutParams generateLayoutParams() { - int size = - mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size); - LayoutParams lp = new LayoutParams(size, size); + int size = mContext.getResources().getDimensionPixelSize(R.dimen.qs_quick_tile_size); + LayoutParams lp = new LayoutParams(0, size); + lp.weight = 1; + lp.gravity = Gravity.CENTER; return lp; } diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomQSPanel.java index 8dda9ba51083d..87c2973592b67 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomQSPanel.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomQSPanel.java @@ -81,6 +81,11 @@ public class CustomQSPanel extends QSPanel { } } + @Override + protected void createCustomizePanel() { + // Already in CustomizePanel. + } + public void tileSelected(QSTile tile, ClipData currentClip) { String sourceSpec = getSpec(currentClip); String destSpec = tile.getTileSpec(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java index baad370ca0140..4a7d67f9fe385 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/QSCustomizer.java @@ -37,9 +37,7 @@ import android.widget.LinearLayout; import android.widget.ListView; import android.widget.Toolbar; import android.widget.Toolbar.OnMenuItemClickListener; - import com.android.systemui.R; -import com.android.systemui.SystemUIApplication; import com.android.systemui.qs.QSDetailClipper; import com.android.systemui.qs.QSTile.Host.Callback; import com.android.systemui.qs.customize.DropButton.OnDropListener; @@ -80,14 +78,13 @@ public class QSCustomizer extends LinearLayout implements OnMenuItemClickListene public QSCustomizer(Context context, AttributeSet attrs) { super(new ContextThemeWrapper(context, android.R.style.Theme_Material), attrs); - mPhoneStatusBar = ((SystemUIApplication) mContext.getApplicationContext()) - .getComponent(PhoneStatusBar.class); mClipper = new QSDetailClipper(this); } public void setHost(QSTileHost host) { mHost = host; mHost.addCallback(this); + mPhoneStatusBar = host.getPhoneStatusBar(); mQsPanel.setTiles(mHost.getTiles()); mQsPanel.setHost(mHost); mQsPanel.setSavedTiles(); diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index 5fb76c8334e2d..6c7b33730eecc 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -85,6 +85,14 @@ public class CellularTile extends QSTile { } } + @Override + protected void handleSecondaryClick() { + boolean dataEnabled = mDataController.isMobileDataSupported() + && mDataController.isMobileDataEnabled(); + MetricsLogger.action(mContext, MetricsLogger.QS_CELLULAR_TOGGLE, !dataEnabled); + mDataController.setMobileDataEnabled(!dataEnabled); + } + @Override protected void handleUpdateState(SignalState state, Object arg) { CallbackInfo cb = (CallbackInfo) arg; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 73ee363a61cf2..6a2b32d519588 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -44,7 +44,6 @@ import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; import android.widget.FrameLayout; import android.widget.TextView; - import com.android.internal.logging.MetricsLogger; import com.android.keyguard.KeyguardStatusView; import com.android.systemui.DejankUtils; @@ -65,7 +64,6 @@ import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.KeyguardUserSwitcher; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.stack.StackStateAnimator; -import com.android.systemui.tuner.TunerService; import java.util.List; @@ -73,7 +71,7 @@ public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener, KeyguardAffordanceHelper.Callback, NotificationStackScrollLayout.OnEmptySpaceClickListener, - HeadsUpManager.OnHeadsUpChangedListener, TunerService.Tunable { + HeadsUpManager.OnHeadsUpChangedListener { private static final boolean DEBUG = false; @@ -221,40 +219,21 @@ public class NotificationPanelView extends PanelView implements private final Interpolator mTouchResponseInterpolator = new PathInterpolator(0.3f, 0f, 0.1f, 1f); - private boolean mNewQs; - public NotificationPanelView(Context context, AttributeSet attrs) { super(context, attrs); setWillNotDraw(!DEBUG); mFalsingManager = FalsingManager.getInstance(context); - TunerService.get(context).addTunable(this, QSPanel.QS_THE_NEW_QS); } public void setStatusBar(PhoneStatusBar bar) { mStatusBar = bar; } - @Override - public void onTuningChanged(String key, String newValue) { - if (QSPanel.QS_THE_NEW_QS.equals(key)) { - boolean b = newValue != null && Integer.parseInt(newValue) != 0; - if (mNewQs != b) { - if (mHeader != null) { - // We are too late, no good way to re-initialize yet, just die and come back up. - android.os.Process.killProcess(android.os.Process.myPid()); - } else { - mNewQs = b; - } - } - } - } - @Override protected void onFinishInflate() { super.onFinishInflate(); ViewStub stub = (ViewStub) findViewById(R.id.status_bar_header); - stub.setLayoutResource(mNewQs - ? R.layout.quick_status_bar_expanded_header : R.layout.status_bar_expanded_header); + stub.setLayoutResource(R.layout.quick_status_bar_expanded_header); mHeader = (BaseStatusBarHeader) stub.inflate(); mHeader.setOnClickListener(this); mKeyguardStatusBar = (KeyguardStatusBarView) findViewById(R.id.keyguard_header); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java index c740b082e9902..7f27ba72e9e48 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java @@ -133,7 +133,7 @@ public final class QSTileHost extends IQSService.Stub implements QSTile.Host, Tu TunerService.get(mContext).addTunable(this, TILES_SETTING); } - PhoneStatusBar getPhoneStatusBar() { + public PhoneStatusBar getPhoneStatusBar() { return mStatusBar; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java index 26ff97a65ac4f..c4930a9d1750c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java @@ -24,12 +24,14 @@ import android.graphics.Rect; import android.graphics.drawable.Animatable; import android.graphics.drawable.RippleDrawable; import android.util.AttributeSet; +import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; +import com.android.keyguard.KeyguardStatusView; import com.android.systemui.R; import com.android.systemui.qs.QSPanel; import com.android.systemui.qs.QSTile; @@ -42,6 +44,7 @@ import com.android.systemui.tuner.TunerService; public class QuickStatusBarHeader extends BaseStatusBarHeader implements NextAlarmController.NextAlarmChangeCallback, View.OnClickListener { + private static final String TAG = "QuickStatusBarHeader"; private ActivityStarter mActivityStarter; private NextAlarmController mNextAlarmController; private SettingsButton mSettingsButton; @@ -118,14 +121,15 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements @Override public void setExpanded(boolean expanded) { mExpanded = expanded; + updateEverything(); } @Override public void onNextAlarmChanged(AlarmManager.AlarmClockInfo nextAlarm) { mNextAlarm = nextAlarm; + Log.d(TAG, "Got alarm update " + (nextAlarm != null)); if (nextAlarm != null) { - // TODO:... -// mAlarmStatus.setText(KeyguardStatusView.formatNextAlarm(getContext(), nextAlarm)); + mAlarmStatus.setText(KeyguardStatusView.formatNextAlarm(getContext(), nextAlarm)); } mAlarmShowing = nextAlarm != null; updateEverything(); @@ -154,7 +158,7 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements } private void updateVisibilities() { - mAlarmStatus.setVisibility(mExpanded && mAlarmShowing ? View.VISIBLE : View.GONE); + mAlarmStatus.setVisibility(mAlarmShowing ? View.VISIBLE : View.GONE); mQsDetailHeader.setVisibility(mExpanded && mShowingDetail ? View.VISIBLE : View.INVISIBLE); mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility( TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE); @@ -162,8 +166,10 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements private void updateListeners() { if (mListening) { + Log.d(TAG, "Listening for Alarms"); mNextAlarmController.addStateChangedCallback(this); } else { + Log.d(TAG, "Not listening for Alarms"); mNextAlarmController.removeStateChangedCallback(this); } } @@ -193,7 +199,7 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements host.getBatteryController()); mHeaderQsPanel.setQSPanelAndHeader(mQsPanel, this); mHeaderQsPanel.setHost(myHost); - mHeaderQsPanel.setMaxTiles(3); + mHeaderQsPanel.setMaxTiles(5); mHeaderQsPanel.setTiles(myHost.getTiles()); myHost.addCallback(new QSTile.Host.Callback() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java index 6cda561bd08ff..3d21f44e4e24c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -59,7 +59,7 @@ import java.text.NumberFormat; */ public class StatusBarHeaderView extends BaseStatusBarHeader implements View.OnClickListener, BatteryController.BatteryStateChangeCallback, NextAlarmController.NextAlarmChangeCallback, - EmergencyListener, TunerService.Tunable { + EmergencyListener { private boolean mExpanded; private boolean mListening; @@ -234,28 +234,6 @@ public class StatusBarHeaderView extends BaseStatusBarHeader implements View.OnC updateClockCollapsedMargin(); } - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - TunerService.get(mContext).addTunable(this, QSPanel.QS_THE_NEW_QS); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - TunerService.get(mContext).removeTunable(this); - } - - @Override - public void onTuningChanged(String key, String newValue) { - if (QSPanel.QS_THE_NEW_QS.equals(key)) { - mAllowExpand = newValue == null || Integer.parseInt(newValue) == 0; - if (!mAllowExpand) { - setExpanded(false); - } - } - } - private void updateClockCollapsedMargin() { Resources res = getResources(); int padding = res.getDimensionPixelSize(R.dimen.clock_collapsed_bottom_margin);