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

Commit 04223928 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge changes from topic "274106423" into udc-dev

* changes:
  Add a TileSpecRepository
  Add a TileSpec data type
  Add a log buffer for the new pipeline
parents 63fd54bb f428b8bd
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -40,13 +40,12 @@ public interface QSHost extends PanelInteractor {

    /**
     * Returns the default QS tiles for the context.
     * @param context the context to obtain the resources from
     * @param res the resources to use to determine the default tiles
     * @return a list of specs of the default tiles
     */
    static List<String> getDefaultSpecs(Context context) {
    static List<String> getDefaultSpecs(Resources res) {
        final ArrayList<String> tiles = new ArrayList();

        final Resources res = context.getResources();
        final String defaultTileList = res.getString(R.string.quick_settings_tiles_default);

        tiles.addAll(Arrays.asList(defaultTileList.split(",")));
+1 −1
Original line number Diff line number Diff line
@@ -600,7 +600,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
            if (tile.isEmpty()) continue;
            if (tile.equals("default")) {
                if (!addedDefault) {
                    List<String> defaultSpecs = QSHost.getDefaultSpecs(context);
                    List<String> defaultSpecs = QSHost.getDefaultSpecs(context.getResources());
                    for (String spec : defaultSpecs) {
                        if (!addedSpecs.contains(spec)) {
                            tiles.add(spec);
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ public class QSCustomizerController extends ViewController<QSCustomizer> {


    private void reset() {
        mTileAdapter.resetTileSpecs(QSHost.getDefaultSpecs(getContext()));
        mTileAdapter.resetTileSpecs(QSHost.getDefaultSpecs(getContext().getResources()));
    }

    public boolean isCustomizing() {
+7 −5
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.qs.AutoAddTracker;
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.ReduceBrightColorsController;
import com.android.systemui.qs.external.QSExternalModule;
import com.android.systemui.qs.pipeline.dagger.QSPipelineModule;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.statusbar.phone.AutoTileManager;
import com.android.systemui.statusbar.phone.ManagedProfileController;
@@ -40,14 +41,14 @@ import com.android.systemui.statusbar.policy.SafetyController;
import com.android.systemui.statusbar.policy.WalletController;
import com.android.systemui.util.settings.SecureSettings;

import java.util.Map;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;
import dagger.multibindings.Multibinds;

import java.util.Map;

import javax.inject.Named;

/**
 * Module for QS dependencies
 */
@@ -56,7 +57,8 @@ import dagger.multibindings.Multibinds;
                MediaModule.class,
                QSExternalModule.class,
                QSFlagsModule.class,
                QSHostModule.class
                QSHostModule.class,
                QSPipelineModule.class,
        }
)
public interface QSModule {
+57 −0
Original line number Diff line number Diff line
/*
 * 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.
 * 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.
 */

package com.android.systemui.qs.pipeline.dagger

import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.log.LogBufferFactory
import com.android.systemui.plugins.log.LogBuffer
import com.android.systemui.qs.pipeline.data.repository.TileSpecRepository
import com.android.systemui.qs.pipeline.data.repository.TileSpecSettingsRepository
import com.android.systemui.qs.pipeline.prototyping.PrototypeCoreStartable
import com.android.systemui.qs.pipeline.shared.logging.QSPipelineLogger
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap

@Module
abstract class QSPipelineModule {

    /** Implementation for [TileSpecRepository] */
    @Binds
    abstract fun provideTileSpecRepository(impl: TileSpecSettingsRepository): TileSpecRepository

    @Binds
    @IntoMap
    @ClassKey(PrototypeCoreStartable::class)
    abstract fun providePrototypeCoreStartable(startable: PrototypeCoreStartable): CoreStartable

    companion object {
        /**
         * Provides a logging buffer for all logs related to the new Quick Settings pipeline to log
         * the list of current tiles.
         */
        @Provides
        @SysUISingleton
        @QSTileListLog
        fun provideQSTileListLogBuffer(factory: LogBufferFactory): LogBuffer {
            return factory.create(QSPipelineLogger.TILE_LIST_TAG, maxSize = 700, systrace = false)
        }
    }
}
Loading