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

Commit ee2f5966 authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Eliminate reflective form factor aware initialization

This CL removes the runtime instantiation of the form-factor specific
SystemUIInitializer via reflection, which is no longer necessary since
Android TV moved to use a dedicated TvSystemUI target.

This reduces the size of the SystemUI.apk by 500 KB by enabling R8 to
discard TV-specific classes.

Test: make
Bug: 282633512
Change-Id: I30cdb0c2a26e631594bb4bd9ddcecd329de10325
parent 0bec56ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@
        android:defaultToDeviceProtectedStorage="true"
        android:directBootAware="true"
        tools:replace="android:appComponentFactory"
        android:appComponentFactory=".SystemUIAppComponentFactory">
        android:appComponentFactory=".PhoneSystemUIAppComponentFactory">
        <!-- Keep theme in sync with SystemUIApplication.onCreate().
             Setting the theme on the application does not affect views inflated by services.
             The application theme is set again from onCreate to take effect for those views. -->
+1 −7
Original line number Diff line number Diff line
-include proguard_common.flags

-keep class com.android.systemui.statusbar.tv.TvStatusBar
-keep class com.android.systemui.SystemUIInitializerImpl {
    *;
}

-keep class com.android.systemui.tv.TvSystemUIInitializer {
    *;
}

-keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.DaggerReferenceGlobalRootComponent** { !synthetic *; }
 No newline at end of file
-keep,allowoptimization,allowaccessmodification class com.android.systemui.tv.DaggerTvGlobalRootComponent** { !synthetic *; }
 No newline at end of file
+0 −5
Original line number Diff line number Diff line
@@ -20,11 +20,6 @@
<!-- These resources are around just to allow their values to be customized
     for different hardware and product builds. -->
<resources>
    <!-- SystemUIFactory component -->
    <string name="config_systemUIFactoryComponent" translatable="false">
        com.android.systemui.tv.TvSystemUIInitializer
    </string>

    <!-- Svelte specific logic, see RecentsConfiguration.SVELTE_* constants. -->
    <integer name="recents_svelte_level">3</integer>

+0 −3
Original line number Diff line number Diff line
@@ -302,9 +302,6 @@
    <!-- Determines whether the shell features all run on another thread. -->
    <bool name="config_enableShellMainThread">true</bool>

    <!-- SystemUIFactory component -->
    <string name="config_systemUIFactoryComponent" translatable="false">com.android.systemui.SystemUIInitializerImpl</string>

    <!-- QS tile shape store width. negative implies fill configuration instead of stroke-->
    <dimen name="config_qsTileStrokeWidthActive">-1dp</dimen>
    <dimen name="config_qsTileStrokeWidthInactive">-1dp</dimen>
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 * Copyright (C) 2023 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.
@@ -14,24 +14,10 @@
 * limitations under the License.
 */

package com.android.systemui;
package com.android.systemui

import android.content.Context;
import android.content.Context

/**
 * Starts up SystemUI using the AOSP {@link SystemUIInitializerImpl}.
 *
 * This initializer relies on reflection to start everything up and should be considered deprecated.
 * Instead, create your own {@link SystemUIAppComponentFactoryBase}, specify it in your
 * AndroidManifest.xml and construct your own {@link SystemUIInitializer} directly.
 *
 * @deprecated Define your own SystemUIAppComponentFactoryBase implementation and use that. This
 *             implementation may be changed or removed in future releases.
 */
@Deprecated
public class SystemUIAppComponentFactory extends SystemUIAppComponentFactoryBase {
    @Override
    protected SystemUIInitializer createSystemUIInitializer(Context context) {
        return SystemUIInitializerFactory.createWithContext(context);
    }
class PhoneSystemUIAppComponentFactory : SystemUIAppComponentFactoryBase() {
    override fun createSystemUIInitializer(context: Context) = SystemUIInitializerImpl(context)
}
Loading