summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/Presentation.java7
-rw-r--r--core/res/res/layout/resolver_empty_states.xml105
-rw-r--r--libs/hwui/Android.bp9
-rw-r--r--libs/hwui/apex/android_bitmap.cpp5
-rw-r--r--libs/hwui/jni/AnimatedImageDrawable.cpp2
-rw-r--r--libs/hwui/jni/ByteBufferStreamAdaptor.cpp20
-rw-r--r--libs/hwui/jni/CreateJavaOutputStreamAdaptor.cpp4
-rw-r--r--libs/hwui/jni/Utils.cpp10
-rw-r--r--libs/hwui/jni/Utils.h10
-rw-r--r--libs/hwui/tests/unit/ABitmapTests.cpp46
-rw-r--r--packages/SystemUI/res/color/kg_user_switcher_rounded_background_color.xml22
-rw-r--r--packages/SystemUI/res/color/qs_user_avatar_frame.xml (renamed from packages/SystemUI/res/color/qs_user_detail_avatar_frame.xml)2
-rw-r--r--packages/SystemUI/res/drawable/bg_avatar_selected.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_add_circle.xml27
-rw-r--r--packages/SystemUI/res/drawable/ic_add_circle_qs.xml31
-rw-r--r--packages/SystemUI/res/drawable/ic_avatar_guest_user.xml27
-rw-r--r--packages/SystemUI/res/drawable/ic_avatar_user.xml27
-rw-r--r--packages/SystemUI/res/drawable/kg_user_switcher_rounded_bg.xml (renamed from packages/SystemUI/res/drawable/rounded_user_switcher_bg.xml)22
-rw-r--r--packages/SystemUI/res/drawable/qs_bg_avatar.xml28
-rw-r--r--packages/SystemUI/res/layout-sw600dp/keyguard_user_switcher_item.xml16
-rw-r--r--packages/SystemUI/res/layout/keyguard_user_switcher_item.xml6
-rw-r--r--packages/SystemUI/res/layout/qs_user_detail_item.xml13
-rw-r--r--packages/SystemUI/res/values-night/colors.xml11
-rw-r--r--packages/SystemUI/res/values-sw600dp/dimens.xml8
-rw-r--r--packages/SystemUI/res/values-sw600dp/styles.xml12
-rw-r--r--packages/SystemUI/res/values/colors.xml13
-rw-r--r--packages/SystemUI/res/values/dimens.xml6
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt18
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt46
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java21
-rw-r--r--wifi/java/android/net/wifi/WifiNetworkSpecifier.java8
-rw-r--r--wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java8
34 files changed, 450 insertions, 201 deletions
diff --git a/core/java/android/app/Presentation.java b/core/java/android/app/Presentation.java
index eaee0602f4b7..7a18b8120d7e 100644
--- a/core/java/android/app/Presentation.java
+++ b/core/java/android/app/Presentation.java
@@ -19,6 +19,7 @@ package android.app;
import static android.content.Context.DISPLAY_SERVICE;
import static android.content.Context.WINDOW_SERVICE;
import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION;
+import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -191,12 +192,16 @@ public class Presentation extends Dialog {
mDisplay = display;
mDisplayManager = (DisplayManager)getContext().getSystemService(DISPLAY_SERVICE);
+ final int windowType =
+ (display.getFlags() & Display.FLAG_PRIVATE) != 0 ? TYPE_PRIVATE_PRESENTATION
+ : TYPE_PRESENTATION;
+
final Window w = getWindow();
final WindowManager.LayoutParams attr = w.getAttributes();
attr.token = mToken;
w.setAttributes(attr);
w.setGravity(Gravity.FILL);
- w.setType(TYPE_PRESENTATION);
+ w.setType(windowType);
setCanceledOnTouchOutside(false);
}
diff --git a/core/res/res/layout/resolver_empty_states.xml b/core/res/res/layout/resolver_empty_states.xml
index c7e1a21aa642..5890bed11b07 100644
--- a/core/res/res/layout/resolver_empty_states.xml
+++ b/core/res/res/layout/resolver_empty_states.xml
@@ -19,61 +19,66 @@
android:id="@+id/resolver_empty_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
android:gravity="center_horizontal"
android:visibility="gone"
- android:paddingTop="48dp"
android:paddingStart="24dp"
android:paddingEnd="24dp">
- <ImageView
- android:id="@+id/resolver_empty_state_icon"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:layout_centerHorizontal="true" />
- <TextView
- android:id="@+id/resolver_empty_state_title"
- android:layout_below="@+id/resolver_empty_state_icon"
- android:layout_marginTop="8dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:fontFamily="@string/config_headlineFontFamilyMedium"
- android:textColor="@color/resolver_empty_state_text"
- android:textSize="14sp"
- android:layout_centerHorizontal="true" />
- <TextView
- android:id="@+id/resolver_empty_state_subtitle"
- android:layout_below="@+id/resolver_empty_state_title"
- android:layout_marginTop="4dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/resolver_empty_state_text"
- android:textSize="12sp"
- android:gravity="center_horizontal"
- android:layout_centerHorizontal="true" />
- <Button
- android:id="@+id/resolver_empty_state_button"
- android:layout_below="@+id/resolver_empty_state_subtitle"
- android:layout_marginTop="16dp"
- android:text="@string/resolver_switch_on_work"
- android:layout_width="wrap_content"
+ <RelativeLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:fontFamily="@string/config_headlineFontFamilyMedium"
- android:textSize="14sp"
- android:textColor="?attr/colorAccent"
- android:layout_centerHorizontal="true"
- android:background="@drawable/resolver_turn_on_work_button_ripple_background"/>
- <ProgressBar
- android:id="@+id/resolver_empty_state_progress"
- style="@style/Widget.Material.Light.ProgressBar"
- android:visibility="gone"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:indeterminate="true"
- android:layout_alignTop="@+id/resolver_empty_state_icon"
- android:layout_alignBottom="@+id/resolver_empty_state_button"
- android:layout_centerHorizontal="true"
- android:layout_below="@+id/resolver_empty_state_subtitle"
- android:indeterminateTint="?attr/colorAccent"/>
+ android:paddingTop="48dp"
+ android:paddingBottom="48dp"
+ android:gravity="center_horizontal">
+ <ImageView
+ android:id="@+id/resolver_empty_state_icon"
+ android:layout_width="24dp"
+ android:layout_height="24dp"
+ android:layout_centerHorizontal="true" />
+ <TextView
+ android:id="@+id/resolver_empty_state_title"
+ android:layout_below="@+id/resolver_empty_state_icon"
+ android:layout_marginTop="8dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fontFamily="@string/config_headlineFontFamilyMedium"
+ android:textColor="@color/resolver_empty_state_text"
+ android:textSize="14sp"
+ android:layout_centerHorizontal="true" />
+ <TextView
+ android:id="@+id/resolver_empty_state_subtitle"
+ android:layout_below="@+id/resolver_empty_state_title"
+ android:layout_marginTop="4dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/resolver_empty_state_text"
+ android:textSize="12sp"
+ android:gravity="center_horizontal"
+ android:layout_centerHorizontal="true" />
+ <Button
+ android:id="@+id/resolver_empty_state_button"
+ android:layout_below="@+id/resolver_empty_state_subtitle"
+ android:layout_marginTop="16dp"
+ android:text="@string/resolver_switch_on_work"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:fontFamily="@string/config_headlineFontFamilyMedium"
+ android:textSize="14sp"
+ android:textColor="?attr/colorAccent"
+ android:layout_centerHorizontal="true"
+ android:background="@drawable/resolver_turn_on_work_button_ripple_background"/>
+ <ProgressBar
+ android:id="@+id/resolver_empty_state_progress"
+ style="@style/Widget.Material.Light.ProgressBar"
+ android:visibility="gone"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:indeterminate="true"
+ android:layout_alignTop="@+id/resolver_empty_state_icon"
+ android:layout_alignBottom="@+id/resolver_empty_state_button"
+ android:layout_centerHorizontal="true"
+ android:layout_below="@+id/resolver_empty_state_subtitle"
+ android:indeterminateTint="?attr/colorAccent"/>
+ </RelativeLayout>
<TextView android:id="@+id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index ac2fd98248d0..aa842ff6a7b7 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -171,7 +171,6 @@ cc_library_headers {
cc_defaults {
name: "android_graphics_apex",
- host_supported: true,
cflags: [
"-Wno-unused-parameter",
"-Wno-non-virtual-dtor",
@@ -231,7 +230,6 @@ cc_library_headers {
cc_defaults {
name: "android_graphics_jni",
- host_supported: true,
cflags: [
"-Wno-unused-parameter",
"-Wno-non-virtual-dtor",
@@ -537,7 +535,11 @@ cc_defaults {
cc_test {
name: "hwui_unit_tests",
- defaults: ["hwui_test_defaults"],
+ defaults: [
+ "hwui_test_defaults",
+ "android_graphics_apex",
+ "android_graphics_jni",
+ ],
static_libs: [
"libgmock",
@@ -549,6 +551,7 @@ cc_test {
srcs: [
"tests/unit/main.cpp",
+ "tests/unit/ABitmapTests.cpp",
"tests/unit/CacheManagerTests.cpp",
"tests/unit/CanvasContextTests.cpp",
"tests/unit/CommonPoolTests.cpp",
diff --git a/libs/hwui/apex/android_bitmap.cpp b/libs/hwui/apex/android_bitmap.cpp
index b56a619b00aa..3780ba072308 100644
--- a/libs/hwui/apex/android_bitmap.cpp
+++ b/libs/hwui/apex/android_bitmap.cpp
@@ -163,10 +163,9 @@ jobject ABitmapConfig_getConfigFromFormat(JNIEnv* env, AndroidBitmapFormat forma
void ABitmap_notifyPixelsChanged(ABitmap* bitmapHandle) {
Bitmap* bitmap = TypeCast::toBitmap(bitmapHandle);
- if (bitmap->isImmutable()) {
- ALOGE("Attempting to modify an immutable Bitmap!");
+ if (!bitmap->isImmutable()) {
+ bitmap->notifyPixelsChanged();
}
- return bitmap->notifyPixelsChanged();
}
namespace {
diff --git a/libs/hwui/jni/AnimatedImageDrawable.cpp b/libs/hwui/jni/AnimatedImageDrawable.cpp
index 055075d0c42a..1ff156593c41 100644
--- a/libs/hwui/jni/AnimatedImageDrawable.cpp
+++ b/libs/hwui/jni/AnimatedImageDrawable.cpp
@@ -183,7 +183,7 @@ public:
}
~InvokeListener() override {
- auto* env = get_env_or_die(mJvm);
+ auto* env = requireEnv(mJvm);
env->DeleteWeakGlobalRef(mWeakRef);
}
diff --git a/libs/hwui/jni/ByteBufferStreamAdaptor.cpp b/libs/hwui/jni/ByteBufferStreamAdaptor.cpp
index db5f6f6c684f..b10540cb3fbd 100644
--- a/libs/hwui/jni/ByteBufferStreamAdaptor.cpp
+++ b/libs/hwui/jni/ByteBufferStreamAdaptor.cpp
@@ -9,24 +9,6 @@ using namespace android;
static jmethodID gByteBuffer_getMethodID;
static jmethodID gByteBuffer_setPositionMethodID;
-/**
- * Helper method for accessing the JNI interface pointer.
- *
- * Image decoding (which this supports) is started on a thread that is already
- * attached to the Java VM. But an AnimatedImageDrawable continues decoding on
- * the AnimatedImageThread, which is not attached. This will attach if
- * necessary.
- */
-static JNIEnv* requireEnv(JavaVM* jvm) {
- JNIEnv* env;
- if (jvm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
- if (jvm->AttachCurrentThreadAsDaemon(&env, nullptr) != JNI_OK) {
- LOG_ALWAYS_FATAL("Failed to AttachCurrentThread!");
- }
- }
- return env;
-}
-
class ByteBufferStream : public SkStreamAsset {
private:
ByteBufferStream(JavaVM* jvm, jobject jbyteBuffer, size_t initialPosition, size_t length,
@@ -304,7 +286,7 @@ std::unique_ptr<SkStream> CreateByteBufferStreamAdaptor(JNIEnv* env, jobject jby
auto* context = new release_proc_context{jvm, jbyteBuffer};
auto releaseProc = [](const void*, void* context) {
auto* c = reinterpret_cast<release_proc_context*>(context);
- JNIEnv* env = get_env_or_die(c->jvm);
+ JNIEnv* env = requireEnv(c->jvm);
env->DeleteGlobalRef(c->jbyteBuffer);
delete c;
};
diff --git a/libs/hwui/jni/CreateJavaOutputStreamAdaptor.cpp b/libs/hwui/jni/CreateJavaOutputStreamAdaptor.cpp
index 39483b55992b..f1c6b29204b2 100644
--- a/libs/hwui/jni/CreateJavaOutputStreamAdaptor.cpp
+++ b/libs/hwui/jni/CreateJavaOutputStreamAdaptor.cpp
@@ -49,13 +49,13 @@ public:
}
~JavaInputStreamAdaptor() override {
- auto* env = android::get_env_or_die(fJvm);
+ auto* env = android::requireEnv(fJvm);
env->DeleteGlobalRef(fJavaInputStream);
env->DeleteGlobalRef(fJavaByteArray);
}
size_t read(void* buffer, size_t size) override {
- auto* env = android::get_env_or_die(fJvm);
+ auto* env = android::requireEnv(fJvm);
if (!fSwallowExceptions && checkException(env)) {
// Just in case the caller did not clear from a previous exception.
return 0;
diff --git a/libs/hwui/jni/Utils.cpp b/libs/hwui/jni/Utils.cpp
index 17c194d04f84..34fd6687d52c 100644
--- a/libs/hwui/jni/Utils.cpp
+++ b/libs/hwui/jni/Utils.cpp
@@ -159,3 +159,13 @@ JNIEnv* android::get_env_or_die(JavaVM* jvm) {
}
return env;
}
+
+JNIEnv* android::requireEnv(JavaVM* jvm) {
+ JNIEnv* env;
+ if (jvm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
+ if (jvm->AttachCurrentThreadAsDaemon(&env, nullptr) != JNI_OK) {
+ LOG_ALWAYS_FATAL("Failed to AttachCurrentThread!");
+ }
+ }
+ return env;
+}
diff --git a/libs/hwui/jni/Utils.h b/libs/hwui/jni/Utils.h
index 89255177ba2e..f628cc3c85ed 100644
--- a/libs/hwui/jni/Utils.h
+++ b/libs/hwui/jni/Utils.h
@@ -78,6 +78,16 @@ bool isSeekable(int descriptor);
JNIEnv* get_env_or_die(JavaVM* jvm);
+/**
+ * Helper method for accessing the JNI interface pointer.
+ *
+ * Image decoding (which this supports) is started on a thread that is already
+ * attached to the Java VM. But an AnimatedImageDrawable continues decoding on
+ * the AnimatedImageThread, which is not attached. This will attach if
+ * necessary.
+ */
+JNIEnv* requireEnv(JavaVM* jvm);
+
}; // namespace android
#endif // _ANDROID_GRAPHICS_UTILS_H_
diff --git a/libs/hwui/tests/unit/ABitmapTests.cpp b/libs/hwui/tests/unit/ABitmapTests.cpp
new file mode 100644
index 000000000000..8e2f7e09d406
--- /dev/null
+++ b/libs/hwui/tests/unit/ABitmapTests.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2020 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.
+ */
+
+#include <gtest/gtest.h>
+
+#include "android/graphics/bitmap.h"
+#include "apex/TypeCast.h"
+#include "hwui/Bitmap.h"
+#include "tests/common/TestUtils.h"
+
+using namespace android;
+using namespace android::uirenderer;
+
+TEST(ABitmap, notifyPixelsChanged) {
+ // generate a bitmap and its public API handle
+ sk_sp<Bitmap> bitmap(TestUtils::createBitmap(1, 1));
+ ABitmap* abmp = android::TypeCast::toABitmap(bitmap.get());
+
+ // verify that notification changes the genID
+ uint32_t genID = bitmap->getGenerationID();
+ ABitmap_notifyPixelsChanged(abmp);
+ ASSERT_TRUE(bitmap->getGenerationID() != genID);
+
+ // mark the bitmap as immutable
+ ASSERT_FALSE(bitmap->isImmutable());
+ bitmap->setImmutable();
+ ASSERT_TRUE(bitmap->isImmutable());
+
+ // attempt to notify that the pixels have changed
+ genID = bitmap->getGenerationID();
+ ABitmap_notifyPixelsChanged(abmp);
+ ASSERT_TRUE(bitmap->getGenerationID() == genID);
+}
diff --git a/packages/SystemUI/res/color/kg_user_switcher_rounded_background_color.xml b/packages/SystemUI/res/color/kg_user_switcher_rounded_background_color.xml
new file mode 100644
index 000000000000..b16d038f68f2
--- /dev/null
+++ b/packages/SystemUI/res/color/kg_user_switcher_rounded_background_color.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2016 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
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_activated="true" android:color="@color/kg_user_switcher_activated_background_color" />
+ <item android:color="@android:color/transparent" />
+</selector> \ No newline at end of file
diff --git a/packages/SystemUI/res/color/qs_user_detail_avatar_frame.xml b/packages/SystemUI/res/color/qs_user_avatar_frame.xml
index 344859c27e34..0c816b4feffc 100644
--- a/packages/SystemUI/res/color/qs_user_detail_avatar_frame.xml
+++ b/packages/SystemUI/res/color/qs_user_avatar_frame.xml
@@ -18,5 +18,5 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:color="?android:attr/colorAccent" />
- <item android:color="@android:color/transparent" />
+ <item android:color="@color/qs_user_switcher_avatar_background" />
</selector> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/bg_avatar_selected.xml b/packages/SystemUI/res/drawable/bg_avatar_selected.xml
new file mode 100644
index 000000000000..84d3416b7885
--- /dev/null
+++ b/packages/SystemUI/res/drawable/bg_avatar_selected.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="100"
+ android:viewportHeight="100">
+
+ <path
+ android:fillColor="?android:attr/colorAccent"
+ android:pathData="M50,50m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0"/>
+
+</vector> \ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/ic_add_circle.xml b/packages/SystemUI/res/drawable/ic_add_circle.xml
new file mode 100644
index 000000000000..79ea70704ec9
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_add_circle.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+
+ <path
+ android:pathData="M23.9998,10.667C16.6398,10.667 10.6665,16.6403 10.6665,24.0003C10.6665,31.3603 16.6398,37.3337 23.9998,37.3337C31.3598,37.3337 37.3332,31.3603 37.3332,24.0003C37.3332,16.6403 31.3598,10.667 23.9998,10.667ZM22.6665,17.3337V22.667H17.3332V25.3337H22.6665V30.667H25.3332V25.3337H30.6665V22.667H25.3332V17.3337H22.6665ZM13.3332,24.0003C13.3332,29.8803 18.1198,34.667 23.9998,34.667C29.8798,34.667 34.6665,29.8803 34.6665,24.0003C34.6665,18.1203 29.8798,13.3337 23.9998,13.3337C18.1198,13.3337 13.3332,18.1203 13.3332,24.0003Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_add_circle_qs.xml b/packages/SystemUI/res/drawable/ic_add_circle_qs.xml
deleted file mode 100644
index 8e933445be0b..000000000000
--- a/packages/SystemUI/res/drawable/ic_add_circle_qs.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-Copyright (C) 2014 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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48.0dp"
- android:height="48.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorForeground">
- <group
- android:scaleX="1.2"
- android:scaleY="1.2"
- android:pivotX="12.0"
- android:pivotY="12.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12.000000,2.000000C6.500000,2.000000 2.000000,6.500000 2.000000,12.000000s4.500000,10.000000 10.000000,10.000000c5.500000,0.000000 10.000000,-4.500000 10.000000,-10.000000S17.500000,2.000000 12.000000,2.000000zM17.000000,13.000000l-4.000000,0.000000l0.000000,4.000000l-2.000000,0.000000l0.000000,-4.000000L7.000000,13.000000l0.000000,-2.000000l4.000000,0.000000L11.000000,7.000000l2.000000,0.000000l0.000000,4.000000l4.000000,0.000000L17.000000,13.000000z"/>
- </group>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_avatar_guest_user.xml b/packages/SystemUI/res/drawable/ic_avatar_guest_user.xml
new file mode 100644
index 000000000000..e3a83a29b764
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_avatar_guest_user.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+
+ <path
+ android:pathData="M23.9998,10.667C16.6398,10.667 10.6665,16.6403 10.6665,24.0003C10.6665,31.3603 16.6398,37.3337 23.9998,37.3337C31.3598,37.3337 37.3332,31.3603 37.3332,24.0003C37.3332,16.6403 31.3598,10.667 23.9998,10.667ZM17.4265,32.3737C17.9998,31.1737 21.4932,30.0003 23.9998,30.0003C26.5065,30.0003 30.0132,31.1737 30.5732,32.3737C28.7598,33.8137 26.4798,34.667 23.9998,34.667C21.5198,34.667 19.2398,33.8137 17.4265,32.3737ZM23.9998,27.3337C25.9465,27.3337 30.5732,28.1203 32.4798,30.4403C33.8398,28.6537 34.6665,26.427 34.6665,24.0003C34.6665,18.1203 29.8798,13.3337 23.9998,13.3337C18.1198,13.3337 13.3332,18.1203 13.3332,24.0003C13.3332,26.427 14.1598,28.6537 15.5198,30.4403C17.4265,28.1203 22.0532,27.3337 23.9998,27.3337ZM23.9998,16.0003C21.4132,16.0003 19.3332,18.0803 19.3332,20.667C19.3332,23.2537 21.4132,25.3337 23.9998,25.3337C26.5865,25.3337 28.6665,23.2537 28.6665,20.667C28.6665,18.0803 26.5865,16.0003 23.9998,16.0003ZM21.9998,20.667C21.9998,21.7737 22.8932,22.667 23.9998,22.667C25.1065,22.667 25.9998,21.7737 25.9998,20.667C25.9998,19.5603 25.1065,18.667 23.9998,18.667C22.8932,18.667 21.9998,19.5603 21.9998,20.667Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_avatar_user.xml b/packages/SystemUI/res/drawable/ic_avatar_user.xml
new file mode 100644
index 000000000000..b4a4a88bf155
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_avatar_user.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+
+ <path
+ android:pathData="M23.9998,10.667C16.6398,10.667 10.6665,16.6403 10.6665,24.0003C10.6665,31.3603 16.6398,37.3337 23.9998,37.3337C31.3598,37.3337 37.3332,31.3603 37.3332,24.0003C37.3332,16.6403 31.3598,10.667 23.9998,10.667ZM32.4798,30.4403C30.5732,28.1203 25.9465,27.3337 23.9998,27.3337C22.0532,27.3337 17.4265,28.1203 15.5198,30.4403C14.1598,28.6537 13.3332,26.427 13.3332,24.0003C13.3332,18.1203 18.1198,13.3337 23.9998,13.3337C29.8798,13.3337 34.6665,18.1203 34.6665,24.0003C34.6665,26.427 33.8398,28.6537 32.4798,30.4403ZM19.3332,20.667C19.3332,18.0803 21.4132,16.0003 23.9998,16.0003C26.5865,16.0003 28.6665,18.0803 28.6665,20.667C28.6665,23.2537 26.5865,25.3337 23.9998,25.3337C21.4132,25.3337 19.3332,23.2537 19.3332,20.667Z"
+ android:fillColor="#ffffff"
+ android:fillType="evenOdd"/>
+
+</vector>
diff --git a/packages/SystemUI/res/drawable/rounded_user_switcher_bg.xml b/packages/SystemUI/res/drawable/kg_user_switcher_rounded_bg.xml
index e3d010ee7674..13c5fe08f43a 100644
--- a/packages/SystemUI/res/drawable/rounded_user_switcher_bg.xml
+++ b/packages/SystemUI/res/drawable/kg_user_switcher_rounded_bg.xml
@@ -16,17 +16,17 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
- <item>
- <shape>
- <solid android:color="@color/qs_user_detail_avatar_frame" />
+ <item>
+ <shape>
+ <solid android:color="@color/kg_user_switcher_rounded_background_color" />
- <padding
- android:left="1dp"
- android:right="1dp"
- android:bottom="1dp"
- android:top="1dp" />
+ <padding
+ android:left="8dp"
+ android:right="8dp"
+ android:bottom="8dp"
+ android:top="8dp" />
- <corners android:radius="48dp" />
- </shape>
- </item>
+ <corners android:radius="48dp" />
+ </shape>
+ </item>
</ripple>
diff --git a/packages/SystemUI/res/drawable/qs_bg_avatar.xml b/packages/SystemUI/res/drawable/qs_bg_avatar.xml
new file mode 100644
index 000000000000..41176a8efc5e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/qs_bg_avatar.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 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.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="48dp"
+ android:height="48dp"
+ android:viewportWidth="100"
+ android:viewportHeight="100">
+
+ <path
+ android:fillColor="@color/qs_user_switcher_avatar_background"
+ android:pathData="M50,50m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0"/>
+
+</vector> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout-sw600dp/keyguard_user_switcher_item.xml b/packages/SystemUI/res/layout-sw600dp/keyguard_user_switcher_item.xml
index 1f38b1ea1da5..4413b1ef3cd3 100644
--- a/packages/SystemUI/res/layout-sw600dp/keyguard_user_switcher_item.xml
+++ b/packages/SystemUI/res/layout-sw600dp/keyguard_user_switcher_item.xml
@@ -20,24 +20,24 @@
<com.android.systemui.statusbar.policy.KeyguardUserDetailItemView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sysui="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
- android:layout_marginEnd="8dp"
+ android:layout_marginEnd="32dp"
android:gravity="end|center_vertical"
android:clickable="true"
- android:background="@drawable/rounded_user_switcher_bg"
- sysui:regularTextAppearance="@style/TextAppearance.StatusBar.Expanded.UserSwitcher"
- sysui:activatedTextAppearance="@style/TextAppearance.StatusBar.Expanded.UserSwitcher.Activated">
+ android:background="@drawable/kg_user_switcher_rounded_bg"
+ sysui:regularTextAppearance="@style/TextAppearance.StatusBar.Expanded.UserSwitcher">
<TextView android:id="@+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginEnd="13dp"
+ android:layout_marginStart="25dp"
+ android:layout_marginEnd="12dp"
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.UserSwitcher"
/>
<com.android.systemui.statusbar.phone.UserAvatarView android:id="@+id/user_picture"
- android:layout_width="@dimen/framed_avatar_size"
- android:layout_height="@dimen/framed_avatar_size"
+ android:layout_width="@dimen/kg_framed_avatar_size"
+ android:layout_height="@dimen/kg_framed_avatar_size"
android:contentDescription="@null"
sysui:badgeDiameter="18dp"
sysui:badgeMargin="1dp" />
diff --git a/packages/SystemUI/res/layout/keyguard_user_switcher_item.xml b/packages/SystemUI/res/layout/keyguard_user_switcher_item.xml
index b1e51659817e..626951c8c0b7 100644
--- a/packages/SystemUI/res/layout/keyguard_user_switcher_item.xml
+++ b/packages/SystemUI/res/layout/keyguard_user_switcher_item.xml
@@ -36,8 +36,8 @@
android:textAppearance="@style/TextAppearance.StatusBar.Expanded.UserSwitcher"
/>
<com.android.systemui.statusbar.phone.UserAvatarView android:id="@+id/user_picture"
- android:layout_width="@dimen/framed_avatar_size"
- android:layout_height="@dimen/framed_avatar_size"
+ android:layout_width="@dimen/kg_framed_avatar_size"
+ android:layout_height="@dimen/kg_framed_avatar_size"
android:contentDescription="@null"
android:backgroundTint="@color/qs_user_detail_avatar_tint"
android:backgroundTintMode="src_atop"
@@ -45,5 +45,5 @@
sysui:framePadding="2.5dp"
sysui:badgeDiameter="18dp"
sysui:badgeMargin="1dp"
- sysui:frameColor="@color/qs_user_detail_avatar_frame" />
+ sysui:frameColor="@color/kg_user_switcher_rounded_background_color" />
</com.android.systemui.statusbar.policy.KeyguardUserDetailItemView>
diff --git a/packages/SystemUI/res/layout/qs_user_detail_item.xml b/packages/SystemUI/res/layout/qs_user_detail_item.xml
index 5c03e3099522..0608685c3440 100644
--- a/packages/SystemUI/res/layout/qs_user_detail_item.xml
+++ b/packages/SystemUI/res/layout/qs_user_detail_item.xml
@@ -30,21 +30,20 @@
android:clipToPadding="false"
android:focusable="true"
android:background="@drawable/ripple_drawable"
- systemui:regularTextAppearance="@style/TextAppearance.QS.UserSwitcher"
- systemui:activatedTextAppearance="@style/TextAppearance.QS.UserSwitcher.Activated">
+ systemui:regularTextAppearance="@style/TextAppearance.QS.UserSwitcher">
<com.android.systemui.statusbar.phone.UserAvatarView
android:id="@+id/user_picture"
- android:layout_width="@dimen/framed_avatar_size"
- android:layout_height="@dimen/framed_avatar_size"
+ android:layout_width="@dimen/qs_framed_avatar_size"
+ android:layout_height="@dimen/qs_framed_avatar_size"
android:layout_marginBottom="7dp"
android:backgroundTint="@color/qs_user_detail_avatar_tint"
android:backgroundTintMode="src_atop"
- systemui:frameWidth="2dp"
- systemui:framePadding="2.5dp"
+ systemui:frameWidth="6dp"
systemui:badgeDiameter="18dp"
systemui:badgeMargin="1dp"
- systemui:frameColor="@color/qs_user_detail_avatar_frame"/>
+ systemui:framePadding="-1dp"
+ systemui:frameColor="@color/qs_user_avatar_frame"/>
<LinearLayout
android:layout_width="wrap_content"
diff --git a/packages/SystemUI/res/values-night/colors.xml b/packages/SystemUI/res/values-night/colors.xml
index 9b0fe465deee..93aa2701ad07 100644
--- a/packages/SystemUI/res/values-night/colors.xml
+++ b/packages/SystemUI/res/values-night/colors.xml
@@ -86,4 +86,15 @@
<color name="GM2_red_500">#E25142</color>
<color name="GM2_yellow_500">#F5C518</color>
+ <!-- Icon color for user avatars in keyguard user switcher -->
+ <color name="kg_user_switcher_avatar_icon_color">@android:color/background_light</color>
+ <!-- Icon color for selected user avatars in keyguard user switcher -->
+ <color name="kg_user_switcher_selected_avatar_icon_color">#202124</color>
+ <!-- Icon color for user avatars in quick settings user switcher -->
+ <color name="qs_user_switcher_avatar_icon_color">@android:color/background_light</color>
+ <!-- Icon color for selected user avatars in quick settings user switcher -->
+ <color name="qs_user_switcher_selected_avatar_icon_color">#202124</color>
+ <!-- Color of background circle of user avatars in quick settings user switcher -->
+ <color name="qs_user_switcher_avatar_background">#3C4043</color>
+
</resources>
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 89341838f3e3..8f73d231c732 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -45,6 +45,11 @@
<!-- Height of the status bar header bar when on Keyguard -->
<dimen name="status_bar_header_height_keyguard">60dp</dimen>
+ <!-- Size of user icon + frame in the qs user picker (incl. frame) -->
+ <dimen name="qs_framed_avatar_size">60dp</dimen>
+ <!-- Size of user icon + frame in the keyguard user picker (incl. frame) -->
+ <dimen name="kg_framed_avatar_size">48dp</dimen>
+
<!-- The width of user avatar when on Keyguard -->
<dimen name="multi_user_switch_width_keyguard">48dp</dimen>
@@ -88,4 +93,7 @@
<!-- Keyboard shortcuts helper -->
<dimen name="ksh_layout_width">488dp</dimen>
+
+ <!-- Text size for user name in user switcher -->
+ <dimen name="kg_user_switcher_text_size">18sp</dimen>
</resources>
diff --git a/packages/SystemUI/res/values-sw600dp/styles.xml b/packages/SystemUI/res/values-sw600dp/styles.xml
index b375364fdab9..02bd60210e81 100644
--- a/packages/SystemUI/res/values-sw600dp/styles.xml
+++ b/packages/SystemUI/res/values-sw600dp/styles.xml
@@ -30,20 +30,10 @@
<item name="android:textColor">?attr/wallpaperTextColor</item>
</style>
- <style name="TextAppearance.StatusBar.Expanded.UserSwitcher.Activated">
- <item name="android:fontWeight">700</item>
- <item name="android:textStyle">bold</item>
- <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
- </style>
-
<style name="TextAppearance.QS.UserSwitcher">
- <item name="android:textSize">@dimen/qs_detail_item_primary_text_size</item>
+ <item name="android:textSize">@dimen/kg_user_switcher_text_size</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
</style>
- <style name="TextAppearance.QS.UserSwitcher.Activated">
- <item name="android:fontWeight">700</item>
- <item name="android:textStyle">bold</item>
- </style>
</resources>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 74bbee681ccc..288487acec79 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -58,6 +58,19 @@
<!-- Shadows under the clock, date and other keyguard text fields -->
<color name="keyguard_shadow_color">#B2000000</color>
+ <!-- Color for rounded background for activated user in keyguard user switcher -->
+ <color name="kg_user_switcher_activated_background_color">#26000000</color>
+ <!-- Icon color for user avatars in keyguard user switcher -->
+ <color name="kg_user_switcher_avatar_icon_color">@android:color/background_light</color>
+ <!-- Icon color for selected user avatars in keyguard user switcher -->
+ <color name="kg_user_switcher_selected_avatar_icon_color">@android:color/background_light</color>
+ <!-- Icon color for user avatars in user switcher quick settings -->
+ <color name="qs_user_switcher_avatar_icon_color">#3C4043</color>
+ <!-- Icon color for selected user avatars in user switcher quick settings -->
+ <color name="qs_user_switcher_selected_avatar_icon_color">@android:color/background_light</color>
+ <!-- Color of background circle of user avatars in quick settings -->
+ <color name="qs_user_switcher_avatar_background">#DADCE0</color>
+
<!-- The color of the legacy notification background -->
<color name="notification_legacy_background_color">#ff1a1a1a</color>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 5b213edd5f0f..9b9fbed0d904 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -752,8 +752,10 @@
quick settings header -->
<dimen name="max_avatar_size">48dp</dimen>
- <!-- Size of user icon + frame in the qs/keyguard user picker (incl. frame) -->
- <dimen name="framed_avatar_size">54dp</dimen>
+ <!-- Size of user icon + frame in the qs user picker (incl. frame) -->
+ <dimen name="qs_framed_avatar_size">54dp</dimen>
+ <!-- Size of user icon + frame in the keyguard user picker (incl. frame) -->
+ <dimen name="kg_framed_avatar_size">54dp</dimen>
<!-- Margin on the left side of the carrier text on Keyguard -->
<dimen name="keyguard_carrier_text_margin">16dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt
index f2303e622f8d..fe1e6328820d 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/management/ControlsFavoritingActivity.kt
@@ -55,13 +55,19 @@ class ControlsFavoritingActivity @Inject constructor(
companion object {
private const val TAG = "ControlsFavoritingActivity"
+
+ // If provided and no structure is available, use as the title
const val EXTRA_APP = "extra_app_label"
+
+ // If provided, show this structure page first
+ const val EXTRA_STRUCTURE = "extra_structure"
private const val TOOLTIP_PREFS_KEY = Prefs.Key.CONTROLS_STRUCTURE_SWIPE_TOOLTIP_COUNT
private const val TOOLTIP_MAX_SHOWN = 2
}
private var component: ComponentName? = null
private var appName: CharSequence? = null
+ private var structureExtra: CharSequence? = null
private lateinit var structurePager: ViewPager2
private lateinit var statusText: TextView
@@ -111,6 +117,7 @@ class ControlsFavoritingActivity @Inject constructor(
val collator = Collator.getInstance(resources.configuration.locales[0])
comparator = compareBy(collator) { it.structureName }
appName = intent.getCharSequenceExtra(EXTRA_APP)
+ structureExtra = intent.getCharSequenceExtra(EXTRA_STRUCTURE) ?: ""
component = intent.getParcelableExtra<ComponentName>(Intent.EXTRA_COMPONENT_NAME)
bindViews()
@@ -137,9 +144,15 @@ class ControlsFavoritingActivity @Inject constructor(
listOfStructures = controlsByStructure.map {
StructureContainer(it.key, AllModel(it.value, favoriteKeys, emptyZoneString))
}.sortedWith(comparator)
+
+ val structureIndex = listOfStructures.indexOfFirst {
+ sc -> sc.structureName == structureExtra
+ }.let { if (it == -1) 0 else it }
+
executor.execute {
doneButton.isEnabled = true
structurePager.adapter = StructureAdapter(listOfStructures)
+ structurePager.setCurrentItem(structureIndex)
if (error) {
statusText.text = resources.getText(R.string.controls_favorite_load_error)
} else {
@@ -247,7 +260,10 @@ class ControlsFavoritingActivity @Inject constructor(
requireViewById<Button>(R.id.other_apps).apply {
visibility = View.VISIBLE
setOnClickListener {
- this@ControlsFavoritingActivity.onBackPressed()
+ val i = Intent()
+ i.setComponent(
+ ComponentName(context, ControlsProviderSelectorActivity::class.java))
+ context.startActivity(i)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
index 6e527e29a848..208d9117e088 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt
@@ -45,6 +45,7 @@ import com.android.systemui.controls.ControlsServiceInfo
import com.android.systemui.controls.controller.ControlInfo
import com.android.systemui.controls.controller.ControlsController
import com.android.systemui.controls.controller.StructureInfo
+import com.android.systemui.controls.management.ControlsFavoritingActivity
import com.android.systemui.controls.management.ControlsListingController
import com.android.systemui.controls.management.ControlsProviderSelectorActivity
import com.android.systemui.dagger.qualifiers.Background
@@ -92,21 +93,8 @@ class ControlsUiControllerImpl @Inject constructor (
private lateinit var lastItems: List<SelectionItem>
private var popup: ListPopupWindow? = null
private var activeDialog: Dialog? = null
- private val addControlsItem: SelectionItem
private var hidden = true
- init {
- val addDrawable = context.getDrawable(R.drawable.ic_add).apply {
- setTint(context.resources.getColor(R.color.control_secondary_text, null))
- }
- addControlsItem = SelectionItem(
- context.resources.getString(R.string.controls_providers_title),
- "",
- addDrawable,
- EMPTY_COMPONENT
- )
- }
-
override val available: Boolean
get() = controlsController.get().available
@@ -184,7 +172,7 @@ class ControlsUiControllerImpl @Inject constructor (
inflater.inflate(R.layout.controls_no_favorites, parent, true)
val viewGroup = parent.requireViewById(R.id.controls_no_favorites_group) as ViewGroup
- viewGroup.setOnClickListener(launchSelectorActivityListener(context))
+ viewGroup.setOnClickListener { v: View -> startProviderSelectorActivity(v.context) }
val subtitle = parent.requireViewById<TextView>(R.id.controls_subtitle)
subtitle.setText(context.resources.getString(R.string.quick_controls_subtitle))
@@ -198,16 +186,28 @@ class ControlsUiControllerImpl @Inject constructor (
}
}
- private fun launchSelectorActivityListener(context: Context): (View) -> Unit {
- return { _ ->
- val closeDialog = Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
- context.sendBroadcast(closeDialog)
+ private fun startFavoritingActivity(context: Context, si: StructureInfo) {
+ val i = Intent(context, ControlsFavoritingActivity::class.java).apply {
+ putExtra(ControlsFavoritingActivity.EXTRA_APP,
+ controlsListingController.get().getAppLabel(si.componentName))
+ putExtra(ControlsFavoritingActivity.EXTRA_STRUCTURE, si.structure)
+ putExtra(Intent.EXTRA_COMPONENT_NAME, si.componentName)
+ addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
+ }
+ startActivity(context, i)
+ }
- val i = Intent()
- i.setComponent(ComponentName(context, ControlsProviderSelectorActivity::class.java))
- i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
- context.startActivity(i)
+ private fun startProviderSelectorActivity(context: Context) {
+ val i = Intent(context, ControlsProviderSelectorActivity::class.java).apply {
+ addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
}
+ startActivity(context, i)
+ }
+
+ private fun startActivity(context: Context, intent: Intent) {
+ val closeDialog = Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
+ context.sendBroadcast(closeDialog)
+ context.startActivity(intent)
}
private fun showControlsView(items: List<SelectionItem>) {
@@ -248,7 +248,7 @@ class ControlsUiControllerImpl @Inject constructor (
) {
when (pos) {
// 0: Add Control
- 0 -> launchSelectorActivityListener(view.context)(parent)
+ 0 -> startFavoritingActivity(view.context, selectedStructure)
else -> Log.w(ControlsUiController.TAG,
"Unsupported index ($pos) on 'more' menu selection")
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java
index 4f9052709870..447f48b5db94 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/UserDetailView.java
@@ -18,6 +18,8 @@ package com.android.systemui.qs.tiles;
import android.content.Context;
import android.content.Intent;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -29,6 +31,7 @@ import com.android.settingslib.RestrictedLockUtils;
import com.android.systemui.R;
import com.android.systemui.qs.PseudoGridView;
import com.android.systemui.statusbar.policy.UserSwitcherController;
+
/**
* Quick settings detail view for user switching.
*/
@@ -101,6 +104,19 @@ public class UserDetailView extends PseudoGridView {
return v;
}
+ private static Drawable getDrawable(Context context,
+ UserSwitcherController.UserRecord item) {
+ Drawable icon = getIconDrawable(context, item);
+ int iconColorRes = item.isCurrent ? R.color.qs_user_switcher_selected_avatar_icon_color
+ : R.color.qs_user_switcher_avatar_icon_color;
+ icon.setTint(context.getResources().getColor(iconColorRes, context.getTheme()));
+
+ int bgRes = item.isCurrent ? R.drawable.bg_avatar_selected : R.drawable.qs_bg_avatar;
+ Drawable bg = context.getDrawable(bgRes);
+ LayerDrawable drawable = new LayerDrawable(new Drawable[]{bg, icon});
+ return drawable;
+ }
+
@Override
public void onClick(View view) {
UserSwitcherController.UserRecord tag =
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java
index 7d5498157136..45e47f1f763f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardUserSwitcher.java
@@ -21,6 +21,8 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.database.DataSetObserver;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -294,6 +296,21 @@ public class KeyguardUserSwitcher {
return convertView;
}
+ private static Drawable getDrawable(Context context,
+ UserSwitcherController.UserRecord item) {
+ Drawable drawable = getIconDrawable(context, item);
+ int iconColorRes = item.isCurrent ? R.color.kg_user_switcher_selected_avatar_icon_color
+ : R.color.kg_user_switcher_avatar_icon_color;
+ drawable.setTint(context.getResources().getColor(iconColorRes, context.getTheme()));
+
+ if (item.isCurrent) {
+ Drawable bg = context.getDrawable(R.drawable.bg_avatar_selected);
+ drawable = new LayerDrawable(new Drawable[]{bg, drawable});
+ }
+
+ return drawable;
+ }
+
@Override
public void onClick(View v) {
UserSwitcherController.UserRecord user = (UserSwitcherController.UserRecord) v.getTag();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
index 69eaaa4f54a9..bb0b5e00ff67 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java
@@ -31,7 +31,6 @@ import android.content.IntentFilter;
import android.content.pm.UserInfo;
import android.database.ContentObserver;
import android.graphics.Bitmap;
-import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Handler;
@@ -52,7 +51,6 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.UserIcons;
import com.android.settingslib.RestrictedLockUtilsInternal;
-import com.android.settingslib.Utils;
import com.android.systemui.Dumpable;
import com.android.systemui.GuestResumeSessionReceiver;
import com.android.systemui.Prefs;
@@ -684,18 +682,17 @@ public class UserSwitcherController implements Dumpable {
}
}
- public Drawable getDrawable(Context context, UserRecord item) {
+ protected static Drawable getIconDrawable(Context context, UserRecord item) {
+ int iconRes;
if (item.isAddUser) {
- return context.getDrawable(R.drawable.ic_add_circle_qs);
- }
- Drawable icon = UserIcons.getDefaultUserIcon(
- context.getResources(), item.resolveId(), /* light= */ false);
- if (item.isGuest) {
- icon.setColorFilter(Utils.getColorAttrDefaultColor(context,
- android.R.attr.colorForeground),
- Mode.SRC_IN);
+ iconRes = R.drawable.ic_add_circle;
+ } else if (item.isGuest) {
+ iconRes = R.drawable.ic_avatar_guest_user;
+ } else {
+ iconRes = R.drawable.ic_avatar_user;
}
- return icon;
+
+ return context.getDrawable(iconRes);
}
public void refresh() {
diff --git a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
index ed54ad13e5e1..737b7c7b9caf 100644
--- a/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
+++ b/wifi/java/android/net/wifi/WifiNetworkSpecifier.java
@@ -21,7 +21,6 @@ import static com.android.internal.util.Preconditions.checkNotNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.net.MacAddress;
-import android.net.MatchAllNetworkSpecifier;
import android.net.NetworkRequest;
import android.net.NetworkSpecifier;
import android.os.Parcel;
@@ -553,13 +552,6 @@ public final class WifiNetworkSpecifier extends NetworkSpecifier implements Parc
/** @hide */
@Override
public boolean canBeSatisfiedBy(NetworkSpecifier other) {
- if (this == other) {
- return true;
- }
- // Any generic requests should be satisifed by a specific wifi network.
- if (other == null || other instanceof MatchAllNetworkSpecifier) {
- return true;
- }
if (other instanceof WifiNetworkAgentSpecifier) {
return ((WifiNetworkAgentSpecifier) other).satisfiesNetworkSpecifier(this);
}
diff --git a/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java b/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java
index 53a7d032da42..fc0ef469ad80 100644
--- a/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java
+++ b/wifi/tests/src/android/net/wifi/WifiNetworkSpecifierTest.java
@@ -382,11 +382,11 @@ public class WifiNetworkSpecifierTest {
/**
* Validate NetworkSpecifier matching.
* a) Create a network specifier for WPA_PSK network
- * b) Ensure that the specifier matches {@code null} and {@link MatchAllNetworkSpecifier}
+ * b) Ensure that the specifier does not match {@code null} and {@link MatchAllNetworkSpecifier}
* specifiers.
*/
@Test
- public void testWifiNetworkSpecifierSatisfiesNullAndAllMatch() {
+ public void testWifiNetworkSpecifierDoesNotSatisfyNullAndAllMatch() {
WifiConfiguration wifiConfiguration = new WifiConfiguration();
wifiConfiguration.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
wifiConfiguration.preSharedKey = TEST_PRESHARED_KEY;
@@ -396,8 +396,8 @@ public class WifiNetworkSpecifierTest {
MacAddress.fromString(TEST_BSSID_OUI_MASK)),
wifiConfiguration);
- assertTrue(specifier.canBeSatisfiedBy(null));
- assertTrue(specifier.canBeSatisfiedBy(new MatchAllNetworkSpecifier()));
+ assertFalse(specifier.canBeSatisfiedBy(null));
+ assertFalse(specifier.canBeSatisfiedBy(new MatchAllNetworkSpecifier()));
}
/**