Loading core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2612,8 +2612,8 @@ <item>lockdown</item> <item>logout</item> <item>bugreport</item> <item>emergency</item> <item>screenshot</item> <item>emergency</item> </string-array> <!-- Number of milliseconds to hold a wake lock to ensure that drawing is fully Loading packages/SystemUI/res/drawable/faster_emergency_icon.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2018 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. --> <!-- TODO: For demo only, will change content after UI team provide new faster emergency icon. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0" android:tint="?attr/colorControlNormal"> <path android:fillColor="#D93025" android:pathData="M0,0h24v24H0z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M19,3H5c-1.1,0-1.99,0.9,-1.99,2L3,19c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2zm-1,11h-4v4h-4v-4H6v-4h4V6h4v4h4v4z" /> </vector> packages/SystemUI/res/layout/global_actions_wrapped.xml +16 −2 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="top|right" android:layout_marginBottom="0dp" android:orientation="vertical" android:paddingTop="@dimen/global_actions_top_padding" android:clipToPadding="false" android:theme="@style/qs_theme" Loading @@ -17,7 +19,19 @@ android:layout_gravity="top|right" android:gravity="center" android:orientation="vertical" android:padding="12dp" android:translationZ="9dp" /> android:padding="@dimen/global_actions_padding" android:translationZ="@dimen/global_actions_translate" /> <!-- For separated button--> <FrameLayout android:id="@+id/separated_button" android:layout_width="@dimen/global_actions_panel_width" android:layout_height="wrap_content" android:layout_gravity="top|right" android:layout_marginTop="6dp" android:gravity="center" android:orientation="vertical" android:padding="@dimen/global_actions_padding" android:translationZ="@dimen/global_actions_translate" /> </com.android.systemui.HardwareUiLayout> packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,10 @@ <dimen name="global_actions_top_padding">120dp</dimen> <dimen name="global_actions_padding">12dp</dimen> <dimen name="global_actions_translate">9dp</dimen> <!-- the maximum offset in either direction that elements are moved horizontally to prevent burn-in on AOD --> <dimen name="burn_in_prevention_offset_x">8dp</dimen> Loading packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java +62 −5 Original line number Diff line number Diff line Loading @@ -27,24 +27,22 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.LinearLayout; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; import static com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_NONE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE; public class HardwareUiLayout extends FrameLayout implements Tunable { public class HardwareUiLayout extends LinearLayout implements Tunable { private static final String EDGE_BLEED = "sysui_hwui_edge_bleed"; private static final String ROUNDED_DIVIDER = "sysui_hwui_rounded_divider"; private final int[] mTmp2 = new int[2]; private View mChild; private View mSeparatedView; private int mOldHeight; private boolean mAnimating; private AnimatorSet mAnimation; Loading @@ -53,6 +51,7 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { private HardwareBgDrawable mBackground; private Animator mAnimator; private boolean mCollapse; private boolean mHasSeparatedButton; private int mEndPoint; private boolean mEdgeBleed; private boolean mRoundedDivider; Loading Loading @@ -94,6 +93,7 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { mBackground = new HardwareBgDrawable(mRoundedDivider, !mEdgeBleed, getContext()); if (mChild != null) { mChild.setBackground(mBackground); mSeparatedView.setBackground(mBackground); requestLayout(); } } Loading @@ -110,6 +110,18 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { } mChild.setLayoutParams(params); } if (mSeparatedView != null) { MarginLayoutParams params = (MarginLayoutParams) mSeparatedView.getLayoutParams(); if (mRotation == ROTATION_LANDSCAPE) { params.topMargin = edge; } else if (mRotation == ROTATION_SEASCAPE) { params.bottomMargin = edge; } else { params.rightMargin = edge; } mSeparatedView.setLayoutParams(params); } } private int getEdgePadding() { Loading @@ -123,6 +135,8 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { if (getChildCount() != 0) { mChild = getChildAt(0); mChild.setBackground(mBackground); mSeparatedView = getChildAt(1); mSeparatedView.setBackground(mBackground); updateEdgeMargin(mEdgeBleed ? 0 : getEdgePadding()); mOldHeight = mChild.getMeasuredHeight(); mChild.addOnLayoutChangeListener( Loading Loading @@ -170,6 +184,17 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { } else { rotateLeft(); } if (mHasSeparatedButton) { if (from == ROTATION_SEASCAPE || to == ROTATION_SEASCAPE) { // Separated view has top margin, so seascape separated view need special rotation, // not a full left or right rotation. swapLeftAndTop(mSeparatedView); } else if (from == ROTATION_LANDSCAPE) { rotateRight(mSeparatedView); } else { rotateLeft(mSeparatedView); } } if (to != ROTATION_NONE) { if (mChild instanceof LinearLayout) { mRotatedBackground = true; Loading @@ -177,8 +202,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LinearLayout linearLayout = (LinearLayout) mChild; if (mSwapOrientation) { linearLayout.setOrientation(LinearLayout.HORIZONTAL); setOrientation(LinearLayout.HORIZONTAL); } swapDimens(this.mChild); swapDimens(mChild); swapDimens(mSeparatedView); } } else { if (mChild instanceof LinearLayout) { Loading @@ -187,8 +214,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LinearLayout linearLayout = (LinearLayout) mChild; if (mSwapOrientation) { linearLayout.setOrientation(LinearLayout.VERTICAL); setOrientation(LinearLayout.VERTICAL); } swapDimens(mChild); swapDimens(mSeparatedView); } } } Loading @@ -201,6 +230,12 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LayoutParams p = (LayoutParams) mChild.getLayoutParams(); p.gravity = rotateGravityRight(p.gravity); mChild.setLayoutParams(p); LayoutParams separatedViewLayoutParams = (LayoutParams) mSeparatedView.getLayoutParams(); separatedViewLayoutParams.gravity = rotateGravityRight(separatedViewLayoutParams.gravity); mSeparatedView.setLayoutParams(separatedViewLayoutParams); setGravity(p.gravity); } private void swapDimens(View v) { Loading Loading @@ -253,6 +288,12 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LayoutParams p = (LayoutParams) mChild.getLayoutParams(); p.gravity = rotateGravityLeft(p.gravity); mChild.setLayoutParams(p); LayoutParams separatedViewLayoutParams = (LayoutParams) mSeparatedView.getLayoutParams(); separatedViewLayoutParams.gravity = rotateGravityLeft(separatedViewLayoutParams.gravity); mSeparatedView.setLayoutParams(separatedViewLayoutParams); setGravity(p.gravity); } private int rotateGravityLeft(int gravity) { Loading Loading @@ -310,6 +351,15 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { v.setLayoutParams(params); } private void swapLeftAndTop(View v) { v.setPadding(v.getPaddingTop(), v.getPaddingLeft(), v.getPaddingBottom(), v.getPaddingRight()); MarginLayoutParams params = (MarginLayoutParams) v.getLayoutParams(); params.setMargins(params.topMargin, params.leftMargin, params.bottomMargin, params.rightMargin); v.setLayoutParams(params); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); Loading Loading @@ -351,6 +401,9 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { private void updatePosition() { if (mChild == null) return; // If got separated button, setRotatedBackground to false, // all items won't get white background. mBackground.setRotatedBackground(mHasSeparatedButton); if (mDivision != null && mDivision.getVisibility() == VISIBLE) { int index = mRotatedBackground ? 0 : 1; mDivision.getLocationOnScreen(mTmp2); Loading Loading @@ -404,6 +457,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { mCollapse = true; } public void setHasSeparatedButton(boolean hasSeparatedButton) { mHasSeparatedButton = hasSeparatedButton; } public static HardwareUiLayout get(View v) { if (v instanceof HardwareUiLayout) return (HardwareUiLayout) v; if (v.getParent() instanceof View) { Loading Loading
core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2612,8 +2612,8 @@ <item>lockdown</item> <item>logout</item> <item>bugreport</item> <item>emergency</item> <item>screenshot</item> <item>emergency</item> </string-array> <!-- Number of milliseconds to hold a wake lock to ensure that drawing is fully Loading
packages/SystemUI/res/drawable/faster_emergency_icon.xml 0 → 100644 +30 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2018 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. --> <!-- TODO: For demo only, will change content after UI team provide new faster emergency icon. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24.0dp" android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0" android:tint="?attr/colorControlNormal"> <path android:fillColor="#D93025" android:pathData="M0,0h24v24H0z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M19,3H5c-1.1,0-1.99,0.9,-1.99,2L3,19c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5c0-1.1-0.9-2-2-2zm-1,11h-4v4h-4v-4H6v-4h4V6h4v4h4v4z" /> </vector>
packages/SystemUI/res/layout/global_actions_wrapped.xml +16 −2 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="top|right" android:layout_marginBottom="0dp" android:orientation="vertical" android:paddingTop="@dimen/global_actions_top_padding" android:clipToPadding="false" android:theme="@style/qs_theme" Loading @@ -17,7 +19,19 @@ android:layout_gravity="top|right" android:gravity="center" android:orientation="vertical" android:padding="12dp" android:translationZ="9dp" /> android:padding="@dimen/global_actions_padding" android:translationZ="@dimen/global_actions_translate" /> <!-- For separated button--> <FrameLayout android:id="@+id/separated_button" android:layout_width="@dimen/global_actions_panel_width" android:layout_height="wrap_content" android:layout_gravity="top|right" android:layout_marginTop="6dp" android:gravity="center" android:orientation="vertical" android:padding="@dimen/global_actions_padding" android:translationZ="@dimen/global_actions_translate" /> </com.android.systemui.HardwareUiLayout>
packages/SystemUI/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -918,6 +918,10 @@ <dimen name="global_actions_top_padding">120dp</dimen> <dimen name="global_actions_padding">12dp</dimen> <dimen name="global_actions_translate">9dp</dimen> <!-- the maximum offset in either direction that elements are moved horizontally to prevent burn-in on AOD --> <dimen name="burn_in_prevention_offset_x">8dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/HardwareUiLayout.java +62 −5 Original line number Diff line number Diff line Loading @@ -27,24 +27,22 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.LinearLayout; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; import com.android.systemui.util.leak.RotationUtils; import java.util.ArrayList; import static com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_NONE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE; public class HardwareUiLayout extends FrameLayout implements Tunable { public class HardwareUiLayout extends LinearLayout implements Tunable { private static final String EDGE_BLEED = "sysui_hwui_edge_bleed"; private static final String ROUNDED_DIVIDER = "sysui_hwui_rounded_divider"; private final int[] mTmp2 = new int[2]; private View mChild; private View mSeparatedView; private int mOldHeight; private boolean mAnimating; private AnimatorSet mAnimation; Loading @@ -53,6 +51,7 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { private HardwareBgDrawable mBackground; private Animator mAnimator; private boolean mCollapse; private boolean mHasSeparatedButton; private int mEndPoint; private boolean mEdgeBleed; private boolean mRoundedDivider; Loading Loading @@ -94,6 +93,7 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { mBackground = new HardwareBgDrawable(mRoundedDivider, !mEdgeBleed, getContext()); if (mChild != null) { mChild.setBackground(mBackground); mSeparatedView.setBackground(mBackground); requestLayout(); } } Loading @@ -110,6 +110,18 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { } mChild.setLayoutParams(params); } if (mSeparatedView != null) { MarginLayoutParams params = (MarginLayoutParams) mSeparatedView.getLayoutParams(); if (mRotation == ROTATION_LANDSCAPE) { params.topMargin = edge; } else if (mRotation == ROTATION_SEASCAPE) { params.bottomMargin = edge; } else { params.rightMargin = edge; } mSeparatedView.setLayoutParams(params); } } private int getEdgePadding() { Loading @@ -123,6 +135,8 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { if (getChildCount() != 0) { mChild = getChildAt(0); mChild.setBackground(mBackground); mSeparatedView = getChildAt(1); mSeparatedView.setBackground(mBackground); updateEdgeMargin(mEdgeBleed ? 0 : getEdgePadding()); mOldHeight = mChild.getMeasuredHeight(); mChild.addOnLayoutChangeListener( Loading Loading @@ -170,6 +184,17 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { } else { rotateLeft(); } if (mHasSeparatedButton) { if (from == ROTATION_SEASCAPE || to == ROTATION_SEASCAPE) { // Separated view has top margin, so seascape separated view need special rotation, // not a full left or right rotation. swapLeftAndTop(mSeparatedView); } else if (from == ROTATION_LANDSCAPE) { rotateRight(mSeparatedView); } else { rotateLeft(mSeparatedView); } } if (to != ROTATION_NONE) { if (mChild instanceof LinearLayout) { mRotatedBackground = true; Loading @@ -177,8 +202,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LinearLayout linearLayout = (LinearLayout) mChild; if (mSwapOrientation) { linearLayout.setOrientation(LinearLayout.HORIZONTAL); setOrientation(LinearLayout.HORIZONTAL); } swapDimens(this.mChild); swapDimens(mChild); swapDimens(mSeparatedView); } } else { if (mChild instanceof LinearLayout) { Loading @@ -187,8 +214,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LinearLayout linearLayout = (LinearLayout) mChild; if (mSwapOrientation) { linearLayout.setOrientation(LinearLayout.VERTICAL); setOrientation(LinearLayout.VERTICAL); } swapDimens(mChild); swapDimens(mSeparatedView); } } } Loading @@ -201,6 +230,12 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LayoutParams p = (LayoutParams) mChild.getLayoutParams(); p.gravity = rotateGravityRight(p.gravity); mChild.setLayoutParams(p); LayoutParams separatedViewLayoutParams = (LayoutParams) mSeparatedView.getLayoutParams(); separatedViewLayoutParams.gravity = rotateGravityRight(separatedViewLayoutParams.gravity); mSeparatedView.setLayoutParams(separatedViewLayoutParams); setGravity(p.gravity); } private void swapDimens(View v) { Loading Loading @@ -253,6 +288,12 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { LayoutParams p = (LayoutParams) mChild.getLayoutParams(); p.gravity = rotateGravityLeft(p.gravity); mChild.setLayoutParams(p); LayoutParams separatedViewLayoutParams = (LayoutParams) mSeparatedView.getLayoutParams(); separatedViewLayoutParams.gravity = rotateGravityLeft(separatedViewLayoutParams.gravity); mSeparatedView.setLayoutParams(separatedViewLayoutParams); setGravity(p.gravity); } private int rotateGravityLeft(int gravity) { Loading Loading @@ -310,6 +351,15 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { v.setLayoutParams(params); } private void swapLeftAndTop(View v) { v.setPadding(v.getPaddingTop(), v.getPaddingLeft(), v.getPaddingBottom(), v.getPaddingRight()); MarginLayoutParams params = (MarginLayoutParams) v.getLayoutParams(); params.setMargins(params.topMargin, params.leftMargin, params.bottomMargin, params.rightMargin); v.setLayoutParams(params); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); Loading Loading @@ -351,6 +401,9 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { private void updatePosition() { if (mChild == null) return; // If got separated button, setRotatedBackground to false, // all items won't get white background. mBackground.setRotatedBackground(mHasSeparatedButton); if (mDivision != null && mDivision.getVisibility() == VISIBLE) { int index = mRotatedBackground ? 0 : 1; mDivision.getLocationOnScreen(mTmp2); Loading Loading @@ -404,6 +457,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable { mCollapse = true; } public void setHasSeparatedButton(boolean hasSeparatedButton) { mHasSeparatedButton = hasSeparatedButton; } public static HardwareUiLayout get(View v) { if (v instanceof HardwareUiLayout) return (HardwareUiLayout) v; if (v.getParent() instanceof View) { Loading