MK Android P 长按power键添加情景,飞行,重启等

--- a/frameworks/base/core/res/res/values/config.xml
+++ b/frameworks/base/core/res/res/values/config.xml
@@ -2578,10 +2578,10 @@
     <string-array translatable="false" name="config_globalActionsList">
         <item>power</item>
         <item>restart</item>
-        <item>lockdown</item>
-        <item>logout</item>
-        <item>bugreport</item>
         <item>screenshot</item>
+        <item>airplane</item>
+        <item>silent</item>
+        <item>users</item>
     </string-array>
 
     <!-- Number of milliseconds to hold a wake lock to ensure that drawing is fully
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_item.xml b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_item.xml
old mode 100644 (file)
new mode 100755 (executable)
index 66a4b73..5f9bed6
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_item.xml
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_item.xml
@@ -1,60 +1,41 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<!-- RelativeLayouts have an issue enforcing minimum heights, so just
-     work around this for now with LinearLayouts. -->
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:layout_gravity="center"
-    android:minWidth="92dp"
-    android:minHeight="92dp"
-    android:gravity="center"
-    android:orientation="vertical"
-    android:paddingEnd="4dip"
-    android:paddingStart="4dip">
-
-    <ImageView
-        android:id="@*android:id/icon"
-        android:layout_width="24dp"
-        android:layout_height="24dp"
-        android:layout_gravity="center"
-        android:scaleType="center"
-        android:alpha="?android:attr/primaryContentAlpha"
-    />
-
-    <TextView
-        android:id="@*android:id/message"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="top|center_horizontal"
-        android:paddingTop="10dp"
-        android:gravity="center"
-        android:textSize="12sp"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        />
-
-    <TextView
-        android:id="@*android:id/status"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="top|center_horizontal"
-        android:gravity="center"
-        android:textColor="?android:attr/textColorTertiary"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        />
+<LinearLayout 
+android:orientation="horizontal" 
+android:paddingTop="2.0dip" 
+android:paddingBottom="2.0dip" 
+android:layout_width="fill_parent" 
+android:layout_height="wrap_content" 
+android:minHeight="56.0dip" 
+android:paddingStart="8.0dip" 
+android:paddingEnd="16.0dip"
+xmlns:android="http://schemas.android.com/apk/res/android">
+    <ImageView 
+       android:layout_gravity="center" 
+       android:id="@*android:id/icon" 
+       android:layout_width="56.0dip" 
+       android:layout_height="56.0dip" 
+       android:scaleType="center" 
+       android:layout_marginEnd="8.0dip" />
+    <LinearLayout 
+       android:layout_gravity="center_vertical" 
+       android:orientation="vertical" 
+       android:layout_width="fill_parent" 
+       android:layout_height="wrap_content" 
+       android:layout_marginEnd="8.0dip">
+        <TextView 
+               android:textAppearance="?android:textAppearanceMedium" 
+               android:textColor="@*android:color/black" 
+               android:gravity="start|center" 
+               android:layout_gravity="start|center|top" 
+               android:id="@*android:id/message" 
+               android:layout_width="wrap_content" 
+               android:layout_height="wrap_content" />
+        <TextView 
+               android:textAppearance="?android:textAppearanceSmall" 
+               android:layout_gravity="start|bottom|center" 
+               android:id="@*android:id/status" 
+               android:layout_width="wrap_content" 
+               android:layout_height="wrap_content" 
+               android:minHeight="26.0dip" />
+    </LinearLayout>
 </LinearLayout>
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_wrapped.xml b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_wrapped.xml
old mode 100644 (file)
new mode 100755 (executable)
index b715def..4961531
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_wrapped.xml
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/global_actions_wrapped.xml
@@ -1,23 +1,23 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.android.systemui.HardwareUiLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layout_marginBottom="0dp"
-    android:paddingTop="@dimen/global_actions_top_padding"
-    android:clipToPadding="false"
-    android:theme="@style/qs_theme"
-    android:clipChildren="false">
-
-    <!-- Global actions is right-aligned to be physically near power button -->
-    <LinearLayout
-        android:id="@android:id/list"
-        android:layout_width="@dimen/global_actions_panel_width"
-        android:layout_height="wrap_content"
-        android:layout_gravity="top|right"
-        android:gravity="center"
-        android:orientation="vertical"
-        android:padding="12dp"
-        android:translationZ="9dp" />
-
-</com.android.systemui.HardwareUiLayout>
+<com.android.systemui.HardwareUiLayout 
+android:theme="@style/qs_theme" 
+android:paddingTop="@dimen/global_actions_top_padding" 
+android:clipChildren="false" 
+android:clipToPadding="false" 
+android:layout_width="fill_parent" 
+android:layout_height="fill_parent" 
+android:paddingRight="18dp"
+android:layout_marginBottom="0.0dip"
+xmlns:android="http://schemas.android.com/apk/res/android">
+    <LinearLayout 
+       android:gravity="center" 
+       android:layout_gravity="center|top" 
+       android:orientation="vertical" 
+       android:id="@android:id/list" 
+       android:padding="4.0dip" 
+       android:layout_width="wrap_content" 
+       android:layout_height="@dimen/global_actions_panel_height" 
+       android:layout_marginLeft="16.0dip" 
+       android:layout_marginTop="70.0dip" 
+       android:translationZ="8.0dip" />
+</com.android.systemui.HardwareUiLayout>
\ No newline at end of file
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/recent_apps.xml b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/recent_apps.xml
old mode 100644 (file)
new mode 100755 (executable)
index 870bcf7..3e6a480
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/recent_apps.xml
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/layout/recent_apps.xml
@@ -22,6 +22,7 @@
     android:layout_height="match_parent"
     android:layout_weight="0"
     android:scaleType="center"
