Merge "Apply android accent color" into sc-dev
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index b9f5009..bb414ad 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -1125,22 +1125,6 @@
         priority="4"
         summary="Using hardcoded color"
         explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
-        errorLine1="    <color name="contextual_card_stroke_color">#1f000000</color>"
-        errorLine2="    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
-        <location
-            file="res/values/colors.xml"
-            line="106"
-            column="5"/>
-    </issue>
-
-    <issue
-        id="HardCodedColor"
-        severity="Error"
-        message="Avoid using hardcoded color"
-        category="Correctness"
-        priority="4"
-        summary="Using hardcoded color"
-        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
         errorLine1="    &lt;color name=&quot;switchbar_switch_track_tint&quot;>#BFFFFFFF&lt;/color>"
         errorLine2="    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
@@ -4293,22 +4277,6 @@
         priority="4"
         summary="Using hardcoded color"
         explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
-        errorLine1="        &lt;item name=&quot;strokeColor&quot;>@color/contextual_card_stroke_color&lt;/item>"
-        errorLine2="                                 ^">
-        <location
-            file="res/values/styles.xml"
-            line="475"
-            column="34"/>
-    </issue>
-
-    <issue
-        id="HardCodedColor"
-        severity="Error"
-        message="Avoid using hardcoded color"
-        category="Correctness"
-        priority="4"
-        summary="Using hardcoded color"
-        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
         errorLine1="        &lt;item name=&quot;android:trackTint&quot;>@color/switchbar_switch_track_tint&lt;/item>"
         errorLine2="                                       ^">
         <location
diff --git a/res/layout/card_preference_layout.xml b/res/layout/card_preference_layout.xml
index bcaeb86..90e3388 100644
--- a/res/layout/card_preference_layout.xml
+++ b/res/layout/card_preference_layout.xml
@@ -29,6 +29,6 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginStart="-8dp"
-            layout="@layout/preference_material" />
+            layout="@layout/settingslib_preference" />
     </com.google.android.material.card.MaterialCardView>
 </FrameLayout>
diff --git a/res/layout/remove_account_button.xml b/res/layout/remove_account_button.xml
index 6b47c37..070ecc5 100644
--- a/res/layout/remove_account_button.xml
+++ b/res/layout/remove_account_button.xml
@@ -20,13 +20,14 @@
     android:orientation="vertical">
 
     <Button
-      android:id="@+id/button"
-      android:text="@string/remove_account_label"
-      android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_gravity="center_horizontal"
-      android:layout_marginTop="20dip"
-      android:layout_marginBottom="12dip"
-      android:gravity="center" />
+        android:id="@+id/button"
+        android:text="@string/remove_account_label"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginTop="20dp"
+        android:layout_marginBottom="12dp"
+        android:gravity="center"
+        style="@style/ActionPrimaryButton" />
 
 </LinearLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 0b26c13..db525d5 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -103,9 +103,7 @@
     <color name="homepage_wallpaper_background">#E51AD1</color>
     <color name="homepage_notification_background">#DD4C9D</color>
 
-    <color name="contextual_card_stroke_color">#1f000000</color>
     <color name="contextual_card_dismissal_background">@*android:color/material_grey_100</color>
-    <color name="contextual_card_background">@*android:color/background_device_default_light</color>
     <!-- End of dashboard/homepage icon background colors -->
 
     <color name="switchbar_background_color">@*android:color/material_grey_600</color>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 6021a7c..80452d2 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -13,7 +13,8 @@
      limitations under the License.
 -->
 
-<resources>
+<resources
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
 
     <style name="Widget.ActionBar.Base"
            parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid"/>
@@ -417,6 +418,8 @@
 
     <style name="RoundedCornerThemeOverlay">
         <item name="android:buttonCornerRadius">24dp</item>
+        <item name="android:paddingStart">16dp</item>
+        <item name="android:paddingEnd">16dp</item>
     </style>
 
     <style name="LockPatternContainerStyle">
@@ -470,11 +473,9 @@
         <item name="android:layout_marginBottom">@dimen/contextual_card_vertical_margin</item>
         <item name="android:layout_marginStart">@dimen/contextual_card_side_margin</item>
         <item name="android:layout_marginEnd">@dimen/contextual_card_side_margin</item>
