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

Commit f74230f0 authored by Chen Bai's avatar Chen Bai
Browse files

m3: wear material3 button style can only override DeviceDefault theme

Platform Wear Material3 should only override Theme.DeviceDefault
instead of dicatating all themes.

Flag: android.widget.flags.use_wear_material3_ui
Test: manual & cts
Bug: 376561342
Bug: 380281547
Bug: 380312688
Change-Id: Ibbe9b754887eb478dd51752ec24bec75ac5f0853
parent 41683230
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ public class Button extends TextView {
        // 1. app target sdk is 36 or above.
        // 2. feature flag rolled-out.
        // 3. device is a watch.
        // 4. button uses Theme.DeviceDefault.
        // getButtonDefaultStyleAttr and getButtonDefaultStyleRes works together to alter the UI
        // while considering the conditions above.
        // Their results are mutual exclusive. i.e. when conditions above are all true,
@@ -229,6 +230,7 @@ public class Button extends TextView {

    private static boolean useWearMaterial3Style(Context context) {
        return Flags.useWearMaterial3Ui() && CompatChanges.isChangeEnabled(WEAR_MATERIAL3_BUTTON)
                && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
                && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
                && context.getThemeResId() == com.android.internal.R.style.Theme_DeviceDefault;
    }
}