+    systemui:keyCode="187"
     android:contentDescription="@string/accessibility_recent"
     android:paddingStart="@dimen/navigation_key_padding"
     android:paddingEnd="@dimen/navigation_key_padding"
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-hdpi/dimens.xml b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-hdpi/dimens.xml
old mode 100644 (file)
new mode 100755 (executable)
index 10b00eb..d4f02b5
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-hdpi/dimens.xml
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-hdpi/dimens.xml
@@ -25,4 +25,5 @@
     <fraction name="battery_subpixel_smoothing_right">12%</fraction>
 
     <dimen name="battery_margin_bottom">1px</dimen>
+    <dimen name="global_actions_panel_height">90.0px</dimen>
 </resources>
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-xhdpi/dimens.xml b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-xhdpi/dimens.xml
old mode 100644 (file)
new mode 100755 (executable)
index 144b225..6a00f08
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-xhdpi/dimens.xml
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values-xhdpi/dimens.xml
@@ -24,4 +24,5 @@
     <fraction name="battery_subpixel_smoothing_right">12.5%</fraction>
 
     <dimen name="battery_margin_bottom">0dp</dimen>
+    <dimen name="global_actions_panel_height">120.0px</dimen>
 </resources>
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/dimens.xml b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/dimens.xml
old mode 100644 (file)
new mode 100755 (executable)
index f00957a..bb29f6c
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/dimens.xml
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/res/values/dimens.xml
@@ -921,6 +921,7 @@
     <dimen name="global_actions_panel_width">120dp</dimen>
 
     <dimen name="global_actions_top_padding">120dp</dimen>
+    <dimen name="global_actions_panel_height">70.0dip</dimen>
 
     <!-- the maximum offset in either direction that elements are moved horizontally to prevent
             burn-in on AOD -->
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/HardwareUiLayout.java b/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/HardwareUiLayout.java
old mode 100644 (file)
new mode 100755 (executable)
index 98dc321..2334723
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/HardwareUiLayout.java
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/HardwareUiLayout.java
@@ -175,9 +175,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable {
                 mRotatedBackground = true;
                 mBackground.setRotatedBackground(true);
                 LinearLayout linearLayout = (LinearLayout) mChild;
-                if (mSwapOrientation) {
+                /* if (mSwapOrientation) {
                     linearLayout.setOrientation(LinearLayout.HORIZONTAL);
-                }
+                } */
+                linearLayout.setOrientation(LinearLayout.VERTICAL);
                 swapDimens(this.mChild);
             }
         } else {
@@ -185,9 +186,10 @@ public class HardwareUiLayout extends FrameLayout implements Tunable {
                 mRotatedBackground = false;
                 mBackground.setRotatedBackground(false);
                 LinearLayout linearLayout = (LinearLayout) mChild;
-                if (mSwapOrientation) {
+                /* if (mSwapOrientation) {
                     linearLayout.setOrientation(LinearLayout.VERTICAL);
-                }
+                } */
+                linearLayout.setOrientation(LinearLayout.VERTICAL);
                 swapDimens(mChild);
             }
         }
diff --git a/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
old mode 100644 (file)
new mode 100755 (executable)
index d232108..e44045f
--- a/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/vendor/mediatek/proprietary/packages/apps/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -98,6 +98,9 @@ import com.android.systemui.volume.SystemUIInterpolators.LogAccelerateInterpolat
 import java.util.ArrayList;
 import java.util.List;
 
+import java.util.Arrays;
+import android.view.ViewGroup.LayoutParams;
@@ -893,7 +896,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
             View view = action.create(mContext, convertView, parent, LayoutInflater.from(mContext));
             // Everything but screenshot, the last item, gets white background.
             if (position == getCount() - 1) {
-                HardwareUiLayout.get(parent).setDivisionView(view);
+                //HardwareUiLayout.get(parent).setDivisionView(view);
             }
             return view;
         }
@@ -1082,7 +1085,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
                 LayoutInflater inflater) {
             willCreate();
 
-            View v = inflater.inflate(R
+            View v = inflater.inflate(com.android.systemui.R
                     .layout.global_actions_item, parent, false);
 
             ImageView icon = (ImageView) v.findViewById(R.id.icon);
@@ -1104,7 +1107,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
 
             if (statusView != null) {
                 statusView.setText(on ? mEnabledStatusMessageResId : mDisabledStatusMessageResId);
-                statusView.setVisibility(View.VISIBLE);
+                statusView.setVisibility(View.GONE);
                 statusView.setEnabled(enabled);
             }
             v.setEnabled(enabled);
@@ -1321,7 +1324,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
 
     private void onAirplaneModeChanged() {
         // Let the service state callbacks handle the state.
-        if (mHasTelephony) return;
+        if (!mHasTelephony) return;
 
         boolean airplaneModeOn = Settings.Global.getInt(
                 mContext.getContentResolver(),
@@ -1393,6 +1396,9 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener,
 
             setContentView(com.android.systemui.R.layout.global_actions_wrapped);
             mListView = findViewById(android.R.id.list);
+            LayoutParams layoutParams = mListView.getLayoutParams();
+            layoutParams.height = mAdapter.getCount() * ((int) mContext.getResources().getDimension(com.android.systemui.R.dimen.global_actions_panel_height));
+            mListView.setLayoutParams(layoutParams);
             mHardwareLayout = HardwareUiLayout.get(mListView);
             mHardwareLayout.setOutsideTouchListener(view -> dismiss());
             setTitle(R.string.global_actions);

猜你喜欢

转载自blog.csdn.net/weixin_42910727/article/details/88976914