Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 634d5420 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixes ThemeSettings Parcel writing." into main

parents b8d0ac29 503170cb
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -151,14 +151,12 @@ public abstract sealed class ThemeSettings implements Parcelable permits ThemeSe
        @Override
        public ThemeSettings createFromParcel(Parcel in) {
            // The first string read is the concrete type, used by the sealed class's parceling
            // to delegate to the correct subclass constructor.
            // We then read the actual type string that we wrote in the subclass's writeToParcel.
            in.readString(); // Consume the type written by the sealed class itself for dispatch
            String type = in.readString(); // This is the type we're interested in
            // to delegate to the correct subclass constructor..
            String type = in.readString();
            return switch (type) {
                case VALUE_HOME_WALLPAPER -> new ThemeSettingsWallpaper(in);
                case VALUE_PRESET -> new ThemeSettingsPreset(in);
                default -> throw new IllegalArgumentException(
                case null, default -> throw new IllegalArgumentException(
                        "Invalid type for ThemeSetting: " + type);
            };
        }
+1 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.theming;

import static android.content.theming.FieldColorSource.VALUE_HOME_WALLPAPER;
import static android.content.theming.FieldColorSource.VALUE_PRESET;
import static android.content.theming.ThemeSettings.OVERLAY_CATEGORY_ACCENT_COLOR;
import static android.content.theming.ThemeSettings.OVERLAY_CATEGORY_SYSTEM_PALETTE;
@@ -105,7 +104,6 @@ public class ThemeSettingsTests {
        ThemeSettings originalSettings = ThemeSettings.fromJson(WALLPAPER_JSON);

        Parcel parcel = Parcel.obtain();
        parcel.writeString(VALUE_HOME_WALLPAPER);
        originalSettings.writeToParcel(parcel, 0);
        parcel.setDataPosition(0);

@@ -122,7 +120,6 @@ public class ThemeSettingsTests {
        ThemeSettings originalSettings = ThemeSettings.fromJson(PRESET_JSON);

        Parcel parcel = Parcel.obtain();
        parcel.writeString(VALUE_PRESET);
        originalSettings.writeToParcel(parcel, 0);
        parcel.setDataPosition(0);