-        <item name="cardBackgroundColor">@color/contextual_card_background</item>
+        <item name="cardBackgroundColor">?androidprv:attr/colorSurface</item>
         <item name="cardCornerRadius">@dimen/contextual_card_corner_radius</item>
         <item name="cardElevation">0dp</item>
-        <item name="strokeColor">@color/contextual_card_stroke_color</item>
-        <item name="strokeWidth">1dp</item>
         <item name="rippleColor">?android:attr/colorControlHighlight</item>
     </style>
 
diff --git a/res/xml/storage_category_fragment.xml b/res/xml/storage_category_fragment.xml
index fb62bee..08f3f27 100644
--- a/res/xml/storage_category_fragment.xml
+++ b/res/xml/storage_category_fragment.xml
@@ -19,7 +19,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:title="@string/storage_settings">
-    <Preference
+    <com.android.settings.widget.CardPreference
         android:key="free_up_space"
         android:order="4"
         android:title="@string/storage_free_up_space_title"
diff --git a/res/xml/storage_dashboard_fragment.xml b/res/xml/storage_dashboard_fragment.xml
index fff3235..8edf4bf 100644
--- a/res/xml/storage_dashboard_fragment.xml
+++ b/res/xml/storage_dashboard_fragment.xml
@@ -38,7 +38,7 @@
         android:icon="@drawable/ic_storage"
         android:order="3"
         settings:controller="com.android.settings.deviceinfo.storage.AutomaticStorageManagementSwitchPreferenceController"/>
-    <Preference
+    <com.android.settings.widget.CardPreference
         android:key="free_up_space"
         android:order="4"
         android:title="@string/storage_free_up_space_title"
diff --git a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
index 0064e6c..146b575 100644
--- a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
+++ b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java
@@ -30,12 +30,14 @@
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.settings.R;
 import com.android.settings.SidecarFragment;
+import com.android.settings.core.SettingsBaseActivity;
 import com.android.settings.network.EnableMultiSimSidecar;
 import com.android.settings.network.SubscriptionUtil;
 import com.android.settings.network.SwitchToEuiccSubscriptionSidecar;
 import com.android.settings.network.SwitchToRemovableSlotSidecar;
 import com.android.settings.network.UiccSlotUtil;
 import com.android.settings.sim.SimActivationNotifier;
+import com.android.settingslib.transition.SettingsTransitionHelper;
 
 import com.google.common.collect.ImmutableList;
 
@@ -68,6 +70,9 @@
         Intent intent = new Intent(context, ToggleSubscriptionDialogActivity.class);
         intent.putExtra(ARG_SUB_ID, subId);
         intent.putExtra(ARG_enable, enable);
+        // suppress page transition as this is a dialog
+        intent.putExtra(SettingsBaseActivity.EXTRA_PAGE_TRANSITION_TYPE,
+                SettingsTransitionHelper.TransitionType.TRANSITION_NONE);
         return intent;
     }
 
diff --git a/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java b/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
index 5b2cdb9..d715ce4 100644
--- a/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
+++ b/src/com/android/settings/notification/app/RecentConversationsPreferenceController.java
@@ -141,9 +141,9 @@
         int order = 100;
         boolean hasClearable = false;
         for (ConversationChannel conversation : conversations) {
-            if (conversation.getParentNotificationChannel().getImportance() == IMPORTANCE_NONE
-                    || (conversation.getParentNotificationChannelGroup() != null
-                    && conversation.getParentNotificationChannelGroup().isBlocked())) {
+            if (conversation.getNotificationChannel().getImportance() == IMPORTANCE_NONE
+                    || (conversation.getNotificationChannelGroup() != null
+                    && conversation.getNotificationChannelGroup().isBlocked())) {
                 continue;
             }
             RecentConversationPreference pref =
@@ -179,12 +179,12 @@
         pref.setSummary(getSummary(conversation));
         pref.setIcon(mBackend.getConversationDrawable(mContext, conversation.getShortcutInfo(),
                 pkg, uid, false));
-        pref.setKey(conversation.getParentNotificationChannel().getId()
+        pref.setKey(conversation.getNotificationChannel().getId()
                 + ":" + conversationId);
         pref.setOnPreferenceClickListener(preference -> {
             mBackend.createConversationNotificationChannel(
                     pkg, uid,
-                    conversation.getParentNotificationChannel(),
+                    conversation.getNotificationChannel(),
                     conversationId);
             getSubSettingLauncher(conversation, pref.getTitle()).launch();
             return true;
@@ -194,11 +194,11 @@
     }
 
     CharSequence getSummary(ConversationChannel conversation) {
-        return conversation.getParentNotificationChannelGroup() == null
-                ? conversation.getParentNotificationChannel().getName()
+        return conversation.getNotificationChannelGroup() == null
+                ? conversation.getNotificationChannel().getName()
                 : mContext.getString(R.string.notification_conversation_summary,
-                        conversation.getParentNotificationChannel().getName(),
-                        conversation.getParentNotificationChannelGroup().getName());
+                        conversation.getNotificationChannel().getName(),
+                        conversation.getNotificationChannelGroup().getName());
     }
 
     CharSequence getTitle(ConversationChannel conversation) {
@@ -213,7 +213,7 @@
         channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME,
                 conversation.getShortcutInfo().getPackage());
         channelArgs.putString(Settings.EXTRA_CHANNEL_ID,
-                conversation.getParentNotificationChannel().getId());
+                conversation.getNotificationChannel().getId());
         channelArgs.putString(Settings.EXTRA_CONVERSATION_ID,
                 conversation.getShortcutInfo().getId());
 
@@ -235,8 +235,8 @@
                             o2.getShortcutInfo().getLabel());
 
                     if (labelComparison == 0) {
-                        return o1.getParentNotificationChannel().getId().compareTo(
-                                o2.getParentNotificationChannel().getId());
+                        return o1.getNotificationChannel().getId().compareTo(
+                                o2.getNotificationChannel().getId());
                     }
 
                     return labelComparison;
diff --git a/src/com/android/settings/widget/CardPreference.java b/src/com/android/settings/widget/CardPreference.java
index 20ea710..c041552 100644
--- a/src/com/android/settings/widget/CardPreference.java
+++ b/src/com/android/settings/widget/CardPreference.java
@@ -29,6 +29,7 @@
  * Preference that wrapped by {@link MaterialCardView}, only support to set icon, title and summary
  */
 public class CardPreference extends Preference {
+
     public CardPreference(Context context) {
         this(context, null /* attrs */);
     }
diff --git a/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java
index 15bc598..f0ae7ab 100644
--- a/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/RecentConversationsPreferenceControllerTest.java
@@ -160,9 +160,9 @@
                 true);
 
         assertThat(mController.getSummary(ccw).toString()).contains(
-                ccw.getParentNotificationChannelGroup().getName());
+                ccw.getNotificationChannelGroup().getName());
         assertThat(mController.getSummary(ccw).toString()).contains(
-                ccw.getParentNotificationChannel().getName());
+                ccw.getNotificationChannel().getName());
     }
 
     @Test
@@ -175,7 +175,7 @@
                 true);
 
         assertThat(mController.getSummary(ccw).toString()).isEqualTo(
-                ccw.getParentNotificationChannel().getName());
+                ccw.getNotificationChannel().getName());
     }
 
     @Test
@@ -207,7 +207,7 @@
                 ccw.getShortcutInfo().getPackage());
         assertThat(extras.getInt(AppInfoBase.ARG_PACKAGE_UID)).isEqualTo(ccw.getUid());
         assertThat(extras.getString(Settings.EXTRA_CHANNEL_ID)).isEqualTo(
-                ccw.getParentNotificationChannel().getId());
+                ccw.getNotificationChannel().getId());
         assertThat(extras.getString(Settings.EXTRA_CONVERSATION_ID)).isEqualTo(
                 ccw.getShortcutInfo().getId());
     }
@@ -230,7 +230,7 @@
             // expected since it tries to launch an activity
         }
         verify(mBackend).createConversationNotificationChannel(
-                si.getPackage(), ccw.getUid(), ccw.getParentNotificationChannel(), si.getId());
+                si.getPackage(), ccw.getUid(), ccw.getNotificationChannel(), si.getId());
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/widget/CardPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/CardPreferenceTest.java
index 6d4a6bb..85ab609 100644
--- a/tests/robotests/src/com/android/settings/widget/CardPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/CardPreferenceTest.java
@@ -45,5 +45,4 @@
     public void getLayoutResource() {
         assertThat(mCardPreference.getLayoutResource()).isEqualTo(R.layout.card_preference_layout);
     }
-
 }